Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ set(MODS
Noclip
HUD
Camera
Aimbot
Wallhack
)

foreach(MOD IN LISTS MODS)
Expand Down
47 changes: 47 additions & 0 deletions HitmanAbsolutionSDK/src/Glacier/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
cmake_minimum_required(VERSION 3.8)

project("HitmanAbsolutionSDK" C CXX)

set(CMAKE_CXX_STANDARD 23)
set(GAME_INSTALL_PATH "" CACHE PATH "Path of Hitman Absolution folder.")
set(VCPKG_BUILD_ROOT "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}")

find_package(directxtk CONFIG REQUIRED)
find_package(minhook CONFIG REQUIRED)

add_subdirectory(External/imgui-docking-layout)
add_subdirectory(External/imguizmo)
add_subdirectory(External/imgui-node-editor)

add_subdirectory(HitmanAbsolutionSDK)
add_subdirectory(DirectInputProxy)

set(MODS
FreeCamera
StartingOutfitAndWeaponModifier
Player
Actors
Items
Editor
Noclip
HUD
Camera
Aimbot
Wallhack
)

foreach(MOD IN LISTS MODS)
add_subdirectory("Mods/${MOD}")
endforeach()

if (EXISTS ${GAME_INSTALL_PATH})
install(FILES "$<TARGET_FILE:DirectInputProxy>" DESTINATION ${GAME_INSTALL_PATH})
install(FILES "$<TARGET_FILE:HitmanAbsolutionSDK>" DESTINATION ${GAME_INSTALL_PATH})

foreach(MOD IN LISTS MODS)
install(FILES "$<TARGET_FILE:${MOD}>" DESTINATION "${GAME_INSTALL_PATH}/mods")
endforeach()

