Skip to content

Commit

Permalink
hotkeys, key configurator
Browse files Browse the repository at this point in the history
  • Loading branch information
ermaccer committed Feb 7, 2022
1 parent 51f1aa9 commit ae6089d
Show file tree
Hide file tree
Showing 17 changed files with 1,095 additions and 755 deletions.
Binary file modified MK11Hook/MK11Hook.rc
Binary file not shown.
6 changes: 4 additions & 2 deletions MK11Hook/MK11Hook.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@
<ClInclude Include="code\eSettingsManager.h" />
<ClInclude Include="code\eGamepadManager.h" />
<ClInclude Include="code\helper\eAbilityNames.h" />
<ClInclude Include="code\helper\eKeyboardMan.h" />
<ClInclude Include="code\mk10utils.h" />
<ClInclude Include="code\mk11.h" />
<ClInclude Include="code\mk11menu.h" />
<ClInclude Include="code\mkcamera.h" />
<ClInclude Include="code\MKCamera.h" />
<ClInclude Include="code\MKCharacter.h" />
<ClInclude Include="code\MKInventory.h" />
<ClInclude Include="code\MKModifier.h" />
Expand Down Expand Up @@ -142,10 +143,11 @@
<ClCompile Include="code\eNotifManager.cpp" />
<ClCompile Include="code\eSettingsManager.cpp" />
<ClCompile Include="code\helper\eAbilityNames.cpp" />
<ClCompile Include="code\helper\eKeyboardMan.cpp" />
<ClCompile Include="code\mk10utils.cpp" />
<ClCompile Include="code\mk11.cpp" />
<ClCompile Include="code\mk11menu.cpp" />
<ClCompile Include="code\mkcamera.cpp" />
<ClCompile Include="code\MKCamera.cpp" />
<ClCompile Include="code\MKCharacter.cpp" />
<ClCompile Include="code\MKInventory.cpp" />
<ClCompile Include="code\MKModifier.cpp" />
Expand Down
18 changes: 12 additions & 6 deletions MK11Hook/MK11Hook.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@
<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>
Expand Down Expand Up @@ -159,6 +156,12 @@
<ClInclude Include="code\unreal\FName.h">
<Filter>Header Files\code\unreal</Filter>
</ClInclude>
<ClInclude Include="code\helper\eKeyboardMan.h">
<Filter>Header Files\code\helper</Filter>
</ClInclude>
<ClInclude Include="code\MKCamera.h">
<Filter>Header Files\code</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
Expand Down Expand Up @@ -224,9 +227,6 @@
<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>
Expand All @@ -251,6 +251,12 @@
<ClCompile Include="code\MKInventory.cpp">
<Filter>Header Files\code</Filter>
</ClCompile>
<ClCompile Include="code\helper\eKeyboardMan.cpp">
<Filter>Header Files\code\helper</Filter>
</ClCompile>
<ClCompile Include="code\MKCamera.cpp">
<Filter>Header Files\code</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MK11Hook.rc">
Expand Down
1 change: 0 additions & 1 deletion MK11Hook/code/MKCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ FVector MKCharacter::GetScale()
void MKCharacter::SetAbility(unsigned int id)
{
*(int*)(this + 64304) = id;
//((void(__fastcall*)(MKCharacter*, unsigned int))_addr(0x1404C3340))(this, id);
}

void MKCharacter::ClearAbilities()
Expand Down
2 changes: 0 additions & 2 deletions MK11Hook/code/eNotifManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ void eNotificationManager::UpdateAlpha()
if (eDirectX11Hook::ms_bInit)
delta = 1.0f / ImGui::GetIO().Framerate;


float alphaSpeed = 0.8f;

m_fNotifAlpha = max(m_fNotifAlpha - delta * alphaSpeed, 0.0f);


if (m_fNotifAlpha <= 0)
m_bIsNotificationActive = false;

