Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET Scripting support #8

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b925acc
Too many things ...
DronCode Feb 17, 2021
a66411b
Fix ZLIST, Clone actor prototype (need to find a way to make it 'alive')
DronCode Feb 18, 2021
20ba8e5
ZActor & ZHM3Actor was disassembled and partial tested.
DronCode Feb 22, 2021
5f8d823
Reversed CTelePortList, ZEventBuffer
DronCode Apr 17, 2021
9f25682
ZRenderWintelD3D reversed partially (only data, vftable is not ready)
DronCode Apr 17, 2021
794f044
FreeFS patch & small refactoring
DronCode Apr 18, 2021
64cfd41
Oh, too many things again.
DronCode Apr 24, 2021
53cfbba
1) Reversed class CElevatorHouse
DronCode May 12, 2021
4018626
1) Reversed ZVCR class
DronCode May 16, 2021
595a651
1) Reversed few methods from ZOSD class
DronCode May 16, 2021
8376411
1) Reversed CKeycardReader class with most useful API methods
DronCode May 16, 2021
692e713
Fix return type of the function
DronCode May 16, 2021
318083e
Reversed few things like COLI, loader sequence and added bugfix for F…
DronCode Jun 26, 2021
60876a9
Try to fix fmt bug
DronCode Jun 26, 2021
75c297d
Reversed ZCameraSpace class
DronCode Jul 25, 2021
5c9d70d
Try to fix build (1)
DronCode Jul 25, 2021
82b594e
Try to build (2): update fmt submodule
DronCode Jul 25, 2021
4d4f416
Try to fix build (3): use C++17 instead of C++20
DronCode Jul 25, 2021
482e882
Try to build (4): restore C++20
DronCode Jul 25, 2021
85b898e
Try to fix build (5): check theory
DronCode Jul 25, 2021
3655afe
Try to fix build (6): check theory again
DronCode Jul 25, 2021
615b5bb
Reversed ZDrawBuffer class
DronCode Jul 25, 2021
3874ad5
Fixed ZCameraSpace on-stack size. Added check for ZCAMERA pointer in …
DronCode Jul 26, 2021
b80a765
Fixed few problems from ZCHAROBJ & ZWINOBJ. Added IRenderDelegate to …
DronCode Jul 31, 2021
47e049b
Reversed ZFONT, ZTTFONT, ZKerningFont classes. Fixed scene patch (mor…
DronCode Aug 1, 2021
a4f3d3e
HackingFramework:
DronCode Aug 29, 2021
377fbd0
BloodMoney:
DronCode Aug 29, 2021
b1ae2b2
Added ZWheelChairLock class, ZClothTracker and ZHM3BriefingControl. A…
DronCode Aug 31, 2021
3eabf32
Trying to understand how UI rendering works in the main menu (and in …
DronCode Sep 4, 2021
fb49eec
Added enums and some fields are reconstructed
DronCode Sep 4, 2021
86e1cd8
Reversed few core classes (ZLIGHT as base)
DronCode Sep 5, 2021
0e8193a
Reversed few things in ZCameraSpace
DronCode Sep 5, 2021
968600e
First implementation of scripting subsystem
DronCode Sep 12, 2021
317e6f4
Refactored API in MonoBindings
DronCode Oct 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Trying to understand how UI rendering works in the main menu (and in …
…other menus too). Also, trying to understand how view and logic interact in UI subsystem.

BloodMoney:
 + CMetalDetector: reversed member field with list of ZREF's to actors to notify on alert
 + PF4RunTime: added static factory method
 + IGUIElement: reversed base UI class
 + ZGUIBase: reversed few member methods
 + ZCONTROL: reversed base class of old UI subsystem
 + ZNavigator: reversed base class of navigator UI elements
 + ZWINOBJ: reversed member method GetTexture
 + ZHM3InventoryMenu: reversed (partially) class with inventory menu (cycle menu)
 + ZColorSet: reversed base class represents set of colors for UI element (normal, focus and disable colors)
 + ZActor: added constant id of alert message
 + ZUpgradeInfo: refactored class to use base class IGUIElement

Glacier:
 + ZBOUND: added class, nothing interesting
 + ZActorHeroCheckInside: reversed class with few helper methods
DronCode committed Sep 4, 2021
commit 3eabf322db461e9a4b542bdd7f778421ecfb2f42
15 changes: 15 additions & 0 deletions ReHitman/BloodMoney/include/BloodMoney/BMConfigurationService.h
Original file line number Diff line number Diff line change
@@ -48,6 +48,21 @@ namespace Hitman::BloodMoney
static std::intptr_t BMAPI_FunctionAddress_ZHM3BriefingControl_CompleteObjective;
static std::intptr_t BMAPI_FunctionAddress_ZHM3BriefingControl_PlaySpeech;
static std::intptr_t BMAPI_FunctionAddress_ZHM3BriefingControl_StopSpeech;
static std::intptr_t BMAPI_FunctionAddress_ZWINOBJ_GetTexture;
static std::intptr_t BMAPI_FunctionAddress_ZGUIBase_GetSize;
static std::intptr_t BMAPI_FunctionAddress_PF4_CreatePathFinder;
static std::intptr_t BMAPI_FunctionAddress_ZHM3InventoryMenu_InitInventoryList;
static std::intptr_t BMAPI_FunctionAddress_ZHM3InventoryMenu_CloseItemView;
static std::intptr_t BMAPI_FunctionAddress_ZHM3InventoryMenu_CloseInventoryMenu;
static std::intptr_t BMAPI_FunctionAddress_ZHM3InventoryMenu_UpdateItemView;
static std::intptr_t BMAPI_FunctionAddress_ZHM3InventoryMenu_UpdateItemInfo;
static std::intptr_t BMAPI_FunctionAddress_ZHM3InventoryMenu_SpinCircle;
static std::intptr_t BMAPI_FunctionAddress_ZHM3InventoryMenu_TurnLeft;
static std::intptr_t BMAPI_FunctionAddress_ZHM3InventoryMenu_TurnRight;
static std::intptr_t BMAPI_FunctionAddress_IGUIElement_ChangeColorSet;
static std::intptr_t BMAPI_FunctionAddress_IGUIElement_ChangeColor;
static std::intptr_t BMAPI_FunctionAddress_IGUIElement_SetColor;
static std::intptr_t BMAPI_FunctionAddress_IGUIElement_GetRightPosOfTextGroup;
static std::intptr_t BMAPI_GlobalVariableAddress_ZVCR_m_msgStealTape;
};
}
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ namespace Hitman::BloodMoney
void DoAlarm();

