Skip to content
This repository has been archived by the owner on Sep 12, 2021. It is now read-only.

Commit

Permalink
Added more things in debug menu & reversed few components
Browse files Browse the repository at this point in the history
Reversed ZHM3GameData (more members known for now)
Added more information in debug menu

refs #9 and #7
  • Loading branch information
DronCode committed Feb 6, 2020
1 parent 2e1294c commit ada9f0c
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 108 deletions.
1 change: 1 addition & 0 deletions HM3CoreKill/HM3CoreKill/HM3CoreKill.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
<ClInclude Include="sdk\ZGameFunctions.h" />
<ClInclude Include="sdk\ZGeomBuffer.h" />
<ClInclude Include="sdk\ZHM3Actor.h" />
<ClInclude Include="sdk\ZHM3BriefingControl.h" />
<ClInclude Include="sdk\ZHM3GameData.h" />
<ClInclude Include="sdk\MathCommon.h" />
<ClInclude Include="sdk\ZGameDataFactory.h" />
Expand Down
3 changes: 3 additions & 0 deletions HM3CoreKill/HM3CoreKill/HM3CoreKill.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@
<ClInclude Include="sdk\ZMouseWintel.h">
<Filter>sdk</Filter>
</ClInclude>
<ClInclude Include="sdk\ZHM3BriefingControl.h">
<Filter>sdk</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ck\HM3DebugConsole.cpp">
Expand Down
4 changes: 4 additions & 0 deletions HM3CoreKill/HM3CoreKill/ck/HM3Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ void HM3Game::onD3DEndScene(IDirect3DDevice9* device)
void HM3Game::OnNewGameSession(ioi::hm3::ZHM3Hitman3_t gameSession)
{
HM3_DEBUG("[HM3Game::OnNewGameSession] New session instance detected at 0x%.8X\n", gameSession);
{
auto gd = GetGameDataInstancePtr();
//HM3_DEBUG(" [BriefControl at 0x%.8X Camera at 0x%.8X ]\n", gd->m_BriefingControl, gd->m_Camera);
}
printActorsPoolInfos();
}

Expand Down
47 changes: 44 additions & 3 deletions HM3CoreKill/HM3CoreKill/ck/HM3InGameTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <sdk/ZGameGlobals.h>
#include <sdk/ZEngineDatabase.h>
#include <sdk/ZHM3GameData.h>
#include <sdk/ZHM3BriefingControl.h>
#include <sdk/ZOSD.h>

// Win32 message handler
Expand Down Expand Up @@ -105,15 +106,25 @@ namespace ck
}

void HM3InGameTools::drawDebugMenu()
{
ImGui::Begin("ReHitman | Debugger");

drawPlayerInfo();
drawSystemsInfo();
drawLevelInfo();

ImGui::End();
}

void HM3InGameTools::drawPlayerInfo()
{
auto gameData = ioi::hm3::getGlacierInterface<ioi::hm3::ZHM3GameData>(ioi::hm3::GameData);
auto sysInterface = ioi::hm3::getGlacierInterface<ioi::hm3::ZSysInterfaceWintel>(ioi::hm3::SysInterface);
auto inputInterface = ioi::hm3::getGlacierInterface<ioi::hm3::ZSysInputWintel>(ioi::hm3::WintelInput);
auto engineDB = sysInterface->m_engineDataBase;
auto osd = gameData->m_OSD;

ImGui::Begin("ReHitman | Debugger");

if (ImGui::CollapsingHeader("Player info", ImGuiTreeNodeFlags_None))
{
{ // Common game & profile data
ImGui::Text("Profile: "); ImGui::SameLine(0.f, 10.f); ImGui::TextColored(ImVec4(0.f, 1.f, 0.f, 1.f), gameData->m_ProfileName);
Expand All @@ -129,6 +140,8 @@ namespace ck
ImGui::Text("Noise level: "); ImGui::SameLine(0.f, 15.f);

ImVec4 noiseLevelColor = ImVec4(0.f, 1.f, 0.f, 1.f);
ImGui::ProgressBar(osd->m_realNosieLevel / 100.f, ImVec2(0.0f, 0.0f)); ImGui::SameLine(0.f, 8.5f);

if (osd->m_realNosieLevel >= 0.f && osd->m_realNosieLevel <= 40.f)
noiseLevelColor = ImVec4(0.f, 1.f, 0.f, 1.f);
else if (osd->m_realNosieLevel > 40.f && osd->m_realNosieLevel <= 70.f)
Expand All @@ -138,15 +151,43 @@ namespace ck
ImGui::TextColored(noiseLevelColor, "%.3f", osd->m_realNosieLevel);
}
}
}

void HM3InGameTools::drawSystemsInfo()
{
auto gameData = ioi::hm3::getGlacierInterface<ioi::hm3::ZHM3GameData>(ioi::hm3::GameData);
auto sysInterface = ioi::hm3::getGlacierInterface<ioi::hm3::ZSysInterfaceWintel>(ioi::hm3::SysInterface);
auto inputInterface = ioi::hm3::getGlacierInterface<ioi::hm3::ZSysInputWintel>(ioi::hm3::WintelInput);
auto engineDB = sysInterface->m_engineDataBase;
auto osd = gameData->m_OSD;

if (ImGui::CollapsingHeader("Glacier | Systems"))
{
ImGui::Text("ZSysInterfaceWintel: "); ImGui::SameLine(0.f, 10.f); ImGui::TextColored(ImVec4(1.f, 1.f, 0.f, 1.f), "0x%.8X", sysInterface);
ImGui::Text("ZSysInputWintel: "); ImGui::SameLine(0.f, 10.f); ImGui::TextColored(ImVec4(1.f, 1.f, 0.f, 1.f), "0x%.8X", inputInterface);
ImGui::Text("ZEngineDatabase: "); ImGui::SameLine(0.f, 10.f); ImGui::TextColored(ImVec4(1.f, 1.f, 0.f, 1.f), "0x%.8X", engineDB);
}
}