file(TO_CMAKE_PATH "${GAME_INSTALL_PATH}" GAME_INSTALL_PATH_CMAKE)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/assets/" DESTINATION "${GAME_INSTALL_PATH_CMAKE}/assets")
endif()
40 changes: 40 additions & 0 deletions HitmanAbsolutionSDK/src/Glacier/HitmanAbsolutionSDK/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
file(GLOB_RECURSE SRC_FILES
CONFIGURE_DEPENDS
src/*.cpp
src/*.c
src/*.hpp
src/*.h,
)

file(GLOB_RECURSE HEADER_FILES
CONFIGURE_DEPENDS
include/*.h
)

add_library(HitmanAbsolutionSDK SHARED
${SRC_FILES}
${HEADER_FILES}
)

target_include_directories(HitmanAbsolutionSDK PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/External/IconFontCppHeaders
${CMAKE_SOURCE_DIR}/External/mINI/src/mini
)

target_link_libraries(HitmanAbsolutionSDK PUBLIC
Microsoft::DirectXTK
imgui-docking-layout
minhook::minhook
winmm
)

target_compile_definitions(HitmanAbsolutionSDK PRIVATE
EXPORTS
)

install(TARGETS HitmanAbsolutionSDK
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once

#include "../ZHM5BaseCharacter.h"
#include "../Physics/ICharacterCollision.h"
#include "EActorDeathType.h"
#include "../ZCharacterTemplateAspect.h"
#include "EActorType.h"
#include "ZHM5CCProfile.h"

class HitmanAbsolutionSDK_API ZActor : public ZHM5BaseCharacter, public ICharacterCollision
{
public:
const ZString& GetActorName() const;
ZRuntimeResourceID GetHMAsResourceID() const;
TArray<TEntityRef<IHM5Item>>& GetRuntimeInventory();
void KillActor(EActorDeathType eDeathType, bool bDeathVisible);
void SetCCProfile(TEntityRef<ZHM5CCProfile> ccProfile);
void SetActorName(const ZString& actorName);
float4 GetBoneWorldPosition(unsigned int boneID) const;

private:
TEntityRef<ZHM5CCProfile> m_rCCProfile; //0x1F4
PAD(0x10);
ZString m_sActorName; //0x20C
EActorType m_eActorType; //0x214
PAD(0x1C);
TArray<TEntityRef<IHM5Item>> m_inventory; //0x234
PAD(0x64);
TEntityRef<ZCharacterTemplateAspect> m_pCharacterTemplate; //0x2A4
PAD(0x910);
TArray<TEntityRef<IHM5Item>> m_runtimeInventory; //0xBBC
PAD(0x38);
};

static_assert(sizeof(ZActor) == 0xC00);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

#include "IComponentInterface.h"

class HitmanAbsolutionSDK_API ZGlobalBoneRegistry : public IComponentInterface
{
public:
int GetBoneID(char const* pBoneName) const;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#pragma once

#include <Windows.h>
#include <iostream>
#include <format>

#include "Mutex.h"
#include "Connection/PipeServer.h"
#include "Common.h"

#undef GetCurrentTime

class Logger
{
public:
enum class Level
{
Info,
Warning,
Error
};

struct Message
{
std::string ToString() const
{
std::string level = LevelToString(this->level);

return std::format("ID: {}, Level: {}, Content: {}", id, level, content);
}

int id;
Level level;
std::string content;
};

~Logger();
HitmanAbsolutionSDK_API static Logger& GetInstance();
HitmanAbsolutionSDK_API static unsigned int LevelToNumber(const Level level);
HitmanAbsolutionSDK_API static const char* LevelToString(const Level level);
std::vector<Message>& GetMessages();
void ClearMessage(const unsigned int index);
void ClearAllMessages();
HitmanAbsolutionSDK_API static std::string GetCurrentTime();
static std::string GetLastError();

template <typename... Args>
void Log(const Level level, const std::string& format, const Args&... args)
{
ScopedExclusiveGuard scopedSharedGuard = ScopedExclusiveGuard(&srwLock);

std::cout << LevelToString(level) << std::vformat(format, std::make_format_args(args...)) << std::endl;

PipeServer& pipeServer = PipeServer::GetInstance();

if (pipeServer.IsConnectedWithEditor())
{
std::string type = std::format("sdk_{}", LevelToNumber(level));
std::string content = LevelToString(level) + std::vformat(format, std::make_format_args(args...));

pipeServer.SendMessage(type, content);
}

Message message;

message.id = static_cast<int>(messages.size());
message.level = level;
message.content = std::vformat(format, std::make_format_args(args...));

messages.push_back(message);
}

private:
Logger();
Logger(const Logger& other) = delete;
Logger& operator=(const Logger& other) = delete;

FILE* file;
SRWLOCK srwLock;
std::vector<Message> messages;
};
84 changes: 84 additions & 0 deletions HitmanAbsolutionSDK/src/Glacier/HitmanAbsolutionSDK/include/SDK.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#pragma once

#include "Renderer/DirectXRenderer.h"
#include "Renderer/ImGuiRenderer.h"
#include "ModManager.h"
#include "UI/MainMenu.h"
#include "UI/ModSelector.h"
#include "UI/Settings.h"
#include "ResourcePatcher.h"

class ZMemoryManager;
class ZHitman5Module;
class ZEngineAppCommon;
class ZIniFile;
class ZMouseWindows;
class ZKeyboardWindows;

void __fastcall ZRenderDevice_PresentHook(ZRenderDevice* pThis, int edx);
void __fastcall ZRenderSwapChain_ResizeHook(ZRenderSwapChain* pThis, int edx, const SRenderDestinationDesc* pDescription);
long __stdcall ZApplicationEngineWin32_MainWindowProcHook(ZApplicationEngineWin32* pThis, HWND hWnd, unsigned int uMsgId, unsigned int wParam, long lParam);
bool __fastcall ZHitman5Module_InitializeHook(ZHitman5Module* pThis, int edx);
bool __fastcall ZEngineAppCommon_InitializeHook(ZEngineAppCommon* pThis, int edx, const SRenderDestinationDesc& description);
void __fastcall ZEngineAppCommon_UninitializeHook(ZEngineAppCommon* pThis, int edx);
void __fastcall ZMouseWindows_UpdateHook(ZMouseWindows* pThis, int edx, bool bIgnoreOldEvents);
void __fastcall ZKeyboardWindows_UpdateHook(ZKeyboardWindows* pThis, int edx, bool bIgnoreOldEvents);

class SDK
{
public:
HitmanAbsolutionSDK_API static SDK& GetInstance();
void Setup();
void Cleanup();

static ZMemoryManager* GetMemoryManager();
static void InitializeSingletons();

void OnEngineInitialized();
void OnEngineUninitialized();
void OnModLoaded(const std::string& name, ModInterface* modInterface, const bool liveLoad);
void OnDrawUI(const bool hasFocus);
void OnDraw3D();
void OnDrawMenu();

void OnPresent(ZRenderDevice* renderDevice);
void OnResize(const SRenderDestinationDesc* pDescription);

long MainWindowProc(ZApplicationEngineWin32* applicationEngineWin32, HWND hWnd, unsigned int uMsgId, unsigned int wParam, long lParam);

void OnMouseWindowsUpdate(ZMouseWindows* mouseWindows, bool bIgnoreOldEvents);
void OnKeyboardWindowsUpdate(ZKeyboardWindows* keyboardWindows, bool bIgnoreOldEvents);

HitmanAbsolutionSDK_API ImGuiContext* GetImGuiContext();
HitmanAbsolutionSDK_API ImGuiMemAllocFunc GetImGuiMemAllocFunc();
HitmanAbsolutionSDK_API ImGuiMemFreeFunc GetImGuiMemFreeFunc();
HitmanAbsolutionSDK_API void* GetImGuiUserDataAllocator();
HitmanAbsolutionSDK_API ImFont* GetRegularFont();
HitmanAbsolutionSDK_API ImFont* GetBoldFont();

HitmanAbsolutionSDK_API std::shared_ptr<DirectXRenderer> GetDirectXRenderer() const;
HitmanAbsolutionSDK_API std::shared_ptr<ImGuiRenderer> GetImGuiRenderer() const;

std::shared_ptr<ModManager> GetModManager() const;

std::shared_ptr<ModSelector> GetModSelector() const;
std::shared_ptr<Settings> GetSettings() const;

std::shared_ptr<ResourcePatcher> GetResourcePatcher() const;

private:
SDK();
SDK(const SDK& other) = delete;
SDK& operator=(const SDK& other) = delete;

std::shared_ptr<DirectXRenderer> directXRenderer;
std::shared_ptr<ImGuiRenderer> imGuiRenderer;

std::shared_ptr<ModManager> modManager;

std::shared_ptr<MainMenu> mainMenu;
std::shared_ptr<ModSelector> modSelector;
std::shared_ptr<Settings> settings;

std::shared_ptr<ResourcePatcher> resourcePatcher;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <Glacier/Actor/ZActor.h>

#include <Function.h>
#include <Global.h>

const ZString& ZActor::GetActorName() const
{
return m_sActorName;
}

ZRuntimeResourceID ZActor::GetHMAsResourceID() const
{
return m_pCharacterTemplate.GetRawPointer()->GetHMAsResourceID();
}

TArray<TEntityRef<IHM5Item>>& ZActor::GetRuntimeInventory()
{
return m_runtimeInventory;
}

void ZActor::KillActor(EActorDeathType eDeathType, bool bDeathVisible)
{
Function::CallMethod<ZActor*, EActorDeathType, bool>(BaseAddress + 0x174790, this, eDeathType, bDeathVisible);
}

void ZActor::SetCCProfile(TEntityRef<ZHM5CCProfile> ccProfile)
{
m_rCCProfile = ccProfile;
}

void ZActor::SetActorName(const ZString& actorName)
{
m_sActorName = actorName;
}

float4 ZActor::GetBoneWorldPosition(unsigned int iBoneId) const
{
return Function::CallRVOMethodAndReturn<float4, ZActor*, unsigned int>(BaseAddress + 0x456090, const_cast<ZActor*>(this), iBoneId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "Glacier/ZGlobalBoneRegistry.h"

#include <Function.h>
#include <Global.h>

int ZGlobalBoneRegistry::GetBoneID(char const* pBoneName) const
{
return Function::CallMethodAndReturn<int, const ZGlobalBoneRegistry*, char const*>(BaseAddress + 0x86990, this, pBoneName);
}
Loading