Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ermaccer committed Jul 10, 2021
1 parent 6a32c6d commit 08c2aa0
Show file tree
Hide file tree
Showing 25 changed files with 1,050 additions and 1,089 deletions.
Binary file modified MK11Hook/MK11Hook.rc
Binary file not shown.
9 changes: 9 additions & 0 deletions MK11Hook/MK11Hook.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@
<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\MKModifier.h" />
<ClInclude Include="code\MKStructs.h" />
<ClInclude Include="eDirectX11Hook.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="imgui\imconfig.h" />
<ClInclude Include="imgui\imgui.h" />
Expand Down Expand Up @@ -202,7 +207,11 @@
<ClCompile Include="code\mk10utils.cpp" />
<ClCompile Include="code\mk11.cpp" />
<ClCompile Include="code\mk11menu.cpp" />
<ClCompile Include="code\mkcamera.cpp" />
<ClCompile Include="code\MKCharacter.cpp" />
<ClCompile Include="code\MKModifier.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="eDirectX11Hook.cpp" />
<ClCompile Include="HookInit.cpp" />
<ClCompile Include="imgui\imgui.cpp" />
<ClCompile Include="imgui\imgui_demo.cpp" />
Expand Down
30 changes: 30 additions & 0 deletions MK11Hook/MK11Hook.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
<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>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
Expand Down Expand Up @@ -126,6 +129,21 @@
<ClInclude Include="code\eNotifManager.h">
<Filter>Header Files\code</Filter>
</ClInclude>
<ClInclude Include="code\mkcamera.h">
<Filter>Header Files\code</Filter>
</ClInclude>
<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>
<ClInclude Include="code\MKModifier.h">
<Filter>Header Files\code</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
Expand Down Expand Up @@ -194,6 +212,18 @@
<ClCompile Include="code\eNotifManager.cpp">
<Filter>Header Files\code</Filter>
</ClCompile>
<ClCompile Include="code\mkcamera.cpp">
<Filter>Header Files\code</Filter>
</ClCompile>
<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>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MK11Hook.rc">
Expand Down
63 changes: 63 additions & 0 deletions MK11Hook/code/MKCharacter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include "MKCharacter.h"
#include "mk10utils.h"
#include "mk11.h"
#include <iostream>
#include <Windows.h>

void MKCharacter::SetLife(float life)
{
((void(__fastcall*)(MKCharacter*, float))_addr(0x1404C8070))(this, life);
}

void MKCharacter::SetScale(FVector * scale)
{
((void(__fastcall*)(MKCharacter*, FVector*))_addr(0x141161920))(this, scale);
}

void MKCharacter::SetSpeed(float speed)
{
((void(__fastcall*)(MKCharacter*, float))_addr(0x1404C3D50))(this, speed);
}

void MKCharacter::SetMeter(eMeterValues meter, float value)
{
((void(__fastcall*)(MKCharacter*, eMeterValues, float))_addr(0x1405FA670))(this, meter, value);
}

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

void MKCharacter::SetItem(int64 ptr, char * slot)
{
((void(__fastcall*)(MKCharacter*, int64, char*))_addr(0x140818380))(this, ptr, slot);
}

CharacterInfo * MKCharacter::GetCharacterData(int unk)
{
CharacterInfo* inf = ((CharacterInfo*(__fastcall*)(MKCharacter*,int))_addr(0x140C0DE60))(this, unk);

printf("========\n");
printf("PTR: %x\n", inf);
printf("Character: %s\n", inf->Name);
printf("Class: %s\n", inf->CharacterClass);
printf("CAP: %s %d %d 2: %s %d %d\n", inf->CAPs->cap[0].Name, inf->CAPs->cap[0].unk1, inf->CAPs->cap[0].unk2,
inf->CAPs->cap[1].Name, inf->CAPs->cap[1].unk1, inf->CAPs->cap[1].unk2);
printf("Model: %s\n", inf->CAPPath);
printf("Asset: %s\n", inf->CharacterAssetPath);
printf("Script: %s\n", inf->ScriptName);
printf("ScriptAssets: %s\n", inf->CommonScriptAssets);
printf("Root: %s\n", inf->RootPath);
printf("============\n");


return inf;

}


bool MKCharacter::IsCrouching()
{
return ((bool(__fastcall*)(MKCharacter*))_addr(0x14047ADB0))(this);
}
58 changes: 58 additions & 0 deletions MK11Hook/code/MKCharacter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#pragma once
#include "MKStructs.h"
#include "mk10utils.h"
enum eMeterValues {
BAR_Offensive,
BAR_Defensive
};

struct CharacterCAP {
char* Name;
int unk1;
int unk2;
};

