From 1f75a0b4d28c720b0241e4e80d1cd708a9ce6c6f Mon Sep 17 00:00:00 2001 From: BDKPlayer Date: Fri, 24 Jul 2020 13:28:19 +0200 Subject: Updated some stuff. Still not working for current game version --- Offsets.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'Offsets.cpp') diff --git a/Offsets.cpp b/Offsets.cpp index 7a568ab..cee34de 100644 --- a/Offsets.cpp +++ b/Offsets.cpp @@ -2,39 +2,39 @@ namespace Offsets { - //48 8D 0D ? ? ? ? 41 B8 ? ? ? ? E8 ? ? ? ? 33 C0 //4 - //48 8D 0D ? ? ? ? E8 ? ? ? ? 0F B6 C0 //4 - int64_t pathfindingSystem = 0x29A3AE0; + //48 8D 0D ? ? ? ? 41 B8 ? ? ? ? E8 ? ? ? ? 33 C0 //5 + int64_t pathfindingSystem = 0x2bb6e10; - //48 8B 0D ? ? ? ? E8 ? ? ? ? C6 85 //4 - int64_t mainScreen = 0x2991980; + //48 8B 0D ? ? ? ? E8 ? ? ? ? C6 85 //5 + int64_t mainScreen = 0x2ba4988; - //48 8B 0D ? ? ? ? 48 85 C9 0F 84 ? ? ? ? 40 //3 - int64_t tribePanelInven = 0x2992EE0; + //48 8B 0D ? ? ? ? 48 85 C9 0F 84 ? ? ? ? 40 //4 + int64_t tribePanelInven = 0x2ba5ed0; - //48 8B 83 ? ? ? ? 48 8B 48 70 F3 0F 10 //3 + //48 8B 83 ? ? ? ? 48 8B 48 70 F3 0F 10 //4 int64_t tribePanelInven_localPlayer = 0x208; - //49 83 BF ? ? ? ? ? 0F 86 ? ? ? ? 48 8B + 0xE - int64_t pAVGame = 0x2983AD0; + //4C 8B 05 ? ? ? ? 45 84 + int64_t pAVGame = 0x2b96dd8; + //TODO %s: %d/%d //MinimapText 88 85 ? ? ? ? 41 8B 46 0C //2 - int64_t minimapHookOffset = 0xc26e49; + int64_t minimapHookOffset = 0xcb1646; //Functions - int64_t printNotification = 0xc1d320; //48 83 EC 48 48 8B 05 ? ? ? ? 4C 8D //3 - int64_t printBottomText = 0xc0c680; //48 8B C4 48 83 EC 78 F3 0F 10 05 ? ? ? ? 41 //3 - int64_t pauseGame = 0x81ddd0; //48 89 5C 24 ? 55 48 8D 6C 24 ? 48 81 EC ? ? ? ? 80 //2 + int64_t printNotification = 0xca7b10; //48 83 EC 48 48 8B 05 ? ? ? ? 4C 8D //4 + int64_t printBottomText = 0xc914d0; //48 8B C4 48 83 EC 78 F3 0F 10 05 ? ? ? ? 41 //4 + int64_t pauseGame = 0x874620; //48 89 5C 24 ? 55 48 8D 6C 24 ? 48 81 EC ? ? ? ? 80 //3 - //E8 ? ? ? ? 90 48 8B 05 ? ? ? ? F2 - 0x94 //0 - int64_t sendChat = 0x9AC090; + //E8 ? ? ? ? 90 48 8B 05 ? ? ? ? F2 - 0x94 //1 + int64_t sendChat = 0xa158c0; - int64_t createUnitHook = 0xE06260; //48 89 5C 24 ? 48 89 6C 24 ? 57 48 83 EC 20 8B 41 //2 + int64_t createUnitHook = 0xeacf60; //48 89 5C 24 ? 48 89 6C 24 ? 57 48 83 EC 20 8B 41 //3 int64_t playerArrayStart = 0x2a8; //Manual Update //CustomLoadingScreen - int64_t pathToLoadScreen = 0x1E72D20; // /resources/loading_slash.png - int64_t loadPathToLoadScreen = 0xEEA8EE; // x-ref /resources/loading_slash.png + int64_t pathToLoadScreen = 0x2012278; // /resources/loading_slash.png + int64_t loadPathToLoadScreen = 0xfe0eae; // x-ref /resources/loading_slash.png } \ No newline at end of file -- cgit v1.2.3 From cdc71b248d67fa5d1ac10a4a35ac3a58f757255e Mon Sep 17 00:00:00 2001 From: BDKPlayer Date: Fri, 31 Jul 2020 16:14:55 +0200 Subject: Working minimal version --- CastleManager.cpp | 4 +-- Classes.h | 74 +++++++++++++++++++++++++++++-------------------------- Core.cpp | 38 ++++++++++++++-------------- Debug.cpp | 4 +-- ESP.cpp | 53 ++++++++++++++++++++------------------- Engine.cpp | 11 +-------- Engine.h | 1 - MinimapText.cpp | 2 +- Offsets.cpp | 10 ++++---- RelicManager.cpp | 6 ++--- Source.cpp | 4 +-- 11 files changed, 101 insertions(+), 106 deletions(-) (limited to 'Offsets.cpp') diff --git a/CastleManager.cpp b/CastleManager.cpp index 373d6e5..2b7ab6f 100644 --- a/CastleManager.cpp +++ b/CastleManager.cpp @@ -39,13 +39,13 @@ void CastleManager::OnUnitCreated(Unit* unit) { return; } - Player* owningPlayer = unit->pOwner; + Player* owningPlayer = unit->GetOwner(); if (!owningPlayer || owningPlayer == Engine::Get()->GetLocalPlayer()) { return; } - if (strcmp("CSTL", unit->pUnitData->name) == 0) + if (strcmp("CSTL", unit->GetUnitData()->GetName()) == 0) { std::string message = std::string(owningPlayer->name) + " is building a castle!"; const char* charMessage = message.c_str(); diff --git a/Classes.h b/Classes.h index 6f4e3fe..8f91625 100644 --- a/Classes.h +++ b/Classes.h @@ -281,52 +281,56 @@ public: class UnitData { public: - char pad_0x0000[0x20]; //0x0000 - __int16 Class; //0x0020 - char pad_0x0022[0x26]; //0x0022 - __int16 unk; //0x0048 - __int16 maxHp; //0x004A - char pad_0x004C[0x8]; //0x004C - float collisionX; //0x0054 - float collisionY; //0x0058 - float collisionZ; //0x005C - char pad_0x0060[0x120]; //0x0060 - char* name; //0x0180 -}; //Size=0x0408 + char* GetName() + { + return *reinterpret_cast(*(uint64_t*)this + 0x848); + } + + Vector3 GetCollision() + { + return *(Vector3*)(*(uint64_t*)this + 0x718); + } + +}; class Unit { -public: - char pad_0x0000[0x10]; //0x0000 - UnitData* pUnitData; //0x0010 - Player* pOwner; //0x0018 - char pad_0x0020[0x70]; //0x0020 - float fHealth; //0x0090 - char pad_0x0094[0x4]; //0x0094 - Vector3 position; - - //When moving sadly height isnt set. When attack it works. - Vector3* GetTargetPosition() +private: + float GetPosX() + { + int32_t position = *reinterpret_cast((uint64_t)this + 0x1a0) ^ 0x187F64ADC21CDE88 ^ 0x4F019E376DDAD1E5; + return *(float*)(&position); + } + + float GetPosY() { - uint64_t actionList = *reinterpret_cast((uint64_t)this + 0x288); - if (!actionList){return NULL;} - uint64_t targetDataWrapper = *reinterpret_cast(actionList + 0x10); - if (!targetDataWrapper) { return NULL; } - uint64_t actionMoveTo = *reinterpret_cast(targetDataWrapper); - if (!actionMoveTo) { return NULL; } - return reinterpret_cast(actionMoveTo + 0x38); + int32_t position = *reinterpret_cast((uint64_t)this + 0x308) ^ 0x51E534524D81CFA6; + return *(float*)(&position); } + float GetPosZ() + { + int32_t position = (*reinterpret_cast((uint64_t)this + 0x3f8) - 0x17258AE0D9C58D92 ) ^ 0x78E0AFEAF822FC61; + return *(float*)(&position); + } +public: + + UnitData* GetUnitData() + { + return reinterpret_cast((uint64_t)this + 0x10); + } - typedef char(__fastcall* fhsMoveToCaller)(Unit* unit, Unit* targetUnit, World* world, int64_t zero, float xPos, float yPos, int zero2); - void MoveTo(World* world, float xPos, float yPos) + Player* GetOwner() { - static fhsMoveToCaller moveUnitCaller = (fhsMoveToCaller)((int64_t)GetModuleHandle(NULL) + 0xc863a0); //outdated and desync - moveUnitCaller(this, 0, world, 0, xPos, yPos, 0); + return *reinterpret_cast((uint64_t)this + 0x18); } -}; //Size=0x0250 + Vector3 GetPosition() + { + return Vector3(GetPosX(), GetPosY(), GetPosZ()); + } +}; class ObjectManager { diff --git a/Core.cpp b/Core.cpp index 5ff0aee..318fba2 100644 --- a/Core.cpp +++ b/Core.cpp @@ -82,20 +82,20 @@ void __fastcall OnCreateUnitHook(Registers* registers) Core::Core() { - printf("Core::Core()\n"); - onCreateUnitHook.Hook((BYTE*)GetModuleHandle(NULL) + Offsets::createUnitHook, (BYTE*)OnCreateUnitHook, 15); + //printf("Core::Core()\n"); + //onCreateUnitHook.Hook((BYTE*)GetModuleHandle(NULL) + Offsets::createUnitHook, (BYTE*)OnCreateUnitHook, 15); FeatureManager* featureManager = FeatureManager::Get(); - featureManager->RegisterFeature(new InitialiseOffsets()); + //featureManager->RegisterFeature(new InitialiseOffsets()); //Register Features here - featureManager->RegisterFeature(new ResourceInformation()); + //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 RelicManager()); + //featureManager->RegisterFeature(new CustomLoadingScreen("C:\\wallpaper.jpg")); //featureManager->RegisterFeature(new PauseManager()); - featureManager->RegisterFeature(new CastleManager()); + //featureManager->RegisterFeature(new CastleManager()); #ifdef _DEBUG featureManager->RegisterFeature(new Debug()); @@ -124,19 +124,20 @@ void createPlayerTreeNode(Player* player, int playerIndex) Unit* unit = player->pObjectManager->units[i]; if (!unit) { continue; } - if (unit->pOwner == player) + if (unit->GetOwner() == player) { ImGui::Text("%p", unit); ImGui::SameLine(); - ImGui::Text("%s", unit->pUnitData->name); + ImGui::Text("%s", unit->GetUnitData()->GetName()); + ImGui::Text("%f %f %f", unit->GetPosition().x, unit->GetPosition().y, unit->GetPosition().z); ImGui::SameLine(); - std::string text = std::string("Copy##") + std::string(unit->pUnitData->name) + std::to_string(i); + //std::string text = std::string("Copy##") + std::string(unit->GetUnitData()->GetName()) + std::to_string(i); - if (ImGui::Button(text.c_str())) + if (ImGui::Button("Copy")) { Utility::CopyToClipboard((uint64_t)unit); } - std::string vmtTree = std::string("VMT##") + std::string(unit->pUnitData->name) + "VMT"; + /*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++) @@ -150,9 +151,9 @@ void createPlayerTreeNode(Player* player, int playerIndex) } } ImGui::TreePop(); - } + }*/ - if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Building) + /*if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Building) { buildingCount++; } @@ -163,7 +164,7 @@ void createPlayerTreeNode(Player* player, int playerIndex) if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Cavalry) { calavaryCount++; - } + }*/ } } ImGui::Text("Buildings %.d", buildingCount); @@ -182,7 +183,6 @@ void Core::OnPresent() { __try { - //printf("Valid: "); MainScreen* mainScreen = Engine::Get()->GetMainScreen(); if (!mainScreen) { @@ -194,7 +194,7 @@ void Core::OnPresent() { return; } - //printf(" world %p", world); + //printf("world %p", world); PlayerArray* playerArray = world->pPlayerArray; if (!playerArray) @@ -216,7 +216,7 @@ void Core::OnPresent() for (int i = 0; i < gaiaPlayer->pObjectManager->Count; i++) { Unit* unit = gaiaPlayer->pObjectManager->units[i]; - if (!unit || unit->pUnitData->Class == -1) + if (!unit /*|| unit->GetUnitData()->Class == -1*/) { continue; } @@ -239,7 +239,7 @@ void Core::OnPresent() for (int j = 0; j < player->pObjectManager->Count; j++) { Unit* unit = player->pObjectManager->units[j]; - if (!unit || unit->pUnitData->Class == -1) + if (!unit /*|| unit->pUnitData->Class == -1*/) { continue; } diff --git a/Debug.cpp b/Debug.cpp index 5ee1f42..d86d139 100644 --- a/Debug.cpp +++ b/Debug.cpp @@ -18,9 +18,9 @@ void Debug::OnMenuMainWindow() ImGui::Separator(); ImGui::Text("Debug"); //ImGui::Text("Idle: %d", idleUnit); - if (ImGui::Button("Flare")) + if (ImGui::Button("nothing")) { - Engine::Get()->Flare(100.f, 100.f); + } ImGui::Separator(); } diff --git a/ESP.cpp b/ESP.cpp index 3cd3122..8e8b1b3 100644 --- a/ESP.cpp +++ b/ESP.cpp @@ -12,24 +12,24 @@ uint32_t ESP::colors_hex[8] = { 0xff0000ff, 0xffff0000,0xff00ff00,0xffffff00,0xf void ESP::DrawBox(Unit* unit, int32_t color, bool drawName = false) { - Vector3 one3 = unit->position; - one3.x -= unit->pUnitData->collisionX; - one3.y -= unit->pUnitData->collisionY; + Vector3 one3 = unit->GetPosition(); + one3.x -= unit->GetUnitData()->GetCollision().x; + one3.y -= unit->GetUnitData()->GetCollision().y; Vector2 one = Engine::Get()->worldToScreen(one3); - Vector3 two3 = unit->position; - two3.x += unit->pUnitData->collisionX; - two3.y += unit->pUnitData->collisionY; + Vector3 two3 = unit->GetPosition(); + two3.x += unit->GetUnitData()->GetCollision().x; + two3.y += unit->GetUnitData()->GetCollision().y; Vector2 two = Engine::Get()->worldToScreen(two3); - Vector3 three3 = unit->position; - three3.x -= unit->pUnitData->collisionX; - three3.y += unit->pUnitData->collisionY; + Vector3 three3 = unit->GetPosition(); + three3.x -= unit->GetUnitData()->GetCollision().x; + three3.y += unit->GetUnitData()->GetCollision().y; Vector2 three = Engine::Get()->worldToScreen(three3); - Vector3 four3 = unit->position; - four3.x += unit->pUnitData->collisionX; - four3.y -= unit->pUnitData->collisionY; + Vector3 four3 = unit->GetPosition(); + four3.x += unit->GetUnitData()->GetCollision().x; + four3.y -= unit->GetUnitData()->GetCollision().y; Vector2 four = Engine::Get()->worldToScreen(four3); ImVec2 ivOne = ImVec2(one.x, one.y); @@ -42,10 +42,10 @@ void ESP::DrawBox(Unit* unit, int32_t color, bool drawName = false) if (drawName) { - Vector3 textPos = unit->position; + Vector3 textPos = unit->GetPosition(); Vector2 screenTextPos = Engine::Get()->worldToScreen(textPos); ImVec2 ivTextPos = ImVec2(screenTextPos.x, screenTextPos.y); - Renderer::Get()->RenderText(unit->pUnitData->name, ivTextPos, 16, color, false); + Renderer::Get()->RenderText(std::string(unit->GetUnitData()->GetName()), ivTextPos, 16, color, false); } } @@ -84,7 +84,7 @@ void ESP::DrawCircle(Unit* unit, int radius, int32_t color, int smoothness = 16, { static const float PI = 3.14159265358979323846f; int32_t tileSize = Engine::Get()->GetWorld()->pMap->GetTileSize(); - Vector3 center = unit->position; + Vector3 center = unit->GetPosition(); std::vector screeenPoints; @@ -106,7 +106,7 @@ void ESP::DrawCircle(Unit* unit, int radius, int32_t color, int smoothness = 16, { Vector2 screenTextPos = Engine::Get()->worldToScreen(center); ImVec2 ivTextPos = ImVec2(screenTextPos.x, screenTextPos.y); - Renderer::Get()->RenderText(unit->pUnitData->name, ivTextPos, 16, color, false); + Renderer::Get()->RenderText(unit->GetUnitData()->GetName(), ivTextPos, 16, color, false); } } @@ -135,12 +135,12 @@ void ESP::OnUnitIteration(Unit* unit, Player* player, int playerIndex) { if (playerUnitEsp[playerIndex]) { - if (strcmp(unit->pUnitData->name, "FLARE") == 0) + if (strcmp(unit->GetUnitData()->GetName(), "FLARE") == 0) { return; //Dont display annoying flares that Bots use } - if (siegeImpactLocation) + /*if (siegeImpactLocation) { if (std::string(unit->pUnitData->name).find("Projectile Scorpion") != std::string::npos) { @@ -171,14 +171,15 @@ void ESP::OnUnitIteration(Unit* unit, Player* player, int playerIndex) Renderer::Get()->RenderCircleFilled(ImVec2(screenDestinationPos.x, screenDestinationPos.y), 30, colors_hex[*player->pColor] & 0x77ffffff); } } - } + }*/ - if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Miscellaneous) + /*if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Miscellaneous) { return; } - if (strcmp(unit->pUnitData->name, "CSTL") == 0) + */ + if (strcmp(unit->GetUnitData()->GetName(), "CSTL") == 0) { DrawBox(unit, colors_hex[*player->pColor], true); return; @@ -186,12 +187,12 @@ void ESP::OnUnitIteration(Unit* unit, Player* player, int playerIndex) DrawBox(unit, colors_hex[*player->pColor], playerUnitNameEsp[playerIndex]); - if (trebuchetESP && (std::string(unit->pUnitData->name).find("TREBU") != std::string::npos || std::string(unit->pUnitData->name).find("PTREB") != std::string::npos)) + if (trebuchetESP && (std::string(unit->GetUnitData()->GetName()).find("TREBU") != std::string::npos || std::string(unit->GetUnitData()->GetName()).find("PTREB") != std::string::npos)) { DrawCircle(unit, 16, colors_hex[*player->pColor], 100, 2, true); } - if (playerUnitDestinationEsp[playerIndex]) + /*if (playerUnitDestinationEsp[playerIndex]) { Vector3* targetPosition = unit->GetTargetPosition(); if (!targetPosition || targetPosition->x <= 0 || targetPosition->y <= 0) { return; } @@ -199,7 +200,7 @@ void ESP::OnUnitIteration(Unit* unit, Player* player, int playerIndex) Vector2 screenPos = Engine::Get()->worldToScreen(unit); Vector2 screenTargetPos = Engine::Get()->worldToScreen(*targetPosition); Renderer::Get()->RenderLine(ImVec2(screenPos.x, screenPos.y), ImVec2(screenTargetPos.x, screenTargetPos.y), colors_hex[*player->pColor]); - } + }*/ } } @@ -219,7 +220,7 @@ void ESP::OnNeutralUnit(Unit* unit) { if (gaiaESP || goldESP || stoneESP) { - std::string unitName = unit->pUnitData->name; + std::string unitName = unit->GetUnitData()->GetName(); Vector2 screenPos = Engine::Get()->worldToScreen(unit); if (goldESP && strcmp(unitName.c_str(), "GOLDM") == 0) @@ -290,7 +291,7 @@ void ESP::OnMenuMainWindow() { ImGui::Separator(); ImGui::Text("Siege ESP"); - ImGui::Checkbox("Siege Impact", &siegeImpactLocation); + //ImGui::Checkbox("Siege Impact", &siegeImpactLocation); ImGui::Checkbox("Trebuchet range", &trebuchetESP); ImGui::Separator(); ImGui::Text("Resource ESP"); diff --git a/Engine.cpp b/Engine.cpp index 3619af9..7f797dc 100644 --- a/Engine.cpp +++ b/Engine.cpp @@ -92,7 +92,7 @@ Vector2 Engine::worldToScreen(Vector3 position) const Vector2 Engine::worldToScreen(Unit* unit) const { - return worldToScreen(unit->position); + return worldToScreen(unit->GetPosition()); } uint32_t Engine::GetPlayerColor(int colorIndex) const @@ -249,12 +249,3 @@ void Engine::PrintBottomNotification(const char* message, unsigned int hexcolor) static tPrintBottomText fPrintBottomText = (tPrintBottomText)(base + Offsets::printBottomText); fPrintBottomText(GetMainScreen()->pGameScreen, message, hexcolor, 0xffffffffffffffff); //Color format: RBGA } - -int64_t Engine::Flare(float xPos, float yPos) const -{ - typedef __int64(__fastcall* tCreateFlare) (Player* player, __int64 hundert12, __int64 zero1, __int64 zero2, float xPos, float yPos, int64_t zero3, int64_t zero4); - static tCreateFlare fCreateFlare = (tCreateFlare)(base + 0xc31270); - - return fCreateFlare(GetLocalPlayer(), 0x112, 0, 0, 220.f, 220.f, 0, 0); - //__usercall fhsCreateFlare_MAYBE_7FF718CF1270@( __int64 a3_zero@, __int64 a4_zero@, float xPos@, float yPos@, __int64 a5_zero, int a6_Zero) -} diff --git a/Engine.h b/Engine.h index ca427de..692418c 100644 --- a/Engine.h +++ b/Engine.h @@ -45,5 +45,4 @@ public: void SendChat(const char* message, bool teamchat = false) const; void PrintNotification(const char* message) const; void PrintBottomNotification(const char* message, unsigned int hexcolor) const; - int64_t Flare(float xPos, float yPos) const; }; \ No newline at end of file diff --git a/MinimapText.cpp b/MinimapText.cpp index 974558d..0153d77 100644 --- a/MinimapText.cpp +++ b/MinimapText.cpp @@ -102,7 +102,7 @@ void MinimapText::OnInitialise() { hookEnabled = &enabled; - minimapHook.Hook((BYTE*)(int64_t)GetModuleHandle(NULL) + Offsets::minimapHookOffset, (BYTE*)minimapProxy, 14); + minimapHook.Hook((BYTE*)(int64_t)GetModuleHandle(NULL) + Offsets::minimapHookOffset, (BYTE*)minimapProxy, 20); } void MinimapText::OnShutdown() diff --git a/Offsets.cpp b/Offsets.cpp index cee34de..56695f7 100644 --- a/Offsets.cpp +++ b/Offsets.cpp @@ -3,23 +3,23 @@ namespace Offsets { //48 8D 0D ? ? ? ? 41 B8 ? ? ? ? E8 ? ? ? ? 33 C0 //5 - int64_t pathfindingSystem = 0x2bb6e10; + int64_t pathfindingSystem = 0x2BB80D0; //48 8B 0D ? ? ? ? E8 ? ? ? ? C6 85 //5 - int64_t mainScreen = 0x2ba4988; + int64_t mainScreen = 0x2BA5C48; //48 8B 0D ? ? ? ? 48 85 C9 0F 84 ? ? ? ? 40 //4 - int64_t tribePanelInven = 0x2ba5ed0; + int64_t tribePanelInven = 0x2BA7190; //48 8B 83 ? ? ? ? 48 8B 48 70 F3 0F 10 //4 int64_t tribePanelInven_localPlayer = 0x208; //4C 8B 05 ? ? ? ? 45 84 - int64_t pAVGame = 0x2b96dd8; + int64_t pAVGame = 0x2B98098; //TODO %s: %d/%d //MinimapText 88 85 ? ? ? ? 41 8B 46 0C //2 - int64_t minimapHookOffset = 0xcb1646; + int64_t minimapHookOffset = 0xCB2616; //Functions int64_t printNotification = 0xca7b10; //48 83 EC 48 48 8B 05 ? ? ? ? 4C 8D //4 diff --git a/RelicManager.cpp b/RelicManager.cpp index 74d259a..db5306c 100644 --- a/RelicManager.cpp +++ b/RelicManager.cpp @@ -21,7 +21,7 @@ void RelicManager::OnMenuMainWindow() { continue; } - if (strcmp(unit->pUnitData->name, "RELIC") == 0) + if (strcmp(unit->GetUnitData()->GetName(), "RELIC") == 0) { relics.push_back(unit); } @@ -36,7 +36,7 @@ void RelicManager::OnMenuMainWindow() if (ImGui::Button("<")) { currentRelic = (currentRelic - 1) % relics.size(); - Engine::Get()->GetLocalPlayer()->SetCameraPosition(relics[currentRelic]->position); + Engine::Get()->GetLocalPlayer()->SetCameraPosition(relics[currentRelic]->GetPosition()); } ImGui::SameLine(); ImGui::Text("%d/%d", currentRelic + 1, relics.size()); @@ -44,7 +44,7 @@ void RelicManager::OnMenuMainWindow() if (ImGui::Button(">")) { currentRelic = (currentRelic + 1) % relics.size(); - Engine::Get()->GetLocalPlayer()->SetCameraPosition(relics[currentRelic]->position); + Engine::Get()->GetLocalPlayer()->SetCameraPosition(relics[currentRelic]->GetPosition()); } } ImGui::Separator(); diff --git a/Source.cpp b/Source.cpp index d6793c9..7bfb773 100644 --- a/Source.cpp +++ b/Source.cpp @@ -287,11 +287,11 @@ DWORD __stdcall InitHooks(LPVOID hModule) presentHook.Unhook(); - Sleep(1000); + Sleep(100); (WNDPROC)SetWindowLongPtr(window, GWLP_WNDPROC, (LONG_PTR)OriginalWndProcHandler); - Sleep(1000); + Sleep(100); FreeLibraryAndExitThread((HMODULE)hModule, 0); } -- cgit v1.2.3 From be9a9b51f2258cceb7cf911c3e6981134c06a552 Mon Sep 17 00:00:00 2001 From: BDKPlayer Date: Sat, 1 Aug 2020 14:27:24 +0200 Subject: Updates more features to current game version: - CastleManager - RelicManager - CustomLoadingScreen --- CastleManager.cpp | 12 ++++++++++-- Core.cpp | 12 +++++------- Engine.cpp | 11 +---------- Engine.h | 1 - InitialiseOffsets.cpp | 6 +----- Offsets.cpp | 13 ++++++------- Offsets.h | 1 - 7 files changed, 23 insertions(+), 33 deletions(-) (limited to 'Offsets.cpp') diff --git a/CastleManager.cpp b/CastleManager.cpp index 2b7ab6f..6b85e36 100644 --- a/CastleManager.cpp +++ b/CastleManager.cpp @@ -11,6 +11,7 @@ bool warningEnabled = true; int notification = 0; +ThreadSafeQueue localMessages; ThreadSafeQueue teamMessages; ThreadSafeQueue allMessages; @@ -40,7 +41,7 @@ void CastleManager::OnUnitCreated(Unit* unit) return; } Player* owningPlayer = unit->GetOwner(); - if (!owningPlayer || owningPlayer == Engine::Get()->GetLocalPlayer()) + if (!owningPlayer /*|| owningPlayer == Engine::Get()->GetLocalPlayer()*/) { return; } @@ -53,7 +54,7 @@ void CastleManager::OnUnitCreated(Unit* unit) switch (notification) { case 0: - Engine::Get()->PrintNotification(charMessage); + localMessages.push(message); break; case 1: teamMessages.push(message); @@ -69,6 +70,13 @@ void CastleManager::OnUnitCreated(Unit* unit) void CastleManager::OnMenuMainWindow() { + if (!localMessages.isEmpty()) + { + std::string message; + localMessages.pop(message); + Engine::Get()->PrintNotification(message.c_str()); + } + if (!teamMessages.isEmpty()) { std::string message; diff --git a/Core.cpp b/Core.cpp index 318fba2..17f0f03 100644 --- a/Core.cpp +++ b/Core.cpp @@ -82,20 +82,18 @@ void __fastcall OnCreateUnitHook(Registers* registers) Core::Core() { - //printf("Core::Core()\n"); - //onCreateUnitHook.Hook((BYTE*)GetModuleHandle(NULL) + Offsets::createUnitHook, (BYTE*)OnCreateUnitHook, 15); + onCreateUnitHook.Hook((BYTE*)GetModuleHandle(NULL) + Offsets::createUnitHook, (BYTE*)OnCreateUnitHook, 15); FeatureManager* featureManager = FeatureManager::Get(); //featureManager->RegisterFeature(new InitialiseOffsets()); //Register Features here - //featureManager->RegisterFeature(new ResourceInformation()); + 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 PauseManager()); - //featureManager->RegisterFeature(new CastleManager()); + featureManager->RegisterFeature(new RelicManager()); + featureManager->RegisterFeature(new CustomLoadingScreen("C:\\wallpaper.jpg")); + featureManager->RegisterFeature(new CastleManager()); #ifdef _DEBUG featureManager->RegisterFeature(new Debug()); diff --git a/Engine.cpp b/Engine.cpp index 7f797dc..bb3db2a 100644 --- a/Engine.cpp +++ b/Engine.cpp @@ -208,15 +208,6 @@ Player* Engine::GetLocalPlayer() const return *reinterpret_cast(tribePanelInven + Offsets::tribePanelInven_localPlayer); } -// -//Pauses the game -void Engine::PauseGame() const -{ - typedef int64_t(__fastcall* tPauseGame)(CommHandler* CommHandler); - static tPauseGame fPauseGame = (tPauseGame)(base + Offsets::pauseGame); - fPauseGame(Get()->GetGame()->pCommHandler); -} - // //Sends a chat message. Only to be called from rendering thread void Engine::SendChat(const char* message, bool teamchat) const @@ -240,7 +231,7 @@ 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); - fPrintNotification(GetMainScreen()->pGameScreen, message, 1); + fPrintNotification(GetMainScreen()->pGameScreen, message, 0); } void Engine::PrintBottomNotification(const char* message, unsigned int hexcolor) const diff --git a/Engine.h b/Engine.h index 692418c..4344e25 100644 --- a/Engine.h +++ b/Engine.h @@ -41,7 +41,6 @@ public: Player* GetPlayerByName(char* playername) const; Player* GetLocalPlayer() const; - void PauseGame() 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; diff --git a/InitialiseOffsets.cpp b/InitialiseOffsets.cpp index 4611db8..d626897 100644 --- a/InitialiseOffsets.cpp +++ b/InitialiseOffsets.cpp @@ -57,11 +57,7 @@ void InitialiseOffsets::OnInitialise() printBottomText = Pattern::FindSignature("AoE2DE_s.exe", "48 8B C4 48 83 EC 78 F3 0F 10 05 ? ? ? ? 41"); printBottomText -= base; printf("printBottomText: %x\n", printBottomText); - - pauseGame = Pattern::FindSignature("AoE2DE_s.exe", "48 89 5C 24 ? 55 48 8D 6C 24 ? 48 81 EC ? ? ? ? 80"); - pauseGame -= base; - printf("pauseGame: %x\n", pauseGame); - + sendChat = Pattern::FindSignature("AoE2DE_s.exe", "E8 ? ? ? ? 90 48 8B 05 ? ? ? ? F2") - 0x94; sendChat -= base; printf("sendChat: %x\n", sendChat); diff --git a/Offsets.cpp b/Offsets.cpp index 56695f7..129d0bf 100644 --- a/Offsets.cpp +++ b/Offsets.cpp @@ -22,19 +22,18 @@ namespace Offsets int64_t minimapHookOffset = 0xCB2616; //Functions - int64_t printNotification = 0xca7b10; //48 83 EC 48 48 8B 05 ? ? ? ? 4C 8D //4 - int64_t printBottomText = 0xc914d0; //48 8B C4 48 83 EC 78 F3 0F 10 05 ? ? ? ? 41 //4 - int64_t pauseGame = 0x874620; //48 89 5C 24 ? 55 48 8D 6C 24 ? 48 81 EC ? ? ? ? 80 //3 + int64_t printNotification = 0xCA8AC0; //48 83 EC 48 48 8B 05 ? ? ? ? 4C 8D //4 + int64_t printBottomText = 0xc92480; //48 8B C4 48 83 EC 78 F3 0F 10 05 ? ? ? ? 41 //4 //E8 ? ? ? ? 90 48 8B 05 ? ? ? ? F2 - 0x94 //1 - int64_t sendChat = 0xa158c0; + int64_t sendChat = 0xa16090; - int64_t createUnitHook = 0xeacf60; //48 89 5C 24 ? 48 89 6C 24 ? 57 48 83 EC 20 8B 41 //3 + int64_t createUnitHook = 0xeadf40; //48 89 5C 24 ? 48 89 6C 24 ? 57 48 83 EC 20 8B 41 //4 int64_t playerArrayStart = 0x2a8; //Manual Update //CustomLoadingScreen - int64_t pathToLoadScreen = 0x2012278; // /resources/loading_slash.png - int64_t loadPathToLoadScreen = 0xfe0eae; // x-ref /resources/loading_slash.png + int64_t pathToLoadScreen = 0x2013488; // /resources/loading_slash.png + int64_t loadPathToLoadScreen = 0xfe1ece; // x-ref /resources/loading_slash.png } \ No newline at end of file diff --git a/Offsets.h b/Offsets.h index 74edc51..4530bc0 100644 --- a/Offsets.h +++ b/Offsets.h @@ -18,7 +18,6 @@ namespace Offsets //Functions extern int64_t printNotification; extern int64_t printBottomText; - extern int64_t pauseGame; extern int64_t sendChat; extern int64_t createUnitHook; -- cgit v1.2.3