// data (total size is 0xA8, ZEventBase size is 0x30)
Glacier::REFTAB m_reftab0;
Glacier::REFTAB m_pAttachedActorsRefTab;
int field_4C;
Glacier::REFTAB m_reftab1;
Glacier::REFTAB m_reftab2;
15 changes: 15 additions & 0 deletions ReHitman/BloodMoney/include/BloodMoney/Game/PF4/PF4RunTime.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

namespace Hitman::BloodMoney::PF4RunTime {
class ZData {
public:
//vtable
virtual void Release(bool bFreeMem);

//static
ZData* CreatePathFinder(void* pData);
//data (total size is 0x5E80)
int m_field4;
//TODO: Complete reverse here
};
}
69 changes: 69 additions & 0 deletions ReHitman/BloodMoney/include/BloodMoney/Game/UI/IGUIElement.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#pragma once

#include <BloodMoney/Game/UI/ZGUIBase.h>
#include <BloodMoney/Game/UI/eZWUserEvents.h>
#include <BloodMoney/Game/UI/ZColorSet.h>

namespace Hitman::BloodMoney {
class ZWINDOW;
class ZXMLGUISystem;
class ZResourceManager;

class IGUIElement : public ZGUIBase {
public:
//vftable
virtual void Update(bool);
virtual void Click(eZWUserEvents, int, ZXMLGUISystem*);
virtual void OpenSubwindow();
virtual void SetValue(int);
virtual void Use();
virtual void FocusUpdate();
virtual void Setup(float*, ZResourceManager* pResourceManager, ZWINGROUP* pGroup);
virtual void ReleaseResources(ZResourceManager* pResourceManager);
virtual void SetFocus(bool);
virtual void Cancel();
virtual void Invalidate();
virtual ZWINDOW* GetWindow();

//api
void ChangeColorSet(ZWINGROUP* pGroup, ZColorSet* pColorSet);
void ChangeColor(ZWINGROUP* pGroup, ZColorSet* pColorSet, ZColorSet::EColorIndex eColorIndex);
void SetColor(uint32_t rgba, ZWINGROUP* pGroup, uint32_t mask = 0xFFFFFFFFu);
void GetRightPosOfTextGroup(ZWINGROUP*, Glacier::Vector3* pPos, int iOffsetByX);

//data (total size is 0x6C, base size is 0x48)
int m_field48;
int m_field4C;
int m_field50;
int m_field54;
int m_field58;
int m_field5C;
int m_field60;
int m_field64;
int m_field68;

/*
* @note:
* Why the size of this class is 0x6C?
* Because there are no direct allocations of IGUIElement instance without any inheritance
* we need to find a class with the lowest size and small inheritance tree and if it exists we can choose
* the size of that class as the base size (means that this class does not contain any additional information).
* There are presented the class list which selected to find base size:
*
* Class Size (HEX, in bytes)
* -----------------------------
* ZBackgroundCameraClear 0x6C
* ZHM3HintDetail 0x6C
* ZAnimation 0x80
* ZTextBlock 0x80
* ZXMLFrame 0x80
* ZGraphic 0x84
* ZWeaponDetails 0x110
* ZUpgradeInfo 0x110
* ZGUIEdit 0x240
* ZWeaponSelector 0x564
* ZListBox 0xC14
* ZGUIList 0x1A48
*/
};
}
83 changes: 83 additions & 0 deletions ReHitman/BloodMoney/include/BloodMoney/Game/UI/ZCONTROL.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#pragma once