ImGui::End();
void HM3InGameTools::drawLevelInfo()
{
auto gameData = ioi::hm3::getGlacierInterface<ioi::hm3::ZHM3GameData>(ioi::hm3::GameData);
auto sysInterface = ioi::hm3::getGlacierInterface<ioi::hm3::ZSysInterfaceWintel>(ioi::hm3::SysInterface);
auto inputInterface = ioi::hm3::getGlacierInterface<ioi::hm3::ZSysInputWintel>(ioi::hm3::WintelInput);
auto engineDB = sysInterface->m_engineDataBase;
auto osd = gameData->m_OSD;
auto levelControl = gameData->m_LevelControl;

if (ImGui::CollapsingHeader("Glacier | Level info"))
{
if (!levelControl)
{
ImGui::Text("No active level");
return;
}
else {
ImGui::Text("Level control: "); ImGui::SameLine(0.f, 10.f); ImGui::TextColored(ImVec4(1.f, 1.f, 0.f, 1.f), "0x%.8X", levelControl);
}
}
}
}
3 changes: 3 additions & 0 deletions HM3CoreKill/HM3CoreKill/ck/HM3InGameTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ namespace ck

private:
void drawDebugMenu();
void drawPlayerInfo();
void drawSystemsInfo();
void drawLevelInfo();
};

}
7 changes: 7 additions & 0 deletions HM3CoreKill/HM3CoreKill/sdk/ZHM3BriefingControl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

namespace ioi { namespace hm3 {

class ZHM3BriefingControl {};

}}
21 changes: 15 additions & 6 deletions HM3CoreKill/HM3CoreKill/sdk/ZHM3GameData.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <sdk/ZOSD.h>
#include <sdk/ZHM3MenuElements.h>
#include <sdk/ZHM3LevelControl.h>
#include <sdk/ZHM3BriefingControl.h>

#define DECLARE_UNKNOWN_TYPE_PTR(name) using name = std::uintptr_t;

Expand All @@ -22,6 +23,10 @@ namespace hm3 {
DECLARE_UNKNOWN_TYPE_PTR(m_Gui);
DECLARE_UNKNOWN_TYPE_PTR(CIngameMap);
DECLARE_UNKNOWN_TYPE_PTR(CGlobalCom);
DECLARE_UNKNOWN_TYPE_PTR(ZHM3WeaponUpgradeControl);
DECLARE_UNKNOWN_TYPE_PTR(ZHM3CameraEventCameraClass);
DECLARE_UNKNOWN_TYPE_PTR(ZClothTracker);
DECLARE_UNKNOWN_TYPE_PTR(ZHM3DialogControl);

class ZHM3GameData
{
Expand Down Expand Up @@ -86,11 +91,15 @@ namespace hm3 {
char m_ProfileName[16]; //0xFC5888
char pad_0x0A70[0x64]; //0x0A70
int32_t m_PlayerMoney; //0x0AD4
char pad_0x0AD8[0x5EA0]; //0x0AD8
ZHM3Camera* m_Camera; //0x6978
char pad_0x697C[0x95C]; //0x697C


//+68F8 - ZHM3BriefingControl
char pad_0AD8[24096]; //0x0AD8
ZHM3BriefingControl* m_BriefingControl; //0x68F8
char pad_68FC[116]; //0x68FC
ZHM3WeaponUpgradeControl* m_WeaponUpgradeControl; //0x6970
ZHM3CameraEventCameraClass* m_CameraEventCameraClass; //0x6974
ZHM3Camera* m_CameraClass; //0x6978
char pad_697C[32]; //0x697C
ZClothTracker* m_ClothTracker; //0x699C
char pad_69A0[8]; //0x69A0
ZHM3DialogControl* m_DialogControl; //0x69A8
}; //Size=0x72D8
}}
3 changes: 2 additions & 1 deletion HM3CoreKill/HM3CoreKill/sdk/ZHM3LevelControl.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <cstdint>
#include <sdk/ZHM3BriefingControl.h>

namespace ioi { namespace hm3 {

Expand Down Expand Up @@ -77,7 +78,7 @@ namespace ioi { namespace hm3 {
virtual void completeLevelRequest(); //63
virtual void Function64();
virtual void Function65();
virtual void Function66();
virtual ZHM3BriefingControl* getBriefingControl(int a2); //66
virtual void Function67();
virtual void Function68();
virtual void Function69();
Expand Down
17 changes: 0 additions & 17 deletions HM3CoreKill/HM3CoreKill/sdk/input/ZKeyboard.h

This file was deleted.

28 changes: 0 additions & 28 deletions HM3CoreKill/HM3CoreKill/sdk/input/ZKeyboardStorage.h

This file was deleted.

53 changes: 0 additions & 53 deletions HM3CoreKill/HM3CoreKill/sdk/input/ZSysInput.h

This file was deleted.

Binary file added ReClassNotes/ZHM3GameData.rcnet
Binary file not shown.

0 comments on commit ada9f0c

Please sign in to comment.