Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ermaccer committed Jan 14, 2021
1 parent 7cdf602 commit 57326ad
Show file tree
Hide file tree
Showing 8 changed files with 202 additions and 38 deletions.
Binary file modified MK11Hook/MK11Hook.aps
Binary file not shown.
Binary file modified MK11Hook/MK11Hook.rc
Binary file not shown.
8 changes: 8 additions & 0 deletions MK11Hook/code/eSettingsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,12 @@ void eSettingsManager::Init()
iFreeCameraKeyYawPlus = ini.ReadInteger("Settings", "iFreeCameraKeyYawPlus", 0);
iFreeCameraKeyYawMinus = ini.ReadInteger("Settings", "iFreeCameraKeyYawMinus", 0);

iFreeCameraKeyRollPlus = ini.ReadInteger("Settings", "iFreeCameraKeyRollPlus", 0);
iFreeCameraKeyRollMinus = ini.ReadInteger("Settings", "iFreeCameraKeyRollMinus", 0);

iFreeCameraKeyPitchPlus = ini.ReadInteger("Settings", "iFreeCameraKeyPitchPlus", 0);
iFreeCameraKeyPitchMinus = ini.ReadInteger("Settings", "iFreeCameraKeyPitchMinus", 0);

iFreeCameraKeyFOVPlus = ini.ReadInteger("Settings", "iFreeCameraKeyFOVPlus", 0);
iFreeCameraKeyFOVMinus = ini.ReadInteger("Settings", "iFreeCameraKeyFOVMinus", 0);
}
11 changes: 8 additions & 3 deletions MK11Hook/code/eSettingsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@ class eSettingsManager {
int iFreeCameraKeyXMinus;
int iFreeCameraKeyYPlus;
int iFreeCameraKeyYMinus;
int iFreeCameraKeyYawPlus;
int iFreeCameraKeyYawMinus;
int iFreeCameraKeyZPlus;
int iFreeCameraKeyZMinus;

int iFreeCameraKeyYawPlus;
int iFreeCameraKeyYawMinus;
int iFreeCameraKeyPitchPlus;
int iFreeCameraKeyPitchMinus;
int iFreeCameraKeyRollPlus;
int iFreeCameraKeyRollMinus;


int iFreeCameraKeyFOVPlus;
int iFreeCameraKeyFOVMinus;

};

Expand Down
36 changes: 22 additions & 14 deletions MK11Hook/code/mk11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ void __fastcall MK11Hooks::HookProcessStuff()
TheMenu->camRot.Yaw -= TheMenu->iFreeCameraRotSpeed;
if (GetAsyncKeyState(SettingsMgr->iFreeCameraKeyYawPlus))
TheMenu->camRot.Yaw += TheMenu->iFreeCameraRotSpeed;

if (GetAsyncKeyState(SettingsMgr->iFreeCameraKeyRollMinus))
TheMenu->camRot.Roll -= TheMenu->iFreeCameraRotSpeed;
if (GetAsyncKeyState(SettingsMgr->iFreeCameraKeyRollPlus))
TheMenu->camRot.Roll += TheMenu->iFreeCameraRotSpeed;

if (GetAsyncKeyState(SettingsMgr->iFreeCameraKeyPitchMinus))
TheMenu->camRot.Pitch -= TheMenu->iFreeCameraRotSpeed;
if (GetAsyncKeyState(SettingsMgr->iFreeCameraKeyPitchPlus))
TheMenu->camRot.Pitch += TheMenu->iFreeCameraRotSpeed;

if (GetAsyncKeyState(SettingsMgr->iFreeCameraKeyFOVMinus))
TheMenu->camFov -= 1.0f;
if (GetAsyncKeyState(SettingsMgr->iFreeCameraKeyFOVPlus))
TheMenu->camFov += 1.0f;
}

((void(__fastcall*)())_mk11addr(0x1411518C0))();
Expand All @@ -44,10 +59,6 @@ void __fastcall MK11Hooks::HookStartupFightRecording(int64 eventID, int64 a2, in
TheMenu->bYObtained = false;



//((int64(__fastcall*)(int64, int64))_mk11addr(0x1405F8550))(MK11::GetCharacterInfo(PLAYER1), (int64)&name);

//MK11::SetCharacter(PLAYER1, "char_spawn");
((void(__fastcall*)(int64,int64,int64,int64))_mk11addr(0x141157850))(eventID,a2,a3,a4);

}
Expand Down Expand Up @@ -551,18 +562,15 @@ void __fastcall MK11::ActorCamSetPos(int64 ptr, FVector * pos)
*(float*)(ptr + 0x6BC + 4) = pos->Y;
*(float*)(ptr + 0x6BC + 8) = pos->Z;
((void(__fastcall*)(int64, FVector*))_mk11addr(0x141A0F760))(ptr, pos);
// do stuff
//

}

void __fastcall MK11::ActorCamSetRot(int64 ptr, FRotator * rot)
{
*(int*)(ptr + 0x6BC + 12) = rot->Pitch;
*(int*)(ptr + 0x6BC + 12 + 4) = rot->Yaw;
*(int*)(ptr + 0x6BC + 12 + 8) = rot->Roll;
//*(FRotator*)(ptr + 0x6CC) = *rot;
((void(__fastcall*)(int64, FRotator*))_mk11addr(0x141A10140))(ptr, rot);
//
}