struct CharacterCAPData {
CharacterCAP cap[5];// dunno how many
};
struct CharacterInfo {
char* Name;
char pad[128];
char* CharacterClass;
char _pad[8];
char* AssetDefinition;
char __pad[40];
char* ScriptName;
char ___pad[8];
char* ScriptAssets;
char ____pad[24];
char* CommonScriptAssets;
char _____pad[8];
char* CharacterAssetPath;
char ______pad[24];
char* CAPPath;
char _______pad[8];
char* RootPath;
char ________pad[48];
CharacterCAPData* CAPs;
char _________pad[8];
char* Package;
char __________pad[8];
void* AudioTable;
};


// wrapper for old functions
class MKCharacter {
public:
void SetLife(float life);
void SetScale(FVector* scale);
void SetSpeed(float speed);
void SetMeter(eMeterValues meter, float value);
void SetEasyKrushingBlows(bool enable);
void SetItem(int64 ptr, char* slot);

CharacterInfo* GetCharacterData(int unk);

bool IsCrouching();
};
1 change: 1 addition & 0 deletions MK11Hook/code/MKInventoryManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#pragma once
18 changes: 18 additions & 0 deletions MK11Hook/code/MKModifier.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "MKModifier.h"
#include "mk10utils.h"

TagModifier::TagModifier(const char * character)
{
((void(__fastcall*)(BaseModifier*,const char*, int))_addr(0x1405457D0))(this, character, 0);
}

void TagModifier::Activate(int64 info)
{
//140558320
((void(__fastcall*)(BaseModifier*, int64))_addr(0x140558320))(this, info);
}

void MKModifier::ActivateModifier(BaseModifier * modifier, MKCharacter * obj)
{
((void(__fastcall*)(MKModifier*, BaseModifier*, MKCharacter*))_addr(0x140B85960))(this, modifier, obj);
}
23 changes: 23 additions & 0 deletions MK11Hook/code/MKModifier.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once
#include "MKCharacter.h"
#include "mk10utils.h"

class BaseModifier {
public:
char data[96] = {};
};

class TagModifier : public BaseModifier {
public:
TagModifier(const char* character);
void Activate(int64 info);
};


class MKModifier {
public:
void ActivateModifier(BaseModifier* modifier, MKCharacter* obj);
};



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

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

struct FRotator
{
int Pitch;
int Yaw;
int Roll;
};


struct FName {
//todo
};

struct FLinearColor
{
float R;
float G;
float B;
float A;
};


struct character_info {
char name[16];
};
1 change: 0 additions & 1 deletion MK11Hook/code/eSettingsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ void eSettingsManager::Init()
{
CIniReader ini("");
bEnableConsoleWindow = ini.ReadBoolean("Settings", "bEnableConsoleWindow", true);
bGlobalCameraHook = ini.ReadBoolean("Settings", "bGlobalCameraHook", true);

iHookMenuOpenKey = ini.ReadInteger("Settings", "iHookMenuOpenKey", VK_F1);

Expand Down
2 changes: 0 additions & 2 deletions MK11Hook/code/eSettingsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ class eSettingsManager {
void Init();

bool bEnableConsoleWindow;
bool bGlobalCameraHook;

int iHookMenuOpenKey;

bool bUseLegacyCharacterModifier;
Expand Down
2 changes: 1 addition & 1 deletion MK11Hook/code/mk10utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ int64 GetMKXEntryPoint()
return addr;
}

int64 _mk11addr(__int64 addr)
int64 _addr(__int64 addr)
{
return GetMKXEntryPoint() - 0x140000000 + addr;
}
34 changes: 1 addition & 33 deletions MK11Hook/code/mk10utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,4 @@ typedef __int64 int64;


int64 GetMKXEntryPoint();
int64 _mk11addr(__int64 addr);

// calling
template <unsigned int address, typename... Args>
static void Call(Args... args) {
reinterpret_cast<void(__cdecl *)(Args...)>(address)(args...);
}

template <typename Ret, unsigned int address, typename... Args>
static Ret CallAndReturn(Args... args) {
return reinterpret_cast<Ret(__cdecl *)(Args...)>(address)(args...);
}

template <unsigned int address, typename... Args>
static void STDCall(Args... args) {
reinterpret_cast<void(__stdcall *)(Args...)>(address)(args...);
}

template <typename Ret, unsigned int address, typename... Args>
static Ret STDCallAndReturn(Args... args) {
return reinterpret_cast<Ret(__stdcall *)(Args...)>(address)(args...);
}


template <unsigned int address, typename C, typename... Args>
static void CallMethod(C _this, Args... args) {
reinterpret_cast<void(__thiscall *)(C, Args...)>(address)(_this, args...);
}

template <typename Ret, unsigned int address, typename C, typename... Args>
static Ret CallMethodAndReturn(C _this, Args... args) {
return reinterpret_cast<Ret(__thiscall *)(C, Args...)>(address)(_this, args...);
}
int64 _addr(__int64 addr);
Loading

0 comments on commit 08c2aa0

Please sign in to comment.