diff options
author | BDKPlayer <fabian.stotz@yahoo.de> | 2020-04-04 22:05:13 +0200 |
---|---|---|
committer | BDKPlayer <fabian.stotz@yahoo.de> | 2020-04-04 22:05:13 +0200 |
commit | 351c040f00745b985b71423e5ac1bfede12c85b5 (patch) | |
tree | f0a6479a26c9d41036bbfdc788417b72d775cadc | |
parent | d0f91aed16a1cb40df6e1ab7c19b17410888906d (diff) |
Added notification system
-rw-r--r-- | AoE_imgui_DE.vcxproj | 2 | ||||
-rw-r--r-- | AoE_imgui_DE.vcxproj.filters | 6 | ||||
-rw-r--r-- | Core.cpp | 62 | ||||
-rw-r--r-- | CustomLoadingScreen.h | 10 | ||||
-rw-r--r-- | Debug.cpp | 30 | ||||
-rw-r--r-- | Debug.h | 10 | ||||
-rw-r--r-- | ESP.cpp | 9 | ||||
-rw-r--r-- | ESP.h | 8 | ||||
-rw-r--r-- | Engine.cpp | 53 | ||||
-rw-r--r-- | Engine.h | 28 | ||||
-rw-r--r-- | Feature.cpp | 10 | ||||
-rw-r--r-- | Feature.h | 2 | ||||
-rw-r--r-- | FeatureManager.cpp | 18 | ||||
-rw-r--r-- | FeatureManager.h | 4 | ||||
-rw-r--r-- | MidfunctionHook.h | 8 | ||||
-rw-r--r-- | MinimapText.cpp | 15 | ||||
-rw-r--r-- | MinimapText.h | 8 | ||||
-rw-r--r-- | Offsets.cpp | 13 | ||||
-rw-r--r-- | Offsets.h | 6 | ||||
-rw-r--r-- | RelicManager.cpp | 4 | ||||
-rw-r--r-- | RelicManager.h | 7 | ||||
-rw-r--r-- | Renderer.cpp | 8 | ||||
-rw-r--r-- | Renderer.h | 1 | ||||
-rw-r--r-- | ResourceInformation.cpp | 2 | ||||
-rw-r--r-- | ResourceInformation.h | 2 | ||||
-rw-r--r-- | Source.cpp | 56 | ||||
-rw-r--r-- | VmtHook.h | 2 |
27 files changed, 260 insertions, 124 deletions
diff --git a/AoE_imgui_DE.vcxproj b/AoE_imgui_DE.vcxproj index 7432e66..9339587 100644 --- a/AoE_imgui_DE.vcxproj +++ b/AoE_imgui_DE.vcxproj @@ -150,6 +150,7 @@ <ClInclude Include="Classes.h" /> <ClInclude Include="Core.h" /> <ClInclude Include="CustomLoadingScreen.h" /> + <ClInclude Include="Debug.h" /> <ClInclude Include="Engine.h" /> <ClInclude Include="ESP.h" /> <ClInclude Include="Feature.h" /> @@ -177,6 +178,7 @@ <ItemGroup> <ClCompile Include="Core.cpp" /> <ClCompile Include="CustomLoadingScreen.cpp" /> + <ClCompile Include="Debug.cpp" /> <ClCompile Include="Engine.cpp" /> <ClCompile Include="ESP.cpp" /> <ClCompile Include="Feature.cpp" /> diff --git a/AoE_imgui_DE.vcxproj.filters b/AoE_imgui_DE.vcxproj.filters index 549165b..b6662bf 100644 --- a/AoE_imgui_DE.vcxproj.filters +++ b/AoE_imgui_DE.vcxproj.filters @@ -114,6 +114,9 @@ <ClInclude Include="VmtHook.h"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="Debug.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="imgui\imgui.cpp"> @@ -179,5 +182,8 @@ <ClCompile Include="VmtHook.cpp"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="Debug.cpp"> + <Filter>Source Files\Feature</Filter> + </ClCompile> </ItemGroup> </Project>
\ No newline at end of file @@ -12,6 +12,7 @@ #include "Engine.h" #include "FeatureManager.h" #include "Utility.h" +#include "MidfunctionHook.h" //Features #include "ResourceInformation.h" @@ -19,16 +20,42 @@ #include "MinimapText.h" #include "RelicManager.h" #include "CustomLoadingScreen.h" +#include "Debug.h" + +MidfunctionHook onGameStartHook = MidfunctionHook(); +MidfunctionHook onTurnHook = MidfunctionHook(); + +void __fastcall OnGameStartHook(Registers* registers) +{ + FeatureManager::Get()->OnGameStart(); + printf("OnGameStart()\n"); +} + + +void __fastcall OnTurnHook(Registers* registers) +{ + FeatureManager::Get()->OnTurn(); + printf("OnTurn()\n"); +} + Core::Core() { + //onGameStartHook.Hook((BYTE*)GetModuleHandle(NULL) + 0xba276a, (BYTE*)OnGameStartHook, 15); + //onGameStartHook.Hook((BYTE*)GetModuleHandle(NULL) + 0x7463b, (BYTE*)OnTurnHook, 14); + FeatureManager* featureManager = FeatureManager::Get(); + //Register Features here - featureManager->registerFeature(new ResourceInformation()); - featureManager->registerFeature(new ESP()); - featureManager->registerFeature(new MinimapText()); - featureManager->registerFeature(new RelicManager()); - featureManager->registerFeature(new CustomLoadingScreen("C:\\wallpaper.jpg")); + featureManager->RegisterFeature(new ResourceInformation()); + featureManager->RegisterFeature(new ESP()); + featureManager->RegisterFeature(new MinimapText()); + featureManager->RegisterFeature(new RelicManager()); + featureManager->RegisterFeature(new CustomLoadingScreen("C:\\wallpaper.jpg")); + +#ifdef _DEBUG + featureManager->RegisterFeature(new Debug()); +#endif FeatureManager::Get()->OnInitialise(); } @@ -60,17 +87,28 @@ void createPlayerTreeNode(Player* player, int playerIndex) ImGui::Text("%s", unit->pUnitData->name); ImGui::SameLine(); std::string text = std::string("Copy##") + std::string(unit->pUnitData->name) + std::to_string(i); - /*if (ImGui::Button(text.c_str())) - { - unit->MoveTo(Engine::Get()->GetWorld(), 50.f, 50.f); - }*/ if (ImGui::Button(text.c_str())) { Utility::CopyToClipboard((uint64_t)unit); } + std::string vmtTree = std::string("VMT##") + std::string(unit->pUnitData->name) + "VMT"; + if (ImGui::TreeNode(vmtTree.c_str())) + { + for (int vmtIndex = 0; vmtIndex < 175; vmtIndex++) + { + std::string vmtText = std::string("Copy##") + std::string(unit->pUnitData->name) + std::to_string(vmtIndex) + "VMT"; + ImGui::Text("%d - %p", vmtIndex, *(int64_t**)(*(int64_t**)unit + vmtIndex)); + ImGui::SameLine(); + if (ImGui::Button(vmtText.c_str())) + { + Utility::CopyToClipboard((uint64_t) * (int64_t**)(*(int64_t**)unit + vmtIndex)); + } + } + ImGui::TreePop(); + } - /* if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Building) + if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Building) { buildingCount++; } @@ -81,7 +119,7 @@ void createPlayerTreeNode(Player* player, int playerIndex) if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Cavalry) { calavaryCount++; - }*/ + } } } ImGui::Text("Buildings %.d", buildingCount); @@ -149,7 +187,7 @@ void Core::OnPresent() { continue; } - if (skipLocalplayer && player == Engine::Get()->GetLocalPlayer()) + if (skipLocalplayer && player == Engine::Get()->GetLocalPlayer()) { continue; } diff --git a/CustomLoadingScreen.h b/CustomLoadingScreen.h index 66737b0..21f1eaa 100644 --- a/CustomLoadingScreen.h +++ b/CustomLoadingScreen.h @@ -5,16 +5,16 @@ class CustomLoadingScreen : public Feature { private: - CustomLoadingScreen(); - char* imagePath; public: + CustomLoadingScreen() = delete; + //Supports .gif, .bmp, .jpg, .png CustomLoadingScreen(char* imagePath); //Callbacks - void OnInitialise(); - void OnMenuMainWindow(); - void OnShutdown(); + void OnInitialise() override; + void OnMenuMainWindow() override; + void OnShutdown() override; };
\ No newline at end of file diff --git a/Debug.cpp b/Debug.cpp new file mode 100644 index 0000000..c6fb43f --- /dev/null +++ b/Debug.cpp @@ -0,0 +1,30 @@ +#include "Debug.h" + +#include "Sdk.h" +#include "Renderer.h" +#include "Engine.h" + + +void Debug::OnInitialise() +{ + +} +void Debug::OnMenuMainWindow() +{ + ImGui::Separator(); + ImGui::Text("Debug"); + if (ImGui::Button("Annoy @Kleon")) + { + Engine::Get()->PrintNotification("When DOOM Eternal hack? "); + } + if (ImGui::Button("Annoy @Timb3r")) + { + Engine::Get()->PrintBottomNotification("I do miss the meme war :(", 0xffffffff); + } + ImGui::Separator(); +} + +void Debug::OnShutdown() +{ + +}
\ No newline at end of file @@ -0,0 +1,10 @@ +#pragma once +#include "Feature.h" + +class Debug : public Feature +{ + //Callbacks + void OnInitialise() override; + void OnMenuMainWindow() override; + void OnShutdown() override; +};
\ No newline at end of file @@ -110,7 +110,6 @@ void ESP::DrawCircle(Unit* unit, int radius, int32_t color, int smoothness = 16, void ESP::OnUnitIteration(Unit* unit, Player* player, int playerIndex) { - if (playerUnitEsp[playerIndex]) { if (strcmp(unit->pUnitData->name, "FLARE") == 0) @@ -231,14 +230,15 @@ void ESP::OnNeutralUnit(Unit* unit) } if (strcmp(unitName.c_str(), "BOARX") == 0 || strcmp(unitName.c_str(), "RHINO") == 0 || - strcmp(unitName.c_str(), "BOAR") == 0 || strcmp(unitName.c_str(), "BOARJ") == 0 || - strcmp(unitName.c_str(), "ZEBRA") == 0) + strcmp(unitName.c_str(), "BOAR") == 0 || strcmp(unitName.c_str(), "BOARJ") == 0 || + strcmp(unitName.c_str(), "WELEF") == 0) { Renderer::Get()->RenderCircleFilled(ImVec2(screenPos.x, screenPos.y), 20, 0x4000ff00); Renderer::Get()->RenderText(unitName, ImVec2(screenPos.x, screenPos.y), 16, 0xffffffff); } - if (strcmp(unitName.c_str(), "DEERX") == 0 || strcmp(unitName.c_str(), "IBEX") == 0) + if (strcmp(unitName.c_str(), "DEERX") == 0 || strcmp(unitName.c_str(), "IBEX") == 0 || + strcmp(unitName.c_str(), "ZEBRA") == 0 || strcmp(unitName.c_str(), "OSTRICH") == 0) { Renderer::Get()->RenderCircleFilled(ImVec2(screenPos.x, screenPos.y), 20, 0x4000ffff); Renderer::Get()->RenderText(unitName, ImVec2(screenPos.x, screenPos.y), 16, 0xffffffff); @@ -255,7 +255,6 @@ void ESP::OnNeutralUnit(Unit* unit) Renderer::Get()->RenderText(unitName, ImVec2(screenPos.x, screenPos.y), 16, 0xffffffff); } - if (strcmp(unitName.c_str(), "WOLFX") == 0 || strcmp(unitName.c_str(), "KOMODO") == 0 || strcmp(unitName.c_str(), "GJAGR") == 0 || strcmp(unitName.c_str(), "SLEOPA") == 0 || strcmp(unitName.c_str(), "BEAR") == 0 || strcmp(unitName.c_str(), "CROCO") == 0 || @@ -21,10 +21,10 @@ class ESP : public Feature static uint32_t colors_hex[8]; //Callbacks - void OnUnitIteration(Unit* unit, Player* player, int playerIndex); - void OnMenuPlayerTreenode(Player* player, int playerIndex); - void OnNeutralUnit(Unit* unit); - void OnMenuMainWindow(); + void OnUnitIteration(Unit* unit, Player* player, int playerIndex) override; + void OnMenuPlayerTreenode(Player* player, int playerIndex) override; + void OnNeutralUnit(Unit* unit) override; + void OnMenuMainWindow() override; void DrawBox(Unit* unit, int32_t color, bool drawName); void DrawBox(Vector3 position, Vector2 edgeSize, int32_t color); @@ -22,10 +22,9 @@ Engine* Engine::Get() return instance; } -World* Engine::GetWorld() +World* Engine::GetWorld() const { PathfindingSystem* pathfindingSystem = reinterpret_cast<PathfindingSystem*>(base + Offsets::pathfindingSystem); - //printf("pathfindingSystem: %p\n", pathfindingSystem); if (!pathfindingSystem) { return NULL; @@ -33,17 +32,17 @@ World* Engine::GetWorld() return pathfindingSystem->GetWorld(); } -MainScreen* Engine::GetMainScreen() +MainScreen* Engine::GetMainScreen() const { return reinterpret_cast<MainScreen*>(base + Offsets::mainScreen); } -int Engine::GetTotalPlayers() +int Engine::GetTotalPlayers() const { return *reinterpret_cast<int32_t*>(base + Offsets::totalPlayers); } -PlayerArray* Engine::GetPlayerArray() +PlayerArray* Engine::GetPlayerArray() const { MainScreen* mainScreen = GetMainScreen(); if (!mainScreen) @@ -60,7 +59,7 @@ PlayerArray* Engine::GetPlayerArray() return world->pPlayerArray; } -Vector2 Engine::worldToScreen(Vector3 position) +Vector2 Engine::worldToScreen(Vector3 position) const { MainScreen* mainScreen = GetMainScreen(); static int tileSize = GetWorld()->pMap->GetTileSize(); @@ -82,17 +81,17 @@ Vector2 Engine::worldToScreen(Vector3 position) return Vector2(screenXfinal,screenYfinal); } -Vector2 Engine::worldToScreen(Unit* unit) +Vector2 Engine::worldToScreen(Unit* unit) const { return worldToScreen(unit->position); } -uint32_t Engine::GetPlayerColor(int colorIndex) +uint32_t Engine::GetPlayerColor(int colorIndex) const { return playerColors[colorIndex]; } -ImVec4 Engine::GetPlayerColorImGUI(int colorIndex) +ImVec4 Engine::GetPlayerColorImGUI(int colorIndex) const { ImVec4 color; switch (colorIndex) @@ -125,7 +124,7 @@ ImVec4 Engine::GetPlayerColorImGUI(int colorIndex) return color; } -Player* Engine::GetPlayerByName(char* playerName) +Player* Engine::GetPlayerByName(char* playerName) const { MainScreen* mainScreen = GetMainScreen(); if (!mainScreen) @@ -162,9 +161,9 @@ Player* Engine::GetPlayerByName(char* playerName) return NULL; } -Player* Engine::GetLocalPlayer() +Player* Engine::GetLocalPlayer() const { - uint64_t tribePanelInven = *reinterpret_cast<uint64_t*>(base + Offsets::tribePanelInven); + const uint64_t tribePanelInven = *reinterpret_cast<uint64_t*>(base + Offsets::tribePanelInven); if (!tribePanelInven) { return NULL; @@ -173,4 +172,34 @@ Player* Engine::GetLocalPlayer() { return *reinterpret_cast<Player**>(tribePanelInven + Offsets::tribePanelInven_localPlayer); } +} + +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); //E8 ? ? ? ? 33 FF 49 8B 04 + static int64_t game = base + Offsets::AVGame; + + if (teamchat) + { + message = (";" + std::string(message)).c_str(); + } + fSendChat(game, message); //4C 8B 2D ? ? ? ? 49 83 C5 08 + 3 +} + +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); //48 83 EC 48 48 8B 05 ? ? ? ? 4C 8D + + fPrintNotification(GetMainScreen()->pGameScreen, message, 1); +} + +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); + + //RBGA + fPrintBottomText(GetMainScreen()->pGameScreen, message, hexcolor, 0xffffffffffffffff); }
\ No newline at end of file @@ -24,16 +24,20 @@ class Engine public: static Engine* Get(); - World* GetWorld(); - MainScreen* GetMainScreen(); - int GetTotalPlayers(); - PlayerArray* GetPlayerArray(); - - Vector2 worldToScreen(Vector3 position); - Vector2 worldToScreen(Unit* unit); - - uint32_t GetPlayerColor(int colorIndex); - ImVec4 GetPlayerColorImGUI(int colorIndex); - Player* GetPlayerByName(char* playername); - Player* GetLocalPlayer(); + World* GetWorld() const; + MainScreen* GetMainScreen() const; + int GetTotalPlayers() const; + PlayerArray* GetPlayerArray() const; + + Vector2 worldToScreen(Vector3 position) const; + Vector2 worldToScreen(Unit* unit) const; + + uint32_t GetPlayerColor(int colorIndex) const; + ImVec4 GetPlayerColorImGUI(int colorIndex) const; + Player* GetPlayerByName(char* playername) const; + Player* GetLocalPlayer() const; + + void SendChat(const char* message, bool teamchat = false) const; + void PrintNotification(const char* message) const; + void PrintBottomNotification(const char* message, unsigned int hexcolor) const; };
\ No newline at end of file diff --git a/Feature.cpp b/Feature.cpp index 853b755..c9497eb 100644 --- a/Feature.cpp +++ b/Feature.cpp @@ -5,6 +5,16 @@ void Feature::OnInitialise() } +void Feature::OnGameStart() +{ + +} + +void Feature::OnTurn() +{ + +} + void Feature::OnShutdown() { @@ -10,6 +10,8 @@ protected: bool enabled = true; public: virtual void OnInitialise(); + virtual void OnGameStart(); + virtual void OnTurn(); virtual void OnShutdown(); virtual void OnDraw(); diff --git a/FeatureManager.cpp b/FeatureManager.cpp index 027ad10..6acc467 100644 --- a/FeatureManager.cpp +++ b/FeatureManager.cpp @@ -20,7 +20,7 @@ FeatureManager* FeatureManager::Get() return instance; } -void FeatureManager::registerFeature(Feature* feature) +void FeatureManager::RegisterFeature(Feature* feature) { static int feature_numer = 0; printf("Registered feature %d\n", feature_numer++); @@ -35,6 +35,22 @@ void FeatureManager::OnInitialise() } } +void FeatureManager::OnGameStart() +{ + for (Feature* feature : features) + { + feature->OnGameStart(); + } +} + +void FeatureManager::OnTurn() +{ + for (Feature* feature : features) + { + feature->OnTurn(); + } +} + void FeatureManager::OnShutdown() { for (Feature* feature : features) diff --git a/FeatureManager.h b/FeatureManager.h index 16ffea7..122da06 100644 --- a/FeatureManager.h +++ b/FeatureManager.h @@ -15,10 +15,12 @@ private: public: static FeatureManager* Get(); - void registerFeature(Feature* feature); + void RegisterFeature(Feature* feature); //Callbacks void OnInitialise(); + void OnGameStart(); + void OnTurn(); void OnShutdown(); void OnDraw(); void OnMenuMainWindow(); diff --git a/MidfunctionHook.h b/MidfunctionHook.h index d5e98f3..99cc473 100644 --- a/MidfunctionHook.h +++ b/MidfunctionHook.h @@ -86,16 +86,16 @@ struct Registers class MidfunctionHook { //bytes overwritten by placing the detour - BYTE* originalBytes; + BYTE* originalBytes = nullptr; //location where hook is placed - BYTE* sourceAddress; + BYTE* sourceAddress = nullptr; //runs overwritten instructions - BYTE* trampoline; + BYTE* trampoline = nullptr; //number of bytes to overwrite (don't cut instructions in half) - int hookLength; + int hookLength = 0; public: static void OverwriteRegister(int64_t rsp, Register reg, int64_t value); diff --git a/MinimapText.cpp b/MinimapText.cpp index eb9e3e2..b48fe65 100644 --- a/MinimapText.cpp +++ b/MinimapText.cpp @@ -1,6 +1,3 @@ - - - #include "MinimapText.h" #include "Engine.h" @@ -81,18 +78,6 @@ void MinimapText::OnInitialise() { hookEnabled = &enabled; - int64_t base = (int64_t)GetModuleHandle(NULL); - - Patcher patcher; - - //74 7F 48 8D 4B 01 48 85 C9 74 59 + 14 - //Patch usage of short string optimizaation (playernames <= 15) - //patcher.NOPBytes((BYTE*)(base + 0xA426EE), 6); - - //74 7F 48 8D 4B 01 48 85 C9 74 59 + 18 - //Increase space allocated for playernames to 0x120 bytes so we can write as much as we want to on screen - //Patcher().Patch((BYTE*)(base + 0xA426F5), (int32_t)0x120); - minimapHook.Hook((BYTE*)(int64_t)GetModuleHandle(NULL) + Offsets::minimapHookOffset, (BYTE*)minimapProxy, 14); } diff --git a/MinimapText.h b/MinimapText.h index 808c11c..5bc376a 100644 --- a/MinimapText.h +++ b/MinimapText.h @@ -4,10 +4,8 @@ class DetourHook64; class MinimapText : public Feature { - DetourHook64* minimapTextDetour; - //Callbacks - void OnInitialise(); - void OnMenuMainWindow(); - void OnShutdown(); + void OnInitialise() override; + void OnMenuMainWindow() override; + void OnShutdown() override; };
\ No newline at end of file diff --git a/Offsets.cpp b/Offsets.cpp index b9288b0..bf333d3 100644 --- a/Offsets.cpp +++ b/Offsets.cpp @@ -4,14 +4,14 @@ namespace Offsets { //48 8D 0D ? ? ? ? 41 B8 ? ? ? ? E8 ? ? ? ? 33 C0 //1 //48 8D 0D ? ? ? ? E8 ? ? ? ? 0F B6 C0 //1 - int64_t pathfindingSystem = 0x2921690; //correct + int64_t pathfindingSystem = 0x2921690; //48 8B 0D ? ? ? ? E8 ? ? ? ? C6 85 //1 - int64_t mainScreen = 0x290f160; // + int64_t mainScreen = 0x290f160; //44 89 25 ? ? ? ? 2B //1 //41 8B 45 28 99 + c //1 - int64_t totalPlayers = 0x2793064; // + int64_t totalPlayers = 0x2793064; //48 8B 0D ? ? ? ? 48 85 C9 0F 84 ? ? ? ? 40 int64_t tribePanelInven = 0x2910550; @@ -19,10 +19,17 @@ namespace Offsets //48 8B 83 ? ? ? ? 48 8B 48 70 F3 0F 10 int64_t tribePanelInven_localPlayer = 0x208; + int64_t AVGame = 0x2902590; + //ESP //48 8B 8B ? ? ? ? E8 ? ? ? ? 48 85 FF int64_t unit_actionlist = 0x278; //MinimapText int64_t minimapHookOffset = 0xBE6F99; + + int64_t printNotification = 0xbdd670; + int64_t printBottomText = 0xbcdc00; + + int64_t sendChat = 0x96f300; }
\ No newline at end of file @@ -6,6 +6,7 @@ namespace Offsets extern int64_t pathfindingSystem; extern int64_t mainScreen; extern int64_t totalPlayers; + extern int64_t AVGame; extern int64_t tribePanelInven; extern int64_t tribePanelInven_localPlayer; @@ -13,4 +14,9 @@ namespace Offsets extern int64_t unit_actionlist ; extern int64_t minimapHookOffset; + + extern int64_t printNotification; + extern int64_t printBottomText; + + extern int64_t sendChat; }
\ No newline at end of file diff --git a/RelicManager.cpp b/RelicManager.cpp index 0f8b881..1489481 100644 --- a/RelicManager.cpp +++ b/RelicManager.cpp @@ -5,6 +5,7 @@ void RelicManager::OnNeutralUnit(Unit* unit) { + } void RelicManager::OnMenuMainWindow() @@ -47,5 +48,4 @@ void RelicManager::OnMenuMainWindow() } } ImGui::Separator(); - -} +}
\ No newline at end of file diff --git a/RelicManager.h b/RelicManager.h index 36249ac..04a447d 100644 --- a/RelicManager.h +++ b/RelicManager.h @@ -5,13 +5,10 @@ struct Vector2; struct Vector3; class RelicManager : public Feature { - uint32_t color; - int radius = 20; - std::vector<Unit*> relics; int currentRelic = 0; //Callbacks - void OnNeutralUnit(Unit* unit); - void OnMenuMainWindow(); + void OnNeutralUnit(Unit* unit) override; + void OnMenuMainWindow() override; };
\ No newline at end of file diff --git a/Renderer.cpp b/Renderer.cpp index eab13eb..67ba879 100644 --- a/Renderer.cpp +++ b/Renderer.cpp @@ -59,11 +59,11 @@ void Renderer::RenderText(const std::string& text, const ImVec2& position, float if (center) { - window->DrawList->AddText(NULL, 0, position, ImGui::GetColorU32({ r, g, b, a }), text.c_str()); + window->DrawList->AddText(NULL, size, position, ImGui::GetColorU32({ r, g, b, a }), text.c_str()); } else { - window->DrawList->AddText(NULL, 0, position, ImGui::GetColorU32({ r,g,b,a }), text.c_str()); + window->DrawList->AddText(NULL, size, position, ImGui::GetColorU32({ r,g,b,a }), text.c_str()); } } @@ -88,9 +88,6 @@ void Renderer::RenderPolygon(const ImVec2* points, int pointCount, uint32_t colo RenderLine(points[pointCount - 1], points[0], color, thickness); } - - - void Renderer::RenderCircle(const ImVec2& position, float radius, uint32_t color, float thickness, uint32_t segments) { ImGuiWindow* window = ImGui::GetCurrentWindow(); @@ -154,7 +151,6 @@ void Renderer::RenderRectFilled(const ImVec2& from, const ImVec2& to, uint32_t c window->DrawList->AddRectFilled(from, to, ImGui::GetColorU32({ r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f }), rounding, roundingCornersFlags); } - void Renderer::DrawUnitCollisionRectangle(ImVec2 screenPositionCenter, ImVec2 collision, uint32_t color) { ImVec2 ivOne = ImVec2(screenPositionCenter.x - collision.x, screenPositionCenter.y - collision.y); @@ -8,7 +8,6 @@ class Renderer { private: static Renderer* _instance; - ImFont* m_pFont; Renderer(); ~Renderer(); diff --git a/ResourceInformation.cpp b/ResourceInformation.cpp index dcaf470..a5c7d57 100644 --- a/ResourceInformation.cpp +++ b/ResourceInformation.cpp @@ -13,5 +13,5 @@ void ResourceInformation::OnMenuPlayerTreenode(Player* player, int playerIndex) ImGui::Text("Food: %.f", player->pResources->food); ImGui::Text("Gold: %.f", player->pResources->gold); ImGui::Text("Stone: %.f", player->pResources->stone); - ImGui::Text("PopSpaceLeft: %.f/%.f", player->pResources->popSpaceLeft); + ImGui::Text("PopSpaceLeft: %.f/%.f", player->pResources->currentPop, player->pResources->currentPop + player->pResources->popSpaceLeft); }
\ No newline at end of file diff --git a/ResourceInformation.h b/ResourceInformation.h index 11c1ca0..0d66811 100644 --- a/ResourceInformation.h +++ b/ResourceInformation.h @@ -5,5 +5,5 @@ class ResourceInformation : public Feature { //Callbacks - void OnMenuPlayerTreenode(Player* player, int playerIndex); + void OnMenuPlayerTreenode(Player* player, int playerIndex) override; };
\ No newline at end of file @@ -14,14 +14,15 @@ #include "FeatureManager.h" #include "VmtHook.h" -typedef HRESULT(__stdcall *D3D11PresentHook) (IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags); -D3D11PresentHook phookD3D11Present = NULL; +typedef HRESULT(__stdcall* D3D11PresentHook) (IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags); -ID3D11Device *pDevice = NULL; -ID3D11DeviceContext *pContext = NULL; +D3D11PresentHook phookD3D11Present = nullptr; -DWORD_PTR* pSwapChainVtable = NULL; +ID3D11Device* pDevice = nullptr; +ID3D11DeviceContext* pContext = nullptr; + +DWORD_PTR* pSwapChainVtable = nullptr; #include "main.h" //helper funcs @@ -66,13 +67,13 @@ HRESULT __stdcall hookD3D11Present(IDXGISwapChain* pSwapChain, UINT SyncInterval firstTime = false; //only once //get device - if (SUCCEEDED(pSwapChain->GetDevice(__uuidof(ID3D11Device), (void **)&pDevice))) + if (SUCCEEDED(pSwapChain->GetDevice(__uuidof(ID3D11Device), (void**)&pDevice))) { //SwapChain = pSwapChain; pSwapChain->GetDevice(__uuidof(pDevice), (void**)&pDevice); pDevice->GetImmediateContext(&pContext); } - + //imgui DXGI_SWAP_CHAIN_DESC sd; pSwapChain->GetDesc(&sd); @@ -82,6 +83,7 @@ HRESULT __stdcall hookD3D11Present(IDXGISwapChain* pSwapChain, UINT SyncInterval io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls window = sd.OutputWindow; + //wndprochandler OriginalWndProcHandler = (WNDPROC)SetWindowLongPtr(window, GWLP_WNDPROC, (LONG_PTR)hWndProc); @@ -126,7 +128,7 @@ HRESULT __stdcall hookD3D11Present(IDXGISwapChain* pSwapChain, UINT SyncInterval rasterizer_desc.MultisampleEnable = false; rasterizer_desc.AntialiasedLineEnable = false; pDevice->CreateRasterizerState(&rasterizer_desc, &DEPTHBIASState_FALSE); - + //create normal rasterizer state D3D11_RASTERIZER_DESC nrasterizer_desc; ZeroMemory(&nrasterizer_desc, sizeof(nrasterizer_desc)); @@ -142,13 +144,13 @@ HRESULT __stdcall hookD3D11Present(IDXGISwapChain* pSwapChain, UINT SyncInterval nrasterizer_desc.MultisampleEnable = false; nrasterizer_desc.AntialiasedLineEnable = false; pDevice->CreateRasterizerState(&nrasterizer_desc, &DEPTHBIASState_TRUE); - + //load cfg settings LoadCfg(); } //create rendertarget - if (RenderTargetView == NULL) + if (RenderTargetView == nullptr) { //viewport pContext->RSGetViewports(&vps, &viewport); @@ -156,7 +158,7 @@ HRESULT __stdcall hookD3D11Present(IDXGISwapChain* pSwapChain, UINT SyncInterval ScreenCenterY = viewport.Height / 2.0f; //get backbuffer - ID3D11Texture2D* backbuffer = NULL; + ID3D11Texture2D* backbuffer = nullptr; hr = pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backbuffer); if (FAILED(hr)) { Log("Failed to get BackBuffer"); @@ -164,7 +166,7 @@ HRESULT __stdcall hookD3D11Present(IDXGISwapChain* pSwapChain, UINT SyncInterval } //create rendertargetview - hr = pDevice->CreateRenderTargetView(backbuffer, NULL, &RenderTargetView); + hr = pDevice->CreateRenderTargetView(backbuffer, nullptr, &RenderTargetView); backbuffer->Release(); if (FAILED(hr)) { Log("Failed to get RenderTarget"); @@ -172,8 +174,9 @@ HRESULT __stdcall hookD3D11Present(IDXGISwapChain* pSwapChain, UINT SyncInterval } } else //call before you draw - pContext->OMSetRenderTargets(1, &RenderTargetView, NULL); - + { + pContext->OMSetRenderTargets(1, &RenderTargetView, nullptr); + } //imgui ImGui_ImplWin32_NewFrame(); @@ -203,7 +206,6 @@ DWORD __stdcall InitHooks(LPVOID hModule) hDXGIDLL = GetModuleHandleA("dxgi.dll"); Sleep(100); } while (!hDXGIDLL); - //Sleep(100); IDXGISwapChain* pSwapChain; @@ -260,7 +262,6 @@ DWORD __stdcall InitHooks(LPVOID hModule) return NULL; } - pSwapChainVtable = (DWORD_PTR*)pSwapChain; pSwapChainVtable = (DWORD_PTR*)pSwapChainVtable[0]; @@ -269,27 +270,25 @@ DWORD __stdcall InitHooks(LPVOID hModule) VmtHook presentHook = VmtHook((void**)pSwapChainVtable); presentHook.Hook(8, hookD3D11Present); - - DWORD dwOld; - VirtualProtect(phookD3D11Present, 2, PAGE_EXECUTE_READWRITE, &dwOld); + pDevice->Release(); + pContext->Release(); + pSwapChain->Release(); while (!(GetAsyncKeyState(VK_F2) & 0x8000)) { Sleep(10); } - pDevice->Release(); - pContext->Release(); - pSwapChain->Release(); - FeatureManager::Get()->OnShutdown(); - + presentHook.Unhook(); + Sleep(1000); + (WNDPROC)SetWindowLongPtr(window, GWLP_WNDPROC, (LONG_PTR)OriginalWndProcHandler); - FreeLibraryAndExitThread((HMODULE)hModule, 0); + Sleep(1000); - return NULL; + FreeLibraryAndExitThread((HMODULE)hModule, 0); } BOOL __stdcall DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpReserved) @@ -298,13 +297,14 @@ BOOL __stdcall DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpReserved) { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(hModule); - CreateThread(NULL, 0, InitHooks, hModule, 0, NULL); + CreateThread(nullptr, 0, InitHooks, hModule, 0, nullptr); break; case DLL_PROCESS_DETACH: - //Sleep(1000); OnDllDetach(); break; + default: + break; } return TRUE; }
\ No newline at end of file @@ -7,7 +7,7 @@ class VmtHook { private: - void** vmt; + void** vmt = nullptr; std::map<int, void*> hookedfuncs; public: |