Skip to content

Commit

Permalink
Update addresses and PDB's GUID for patch 1.62
Browse files Browse the repository at this point in the history
  • Loading branch information
wopss committed Apr 11, 2023
1 parent c43f912 commit 5d880da
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "vendor/RED4ext.SDK"]
path = vendor/RED4ext.SDK
url = https://github.com/yamashi/RED4ext.SDK
url = https://github.com/WopsS/RED4ext.SDK
[submodule "vendor/luasocket"]
path = vendor/luasocket
url = https://github.com/diegonehab/luasocket.git
3 changes: 2 additions & 1 deletion src/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ void Image::Initialize()
{{0x69, 0x41, 0x44, 0x27, 0xDB, 0x02, 0x65, 0x4B, 0xA5, 0x7F, 0x5B, 0x1C, 0xD6, 0x79, 0x94, 0x32}, MakeVersion(1, 52)}, // Exclusive steam patch
{{0x4E, 0xE9, 0x22, 0x2A, 0x9D, 0xB5, 0xC6, 0x40, 0xA7, 0xD4, 0xAB, 0x3B, 0xCA, 0x7C, 0x30, 0x06}, MakeVersion(1, 60)},
{{0x75, 0xF0, 0x99, 0xC1, 0x83, 0x84, 0xF9, 0x43, 0x95, 0x00, 0x4E, 0x7D, 0x93, 0x73, 0x84, 0xDF}, MakeVersion(1, 61)},
{{0x5D, 0x30, 0xA1, 0x30, 0x0F, 0x7F, 0x5E, 0x4C, 0xA9, 0xBA, 0xD8, 0x43, 0xD9, 0xAE, 0x85, 0x50}, MakeVersion(1, 61)}};
{{0x5D, 0x30, 0xA1, 0x30, 0x0F, 0x7F, 0x5E, 0x4C, 0xA9, 0xBA, 0xD8, 0x43, 0xD9, 0xAE, 0x85, 0x50}, MakeVersion(1, 61)},
{{0xD6, 0xFF, 0xA3, 0xE9, 0xCA, 0x20, 0x9A, 0x4F, 0xA6, 0x2A, 0x7B, 0x8B, 0x33, 0xF7, 0x9D, 0x02}, MakeVersion(1, 62)}};

mem::module mainModule = mem::module::main();

