11#pragma once
22
33#include " RE/B/BSFixedString.h"
4- #include " RE/B/BSTSmartPointer.h"
5- #include " RE/I/IVirtualMachine.h"
6- #include " RE/V/VirtualMachine.h"
74#include " RE/B/BSTScatterTable.h"
8- #include " RE/T/TESForm .h"
5+ #include " RE/B/BSTSmartPointer .h"
96#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"
139#include " RE/O/Object.h"
10+ #include " RE/O/ObjectTypeInfo.h"
1411#include " RE/S/StackFrame.h"
1512#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"
1717
1818namespace RE ::BSScript
1919{
@@ -83,7 +83,7 @@ namespace RE::BSScript
8383 {
8484 if (_proxy && _proxy->type ) {
8585 const auto & mappings = _proxy->type ->varNameIndexMap ;
86- const auto it = mappings.find (a_name);
86+ const auto it = mappings.find (a_name);
8787 if (it != mappings.end ()) {
8888 const auto & var = _proxy->variables [it->Value ];
8989 return detail::UnpackVariable<T>(var);
@@ -104,7 +104,7 @@ namespace RE::BSScript
104104 bool insert (std::string_view a_name, T&& a_val)
105105 {
106106 if (_proxy && _proxy->type ) {
107- auto & mappings = _proxy->type ->varNameIndexMap ;
107+ auto & mappings = _proxy->type ->varNameIndexMap ;
108108 const auto it = mappings.find (a_name);
109109 if (it != mappings.end ()) {
110110 auto & var = _proxy->variables [it->Value ];
@@ -303,13 +303,12 @@ namespace RE::BSScript
303303 std::true_type> &&
304304 std::is_default_constructible_v<T> &&
305305 ((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
309308 static_cast <bool >(a_nullable);
310309 { *static_cast <T&&>(a_nullable) } -> decays_to<typename T::value_type>;
311- // clang-format on
312- };
310+ // clang-format on
311+ };
313312
314313 template <class T >
315314 concept valid_self =
@@ -377,8 +376,8 @@ namespace RE::BSScript
377376 template <detail::object T>
378377 [[nodiscard]] std::optional<TypeInfo> GetTypeInfo ()
379378 {
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 ;
382381 BSTSmartPointer<ObjectTypeInfo> typeInfo;
383382 if (!vm ||
384383 !vm->GetScriptObjectType (GetVMTypeID<T>(), typeInfo) ||
@@ -394,10 +393,10 @@ namespace RE::BSScript
394393 template <detail::vmobject T>
395394 [[nodiscard]] std::optional<TypeInfo> GetTypeInfo ()
396395 {
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 ;
399398 REL::Relocation<RE::BSFixedString*> baseObjectName{ REL::ID (648543 ) };
400- BSTSmartPointer<ObjectTypeInfo> typeInfo;
399+ BSTSmartPointer<ObjectTypeInfo> typeInfo;
401400 if (!vm ||
402401 !vm->GetScriptObjectType (*baseObjectName, typeInfo) ||
403402 !typeInfo) {
@@ -498,8 +497,8 @@ namespace RE::BSScript
498497 }
499498
500499 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 ;
503502 BSTSmartPointer<ObjectTypeInfo> typeInfo;
504503 if (!vm ||
505504 !vm->GetScriptObjectType (GetVMTypeID<T>(), typeInfo) ||
@@ -508,10 +507,10 @@ namespace RE::BSScript
508507 }
509508
510509 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)));
515514 if (handle == handles.EmptyHandle ()) {
516515 return false ;
517516 }
@@ -594,10 +593,10 @@ namespace RE::BSScript
594593 typename std::remove_cvref_t <T>::value_type&&>;
595594
596595 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 ();
601600 BSTSmartPointer<Array> out;
602601 if (!typeInfo ||
603602 !vm ||
@@ -643,7 +642,7 @@ namespace RE::BSScript
643642 namespace detail
644643 {
645644 template <class T >
646- __forceinline void PackVariable (Variable & a_var, T && a_val)
645+ __forceinline void PackVariable (Variable& a_var, T&& a_val)
647646 {
648647 BSScript::PackVariable (a_var, std::forward<T>(a_val));
649648 }
@@ -677,7 +676,7 @@ namespace RE::BSScript
677676 }
678677
679678 const auto & handles = vm->GetObjectHandlePolicy ();
680- const auto handle = object->GetHandle ();
679+ const auto handle = object->GetHandle ();
681680 if (!handles.IsHandleLoaded (handle)) {
682681 return nullptr ;
683682 }
@@ -776,7 +775,7 @@ namespace RE::BSScript
776775
777776 using value_type = typename T::value_type;
778777
779- T out;
778+ T out;
780779 const auto in = get<Array>(a_var);
781780 for (const auto & var : in->elements ) {
782781 out.push_back (detail::UnpackVariable<value_type>(var));
@@ -905,12 +904,12 @@ namespace RE::BSScript
905904 class F ,
906905 std::size_t ... I>
907906 decltype (auto ) DispatchHelper(
908- Variable& a_self,
907+ Variable& a_self,
909908 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,
914913 std::index_sequence<I...>)
915914 {
916915 const auto self = [&]() -> S {
@@ -986,7 +985,8 @@ namespace RE::BSScript
986985 template <class Fn >
987986 NativeFunction (std::string_view a_object, std::string_view a_function, Fn a_func, bool a_isLatent) //
988987 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+ :
990990 super (a_object, a_function, sizeof ...(Args), detail::static_tag<S>, a_isLatent),
991991 _stub (std::move(a_func))
992992 {
@@ -1060,11 +1060,11 @@ namespace RE::BSScript
10601060
10611061 template <class F >
10621062 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,
10661066 std::optional<bool > a_taskletCallable,
1067- bool a_isLatent)
1067+ bool a_isLatent)
10681068 {
10691069 NF_util::NativeFunctionBase* func = new NativeFunction (
10701070 a_object,
0 commit comments