diff options
author | BDKPlayer <fabian.stotz@yahoo.de> | 2020-03-11 20:52:05 +0100 |
---|---|---|
committer | BDKPlayer <fabian.stotz@yahoo.de> | 2020-03-11 20:52:05 +0100 |
commit | d86765d54c5725d09dfb618811525498f647ff85 (patch) | |
tree | 1cf787795eaf6d826fa0cd7db178f1eaaf9be7dd | |
parent | aa75847f5770c3bbd2840ff5c52af32761e475aa (diff) |
Added: Engine::GetLocalplayer
-rw-r--r-- | Core.cpp | 15 | ||||
-rw-r--r-- | Engine.cpp | 13 | ||||
-rw-r--r-- | Engine.h | 1 | ||||
-rw-r--r-- | MinimapText.cpp | 29 | ||||
-rw-r--r-- | Offsets.h | 8 |
5 files changed, 51 insertions, 15 deletions
@@ -79,18 +79,15 @@ void createPlayerTreeNode(Player* player, int playerIndex) void Core::OnPresent() { - printf("OnPresent\n"); __try { MainScreen* mainScreen = Engine::Get()->GetMainScreen(); - //printf("mainScreen: %p\n", mainScreen); if (!mainScreen) { return; } World* world = Engine::Get()->GetWorld(); - printf("world: %p\n", world); PlayerArray* playerArray = world->pPlayerArray; @@ -98,19 +95,13 @@ void Core::OnPresent() { return; } - printf("playerArray: %p\n", playerArray); int totalPlayers = Engine::Get()->GetTotalPlayers(); - printf("totalPlayers: %d\n", totalPlayers); - - static bool openOverlay = true; if (GetAsyncKeyState(VK_INSERT) & 1) { openOverlay = !openOverlay; } Renderer::Get()->BeginScene(); - printf("BeginScene\n"); FeatureManager::Get()->OnDraw(); - printf("OnDraw\n"); Player* gaiaPlayer = *(Player**)(playerArray); if (gaiaPlayer) @@ -126,19 +117,14 @@ void Core::OnPresent() } } - printf("Iterating players\n"); for (int i = 1; i <= totalPlayers; i++) { - printf("PlayerIndex: %d\n", i); Player* player = playerArray->playerData[i].player; if (!player) { continue; } - printf("Player: %p\n", player); FeatureManager::Get()->OnPlayerIteration(player, i); - printf("ObjectManager: %p\n", player->pObjectManager); - printf("ObjectManagerCount: %d\n", player->pObjectManager->Count); for (int j = 0; j < player->pObjectManager->Count; j++) { Unit* unit = player->pObjectManager->units[j]; @@ -161,6 +147,7 @@ void Core::OnPresent() { ImGui::Text("World %p", world); ImGui::Text("Map %p tilesize %d", world->pMap, world->pMap->GetTileSize()); + ImGui::Text("Localplayer %p", Engine::Get()->GetLocalPlayer()); ImGui::Text("PlayerArray %p", playerArray); ImGui::Text("totalPlayers %d", totalPlayers); ImGui::Text("ScreenPos %f %f %f", mainScreen->pGameScreen->pMainView->ScreenPosX, mainScreen->pGameScreen->pMainView->ScreenPosY, mainScreen->pGameScreen->pMainView->ScreenPosZ); @@ -163,3 +163,16 @@ Player* Engine::GetPlayerByName(char* playerName) } return NULL; } + +Player* Engine::GetLocalPlayer() +{ + uint64_t tribePanelInven = *reinterpret_cast<uint64_t*>(base + Offsets::tribePanelInven); + if (!tribePanelInven) + { + return NULL; + } + else + { + return *reinterpret_cast<Player**>(tribePanelInven + Offsets::tribePanelInven_localPlayer); + } +}
\ No newline at end of file @@ -34,4 +34,5 @@ public: uint32_t GetPlayerColor(int colorIndex); ImVec4 GetPlayerColorImGUI(int colorIndex); Player* GetPlayerByName(char* playername); + Player* GetLocalPlayer(); };
\ No newline at end of file diff --git a/MinimapText.cpp b/MinimapText.cpp index fc6ef8a..1d13635 100644 --- a/MinimapText.cpp +++ b/MinimapText.cpp @@ -18,6 +18,15 @@ char* name = "NewName"; +typedef int(__fastcall* printMinimap)(void* that, char* format, ...); +printMinimap oPrintMinimap; + +int __fastcall hookedWrapper(void* that, char* format, char* playername, int currentPoints, int maxPoints) +{ + printf("In da Hook\n"); + + return oPrintMinimap(that, format, playername, currentPoints, maxPoints); //call original call +} void MinimapText::OnInitialise() { @@ -34,6 +43,26 @@ void MinimapText::OnInitialise() //printf("hookAddress: %p\n", hookAddress); //minimapTextDetour = new DetourHook64(); //minimapTextDetour->Hook(hookAddress, shellcode, shellcodeSize, (uint64_t)(hookAddress + 23), 19); + + BYTE* callAddress = (BYTE*)Utility::Scan("\xE8\x00\x00\x00\x00\x49\x8B\x9D\x00\x00\x00\x00\x33\xD2\x44", "x????xxx????xxx", (char*)0x7ff000000000, 0x800000000000 - 0x7ff000000000); + + BYTE* function = (BYTE*)Utility::Scan("\xFF\x15\x00\x00\x00\x00\x85\xC0\x0F\x48", "xx????xxxx", (char*)0x7ff000000000, 0x800000000000 - 0x7ff000000000); + + function = function - 0x4b; + printf("callAddress: %p\n", callAddress); + printf("function: %p\n", function); + printf("hookedWrapper: %p\n", hookedWrapper); + + + oPrintMinimap = (printMinimap)(function); + + int32_t callRelativeOffset = (int64_t)hookedWrapper - (int64_t)callAddress - 5; + + + getchar(); + //*(int32_t*)(callAddress + 1) = callRelativeOffset; //override original call + + //TO CALL E8 ? ? ? ? 49 8B 9D ? ? ? ? 33 D2 44 } void MinimapText::OnShutdown() @@ -13,5 +13,11 @@ namespace Offsets //44 89 25 ? ? ? ? 2B //41 8B 45 28 99 - int32_t totalPlayers = 0x28900D4; //correct + int64_t totalPlayers = 0x28900D4; //correct + + //48 8B 0D ? ? ? ? 48 85 C9 74 0C 45 + int64_t tribePanelInven = 0x29c5110; + + //48 8B 83 ? ? ? ? 48 8B 48 70 F3 0F 10 + int64_t tribePanelInven_localPlayer = 0x208; }
\ No newline at end of file |