Expand Down
119 changes: 99 additions & 20 deletions MK11Hook/code/eSettingsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,125 @@ eSettingsManager* SettingsMgr = new eSettingsManager;
void eSettingsManager::Init()
{
CIniReader ini("");
bEnableConsoleWindow = ini.ReadBoolean("Settings", "bEnableConsoleWindow", true);
CIniReader user("mk11hook_user.ini");


iHookMenuOpenKey = ini.ReadInteger("Settings", "iHookMenuOpenKey", VK_F1);
bEnableGamepadSupport = ini.ReadBoolean("Settings", "bEnableGamepadSupport", true);
bUseLegacyCharacterModifier = ini.ReadBoolean("Settings", "bUseLegacyCharacterModifier", false);
bMakeAllAbilities1Slot = ini.ReadBoolean("Settings", "bMakeAllAbilities1Slot", false);
iFreeCameraKeyXPlus = ini.ReadInteger("Settings", "iFreeCameraKeyXPlus", 0);
iFreeCameraKeyXMinus = ini.ReadInteger("Settings", "iFreeCameraKeyXMinus", 0);
// user first
iToggleCustomCamKey = user.ReadInteger("Settings", "iToggleCustomCamKey", 0);

iHookMenuOpenKey = user.ReadInteger("Settings", "iHookMenuOpenKey", 0xFF);

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

iFreeCameraKeyYPlus = ini.ReadInteger("Settings", "iFreeCameraKeyYPlus", 0);
iFreeCameraKeyYMinus = ini.ReadInteger("Settings", "iFreeCameraKeyYMinus", 0);

iFreeCameraKeyZPlus = ini.ReadInteger("Settings", "iFreeCameraKeyZPlus", 0);
iFreeCameraKeyZMinus = ini.ReadInteger("Settings", "iFreeCameraKeyZMinus", 0);
iToggleFreezeWorldKey = user.ReadInteger("Settings", "iToggleFreezeWorldKey", 0xFF);
if (iToggleFreezeWorldKey == 0xFF)
iToggleFreezeWorldKey = VK_F2;

iToggleSlowMoKey = user.ReadInteger("Settings", "iToggleSlowMoKey", 0xFF);
if (iToggleSlowMoKey == 0xFF)
iToggleSlowMoKey = VK_F5;

iFreeCameraKeyYawPlus = ini.ReadInteger("Settings", "iFreeCameraKeyYawPlus", 0);
iFreeCameraKeyYawMinus = ini.ReadInteger("Settings", "iFreeCameraKeyYawMinus", 0);
iResetStageInteractablesKey = user.ReadInteger("Settings", "iResetStageInteractablesKey", 0xFF);
if (iResetStageInteractablesKey == 0xFF)
iResetStageInteractablesKey = 0xFF;

iFreeCameraKeyRollPlus = ini.ReadInteger("Settings", "iFreeCameraKeyRollPlus", 0);
iFreeCameraKeyRollMinus = ini.ReadInteger("Settings", "iFreeCameraKeyRollMinus", 0);
iFreeCameraKeyFOVPlus = user.ReadInteger("Settings", "iFreeCameraKeyFOVPlus", 0xFF);
if (iFreeCameraKeyFOVPlus == 0xFF)
iFreeCameraKeyFOVPlus = ini.ReadInteger("Settings", "iFreeCameraKeyFOVPlus", 0);

iFreeCameraKeyPitchPlus = ini.ReadInteger("Settings", "iFreeCameraKeyPitchPlus", 0);
iFreeCameraKeyPitchMinus = ini.ReadInteger("Settings", "iFreeCameraKeyPitchMinus", 0);
iFreeCameraKeyFOVMinus = user.ReadInteger("Settings", "iFreeCameraKeyFOVMinus", 0xFF);
if (iFreeCameraKeyFOVMinus == 0xFF)
iFreeCameraKeyFOVMinus = ini.ReadInteger("Settings", "iFreeCameraKeyFOVMinus", 0);

iFreeCameraKeyXPlus = user.ReadInteger("Settings", "iFreeCameraKeyXPlus", 0xFF);
if (iFreeCameraKeyXPlus == 0xFF)
iFreeCameraKeyXPlus = ini.ReadInteger("Settings", "iFreeCameraKeyXPlus", 0);

iFreeCameraKeyXMinus = user.ReadInteger("Settings", "iFreeCameraKeyXMinus", 0xFF);
if (iFreeCameraKeyXMinus == 0xFF)
iFreeCameraKeyXMinus = ini.ReadInteger("Settings", "iFreeCameraKeyXMinus", 0);


iFreeCameraKeyYPlus = user.ReadInteger("Settings", "iFreeCameraKeyYPlus", 0xFF);
if (iFreeCameraKeyYPlus == 0xFF)
iFreeCameraKeyYPlus = ini.ReadInteger("Settings", "iFreeCameraKeyYPlus", 0);

iFreeCameraKeyYMinus = user.ReadInteger("Settings", "iFreeCameraKeyYMinus", 0xFF);
if (iFreeCameraKeyYMinus == 0xFF)
iFreeCameraKeyYMinus = ini.ReadInteger("Settings", "iFreeCameraKeyYMinus", 0);

iFreeCameraKeyZPlus = user.ReadInteger("Settings", "iFreeCameraKeyZPlus", 0xFF);
if (iFreeCameraKeyZPlus == 0xFF)
iFreeCameraKeyZPlus = ini.ReadInteger("Settings", "iFreeCameraKeyZPlus", 0);

iFreeCameraKeyZMinus = user.ReadInteger("Settings", "iFreeCameraKeyZMinus", 0xFF);
if (iFreeCameraKeyZMinus == 0xFF)
iFreeCameraKeyZMinus = ini.ReadInteger("Settings", "iFreeCameraKeyZMinus", 0);

iFreeCameraKeyYawPlus = user.ReadInteger("Settings", "iFreeCameraKeyYawPlus", 0xFF);
if (iFreeCameraKeyYawPlus == 0xFF)
iFreeCameraKeyYawPlus = ini.ReadInteger("Settings", "iFreeCameraKeyYawPlus", 0);

iFreeCameraKeyYawMinus = user.ReadInteger("Settings", "iFreeCameraKeyYawMinus", 0xFF);
if (iFreeCameraKeyYawMinus == 0xFF)
iFreeCameraKeyYawMinus = ini.ReadInteger("Settings", "iFreeCameraKeyYawMinus", 0);

iFreeCameraKeyRollPlus = user.ReadInteger("Settings", "iFreeCameraKeyRollPlus", 0xFF);
if (iFreeCameraKeyRollPlus == 0xFF)
iFreeCameraKeyRollPlus = ini.ReadInteger("Settings", "iFreeCameraKeyRollPlus", 0);

iFreeCameraKeyRollMinus = user.ReadInteger("Settings", "iFreeCameraKeyRollMinus", 0xFF);
if (iFreeCameraKeyRollMinus == 0xFF)
iFreeCameraKeyRollMinus = ini.ReadInteger("Settings", "iFreeCameraKeyRollMinus", 0);


iFreeCameraKeyPitchPlus = user.ReadInteger("Settings", "iFreeCameraKeyPitchPlus", 0xFF);
if (iFreeCameraKeyPitchPlus == 0xFF)
iFreeCameraKeyPitchPlus = ini.ReadInteger("Settings", "iFreeCameraKeyPitchPlus", 0);

iFreeCameraKeyPitchMinus = user.ReadInteger("Settings", "iFreeCameraKeyPitchMinus", 0xFF);
if (iFreeCameraKeyPitchMinus == 0xFF)
iFreeCameraKeyPitchMinus = ini.ReadInteger("Settings", "iFreeCameraKeyPitchMinus", 0);

iFreeCameraKeyFOVPlus = ini.ReadInteger("Settings", "iFreeCameraKeyFOVPlus", 0);
iFreeCameraKeyFOVMinus = ini.ReadInteger("Settings", "iFreeCameraKeyFOVMinus", 0);
CIniReader user("mk11hook_user.ini");
fMenuScale = user.ReadFloat("MenuSettings", "fMenuScale", 1.0f);

if (fMenuScale < 1.0f)
fMenuScale = 1.0f;

bEnableConsoleWindow = ini.ReadBoolean("Settings", "bEnableConsoleWindow", true);
bEnableGamepadSupport = ini.ReadBoolean("Settings", "bEnableGamepadSupport", true);
bUseLegacyCharacterModifier = ini.ReadBoolean("Settings", "bUseLegacyCharacterModifier", false);
bMakeAllAbilities1Slot = ini.ReadBoolean("Settings", "bMakeAllAbilities1Slot", false);

}



