Skip to content

Commit

Permalink
Fix all hooks for Steam
Browse files Browse the repository at this point in the history
  • Loading branch information
TheIndra55 committed Jun 13, 2021
1 parent 9103a30 commit 7d42265
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 24 deletions.
4 changes: 2 additions & 2 deletions ControlHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ void InstallControlHooks()
//MH_CreateHook((void*)0x004EC280, GetNumButtons, nullptr);

#if TRAE
UIDataList__AllocateRunData = reinterpret_cast<char(__thiscall*)(DWORD, int, int, int, int, int)>(0x00C704C2);
UIDataList__AddItem = reinterpret_cast<char(__thiscall*)(DWORD, int, void*, int, int, const char*)>(0x00C70577);
UIDataList__AllocateRunData = reinterpret_cast<char(__thiscall*)(DWORD, int, int, int, int, int)>(0x004ED600);
UIDataList__AddItem = reinterpret_cast<char(__thiscall*)(DWORD, int, void*, int, int, const char*)>(0x004ED6C0);

MH_CreateHook((void*)0x004ECCB0, UIControllerConfigDataList, nullptr);

Expand Down
10 changes: 2 additions & 8 deletions Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,16 @@ void Game::Initialize()
#elif TR7
PLAYER_DebugSwitchPlayerCharacter = reinterpret_cast<void(__cdecl*)()>(0x005A9A90);
#endif
sub_C64D3F = reinterpret_cast<DWORD(__cdecl*)(int, int, int)>(0xC64D3F);
G2EmulationInstanceSetEventAnimPlaying = reinterpret_cast<void(__cdecl*)(Instance*, int)>(0x4DE940);

IncrHealth = reinterpret_cast<void(__cdecl*)(float)>(0x005715E0);
UIFadeGroupTrigger = reinterpret_cast<void(__cdecl*)(int)>(0x004EE580);
game_SetGameValue = reinterpret_cast<void(__cdecl*)(int, float, char)>(0x004551A0);

PLAYER_SetLookAround = reinterpret_cast<void(__cdecl*)(Instance*)>(0x00C759A8);
PLAYER_SetLookAround = reinterpret_cast<void(__cdecl*)(Instance*)>(0x005600F0);
CAMERA_StartLookaroundMode = reinterpret_cast<void(__cdecl*)(DWORD)>(0x0048A300);
SteerSwitchMode = reinterpret_cast<int(__cdecl*)(Instance*, int)>(0x005BAE60);
PLAYER_ReSetLookAround = reinterpret_cast<void(__cdecl*)(Instance * instance)>(0x00C759C7);
PLAYER_ReSetLookAround = reinterpret_cast<void(__cdecl*)(Instance * instance)>(0x00560110);
CAMERA_ForceEndLookaroundMode = reinterpret_cast<__int16(__cdecl*)(DWORD)>(0x0048A5E0);

sub_456B50 = reinterpret_cast<void(__cdecl*)()>(0x456B50);
Expand Down Expand Up @@ -215,11 +214,6 @@ void Game::SwitchPlayerCharacter()
#endif
}

DWORD Game::AnimDataSomething(int a1, int a2, int a3)
{
return sub_C64D3F(a1, a2, a3);
}

void Game::InstanceSetEventAnimPlaying(Instance* instance, int a2)
{
G2EmulationInstanceSetEventAnimPlaying(instance, a2);
Expand Down
4 changes: 3 additions & 1 deletion Hooking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,9 @@ void Hooking::GotDevice()
objCheckFamily = reinterpret_cast<bool(__cdecl*)(DWORD instance, unsigned __int16 family)>(0x534660);

MH_CreateHook((void*)0x00434C40, Font__Flush, (void**)&org_Font__Flush);
Font__Print = reinterpret_cast<void(__cdecl*)(DWORD, const char*, ...)>(0x00434C10);

auto pFound = FindPattern((PBYTE)"\xE8\x00\x00\x00\x00\x68\x00\x00\x00\x00\xE8\x00\x00\x00\x00\xA0\x00\x00\x00\x00\x83\xC4\x00\x84\xC0\x0F\x84", "x????x????x????x????xx?xxxx");
Font__Print = (void(__cdecl*)(DWORD, const char*, ...))GetAddress(pFound, 0x1, 0x5); // 0x00434C10

TRANS_RotTransPersVectorf = reinterpret_cast<float*(__cdecl*)(DWORD, DWORD)>(0x00402B50);

Expand Down
13 changes: 0 additions & 13 deletions Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,19 +678,6 @@ void Menu::Draw()
Game::SetGameValue(126, 10.0, 1);
}

if (ImGui::Button("Turn Lara into gold anim"))
{
auto player = *reinterpret_cast<Instance**>(PLAYERINSTANCE);
int v11 = 52;

Game::InstancePost(player, 262158, 1);

auto anim = Game::AnimDataSomething((int)player, (int)player, (int)&v11);
Game::InstancePost(player, 262147, anim);
Game::InstanceSetEventAnimPlaying(player, 0);
Game::PlayerTurnGold();
}

if (ImGui::Button("Real gold lara"))
{
Game::PlayerTurnGold();
Expand Down

0 comments on commit 7d42265

Please sign in to comment.