Skip to content

Commit

Permalink
free camera overhaul, mouse control
Browse files Browse the repository at this point in the history
  • Loading branch information
ermaccer committed Jul 1, 2022
1 parent a1f581c commit c73fc24
Show file tree
Hide file tree
Showing 36 changed files with 761 additions and 134 deletions.
Binary file modified MK11Hook/MK11Hook.rc
Binary file not shown.
16 changes: 16 additions & 0 deletions MK11Hook/MK11Hook.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,27 @@
<ClInclude Include="code\helper\eAbilityNames.h" />
<ClInclude Include="code\helper\eGamepadManager.h" />
<ClInclude Include="code\helper\eKeyboardMan.h" />
<ClInclude Include="code\helper\eMath.h" />
<ClInclude Include="code\helper\eMouse.h" />
<ClInclude Include="code\Krypt.h" />
<ClInclude Include="code\mk10utils.h" />
<ClInclude Include="code\mk11.h" />
<ClInclude Include="code\mk11menu.h" />
<ClInclude Include="code\MKCamera.h" />
<ClInclude Include="code\MKCharacter.h" />
<ClInclude Include="code\MKCommand.h" />
<ClInclude Include="code\MKModifier.h" />
<ClInclude Include="code\MKObject.h" />
<ClInclude Include="code\MKStructs.h" />
<ClInclude Include="code\PlayerInfo.h" />
<ClInclude Include="code\plugin\ePluginInterface.h" />
<ClInclude Include="code\unreal\FMath.h" />
<ClInclude Include="code\unreal\FMatrix.h" />
<ClInclude Include="code\unreal\FName.h" />
<ClInclude Include="code\unreal\FQuat.h" />
<ClInclude Include="code\unreal\FRotator.h" />
<ClInclude Include="code\unreal\FVector.h" />
<ClInclude Include="code\VMProc.h" />
<ClInclude Include="eDirectX11Hook.h" />
<ClInclude Include="font.h" />
<ClInclude Include="framework.h" />
Expand Down Expand Up @@ -150,6 +160,8 @@
<ClCompile Include="code\helper\eAbilityNames.cpp" />
<ClCompile Include="code\helper\eGamepadManager.cpp" />
<ClCompile Include="code\helper\eKeyboardMan.cpp" />
<ClCompile Include="code\helper\eMath.cpp" />
<ClCompile Include="code\helper\eMouse.cpp" />
<ClCompile Include="code\Krypt.cpp" />
<ClCompile Include="code\mk10utils.cpp" />
<ClCompile Include="code\mk11.cpp" />
Expand All @@ -159,7 +171,11 @@
<ClCompile Include="code\MKModifier.cpp" />
<ClCompile Include="code\MKObject.cpp" />
<ClCompile Include="code\PlayerInfo.cpp" />
<ClCompile Include="code\plugin\ePluginInterface.cpp" />
<ClCompile Include="code\unreal\FMath.cpp" />
<ClCompile Include="code\unreal\FMatrix.cpp" />
<ClCompile Include="code\unreal\FName.cpp" />
<ClCompile Include="code\VMProc.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="eDirectX11Hook.cpp" />
<ClCompile Include="imgui\imgui.cpp" />
Expand Down
66 changes: 57 additions & 9 deletions MK11Hook/MK11Hook.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
<Filter Include="Header Files\kiero\minhook">
<UniqueIdentifier>{db46cdf8-7c42-4a12-a5f1-14ed4879f476}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\dx">
<UniqueIdentifier>{7187d197-8447-41c0-9f40-8dcab7f80186}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\code\helper">
<UniqueIdentifier>{bb5a43a5-8836-46b1-9a85-18be7a5c70a3}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\code\unreal">
<UniqueIdentifier>{28f5b54e-93a3-4310-8370-b568866173c6}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\code\plugin">
<UniqueIdentifier>{625ccf99-cebc-4904-a474-5f92cefdad83}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
Expand Down Expand Up @@ -129,9 +129,6 @@
<ClInclude Include="code\MKCharacter.h">
<Filter>Header Files\code</Filter>
</ClInclude>
<ClInclude Include="eDirectX11Hook.h">
<Filter>Source Files\dx</Filter>
</ClInclude>
<ClInclude Include="code\MKStructs.h">
<Filter>Header Files\code</Filter>
</ClInclude>
Expand Down Expand Up @@ -174,6 +171,39 @@
<ClInclude Include="code\helper\eGamepadManager.h">
<Filter>Header Files\code\helper</Filter>
</ClInclude>
<ClInclude Include="code\plugin\ePluginInterface.h">
<Filter>Header Files\code\plugin</Filter>
</ClInclude>
<ClInclude Include="code\MKCommand.h">
<Filter>Header Files\code</Filter>
</ClInclude>
<ClInclude Include="code\VMProc.h">
<Filter>Header Files\code</Filter>
</ClInclude>
<ClInclude Include="eDirectX11Hook.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="code\unreal\FMath.h">
<Filter>Header Files\code\unreal</Filter>
</ClInclude>
<ClInclude Include="code\unreal\FMatrix.h">
<Filter>Header Files\code\unreal</Filter>
</ClInclude>
<ClInclude Include="code\unreal\FQuat.h">
<Filter>Header Files\code\unreal</Filter>
</ClInclude>
<ClInclude Include="code\unreal\FRotator.h">
<Filter>Header Files\code\unreal</Filter>
</ClInclude>
<ClInclude Include="code\unreal\FVector.h">
<Filter>Header Files\code\unreal</Filter>
</ClInclude>
<ClInclude Include="code\helper\eMath.h">
<Filter>Header Files\code\helper</Filter>
</ClInclude>
<ClInclude Include="code\helper\eMouse.h">
<Filter>Header Files\code\helper</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
Expand Down Expand Up @@ -242,9 +272,6 @@
<ClCompile Include="code\MKCharacter.cpp">
<Filter>Header Files\code</Filter>
</ClCompile>
<ClCompile Include="eDirectX11Hook.cpp">
<Filter>Source Files\dx</Filter>
</ClCompile>
<ClCompile Include="code\MKModifier.cpp">
<Filter>Header Files\code</Filter>
</ClCompile>
Expand Down Expand Up @@ -281,6 +308,27 @@
<ClCompile Include="code\helper\eGamepadManager.cpp">
<Filter>Header Files\code\helper</Filter>
</ClCompile>
<ClCompile Include="code\plugin\ePluginInterface.cpp">
<Filter>Header Files\code\plugin</Filter>
</ClCompile>
<ClCompile Include="code\VMProc.cpp">
<Filter>Header Files\code</Filter>
</ClCompile>
<ClCompile Include="eDirectX11Hook.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="code\unreal\FMath.cpp">
<Filter>Header Files\code\unreal</Filter>
</ClCompile>
<ClCompile Include="code\unreal\FMatrix.cpp">
<Filter>Header Files\code\unreal</Filter>
</ClCompile>
<ClCompile Include="code\helper\eMath.cpp">
<Filter>Header Files\code\helper</Filter>
</ClCompile>
<ClCompile Include="code\helper\eMouse.cpp">
<Filter>Header Files\code\helper</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MK11Hook.rc">
Expand Down
15 changes: 15 additions & 0 deletions MK11Hook/code/GameInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ FGGameInfo* GetGameInfo()
return *(FGGameInfo**)_addr(GFG_GAME_INFO);
}

