Skip to content

Commit

Permalink
feat: swap REL::Offset to REL::ID usage (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbyclue authored Sep 26, 2023
1 parent 2a67c67 commit 6d5cd9a
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion CommonLibSF/include/RE/A/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace RE

inline static Actor* PlayerCharacter()
{
static REL::Relocation<Actor**> singleton{ REL::Offset(0x05595BA8) };
static REL::Relocation<Actor**> singleton{ REL::ID(865059) };
return *singleton;
}

Expand Down
2 changes: 1 addition & 1 deletion CommonLibSF/include/RE/A/ActorValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace RE
[[nodiscard]] static ActorValue* GetSingleton()
{
using func_t = decltype(&ActorValue::GetSingleton);
REL::Relocation<func_t> func{ REL::Offset(0x00824D90) };
REL::Relocation<func_t> func{ REL::ID(516248) };
return func();
}

Expand Down
2 changes: 1 addition & 1 deletion CommonLibSF/include/RE/B/BGSEntryPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ namespace RE
inline void HandleEntryPoint(ENTRY_POINT a_entryPoint, Actor* a_perkOwner, Args... a_args)
{
using func_t = decltype(&BGSEntryPoint::HandleEntryPoint<Args...>);
REL::Relocation<func_t> func{ REL::Offset(0x01AF0C5C) };
REL::Relocation<func_t> func{ REL::ID(110912) };
return func(a_entryPoint, a_perkOwner, a_args...);
}
}
Expand Down
8 changes: 4 additions & 4 deletions CommonLibSF/include/RE/B/BSStringPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace RE
static void release(Entry*& a_entry)
{
using func_t = decltype(&Entry::release);
REL::Relocation<func_t> func{ REL::Offset(0x00836C2C) };
REL::Relocation<func_t> func{ REL::ID(36754) };
return func(a_entry);
}

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

Expand All @@ -126,15 +126,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::Offset(0x03149530) };
REL::Relocation<func_t> func{ REL::ID(198219) };
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::Offset(0x03149D40) };
REL::Relocation<func_t> func{ REL::ID(198220) };
return func(a_result, a_string, a_caseSensitive);
}
}
4 changes: 2 additions & 2 deletions CommonLibSF/include/RE/C/ConsoleLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace RE
// BSTSDM
[[nodiscard]] static ConsoleLog* GetSingleton()
{
static REL::Relocation<ConsoleLog**> singleton{ REL::Offset(0x058F7A90) };
static REL::Relocation<ConsoleLog**> singleton{ REL::ID(879277) };
return *singleton;
}

Expand All @@ -25,7 +25,7 @@ namespace RE
void VPrint(const char* a_fmt, std::va_list a_args)
{
using func_t = decltype(&ConsoleLog::VPrint);
REL::Relocation<func_t> func{ REL::Offset(0x02883978) };
REL::Relocation<func_t> func{ REL::ID(166358) };
func(this, a_fmt, a_args);
}
};
Expand Down
2 changes: 1 addition & 1 deletion CommonLibSF/include/RE/F/FORM_ENUM_STRING.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace RE
public:
[[nodiscard]] static std::span<FORM_ENUM_STRING, 215> GetFormEnumString()
{
REL::Relocation<FORM_ENUM_STRING(*)[215]> formEnumString{ REL::Offset(0x50146A0) };
REL::Relocation<FORM_ENUM_STRING(*)[215]> formEnumString{ REL::ID(761416) };
return { *formEnumString };
}

Expand Down
2 changes: 1 addition & 1 deletion CommonLibSF/include/RE/I/INIPrefSettingCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace RE

[[nodiscard]] static INIPrefSettingCollection* GetSingleton()
{
REL::Relocation<INIPrefSettingCollection**> singleton{ REL::Offset(0x05913BB8) };
REL::Relocation<INIPrefSettingCollection**> singleton{ REL::ID(885866) };
return *singleton;
}

Expand Down
2 changes: 1 addition & 1 deletion CommonLibSF/include/RE/I/INISettingCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace RE

[[nodiscard]] static INISettingCollection* GetSingleton()
{
REL::Relocation<INISettingCollection**> singleton{ REL::Offset(0x05913B98) };
REL::Relocation<INISettingCollection**> singleton{ REL::ID(885862) };
return *singleton;
}

Expand Down
4 changes: 2 additions & 2 deletions CommonLibSF/include/RE/N/NativeFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ namespace RE
NativeFunction(const char* a_name, const char* a_className, bool a_isStatic, std::uint32_t a_numParams)
{
using func_t = std::add_pointer_t<NativeFunction*(NativeFunction*, const char*, const char*, bool, std::uint32_t)>;
REL::Relocation<func_t> func{ REL::Offset(0x03076DE8) };
REL::Relocation<func_t> func{ REL::ID(196396) };
func(this, a_name, a_className, a_isStatic, a_numParams);
}

