Skip to content

Commit

Permalink
Added invisibility, lost the sword. Fixed required debug msvc140d.dll
Browse files Browse the repository at this point in the history
  • Loading branch information
Baromir19 committed Apr 18, 2023
1 parent bfc7d07 commit 4b58af5
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 51 deletions.
3 changes: 2 additions & 1 deletion MGR RedTrainer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
Expand Down Expand Up @@ -203,6 +203,7 @@
</ClCompile>
<ClCompile Include="include\libmem\libmem.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\base.cpp" />
<ClCompile Include="src\hooks\EndScene.cpp" />
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/EndScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ HRESULT __stdcall Base::Hooks::EndScene(LPDIRECT3DDEVICE9 pDevice)

if (Data::ShowMenu7)
{
RtGui::raidenFlagsWindow();
RtGui::testWindow();
}

if (Data::ShowMenu8)
Expand Down
91 changes: 91 additions & 0 deletions src/trainerFunctions/trainerFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ uintptr_t RedTrainer::moduleBase = 0;

int(*playAnimation)(unsigned int, int, int, int, int); ///playerPtr, animId, animType, aId2, aType2
int(*getItem)(unsigned int);
unsigned int(*setLessSword)(unsigned int, int);
int(*setSound)(int, int);
int(*setBgmFunc)(int);
int(*setMessagePrint)(unsigned int, int, unsigned int, int, int, int, int, int, int);

void RedTrainer::setText (bool bActive)
{
Expand Down Expand Up @@ -55,6 +58,30 @@ void RedTrainer::playSound(int soundPtr)
}
}

void RedTrainer::setBgm(int bgmPtr)
{
bgmPtr += moduleBase; //0x123CFD8 bgm sam
int bgmFuncAddr = moduleBase + 0xA5E1B0;
setBgmFunc = (int(__cdecl*)(int))bgmFuncAddr;

__asm {
push bgmPtr
call setBgmFunc
add esp, 4
}
}
void RedTrainer::setBgm(char bgmText[])
{
int bgmFuncAddr = moduleBase + 0xA5E1B0;
setBgmFunc = (int(__cdecl*)(int))bgmFuncAddr;

__asm {
push [bgmText]
call setBgmFunc
add esp, 4
}
}

///STATS

void RedTrainer::setInvincibility(bool &bInvincibility)
Expand Down Expand Up @@ -369,6 +396,22 @@ void RedTrainer::setPlayerHair(int playerHairId)
}
}

void RedTrainer::setInvisibility(bool &bInvisible)
{
uintptr_t invisibleAddress;
memcpy(&invisibleAddress, (BYTE*)(moduleBase + 0x19C1490), sizeof(invisibleAddress));
if (invisibleAddress == NULL)
{
playSound(0x12581AC);
return;
}
bInvisible = !bInvisible;
int invisibleVar = bInvisible;
playSound(0x1257100);
invisibleAddress = mem::in::find_DMA(moduleBase + 0x19C1490, { 0x18C });
mem::in::write((BYTE*)invisibleAddress, (BYTE*)&invisibleVar, sizeof(invisibleVar));
}

///MOVEMENT

void RedTrainer::setSpeed(float speedValue)
Expand Down Expand Up @@ -861,6 +904,31 @@ void RedTrainer::setPlayerAnimation(int animId, int animType, int animIdOld, int
}
}

void RedTrainer::setWithoutSword(bool &isActive)
{
int playerPtr = 0;
memcpy(&playerPtr, (BYTE*)(moduleBase + 0x19C1490), sizeof(playerPtr));

if (playerPtr == NULL)
{
playSound(0x12581AC);
return;
}

isActive = !isActive;

playSound(0x1257100);
int playerSwordType = 1;
int setLessSwordAddr = moduleBase + 0x77E210;
setLessSword = (unsigned int(*)(unsigned int, int))setLessSwordAddr;

__asm {
push playerSwordType
mov ecx, playerPtr
call setLessSword
}
}

///MISSION

void RedTrainer::setMission(short missionId, char missionName[])
Expand Down Expand Up @@ -1061,6 +1129,29 @@ void RedTrainer::setMenuType(char menuType)
mem::in::write((BYTE*)(moduleBase + 0x17E9F9C), (BYTE*)&menuType, sizeof(menuType));
}

void RedTrainer::printMessage(unsigned int messageId, int messageNum, int messagePrint, int messagePosition, char messageChar[])
{
int setPtrChkMsg = moduleBase + 0x19C3D08;
int setMsgFuncAddr = moduleBase + 0x8E2DB0;
playSound(0x1257100);
//mem::in::read((BYTE*)(moduleBase + 0x19C3D08), (BYTE*)&setPtrChkMsg, sizeof(setPtrChkMsg));

setMessagePrint = (int(*)(unsigned int, int, unsigned int, int, int, int, int, int, int))setMsgFuncAddr;

__asm {
push messagePosition
push 1
push 0
push 0
push messageNum
push messagePrint
push messageId
push 0
mov ecx, setPtrChkMsg
call setMessagePrint
}
}

///ENEMY

void RedTrainer::setAllEnemies(bool bEnemyActive, unsigned int enemyId, unsigned int enemyType, unsigned int enemySetType, unsigned int enemyFlag)
Expand Down
10 changes: 10 additions & 0 deletions src/trainerFunctions/trainerFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ namespace RedTrainer {

void playSound(int soundPtr);

void setBgm(int bgmPtr);

void setBgm(char bgmText[]);

///STATS

void setInvincibility(bool &Invincibility);
Expand Down Expand Up @@ -51,6 +55,8 @@ namespace RedTrainer {

void setPlayerHair(int playerHairId);

void setInvisibility(bool &bInvisible);

///MOVEMENT

void setSpeed(float speedValue);
Expand All @@ -59,6 +65,8 @@ namespace RedTrainer {

void setPlayerAnimation(int animId, int animType, int animIdOld, int animTypeOld, bool isSelectable);

void setWithoutSword(bool &isActive);

///MISSION

void setMission(short missionId, char missionName[]);
Expand Down Expand Up @@ -95,6 +103,8 @@ namespace RedTrainer {

void setMenuType(char menuType);

void printMessage(unsigned int messageId, int messageNum, int messagePrint, int messagePosition, char messageChar[]);

///ENEMY

void setAllEnemies(bool bEnemyActive, unsigned int enemyId = 0, unsigned int enemyType = 0, unsigned int enemySetType = 0, unsigned int enemyFlag = 0);
Expand Down
Loading

0 comments on commit 4b58af5

Please sign in to comment.