void eSettingsManager::SaveSettings()
{
CIniReader user("mk11hook_user.ini");
user.WriteFloat("MenuSettings", "fMenuScale", fMenuScale);

user.WriteInteger("Settings", "iHookMenuOpenKey", iHookMenuOpenKey);
user.WriteInteger("Settings", "iToggleFreezeWorldKey", iToggleFreezeWorldKey);
user.WriteInteger("Settings", "iToggleCustomCamKey", iToggleCustomCamKey);
user.WriteInteger("Settings", "iFreeCameraKeyXMinus", iFreeCameraKeyXMinus);
user.WriteInteger("Settings", "iFreeCameraKeyYPlus", iFreeCameraKeyYPlus);
user.WriteInteger("Settings", "iFreeCameraKeyYMinus", iFreeCameraKeyYMinus);
user.WriteInteger("Settings", "iFreeCameraKeyZPlus", iFreeCameraKeyZPlus);
user.WriteInteger("Settings", "iFreeCameraKeyZMinus", iFreeCameraKeyZMinus);
user.WriteInteger("Settings", "iFreeCameraKeyYawPlus", iFreeCameraKeyYawPlus);
user.WriteInteger("Settings", "iFreeCameraKeyYawMinus", iFreeCameraKeyYawMinus);
user.WriteInteger("Settings", "iFreeCameraKeyRollPlus", iFreeCameraKeyRollPlus);
user.WriteInteger("Settings", "iFreeCameraKeyRollMinus", iFreeCameraKeyRollMinus);
user.WriteInteger("Settings", "iFreeCameraKeyPitchPlus", iFreeCameraKeyPitchPlus);
user.WriteInteger("Settings", "iFreeCameraKeyPitchMinus", iFreeCameraKeyPitchMinus);
user.WriteInteger("Settings", "iFreeCameraKeyFOVPlus", iFreeCameraKeyFOVPlus);
user.WriteInteger("Settings", "iFreeCameraKeyFOVMinus", iFreeCameraKeyFOVMinus);
user.WriteInteger("Settings", "iResetStageInteractablesKey", iResetStageInteractablesKey);

CIniReader ini("");
ini.WriteBoolean("Settings", "bEnableGamepadSupport", bEnableGamepadSupport);
ini.WriteBoolean("Settings", "bEnableConsoleWindow", bEnableConsoleWindow);
Expand Down
16 changes: 14 additions & 2 deletions MK11Hook/code/eSettingsManager.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include <Windows.h>

// as usual, pluginmh/mugenhook

Expand All @@ -7,12 +8,18 @@ class eSettingsManager {
void Init();

bool bEnableConsoleWindow;
int iHookMenuOpenKey;


bool bUseLegacyCharacterModifier;
bool bMakeAllAbilities1Slot;

bool bEnableGamepadSupport;
// generic
int iHookMenuOpenKey;
int iToggleCustomCamKey;
int iToggleSlowMoKey = VK_F5;
int iToggleFreezeWorldKey = VK_F2;
int iResetStageInteractablesKey;
// free camera keys
int iFreeCameraKeyXPlus;
int iFreeCameraKeyXMinus;
Expand All @@ -21,12 +28,17 @@ class eSettingsManager {
int iFreeCameraKeyZPlus;
int iFreeCameraKeyZMinus;


int iFreeCameraKeyYawPlus;
int iFreeCameraKeyYawMinus;

int iFreeCameraKeyPitchPlus;
int iFreeCameraKeyPitchMinus;
int iFreeCameraKeyRollPlus;

int iFreeCameraKeyRollMinus;
int iFreeCameraKeyRollPlus;



int iFreeCameraKeyFOVPlus;
int iFreeCameraKeyFOVMinus;
Expand Down
12 changes: 7 additions & 5 deletions MK11Hook/code/helper/eAbilityNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ void eAbiltityNames::Init()
ent.abNames[6] = "Lightning Storm";
ent.abNames[7] = "Electric Current";
ent.abNames[8] = "Lightning Rod";
ent.abNames[9] = "Sparkport";

m_aAbilityNames.push_back(ent);
ent = {};
Expand Down Expand Up @@ -565,11 +566,12 @@ void eAbiltityNames::Init()
ent.abNames[1] = "Ground Ice";
ent.abNames[2] = "Cold Shoulder";
ent.abNames[3] = "Rising Ice";
ent.abNames[4] = "Frigid Storm";
ent.abNames[5] = "Death-Cicle Barrage";
ent.abNames[6] = "Air Polar Axe";
ent.abNames[7] = "Arctic Trap";
ent.abNames[8] = "Deep Freeze";
ent.abNames[4] = "Unused";
ent.abNames[5] = "Frigid Storm";
ent.abNames[6] = "Death-Cicle Barrage";
ent.abNames[7] = "Air Polar Axe";
ent.abNames[8] = "Arctic Trap";
ent.abNames[9] = "Deep Freeze";

m_aAbilityNames.push_back(ent);
ent = {};
Expand Down
39 changes: 39 additions & 0 deletions MK11Hook/code/helper/eKeyboardMan.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include "eKeyboardMan.h"
#include <iostream>
#include <Windows.h>


eVKKeyCode eKeyboardMan::GetLastKey()
{
eVKKeyCode key = VK_KEY_NONE;
for (int i = 0; i < VK_KEY_MAX; i++)
{
if (GetAsyncKeyState(i) & 0x8000)
{
key = (eVKKeyCode)i;
break;
}
}
return key;
}

const char * eKeyboardMan::KeyToString(int code)
{
static char buff[128] = {};
UINT key = MapVirtualKey(code, MAPVK_VK_TO_VSC);

int result = GetKeyNameTextA((key << 16), buff, sizeof(buff));

if (code == VK_UP)
return "Up";
else if (code == VK_DOWN)
return "Down";
else if (code == VK_LEFT)
return "Left";
else if (code == VK_RIGHT)
return "Right";
else if (result)
return buff;
else
return "Unknown";
}
Loading

0 comments on commit ae6089d

Please sign in to comment.