Skip to content

Commit

Permalink
ci: maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 24, 2024
1 parent fd25015 commit 9debf70
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 71 deletions.
86 changes: 43 additions & 43 deletions include/RE/B/BSScriptUtil.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#pragma once

#include "RE/B/BSFixedString.h"
#include "RE/B/BSTSmartPointer.h"
#include "RE/I/IVirtualMachine.h"
#include "RE/V/VirtualMachine.h"
#include "RE/B/BSTScatterTable.h"
#include "RE/T/TESForm.h"
#include "RE/B/BSTSmartPointer.h"
#include "RE/G/GameVM.h"
#include "SFSE/Logger.h"
#include "SFSE/SFSE.h"
#include "RE/O/ObjectTypeInfo.h"
#include "RE/I/IVirtualMachine.h"
#include "RE/N/NativeFunctionBase.h"
#include "RE/O/Object.h"
#include "RE/O/ObjectTypeInfo.h"
#include "RE/S/StackFrame.h"
#include "RE/S/Struct.h"
#include "RE/N/NativeFunctionBase.h"
#include "RE/T/TESForm.h"
#include "RE/V/VirtualMachine.h"
#include "SFSE/Logger.h"
#include "SFSE/SFSE.h"

namespace RE::BSScript
{
Expand Down Expand Up @@ -83,7 +83,7 @@ namespace RE::BSScript
{
if (_proxy && _proxy->type) {
const auto& mappings = _proxy->type->varNameIndexMap;
const auto it = mappings.find(a_name);
const auto it = mappings.find(a_name);
if (it != mappings.end()) {
const auto& var = _proxy->variables[it->Value];
return detail::UnpackVariable<T>(var);
Expand All @@ -104,7 +104,7 @@ namespace RE::BSScript
bool insert(std::string_view a_name, T&& a_val)
{
if (_proxy && _proxy->type) {
auto& mappings = _proxy->type->varNameIndexMap;
auto& mappings = _proxy->type->varNameIndexMap;
const auto it = mappings.find(a_name);
if (it != mappings.end()) {
auto& var = _proxy->variables[it->Value];
Expand Down Expand Up @@ -303,13 +303,12 @@ namespace RE::BSScript
std::true_type> &&
std::is_default_constructible_v<T> &&
((array<typename T::value_type> || wrapper<typename T::value_type>)) && //
requires(T a_nullable)
{
// clang-format off
requires(T a_nullable) {
// clang-format off
static_cast<bool>(a_nullable);
{ *static_cast<T&&>(a_nullable) } -> decays_to<typename T::value_type>;
// clang-format on
};
// clang-format on
};

template <class T>
concept valid_self =
Expand Down Expand Up @@ -377,8 +376,8 @@ namespace RE::BSScript
template <detail::object T>
[[nodiscard]] std::optional<TypeInfo> GetTypeInfo()
{
const auto game = GameVM::GetSingleton();
const auto vm = game ? game->GetVM() : nullptr;
const auto game = GameVM::GetSingleton();
const auto vm = game ? game->GetVM() : nullptr;
BSTSmartPointer<ObjectTypeInfo> typeInfo;
if (!vm ||
!vm->GetScriptObjectType(GetVMTypeID<T>(), typeInfo) ||
Expand All @@ -394,10 +393,10 @@ namespace RE::BSScript
template <detail::vmobject T>
[[nodiscard]] std::optional<TypeInfo> GetTypeInfo()
{
const auto game = GameVM::GetSingleton();
const auto vm = game ? game->GetVM() : nullptr;
const auto game = GameVM::GetSingleton();
const auto vm = game ? game->GetVM() : nullptr;
REL::Relocation<RE::BSFixedString*> baseObjectName{ REL::ID(648543) };
BSTSmartPointer<ObjectTypeInfo> typeInfo;
BSTSmartPointer<ObjectTypeInfo> typeInfo;
if (!vm ||
!vm->GetScriptObjectType(*baseObjectName, typeInfo) ||
!typeInfo) {
Expand Down Expand Up @@ -498,8 +497,8 @@ namespace RE::BSScript
}

const auto success = [&]() {
const auto game = GameVM::GetSingleton();
const auto vm = game ? game->GetVM() : nullptr;
const auto game = GameVM::GetSingleton();
const auto vm = game ? game->GetVM() : nullptr;
BSTSmartPointer<ObjectTypeInfo> typeInfo;
if (!vm ||
!vm->GetScriptObjectType(GetVMTypeID<T>(), typeInfo) ||
Expand All @@ -508,10 +507,10 @@ namespace RE::BSScript
}

const auto& handles = vm->GetObjectHandlePolicy();
const auto handle = handles.GetHandleForObject(
GetVMTypeID<T>(),
const_cast<const void*>(
static_cast<const volatile void*>(a_val)));
const auto handle = handles.GetHandleForObject(
GetVMTypeID<T>(),
const_cast<const void*>(
static_cast<const volatile void*>(a_val)));
if (handle == handles.EmptyHandle()) {
return false;
}
Expand Down Expand Up @@ -594,10 +593,10 @@ namespace RE::BSScript
typename std::remove_cvref_t<T>::value_type&&>;

const auto success = [&]() {
const auto game = GameVM::GetSingleton();
const auto vm = game ? game->GetVM() : nullptr;
const auto typeInfo = GetTypeInfo<std::remove_cvref_t<T>>();
const auto size = a_val.size();
const auto game = GameVM::GetSingleton();
const auto vm = game ? game->GetVM() : nullptr;
const auto typeInfo = GetTypeInfo<std::remove_cvref_t<T>>();
const auto size = a_val.size();
BSTSmartPointer<Array> out;
if (!typeInfo ||
!vm ||
Expand Down Expand Up @@ -643,7 +642,7 @@ namespace RE::BSScript
namespace detail
{
template <class T>
__forceinline void PackVariable(Variable & a_var, T && a_val)
__forceinline void PackVariable(Variable& a_var, T&& a_val)
{
BSScript::PackVariable(a_var, std::forward<T>(a_val));
}
Expand Down Expand Up @@ -677,7 +676,7 @@ namespace RE::BSScript
}

const auto& handles = vm->GetObjectHandlePolicy();
const auto handle = object->GetHandle();
const auto handle = object->GetHandle();
if (!handles.IsHandleLoaded(handle)) {
return nullptr;
}
Expand Down Expand Up @@ -776,7 +775,7 @@ namespace RE::BSScript

using value_type = typename T::value_type;

T out;
T out;
const auto in = get<Array>(a_var);
for (const auto& var : in->elements) {
out.push_back(detail::UnpackVariable<value_type>(var));
Expand Down Expand Up @@ -905,12 +904,12 @@ namespace RE::BSScript
class F,
std::size_t... I>
decltype(auto) DispatchHelper(
Variable& a_self,
Variable& a_self,
Internal::VirtualMachine& a_vm,
std::uint32_t a_stackID,
const StackFrame& a_stackFrame,
Stack& a_stack,
const std::function<F>& a_callback,
std::uint32_t a_stackID,
const StackFrame& a_stackFrame,
Stack& a_stack,
const std::function<F>& a_callback,
std::index_sequence<I...>)
{
const auto self = [&]() -> S {
Expand Down Expand Up @@ -986,7 +985,8 @@ namespace RE::BSScript
template <class Fn>
NativeFunction(std::string_view a_object, std::string_view a_function, Fn a_func, bool a_isLatent) //
requires(detail::invocable_r<Fn, R, S, Args...> ||
detail::invocable_r<Fn, R, IVirtualMachine&, std::uint32_t, S, Args...>) :
detail::invocable_r<Fn, R, IVirtualMachine&, std::uint32_t, S, Args...>)
:
super(a_object, a_function, sizeof...(Args), detail::static_tag<S>, a_isLatent),
_stub(std::move(a_func))
{
Expand Down Expand Up @@ -1060,11 +1060,11 @@ namespace RE::BSScript

template <class F>
void IVirtualMachine::BindNativeMethod(
stl::zstring a_object,
stl::zstring a_function,
F a_func,
stl::zstring a_object,
stl::zstring a_function,
F a_func,
std::optional<bool> a_taskletCallable,
bool a_isLatent)
bool a_isLatent)
{
NF_util::NativeFunctionBase* func = new NativeFunction(
a_object,
Expand Down
4 changes: 2 additions & 2 deletions include/RE/I/IFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include "RE/B/BSFixedString.h"
#include "RE/B/BSIntrusiveRefCounted.h"
#include "RE/T/TypeInfo.h"
#include "RE/S/StackFrame.h"
#include "RE/E/ErrorLogger.h"
#include "RE/S/StackFrame.h"
#include "RE/T/TypeInfo.h"

namespace RE::BSScript
{
Expand Down
14 changes: 7 additions & 7 deletions include/RE/I/IStackCallbackSaveInterface.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "RE/B/BSTSmartPointer.h"
#include "RE/B/BSIntrusiveRefCounted.h"
#include "RE/B/BSTSmartPointer.h"

namespace RE
{
Expand All @@ -18,12 +18,12 @@ namespace RE
virtual ~IStackCallbackFunctor(){}; // 00

// add
virtual void CallQueued() = 0; // 01
virtual void CallCanceled() = 0; // 02
virtual void StartMultiDispatch() = 0; // 03
virtual void EndMultiDispatch() = 0; // 04
virtual void operator()(Variable) = 0; // 05
virtual bool CanSave() { return false; }; // 06
virtual void CallQueued() = 0; // 01
virtual void CallCanceled() = 0; // 02
virtual void StartMultiDispatch() = 0; // 03
virtual void EndMultiDispatch() = 0; // 04
virtual void operator()(Variable) = 0; // 05
virtual bool CanSave() { return false; }; // 06
};
static_assert(sizeof(IStackCallbackFunctor) == 0x10);

Expand Down
8 changes: 4 additions & 4 deletions include/RE/I/IVirtualMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ namespace RE

template <class F>
void BindNativeMethod(
stl::zstring a_object,
stl::zstring a_function,
F a_func,
stl::zstring a_object,
stl::zstring a_function,
F a_func,
std::optional<bool> a_taskletCallable,
bool a_isLatent);
bool a_isLatent);

void PostError(std::string_view a_msg, std::uint32_t a_stackID, ErrorLogger::Severity a_severity)
{
Expand Down
10 changes: 5 additions & 5 deletions include/RE/N/NativeFunctionBase.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "RE/B/BSTTuple.h"
#include "RE/I/IFunction.h"
#include "RE/T/TypeInfo.h"
#include "RE/B/BSTTuple.h"

namespace RE::BSScript
{
Expand Down Expand Up @@ -49,9 +49,9 @@ namespace RE::BSScript
NativeFunctionBase(
std::string_view a_object,
std::string_view a_function,
std::uint16_t a_paramCount,
bool a_isStatic,
bool a_isLatent) :
std::uint16_t a_paramCount,
bool a_isStatic,
bool a_isLatent) :
_name(a_function),
_className(a_object),
_params(a_paramCount, 0),
Expand All @@ -74,7 +74,7 @@ namespace RE::BSScript
return a_dst;
}

virtual std::uint64_t GetParamCount() override { return _params.paramCount; }
virtual std::uint64_t GetParamCount() override { return _params.paramCount; }

virtual TypeInfo* GetParam(std::uint32_t a_idx, BSFixedString* a_nameOut, TypeInfo* a_typeOut) override
{
Expand Down
4 changes: 2 additions & 2 deletions include/RE/N/NiAVObject.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "RE/B/BSFixedString.h"
#include "RE/N/NiTransform.h"
#include "RE/N/NiBound.h"
#include "RE/N/NiTransform.h"

namespace RE
{
Expand Down Expand Up @@ -130,7 +130,7 @@ namespace RE
{
_InterlockedExchangeAdd(&refcount, 1);
}

void DecRefCount()
{
if (_InterlockedExchangeAdd(&refcount, -1) == 1)
Expand Down
12 changes: 6 additions & 6 deletions include/RE/S/StructTypeInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#include "RE/B/BSFixedString.h"
#include "RE/B/BSTArray.h"
#include "RE/B/BSTScatterTable.h"
#include "RE/B/BSTSmartPointer.h"
#include "RE/I/IComplexType.h"
#include "RE/O/ObjectTypeInfo.h"
#include "RE/T/TypeInfo.h"
#include "RE/V/Variable.h"
#include "RE/B/BSTScatterTable.h"

namespace RE::BSScript
{
Expand Down Expand Up @@ -52,11 +52,11 @@ namespace RE::BSScript
virtual TypeInfo::RawType GetRawType() const override { return TypeInfo::RawType::kStruct; } // 01

// members
BSFixedString name; // 10
BSTSmartPointer<ObjectTypeInfo> containingObjTypeInfo; // 18
BSTArray<StructVar> variables; // 20
BSTHashMap<BSFixedString, std::uint32_t> varNameIndexMap; // 30
stl::enumeration<LinkValidState, std::int32_t> linkedValid; // 68
BSFixedString name; // 10
BSTSmartPointer<ObjectTypeInfo> containingObjTypeInfo; // 18
BSTArray<StructVar> variables; // 20
BSTHashMap<BSFixedString, std::uint32_t> varNameIndexMap; // 30
stl::enumeration<LinkValidState, std::int32_t> linkedValid; // 68
};
static_assert(sizeof(StructTypeInfo) == 0x70);
}
4 changes: 2 additions & 2 deletions src/SFSE/API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ namespace SFSE
if (!allocated) {
trampoline.create(hookSize);
}

// Call to GameVM::BindEverythingToScript(IVirtualMachine**) from GameVM::GameVM()
REL::Relocation<uintptr_t> hookLoc{ REL::ID(169912), 0x514 };
func = reinterpret_cast<call_t>(trampoline.write_call<5>(hookLoc.address(), &thunk));
}

static void thunk(RE::BSScript::IVirtualMachine** a_vm)
{
func(a_vm);
Expand Down

0 comments on commit 9debf70

Please sign in to comment.