#include <BloodMoney/Game/UI/ZWINGROUP.h>

namespace Hitman::BloodMoney {
enum class EFocusMove {
TryToFindFocusFromTopValueToBottom = 0,
Value_1 = 1,
Value_2 = 2,
Value_3 = 3,
Value_4 = 4,
};

enum class EControlState {
CS_RELEASED = 1u,
CS_PUSHED = 2u,
CS_HOVERED = 8u,
CS_DISABLED = 32u
};

enum EControlMask {
CM_DISABLED = 1 << 1
};

class ZCONTROL : public ZWINGROUP {
public:
//vftable
virtual void Enable();
virtual void Disable();
virtual bool NotifyControl();
virtual void SetNotifyControl(bool);
virtual void SetOwner(Glacier::uint);
virtual void SetState(Glacier::uint);
virtual Glacier::uint GetState();
virtual void UpdateStateGraphics(Glacier::uint);
virtual void SetAvailableStates(Glacier::uint);
virtual void MouseLeave();
virtual void MouseEnter(bool);
virtual void Push(bool);
virtual void Release();
virtual void Click();
virtual void SetControlId(int id);
virtual int GetControlId();
virtual void GrabFocus();
virtual ZCONTROL* GetNextFocus(EFocusMove eFocusMove);
virtual void SetNextFocus(ZCONTROL* pControl, EFocusMove eFocusMove);
virtual void OnCommand(Glacier::uint);
virtual void OnMouseMove(Glacier::Vector2* pMousePos);
virtual void OnKeyUp(Glacier::uint);
virtual void OnKeyDown(Glacier::uint);
virtual void OnKeyPress(Glacier::uint);
virtual void OnKeyRepeat(Glacier::uint);
virtual void OnFocusReceived(Glacier::uint);
virtual void OnFocusLost(Glacier::uint);
virtual void OnClick(Glacier::ZVector2* pPos, Glacier::uint);
virtual void OnSliderChange(Glacier::uint, Glacier::uint);
virtual void OnScrollbarChange(Glacier::uint, Glacier::uint);
virtual void OnFocusChanged(Glacier::uint, Glacier::uint);
virtual void OnStateChanged(Glacier::uint, Glacier::uint);

//data (total size is 0x98, base size is 0x54)
Glacier::ZREF m_rOwner;
int m_field58;
int m_Id;
int m_stateMask;
EControlState m_currentState;
int m_availableStates;
int m_rControlToFocus1;
int m_rControlToFocus2;
int m_rControlToFocus3;
int m_rControlToFocus4;
bool m_bNotifyControl;
bool m_field7D;
bool m_field7E;
bool m_field7F;
int m_field80;
int m_field84;
int m_field88;
int m_field8C;
int m_field90;
int m_field94;
};
}
24 changes: 24 additions & 0 deletions ReHitman/BloodMoney/include/BloodMoney/Game/UI/ZColorSet.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once

#include <BloodMoney/Game/UI/ZGUIBase.h>

namespace Hitman::BloodMoney {
class ZColorSet : public ZGUIBase {
public:
enum EColorIndex {
DisableColor,
FocusColor,
NormalColor
};

//vftable (no changes)
//api
uint32_t GetColor(EColorIndex colorIndex);

//data (total size is 0x58, base size is 0x48)
int m_field48;
uint32_t m_NormalColor;
uint32_t m_FocusColor;
uint32_t m_DisableColor;
};
}
12 changes: 9 additions & 3 deletions ReHitman/BloodMoney/include/BloodMoney/Game/UI/ZGUIBase.h
Original file line number Diff line number Diff line change
@@ -5,14 +5,20 @@
namespace Hitman::BloodMoney
{
class ZHM3MenuElements;
class ZWINGROUP;

class ZGUIBase
{
public:
char m_name[64]; //0x0004
Glacier::ZVector2 m_position; //0x0044

// vtable
virtual void readParams(const char**, ZHM3MenuElements*);
virtual void addElement(const char*, ZGUIBase*);

// api
void GetSize(ZWINGROUP* pGroup, Glacier::Vector2* pSize);

// data (total size is 0x48)
char m_name[0x40] { 0 }; //0x0004
Glacier::ZVector2 m_position {}; //0x0044
};
}
25 changes: 25 additions & 0 deletions ReHitman/BloodMoney/include/BloodMoney/Game/UI/ZHM3InventoryMenu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once

