Skip to content

Commit

Permalink
chore: Move all offsets to Offsets.h
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitalita committed Oct 19, 2023
1 parent 2cad0c7 commit e90af28
Show file tree
Hide file tree
Showing 27 changed files with 358 additions and 93 deletions.
3 changes: 2 additions & 1 deletion CommonLibSF/include/RE/A/ActorValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "RE/B/BSTArray.h"
#include "RE/B/BSTSingleton.h"
#include "RE/Offsets.h"

namespace RE
{
Expand Down Expand Up @@ -37,7 +38,7 @@ namespace RE
[[nodiscard]] static ActorValue* GetSingleton()
{
using func_t = decltype(&ActorValue::GetSingleton);
REL::Relocation<func_t> func{ REL::ID(36266) };
REL::Relocation<func_t> func{ Offset::ActorValue::GetSingleton };
return func();
}

Expand Down
3 changes: 2 additions & 1 deletion CommonLibSF/include/RE/B/BGSObjectInstance.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

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

namespace RE
{
Expand All @@ -23,7 +24,7 @@ namespace RE
BGSObjectInstance* ctor(TESForm* a_object, TBO_InstanceData* a_instanceData)
{
using func_t = decltype(&BGSObjectInstance::ctor);
REL::Relocation<func_t> func{ REL::ID(101725) };
REL::Relocation<func_t> func{ Offset::BGSObjectInstance::ctor };
return func(this, a_object, a_instanceData);
}
};
Expand Down
10 changes: 6 additions & 4 deletions CommonLibSF/include/RE/B/BSStringPool.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "RE/Offsets.h"

namespace RE
{
struct BSStringPool
Expand All @@ -16,7 +18,7 @@ namespace RE
static void release(Entry*& a_entry)
{
using func_t = decltype(&Entry::release);
REL::Relocation<func_t> func{ REL::ID(36754) };
REL::Relocation<func_t> func{ Offset::BSStringPool::Entry::release };
return func(a_entry);
}

Expand Down Expand Up @@ -85,7 +87,7 @@ namespace RE
static BucketTable& GetSingleton()
{
using func_t = decltype(&BucketTable::GetSingleton);
REL::Relocation<func_t> func{ REL::ID(198241) };
REL::Relocation<func_t> func{ Offset::BSStringPool::BucketTable::GetSingleton };
return func();
}

Expand All @@ -103,15 +105,15 @@ namespace RE
inline void GetEntry<char>(BSStringPool::Entry*& a_result, const char* a_string, bool a_caseSensitive)
{
using func_t = decltype(&GetEntry<char>);
REL::Relocation<func_t> func{ REL::ID(198219) };
REL::Relocation<func_t> func{ Offset::BSStringPool::GetEntry_char_ };
return func(a_result, a_string, a_caseSensitive);
}

template <>
inline void GetEntry<wchar_t>(BSStringPool::Entry*& a_result, const wchar_t* a_string, bool a_caseSensitive)
{
using func_t = decltype(&GetEntry<wchar_t>);
REL::Relocation<func_t> func{ REL::ID(198220) };
REL::Relocation<func_t> func{ Offset::BSStringPool::GetEntry_wchar_t_ };
return func(a_result, a_string, a_caseSensitive);
}
}
7 changes: 4 additions & 3 deletions CommonLibSF/include/RE/B/BSTEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "RE/B/BSTArray.h"
#include "RE/B/BSTSingleton.h"
#include "RE/Offsets.h"

namespace RE
{
Expand Down Expand Up @@ -53,19 +54,19 @@ namespace RE
void Notify(void* a_event)
{
using func_t = decltype(&BSTEventSource::Notify);
REL::Relocation<func_t> func{ REL::ID(178573) };
REL::Relocation<func_t> func{ Offset::BSTEventSource::Notify };
return func(this, a_event);
}
void RegisterSink(BSTEventSink<Event>* a_sink)
{
using func_t = decltype(&BSTEventSource::RegisterSink);
REL::Relocation<func_t> func{ REL::ID(34452) };
REL::Relocation<func_t> func{ Offset::BSTEventSource::RegisterSink };
return func(this, a_sink);
}
void UnregisterSink(BSTEventSink<Event>* a_sink)
{
using func_t = decltype(&BSTEventSource::UnregisterSink);
REL::Relocation<func_t> func{ REL::ID(34451) };
REL::Relocation<func_t> func{ Offset::BSTEventSource::UnregisterSink };
return func(this, a_sink);
}

Expand Down
6 changes: 4 additions & 2 deletions CommonLibSF/include/RE/C/ConsoleLog.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "RE/Offsets.h"

namespace RE
{
class ConsoleLog
Expand All @@ -10,14 +12,14 @@ namespace RE
// BSTSDM
[[nodiscard]] static ConsoleLog* GetSingleton()
{
static REL::Relocation<ConsoleLog**> singleton{ REL::ID(879277) };
static REL::Relocation<ConsoleLog**> singleton{ Offset::ConsoleLog::singleton };
return *singleton;
}

void VPrint(const char* a_fmt, std::va_list a_args)
{
using func_t = decltype(&ConsoleLog::VPrint);
REL::Relocation<func_t> func{ REL::ID(166358) };
REL::Relocation<func_t> func{ Offset::ConsoleLog::VPrint };
func(this, a_fmt, a_args);
}

Expand Down
7 changes: 4 additions & 3 deletions CommonLibSF/include/RE/E/ExtraDataList.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "RE/B/BSIntrusiveRefCounted.h"
#include "RE/B/BSLock.h"
#include "RE/E/ExtraDataTypes.h"
#include "RE/Offsets.h"

namespace RE
{
Expand All @@ -13,14 +14,14 @@ namespace RE
void AddExtra(BSExtraData* a_extra)
{
using func_t = decltype(&BaseExtraList::AddExtra);
REL::Relocation<func_t> func{ REL::ID(83084) };
REL::Relocation<func_t> func{ Offset::BaseExtraList::AddExtra };
return func(this, a_extra);
}

[[nodiscard]] BSExtraData* GetByType(ExtraDataType a_type) const noexcept
{
using func_t = decltype(&BaseExtraList::GetByType);
REL::Relocation<func_t> func{ REL::ID(83208) };
REL::Relocation<func_t> func{ Offset::BaseExtraList::GetByType };
return func(this, a_type);
}

Expand Down Expand Up @@ -66,7 +67,7 @@ namespace RE
[[nodiscard]] bool HasType(ExtraDataType a_type) const noexcept
{
using func_t = bool (*)(const ExtraDataList*, ExtraDataType);
REL::Relocation<func_t> func{ REL::ID(83208) };
REL::Relocation<func_t> func{ Offset::ExtraDataList::HasType };
return func(this, a_type);
}

Expand Down
8 changes: 5 additions & 3 deletions CommonLibSF/include/RE/M/MemoryManager.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "RE/Offsets.h"

namespace RE
{
class MemoryManager
Expand All @@ -8,21 +10,21 @@ namespace RE
[[nodiscard]] static MemoryManager* GetSingleton()
{
using func_t = decltype(&MemoryManager::GetSingleton);
const REL::Relocation<func_t> func{ REL::ID(33961) };
const REL::Relocation<func_t> func{ Offset::MemoryManager::GetSingleton };
return func();
}

[[nodiscard]] void* Allocate(std::size_t a_size, std::uint32_t a_alignment, bool a_alignmentRequired)
{
using func_t = decltype(&MemoryManager::Allocate);
const REL::Relocation<func_t> func{ REL::ID(33962) };
const REL::Relocation<func_t> func{ Offset::MemoryManager::Allocate };
return func(this, a_size, a_alignment, a_alignmentRequired);
}

void Free(void* a_ptr, bool a_alignmentRequired)
{
using func_t = decltype(&MemoryManager::Free);
const REL::Relocation<func_t> func{ REL::ID(34032) };
const REL::Relocation<func_t> func{ Offset::MemoryManager::Free };
return func(this, a_ptr, a_alignmentRequired);
}
};
Expand Down
11 changes: 6 additions & 5 deletions CommonLibSF/include/RE/N/NativeFunctionBase.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "RE/I/IFunction.h"
#include "RE/Offsets.h"

namespace RE
{
Expand Down Expand Up @@ -59,7 +60,7 @@ namespace RE
virtual std::uint64_t* GetParam(std::uint32_t a_idx, BSFixedString* a_nameOut, std::uint64_t* a_typeOut)
{
using func_t = std::add_pointer_t<std::uint64_t*(ParameterInfo*, std::uint32_t, BSFixedString*, std::uint64_t*)>;
REL::Relocation<func_t> func{ REL::ID(196404) };
REL::Relocation<func_t> func{ Offset::BSScript::Internal::NF_util::NativeFunctionBase::GetParam };
return func(&_params, a_idx, a_nameOut, a_typeOut);
}
virtual std::uint64_t GetNumParams2(void) override { return _params.unk0A; }
Expand All @@ -73,13 +74,13 @@ namespace RE
virtual std::uint32_t Invoke(std::uint64_t a_unk0, std::uint64_t a_unk1, VMClassRegistry* a_registry, VMState* a_unk3) override
{
using func_t = decltype(&NativeFunctionBase::Invoke);
REL::Relocation<func_t> func{ REL::ID(196401) };
REL::Relocation<func_t> func{ Offset::BSScript::Internal::NF_util::NativeFunctionBase::Invoke };
return func(this, a_unk0, a_unk1, a_registry, a_unk3);
}
virtual BSFixedString* Unk_10(void) override
{
using func_t = decltype(&NativeFunctionBase::Unk_10);
REL::Relocation<func_t> func{ REL::ID(196407) };
REL::Relocation<func_t> func{ Offset::BSScript::Internal::NF_util::NativeFunctionBase::Unk_10 };
return func(this);
}
virtual bool Unk_11(std::uint32_t a_unk0, std::uint32_t* a_unk1) override
Expand All @@ -104,13 +105,13 @@ namespace RE
virtual bool GetParamInfo(std::uint32_t a_idx, void* a_out) override
{
using func_t = decltype(&NativeFunctionBase::GetParamInfo);
REL::Relocation<func_t> func{ REL::ID(196409) };
REL::Relocation<func_t> func{ Offset::BSScript::Internal::NF_util::NativeFunctionBase::GetParamInfo };
return func(this, a_idx, a_out);
}
virtual void* Unk_15(std::uint64_t a_arg0, std::uint64_t a_arg1)
{
using func_t = decltype(&NativeFunctionBase::Unk_15);
REL::Relocation<func_t> func{ REL::ID(196408) };
REL::Relocation<func_t> func{ Offset::BSScript::Internal::NF_util::NativeFunctionBase::Unk_15 };
return func(this, a_arg0, a_arg1);
}
virtual bool GetUnk41(void) override { return _isCallableFromTasklet; }
Expand Down
Loading

0 comments on commit e90af28

Please sign in to comment.