Expand Down Expand Up @@ -590,15 +598,15 @@ bool MK11::IsDLC(const char * name)
{
if (name)
{
for (int i = 0; i < sizeof(szCharactersDLC) / sizeof(szCharactersDLC[0]); i++)
{
if (strcmp(name, szCharactersDLC[i]) == 0)
for (int i = 0; i < sizeof(szCharactersDLC) / sizeof(szCharactersDLC[0]); i++)
{
printf("MK11Hook::Info() | Cannot swap DLC characters!\n");
return true;
if (strcmp(name, szCharactersDLC[i]) == 0)
{
printf("MK11Hook::Info() | Cannot swap DLC characters!\n");
return true;
}
}
}
}

return false;
}
56 changes: 54 additions & 2 deletions MK11Hook/code/mk11menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "eSettingsManager.h"

static int64 timer = GetTickCount64();
static int64 func_timer = GetTickCount64();
char textBuffer[260] = {};
const char* szCharacters[] = {
// place npcs first for easy access
Expand Down Expand Up @@ -105,12 +106,21 @@ void MK11Menu::Initialize()

sprintf(szPlayer1ModifierCharacter, szCharacters[0]);
sprintf(szPlayer2ModifierCharacter, szCharacters[0]);
orgMouse.x = GetSystemMetrics(SM_CXSCREEN) / 2;
orgMouse.y = GetSystemMetrics(SM_CYSCREEN) / 2;
mouseSpeedX = 0;
mouseSpeedY = 0;
mouseScroll = 0;
mouseSens = 5;
bInvertMouseY = true;

bFocused = false;
}

void MK11Menu::Draw()
{
ImGui::GetIO().MouseDrawCursor = true;
ImGui::Begin("MK11Hook by ermaccer (0.3)");
ImGui::Begin("MK11Hook by ermaccer (0.3.1)");
if (ImGui::Button("Character Modifier")) iCurrentTab = TAB_CHARACTER_MODIFIER;
ImGui::SameLine();
if (ImGui::Button("Speed Modifier")) iCurrentTab = TAB_SPEED;
Expand Down Expand Up @@ -171,7 +181,6 @@ void MK11Menu::Draw()
}
if (iCurrentTab == TAB_CAMERA)
{

ImGui::Checkbox("Custom Camera Position", &bCustomCamera);
ImGui::InputFloat3("X | Y | Z", &camPos.X);
ImGui::Checkbox("Custom Camera Rotation", &bCustomCameraRot);
Expand All @@ -187,6 +196,18 @@ void MK11Menu::Draw()
ImGui::InputFloat("Freecam Speed", &fFreeCameraSpeed);
ImGui::InputInt("Freecam Rotation Speed", &iFreeCameraRotSpeed);

if (bFreeCameraMovement)
{
ImGui::Separator();
ImGui::Checkbox("Mouse Control", &bEnableMouseControl);

if (bEnableMouseControl)
{
ImGui::Checkbox("Invert Y", &bInvertMouseY);
ImGui::SliderInt("Mouse Smoothness", &mouseSens, 1, 15);
}
}


ImGui::Separator();
if (MK11::GetCharacterObject(PLAYER1) && MK11::GetCharacterObject(PLAYER2))
Expand Down Expand Up @@ -244,6 +265,8 @@ void MK11Menu::Draw()
void MK11Menu::Process()
{
UpdateControls();
if (bFocused && bEnableMouseControl)
UpdateMouse();
}

void MK11Menu::UpdateControls()
Expand Down Expand Up @@ -284,6 +307,35 @@ void MK11Menu::UpdateControls()

}

void MK11Menu::UpdateMouse()
{
if (bIsActive) return;

GetCursorPos(&curMouse);
mouseSpeedX = curMouse.x - orgMouse.x;
mouseSpeedY = curMouse.y - orgMouse.y;


if (bFocused)
{
if (TheMenu->bFreeCameraMovement)
{
float newVal = TheMenu->camRot.Yaw;
newVal += mouseSpeedX / mouseSens;
TheMenu->camRot.Yaw = newVal;


float newValY = TheMenu->camRot.Pitch;

if (bInvertMouseY) mouseSpeedY *= -1;

newValY += mouseSpeedY / mouseSens;
TheMenu->camRot.Pitch = newValY;
}
}

}

bool MK11Menu::GetActiveState()
{
return bIsActive;
Expand Down
17 changes: 17 additions & 0 deletions MK11Hook/code/mk11menu.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include "mk11.h"
#include <Windows.h>
// as usual, based on mh2 debug menu

enum eTabs {
Expand All @@ -25,6 +26,9 @@ class MK11Menu {
public:
bool bSlowMotionEnabled;
float fSlowMotionSpeed;
// window data

bool bFocused;

// characters
bool bPlayer1ModifierEnabled;
Expand All @@ -49,6 +53,7 @@ class MK11Menu {
int iCurrentCustomCamera;
char szCurrentCameraOption[128];
bool bYObtained;


float fAdjustCam;
float fAdjustCamZ;
Expand All @@ -57,6 +62,17 @@ class MK11Menu {
float fAdjustCam3;
float fAdjustCamZ3;
float fAdjustCamX3;

// cam mouse
bool bEnableMouseControl;
bool bInvertMouseY;
POINT orgMouse;
POINT curMouse;
int mouseSpeedX;
int mouseSpeedY;
int mouseScroll;
int mouseSens;

// player
FVector plrPos;
FVector plrPos2;
Expand All @@ -65,6 +81,7 @@ class MK11Menu {
void Draw();
void Process();
void UpdateControls();
void UpdateMouse();
bool GetActiveState();
};

Expand Down
Loading

0 comments on commit 57326ad

Please sign in to comment.