From 018a47dbcbd5399b8a14417a7ad8f096f46f4a70 Mon Sep 17 00:00:00 2001 From: DronCode Date: Sun, 23 Feb 2020 15:04:44 +0300 Subject: [PATCH 01/25] Implemented RTTI viewer. Some parts of CInGameMap explored. --- HM3CoreKill/HM3CoreKill/HM3CoreKill.vcxproj | 8 +- .../HM3CoreKill/HM3CoreKill.vcxproj.filters | 12 + .../HM3CoreKill/ck/HM3AnimationRegistry.cpp | 20 +- HM3CoreKill/HM3CoreKill/ck/HM3Function.h | 20 + HM3CoreKill/HM3CoreKill/ck/HM3Game.cpp | 19 + HM3CoreKill/HM3CoreKill/ck/HM3Game.h | 1 + HM3CoreKill/HM3CoreKill/ck/HM3Hooks.cpp | 15 + HM3CoreKill/HM3CoreKill/ck/HM3Hooks.h | 5 +- HM3CoreKill/HM3CoreKill/ck/HM3InGameTools.cpp | 57 +- HM3CoreKill/HM3CoreKill/ck/HM3Offsets.h | 3 + HM3CoreKill/HM3CoreKill/ck/HM3Types.h | 3 +- HM3CoreKill/HM3CoreKill/sdk/CIngameMap.h | 91 +- HM3CoreKill/HM3CoreKill/sdk/CMapObject.h | 56 + .../HM3CoreKill/sdk/InterfacesProvider.h | 17 + HM3CoreKill/HM3CoreKill/sdk/ZGUI.h | 147 + HM3CoreKill/HM3CoreKill/sdk/ZGlacierRTTI.h | 25 + HM3CoreKill/HM3CoreKill/sdk/ZHM3GameData.h | 2 +- .../HM3CoreKill/sdk/ZHM3LevelControl.h | 2 +- Notes.txt | 62 - ReClassNotes/2k20_notes.txt | 23 - ReClassNotes/2k20_reverse_issues.rcnet | Bin 21652 -> 0 bytes ReClassNotes/M05_FAIL_MISSION.txt | 5 - ReClassNotes/README.md | 6 - ReClassNotes/ZHM3Actor.reclass | 768 - ReClassNotes/ZHM3ActorRefsToMap | 83 - ReClassNotes/ZHM3GameData.rcnet | Bin 20184 -> 0 bytes ReClassNotes/actors_research.rcnet | Bin 2405 -> 0 bytes ReClassNotes/g_GameData.reclass | 15154 ---------------- ReClassNotes/g_MemorySystemClass.reclass | 137 - ReClassNotes/ingame_map.rcnet | Bin 4072 -> 0 bytes ReClassNotes/input_and_etc.rcnet | Bin 1714 -> 0 bytes ReClassNotes/render.rcnet | Bin 2669 -> 0 bytes 32 files changed, 441 insertions(+), 16300 deletions(-) create mode 100644 HM3CoreKill/HM3CoreKill/sdk/CMapObject.h create mode 100644 HM3CoreKill/HM3CoreKill/sdk/ZGUI.h create mode 100644 HM3CoreKill/HM3CoreKill/sdk/ZGlacierRTTI.h delete mode 100644 Notes.txt delete mode 100644 ReClassNotes/2k20_notes.txt delete mode 100644 ReClassNotes/2k20_reverse_issues.rcnet delete mode 100644 ReClassNotes/M05_FAIL_MISSION.txt delete mode 100644 ReClassNotes/README.md delete mode 100644 ReClassNotes/ZHM3Actor.reclass delete mode 100644 ReClassNotes/ZHM3ActorRefsToMap delete mode 100644 ReClassNotes/ZHM3GameData.rcnet delete mode 100644 ReClassNotes/actors_research.rcnet delete mode 100644 ReClassNotes/g_GameData.reclass delete mode 100644 ReClassNotes/g_MemorySystemClass.reclass delete mode 100644 ReClassNotes/ingame_map.rcnet delete mode 100644 ReClassNotes/input_and_etc.rcnet delete mode 100644 ReClassNotes/render.rcnet diff --git a/HM3CoreKill/HM3CoreKill/HM3CoreKill.vcxproj b/HM3CoreKill/HM3CoreKill/HM3CoreKill.vcxproj index def218d..316cb89 100644 --- a/HM3CoreKill/HM3CoreKill/HM3CoreKill.vcxproj +++ b/HM3CoreKill/HM3CoreKill/HM3CoreKill.vcxproj @@ -1,4 +1,4 @@ - + @@ -126,7 +126,7 @@ Disabled true true - _CRT_SECURE_NO_WARNINGS;HM3_TRACE_HOOKS;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;HM3_TRACE_HOOKS;HM3_TRACE_NATIVE_OBJECTS_CREATION_ENABLED;%(PreprocessorDefinitions) stdcpp17 @@ -205,6 +205,8 @@ + + @@ -218,6 +220,8 @@ + + diff --git a/HM3CoreKill/HM3CoreKill/HM3CoreKill.vcxproj.filters b/HM3CoreKill/HM3CoreKill/HM3CoreKill.vcxproj.filters index aa6d47c..8729b39 100644 --- a/HM3CoreKill/HM3CoreKill/HM3CoreKill.vcxproj.filters +++ b/HM3CoreKill/HM3CoreKill/HM3CoreKill.vcxproj.filters @@ -222,6 +222,18 @@ ck + + sdk + + + sdk + + + sdk + + + sdk + diff --git a/HM3CoreKill/HM3CoreKill/ck/HM3AnimationRegistry.cpp b/HM3CoreKill/HM3CoreKill/ck/HM3AnimationRegistry.cpp index 9f172e5..913b275 100644 --- a/HM3CoreKill/HM3CoreKill/ck/HM3AnimationRegistry.cpp +++ b/HM3CoreKill/HM3CoreKill/ck/HM3AnimationRegistry.cpp @@ -4,6 +4,16 @@ #include #include //ZHitman3 definition (pre-def) +#ifdef HM3_TRACE_ANIMATIONS +#define HM3_TRACE_LOAD_ANIM(name, id, pInfo) HM3_DEBUG("[HM3AnimationRegistry::registerAnimation] register animation \"%s\" with ID %.8X at 0x%.8X\n", name, id, pInfo) +#define HM3_TRACE_UNLOAD_ALL HM3_DEBUG("[HM3AnimationRegistry::reset] unload all!\n") +#define HM3_TRACE_BAD_ANIMATION(path) HM3_DEBUG("[HM3AnimationRegistry::loadCustomAnimation] failed to load animation \"%s\"\n", path) +#else +#define HM3_TRACE_LOAD_ANIM(name, id, pInfo) +#define HM3_TRACE_UNLOAD_ALL +#define HM3_TRACE_BAD_ANIMATION(path) +#endif + namespace ck { @@ -19,23 +29,21 @@ namespace ck return; m_loadedAnimations[info->m_name] = info; - HM3_DEBUG("[HM3AnimationRegistry::registerAnimation] register animation \"%s\" with ID %.8X at 0x%.8X\n", info->m_name, info->m_id, info); + HM3_TRACE_LOAD_ANIM(info->m_name, info->m_id, info); } void HM3AnimationRegistry::reset() { m_loadedAnimations.clear(); - HM3_DEBUG("[HM3AnimationRegistry::reset] unload all!\n"); + HM3_TRACE_UNLOAD_ALL } ioi::hm3::ZAnimationInfo* HM3AnimationRegistry::loadCustomAnimation(const char* animationPath) { auto gameData = ioi::hm3::getGlacierInterface(ioi::hm3::GameData); + HM3_ASSERT(gameData, "GameData should be initialized here!"); if (!gameData) - { - HM3_DEBUG("[HM3AnimationRegistry::loadCustomAnimation] Failed to load custom animation : game data service not available\n"); return nullptr; - } typedef ioi::hm3::ZAnimationInfo* (__thiscall* Glacier_PreloadAnimation_t)(ioi::hm3::ZHitman3*, const char*); Glacier_PreloadAnimation_t preloadAnimation = (Glacier_PreloadAnimation_t)0x00519AE0; @@ -43,7 +51,7 @@ namespace ck auto animation = preloadAnimation(gameData->m_Hitman3, animationPath); if (!animation) { - HM3_DEBUG("[HM3AnimationRegistry::loadCustomAnimation] failed to load animation \"%s\"\n", animationPath); + HM3_TRACE_BAD_ANIMATION(animationPath); return nullptr; } diff --git a/HM3CoreKill/HM3CoreKill/ck/HM3Function.h b/HM3CoreKill/HM3CoreKill/ck/HM3Function.h index 7a55bdd..f37c5c7 100644 --- a/HM3CoreKill/HM3CoreKill/ck/HM3Function.h +++ b/HM3CoreKill/HM3CoreKill/ck/HM3Function.h @@ -104,6 +104,19 @@ class HM3Function return NULL; } public: + static DWORD getValueFromModule(const std::string& process, DWORD offset) + { + /// Find function + ProcessHandleCacheController::ProcessCacheRow procInfo = ProcessHandleCacheController::getProcessHandle(process); + ModuleInfo_t mod = ModuleInfo_t::GetModule(procInfo.pid, process.c_str()); + + HANDLE pHandle = procInfo.handle; + + HM3_ASSERT(pHandle != 0, "Unable to find target process!"); + + return mod.baseAddr + offset; + } + template static DWORD findFunction(const std::string& process, const std::string& pattern, const std::string& mask) { @@ -354,6 +367,13 @@ class HM3Function return static_cast(original_func); } + template + static DWORD hookVFTable(_Class* instance, DWORD index, _RetType(__thiscall _Class::* pMember)(_Args...), bool doLog = true) + { + DWORD newAddr = reinterpret_cast(reinterpret_cast(pMember)); //funny C++ trick to get member addr xD | ref https://stackoverflow.com/a/8122891 + return hookVFTable((DWORD)instance, index, newAddr, doLog); + } + static DWORD hookIAT(const std::string& process, const char* functionName, DWORD to) { ProcessHandleCacheController::ProcessCacheRow cacheRow = ProcessHandleCacheController::getProcessHandle(process); diff --git a/HM3CoreKill/HM3CoreKill/ck/HM3Game.cpp b/HM3CoreKill/HM3CoreKill/ck/HM3Game.cpp index b460675..1b29a03 100644 --- a/HM3CoreKill/HM3CoreKill/ck/HM3Game.cpp +++ b/HM3CoreKill/HM3CoreKill/ck/HM3Game.cpp @@ -72,6 +72,7 @@ void HM3Game::Initialise() setupHookZPlayerDestructor(); patchFreeBeamHere(); setupLoadAnimationHook(); + setupNativeObjectsCreationHooks(); /* @@ -94,6 +95,7 @@ sub_502A80 sub_5EFC00 - preload animations into ZHitman3 */ + HM3_DEBUG("----------------< GAME STARTED >----------------\n"); m_isHackActive = true; } @@ -222,6 +224,23 @@ void HM3Game::setupLoadAnimationHook() }); } +void HM3Game::setupNativeObjectsCreationHooks() +{ + // CMapObject::ctor ending (with runtime infos) + HM3Function::hookFunction( + HM3_PROCESS_NAME, + HM3Offsets::CMapObject_ConstructorEnding, + (DWORD)CMapObject_OnCreate, + { + x86_pushad, + x86_pushfd, + x86_push_eax + }, { + x86_popfd, + x86_popad + }); +} + void HM3Game::onD3DInitialized(IDirect3DDevice9* device) { const auto renderer = GetSystemInterface()->m_renderer; diff --git a/HM3CoreKill/HM3CoreKill/ck/HM3Game.h b/HM3CoreKill/HM3CoreKill/ck/HM3Game.h index f70f987..8051e31 100644 --- a/HM3CoreKill/HM3CoreKill/ck/HM3Game.h +++ b/HM3CoreKill/HM3CoreKill/ck/HM3Game.h @@ -46,6 +46,7 @@ class HM3Game void setupD3DDeviceCreationHook(); void patchFreeBeamHere(); void setupLoadAnimationHook(); + void setupNativeObjectsCreationHooks(); public: static ioi::hm3::ZHM3GameData* GetGameDataInstancePtr(); static ioi::hm3::ZSysInterfaceWintel* GetSystemInterface(); diff --git a/HM3CoreKill/HM3CoreKill/ck/HM3Hooks.cpp b/HM3CoreKill/HM3CoreKill/ck/HM3Hooks.cpp index 5380ecd..d107db3 100644 --- a/HM3CoreKill/HM3CoreKill/ck/HM3Hooks.cpp +++ b/HM3CoreKill/HM3CoreKill/ck/HM3Hooks.cpp @@ -15,10 +15,17 @@ #include #include #include +#include #include #include +#ifdef HM3_TRACE_NATIVE_OBJECTS_CREATION_ENABLED +#define HM3_TRACE_NATIVE_OBJECT_CREATION(instance) HM3_DEBUG("[NativeObject<%s>::CTOR {TypeID is %d}|0x%.X] native object constructed\n", instance->m_runtimeTypeInfo->SelfType, instance->m_runtimeTypeInfo->TypeID, instance) +#else +#define HM3_TRACE_NATIVE_OBJECT_CREATION(instance) +#endif + LRESULT WINAPI Glacier_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { typedef LRESULT(__stdcall* GlacierWndProc_t)(HWND, UINT, WPARAM, LPARAM); @@ -148,4 +155,12 @@ void __stdcall ZHM3_OnAnimationLoaded(ioi::hm3::ZAnimationInfo* animationInstanc { ck::HM3AnimationRegistry::getRegistry().registerAnimation(animationInstance); } +} + +void __stdcall CMapObject_OnCreate(ioi::hm3::CMapObject* instance) +{ + if (!instance) + return; + + HM3_TRACE_NATIVE_OBJECT_CREATION(instance); } \ No newline at end of file diff --git a/HM3CoreKill/HM3CoreKill/ck/HM3Hooks.h b/HM3CoreKill/HM3CoreKill/ck/HM3Hooks.h index a31b21c..8db7800 100644 --- a/HM3CoreKill/HM3CoreKill/ck/HM3Hooks.h +++ b/HM3CoreKill/HM3CoreKill/ck/HM3Hooks.h @@ -3,6 +3,7 @@ #include #include #include +#include ATOM __stdcall RegisterClassExA_Hooked(WNDCLASSEXA* wndClass); @@ -39,4 +40,6 @@ void __stdcall ZDirect3DDevice_OnDeviceReady(ioi::hm3::ZDirect3DDevice* device); void __stdcall OnZMouseWintelCreated(DWORD device); -void __stdcall ZHM3_OnAnimationLoaded(ioi::hm3::ZAnimationInfo* animationInstance); \ No newline at end of file +void __stdcall ZHM3_OnAnimationLoaded(ioi::hm3::ZAnimationInfo* animationInstance); + +void __stdcall CMapObject_OnCreate(ioi::hm3::CMapObject* instance); \ No newline at end of file diff --git a/HM3CoreKill/HM3CoreKill/ck/HM3InGameTools.cpp b/HM3CoreKill/HM3CoreKill/ck/HM3InGameTools.cpp index 91fc377..1af58e9 100644 --- a/HM3CoreKill/HM3CoreKill/ck/HM3InGameTools.cpp +++ b/HM3CoreKill/HM3CoreKill/ck/HM3InGameTools.cpp @@ -247,6 +247,18 @@ namespace ck ImGui::EndPopup(); } } + + { + ImGui::Text("ZGui: "); ImGui::SameLine(0.f, 15.f); + if (!gameData || !gameData->m_Gui) + ImGui::TextColored(ImVec4(1.f, 0.f, 0.f, 1.f), "N/A"); + else + ImGui::TextColored(ImVec4(1.f, 1.f, 0.f, 1.f), "0x%.8X", gameData->m_Gui); + } + + // sub_6AE2C0 (on level event?) + // sub_6ACD90 (on update map) + // ev int __thiscall sub_461780(int this, unsigned int *a2) } } @@ -269,21 +281,36 @@ namespace ck return; } - ImGui::Text("Level control: "); ImGui::SameLine(0.f, 10.f); ImGui::TextColored(ImVec4(1.f, 1.f, 0.f, 1.f), "0x%.8X", levelControl); - - //Get camera transform - //{ - // float oldPos[4] = { 0.f, 0.f, 0.f, 0.f }; - // - // auto cameraClass = ioi::hm3::getCameraClassByIndex(0); - // - // DWORD cameraClass_Method0 = HM3Function::getVirtualFunctionAddress((DWORD)cameraClass, 0x254); - // typedef int(__thiscall* Method0_t)(ioi::hm3::ZHM3CameraClass*, float*, DWORD, signed int, DWORD); - // Method0_t Method0 = (Method0_t)cameraClass_Method0; - // - // Method0(cameraClass, oldPos, 0, 39, 0); - // ImGui::Text("TEST: "); ImGui::SameLine(0.f, 10.f); ImGui::InputFloat3("", oldPos); - //} + ImGui::Text("Level control : "); ImGui::SameLine(0.f, 10.f); ImGui::TextColored(ImVec4(1.f, 1.f, 0.f, 1.f), "0x%.8X", levelControl); + ImGui::Separator(); + ioi::hm3::ZGlacierRTTI* rtti = ioi::hm3::getTypeInfo(levelControl); + + ImGui::Text(" RTTI : "); + ImGui::Text(" ID : %d", rtti->TypeID); + ImGui::Text(" Name : %s", rtti->SelfType); + ImGui::Text(" Parent : %s", rtti->Parent); + ImGui::Text(" Full name : %s", rtti->ComplexTypeName); + ImGui::Separator(); + + ImGui::Text("Map : "); ImGui::SameLine(0.f, 10.f); ImGui::TextColored(ImVec4(1.f, 1.f, 0.f, 1.f), "0x%.8X", gameData->m_IngameMap); + ImGui::Separator(); + ImGui::Text(" RTTI : "); + ImGui::Text(" ID : %d", gameData->m_IngameMap->m_RTTI->TypeID); + ImGui::Text(" Name : %s", gameData->m_IngameMap->m_RTTI->SelfType); + ImGui::Text(" Parent : %s", gameData->m_IngameMap->m_RTTI->Parent); + ImGui::Text(" Full name : %s", gameData->m_IngameMap->m_RTTI->ComplexTypeName); + ImGui::Separator(); + ImGui::Text(" isShowed : %s", (gameData->m_IngameMap->m_showed ? "Yes" : "No")); + if (gameData->m_IngameMap->m_showed) + { + ImGui::Text(" position : {%.4f; %.4f}", gameData->m_IngameMap->m_drawPosition.x, gameData->m_IngameMap->m_drawPosition.y); + ImGui::Text(" cursor : {%.4f; %.4f}", gameData->m_IngameMap->m_drawPosition.z, gameData->m_IngameMap->m_drawPosition.w); + if (gameData->m_IngameMap->m_activeMap->m_viewId >= 0) + ImGui::Text(" floor : (%.4X) %s", gameData->m_IngameMap->m_activeMap->m_viewId, gameData->m_IngameMap->m_activeMap->m_viewName); + else + ImGui::Text(" floor : %s", gameData->m_IngameMap->m_activeMap->m_viewName); + ImGui::Text(" renderer : {%.4f; %.4f; %.4f}", gameData->m_IngameMap->m_iconRenderer->m_position.x, gameData->m_IngameMap->m_iconRenderer->m_position.y, gameData->m_IngameMap->m_iconRenderer->m_position.z); + } } } diff --git a/HM3CoreKill/HM3CoreKill/ck/HM3Offsets.h b/HM3CoreKill/HM3CoreKill/ck/HM3Offsets.h index cfe9574..91f4850 100644 --- a/HM3CoreKill/HM3CoreKill/ck/HM3Offsets.h +++ b/HM3CoreKill/HM3CoreKill/ck/HM3Offsets.h @@ -45,6 +45,9 @@ namespace HM3Offsets static const FuncAddr_t ZHM3CheatMenu_BeamHereFuncPatch = 0x0065BC07; static const FuncAddr_t ZHM3AnimationManager_Pre_OnLoadAnimation = 0x00519B0B; static const FuncAddr_t ZHM3AnimationManager_OnLoadAnimation = 0x00519B09; + static const FuncAddr_t CMapObject_ConstructorEnding = 0x00665E13; + + static const Index_t CMapObject_OnProcessMethodIndex = 29; } namespace D3D9Offsets diff --git a/HM3CoreKill/HM3CoreKill/ck/HM3Types.h b/HM3CoreKill/HM3CoreKill/ck/HM3Types.h index ec6db2d..5905d8b 100644 --- a/HM3CoreKill/HM3CoreKill/ck/HM3Types.h +++ b/HM3CoreKill/HM3CoreKill/ck/HM3Types.h @@ -1,3 +1,4 @@ #pragma once -typedef unsigned long FuncAddr_t; \ No newline at end of file +typedef unsigned long FuncAddr_t; +typedef unsigned int Index_t; \ No newline at end of file diff --git a/HM3CoreKill/HM3CoreKill/sdk/CIngameMap.h b/HM3CoreKill/HM3CoreKill/sdk/CIngameMap.h index 9b1880a..49d6344 100644 --- a/HM3CoreKill/HM3CoreKill/sdk/CIngameMap.h +++ b/HM3CoreKill/HM3CoreKill/sdk/CIngameMap.h @@ -2,50 +2,71 @@ #include #include - -#define DECLARE_UNKNOWN_TYPE_PTR(name) using name = std::uintptr_t; +#include namespace ioi { namespace hm3 { - DECLARE_UNKNOWN_TYPE_PTR(ZWINDOW); - DECLARE_UNKNOWN_TYPE_PTR(ZActionMapTree); - + class CIngameMap; class CMapIconDraw; + class CInGameMapViews; + class MapView_t; + class ZGlacierRTTI; + + class MapAction + { + public: + char* name; //0x0000 + std::uintptr_t* action; //0x0004 + char pad_0x0008[0x4]; //0x0008 + }; //Size=0x000C class CIngameMap { public: - char pad_0000[36]; //0x0000 - ZWINDOW* m_UIWindow; //0x0024 [ZWINDOW] - char pad_0028[144]; //0x0028 - ZActionMapTree* m_actionsTree; //0x00B8 [ZActionMapTree] - char pad_00BC[276]; //0x00BC - CMapIconDraw* m_iconDraw; //0x01D0 - char pad_01D4[180]; //0x01D4 - Vector2 m_mapOffset; //0x0288 - char pad_0290[12]; //0x0290 - bool m_isInDragProcess; //0x029C - char pad_029D[11]; //0x029D - bool m_isShowing; //0x02A8 - char pad_02A9[3]; //0x02A9 - int32_t m_currentPage; //0x02AC - char pad_02B0[32]; //0x02B0 - }; //Size: 0x02D0 + char pad_0x0000[0x18]; //0x0000 + int32_t m_flags; //0x0018 + int32_t m_showed; //0x001C + char pad_0x0020[0xC]; //0x0020 + ZGlacierRTTI* m_RTTI; //0x002C + MapAction m_actions[12]; //0x0030 + char pad_0x00C0[0xE8]; //0x00C0 + CInGameMapViews* m_views; //0x01A8 + char pad_0x01AC[0x24]; //0x01AC + CMapIconDraw* m_iconRenderer; //0x01D0 + char pad_0x01D4[0x38]; //0x01D4 + Vector4 m_drawPosition; //0x020C + char pad_0x021C[0x90]; //0x021C + MapView_t* m_activeMap; //0x02AC + char pad_0x02B0[0x20]; //0x02B0 + + }; //Size=0x02D0 class CMapIconDraw { public: - char pad_0000[16]; //0x0000 - int8_t N00000981; //0x0010 - char pad_0011[3]; //0x0011 - int8_t N00000982; //0x0014 - char pad_0015[3]; //0x0015 - int8_t N00000983; //0x0018 - char pad_0019[3]; //0x0019 - Vector3 m_position; //0x001C - char pad_0028[480]; //0x0028 - }; //Size: 0x0208 - -}} - -#undef DECLARE_UNKNOWN_TYPE_PTR \ No newline at end of file + char pad_0x0000[0x1C]; //0x0000 + Vector3 m_position; //0x001C + char pad_0x0028[0x5C]; //0x0028 + + }; //Size=0x0084 + + class MapView_t + { + public: + int32_t m_unknown; //0x0000 + int32_t m_flags; //0x0004 + char* m_viewName; //0x0008 + int32_t m_viewId; //0x000C + char pad_0x0010[0x4]; //0x0010 + + }; //Size=0x0014 + + class CInGameMapViews + { + public: + MapView_t viewsPool[5]; //0x0000 + char pad_0x0064[0x10]; //0x0064 + ZGlacierRTTI* m_RTTI; //0x0074 + + }; //Size=0x0078 +}} \ No newline at end of file diff --git a/HM3CoreKill/HM3CoreKill/sdk/CMapObject.h b/HM3CoreKill/HM3CoreKill/sdk/CMapObject.h new file mode 100644 index 0000000..de2ab69 --- /dev/null +++ b/HM3CoreKill/HM3CoreKill/sdk/CMapObject.h @@ -0,0 +1,56 @@ +#pragma once + +#include +#include + +namespace ioi { namespace hm3 { + + class CMapObject + { + public: + virtual void Function_0(); //+0000 [rdata base at 0x0076CB0C] + virtual void Function_1(); //+0001 [rdata base at 0x0076CB10] + virtual void Function_2(); //+0002 [rdata base at 0x0076CB14] + virtual void Function_3(); //+0003 [rdata base at 0x0076CB18] + virtual void Function_4(); //+0004 [rdata base at 0x0076CB1C] + virtual void Function_5(); //+0005 [rdata base at 0x0076CB20] + virtual void Function_6(); //+0006 [rdata base at 0x0076CB24] + virtual void Function_7(); //+0007 [rdata base at 0x0076CB28] + virtual void Function_8(); //+0008 [rdata base at 0x0076CB2C] + virtual void Function_9(); //+0009 [rdata base at 0x0076CB30] + virtual void Function_10(); //+000A [rdata base at 0x0076CB34] + virtual void Function_11(); //+000B [rdata base at 0x0076CB38] + virtual void Function_12(); //+000C [rdata base at 0x0076CB3C] + virtual void Function_13(); //+000D [rdata base at 0x0076CB40] + virtual void Function_14(); //+000E [rdata base at 0x0076CB44] + virtual void Function_15(); //+000F [rdata base at 0x0076CB48] + virtual void Function_16(); //+0010 [rdata base at 0x0076CB4C] + virtual void Function_17(); //+0011 [rdata base at 0x0076CB50] + virtual void Function_18(); //+0012 [rdata base at 0x0076CB54] + virtual void Function_19(); //+0013 [rdata base at 0x0076CB58] + virtual void Function_20(); //+0014 [rdata base at 0x0076CB5C] + virtual void Function_21(); //+0015 [rdata base at 0x0076CB60] + virtual void Function_22(); //+0016 [rdata base at 0x0076CB64] + virtual void Function_23(); //+0017 [rdata base at 0x0076CB68] + virtual void Function_24(); //+0018 [rdata base at 0x0076CB6C] + virtual void Function_25(); //+0019 [rdata base at 0x0076CB70] + virtual void Function_26(); //+001A [rdata base at 0x0076CB74] + virtual void Function_27(); //+001B [rdata base at 0x0076CB78] + virtual void Function_28(); //+001C [rdata base at 0x0076CB7C] + virtual void Function_29(); //+001D [rdata base at 0x0076CB80] + virtual void Function_30(); //+001E [rdata base at 0x0076CB84] + virtual void Function_31(); //+001F [rdata base at 0x0076CB88] + virtual void Function_32(); //+0020 [rdata base at 0x0076CB8C] + virtual void Function_33(); //+0021 [rdata base at 0x0076CB90] + virtual void Function_34(); //+0022 [rdata base at 0x0076CB94] + virtual void Function_35(); //+0023 [rdata base at 0x0076CB98] + + // --- MEMBERS --- + char pad_0004[32]; //0x0004 + std::uintptr_t m_objectToLookup; //0x0024 + char pad_0028[4]; //0x0028 + ioi::hm3::ZGlacierRTTI* m_runtimeTypeInfo; //0x002C + char pad_0030[16]; //0x0030 + }; + +}} \ No newline at end of file diff --git a/HM3CoreKill/HM3CoreKill/sdk/InterfacesProvider.h b/HM3CoreKill/HM3CoreKill/sdk/InterfacesProvider.h index 32edd17..98fcd1b 100644 --- a/HM3CoreKill/HM3CoreKill/sdk/InterfacesProvider.h +++ b/HM3CoreKill/HM3CoreKill/sdk/InterfacesProvider.h @@ -1,6 +1,7 @@ #pragma once #include +#include namespace ioi { namespace hm3 { @@ -9,4 +10,20 @@ namespace hm3 { { return ((*(T**)baseAddr)); } + + + template + ZGlacierRTTI* getTypeInfo(T* instance, std::uintptr_t rttiOffset = 0x2C) + { + assert(rttiOffset >= 0); + + if (!instance) + return nullptr; + + auto result = reinterpret_cast(*reinterpret_cast(reinterpret_cast(instance) + rttiOffset)); + if (result->TypeID < 0 || result->TypeID >= 0x10000) + return nullptr; ///Bad type info. TypeID has too much value for it. + + return result; + } }} \ No newline at end of file diff --git a/HM3CoreKill/HM3CoreKill/sdk/ZGUI.h b/HM3CoreKill/HM3CoreKill/sdk/ZGUI.h new file mode 100644 index 0000000..eec386f --- /dev/null +++ b/HM3CoreKill/HM3CoreKill/sdk/ZGUI.h @@ -0,0 +1,147 @@ +#pragma once + +#include + +#define CONCAT_IMPL(a,b) a##b +#define CONCAT(a,b) CONCAT_IMPL(a,b) +#define MEMBER_PAD(id, size) unsigned char CONCAT(CONCAT(__pad_, id),__)[size]; + +namespace ioi { namespace hm3 { + + class ZGUI + { + public: + virtual void UnknownFunction_0();// +0000 + virtual void UnknownFunction_1();// +0004 + virtual void UnknownFunction_2();// +0008 + virtual void UnknownFunction_3();// +000C + virtual void UnknownFunction_4();// +0010 + virtual void UnknownFunction_5();// +0014 + virtual void UnknownFunction_6();// +0018 + virtual void UnknownFunction_7();// +001C + virtual void UnknownFunction_8();// +0020 + virtual void UnknownFunction_9();// +0024 + virtual void UnknownFunction_10();// +0028 + virtual void UnknownFunction_11();// +002C + virtual void UnknownFunction_12();// +0030 + virtual void UnknownFunction_13();// +0034 + virtual void UnknownFunction_14();// +0038 + virtual void UnknownFunction_15();// +003C + virtual void UnknownFunction_16();// +0040 + virtual void UnknownFunction_17();// +0044 + virtual void UnknownFunction_18();// +0048 + virtual void UnknownFunction_19();// +004C + virtual void UnknownFunction_20();// +0050 + virtual void UnknownFunction_21();// +0054 + virtual void UnknownFunction_22();// +0058 + virtual void UnknownFunction_23();// +005C + virtual void UnknownFunction_24();// +0060 + virtual void UnknownFunction_25();// +0064 + virtual void UnknownFunction_26();// +0068 + virtual void UnknownFunction_27();// +006C + virtual void UnknownFunction_28();// +0070 + virtual void UnknownFunction_29();// +0074 + virtual void UnknownFunction_30();// +0078 + virtual void UnknownFunction_31();// +007C + virtual void UnknownFunction_32();// +0080 + virtual void UnknownFunction_33();// +0084 + virtual void UnknownFunction_34();// +0088 + virtual void UnknownFunction_35();// +008C + virtual void UnknownFunction_36();// +0090 + virtual void UnknownFunction_37();// +0094 + virtual void UnknownFunction_38();// +0098 + virtual void UnknownFunction_39();// +009C + virtual void UnknownFunction_40();// +00A0 + virtual void UnknownFunction_41();// +00A4 + virtual void UnknownFunction_42();// +00A8 + virtual void UnknownFunction_43();// +00AC + virtual void UnknownFunction_44();// +00B0 + virtual void UnknownFunction_45();// +00B4 + virtual void UnknownFunction_46();// +00B8 + virtual void UnknownFunction_47();// +00BC + virtual void UnknownFunction_48();// +00C0 + virtual void UnknownFunction_49();// +00C4 + virtual void UnknownFunction_50();// +00C8 + virtual void UnknownFunction_51();// +00CC + virtual void UnknownFunction_52();// +00D0 + virtual void UnknownFunction_53();// +00D4 + virtual void UnknownFunction_54();// +00D8 + virtual void UnknownFunction_55();// +00DC + virtual void UnknownFunction_56();// +00E0 + virtual void UnknownFunction_57();// +00E4 + virtual void UnknownFunction_58();// +00E8 + virtual void UnknownFunction_59();// +00EC + virtual void UnknownFunction_60();// +00F0 + virtual void UnknownFunction_61();// +00F4 + virtual void UnknownFunction_62();// +00F8 + virtual void UnknownFunction_63();// +00FC + virtual void UnknownFunction_64();// +0100 + virtual void UnknownFunction_65();// +0104 + virtual void UnknownFunction_66();// +0108 + virtual void UnknownFunction_67();// +010C + virtual void UnknownFunction_68();// +0110 + virtual void UnknownFunction_69();// +0114 + virtual void UnknownFunction_70();// +0118 + virtual void UnknownFunction_71();// +011C + virtual void UnknownFunction_72();// +0120 + virtual void UnknownFunction_73();// +0124 + virtual void UnknownFunction_74();// +0128 + virtual void UnknownFunction_75();// +012C + virtual void UnknownFunction_76();// +0130 + virtual void UnknownFunction_77();// +0134 + virtual void UnknownFunction_78();// +0138 + virtual void UnknownFunction_79();// +013C + virtual void UnknownFunction_80();// +0140 + virtual void UnknownFunction_81();// +0144 + virtual void UnknownFunction_82();// +0148 + virtual void UnknownFunction_83();// +014C + virtual void UnknownFunction_84();// +0150 + virtual void UnknownFunction_85();// +0154 + virtual void UnknownFunction_86();// +0158 + virtual void UnknownFunction_87();// +015C + virtual void UnknownFunction_88();// +0160 + virtual void UnknownFunction_89();// +0164 + virtual void UnknownFunction_90();// +0168 + virtual void UnknownFunction_91();// +016C + virtual void UnknownFunction_92();// +0170 + virtual void UnknownFunction_93();// +0174 + virtual void UnknownFunction_94();// +0178 + virtual void UnknownFunction_95();// +017C + virtual void UnknownFunction_96();// +0180 + virtual void UnknownFunction_97();// +0184 + virtual void UnknownFunction_98();// +0188 + virtual void UnknownFunction_99();// +018C + virtual void UnknownFunction_100();// +0190 + virtual void UnknownFunction_101();// +0194 + virtual void UnknownFunction_102();// +0198 + virtual void UnknownFunction_103();// +019C + virtual void UnknownFunction_104();// +01A0 + virtual void UnknownFunction_105();// +01A4 + virtual void UnknownFunction_106();// +01A8 + virtual void UnknownFunction_107();// +01AC + virtual void UnknownFunction_108();// +01B0 + virtual void UnknownFunction_109();// +01B4 + virtual void UnknownFunction_110();// +01B8 + virtual void UnknownFunction_111();// +01BC + virtual void UnknownFunction_112();// +01C0 + virtual void UnknownFunction_113();// +01C4 + virtual void UnknownFunction_114();// +01C8 + virtual void UnknownFunction_115();// +01CC + virtual void UnknownFunction_116();// +01D0 + virtual void UnknownFunction_117();// +01D4 + virtual void UnknownFunction_118();// +01D8 + virtual void UnknownFunction_119();// +01DC + + /// ---------- MEMBERS ----------- + MEMBER_PAD(0, 0x5C); + std::uintptr_t m_InventoryMenu; //5C + MEMBER_PAD(1, 0x1C); + std::uintptr_t m_Unknown_WINPIC; //7C + //TODO: Complete it + }; + +}} + +#undef MEMBER_PAD +#undef CONCAT +#undef CONCAT_IMPL \ No newline at end of file diff --git a/HM3CoreKill/HM3CoreKill/sdk/ZGlacierRTTI.h b/HM3CoreKill/HM3CoreKill/sdk/ZGlacierRTTI.h new file mode 100644 index 0000000..254e024 --- /dev/null +++ b/HM3CoreKill/HM3CoreKill/sdk/ZGlacierRTTI.h @@ -0,0 +1,25 @@ +#pragma once + +namespace ioi { namespace hm3 { + + /** + * @class ZGlacierRTTI + * @brief Runtime Type Information Primitive definition + **/ + class ZGlacierRTTI + { + public: + char* ComplexTypeName; //0x0000 + char pad_0x0004[0x14]; //0x0004 + int32_t TypeID; //0x0018 + char pad_0x001C[0x4]; //0x001C + char* SelfType; //0x0020 + char* Parent; //0x0024 + char pad_0x0028[0x4]; //0x0028 + int32_t Unk0; //0x002C + int32_t Unk1; //0x0030 + char* SelfName2; //0x0034 + char pad_0x0038[0x4]; //0x0038 + ZGlacierRTTI* NextEntity; //0x003C + }; //Size=0x0040 +}} \ No newline at end of file diff --git a/HM3CoreKill/HM3CoreKill/sdk/ZHM3GameData.h b/HM3CoreKill/HM3CoreKill/sdk/ZHM3GameData.h index b69b5f6..1a82b9c 100644 --- a/HM3CoreKill/HM3CoreKill/sdk/ZHM3GameData.h +++ b/HM3CoreKill/HM3CoreKill/sdk/ZHM3GameData.h @@ -8,6 +8,7 @@ #include #include #include +#include #define DECLARE_UNKNOWN_TYPE_PTR(name) using name = std::uintptr_t; @@ -21,7 +22,6 @@ namespace hm3 { DECLARE_UNKNOWN_TYPE_PTR(N0000163D); DECLARE_UNKNOWN_TYPE_PTR(ZGui); 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); diff --git a/HM3CoreKill/HM3CoreKill/sdk/ZHM3LevelControl.h b/HM3CoreKill/HM3CoreKill/sdk/ZHM3LevelControl.h index 1d7c07e..16db002 100644 --- a/HM3CoreKill/HM3CoreKill/sdk/ZHM3LevelControl.h +++ b/HM3CoreKill/HM3CoreKill/sdk/ZHM3LevelControl.h @@ -2,6 +2,7 @@ #include #include +#include namespace ioi { namespace hm3 { @@ -114,7 +115,6 @@ namespace ioi { namespace hm3 { virtual void Function99(); virtual void Function100(); virtual void Function101(); - }; }} \ No newline at end of file diff --git a/Notes.txt b/Notes.txt deleted file mode 100644 index eb51098..0000000 --- a/Notes.txt +++ /dev/null @@ -1,62 +0,0 @@ -ZHM3Actor::ZHM3Actor at sub_638700 - -Attack details: -Mask : E8 BB DF E0 FF 83 C4 04 8B C6 5E {call sub_4466D0 to next nearest C2 04 00 (retn 4)} - -Possible good methods: - -sub_516390 - set XYZ & rotation? - -ZHM3MenuElements: -sub_690460 - detect xml target to load -sub_691DB0 - create UI item by type - -ZQuitWindow: -sub_569830 - vftable constructor (usage at 0x00569D53) - -ZStandardMenuFactory: -sub_569960 - GUI element creator - -INTR -sub_675AD0 - -Camera at *(g_GameData + 27000) -sub_4E4300 - set camera position (__thiscall) - -Upgrades -int __thiscall sub_67F940(int (__thiscall ***this)(_DWORD, int), int a2, int a3) - ---- 2020 --- - -class ZHitman3 usable offsets: -(all offsets in HEX format!) -+ 744 - allowed actions mask (bit #8 - does player accepts collisions; bit #16 - does player accepts input from keyboard; other bits not used) -+ 700 - player position X (overrides by 00528FA0 ; char __thiscall setPosition(int *pUser); will reverse it later) -+ 704 - player position Y (overrides by 00528FA0 ; char __thiscall setPosition(int *pUser); will reverse it later) -+ 708 - player position Z (overrides by 00528FA0 ; char __thiscall setPosition(int *pUser); will reverse it later) -+ 3D0 - does player accepts any updates (boolean value, should use as int32_t value) - -class ZLIST for teleport entities -+ 0 - vftable -+ 4 - unknown -+ 8 - unknown -+ C - const 0x50000 (may be used for memcheck by custom ZMemAllocator) -+ 10 - REFTAB -+ 14 from this point and later - values (value by value, looks like static array of items, or inline memory allocation; don't know how it made for now) - -Each value contains -+ 0 - vftbl ZSTDOBJ -+ 4 - pointer to value -+ 8 - always zero -+ C - 0x50000 another const for memcheck - -REFTAB (for case with teleports, not tested with other entities) -+ 0 - vftbl -+ 4 - ? -+ 8 - ? -+ C - ? -+ 10 - ? -+ 14 - total count of sub elements (for ZLIST of teleports - total count of teleports in list) -+ 18 - ? unknown integer value, often less by 1 of +14 offset value; For the first time it seemed that this is the number of weak references to object, but for now, I guess that REFTAB is not shared_ptr. Also it could be used for garbage collector or other memory management stuff - -006A151A - check if mission scripts enabled (and it can override scripts path if it defined in HitmanBloodMoney.ini). it refs to unk_8168B8, that value was initialized by static constructor (thx cxx) \ No newline at end of file diff --git a/ReClassNotes/2k20_notes.txt b/ReClassNotes/2k20_notes.txt deleted file mode 100644 index a33ba05..0000000 --- a/ReClassNotes/2k20_notes.txt +++ /dev/null @@ -1,23 +0,0 @@ -sub_4FBE60 <- ctor of ZSTDOBJ -sub_4E8A90 <- ctor of ZGEOM -sub_65B530 <- teleport cheat implementation - - ---> sub_426BA0 - -class ZSysInterfaceWintel -{ -public: - char pad_0000[184]; //0x0000 - uint32_t m_engineDataBase; //0x00B8 - char *m_basePath; //0x00BC - char pad_00C0[508]; //0x00C0 - char *m_currentScene; //0x02BC - char pad_02C0[508]; //0x02C0 - char *m_currentConfig; //0x04BC - char pad_04C0[1212]; //0x04C0 - uint32_t m_renderer; //0x097C - char pad_0980[7517]; //0x0980 -}; //Size: 0x26DD - -sub_52A970 <- member for teleport (ZTelePortList) \ No newline at end of file diff --git a/ReClassNotes/2k20_reverse_issues.rcnet b/ReClassNotes/2k20_reverse_issues.rcnet deleted file mode 100644 index 94acaa5f086f62131a60844aaa9af2a07a485ab2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21652 zcmeI44{Q_H9mgFY1d@e}@+ae8)1h`%iGo=*l8}TPg)z4BcdWsvjJ%kRSu_DtSQY~K z4iX3&Fs!bEY%SncEkl||&s7viA^4F*9)&1zAT@Sol1m!$hs24K*go5Le!iW(Kiwo( zt34*H^w}TDcfa#{cmDdFbicdb_ib7`anekQL^4J4R&4I3;`yIylEhF{m}k-%WY$P~1JWf57B(ekg^$Q6mfB401l> zHP}164$XFlu@#{HHOvC9RR%p{@0e--qYD6%$SM^c-E@<#JA(jv4Qj&g%do55Jw_RH zKe&Gla0aa!>PL(jzq4nbEn!O04Mu-ZXs6#K-OF6f*@V~AR7n#;69awyt~K^r_s}I; z?L*33Zb+%g_V?c1KSXN^yB$UXbtW6%)6}}r38jjIBzv74x#Q@y1L{!cdkI9&x5vyc zt|SLP+yD54VzZB1cT#zwbTJxPr`PAcLtksosqDydbY(EUChIjv7p&DJK{Tu+_pV9t z*QKdELy5KCy7ekgT#2jentP--&h6?-d1&!E9qN2)q>*OGLyxQp$_raH;*Y#c=N|Aj zr7#!0!}qtH@b{W-i@#tYInu6Sp5>8&$gI?7S9au9`bQqR+CLo}+E3IV4e8`gZPdRC zE+y$HyR}O2{f5}baek+(p_Tdt|MvxR(niX|Rk~=Pa&hHq3f)U)&~CwhKS_Pu*JPkL zuG3BY-YykJicT_0y{p0R=d8qM85)(3EBz(%xsp?S-F=!`pOHbC%ynN=)#IDQfh_dM zq)?KM9=m2Yld~SEy!>OOrdru?cx()nfR6zUd22F(oGJNexDTpOBlLP`|8NuCK?&_8 zxqN?yvC3mo(9qLs3Cij zKL+08gEF!!oYfe9Rsoz~lN~|vIuOIA-XdcywB##-a=6eYJBCi`z;rgXo?LCAr|`4> z5iBD&ocS_7i9cHapRvix(5pHyl})W9U$D?$2Fv`i3Jg}@KNaZEffnIzm@H}$qJ`;f z0taF-Sb>NX*x5k7B4}5H$x1;RCH%-D?WgiESb>NXFeUP_h>j1F$%u{;X3OFGf(e5a zh)jWWTe1_*4U;S^M2-!u$XAR+~>1e0Ge{|$>o zL`Mk=0?BXn2N3PhwpTOj$(3X5jpdVZ!b*tP>5 zyt)-$OnX2pPPxABszusIE#IaC&BDQ}1@OG!Dyk!wiJg_9eSULQEZ^g!6$xyk7Z_*T zDjj0);WQAR5R1LI>LY6%_U>?l|I5D^C9;Zz5$A>Cn|s3>mithAix4dYGvgQzV6Xxa zC?F4H#;Gg9WTlWAB?KP}ukNQXSb+!>Fa$H>DToe>Nr;XTW(G3jvly&EWC{cy3qRw8 zVX?TM+TJ2ue_tqmMHmz_Q}M2nSehoL*iUJLSS%VH2l7-^z&n4^qcV7Mgg>VD^i%EP z>G6S3yh<3X@SDY(sPj0G;e=0VLw4}=h=K!osw&`}Kj~2!ysH}in10y_qlA6Iq9SY+ zzzRgB0Cp5aREdr~4C6xq>?nw+5*>RO#)ksfQ4m=rI&L*S6u^#xh$_*shhcmufE@+c zjqnXtATmcm$nxu_V>7^x0_>*v9~8ijf`}^7v4>%ND1aRW*p2W_RscH+BC13mHy#GB z*$aqLd-q0y8*5}JXH%TLw$yQ_(aos51W%wgAyepql;?&iH8545o9XLT zla6xx$i2o&P%AceGrzrTWWO*Rb~AgSJHaD-uA$W5XIsTN4M*?D%rbL|wfw@dX3Np9 zNxJ3eljCjS%oFVGUtPVGZb9|Sw`kJXt*Wb*H(YHy)F#EL_bpxj9`IcflY zgK?wRVWgq2kJ+W-RrPSmk`AtE%RE&Ml`WjRF>OQLfvXQclxD_ux9wBwJ7=C&G%n}L zezxRdntNc5e|h|0m|D)`>H{AUS9|k`^8JAg+??~}qeY*Zjh*vPD+Ym!^Zq&&9uiFE z6!hq(G+)L4L5SP5HfF+1$yd)LDo!T)Z?AvOE4pcI?BqZ=MtrA>pFbAo9+gP`1_a-! AwEzGB diff --git a/ReClassNotes/M05_FAIL_MISSION.txt b/ReClassNotes/M05_FAIL_MISSION.txt deleted file mode 100644 index 11f9934..0000000 --- a/ReClassNotes/M05_FAIL_MISSION.txt +++ /dev/null @@ -1,5 +0,0 @@ - -Mission fail call graph - - ZPlayer ZHitman3 ZLnkActionQueue ZLnkActionQueue ZHitmanActionDropDeadBody ZHM3LevelControlM05 -sub_528FA0 (at 005290BE) -> sub_5EF760 (at 005EFB4A) -> sub_653D90 (at 00653DA0) -> sub_653D10 (at ) -> sub_609630 (at 00609655) -> sub_6BE610 \ No newline at end of file diff --git a/ReClassNotes/README.md b/ReClassNotes/README.md deleted file mode 100644 index c3e010c..0000000 --- a/ReClassNotes/README.md +++ /dev/null @@ -1,6 +0,0 @@ -ReClassNotes -============= - -Here placed notes about some structures (based on static pointers). - -Also here can be placed other docs about ingame structures. \ No newline at end of file diff --git a/ReClassNotes/ZHM3Actor.reclass b/ReClassNotes/ZHM3Actor.reclass deleted file mode 100644 index 9778571..0000000 --- a/ReClassNotes/ZHM3Actor.reclass +++ /dev/null @@ -1,768 +0,0 @@ - - - - -
-