#include "ZNavigator.h"

namespace Hitman::BloodMoney {
class ZHM3InventoryMenu : public ZNavigator {
public:
//vftable (no changes)
//api
void InitInventoryList();
void CloseItemView();
void CloseInventoryMenu();
void UpdateItemView();
void UpdateItemInfo();
void SpinCircle(bool);
void TurnLeft();
void TurnRight();

//data (total size is 0x1FF8, base size is 0x98)
int m_field98;
int m_field9C;
int m_field100;
//TODO: Complete fields list
};
}
53 changes: 53 additions & 0 deletions ReHitman/BloodMoney/include/BloodMoney/Game/UI/ZNavigator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#pragma once

#include "IGUIElement.h"

namespace Hitman::BloodMoney {
class ZNavigator : public IGUIElement {
public:
//vftable
virtual void SetText();
virtual void ForceSetText(const char* psText);

//data (total size is 0x98, base size is 0x6C)
int m_field6C;
int m_field70;
int m_field74;
int m_field78;
int m_field7C;
int m_field80;
int m_field84;
int m_field88;
int m_field8C;
int m_field90;
int m_field94;
/**
* Class list:
*
* Class Size
* ----------------------------------
* ZAgeCheck 0x98
* ZBribesNavigator 0x98
* ZBuyUpgrade 0x98
* ZClearSavedAccount 0x98
* ZContinueToNextMission 0x98
* ZCreateAccountClass 0x98
* ZDefaultButton 0x98
* ZDemoStartTraining 0x98
* ZMissionCompleted 0x98
* ZNetworkUpdateYes 0x98
* ZNewButton 0x98
* ZOnlineAgreementAccept 0x98
* ZQuitGame 0x98
* ZCloseWindow 0x9C
* ZCompleteMission 0xA0
* ZNavigatorGeneric 0xA4
* ZClearLoginNames 0xA4
* ZLoginNames 0xA4
* ZLoadScene 0xA4
* ZNetConfig 0xA8
* ZCreateProfile 0xB0
* ZHM3InventoryMenu 0x1FF8
*/
};
}
1 change: 1 addition & 0 deletions ReHitman/BloodMoney/include/BloodMoney/Game/UI/ZWINOBJ.h
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@ namespace Hitman::BloodMoney
virtual void SetPriority(uint8_t);

// api
int GetTexture(unsigned int iTextureType);

// data (total size is 0x88, base size is 0x10)
int m_field10; //+0x10
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

namespace Hitman::BloodMoney {
enum class eZWUserEvents;
}
2 changes: 2 additions & 0 deletions ReHitman/BloodMoney/include/BloodMoney/Game/ZActor.h
Original file line number Diff line number Diff line change
@@ -26,6 +26,8 @@ namespace Hitman::BloodMoney
{
};

static constexpr Glacier::ZMSGID kAlarmMsg = 0x81A;

// vftable
virtual void SetActorRootTM(float const*,float const*);
virtual void SetActorPosDir(float const*,float const*);
28 changes: 11 additions & 17 deletions ReHitman/BloodMoney/include/BloodMoney/Game/ZUpgradeInfo.h
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
#pragma once

#include <BloodMoney/Game/UI/IGUIElement.h>

