aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBDKPlayer <fabian.stotz@yahoo.de>2020-08-01 14:45:52 +0200
committerBDKPlayer <fabian.stotz@yahoo.de>2020-08-01 14:45:52 +0200
commitac611e09cf668329703b43c4b88bab63a3398148 (patch)
tree00a7b3eb737bb2eb90171e4e56713defa3a6f435
parentbe9a9b51f2258cceb7cf911c3e6981134c06a552 (diff)
Added support for ManualMap by removing TLS callbacks
-rw-r--r--Classes.h3
-rw-r--r--Core.cpp5
-rw-r--r--ESP.cpp2
-rw-r--r--Engine.cpp10
-rw-r--r--FeatureManager.cpp2
-rw-r--r--Source.cpp7
6 files changed, 16 insertions, 13 deletions
diff --git a/Classes.h b/Classes.h
index 8f91625..a38687f 100644
--- a/Classes.h
+++ b/Classes.h
@@ -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
diff --git a/Core.cpp b/Core.cpp
index 17f0f03..74ad230 100644
--- a/Core.cpp
+++ b/Core.cpp
@@ -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();
diff --git a/ESP.cpp b/ESP.cpp
index 8e8b1b3..dd50c6e 100644
--- a/ESP.cpp
+++ b/ESP.cpp
@@ -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();
diff --git a/Engine.cpp b/Engine.cpp
index bb3db2a..f59e68e 100644
--- a/Engine.cpp
+++ b/Engine.cpp
@@ -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);
}
diff --git a/Source.cpp b/Source.cpp
index 7bfb773..045300f 100644
--- a/Source.cpp
+++ b/Source.cpp
@@ -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();