Expand Down
4 changes: 2 additions & 2 deletions src/overlay/widgets/TweakDBEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ void TweakDBEditor::FilterAll()
RED4ext::TweakDBID ExtractTweakDBIDFromString(const char* acString)
{
if (acString[0] == '\0')
return 0;
return {};

RED4ext::TweakDBID dbid = 0;
RED4ext::TweakDBID dbid;
if (sscanf(acString, "%llX", &dbid.value) != 1)
{
if (sscanf(acString, "<TDBID:%X:%hhX", &dbid.name.hash, &dbid.name.length) != 2)
Expand Down
74 changes: 37 additions & 37 deletions src/reverse/Addresses.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,86 +8,86 @@
*/
#include <cstdint>

// Addresses for Cyberpunk 2077, version 1.61.
// Addresses for Cyberpunk 2077, version 1.62.
namespace CyberEngineTweaks::Addresses
{
constexpr uintptr_t ImageBase = 0x140000000;

#pragma region CBaseInitializationState
constexpr uintptr_t CBaseInitializationState_OnTick = 0x140A730E0 - ImageBase; // 48 83 EC 28 48 8B 05 ? ? ? ? 4C 8B C2 48 85 C0 75 12 8D 50 03 49 8B C8 E8 ? ? ? ?, expected: 1, index: 0
constexpr uintptr_t CBaseInitializationState_OnTick = 0x140A81D30 - ImageBase; // 48 83 EC 28 48 8B 05 ? ? ? ? 4C 8B C2 48 85 C0 75 12 8D 50 03 49 8B C8 E8 ? ? ? ?, expected: 1, index: 0
#pragma endregion

#pragma region CGame
constexpr uintptr_t CGame_Main = 0x140A75630 - ImageBase; // 40 57 48 83 EC 70 48 8B F9 0F 29 7C 24 50 48 8D 4C 24 38, expected: 1, index: 0
constexpr uintptr_t CGame_Main = 0x140A84280 - ImageBase; // 40 57 48 83 EC 70 48 8B F9 0F 29 7C 24 50 48 8D 4C 24 38, expected: 1, index: 0
#pragma endregion

#pragma region CGameApplication
constexpr uintptr_t CGameApplication_Run = 0x140A71810 - ImageBase; // 48 89 5C 24 08 57 48 83 EC 20 48 8B D9 33 FF 90 E8 ? ? ? ? 84 C0, expected: 1, index: 0
constexpr uintptr_t CGameApplication_Run = 0x140A80460 - ImageBase; // 48 89 5C 24 08 57 48 83 EC 20 48 8B D9 33 FF 90 E8 ? ? ? ? 84 C0, expected: 1, index: 0
#pragma endregion

#pragma region CInitializationState
constexpr uintptr_t CInitializationState_OnTick = 0x140A733E0 - ImageBase; // 48 83 EC 28 48 8B 05 ? ? ? ? 4C 8B C2 8B 88 F8 00 00 00 85 C9 74 3D 83 E9 02 74 25 83 E9 01, expected: 1, index: 0
constexpr uintptr_t CInitializationState_OnTick = 0x140A82030 - ImageBase; // 48 83 EC 28 48 8B 05 ? ? ? ? 4C 8B C2 8B 88 F8 00 00 00 85 C9 74 3D 83 E9 02 74 25 83 E9 01, expected: 1, index: 0
#pragma endregion

#pragma region CPatches
constexpr uintptr_t CPatches_BoundaryTeleport = 0x141B2C570 - ImageBase; // 48 8B C4 55 53 41 54 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 48 89 70 10 48 8D 59 48, expected: 1, index: 0
constexpr uintptr_t CPatches_IntroMovie = 0x1401FF1D0 - 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 = 0x14117CB70 - ImageBase; // 48 8B 41 30 48 83 78 68 00 74, expected: 1, index: 0
constexpr uintptr_t CPatches_MinimapFlicker = 0x1425AB28D - ImageBase; // 83 79 2C 00 48 8B F2 4C, expected: 1, index: 0
constexpr uintptr_t CPatches_OptionsInit = 0x142BF4FE0 - ImageBase; // 40 53 48 83 EC 40 48 8B D9 48 8D 4C 24 20 E8 ? ? ? ? E8 ? ? ? ? 4C 8B 43 08, expected: 1, index: 0
constexpr uintptr_t CPatches_SkipStartScreen = 0x142A2C070 - ImageBase; // 74 5F E8 ? ? ? ? 48 8D 4C 24 20 8B D8 E8 ? ? ? ? 48 8B C8 8B D3 E8, expected: 2, index: 1
constexpr uintptr_t CPatches_AmdSMT = 0x142B9DC6B - ImageBase; // 75 2D 33 C9 B8 01 00 00 00 0F A2 8B C8 C1 F9 08, expected: 1, index: 0
constexpr uintptr_t CPatches_BoundaryTeleport = 0x141B3E360 - ImageBase; // 48 8B C4 55 53 41 54 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 48 89 70 10 48 8D 59 48, expected: 1, index: 0
constexpr uintptr_t CPatches_IntroMovie = 0x140209000 - 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 = 0x14118E330 - ImageBase; // 48 8B 41 30 48 83 78 68 00 74, expected: 1, index: 0
constexpr uintptr_t CPatches_MinimapFlicker = 0x1425BD0BD - ImageBase; // 83 79 2C 00 48 8B F2 4C, expected: 1, index: 0
constexpr uintptr_t CPatches_OptionsInit = 0x142C29680 - ImageBase; // 40 53 48 83 EC 40 48 8B D9 48 8D 4C 24 20 E8 ? ? ? ? E8 ? ? ? ? 4C 8B 43 08, expected: 1, index: 0
constexpr uintptr_t CPatches_SkipStartScreen = 0x142A5E990 - ImageBase; // 74 5F E8 ? ? ? ? 48 8D 4C 24 20 8B D8 E8 ? ? ? ? 48 8B C8 8B D3 E8, expected: 2, index: 1
constexpr uintptr_t CPatches_AmdSMT = 0x142BD230B - ImageBase; // 75 2D 33 C9 B8 01 00 00 00 0F A2 8B C8 C1 F9 08, expected: 1, index: 0
#pragma endregion

#pragma region CPhotoMode
constexpr uintptr_t CPhotoMode_SetRecordID = 0x142DC33F0 - ImageBase; // 48 8B C4 55 57 48 8D 68 A1 48 81 EC 98 00 00 00 48 89 58 08 48 8B D9 48 89 70 18 48 8D 4D 27 48, expected: 1, index: 0
constexpr uintptr_t CPhotoMode_SetRecordID = 0x142DFD400 - ImageBase; // 48 8B C4 55 57 48 8D 68 A1 48 81 EC 98 00 00 00 48 89 58 08 48 8B D9 48 89 70 18 48 8D 4D 27 48, expected: 1, index: 0
#pragma endregion

#pragma region CRenderGlobal
constexpr uintptr_t CRenderGlobal_InstanceOffset = 0x144DC7D40 - ImageBase; // 48 89 5C 24 08 48 89 6C 24 18 48 89 74 24 20 57 41 56 41 57 48 83 EC 30 8B 01 4C 8B F9 48, expected: 1, index: 0, offset: 41
constexpr uintptr_t CRenderGlobal__DoNotUse_RenderQueueOffset = 0x151F6FD59 - ImageBase; // 49 39 29 0F 84 ? ? ? ? 41 39 69 24 0F 84 ? ? ? ? 49 8B 95, expected: 1, index: 0, offset: 0
constexpr uintptr_t CRenderGlobal_Resize = 0x142CE4670 - ImageBase; // 44 88 4C 24 20 44 89 44 24 18 89 54 24 10 89 4C, expected: 1, index: 0
constexpr uintptr_t CRenderGlobal_Shutdown = 0x142CCEF20 - ImageBase; // 48 89 6C 24 20 41 56 48 83 EC 20 48 8D 05, expected: 1, index: 0
constexpr uintptr_t CRenderGlobal_InstanceOffset = 0x144E0AE80 - ImageBase; // 48 89 5C 24 08 48 89 6C 24 18 48 89 74 24 20 57 41 56 41 57 48 83 EC 30 8B 01 4C 8B F9 48, expected: 1, index: 0, offset: 41
constexpr uintptr_t CRenderGlobal__DoNotUse_RenderQueueOffset = 0x151FA54C9 - ImageBase; // 49 39 29 0F 84 ? ? ? ? 41 39 69 24 0F 84 ? ? ? ? 49 8B 95, expected: 1, index: 0, offset: 0
constexpr uintptr_t CRenderGlobal_Resize = 0x142D19DE0 - ImageBase; // 44 88 4C 24 20 44 89 44 24 18 89 54 24 10 89 4C, expected: 1, index: 0
constexpr uintptr_t CRenderGlobal_Shutdown = 0x142D03870 - ImageBase; // 48 89 6C 24 20 41 56 48 83 EC 20 48 8D 05, expected: 1, index: 0
#pragma endregion

#pragma region CRenderNode_Present
constexpr uintptr_t CRenderNode_Present_DoInternal = 0x142CE6C20 - ImageBase; // 48 89 5C 24 08 48 89 6C 24 18 48 89 74 24 20 57 41 56 41 57 48 83 EC 30 8B 01 4C 8B F9 48, expected: 1, index: 0
constexpr uintptr_t CRenderNode_Present_DoInternal = 0x142D1C3A0 - ImageBase; // 48 89 5C 24 08 48 89 6C 24 18 48 89 74 24 20 57 41 56 41 57 48 83 EC 30 8B 01 4C 8B F9 48, expected: 1, index: 0
#pragma endregion

#pragma region CRunningState
constexpr uintptr_t CRunningState_OnTick = 0x140A73520 - ImageBase; // 40 53 48 83 EC 20 48 8B 0D ? ? ? ? 48 8B DA E8 ? ? ? ? 84 C0, expected: 1, index: 0
constexpr uintptr_t CRunningState_OnTick = 0x140A82170 - ImageBase; // 40 53 48 83 EC 20 48 8B 0D ? ? ? ? 48 8B DA E8 ? ? ? ? 84 C0, expected: 1, index: 0
#pragma endregion

#pragma region CScript
constexpr uintptr_t CScript_RunPureScript = 0x14020BB10 - 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 = 0x1401AC240 - ImageBase; // BA B8 00 00 00 48 8D 4D D7 E8, expected: 3, index: 0
constexpr uintptr_t CScript_Log = 0x1401EDD90 - ImageBase; // 40 53 48 83 EC ? 48 8D 4C 24 20 48 8B DA E8 ? ? ? ? 33 D2 48 8D 4C 24 40 E8, expected: 1, index: 0
constexpr uintptr_t CScript_ToStringDEBUG = 0x140BD5AF0 - ImageBase; // 48 89 5C 24 08 57 48 83 EC 20 FE 42 62 4C 8D 15 ? ? ? ? 33 C9 33 C0, expected: 4, index: 2
constexpr uintptr_t CScript_LogChannel = 0x1401EDE30 - ImageBase; // 4C 8B DC 49 89 5B 08 49 89 73 18 57 48 83 EC 70 48 8B 02 ? ? ? ? ? ? ? FE 42 62 4D 8D 43 10 33 FF 45 33 C9 49 89 7B 10 48 8B DA 48 89 7A, expected: 1, index: 0
constexpr uintptr_t CScript_TDBIDConstructorDerive = 0x142BEE050 - ImageBase; // 40 53 48 83 EC 30 33 C0 4C 89 44 24 20 48 8B DA, expected: 1, index: 0
constexpr uintptr_t CScript_TranslateBytecode = 0x14027B150 - ImageBase; // 4C 8B DC 55 53 57 41 55 49 8D 6B A1 48 81 EC 98 00 00 00 48 8B 1A 4C 8B E9 8B 42 0C 48 8D 3C C3, expected: 1, index: 0
constexpr uintptr_t CScript_TweakDBLoad = 0x140BD3E20 - ImageBase; // 48 89 5C 24 18 55 57 41 56 48 8B EC 48 83 EC 70 48 8B D9 45 33 F6 48 8D, expected: 1, index: 0
constexpr uintptr_t CScript_RegisterMemberFunction = 0x14020AE00 - ImageBase; // 48 89 5C 24 08 57 48 83 EC 20 49 8B C1 4D 8B D0 44 8B 4C 24 58 48 8B DA 41 83 C9 03, expected: 1, index: 0
constexpr uintptr_t CScript_RunPureScript = 0x140215940 - 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 = 0x140284642 - ImageBase; // BA B8 00 00 00 48 8D 4D D7 E8, expected: 3, index: 0
constexpr uintptr_t CScript_Log = 0x1401F7BC0 - ImageBase; // 40 53 48 83 EC ? 48 8D 4C 24 20 48 8B DA E8 ? ? ? ? 33 D2 48 8D 4C 24 40 E8, expected: 1, index: 0
constexpr uintptr_t CScript_ToStringDEBUG = 0x140BE7000 - ImageBase; // 48 89 5C 24 08 57 48 83 EC 20 FE 42 62 4C 8D 15 ? ? ? ? 33 C9 33 C0, expected: 4, index: 2
constexpr uintptr_t CScript_LogChannel = 0x1401F7C60 - ImageBase; // 4C 8B DC 49 89 5B 08 49 89 73 18 57 48 83 EC 70 48 8B 02 ? ? ? ? ? ? ? FE 42 62 4D 8D 43 10 33 FF 45 33 C9 49 89 7B 10 48 8B DA 48 89 7A, expected: 1, index: 0
constexpr uintptr_t CScript_TDBIDConstructorDerive = 0x142C226F0 - ImageBase; // 40 53 48 83 EC 30 33 C0 4C 89 44 24 20 48 8B DA, expected: 1, index: 0
constexpr uintptr_t CScript_TranslateBytecode = 0x140284F80 - ImageBase; // 4C 8B DC 55 53 57 41 55 49 8D 6B A1 48 81 EC 98 00 00 00 48 8B 1A 4C 8B E9 8B 42 0C 48 8D 3C C3, expected: 1, index: 0
constexpr uintptr_t CScript_TweakDBLoad = 0x140BE5330 - ImageBase; // 48 89 5C 24 18 55 57 41 56 48 8B EC 48 83 EC 70 48 8B D9 45 33 F6 48 8D, expected: 1, index: 0
constexpr uintptr_t CScript_RegisterMemberFunction = 0x140214C30 - ImageBase; // 48 89 5C 24 08 57 48 83 EC 20 49 8B C1 4D 8B D0 44 8B 4C 24 58 48 8B DA 41 83 C9 03, expected: 1, index: 0
#pragma endregion

#pragma region CShutdownState
constexpr uintptr_t CShutdownState_OnTick = 0x140A73630 - ImageBase; // 48 89 6C 24 18 56 48 83 EC 30 48 8B 0D ? ? ? ?, expected: 1, index: 0
constexpr uintptr_t CShutdownState_OnTick = 0x140A82280 - ImageBase; // 48 89 6C 24 18 56 48 83 EC 30 48 8B 0D ? ? ? ?, expected: 1, index: 0
#pragma endregion

#pragma region CWinapi
constexpr uintptr_t CWinapi_ClipToCenter = 0x14078C3B0 - ImageBase; // 48 89 5C 24 08 57 48 83 EC 30 48 8B 99 ? 01 00 00 48 8B F9 FF, expected: 1, index: 0
constexpr uintptr_t CWinapi_ClipToCenter = 0x14079B150 - ImageBase; // 48 89 5C 24 08 57 48 83 EC 30 48 8B 99 ? 01 00 00 48 8B F9 FF, expected: 1, index: 0
#pragma endregion

#pragma region gameIGameSystem
constexpr uintptr_t gameIGameSystem_Constructor = 0x140AF68F6 - ImageBase; // 48 8B D9 E8 ? ? ? ? 48 8D 05 ? ? ? ? 48 C7 43 40 00 00 00 00, expected: 2, index: 0
constexpr uintptr_t gameIGameSystem_Initialize = 0x142DC4E10 - ImageBase; // 48 89 5C 24 18 48 89 6C 24 20 57 48 83 EC 30 48 8B 42 78, expected: 1, index: 0
constexpr uintptr_t gameIGameSystem_UnInitialize = 0x142DC3A80 - ImageBase; // 40 53 48 83 EC 20 48 8B D9 E8 ? ? ? ? 33 C0 48 89 43 50 48 89 43 48, expected: 1, index: 0
constexpr uintptr_t gameIGameSystem_Spawn = 0x142DC6010 - ImageBase; // 48 89 5C 24 18 55 56 41 54 41 56 41 57 48 8D 6C 24 90 48 81 EC 70 01 00 00 48 83 79 50 00 49 8B, expected: 1, index: 0
constexpr uintptr_t gameIGameSystem_Despawn = 0x142DC3AB0 - ImageBase; // 48 89 5C 24 10 48 89 6C 24 18 56 57 41 54 41 56 41 57 48 83 EC 50 4C 8B F9 0F 57 C0 48 83 C1 41, expected: 1, index: 0
constexpr uintptr_t gameIGameSystem_SpawnCallback = 0x1410F2560 - ImageBase; // 48 89 5C 24 18 48 89 6C 24 20 56 57 41 56 48 83 EC 70 48 8B F1 48 8B EA 48 83 C1 48 E8, expected: 1, index: 0
constexpr uintptr_t gameIGameSystem_Constructor = 0x140B07756 - ImageBase; // 48 8B D9 E8 ? ? ? ? 48 8D 05 ? ? ? ? 48 C7 43 40 00 00 00 00, expected: 2, index: 0
constexpr uintptr_t gameIGameSystem_Initialize = 0x142DFEE20 - ImageBase; // 48 89 5C 24 18 48 89 6C 24 20 57 48 83 EC 30 48 8B 42 78, expected: 1, index: 0
constexpr uintptr_t gameIGameSystem_UnInitialize = 0x142DFDA90 - ImageBase; // 40 53 48 83 EC 20 48 8B D9 E8 ? ? ? ? 33 C0 48 89 43 50 48 89 43 48, expected: 1, index: 0
constexpr uintptr_t gameIGameSystem_Spawn = 0x142E00020 - ImageBase; // 48 89 5C 24 18 55 56 41 54 41 56 41 57 48 8D 6C 24 90 48 81 EC 70 01 00 00 48 83 79 50 00 49 8B, expected: 1, index: 0
constexpr uintptr_t gameIGameSystem_Despawn = 0x142DFDAC0 - ImageBase; // 48 89 5C 24 10 48 89 6C 24 18 56 57 41 54 41 56 41 57 48 83 EC 50 4C 8B F9 0F 57 C0 48 83 C1 41, expected: 1, index: 0
constexpr uintptr_t gameIGameSystem_SpawnCallback = 0x141103D20 - ImageBase; // 48 89 5C 24 18 48 89 6C 24 20 56 57 41 56 48 83 EC 70 48 8B F1 48 8B EA 48 83 C1 48 E8, expected: 1, index: 0
#pragma endregion

#pragma region PlayerSystem
constexpr uintptr_t PlayerSystem_OnPlayerSpawned = 0x14271E280 - ImageBase; // 48 8B C4 4C 89 48 20 55 56 57 48 8B EC 48 81 EC 80 00 00 00, expected: 1, index: 0
constexpr uintptr_t PlayerSystem_OnPlayerSpawned = 0x142730170 - ImageBase; // 48 8B C4 4C 89 48 20 55 56 57 48 8B EC 48 81 EC 80 00 00 00, expected: 1, index: 0
#pragma endregion
} // namespace CyberEngineTweaks::Addresses
2 changes: 1 addition & 1 deletion src/reverse/NativeProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void NativeProxy::Callback(RED4ext::IScriptable* apSelf, RED4ext::CStackFrame* a
{
RED4ext::CStackType arg;
arg.type = param->type;
arg.value = param->GetValuePtr<void>(reinterpret_cast<void*>(apFrame->unk18));
arg.value = param->GetValuePtr<void>(apFrame->params);

args.emplace_back(Scripting::ToLua(lockedState, arg));
}
Expand Down
26 changes: 13 additions & 13 deletions src/reverse/RTTIExtender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ struct TEMP_SpawnSettings
uintptr_t unkC8 = 0;
uintptr_t unkD0 = 0;
uintptr_t unkD8 = 0;
RED4ext::TweakDBID DONOTUSE_recordDBID = 0;
RED4ext::TweakDBID DONOTUSE_recordDBID{};
uint32_t unkE8 = 0x10101FF;

void SetTransform(const RED4ext::WorldTransform& acWorldTransform)
Expand Down Expand Up @@ -327,7 +327,7 @@ void CreateSingleton(const RED4ext::Handle<RED4ext::IScriptable>& apClassInstanc
auto* pRTTI = RED4ext::CRTTISystem::Get();
auto* pType = apClassInstance->GetNativeType();
auto* pGameInstance = RED4ext::CGameEngine::Get()->framework->gameInstance;
if (pGameInstance->GetInstance(pType) != nullptr)
if (pGameInstance->GetSystem(pType) != nullptr)
return; // already init

auto* pGameSystemType = pRTTI->GetType("gameIGameSystem");
Expand Down Expand Up @@ -365,22 +365,22 @@ void CreateSingleton(const RED4ext::Handle<RED4ext::IScriptable>& apClassInstanc
}

auto* pParentType = apClassInstance->GetType();
pGameInstance->unk08.Insert(pParentType, apClassInstance);
pGameInstance->unk38.PushBack(apClassInstance);
pGameInstance->systemMap.Insert(pParentType, apClassInstance);
pGameInstance->systemInstances.PushBack(apClassInstance);

pParentType = pParentType->parent;
auto* pReplicatedGameSystemType = pRTTI->GetType("gameIReplicatedGameSystem");
while (pParentType && pParentType != pGameSystemType && pParentType != pReplicatedGameSystemType)
{
pGameInstance->unk48.Insert(pParentType, pType);
pGameInstance->systemImplementations.Insert(pParentType, pType);
pParentType = pParentType->parent;
}
}
else
{
auto* pParentType = apClassInstance->GetType();
pGameInstance->unk08.Insert(pParentType, apClassInstance);
pGameInstance->unk48.Insert(pParentType, pType);
pGameInstance->systemMap.Insert(pParentType, apClassInstance);
pGameInstance->systemImplementations.Insert(pParentType, pType);
}
}

Expand All @@ -389,7 +389,7 @@ void CreateSingleton(const RED4ext::CName acTypeName)
auto* pRTTI = RED4ext::CRTTISystem::Get();
auto* pType = pRTTI->GetClass(acTypeName);
auto* pGameInstance = RED4ext::CGameEngine::Get()->framework->gameInstance;
if (pGameInstance->GetInstance(pType) != nullptr)
if (pGameInstance->GetSystem(pType) != nullptr)
return; // already init

auto* pClassInstance = static_cast<RED4ext::IScriptable*>(pType->CreateInstance());
Expand Down Expand Up @@ -423,7 +423,7 @@ void WorldFunctionalTests_SpawnEntity(RED4ext::IScriptable*, RED4ext::CStackFram
auto* pRTTI = RED4ext::CRTTISystem::Get();
auto* pGameInstance = RED4ext::CGameEngine::Get()->framework->gameInstance;
auto* pFunctionalType = pRTTI->GetType("FunctionalTestsGameSystem");
auto* pFunctionalSystem = reinterpret_cast<FunctionalTestsGameSystem*>(pGameInstance->GetInstance(pFunctionalType));
auto* pFunctionalSystem = reinterpret_cast<FunctionalTestsGameSystem*>(pGameInstance->GetSystem(pFunctionalType));
uint32_t oldSize = pFunctionalSystem->spawner.pendingEntities.size;

ExecuteFunction("WorldFunctionalTests", "Internal_SpawnEntity", nullptr, entityPath, worldTransform, unknown);
Expand Down Expand Up @@ -539,7 +539,7 @@ struct exEntitySpawnerSystem : gameIGameSystem
RED4ext::CName entityPath; // <- raRef
RED4ext::WorldTransform worldTransform{};
RED4ext::CName appearance = "default";
RED4ext::TweakDBID recordDBID = 0;
RED4ext::TweakDBID recordDBID{};

GetParameter(apFrame, &entityPath);
GetParameter(apFrame, &worldTransform);
Expand Down Expand Up @@ -569,7 +569,7 @@ struct exEntitySpawnerSystem : gameIGameSystem

static void SpawnRecord(IScriptable*, RED4ext::CStackFrame* apFrame, RED4ext::ent::EntityID* apOut, int64_t)
{
RED4ext::TweakDBID recordDBID = 0;
RED4ext::TweakDBID recordDBID{};
RED4ext::WorldTransform worldTransform{};
RED4ext::CName appearance = "default";
GetParameter(apFrame, &recordDBID);
Expand Down Expand Up @@ -629,11 +629,11 @@ void RTTIExtender::AddFunctionalTests()
RED4EXT_ASSERT_OFFSET(WorldFunctionalTests, unk40, 0x40);

auto* pGameInstance = RED4ext::CGameEngine::Get()->framework->gameInstance;
auto* pWorld = reinterpret_cast<WorldFunctionalTests*>(pGameInstance->GetInstance(pClass));
auto* pWorld = reinterpret_cast<WorldFunctionalTests*>(pGameInstance->GetSystem(pClass));

// whatever this is, it's only used to get gameInstance
// passing cpPlayerSystem (or any system) will work
pWorld->unk40 = pGameInstance->GetInstance(pRTTI->GetType("cpPlayerSystem"))->ref.Lock();
pWorld->unk40 = pGameInstance->GetSystem(pRTTI->GetType("cpPlayerSystem"))->ref.Lock();
}

auto* pFunction = pClass->GetFunction("SpawnEntity");
Expand Down
2 changes: 1 addition & 1 deletion src/reverse/RTTIHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void RTTIHelper::InitializeRuntime()
m_pGameInstance = static_cast<ScriptGameInstance*>(m_pGameInstanceType->CreateInstance());
m_pGameInstance->gameInstance = cpGameInstance;

m_pPlayerSystem = cpGameInstance->GetInstance(cpPlayerSystemType);
m_pPlayerSystem = cpGameInstance->GetSystem(cpPlayerSystemType);
}

void RTTIHelper::ParseGlobalStatics()
Expand Down
Loading

0 comments on commit 5d880da

Please sign in to comment.