namespace Hitman::BloodMoney
{
// Type forwardings for class ZUpgradeInfo
class ZGUIBase;
class ZXMLGUISystem;
class ZWINGROUP;
enum class eZWUserEvents;
class ZResourceManager;

// Class definition ZUpgradeInfo
class ZUpgradeInfo {
virtual void Ctor();
virtual void addElement(char const*, ZGUIBase*); //#0000 at 0044D9CC org ZGUIBase::addElement(char const*,ZGUIBase*)
virtual void Update(bool); //#0001 at 003C59C8 org ZUpgradeInfo::Update(bool)
virtual void Click(eZWUserEvents,int,ZXMLGUISystem *); //#0002 at 0044DA68 org IGUIElement::Click(eZWUserEvents,int,ZXMLGUISystem *)
virtual void OpenSubwindow(); //#0003 at 0044DA18 org IGUIElement::OpenSubwindow(void)
virtual void SetValue(int); //#0004 at 0044DA20 org IGUIElement::SetValue(int)
virtual void Use(); //#0005 at 0044DA28 org IGUIElement::Use(void)
virtual void FocusUpdate(); //#0006 at 0044DA30 org IGUIElement::FocusUpdate(void)
virtual void Setup(float *,ZResourceManager *,ZWINGROUP *); //#0007 at 003C5A80 org ZUpgradeInfo::Setup(float *,ZResourceManager *,ZWINGROUP *)
virtual void ReleaseResources(ZResourceManager *); //#0008 at 003C5EC0 org ZUpgradeInfo::ReleaseResources(ZResourceManager *)
virtual void SetFocus(bool); //#0009 at 0044DA60 org IGUIElement::SetFocus(bool)
virtual void Cancel(); //#0010 at 0044DA38 org IGUIElement::Cancel(void)
virtual void Invalidate(); //#0011 at 0044DA40 org IGUIElement::Invalidate(void)
virtual void GetWindow(); //#0012 at 0044DA48 org IGUIElement::GetWindow(void)
}; //End of ZUpgradeInfo from 0057B880
class ZUpgradeInfo : public IGUIElement {
public:
//vftable
//api
void SetupTextGraphic();

//data (total size is 0x110, base size is 0x6c)
int m_field6C;
};
}
16 changes: 16 additions & 0 deletions ReHitman/BloodMoney/source/BMConfigurationService.cpp
Original file line number Diff line number Diff line change
@@ -40,5 +40,21 @@ namespace Hitman::BloodMoney
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_ZHM3BriefingControl_CompleteObjective = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_ZHM3BriefingControl_PlaySpeech = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_ZHM3BriefingControl_StopSpeech = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_ZWINOBJ_GetTexture = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_ZGUIBase_GetSize = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_PF4_CreatePathFinder = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_InitInventoryList = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_CloseItemView = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_CloseInventoryMenu = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_UpdateItemView = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_UpdateItemInfo = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_SpinCircle = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_TurnLeft = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_TurnRight = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_ChangeColorSet = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_ChangeColor = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_SetColor = BMConfigurationService::kNotConfiguredOption;
std::intptr_t BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_GetRightPosOfTextGroup = BMConfigurationService::kNotConfiguredOption;

std::intptr_t BMConfigurationService::BMAPI_GlobalVariableAddress_ZVCR_m_msgStealTape = BMConfigurationService::kNotConfiguredOption;
}
16 changes: 16 additions & 0 deletions ReHitman/BloodMoney/source/Client.cpp
Original file line number Diff line number Diff line change
@@ -133,6 +133,7 @@ namespace Hitman::BloodMoney
Glacier::G1ConfigurationService::G1API_FunctionAddress_ZCameraSpace_TransformInversMatPos = 0x00439FC0;
Glacier::G1ConfigurationService::G1API_FunctionAddress_CCom_GetpVal = 0x004267A0;
Glacier::G1ConfigurationService::G1API_FunctionAddress_CCom_GetVal = 0x00426380;
Glacier::G1ConfigurationService::G1API_FunctionAddress_ZActorHeroCheckInside_IsInside = 0x005D4BC0;
#pragma endregion
#pragma region BloodMoney Configuration Table
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_ZPathFollower_GetClosestWaypoint = 0x00654450;
@@ -173,6 +174,21 @@ namespace Hitman::BloodMoney
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_ZHM3BriefingControl_CompleteObjective = 0x006CF120;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_ZHM3BriefingControl_PlaySpeech = 0x006CF650;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_ZHM3BriefingControl_StopSpeech = 0x006CEBB0;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_ZWINOBJ_GetTexture = 0x0054F2A0;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_ZGUIBase_GetSize = 0x00564040;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_PF4_CreatePathFinder = 0x004D8C50;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_InitInventoryList = 0x00681A10;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_CloseItemView = 0x00680DA0;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_CloseInventoryMenu = 0x00681040;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_UpdateItemView = 0x006813F0;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_UpdateItemInfo = 0x00681F10;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_SpinCircle = 0x00680E10;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_TurnLeft = 0x00680F40;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_TurnRight = 0x00680FC0;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_ChangeColorSet = 0x0055E6E0;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_ChangeColor = 0x0055E800;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_SetColor = 0x0055E4E0;
BloodMoney::BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_GetRightPosOfTextGroup = 0x0055E550;
BloodMoney::BMConfigurationService::BMAPI_GlobalVariableAddress_ZVCR_m_msgStealTape = 0x009B3C24;
#pragma endregion
return true;
15 changes: 15 additions & 0 deletions ReHitman/BloodMoney/source/Game/PF4/PF4RunTime.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <BloodMoney/Game/PF4/PF4RunTime.h>
#include <BloodMoney/BMConfigurationService.h>
#include <cassert>

