Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ermaccer committed Jul 11, 2021
1 parent aa58d9e commit 2045e5b
Show file tree
Hide file tree
Showing 12 changed files with 275 additions and 121 deletions.
Binary file modified I2Hook/I2Hook.rc
Binary file not shown.
2 changes: 2 additions & 0 deletions I2Hook/I2Hook.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
<ClInclude Include="code\eSettingsManager.h" />
<ClInclude Include="code\mk10utils.h" />
<ClInclude Include="code\mkcamera.h" />
<ClInclude Include="eDirectX11Hook.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="imgui\imconfig.h" />
<ClInclude Include="imgui\imgui.h" />
Expand Down Expand Up @@ -198,6 +199,7 @@
<ClCompile Include="code\mk10utils.cpp" />
<ClCompile Include="code\mkcamera.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="eDirectX11Hook.cpp" />
<ClCompile Include="imgui\imgui.cpp" />
<ClCompile Include="imgui\imgui_demo.cpp" />
<ClCompile Include="imgui\imgui_draw.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions I2Hook/I2Hook.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="eDirectX11Hook.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
Expand Down Expand Up @@ -194,6 +197,9 @@
<ClCompile Include="imgui\imgui_tables.cpp">
<Filter>Header Files\imgui</Filter>
</ClCompile>
<ClCompile Include="eDirectX11Hook.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="utils\LICENSE">
Expand Down
31 changes: 31 additions & 0 deletions I2Hook/code/dcf2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include "eSettingsManager.h"
#include "eNotifManager.h"
#include <Windows.h>
#include "mkcamera.h"

int64 hud_property = 0;

static int64 gametimer = GetTickCount64();

Expand Down Expand Up @@ -77,6 +80,16 @@ void __fastcall DCF2Hooks::HookProcessStuff()
}


if (TheMenu->bForceMoveCamera)
{
if (TheCamera)
{
TheCamera->HookedSetPosition(&TheMenu->camPos);
TheCamera->HookedSetRotation(&TheMenu->camRot);
TheCamera->SetFOV(TheMenu->camFov);
}

}


((void(__fastcall*)())(0x1498F27F0))();
Expand Down Expand Up @@ -136,6 +149,24 @@ int64 __fastcall DCF2Hooks::HookLoadCharacter(int64 ptr, char * name)
return ((int64(__fastcall*)(int64, char*))_addr(0x145EAEC10))(ptr, name);
}

int64 DCF2Hooks::HookSetProperty(int64 ptr, char * name, int64 unk)
{
hud_property = ptr;
return ((int64(__fastcall*)(int64, char*, int64))_addr(0x14218EC40))(ptr, name, unk);
}

void DCF2Hooks::HookReadPropertyValue(int64 ptr, int64 * unk, int64 * value)
{
int64 input = *value;
if (ptr == hud_property)
{
if (TheMenu->bForceDisableHUD)
input ^= 1;
}

*unk = *(int64*)(ptr + 296) & input | *unk & ~*(int64*)(ptr + 296);
}




Expand Down
6 changes: 5 additions & 1 deletion I2Hook/code/dcf2.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "mk10utils.h"
#define GFG_GAME_INFO 0x14410C6D8

#define I2HOOK_VERSION "0.2"
#define I2HOOK_VERSION "0.3"

enum PLAYER_NUM
{
Expand Down Expand Up @@ -66,4 +66,8 @@ namespace DCF2Hooks {
void __fastcall HookStartupFightRecording(int64 eventID, int64 a2, int64 a3, int64 a4);
int64 __fastcall HookLoadCharacter(int64 ptr, char * name);


int64 HookSetProperty(int64 ptr, char* name, int64 unk);
void HookReadPropertyValue(int64 ptr, int64* unk, int64* value);

}
29 changes: 21 additions & 8 deletions I2Hook/code/dcf2menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ const char* szCameraModes[TOTAL_CUSTOM_CAMERAS] = {
"Third Person #2",
"First Person",
"First Person Mid",
"Mortal Kombat 11"
};

int GetCamMode(const char* mode)
Expand Down Expand Up @@ -212,6 +213,8 @@ void DCF2Menu::Initialize()
fAdjustCamZ3 = 0;
bYObtained = false;
bFocused = false;
bForceMoveCamera = false;
bForceDisableHUD = false;
}

void DCF2Menu::Draw()
Expand Down Expand Up @@ -239,6 +242,7 @@ void DCF2Menu::Draw()
}
ImGui::EndCombo();
}

ImGui::Separator();
ImGui::Checkbox("Enable Player 2 Modifier", &bPlayer2ModifierEnabled);

Expand Down Expand Up @@ -285,10 +289,17 @@ void DCF2Menu::Draw()

