Skip to content

Commit

Permalink
2.12
Browse files Browse the repository at this point in the history
  • Loading branch information
maximegmd committed Feb 29, 2024
1 parent 2edfe6d commit 30e5495
Show file tree
Hide file tree
Showing 21 changed files with 139 additions and 103 deletions.
2 changes: 2 additions & 0 deletions src/CET.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ static bool s_isRunning{true};
void CET::Initialize()
{
s_pInstance.reset(new CET);

s_pInstance->GetVM().Prepare();
}

void CET::Shutdown()
Expand Down
2 changes: 1 addition & 1 deletion src/Image.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ struct Image
{
void Initialize();

static std::tuple<uint32_t, uint16_t> GetSupportedVersion() noexcept { return std::make_tuple(2, 11); }
static std::tuple<uint32_t, uint16_t> GetSupportedVersion() noexcept { return std::make_tuple(2, 12); }

uintptr_t base_address;
mem::region TextRegion;
Expand Down
6 changes: 3 additions & 3 deletions src/d3d12/D3D12_Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ void D3D12::Hook()

void D3D12::HookGame()
{
const RED4ext::RelocPtr<void> presentInternal(CyberEngineTweaks::Addresses::CRenderNode_Present_DoInternal);
const RED4ext::RelocPtr<void> resizeInternal(CyberEngineTweaks::Addresses::CRenderGlobal_Resize);
const RED4ext::RelocPtr<void> shutdownInternal(CyberEngineTweaks::Addresses::CRenderGlobal_Shutdown);
const RED4ext::UniversalRelocPtr<void> presentInternal(CyberEngineTweaks::AddressHashes::CRenderNode_Present_DoInternal);
const RED4ext::UniversalRelocPtr<void> resizeInternal(CyberEngineTweaks::AddressHashes::CRenderGlobal_Resize);
const RED4ext::UniversalRelocPtr<void> shutdownInternal(CyberEngineTweaks::AddressHashes::CRenderGlobal_Shutdown);

if (MH_CreateHook(presentInternal.GetAddr(), reinterpret_cast<void*>(&CRenderNode_Present_InternalPresent), reinterpret_cast<void**>(&m_realInternalPresent)) != MH_OK ||
MH_EnableHook(presentInternal.GetAddr()) != MH_OK)
Expand Down
55 changes: 46 additions & 9 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
#include "CET.h"

#include "Options.h"
#include "RED4ext/Api/EMainReason.hpp"
#include "RED4ext/Api/PluginHandle.hpp"
#include "RED4ext/Api/Runtime.hpp"
#include "RED4ext/Api/Sdk.hpp"
#include "RED4ext/Api/Version.hpp"

#include "scripting/GameHooks.h"

Expand All @@ -16,7 +21,7 @@ static HANDLE s_modInstanceMutex = nullptr;

using namespace std::chrono_literals;

static void Initialize()
static bool Initialize()
{
try
{
Expand All @@ -29,7 +34,7 @@ static void Initialize()
// single instance check
s_modInstanceMutex = CreateMutex(nullptr, TRUE, TEXT("Cyber Engine Tweaks Module Instance"));
if (s_modInstanceMutex == nullptr)
return;
return false;

// initialize patches

Expand All @@ -52,7 +57,10 @@ static void Initialize()
}
catch (...)
{
return false;
}

return true;
}

static void Shutdown()
Expand All @@ -79,16 +87,45 @@ static void Shutdown()
}
}

BOOL APIENTRY DllMain(HMODULE mod, DWORD ul_reason_for_call, LPVOID)
RED4EXT_C_EXPORT bool RED4EXT_CALL Main(RED4ext::PluginHandle aHandle, RED4ext::EMainReason aReason, const RED4ext::Sdk* aSdk)
{
DisableThreadLibraryCalls(mod);
RED4EXT_UNUSED_PARAMETER(aHandle);
RED4EXT_UNUSED_PARAMETER(aSdk);

switch (ul_reason_for_call)
switch (aReason)
{
case RED4ext::EMainReason::Load:
{
return Initialize();
break;
}
case RED4ext::EMainReason::Unload:
{
case DLL_PROCESS_ATTACH: Initialize(); break;
case DLL_PROCESS_DETACH: Shutdown(); break;
default: break;
Shutdown();
break;
}
}

return true;
}