virtual ~NativeFunction()
{
using func_t = std::add_pointer_t<void(NativeFunction*)>;
REL::Relocation<func_t> func{ REL::Offset(0x03076EA4) };
REL::Relocation<func_t> func{ REL::ID(196398) };
func(this);
}

Expand Down
10 changes: 5 additions & 5 deletions CommonLibSF/include/RE/N/NativeFunctionBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,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::Offset(0x0307728C) };
REL::Relocation<func_t> func{ REL::ID(196404) };
return func(&_params, a_idx, a_nameOut, a_typeOut);
}
virtual std::uint64_t GetNumParams2(void) override { return _params.unk0A; }
Expand All @@ -73,13 +73,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::Offset(0x03076F64) };
REL::Relocation<func_t> func{ REL::ID(196401) };
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::Offset(0x030772F4) };
REL::Relocation<func_t> func{ REL::ID(196407) };
return func(this);
}
virtual bool Unk_11(std::uint32_t a_unk0, std::uint32_t* a_unk1) override
Expand All @@ -104,13 +104,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::Offset(0x03077390) };
REL::Relocation<func_t> func{ REL::ID(196409) };
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::Offset(0x030772FC) };
REL::Relocation<func_t> func{ REL::ID(196408) };
return func(this, a_arg0, a_arg1);
}
virtual bool GetUnk41(void) override { return _isCallableFromTasklet; }
Expand Down
2 changes: 1 addition & 1 deletion CommonLibSF/include/RE/RTTI.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ namespace RE
inline void* RTDynamicCast(void* a_inptr, std::int32_t a_vfDelta, void* a_srcType, void* a_targetType, std::int32_t a_isReference)
{
using func_t = decltype(&RTDynamicCast);
REL::Relocation<func_t> func{ REL::Offset(0x034C7500) };
REL::Relocation<func_t> func{ REL::ID(211916) };
return func(a_inptr, a_vfDelta, a_srcType, a_targetType, a_isReference);
}

Expand Down
4 changes: 2 additions & 2 deletions CommonLibSF/include/RE/S/Script.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ namespace RE

inline static SCRIPT_FUNCTION GetFirstScriptCommand()
{
static REL::Relocation<SCRIPT_FUNCTION> chunk{ REL::Offset(0x05511F30) };
static REL::Relocation<SCRIPT_FUNCTION> chunk{ REL::ID(841467) };
return chunk.get();
}

inline static SCRIPT_FUNCTION GetFirstConsoleCommand()
{
static REL::Relocation<SCRIPT_FUNCTION> chunk{ REL::Offset(0x055056C0) };
static REL::Relocation<SCRIPT_FUNCTION> chunk{ REL::ID(841465) };
return chunk.get();
}

Expand Down
4 changes: 2 additions & 2 deletions CommonLibSF/include/RE/T/TESForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ namespace RE
[[nodiscard]] static TESForm* LookupByID(std::uint32_t a_formID)
{
using func_t = decltype(&TESForm::LookupByID);
REL::Relocation<func_t> func{ REL::Offset(0x014D7DB0) };
REL::Relocation<func_t> func{ REL::ID(86125) };
return func(a_formID);
}

[[nodiscard]] static TESForm* LookupByEditorID(const char* a_editorID)
{
using func_t = decltype(&TESForm::LookupByEditorID);
REL::Relocation<func_t> func{ REL::Offset(0x014D7F0C) };
REL::Relocation<func_t> func{ REL::ID(86127) };
return func(a_editorID);
}

Expand Down
4 changes: 2 additions & 2 deletions CommonLibSF/include/RE/U/UI.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ namespace RE
public:
inline static UI* GetSingleton()
{
static REL::Relocation<UI**> singleton{ REL::Offset(0x056EE0D0) };
static REL::Relocation<UI**> singleton{ REL::ID(878339) };
return *singleton;
}

