Skip to content

Commit

Permalink
head camera, hud, skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
ermaccer committed Jan 22, 2022
1 parent 6fdd644 commit b940b3e
Show file tree
Hide file tree
Showing 14 changed files with 462 additions and 130 deletions.
Binary file modified I2Hook/I2Hook.rc
Binary file not shown.
3 changes: 3 additions & 0 deletions I2Hook/I2Hook.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@
<ClInclude Include="code\MKCharacter.h" />
<ClInclude Include="code\MKModifier.h" />
<ClInclude Include="code\MKStructs.h" />
<ClInclude Include="code\unreal\FName.h" />
<ClInclude Include="code\unreal\FVector.h" />
<ClInclude Include="eDirectX11Hook.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="imgui\imconfig.h" />
Expand Down Expand Up @@ -178,6 +180,7 @@
<ClCompile Include="code\mkcamera.cpp" />
<ClCompile Include="code\MKCharacter.cpp" />
<ClCompile Include="code\MKModifier.cpp" />
<ClCompile Include="code\unreal\FName.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="eDirectX11Hook.cpp" />
<ClCompile Include="font.h" />
Expand Down
12 changes: 12 additions & 0 deletions I2Hook/I2Hook.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
<Filter Include="Header Files\imgui">
<UniqueIdentifier>{175955e2-34e8-487e-91d7-570e3b1342db}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\code\unreal">
<UniqueIdentifier>{0af6796d-1a24-4afc-ad4f-498d01ed5e7b}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h">
Expand Down Expand Up @@ -129,6 +132,12 @@
<ClInclude Include="code\MKModifier.h">
<Filter>Header Files\code</Filter>
</ClInclude>
<ClInclude Include="code\unreal\FName.h">
<Filter>Header Files\code\unreal</Filter>
</ClInclude>
<ClInclude Include="code\unreal\FVector.h">
<Filter>Header Files\code\unreal</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
Expand Down Expand Up @@ -212,6 +221,9 @@
<ClCompile Include="font.h">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="code\unreal\FName.cpp">
<Filter>Header Files\code\unreal</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="utils\LICENSE">
Expand Down
31 changes: 31 additions & 0 deletions I2Hook/code/MKCharacter.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "MKCharacter.h"
#include "dcf2.h"
#include "unreal/FName.h"


void MKCharacter::SetLife(float life)
{
((void(__fastcall*)(MKCharacter*, float))_addr(0x1409725D0))(this, life);
Expand Down Expand Up @@ -29,3 +32,31 @@ void MKCharacter::ClearAbility()
{
*(int*)(this + 99068) = 0;
}

void MKCharacter::ActivateHeadTracking()
{
((void(__fastcall*)(MKCharacter*, float))_addr(0x1410CB9C0))(this, 0.5);
}

void MKCharacter::KillHeadTracking()
{
((void(__fastcall*)(MKCharacter*, float))_addr(0x1410CB940))(this, 0.5);
}

void MKCharacter::SetBoneSize(const char * name, float size)
{
FName fname(name, FNAME_Add, 1);
((void(__fastcall*)(MKCharacter*, FName,float))_addr(0x1410CC940))(this, fname, size);
}

void MKCharacter::GetBonePos(const char * name, FVector * pos)
{
FName fname(name, FNAME_Add, 1);
((void(__fastcall*)(MKCharacter*, FName, FVector*))_addr(0x1410BBDA0))(this, fname, pos);
}

void MKCharacter::GetBoneRot(const char * name, FRotator * rot)
{
FName fname(name, FNAME_Add, 1);
((void(__fastcall*)(MKCharacter*, FName, FRotator*))_addr(0x14094D570))(this, fname, rot);
}
9 changes: 8 additions & 1 deletion I2Hook/code/MKCharacter.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "MKStructs.h"
#include "mk10utils.h"

#include "unreal/FVector.h"

class MKCharacter {
public:
Expand All @@ -14,5 +14,12 @@ class MKCharacter {

void ClearAbility();

void ActivateHeadTracking();
void KillHeadTracking();

void SetBoneSize(const char* name, float size);

void GetBonePos(const char* name, FVector* pos);
void GetBoneRot(const char* name, FRotator* rot);
};

7 changes: 0 additions & 7 deletions I2Hook/code/MKStructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ enum PLAYER_NUM
};


struct FVector
{
float X;
float Y;
float Z;
};

struct FRotator
{
int Pitch;
Expand Down
44 changes: 36 additions & 8 deletions I2Hook/code/dcf2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ int64 hud_property = 0;

void __fastcall Hooks::HookProcessStuff()
{


TheMenu->Process();
Notifications->Update();

Expand All @@ -30,6 +32,10 @@ void __fastcall Hooks::HookProcessStuff()
if (TheMenu->m_bZeroMeterP1)
SetCharacterMeter(GetInfo(PLAYER1), 0.0f);

if (TheMenu->m_bDisableHeadTracking)
GetObj(PLAYER1)->KillHeadTracking();


if (TheMenu->m_bP1CustomAbilities)
{
TheMenu->m_nP1Abilities = 0;
Expand All @@ -42,6 +48,14 @@ void __fastcall Hooks::HookProcessStuff()
}
GetObj(PLAYER1)->SetAbility(TheMenu->m_nP1Abilities);
}

if (TheMenu->m_nCurrentCustomCamera == CAMERA_HEAD_TRACKING && TheMenu->m_bCustomCameras)
{
TheMenu->m_bDisableHeadTracking = true;
GetObj(PLAYER1)->SetBoneSize("Head", 0.01f);
}


}


Expand All @@ -57,7 +71,10 @@ void __fastcall Hooks::HookProcessStuff()
SetCharacterMeter(GetInfo(PLAYER2), 1.0f);
if (TheMenu->m_bZeroMeterP2)
SetCharacterMeter(GetInfo(PLAYER2), 0.0f);

if (TheMenu->m_bAutoHideHUD)
HideHUD();
if (TheMenu->m_bDisableHeadTracking)
GetObj(PLAYER2)->KillHeadTracking();
if (TheMenu->m_bP1CustomAbilities)
{
TheMenu->m_nP2Abilities = 0;
Expand All @@ -70,6 +87,12 @@ void __fastcall Hooks::HookProcessStuff()
}
GetObj(PLAYER2)->SetAbility(TheMenu->m_nP2Abilities);
}

