diff options
author | BDKPlayer <fabian.stotz@yahoo.de> | 2020-08-01 14:45:52 +0200 |
---|---|---|
committer | BDKPlayer <fabian.stotz@yahoo.de> | 2020-08-01 14:45:52 +0200 |
commit | ac611e09cf668329703b43c4b88bab63a3398148 (patch) | |
tree | 00a7b3eb737bb2eb90171e4e56713defa3a6f435 | |
parent | be9a9b51f2258cceb7cf911c3e6981134c06a552 (diff) |
Added support for ManualMap by removing TLS callbacks
-rw-r--r-- | Classes.h | 3 | ||||
-rw-r--r-- | Core.cpp | 5 | ||||
-rw-r--r-- | ESP.cpp | 2 | ||||
-rw-r--r-- | Engine.cpp | 10 | ||||
-rw-r--r-- | FeatureManager.cpp | 2 | ||||
-rw-r--r-- | Source.cpp | 7 |
6 files changed, 16 insertions, 13 deletions
@@ -220,8 +220,7 @@ class Map public: int32_t GetTileSize() { - static int32_t tileOffset = 0x5B38; - return *reinterpret_cast<int32_t*>((int64_t)this + tileOffset); + return *reinterpret_cast<int32_t*>((int64_t)this + 0x5B38); } }; //Size=0x5CC8 @@ -31,6 +31,9 @@ MidfunctionHook onGameStartHook = MidfunctionHook(); MidfunctionHook onTurnHook = MidfunctionHook(); MidfunctionHook onCreateUnitHook = MidfunctionHook(); + +bool openOverlay = true; + void __fastcall OnGameStartHook(Registers* registers) { FeatureManager::Get()->OnGameStart(); @@ -176,7 +179,6 @@ void createPlayerTreeNode(Player* player, int playerIndex) ImGui::PopStyleColor(); } - void Core::OnPresent() { __try @@ -202,7 +204,6 @@ void Core::OnPresent() //printf(" playerArray %p", playerArray); int64_t totalPlayers = Engine::Get()->GetTotalPlayers(); - static bool openOverlay = true; if (GetAsyncKeyState(VK_INSERT) & 1) { openOverlay = !openOverlay; } Renderer::Get()->BeginScene(); @@ -82,7 +82,7 @@ void ESP::DrawBox(Vector3 position, Vector2 edgeSize, int32_t color) void ESP::DrawCircle(Unit* unit, int radius, int32_t color, int smoothness = 16, float thickness = 1.f, bool drawName = false) { - static const float PI = 3.14159265358979323846f; + const float PI = 3.14159265358979323846f; int32_t tileSize = Engine::Get()->GetWorld()->pMap->GetTileSize(); Vector3 center = unit->GetPosition(); @@ -72,7 +72,7 @@ PlayerArray* Engine::GetPlayerArray() const Vector2 Engine::worldToScreen(Vector3 position) const { MainScreen* mainScreen = GetMainScreen(); - static int tileSize = GetWorld()->pMap->GetTileSize(); + int tileSize = GetWorld()->pMap->GetTileSize(); float tile_width = tileSize * mainScreen->pGameScreen->pMainView->ScreenPosZ; float tile_height = tileSize * mainScreen->pGameScreen->pMainView->ScreenPosZ; @@ -213,8 +213,8 @@ Player* Engine::GetLocalPlayer() const void Engine::SendChat(const char* message, bool teamchat) const { typedef void(__fastcall* tSendChat) (int64_t game, const char* text); - static tSendChat fSendChat = (tSendChat)(base + Offsets::sendChat); - static int64_t game = *(int64_t*)(base + Offsets::pAVGame); + tSendChat fSendChat = (tSendChat)(base + Offsets::sendChat); + int64_t game = *(int64_t*)(base + Offsets::pAVGame); if (teamchat) { @@ -230,13 +230,13 @@ void Engine::SendChat(const char* message, bool teamchat) const void Engine::PrintNotification(const char* message) const { typedef void(__fastcall* tPrintNotification) (GameScreen* AVGameScreen, const char* message, int unknown); - static tPrintNotification fPrintNotification = (tPrintNotification)(base + Offsets::printNotification); + tPrintNotification fPrintNotification = (tPrintNotification)(base + Offsets::printNotification); fPrintNotification(GetMainScreen()->pGameScreen, message, 0); } void Engine::PrintBottomNotification(const char* message, unsigned int hexcolor) const { typedef void(__fastcall* tPrintBottomText) (GameScreen* AVGameScreen, const char* message, unsigned int hexcolor, int64_t unused); - static tPrintBottomText fPrintBottomText = (tPrintBottomText)(base + Offsets::printBottomText); + tPrintBottomText fPrintBottomText = (tPrintBottomText)(base + Offsets::printBottomText); fPrintBottomText(GetMainScreen()->pGameScreen, message, hexcolor, 0xffffffffffffffff); //Color format: RBGA } diff --git a/FeatureManager.cpp b/FeatureManager.cpp index 8d9b71f..ca7cf66 100644 --- a/FeatureManager.cpp +++ b/FeatureManager.cpp @@ -22,8 +22,6 @@ FeatureManager* FeatureManager::Get() void FeatureManager::RegisterFeature(Feature* feature) { - static int feature_numer = 0; - printf("Registered feature %d\n", feature_numer++); features.push_back(feature); } @@ -24,6 +24,8 @@ ID3D11DeviceContext* pContext = nullptr; DWORD_PTR* pSwapChainVtable = nullptr; +Core* core = nullptr; + #include "main.h" //helper funcs @@ -184,7 +186,10 @@ HRESULT __stdcall hookD3D11Present(IDXGISwapChain* pSwapChain, UINT SyncInterval ImGui_ImplDX11_NewFrame(); ImGui::NewFrame(); - static Core* core = new Core(); + if (!core) + { + core = new Core(); + } core->OnPresent(); ImGui::EndFrame(); |