int GetGameState()
{
return *(int*)((*(int64*)_addr(GFG_GAME_INFO)) + 1944);
}

void FGGameInfo::SetStage(const char* stage)
{
((void(__thiscall*)(FGGameInfo*, const char*))_addr(0x14059A460))(this, stage);
Expand All @@ -47,3 +52,13 @@ int MKScript::GetFunctionID(int hash)
{
return ((int(__thiscall*)(MKScript*, int, int))_addr(0x14114C5F0))(this, hash, 0);
}

int64 MKScript::GetVar(const char* name)
{
return ((int64(__fastcall*)(MKScript*, const char*, int))_addr(0x14114F750))(this, name, 1);
}

unsigned int MKScript::GetCurrentFunc()
{
return *(unsigned int*)(this + 360);
}
5 changes: 4 additions & 1 deletion MK11Hook/code/GameInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ enum PLAYER_NUM
class MKScript {
public:
int GetFunctionID(int hash);
int64 GetVar(const char* name);
unsigned int GetCurrentFunc();
};

class FGGameInfo {
Expand All @@ -32,4 +34,5 @@ MKScript* GetScript(const char* name);

int64 GetScriptVar(MKScript* script, const char* name);

FGGameInfo* GetGameInfo();
FGGameInfo* GetGameInfo();
int GetGameState();
16 changes: 16 additions & 0 deletions MK11Hook/code/MKCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ void MKCharacter::SetAbility(unsigned int id)
*(int*)(this + 64304) = id;
}

void MKCharacter::SetCombos(bool enable)
{
((void(__fastcall*)(MKCharacter*, int, int))_addr(0x1404C7300))(this, enable, 1);
}

float MKCharacter::GetLife()
{
return *(float*)(this + 3104);
Expand Down Expand Up @@ -95,3 +100,14 @@ void MKCharacter::ExecuteScript(MKScript* script, int function)
((void(__thiscall*)(MKCharacter*, MKScript*, int, int))_addr(0x1404D1CC0))(this, script, function, 1);
}

MKScript* MKCharacter::GetMyScript()
{
return *(MKScript**)(this + 0xA7D8);
}

VMProc* MKCharacter::GetMyProc()
{
return *(VMProc**)(this + 0x10E0);
}


6 changes: 5 additions & 1 deletion MK11Hook/code/MKCharacter.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "MKStructs.h"
#include "mk10utils.h"
#include "GameInfo.h"

#include "VMProc.h"

struct CharacterCAP {
char* Name;
Expand Down Expand Up @@ -50,6 +50,7 @@ class MKCharacter {
void SetInfiniteKrushingBlows(bool enable);
void SetFastUppercutRecovery(bool enable);
void SetAbility(unsigned int id);
void SetCombos(bool enable);

float GetLife();

Expand All @@ -69,6 +70,9 @@ class MKCharacter {


void ExecuteScript(MKScript* script, int function);

MKScript* GetMyScript();
VMProc* GetMyProc();
};


10 changes: 10 additions & 0 deletions MK11Hook/code/MKCommand.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once


struct MKCommand {
char* name;
int air_ground; // or not
int action_key;
char pad[24]; // mk11 only
int* directions; // 4 max, close with -1
};
17 changes: 3 additions & 14 deletions MK11Hook/code/MKStructs.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
#pragma once

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

struct FRotator
{
int Pitch;
int Yaw;
int Roll;
};
#include "unreal/FVector.h"
#include "unreal/FQuat.h"
#include "unreal/FRotator.h"

struct FLinearColor
{
Expand Down
22 changes: 19 additions & 3 deletions MK11Hook/code/PlayerInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,23 @@ void PlayerInfo::SetMeter(eMeterValues type, float value)

void PlayerInfo::SetDamageMult(float value)
{
*(float*)(this + 1000) = value;
*(float*)(this + 1004) = value;
*(float*)(this + 1008) = value;
*(float*)((int64)this + 1000) = value;
*(float*)((int64)this + 1004) = value;
*(float*)((int64)this + 1008) = value;
}

void PlayerInfo::RefreshMeter(bool value)
{
((void(__fastcall*)(PlayerInfo*, bool))_addr(0x140602930))(this,value);
}

float PlayerInfo::GetMeter(eMeterValues type)
{
int64 meter_ptr = ((int64)this + 16 * (type + 24));
return *(float*)(meter_ptr + 4);
}

HitCounter PlayerInfo::GetHits()
{
return *(HitCounter*)((int64)this + 0x430);
}
43 changes: 43 additions & 0 deletions MK11Hook/code/PlayerInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,51 @@ enum eMeterValues {
BAR_Defensive
};

enum eButton : int {
BUTTON_UP = 1,
BUTTON_DOWN = 2,
BUTTON_LEFT = 4,
BUTTON_RIGHT = 8,
BUTTON_BP = 16,
BUTTON_FK = 32,
BUTTON_FP = 64,
BUTTON_BK = 128,
BUTTON_UNK = 256,
BUTTON_RESET = 512,
BUTTON_ASSIST = 2048,
BUTTON_THROW = 4096,
BUTTON_INTERACT = 8192,
BUTTON_FLIP_STANCE = 16384,
BUTTON_BLOCK = 32768
};

struct ButtonInfo {
eButton id;
int pad[3];
};


struct HitCounter {
int hits;
int airHits;
int combo;
};

struct Gamepad {
char pad[0x1C];
ButtonInfo buttons;
ButtonInfo oldButtons;
};

class PlayerInfo {
public:
char _pad[48];
Gamepad* pad;

void SetMeter(eMeterValues type, float value);
void SetDamageMult(float value);
void RefreshMeter(bool value);
float GetMeter(eMeterValues type);

HitCounter GetHits();
};
6 changes: 6 additions & 0 deletions MK11Hook/code/VMProc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "VMProc.h"

unsigned int VMProc::GetCurrentFunction()
{
return *(unsigned int*)(this + 360);
}
6 changes: 6 additions & 0 deletions MK11Hook/code/VMProc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

class VMProc {
public:
unsigned int GetCurrentFunction();
};
Loading

0 comments on commit c73fc24

Please sign in to comment.