namespace Hitman::BloodMoney::PF4RunTime {
ZData* ZData::CreatePathFinder(void *pData) {
if (!pData) return nullptr;
assert(BMConfigurationService::BMAPI_FunctionAddress_PF4_CreatePathFinder != BMConfigurationService::kNotConfiguredOption);
if (BMConfigurationService::BMAPI_FunctionAddress_PF4_CreatePathFinder != BMConfigurationService::kNotConfiguredOption) {
return ((ZData*(__cdecl*)(void*))BMConfigurationService::BMAPI_FunctionAddress_PF4_CreatePathFinder)(pData);
}

return nullptr;
}
}
34 changes: 34 additions & 0 deletions ReHitman/BloodMoney/source/Game/UI/IGUIElement.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <BloodMoney/Game/UI/IGUIElement.h>
#include <BloodMoney/Game/UI/ZWINGROUP.h>
#include <BloodMoney/BMConfigurationService.h>
#include <cassert>

namespace Hitman::BloodMoney {
void IGUIElement::ChangeColorSet(ZWINGROUP *pGroup, ZColorSet *pColorSet) {
assert(BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_ChangeColorSet != BMConfigurationService::kNotConfiguredOption);
if (BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_ChangeColorSet != BMConfigurationService::kNotConfiguredOption) {
((void(__thiscall*)(IGUIElement*,ZWINGROUP*,ZColorSet*))BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_ChangeColorSet)(this, pGroup, pColorSet);
}
}

void IGUIElement::ChangeColor(ZWINGROUP *pGroup, ZColorSet *pColorSet, ZColorSet::EColorIndex eColorIndex) {
assert(BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_ChangeColor != BMConfigurationService::kNotConfiguredOption);
if (BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_ChangeColor != BMConfigurationService::kNotConfiguredOption) {
((void(__thiscall*)(IGUIElement*,ZWINGROUP*,ZColorSet*,ZColorSet::EColorIndex))BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_ChangeColor)(this, pGroup, pColorSet, eColorIndex);
}
}

void IGUIElement::SetColor(uint32_t rgba, ZWINGROUP *pGroup, uint32_t mask) {
assert(BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_SetColor != BMConfigurationService::kNotConfiguredOption);
if (BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_SetColor != BMConfigurationService::kNotConfiguredOption) {
((void(__thiscall*)(IGUIElement*,uint32_t,ZWINGROUP*,uint32_t))BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_SetColor)(this, rgba, pGroup, mask);
}
}

void IGUIElement::GetRightPosOfTextGroup(ZWINGROUP* pGroup, Glacier::Vector3 *pPos, int iOffsetByX) {
assert(BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_GetRightPosOfTextGroup != BMConfigurationService::kNotConfiguredOption);
if (BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_GetRightPosOfTextGroup != BMConfigurationService::kNotConfiguredOption) {
((void(__thiscall*)(IGUIElement*,ZWINGROUP*,Glacier::Vector3*,int))BMConfigurationService::BMAPI_FunctionAddress_IGUIElement_GetRightPosOfTextGroup)(this, pGroup, pPos, iOffsetByX);
}
}
}
16 changes: 16 additions & 0 deletions ReHitman/BloodMoney/source/Game/UI/ZColorSet.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <BloodMoney/Game/UI/ZColorSet.h>

namespace Hitman::BloodMoney {
uint32_t ZColorSet::GetColor(EColorIndex colorIndex) {
switch (colorIndex) {
case EColorIndex::NormalColor:
return m_NormalColor;
case EColorIndex::DisableColor:
return m_DisableColor;
case EColorIndex::FocusColor:
return m_FocusColor;
}

return 0u;
}
}
15 changes: 15 additions & 0 deletions ReHitman/BloodMoney/source/Game/UI/ZGUIBase.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <BloodMoney/Game/UI/ZGUIBase.h>
#include <BloodMoney/Game/UI/ZWINGROUP.h>
#include <BloodMoney/BMConfigurationService.h>
#include <cassert>

namespace Hitman::BloodMoney {
void ZGUIBase::GetSize(ZWINGROUP* pGroup, Glacier::Vector2* pSize) {
assert(pGroup != nullptr);
assert(pSize != nullptr);
assert(BMConfigurationService::BMAPI_FunctionAddress_ZGUIBase_GetSize != BMConfigurationService::kNotConfiguredOption);
if (BMConfigurationService::BMAPI_FunctionAddress_ZGUIBase_GetSize != BMConfigurationService::kNotConfiguredOption) {
((void(__thiscall*)(ZGUIBase*,ZWINGROUP*,Glacier::Vector2*))BMConfigurationService::BMAPI_FunctionAddress_ZGUIBase_GetSize)(this, pGroup, pSize);
}
}
}
61 changes: 61 additions & 0 deletions ReHitman/BloodMoney/source/Game/UI/ZHM3InventoryMenu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#include <BloodMoney/Game/UI/ZHM3InventoryMenu.h>
#include <BloodMoney/BMConfigurationService.h>
#include <cassert>