return TRUE;
RED4EXT_C_EXPORT void RED4EXT_CALL Query(RED4ext::PluginInfo* aInfo)
{
aInfo->name = L"Cyber Engine Tweaks";
aInfo->author = L"Yamashi and Friends";

std::istringstream oss(CET_BUILD_COMMIT);

char buffer;
uint32_t major, minor, patch;
oss >> buffer >> major >> buffer >> minor >> buffer >> patch;

aInfo->version = RED4EXT_SEMVER(major, minor, patch);
aInfo->runtime = RED4EXT_RUNTIME_INDEPENDENT;
aInfo->sdk = RED4EXT_SDK_LATEST;
}

RED4EXT_C_EXPORT uint32_t RED4EXT_CALL Supports()
{
return RED4EXT_API_VERSION_LATEST;
}
4 changes: 2 additions & 2 deletions src/overlay/Overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ BOOL Overlay::ClipToCenter(RED4ext::CGameEngine::UnkD0* apThis)

void Overlay::Hook()
{
const RED4ext::RelocPtr<uint8_t> func(CyberEngineTweaks::Addresses::CWinapi_ClipToCenter);
const RED4ext::UniversalRelocPtr<uint8_t> func(CyberEngineTweaks::AddressHashes::CWinapi_ClipToCenter);

if (auto* pLocation = func.GetAddr())
{
Expand All @@ -272,7 +272,7 @@ Overlay::Overlay(VKBindings& aBindings, Options& aOptions, PersistentState& aPer
{
Hook();

GameMainThread::Get().AddBaseInitializationTask(
GameMainThread::Get().AddInitializationTask(
[this]
{
PostInitialize();
Expand Down
2 changes: 1 addition & 1 deletion src/patches/DisableBoundaries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ void DisableBoundaryTeleportPatch()
// Disarm the WorldBoundarySystem/Tick function
// Going out of bounds will still play the glitchy-screen effect that normally happens when game teleports you, but
// the actual teleport won't happen
const RED4ext::RelocPtr<uint8_t> func(CyberEngineTweaks::Addresses::CPatches_BoundaryTeleport);
const RED4ext::UniversalRelocPtr<uint8_t> func(CyberEngineTweaks::AddressHashes::CPatches_BoundaryTeleport);
const auto pLocation = func.GetAddr();

if (pLocation == nullptr)
Expand Down
2 changes: 1 addition & 1 deletion src/patches/DisableIntroMovies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void* HookInitScriptMemberVariable(void* a1, void* a2, uint64_t a3, uint64_t nam

void DisableIntroMoviesPatch()
{
const RED4ext::RelocPtr<void> func(CyberEngineTweaks::Addresses::CPatches_IntroMovie);
const RED4ext::UniversalRelocPtr<void> func(CyberEngineTweaks::AddressHashes::CPatches_IntroMovie);
RealInitScriptMemberVariable = reinterpret_cast<TInitScriptMemberVariable*>(func.GetAddr());

if (RealInitScriptMemberVariable == nullptr)
Expand Down
2 changes: 1 addition & 1 deletion src/patches/DisableVignette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

void DisableVignettePatch()
{
const RED4ext::RelocPtr<uint8_t> func(CyberEngineTweaks::Addresses::CPatches_Vignette);
const RED4ext::UniversalRelocPtr<uint8_t> func(CyberEngineTweaks::AddressHashes::CPatches_Vignette);
const auto pLocation = func.GetAddr();

if (pLocation == nullptr)
Expand Down
2 changes: 1 addition & 1 deletion src/patches/OptionsPatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void* HookGameOptionInit(GameOption* apThis)

void OptionsInitHook()
{
const RED4ext::RelocPtr<uint8_t> func(CyberEngineTweaks::Addresses::CPatches_OptionsInit);
const RED4ext::UniversalRelocPtr<uint8_t> func(CyberEngineTweaks::AddressHashes::CPatches_OptionsInit);
uint8_t* pLocation = func.GetAddr();

if (pLocation)
Expand Down
78 changes: 35 additions & 43 deletions src/reverse/Addresses.h
Original file line number Diff line number Diff line change
@@ -1,87 +1,79 @@
#pragma once

/*
* This file is generated. DO NOT modify it!
*
* Add new patterns in "patterns.py" file located in "project_root/scripts" and run "find_patterns.py".
* The new file should be located in "idb_path/Addresses.h".
*/
#include <cstdint>

namespace CyberEngineTweaks::Addresses
namespace CyberEngineTweaks::AddressHashes
{
constexpr uintptr_t ImageBase = 0x140000000;

#pragma region CBaseInitializationState
constexpr uintptr_t CBaseInitializationState_OnTick = 0x1406A4580 - ImageBase; // 40 53 48 83 EC 20 48 8B 05 ? ? ? ? 33 DB 4C 8B C2 48 85 C0 ? ? ? ?, expected: 1, index: 0
constexpr uint32_t CBaseInitializationState_OnTick = 2529693960UL;
#pragma endregion

#pragma region CGame
constexpr uintptr_t CGame_Main = 0x140454F24 - ImageBase; // 48 89 5C 24 10 55 56 57 48 8B EC 48 81 EC 80 00 00 00 48 8B F9 0F 29 74 24 70 0F 29 7C 24 60 48 8D 4D C0, expected: 1, index: 0
constexpr uint32_t CGame_Main = 1852772247UL;
#pragma endregion

#pragma region CInitializationState
constexpr uintptr_t CInitializationState_OnTick = 0x1406A463C - ImageBase; // 40 53 48 83 EC 30 48 8B 05 ? ? ? ? 33 DB 4C 8B C2 8B 88 08 01 00 00, expected: 1, index: 0
constexpr uint32_t CInitializationState_OnTick = 2447710505UL;
#pragma endregion

#pragma region CPatches
constexpr uintptr_t CPatches_BoundaryTeleport = 0x140C51158 - ImageBase; // 48 8B C4 48 89 58 10 55 56 57 41 54 41 55 41 56 41 57 48 8D 6C 24 B0 48 81 EC ? 01 00 00 0F 29 ? B8 48 8D 51 48, expected: 1, index: 0
constexpr uintptr_t CPatches_IntroMovie = 0x140186ABC - ImageBase; // 48 89 5C 24 08 57 48 83 EC 20 48 8B 44 24 50 48 8B D9 48 89 41 08, expected: 1, index: 0
constexpr uintptr_t CPatches_Vignette = 0x14235C144 - ImageBase; // 33 C0 48 39 41 68 74 11, expected: 1, index: 0
constexpr uintptr_t CPatches_OptionsInit = 0x140778E48 - ImageBase; // 48 89 5C 24 08 55 48 8B EC 48 83 EC 70 48 83 65 F8 00 48 8B D9 83 65 F4 00, expected: 1, index: 0
constexpr uint32_t CPatches_BoundaryTeleport = 887623293UL;
constexpr uint32_t CPatches_IntroMovie = 4056423627UL;
constexpr uint32_t CPatches_Vignette = 1592528795UL;
constexpr uint32_t CPatches_OptionsInit = 2920158527UL;
#pragma endregion

#pragma region CPhotoMode
constexpr uintptr_t CPhotoMode_SetRecordID = 0x140450BF0 - ImageBase; // 48 89 5C 24 10 48 89 4C 24 08 55 48 8B EC 48 83 EC 40 48 8B DA 48 8D 4D E0 48 8D 55 10 E8, expected: 1, index: 0
constexpr uint32_t CPhotoMode_SetRecordID = 2826047827UL;
#pragma endregion

#pragma region CRenderGlobal
constexpr uintptr_t CRenderGlobal_InstanceOffset = 0x143384588 - ImageBase; // 48 89 5C 24 08 48 89 6C 24 10 4C 89 4C 24 20 56 57 41 56 48 83 EC 30 8B 11 45 8B F0 48 8B 2D, expected: 1, index: 0, offset: 31
constexpr uintptr_t CRenderGlobal__DoNotUse_RenderQueueOffset = 0x1B5F5FCB0 - ImageBase; // 39 72 24 74 5B 48 8B 4A 18 4C 8D 8C 24 88 00 00 00 8B 42 24 44 8B C7 48 8B 95 ? ? ? ?, expected: 1, index: 0, offset: 0
constexpr uintptr_t CRenderGlobal_Resize = 0x14088EC60 - ImageBase; // 48 8B C4 44 88 48 20 44 89 40 18 89 50 10 89 48 08 55 53 56 57 41 54 41 55 41 56 41 57 48 8D 68 ? 48 81 EC ? ? 00 00, expected: 1, index: 0
constexpr uintptr_t CRenderGlobal_Shutdown = 0x141041AA8 - ImageBase; // 40 53 48 83 EC 20 48 8B D9 48 8D 05 ? ? ? ? 48 81 C1 98 00 00 00 48 89 01 E8, expected: 1, index: 0
constexpr uint32_t CRenderGlobal_InstanceOffset = 1239944840UL;
//constexpr uint32_t CRenderGlobal__DoNotUse_RenderQueueOffset = 0x1B5F5FCB0;
constexpr uint32_t CRenderGlobal_Resize = 239671909UL;
constexpr uint32_t CRenderGlobal_Shutdown = 3192982283UL;
#pragma endregion

#pragma region CRenderNode_Present
constexpr uintptr_t CRenderNode_Present_DoInternal = 0x1403E195C - ImageBase; // 48 89 5C 24 08 48 89 6C 24 10 4C 89 4C 24 20 56 57 41 56 48 83 EC 30 8B 11 45 8B F0 48 8B 2D, expected: 1, index: 0
constexpr uint32_t CRenderNode_Present_DoInternal = 2468877568UL;
#pragma endregion

#pragma region CRunningState
constexpr uintptr_t CRunningState_OnTick = 0x1406A45D8 - ImageBase; // 40 53 48 83 EC 30 83 64 24 28 00 48 8D 05 ? ? ? ? 48 8B 0D ? ? ? ? 48 8B DA, expected: 1, index: 0
constexpr uint32_t CRunningState_OnTick = 3592689218UL;
#pragma endregion

#pragma region CScript
constexpr uintptr_t CScript_RunPureScript = 0x1405ACE18 - ImageBase; // 40 55 48 81 EC D0 00 00 00 48 8D 6C 24 40 8B, expected: 1, index: 0
constexpr uintptr_t CScript_AllocateFunction = 0x141FE1FB8 - ImageBase; // 40 53 48 83 EC 30 BA B8 00 00 00 48 8D 4C 24 20 E8, expected: 2, index: 0
constexpr uintptr_t CScript_Log = 0x140EADF74 - ImageBase; // 48 8B C4 53 48 83 EC 70 48 83 60 C0 00 48 8D 48 C8 83 60 BC 00, expected: 3, index: 0
constexpr uintptr_t CScript_LogError = 0x1410951D0 - ImageBase; // 48 8B C4 53 48 83 EC 70 48 83 60 C0 00 48 8D 48 C8 83 60 BC 00, expected: 3, index: 1
constexpr uintptr_t CScript_LogWarning = 0x141130E10 - ImageBase; // 48 8B C4 53 48 83 EC 70 48 83 60 C0 00 48 8D 48 C8 83 60 BC 00, expected: 3, index: 2
constexpr uintptr_t CScript_ToStringDEBUG = 0x140DEABA4 - ImageBase; // 48 89 5C 24 08 57 48 83 EC 20 83 64 24 38 00 4C 8D 15 ? ? ? ? FE 42 62 33 C0, expected: 4, index: 1
constexpr uintptr_t CScript_LogChannel = 0x140CC91C8 - ImageBase; // 48 89 5C 24 08 48 89 74 24 18 55 48 8B EC 48 83 EC 70 48 8B 02 48 8D 35 ? ? ? ? 48 83 65 18 00 4C 8D 45 18 48 83 62 30 00 45 33 C9 48 83 62 38 00, expected: 2, index: 0
constexpr uintptr_t CScript_LogChannelWarning = 0x141FF029C - ImageBase; // 48 89 5C 24 08 48 89 74 24 18 55 48 8B EC 48 83 EC 70 48 8B 02 48 8D 35 ? ? ? ? 48 83 65 18 00 4C 8D 45 18 48 83 62 30 00 45 33 C9 48 83 62 38 00, expected: 2, index: 1
constexpr uintptr_t CScript_TDBIDConstructorDerive = 0x14018EF44 - ImageBase;
constexpr uintptr_t CScript_TranslateBytecode = 0x1401555EC - ImageBase; // 48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 48 83 EC 20 48 8B 1A 48 8B E9 8B 42 0C, expected: 2, index: 1
constexpr uintptr_t CScript_TweakDBLoad = 0x140528F6C - ImageBase; // 48 89 5C 24 10 48 89 7C 24 18 55 48 8B EC 48 ? EC 80 00 00 00 48 8B F9 48 8B DA 48 8B 0D, expected: 1, index: 0
constexpr uintptr_t CScript_RegisterMemberFunction = 0x140385900 - ImageBase; // 40 53 48 83 EC 20 49 8B C1 4D 8B D0 44 8B 4C 24 58 4C 8B DA 41 83 C9 03 4C 8B C0 49 8B D2 48 8B D9 E8, expected: 1, index: 0
constexpr uint32_t CScript_RunPureScript = 3791200470UL;
constexpr uint32_t CScript_AllocateFunction = 160045886UL;
constexpr uint32_t CScript_Log = 3455393801UL;
constexpr uint32_t CScript_LogError = 2135235617UL;
constexpr uint32_t CScript_LogWarning = 3222609133UL;
constexpr uint32_t CScript_ToStringDEBUG = 3515162577UL;
constexpr uint32_t CScript_LogChannel = 1663049434UL;
constexpr uint32_t CScript_LogChannelWarning = 2841780134UL;
constexpr uint32_t CScript_TDBIDConstructorDerive = 326438016UL;
constexpr uint32_t CScript_TranslateBytecode = 3442875632UL;
constexpr uint32_t CScript_TweakDBLoad = 3602585178UL;
constexpr uint32_t CScript_RegisterMemberFunction = 592450491UL;
#pragma endregion

#pragma region CShutdownState
constexpr uintptr_t CShutdownState_OnTick = 0x1400FE288 - ImageBase; // 48 89 5C 24 08 57 48 83 EC 20 48 8B 0D ? ? ? ? 48, expected: 1, index: 0
constexpr uint32_t CShutdownState_OnTick = 4069332669UL;
#pragma endregion

#pragma region CWinapi
constexpr uintptr_t CWinapi_ClipToCenter = 0x1401D78E4 - ImageBase; // 48 89 5C 24 08 55 48 8B EC 48 83 EC 30 48 8B D9 48 8B 89 ? 01 00 00, expected: 1, index: 0
constexpr uint32_t CWinapi_ClipToCenter = 261693736UL;
#pragma endregion

#pragma region gameIGameSystem
constexpr uintptr_t gameIGameSystem_Initialize = 0x140A9E8A4 - ImageBase; // 48 89 5C 24 08 57 48 83 EC 30 48 8B 42 78 4C 8B CA 48 8B D9, expected: 1, index: 0
constexpr uintptr_t gameIGameSystem_UnInitialize = 0x141FE5BBC - ImageBase; // 48 89 5C 24 10 48 89 74 24 18 57 48 83 EC 20 48 8B F9 48 8D 51 42, expected: 2, index: 1
constexpr uintptr_t gameIGameSystem_Spawn = 0x140451460 - ImageBase; // 48 89 5C 24 10 48 89 74 24 18 55 57 41 56 48 8D 6C 24 B0 48 81 EC 50 01 00 00 48 83 79 50 00 49 8B D9 4D 8B F0, expected: 1, index: 0
constexpr uintptr_t gameIGameSystem_Despawn = 0x1404B6B88 - ImageBase; // 48 8B C4 48 89 58 08 48 89 68 10 48 89 70 18 48 89 78 20 41 56 48 83 EC 40 48 8B E9 0F 57 C0 48 83 C1 41 48 8B F2 F3 0F 7F 40 D8 E8, expected: 1, index: 0
constexpr uintptr_t gameIGameSystem_SpawnCallback = 0x140251B38 - ImageBase; // 48 89 5C 24 10 48 89 6C 24 18 48 89 74 24 20 57 48 83 EC 60 48 8B F1 48 8B FA 48 83 C1 48 E8, expected: 1, index: 0
constexpr uint32_t gameIGameSystem_Initialize = 385618721UL;
constexpr uint32_t gameIGameSystem_UnInitialize = 3313306514UL;
constexpr uint32_t gameIGameSystem_Spawn = 2509382878UL;
constexpr uint32_t gameIGameSystem_Despawn = 3168866665UL;
constexpr uint32_t gameIGameSystem_SpawnCallback = 2840271332UL;
#pragma endregion

#pragma region PlayerSystem
constexpr uintptr_t PlayerSystem_OnPlayerSpawned = 0x1409700EC - ImageBase; // 48 89 5C 24 18 48 89 74 24 20 55 57 41 54 41 56 41 57 48 8B EC 48 83 EC 50 48 8B DA 48 8B F9, expected: 1, index: 0
constexpr uint32_t PlayerSystem_OnPlayerSpawned = 2050111212UL;
#pragma endregion
} // namespace CyberEngineTweaks::Addresses
16 changes: 8 additions & 8 deletions src/reverse/RTTIExtender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

template <typename T> struct GameCall
{
GameCall(uintptr_t aAddress, const int32_t acOffset = 0)
GameCall(uint32_t aHash, const int32_t acOffset = 0)
{
const RED4ext::RelocPtr<uint8_t> addr(aAddress);
static RED4ext::UniversalRelocPtr<uint8_t> addr(aHash);
auto* pLocation = addr.GetAddr();
m_address = pLocation ? reinterpret_cast<T>(pLocation + acOffset) : nullptr;
}
Expand Down Expand Up @@ -188,7 +188,7 @@ struct TEMP_SpawnSettings
{
// Copied from the function photomode uses to spawn 3rd person puppet
using TFunc = void (*)(const RED4ext::TweakDBID, RED4ext::Handle<RED4ext::IScriptable>&);
static GameCall<TFunc> func(CyberEngineTweaks::Addresses::CPhotoMode_SetRecordID);
static GameCall<TFunc> func(CyberEngineTweaks::AddressHashes::CPhotoMode_SetRecordID);

DONOTUSE_recordDBID = acTweakDBID;
func(acTweakDBID, unkB0);
Expand Down Expand Up @@ -223,22 +223,22 @@ struct TEMP_Spawner
void Initialize(RED4ext::GameInstance* apGameInstance)
{
using TFunc = void (*)(TEMP_Spawner*, RED4ext::GameInstance*);
static GameCall<TFunc> func(CyberEngineTweaks::Addresses::gameIGameSystem_Initialize);
static GameCall<TFunc> func(CyberEngineTweaks::AddressHashes::gameIGameSystem_Initialize);
func(this, apGameInstance);
}

void UnInitialize()
{
using TFunc = void (*)(TEMP_Spawner*);
static GameCall<TFunc> func(CyberEngineTweaks::Addresses::gameIGameSystem_UnInitialize);
static GameCall<TFunc> func(CyberEngineTweaks::AddressHashes::gameIGameSystem_UnInitialize);
func(this);
}

RED4ext::ent::EntityID Spawn(const RED4ext::CName acEntityPath, TEMP_SpawnSettings& aSettings)
{
// REDSmartPtr<TEMP_PendingEntity::Unk00> TEMP_Spawner::func(this, TEMP_SpawnSettings&, RED4ext::CName&)
using TFunc = void (*)(TEMP_Spawner*, REDSmartPtr<TEMP_PendingEntity::Unk00>*, TEMP_SpawnSettings&, const RED4ext::CName);
static GameCall<TFunc> func(CyberEngineTweaks::Addresses::gameIGameSystem_Spawn);
static GameCall<TFunc> func(CyberEngineTweaks::AddressHashes::gameIGameSystem_Spawn);

REDSmartPtr<TEMP_PendingEntity::Unk00> pendingEntity;
func(this, &pendingEntity, aSettings, acEntityPath);
Expand Down Expand Up @@ -278,7 +278,7 @@ struct TEMP_Spawner
void Despawn(const RED4ext::Handle<RED4ext::IScriptable>& aEntity)
{
using TFunc = void (*)(TEMP_Spawner*, RED4ext::IScriptable*);
static GameCall<TFunc> func(CyberEngineTweaks::Addresses::gameIGameSystem_Despawn);
static GameCall<TFunc> func(CyberEngineTweaks::AddressHashes::gameIGameSystem_Despawn);
func(this, aEntity.GetPtr());
}
};
Expand Down Expand Up @@ -423,7 +423,7 @@ struct exEntitySpawnerSystem : RED4ext::gameIGameSystem
static void SpawnCallback(TEMP_PendingEntity::Unk00& aUnk)
{
using TFunc = void (*)(IScriptable*, RED4ext::ent::Entity*);
static GameCall<TFunc> func(CyberEngineTweaks::Addresses::gameIGameSystem_SpawnCallback);
static GameCall<TFunc> func(CyberEngineTweaks::AddressHashes::gameIGameSystem_SpawnCallback);

struct GameInstance_78_Unk
{
Expand Down
4 changes: 2 additions & 2 deletions src/reverse/RTTIHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ constexpr bool s_cThrowLuaErrors = true;
std::unique_ptr<RTTIHelper> s_pInstance{nullptr};

using TCallScriptFunction = bool (*)(RED4ext::IFunction* apFunction, RED4ext::IScriptable* apContext, RED4ext::CStackFrame* apFrame, void* apResult, void* apResultType);

RED4ext::RelocFunc<TCallScriptFunction> CallScriptFunction(RED4ext::Addresses::CBaseFunction_InternalExecute);
} // namespace

void RTTIHelper::Initialize(const LockableState& acLua, LuaSandbox& apSandbox)
Expand Down Expand Up @@ -773,6 +771,8 @@ void LuaDummyFunction(RED4ext::IScriptable*, RED4ext::CStackFrame* apFrame, void
bool RTTIHelper::ExecuteFunction(
RED4ext::CBaseFunction* apFunc, RED4ext::IScriptable* apContext, TiltedPhoques::Vector<RED4ext::CStackType>& aArgs, RED4ext::CStackType& aResult) const
{
static RED4ext::UniversalRelocFunc<TCallScriptFunction> CallScriptFunction(RED4ext::Detail::AddressHashes::CBaseFunction_InternalExecute);

constexpr auto NopOp = 0;
constexpr auto ParamOp = 27;
constexpr auto ParamEndOp = 38;
Expand Down
2 changes: 1 addition & 1 deletion src/reverse/RenderContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

RenderContext* RenderContext::GetInstance() noexcept
{
static RED4ext::RelocPtr<RenderContext*> s_instance(CyberEngineTweaks::Addresses::CRenderGlobal_InstanceOffset);
static RED4ext::UniversalRelocPtr<RenderContext*> s_instance(CyberEngineTweaks::AddressHashes::CRenderGlobal_InstanceOffset);
return *s_instance.GetAddr();
}
Loading

0 comments on commit 30e5495

Please sign in to comment.