Skip to content

Commit

Permalink
abilities update
Browse files Browse the repository at this point in the history
  • Loading branch information
ermaccer committed Oct 15, 2021
1 parent 9432d61 commit d8e2b3f
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 31 deletions.
Binary file modified MK11Hook/MK11Hook.rc
Binary file not shown.
16 changes: 16 additions & 0 deletions MK11Hook/code/MKCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@ void MKCharacter::SetEasyKrushingBlows(bool enable)
((void(__fastcall*)(MKCharacter*, int, int))_addr(0x1404C71E0))(this, enable, 1);
}

int MKCharacter::GetAbility()
{
return *(int*)(this + 64304);
}

void MKCharacter::SetAbility(unsigned int id)
{
*(int*)(this + 64304) = id;
//((void(__fastcall*)(MKCharacter*, unsigned int))_addr(0x1404C3340))(this, id);
}

void MKCharacter::ClearAbilities()
{
((void(__fastcall*)(MKCharacter*))_addr(0x14048D8A0))(this);
}

CharacterInfo * MKCharacter::GetCharacterData(int unk)
{
CharacterInfo* inf = ((CharacterInfo*(__fastcall*)(MKCharacter*,int))_addr(0x140C0E130))(this, unk);
Expand Down
5 changes: 5 additions & 0 deletions MK11Hook/code/MKCharacter.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ class MKCharacter {
void SetSpeed(float speed);
void SetEasyKrushingBlows(bool enable);

int GetAbility();
void SetAbility(unsigned int id);
void ClearAbilities();

CharacterInfo* GetCharacterData(int unk);

bool IsCrouching();
};


29 changes: 29 additions & 0 deletions MK11Hook/code/mk11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ void __fastcall MK11Hooks::HookProcessStuff()

if (TheMenu->m_bAutoHideHUD)
HideHUD();
if (TheMenu->m_bP1CustomAbilities)
{
TheMenu->m_nP1Abilities = 0;
for (int i = 0; i < sizeof(TheMenu->m_P1Abilities) / sizeof(TheMenu->m_P1Abilities[0]); i++)
{
if (TheMenu->m_P1Abilities[i])
{
TheMenu->m_nP1Abilities += pow(2, i);
}
}
GetObj(PLAYER1)->SetAbility(TheMenu->m_nP1Abilities);
}


}


Expand All @@ -82,6 +96,19 @@ void __fastcall MK11Hooks::HookProcessStuff()
if (GetInfo(PLAYER2))
SetCharacterEnergy(GetInfo(PLAYER2), BAR_Defensive, 1000.0f);
}

if (TheMenu->m_bP1CustomAbilities)
{
TheMenu->m_nP2Abilities = 0;
for (int i = 0; i < sizeof(TheMenu->m_P2Abilities) / sizeof(TheMenu->m_P2Abilities[0]); i++)
{
if (TheMenu->m_P2Abilities[i])
{
TheMenu->m_nP2Abilities += pow(2, i);
}
}
GetObj(PLAYER2)->SetAbility(TheMenu->m_nP2Abilities);
}
}


Expand Down Expand Up @@ -201,13 +228,15 @@ void __fastcall MK11Hooks::HookStartupFightRecording(int64 eventID, int64 a2, in




((void(__fastcall*)(int64, int64, int64, int64))_addr(0x141159CB0))(eventID, a2, a3, a4);

}

void MK11Hooks::PostLoadHook()
{


((int64(__fastcall*)())_addr(0x14090F7A0))();
}

Expand Down
2 changes: 1 addition & 1 deletion MK11Hook/code/mk11.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define GFG_GAME_INFO 0x1434990A0


#define MK11HOOK_VERSION "0.4.4"
#define MK11HOOK_VERSION "0.4.5"