namespace Hitman::BloodMoney {
void ZHM3InventoryMenu::InitInventoryList() {
assert(BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_InitInventoryList != BMConfigurationService::kNotConfiguredOption);
if (BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_InitInventoryList != BMConfigurationService::kNotConfiguredOption) {
((void(__thiscall*)(ZHM3InventoryMenu*))BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_InitInventoryList)(this);
}
}

void ZHM3InventoryMenu::CloseItemView() {
assert(BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_CloseItemView != BMConfigurationService::kNotConfiguredOption);
if (BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_CloseItemView != BMConfigurationService::kNotConfiguredOption) {
((void(__thiscall*)(ZHM3InventoryMenu*))BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_CloseItemView)(this);
}
}

void ZHM3InventoryMenu::CloseInventoryMenu() {
assert(BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_CloseItemView != BMConfigurationService::kNotConfiguredOption);
if (BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_CloseItemView != BMConfigurationService::kNotConfiguredOption) {
((void(__thiscall*)(ZHM3InventoryMenu*))BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_CloseItemView)(this);
}
}

void ZHM3InventoryMenu::UpdateItemView() {
assert(BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_UpdateItemView != BMConfigurationService::kNotConfiguredOption);
if (BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_UpdateItemView != BMConfigurationService::kNotConfiguredOption) {
((void(__thiscall*)(ZHM3InventoryMenu*))BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_UpdateItemView)(this);
}
}

void ZHM3InventoryMenu::UpdateItemInfo() {
assert(BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_UpdateItemInfo != BMConfigurationService::kNotConfiguredOption);
if (BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_UpdateItemInfo != BMConfigurationService::kNotConfiguredOption) {
((void(__thiscall*)(ZHM3InventoryMenu*))BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_UpdateItemInfo)(this);
}
}

void ZHM3InventoryMenu::SpinCircle(bool a1) {
assert(BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_SpinCircle != BMConfigurationService::kNotConfiguredOption);
if (BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_SpinCircle != BMConfigurationService::kNotConfiguredOption) {
((void(__thiscall*)(ZHM3InventoryMenu*, bool))BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_SpinCircle)(this, a1);
}
}

void ZHM3InventoryMenu::TurnLeft() {
assert(BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_TurnLeft != BMConfigurationService::kNotConfiguredOption);
if (BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_TurnLeft != BMConfigurationService::kNotConfiguredOption) {
((void(__thiscall*)(ZHM3InventoryMenu*))BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_TurnLeft)(this);
}
}

void ZHM3InventoryMenu::TurnRight() {
assert(BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_TurnRight != BMConfigurationService::kNotConfiguredOption);
if (BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_TurnRight != BMConfigurationService::kNotConfiguredOption) {
((void(__thiscall*)(ZHM3InventoryMenu*))BMConfigurationService::BMAPI_FunctionAddress_ZHM3InventoryMenu_TurnRight)(this);
}
}
}
15 changes: 15 additions & 0 deletions ReHitman/BloodMoney/source/Game/UI/ZWINOBJ.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <BloodMoney/Game/UI/ZWINOBJ.h>
#include <BloodMoney/BMConfigurationService.h>
#include <cassert>

namespace Hitman::BloodMoney
{
int ZWINOBJ::GetTexture(unsigned int iTextureType) {
assert(BMConfigurationService::BMAPI_FunctionAddress_ZWINOBJ_GetTexture != BMConfigurationService::kNotConfiguredOption);

if (BMConfigurationService::BMAPI_FunctionAddress_ZWINOBJ_GetTexture != BMConfigurationService::kNotConfiguredOption) {
return ((int(__thiscall*)(ZWINOBJ*,unsigned int))BMConfigurationService::BMAPI_FunctionAddress_ZWINOBJ_GetTexture)(this, iTextureType);
}
return 0;
}
}
1 change: 1 addition & 0 deletions ReHitman/Glacier/include/G1ConfigurationService.h
Original file line number Diff line number Diff line change
@@ -67,6 +67,7 @@ namespace Glacier
static std::intptr_t G1API_FunctionAddress_ZCameraSpace_TransformInversMatPos;
static std::intptr_t G1API_FunctionAddress_CCom_GetpVal;
static std::intptr_t G1API_FunctionAddress_CCom_GetVal;
static std::intptr_t G1API_FunctionAddress_ZActorHeroCheckInside_IsInside;

