1
1
#pragma once
2
2
3
3
#include " RE/B/BSFixedString.h"
4
- #include " RE/B/BSTSmartPointer.h"
5
- #include " RE/I/IVirtualMachine.h"
6
- #include " RE/V/VirtualMachine.h"
7
4
#include " RE/B/BSTScatterTable.h"
8
- #include " RE/T/TESForm .h"
5
+ #include " RE/B/BSTSmartPointer .h"
9
6
#include " RE/G/GameVM.h"
10
- #include " SFSE/Logger.h"
11
- #include " SFSE/SFSE.h"
12
- #include " RE/O/ObjectTypeInfo.h"
7
+ #include " RE/I/IVirtualMachine.h"
8
+ #include " RE/N/NativeFunctionBase.h"
13
9
#include " RE/O/Object.h"
10
+ #include " RE/O/ObjectTypeInfo.h"
14
11
#include " RE/S/StackFrame.h"
15
12
#include " RE/S/Struct.h"
16
- #include " RE/N/NativeFunctionBase.h"
13
+ #include " RE/T/TESForm.h"
14
+ #include " RE/V/VirtualMachine.h"
15
+ #include " SFSE/Logger.h"
16
+ #include " SFSE/SFSE.h"
17
17
18
18
namespace RE ::BSScript
19
19
{
@@ -83,7 +83,7 @@ namespace RE::BSScript
83
83
{
84
84
if (_proxy && _proxy->type ) {
85
85
const auto & mappings = _proxy->type ->varNameIndexMap ;
86
- const auto it = mappings.find (a_name);
86
+ const auto it = mappings.find (a_name);
87
87
if (it != mappings.end ()) {
88
88
const auto & var = _proxy->variables [it->Value ];
89
89
return detail::UnpackVariable<T>(var);
@@ -104,7 +104,7 @@ namespace RE::BSScript
104
104
bool insert (std::string_view a_name, T&& a_val)
105
105
{
106
106
if (_proxy && _proxy->type ) {
107
- auto & mappings = _proxy->type ->varNameIndexMap ;
107
+ auto & mappings = _proxy->type ->varNameIndexMap ;
108
108
const auto it = mappings.find (a_name);
109
109
if (it != mappings.end ()) {
110
110
auto & var = _proxy->variables [it->Value ];
@@ -303,13 +303,12 @@ namespace RE::BSScript
303
303
std::true_type> &&
304
304
std::is_default_constructible_v<T> &&
305
305
((array<typename T::value_type> || wrapper<typename T::value_type>)) && //
306
- requires (T a_nullable)
307
- {
308
- // clang-format off
306
+ requires (T a_nullable) {
307
+ // clang-format off
309
308
static_cast <bool >(a_nullable);
310
309
{ *static_cast <T&&>(a_nullable) } -> decays_to<typename T::value_type>;
311
- // clang-format on
312
- };
310
+ // clang-format on
311
+ };
313
312
314
313
template <class T >
315
314
concept valid_self =
@@ -377,8 +376,8 @@ namespace RE::BSScript
377
376
template <detail::object T>
378
377
[[nodiscard]] std::optional<TypeInfo> GetTypeInfo ()
379
378
{
380
- const auto game = GameVM::GetSingleton ();
381
- const auto vm = game ? game->GetVM () : nullptr ;
379
+ const auto game = GameVM::GetSingleton ();
380
+ const auto vm = game ? game->GetVM () : nullptr ;
382
381
BSTSmartPointer<ObjectTypeInfo> typeInfo;
383
382
if (!vm ||
384
383
!vm->GetScriptObjectType (GetVMTypeID<T>(), typeInfo) ||
@@ -394,10 +393,10 @@ namespace RE::BSScript
394
393
template <detail::vmobject T>
395
394
[[nodiscard]] std::optional<TypeInfo> GetTypeInfo ()
396
395
{
397
- const auto game = GameVM::GetSingleton ();
398
- const auto vm = game ? game->GetVM () : nullptr ;
396
+ const auto game = GameVM::GetSingleton ();
397
+ const auto vm = game ? game->GetVM () : nullptr ;
399
398
REL::Relocation<RE::BSFixedString*> baseObjectName{ REL::ID (648543 ) };
400
- BSTSmartPointer<ObjectTypeInfo> typeInfo;
399
+ BSTSmartPointer<ObjectTypeInfo> typeInfo;
401
400
if (!vm ||
402
401
!vm->GetScriptObjectType (*baseObjectName, typeInfo) ||
403
402
!typeInfo) {
@@ -498,8 +497,8 @@ namespace RE::BSScript
498
497
}
499
498
500
499
const auto success = [&]() {
501
- const auto game = GameVM::GetSingleton ();
502
- const auto vm = game ? game->GetVM () : nullptr ;
500
+ const auto game = GameVM::GetSingleton ();
501
+ const auto vm = game ? game->GetVM () : nullptr ;
503
502
BSTSmartPointer<ObjectTypeInfo> typeInfo;
504
503
if (!vm ||
505
504
!vm->GetScriptObjectType (GetVMTypeID<T>(), typeInfo) ||
@@ -508,10 +507,10 @@ namespace RE::BSScript
508
507
}
509
508
510
509
const auto & handles = vm->GetObjectHandlePolicy ();
511
- const auto handle = handles.GetHandleForObject (
512
- GetVMTypeID<T>(),
513
- const_cast <const void *>(
514
- static_cast <const volatile void *>(a_val)));
510
+ const auto handle = handles.GetHandleForObject (
511
+ GetVMTypeID<T>(),
512
+ const_cast <const void *>(
513
+ static_cast <const volatile void *>(a_val)));
515
514
if (handle == handles.EmptyHandle ()) {
516
515
return false ;
517
516
}
@@ -594,10 +593,10 @@ namespace RE::BSScript
594
593
typename std::remove_cvref_t <T>::value_type&&>;
595
594
596
595
const auto success = [&]() {
597
- const auto game = GameVM::GetSingleton ();
598
- const auto vm = game ? game->GetVM () : nullptr ;
599
- const auto typeInfo = GetTypeInfo<std::remove_cvref_t <T>>();
600
- const auto size = a_val.size ();
596
+ const auto game = GameVM::GetSingleton ();
597
+ const auto vm = game ? game->GetVM () : nullptr ;
598
+ const auto typeInfo = GetTypeInfo<std::remove_cvref_t <T>>();
599
+ const auto size = a_val.size ();
601
600
BSTSmartPointer<Array> out;
602
601
if (!typeInfo ||
603
602
!vm ||
@@ -643,7 +642,7 @@ namespace RE::BSScript
643
642
namespace detail
644
643
{
645
644
template <class T >
646
- __forceinline void PackVariable (Variable & a_var, T && a_val)
645
+ __forceinline void PackVariable (Variable& a_var, T&& a_val)
647
646
{
648
647
BSScript::PackVariable (a_var, std::forward<T>(a_val));
649
648
}
@@ -677,7 +676,7 @@ namespace RE::BSScript
677
676
}
678
677
679
678
const auto & handles = vm->GetObjectHandlePolicy ();
680
- const auto handle = object->GetHandle ();
679
+ const auto handle = object->GetHandle ();
681
680
if (!handles.IsHandleLoaded (handle)) {
682
681
return nullptr ;
683
682
}
@@ -776,7 +775,7 @@ namespace RE::BSScript
776
775
777
776
using value_type = typename T::value_type;
778
777
779
- T out;
778
+ T out;
780
779
const auto in = get<Array>(a_var);
781
780
for (const auto & var : in->elements ) {
782
781
out.push_back (detail::UnpackVariable<value_type>(var));
@@ -905,12 +904,12 @@ namespace RE::BSScript
905
904
class F ,
906
905
std::size_t ... I>
907
906
decltype (auto ) DispatchHelper(
908
- Variable& a_self,
907
+ Variable& a_self,
909
908
Internal::VirtualMachine& a_vm,
910
- std::uint32_t a_stackID,
911
- const StackFrame& a_stackFrame,
912
- Stack& a_stack,
913
- const std::function<F>& a_callback,
909
+ std::uint32_t a_stackID,
910
+ const StackFrame& a_stackFrame,
911
+ Stack& a_stack,
912
+ const std::function<F>& a_callback,
914
913
std::index_sequence<I...>)
915
914
{
916
915
const auto self = [&]() -> S {
@@ -986,7 +985,8 @@ namespace RE::BSScript
986
985
template <class Fn >
987
986
NativeFunction (std::string_view a_object, std::string_view a_function, Fn a_func, bool a_isLatent) //
988
987
requires (detail::invocable_r<Fn, R, S, Args...> ||
989
- detail::invocable_r<Fn, R, IVirtualMachine&, std::uint32_t , S, Args...>) :
988
+ detail::invocable_r<Fn, R, IVirtualMachine&, std::uint32_t , S, Args...>)
989
+ :
990
990
super (a_object, a_function, sizeof ...(Args), detail::static_tag<S>, a_isLatent),
991
991
_stub (std::move(a_func))
992
992
{
@@ -1060,11 +1060,11 @@ namespace RE::BSScript
1060
1060
1061
1061
template <class F >
1062
1062
void IVirtualMachine::BindNativeMethod (
1063
- stl::zstring a_object,
1064
- stl::zstring a_function,
1065
- F a_func,
1063
+ stl::zstring a_object,
1064
+ stl::zstring a_function,
1065
+ F a_func,
1066
1066
std::optional<bool > a_taskletCallable,
1067
- bool a_isLatent)
1067
+ bool a_isLatent)
1068
1068
{
1069
1069
NF_util::NativeFunctionBase* func = new NativeFunction (
1070
1070
a_object,
0 commit comments