bool IsMenuOpen(const BSFixedString& a_name)
{
using func_t = decltype(&UI::IsMenuOpen);
REL::Relocation<func_t> func{ REL::Offset(0x02E7095C) };
REL::Relocation<func_t> func{ REL::ID(187048) };
return func(this, a_name);
}
};
Expand Down
10 changes: 5 additions & 5 deletions CommonLibSF/src/RE/P/PlayerCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ namespace RE
{
PlayerCamera* PlayerCamera::GetSingleton()
{
REL::Relocation<PlayerCamera**> singleton{ REL::Offset(0x058F1978) };
REL::Relocation<PlayerCamera**> singleton{ REL::ID(878523) };
return *singleton;
}

void PlayerCamera::ForceFirstPerson()
{
using func_t = decltype(&PlayerCamera::ForceFirstPerson);
REL::Relocation<func_t> func{ REL::Offset(0x0286A798) };
REL::Relocation<func_t> func{ REL::ID(166029) };
return func(this);
}

void PlayerCamera::ForceThirdPerson()
{
using func_t = decltype(&PlayerCamera::ForceThirdPerson);
REL::Relocation<func_t> func{ REL::Offset(0x0286A850) };
REL::Relocation<func_t> func{ REL::ID(166031) };
return func(this);
}

Expand All @@ -35,14 +35,14 @@ namespace RE
void PlayerCamera::SetCameraState(CameraState a_cameraState)
{
using func_t = decltype(&PlayerCamera::SetCameraState);
REL::Relocation<func_t> func{ REL::Offset(0x0286BCBC) };
REL::Relocation<func_t> func{ REL::ID(166078) };
return func(this, a_cameraState);
}

bool PlayerCamera::QCameraEquals(CameraState a_cameraState) const
{
using func_t = decltype(&PlayerCamera::QCameraEquals);
REL::Relocation<func_t> func{ REL::Offset(0x0286BDC8) };
REL::Relocation<func_t> func{ REL::ID(166081) };
return func(this, a_cameraState);
}
}
22 changes: 11 additions & 11 deletions CommonLibSF/src/RE/T/TESObjectREFR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,77 +5,77 @@ namespace RE
BGSLocation* TESObjectREFR::GetCurrentLocation()
{
using func_t = decltype(&TESObjectREFR::GetCurrentLocation);
REL::Relocation<func_t> func{ REL::Offset(0x01A0505C) };
REL::Relocation<func_t> func{ REL::ID(106554) };
return func(this);
}

TESObjectREFR* TESObjectREFR::GetLinkedRef(BGSKeyword* a_keyword)
{
using func_t = decltype(&TESObjectREFR::GetLinkedRef);
REL::Relocation<func_t> func{ REL::Offset(0x1A379E4) };
REL::Relocation<func_t> func{ REL::ID(107578) };
return func(this, a_keyword);
}

TESWorldSpace* TESObjectREFR::GetParentWorldSpace()
{
using func_t = decltype(&TESObjectREFR::GetParentWorldSpace);
REL::Relocation<func_t> func{ REL::Offset(0x01A093BC) };
REL::Relocation<func_t> func{ REL::ID(106696) };
return func(this);
}

TESObjectREFR* TESObjectREFR::GetSpaceship(bool a_arg1)
{
using func_t = decltype(&TESObjectREFR::GetSpaceship);
REL::Relocation<func_t> func{ REL::Offset(0x02B3A714) };
REL::Relocation<func_t> func{ REL::ID(173851) };
return func(this, a_arg1);
}

TESObjectREFR* TESObjectREFR::GetSpaceshipParentDock()
{
using func_t = decltype(&TESObjectREFR::GetSpaceshipParentDock);
REL::Relocation<func_t> func{ REL::Offset(0x02B53DC0) };
REL::Relocation<func_t> func{ REL::ID(174134) };
return func(this);
}

Actor* TESObjectREFR::GetSpaceshipPilot()
{
using func_t = decltype(&TESObjectREFR::GetSpaceshipPilot);
REL::Relocation<func_t> func{ REL::Offset(0x02B39D74) };
REL::Relocation<func_t> func{ REL::ID(173834) };
return func(this);
}

std::int32_t TESObjectREFR::GetValue()
{
using func_t = decltype(&TESObjectREFR::GetValue);
REL::Relocation<func_t> func{ REL::Offset(0x01A38790) };
REL::Relocation<func_t> func{ REL::ID(107605)};
return func(this);
}

bool TESObjectREFR::HasKeyword(BGSKeyword* a_keyword)
{
using func_t = decltype(&TESObjectREFR::HasKeyword);
REL::Relocation<func_t> func{ REL::Offset(0x0139EDB8) };
REL::Relocation<func_t> func{ REL::ID(80343) };
return func(this, a_keyword);
}

bool TESObjectREFR::IsCrimeToActivate()
{
using func_t = decltype(&TESObjectREFR::IsCrimeToActivate);
REL::Relocation<func_t> func{ REL::Offset(0x01A0DC60) };
REL::Relocation<func_t> func{ REL::ID(106755) };
return func(this);
}

bool TESObjectREFR::IsInSpace(bool a_arg1)
{
using func_t = decltype(&TESObjectREFR::IsInSpace);
REL::Relocation<func_t> func{ REL::Offset(0x01A0E1C8) };
REL::Relocation<func_t> func{ REL::ID(106767) };
return func(this, a_arg1);
}

bool TESObjectREFR::IsSpaceshipDocked()
{
using func_t = decltype(&TESObjectREFR::IsSpaceshipDocked);
REL::Relocation<func_t> func{ REL::Offset(0x2B557C8) };
REL::Relocation<func_t> func{ REL::ID(174146) };
return func(this);
}

Expand Down

0 comments on commit 6d5cd9a

Please sign in to comment.