static std::intptr_t G1API_InstanceAddress_ZEngineGeomControl;

12 changes: 12 additions & 0 deletions ReHitman/Glacier/include/Glacier/Geom/ZBOUND.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once

#include <Glacier/Geom/ZSTDOBJ.h>

namespace Glacier {
class ZBOUND : public ZSTDOBJ {
public:
//vftable
void Draw(ZDrawBuffer* pDrawBuffer, ZCAMERA* pCamera, const float* a2, const float* a3);
//data (total size is 0x10, base size is 0x10)
};
}
92 changes: 92 additions & 0 deletions ReHitman/Glacier/include/Glacier/ZActorHeroCheckInside.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#pragma once

#include <Glacier/EventBase/ZEventBase.h>

namespace Glacier {
class ZGEOM;

class ZActorHeroCheckInside : public Glacier::ZEventBase {
public:
//consts
static constexpr Glacier::ZMSGID kActivateFrameUpdateMsg = 0x83A;
//vftable (no changes)
//api
bool IsInside(Glacier::ZGEOM* pGeom);
//data (total size is 0x15C, base size is 0x30)
int m_field30;
int m_field34;
int m_field38;
int m_field3C;
int m_field40;
int m_field44;
int m_field48;
int m_field4C;
int m_field50;
int m_field54;
int m_field58;
int m_field5C;
int m_field60;
int m_field64;
int m_field68;
int m_field6C;
int m_field70;
int m_field74;
int m_field78;
int m_field7C;
int m_field80;
int m_field84;
int m_field88;
int m_field8C;
int m_field90;
int m_field94;
int m_field98;
int m_field9C;
int m_fieldA0;
int m_fieldA4;
int m_fieldA8;
int m_fieldAC;
int m_fieldB0;
int m_fieldB4;
int m_fieldB8;
int m_fieldBC;
int m_fieldC0;
int m_fieldC4;
int m_fieldC8;
int m_fieldCC;
int m_fieldD0;
int m_fieldD4;
int m_fieldD8;
int m_fieldDC;
int m_fieldE0;
int m_fieldE4;
int m_fieldE8;
int m_fieldEC;
int m_fieldF0;
int m_fieldF4;
int m_fieldF8;
int m_fieldFC;
int m_field100;
int m_field104;
int m_field108;
int m_field10C;
int m_field110;
int m_field114;
int m_field118;
int m_field11C;
int m_field120;
int m_field124;
int m_field128;
int m_field12C;
int m_field130;
int m_field134;
int m_field138;
int m_field13C;
int m_field140;
int m_field144;
int m_field148;
int m_field14C;
int m_field150;
int m_field154;
int m_field158;
};
}
1 change: 1 addition & 0 deletions ReHitman/Glacier/source/G1ConfigurationService.cpp
Original file line number Diff line number Diff line change
@@ -74,6 +74,7 @@ namespace Glacier
std::intptr_t G1ConfigurationService::G1API_FunctionAddress_ZCameraSpace_TransformInversMatPos = G1ConfigurationService::kNotConfiguredOption;
std::intptr_t G1ConfigurationService::G1API_FunctionAddress_CCom_GetpVal = G1ConfigurationService::kNotConfiguredOption;
std::intptr_t G1ConfigurationService::G1API_FunctionAddress_CCom_GetVal = G1ConfigurationService::kNotConfiguredOption;
std::intptr_t G1ConfigurationService::G1API_FunctionAddress_ZActorHeroCheckInside_IsInside = G1ConfigurationService::kNotConfiguredOption;

std::intptr_t G1ConfigurationService::G1API_InstanceAddress_ZEngineGeomControl = G1ConfigurationService::kNotConfiguredOption;

17 changes: 17 additions & 0 deletions ReHitman/Glacier/source/ZActorHeroCheckInside.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <Glacier/ZActorHeroCheckInside.h>
#include <Glacier/Geom/ZGEOM.h>
#include <G1ConfigurationService.h>
#include <cassert>

namespace Glacier {
bool ZActorHeroCheckInside::IsInside(Glacier::ZGEOM* pGeom) {
if (!pGeom) { return false; }

assert(G1ConfigurationService::G1API_FunctionAddress_ZActorHeroCheckInside_IsInside != G1ConfigurationService::kNotConfiguredOption);
if (G1ConfigurationService::G1API_FunctionAddress_ZActorHeroCheckInside_IsInside != G1ConfigurationService::kNotConfiguredOption) {
return ((bool(__thiscall*)(ZActorHeroCheckInside*,ZGEOM*))G1ConfigurationService::G1API_FunctionAddress_ZActorHeroCheckInside_IsInside)(this, pGeom);
}

return false;
}
}