enum PLAYER_NUM
{
Expand Down
147 changes: 117 additions & 30 deletions MK11Hook/code/mk11menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "..\utils\MemoryMgr.h"
#include "eNotifManager.h"
#include "MKCamera.h"
#include <math.h>


static int64 timer = GetTickCount64();
Expand Down Expand Up @@ -630,7 +631,6 @@ const char* szKryptCharacters[] = {
"CHAR_Sektor",
"CHAR_FireGod",
"CHAR_Kronika",

// rest of the cast
"CHAR_Baraka",
"CHAR_Cage",
Expand Down Expand Up @@ -748,10 +748,15 @@ void MK11Menu::Initialize()
m_bTagAssist = false;
m_bTagAssistP2 = false;
m_bSlowMotion = false;
m_bP1CustomAbilities = false;
m_bP2CustomAbilities = false;


m_nCurrentCharModifier = MODIFIER_SCREEN;
m_nFreeCameraRotationSpeed = 120;
m_nCurrentCustomCamera = -1;
m_nP1Abilities = 0;
m_nP2Abilities = 0;
mouseSpeedX = 0;
mouseSpeedY = 0;
mouseSens = 5;
Expand Down Expand Up @@ -885,43 +890,124 @@ void MK11Menu::Draw()
}
if (ImGui::BeginTabItem("Modifiers"))
{
ImGui::Checkbox("Player 1 Tag Assist Modifier", &m_bTagAssist);


if (ImGui::BeginCombo("Player 1 Tag Assist Character", szPlayer1TagAssistCharacter))
if (ImGui::BeginTabBar("##modifiers"))
{
for (int n = 0; n < IM_ARRAYSIZE(szKryptCharacters); n++)
if (ImGui::BeginTabItem("Tag Assists"))
{
bool is_selected = (szPlayer1TagAssistCharacter == szKryptCharacters[n]);
if (ImGui::Selectable(szKryptCharacters[n], is_selected))
sprintf(szPlayer1TagAssistCharacter, szKryptCharacters[n]);
if (is_selected)
ImGui::SetItemDefaultFocus();
ImGui::Checkbox("Player 1 Tag Assist Modifier", &m_bTagAssist);

}
ImGui::EndCombo();
}
ImGui::Separator();
ImGui::Checkbox("Player 2 Tag Assist Modifier", &m_bTagAssistP2);

if (ImGui::BeginCombo("Player 1 Tag Assist Character", szPlayer1TagAssistCharacter))
{
for (int n = 0; n < IM_ARRAYSIZE(szKryptCharacters); n++)
{
bool is_selected = (szPlayer1TagAssistCharacter == szKryptCharacters[n]);
if (ImGui::Selectable(szKryptCharacters[n], is_selected))
sprintf(szPlayer1TagAssistCharacter, szKryptCharacters[n]);
if (is_selected)
ImGui::SetItemDefaultFocus();

}
ImGui::EndCombo();
}
ImGui::Separator();
ImGui::Checkbox("Player 2 Tag Assist Modifier", &m_bTagAssistP2);

if (ImGui::BeginCombo("Player 2 Tag Assist Character", szPlayer2TagAssistCharacter))
{
for (int n = 0; n < IM_ARRAYSIZE(szKryptCharacters); n++)

if (ImGui::BeginCombo("Player 2 Tag Assist Character", szPlayer2TagAssistCharacter))
{
for (int n = 0; n < IM_ARRAYSIZE(szKryptCharacters); n++)
{
bool is_selected = (szPlayer2TagAssistCharacter == szKryptCharacters[n]);
if (ImGui::Selectable(szKryptCharacters[n], is_selected))
sprintf(szPlayer2TagAssistCharacter, szKryptCharacters[n]);
if (is_selected)
ImGui::SetItemDefaultFocus();

}
ImGui::EndCombo();
}
ImGui::Separator();

ImGui::Text("NOTE: Scorpion will not work unless previously loaded (eg. P2).\nIf you get load crashes enable modifier in-game then restart or rematch (when online).");
ImGui::Text("Restart match when you toggle these in game!");
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Abilities"))
{
bool is_selected = (szPlayer2TagAssistCharacter == szKryptCharacters[n]);
if (ImGui::Selectable(szKryptCharacters[n], is_selected))
sprintf(szPlayer2TagAssistCharacter, szKryptCharacters[n]);
if (is_selected)
ImGui::SetItemDefaultFocus();

ImGui::Checkbox("Player 1 Custom Abilities", &m_bP1CustomAbilities);
ImGui::SameLine(); ShowHelpMarker("Set these on select screen! Changing these in game might make moves locked. Hold L SHIFT to view numeric value.");
ImGui::Separator();

for (int i = 0; i < sizeof(m_P1Abilities) / sizeof(m_P1Abilities[0]); i++)
{
int val = pow(2, i);
if (GetAsyncKeyState(VK_LSHIFT))
sprintf(textBuffer, "Ability %d (%d)", i + 1, val);
else
sprintf(textBuffer, "Ability %d", i + 1);

ImGui::Checkbox(textBuffer, &m_P1Abilities[i]);

if (i % 2 == 0)
ImGui::SameLine();
}


if (GetObj(PLAYER1))
{
if (ImGui::Button("Get##p1"))
{
int abilities = GetObj(PLAYER1)->GetAbility();

for (int i = 0; i < sizeof(m_P1Abilities) / sizeof(m_P1Abilities[0]); i++)
{
int id = pow(2, i);
m_P1Abilities[i] = abilities & id;
}
}

}
ImGui::Separator();
ImGui::Checkbox("Player 2 Custom Abilities", &m_bP2CustomAbilities);
ImGui::Separator();

for (int i = 0; i < sizeof(m_P2Abilities) / sizeof(m_P2Abilities[0]); i++)
{
int val = pow(2, i);
if (GetAsyncKeyState(VK_LSHIFT))
sprintf(textBuffer, "Ability %d (%d)##p2", i + 1, val);
else
sprintf(textBuffer, "Ability %d##p2", i + 1);

ImGui::Checkbox(textBuffer, &m_P2Abilities[i]);

if (i % 2 == 0)
ImGui::SameLine();
}


if (GetObj(PLAYER2))
{
if (ImGui::Button("Get##p2"))
{
int abilities = GetObj(PLAYER2)->GetAbility();

for (int i = 0; i < sizeof(m_P2Abilities) / sizeof(m_P2Abilities[0]); i++)
{
int id = pow(2, i);
m_P2Abilities[i] = abilities & id;
}
}

}

ImGui::EndTabItem();
}
ImGui::EndCombo();
}
ImGui::Separator();

ImGui::Text("NOTE: Scorpion will not work unless previously loaded (eg. P2).\nIf you get load crashes enable modifier in-game then restart or rematch (when online).");
ImGui::Text("Restart match when you toggle these in game!");
ImGui::EndTabBar();
}
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Player Control"))
Expand Down Expand Up @@ -1212,8 +1298,9 @@ void MK11Menu::Draw()
ImGui::SameLine();
ShowHelpMarker("Only default loadouts will be used. Do not toggle this option when models are on screen.");
ImGui::EndTabItem();
}

}
ImGui::EndTabBar();
ImGui::End();
}

Expand Down
6 changes: 6 additions & 0 deletions MK11Hook/code/mk11menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ class MK11Menu {
int m_nFreeCameraRotationSpeed;
int m_nCurrentCustomCamera;
int m_nCurrentCharModifier;
int m_nP1Abilities;
int m_nP2Abilities;

bool m_bP1CustomAbilities;
bool m_P1Abilities[20] = {};
bool m_bP2CustomAbilities;
bool m_P2Abilities[20] = {};

FVector m_vP1Scale;
FVector m_vP2Scale;
Expand Down

0 comments on commit d8e2b3f

Please sign in to comment.