ImGui::Separator();
ImGui::Checkbox("Enable Freecam", &bFreeCameraMovement);
ImGui::SameLine(); ShowHelpMarker("Requires all toggles enabled!\n You can configure keys in .ini file.");
ImGui::SameLine(); ShowHelpMarker("Requires all toggles enabled!\nYou can configure keys in .ini file.");
ImGui::InputFloat("Freecam Speed", &fFreeCameraSpeed);
ImGui::InputInt("Freecam Rotation Speed", &iFreeCameraRotSpeed);



ImGui::Separator();
ImGui::Text("Check this option if the game you can't move camera anymore win poses.");
ImGui::Checkbox("Force Camera To Move", &bForceMoveCamera);


if (bFreeCameraMovement)
{
ImGui::Separator();
Expand Down Expand Up @@ -372,6 +383,15 @@ void DCF2Menu::Draw()

ImGui::EndTabItem();
}

if (ImGui::BeginTabItem("Misc."))
{
ImGui::Checkbox("Disable HUD Completely", &bForceDisableHUD);
ImGui::SameLine();
ShowHelpMarker("You'll need to go in-game/back to menu for this option to take effect.");

ImGui::EndTabItem();
}
}
}

Expand All @@ -384,13 +404,6 @@ void DCF2Menu::Process()

void DCF2Menu::UpdateControls()
{
if (GetAsyncKeyState(SettingsMgr->iHookMenuOpenKey))
{
if (GetTickCount64() - timer <= 150) return;
timer = GetTickCount64();
bIsActive ^= 1;
}

if (GetAsyncKeyState(VK_F5))
{
if (GetTickCount64() - timer <= 150) return;
Expand Down
11 changes: 10 additions & 1 deletion I2Hook/code/dcf2menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ enum eCustomCameras {
CAMERA_3RDPERSON2,
CAMERA_1STPERSON,
CAMERA_1STPERSON_MID,
CAMERA_MK11,
TOTAL_CUSTOM_CAMERAS
};

Expand All @@ -21,9 +22,10 @@ enum eCustomCameras {

class DCF2Menu {
private:
bool bIsActive;
int iCurrentTab;
public:
bool bIsActive;

bool bSlowMotionEnabled;
int iSlowMotionTicks;
float fSlowMotionSpeed;
Expand Down Expand Up @@ -72,6 +74,7 @@ class DCF2Menu {
int mouseSpeedY;
int mouseSens;


bool bFreeCameraMovement;
float fFreeCameraSpeed;
int iFreeCameraRotSpeed;
Expand All @@ -89,7 +92,13 @@ class DCF2Menu {
float fAdjustCamZ3;
float fAdjustCamX3;

bool bForceMoveCamera;

int iSlowMoRefreshDelay;


bool bForceDisableHUD;

void Initialize();
void Draw();
void Process();
Expand Down
14 changes: 14 additions & 0 deletions I2Hook/code/mkcamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
#include "dcf2menu.h"
#include <iostream>

MKCamera* TheCamera;

void MKCamera::SetPosition(FVector * pos)
{
TheCamera = this;
*(float*)(this + 0x584) = pos->X;
*(float*)(this + 0x584 + 4) = pos->Y;
*(float*)(this + 0x584 + 8) = pos->Z;
Expand All @@ -13,6 +16,7 @@ void MKCamera::SetPosition(FVector * pos)

void MKCamera::SetRotation(FRotator * rot)
{
TheCamera = this;
*(int*)(this + 0x584 + 12) = rot->Pitch;
*(int*)(this + 0x584 + 12 + 4) = rot->Yaw;
*(int*)(this + 0x584 + 12 + 8) = rot->Roll;
Expand Down Expand Up @@ -109,6 +113,12 @@ void MKCamera::HookedSetPosition(FVector * pos)
pos->Z = 124.0f + plrPos.Z;


TheMenu->camPos = *pos;
break;
case CAMERA_MK11:
pos->X += 120.0f;
pos->Z += 25.0f;

TheMenu->camPos = *pos;
break;
}
Expand Down Expand Up @@ -196,6 +206,10 @@ void MKCamera::HookedSetRotation(FRotator * rot)
rot->Yaw = -16000;
}

TheMenu->camRot = *rot;
break;
case CAMERA_MK11:
rot->Pitch -= 1258;
TheMenu->camRot = *rot;
break;
}
Expand Down
4 changes: 3 additions & 1 deletion I2Hook/code/mkcamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ class MKCamera {

void HookedSetPosition(FVector* pos);
void HookedSetRotation(FRotator* rot);
};
};

extern MKCamera* TheCamera;
Loading

0 comments on commit 2045e5b

Please sign in to comment.