if (TheMenu->m_nCurrentCustomCamera == CAMERA_HEAD_TRACKING && TheMenu->m_bCustomCameras && TheMenu->m_bUsePlayerTwoAsTracker)
{
TheMenu->m_bDisableHeadTracking = true;
GetObj(PLAYER2)->SetBoneSize("Head", 0.01f);
}
}


Expand All @@ -89,13 +112,6 @@ void __fastcall Hooks::HookProcessStuff()
}


if (!(GetObj(PLAYER1)) || !(GetObj(PLAYER2)))
{
if (TheMenu->m_bCustomCameras)
TheMenu->m_bCustomCameras = false;
}



if (TheMenu->m_bFreeCam)
{
Expand Down Expand Up @@ -145,6 +161,8 @@ void __fastcall Hooks::HookProcessStuff()

}



((void(__fastcall*)())(_addr(0x141725320)))();
}

Expand Down Expand Up @@ -300,3 +318,13 @@ void GetCharacterPosition(FVector * vec, PLAYER_NUM plr)
((void(__fastcall*)(int64, FVector*))_addr(0x140B5BF00))(GetInfo(plr), vec);
}

void HideHUD()
{
((void(__fastcall*)(int, int))_addr(0x14058E3D0))(8, 8);
}

void ShowHUD()
{
((void(__fastcall*)(int, int))_addr(0x14058E9D0))(8, 8);
}

7 changes: 6 additions & 1 deletion I2Hook/code/dcf2.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
#include "mk10utils.h"
#include "MKStructs.h"
#include "MKCharacter.h"
#include "unreal/FVector.h"

#define GFG_GAME_INFO 0x14417DF30

#define I2HOOK_VERSION "0.4.3"
#define I2HOOK_VERSION "0.4.4"


MKCharacter* GetObj(PLAYER_NUM plr);
Expand All @@ -20,6 +21,10 @@ void SetCharacterBreakers(PLAYER_NUM plr, int amount);
char* GetCharacterName(PLAYER_NUM plr);
void GetCharacterPosition(FVector* vec,PLAYER_NUM plr);

void HideHUD();
void ShowHUD();


void SlowGameTimeForXTicks(float speed, int ticks);

void SetTagAssist(PLAYER_NUM plr, char* character);
Expand Down
Loading

0 comments on commit b940b3e

Please sign in to comment.