Skip to content

Commit

Permalink
abilities update, menu scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
ermaccer committed Nov 13, 2021
1 parent 8d8ae62 commit ad8e57c
Show file tree
Hide file tree
Showing 19 changed files with 551 additions and 19 deletions.
Binary file modified I2Hook/I2Hook.rc
Binary file not shown.
13 changes: 9 additions & 4 deletions I2Hook/I2Hook.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
Expand Down Expand Up @@ -59,6 +59,7 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<TargetExt>.asi</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
Expand All @@ -72,13 +73,14 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;I2HOOK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;I2HOOK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>false</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpplatest</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down Expand Up @@ -140,6 +142,7 @@
<ClInclude Include="code\mk10utils.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" />
Expand Down Expand Up @@ -174,8 +177,10 @@
<ClCompile Include="code\mk10utils.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="font.h" />
<ClCompile Include="imgui\imgui.cpp" />
<ClCompile Include="imgui\imgui_demo.cpp" />
<ClCompile Include="imgui\imgui_draw.cpp" />
Expand Down
9 changes: 9 additions & 0 deletions I2Hook/I2Hook.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<ClInclude Include="code\eGamepadManager.h">
<Filter>Header Files\code</Filter>
</ClInclude>
<ClInclude Include="code\MKModifier.h">
<Filter>Header Files\code</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
Expand Down Expand Up @@ -203,6 +206,12 @@
<ClCompile Include="code\eGamepadManager.cpp">
<Filter>Header Files\code</Filter>
</ClCompile>
<ClCompile Include="code\MKModifier.cpp">
<Filter>Header Files\code</Filter>
</ClCompile>
<ClCompile Include="font.h">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="utils\LICENSE">
Expand Down
4 changes: 2 additions & 2 deletions I2Hook/IniReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ CIniReader::CIniReader(char* szFileName)
strcat(dllPath, szFileName);
}

memset(m_szFileName, 0x00, 255);
memcpy(m_szFileName, dllPath, strlen(dllPath));
memset(m_szFileName, 0x00, 255);
memcpy(m_szFileName, dllPath, strlen(dllPath));
}
int CIniReader::ReadInteger(char* szSection, char* szKey, int iDefaultValue)
{
Expand Down
17 changes: 16 additions & 1 deletion I2Hook/code/MKCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,19 @@ void MKCharacter::SetScale(FVector * scale)
void MKCharacter::SetSpeed(float speed)
{
((void(__fastcall*)(MKCharacter*, float))_addr(0x14096E0C0))(this, speed);
}
}

void MKCharacter::SetAbility(unsigned int id)
{
*(int*)(this + 99068) = id;
}

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

void MKCharacter::ClearAbility()
{
*(int*)(this + 99068) = 0;
}
6 changes: 6 additions & 0 deletions I2Hook/code/MKCharacter.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@ class MKCharacter {
void SetLife(float life);
void SetScale(FVector* scale);
void SetSpeed(float speed);
void SetAbility(unsigned int id);

int GetAbility();

void ClearAbility();

};

27 changes: 27 additions & 0 deletions I2Hook/code/MKModifier.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "MKModifier.h"
#include "mk10utils.h"

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

void TagAssistModifier::Activate(int64 info)
{
((void(__fastcall*)(BaseModifier*, int64))_addr(0x140B3E1A0))(this, info);
}

TagAssistModifierObject * TagAssistModifier::CreateObject()
{
return nullptr;
}

void MKModifier::ActivateModifier(BaseModifier * modifier, MKCharacter * obj)
{
((void(__fastcall*)(MKModifier*, BaseModifier*, MKCharacter*))_addr(0x140B85BD0))(this, modifier, obj);
}

void TagAssistModifierObject::Activate(MKCharacter* obj)
{
//((void(__fastcall*)(TagAssistModifierObject*, MKCharacter*))_addr(0x1405581D0))(this, obj);
}
31 changes: 31 additions & 0 deletions I2Hook/code/MKModifier.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#pragma once
#include "MKCharacter.h"
#include "mk10utils.h"

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

class TagAssistModifierObject {
public:
void Activate(MKCharacter* obj);
};

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




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



41 changes: 40 additions & 1 deletion I2Hook/code/dcf2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#include <Windows.h>
#include "mkcamera.h"
#include "MKCharacter.h"

#include <math.h>
#include "MKModifier.h"
int64 hud_property = 0;

void __fastcall Hooks::HookProcessStuff()
Expand All @@ -28,6 +29,19 @@ void __fastcall Hooks::HookProcessStuff()
SetCharacterMeter(GetInfo(PLAYER1), 1.0f);
if (TheMenu->m_bZeroMeterP1)
SetCharacterMeter(GetInfo(PLAYER1), 0.0f);

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 @@ -43,6 +57,19 @@ void __fastcall Hooks::HookProcessStuff()
SetCharacterMeter(GetInfo(PLAYER2), 1.0f);
if (TheMenu->m_bZeroMeterP2)
SetCharacterMeter(GetInfo(PLAYER2), 0.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 @@ -227,6 +254,18 @@ void SlowGameTimeForXTicks(float speed, int ticks)
((void(__fastcall*)(float, int, int))_addr(0x1409C4630))(speed, ticks, 0);
}

void SetTagAssist(PLAYER_NUM plr, char * character)
{
((void(__fastcall*)(int64, char*))_addr(0x140B70E50))(GetInfo(plr), character);

}

void LoadModifierAssets()
{
int64 gameinfo = *(__int64*)_addr(GFG_GAME_INFO);
((void(__fastcall*)(int64, bool))_addr(0x1405A0C30))(gameinfo, 1);
}

void SetCharacterLife(int64 obj, float life)
{
((void(__fastcall*)(int64, float))_addr(0x1409725D0))(obj, life);
Expand Down
7 changes: 6 additions & 1 deletion I2Hook/code/dcf2.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#define GFG_GAME_INFO 0x14417DF30

#define I2HOOK_VERSION "0.4.1"
#define I2HOOK_VERSION "0.4.2"


MKCharacter* GetObj(PLAYER_NUM plr);
Expand All @@ -22,6 +22,11 @@ void GetCharacterPosition(FVector* vec,PLAYER_NUM plr);

void SlowGameTimeForXTicks(float speed, int ticks);

void SetTagAssist(PLAYER_NUM plr, char* character);


void LoadModifierAssets();



namespace Hooks {
Expand Down
Loading

0 comments on commit ad8e57c

Please sign in to comment.