kingadent
05-02-2013, 10:16 PM
I quit trainers, got boring, only did it to learn stuff anyway.
Here's my first cave's source, it's for Kingdoms of Amalur, right now it's just OneHitKill and InfHealth, both work perfect though.
I'm using a different engine, as you can see, you get the concept though.
#include "common.h"
bool OneHitKo = false;
bool HooksSet = false;
bool InfHealth = false;
VOID __declspec(naked) CheckHP(VOID)
{
DWORD Ptr1;
__asm
{
mr Ptr1,r6
}
__asm{
}
DWORD Ptr2;
__asm
{
mr Ptr2,r9
}
if( InfHealth == TRUE && Ptr1 != 0x00)
{
int XValue = 999;
__asm
{
stw XValue,48h(r31)
}
}else{
if( InfHealth == FALSE )
{
__asm{
stw r11,48h(r31)
}
}
}
if( OneHitKo == TRUE && Ptr2 == 0x0000000000B60B60 )
{
int ZValue = 0;
__asm
{
stw ZValue,48h(r31)
}
}else{
if( OneHitKo == FALSE )
{
__asm{
stw r11,48h(r31)
}
}
}
__asm{
lis r11,0x8253
ori r11,r11,0x0E64
mtctr r11
bctr
}
}
VOID SetHooks()
{
DWORD IHealth[4];
patchInJump( (PDWORD)IHealth, (DWORD)CheckHP, FALSE );
DoCave(0x82530E4C, &IHealth[0], 4);
DoCave(0x82530E50, &IHealth[1], 4);
DoCave(0x82530E54, &IHealth[2], 4);
DoCave(0x82530E58, &IHealth[3], 4);
HooksSet = true;
}
VOID ShowTrainerMain()
{
Prompt = XShowMessageBoxUI(0, L"Kingdoms of Amalur", L"View Codes: DPAD-DOWN(x4)\r\nCreated by Kingadent\r\n", ARRAYSIZE(g_strButtons), g_strButtons, 0, XMB_PASSCODEMODE, &g_mb_result, &g_xol);
if( HooksSet == false )
{
SetHooks();
}
}
VOID TrainerLoaded()
{
Prompt = XShowMessageBoxUI(0, L"Kingdoms of Amalur", L"Trainer Loaded!\r\nYou may now start your game\r\n", ARRAYSIZE(g_strButtons), g_strButtons, 0, XMB_NOICON, &g_mb_result, &g_xol);
}
VOID ProcessButtonPress( MESSAGEBOX_RESULT g_mb_result )
{
if( g_mb_result.rgwPasscode[0] == DPAD_DOWN && g_mb_result.rgwPasscode[1] == DPAD_DOWN && g_mb_result.rgwPasscode[2] == DPAD_DOWN && g_mb_result.rgwPasscode[3] == DPAD_DOWN )
{
Sleep(500);
XShowMessageBoxUI(0, L"Viewing All Codes", L"Inf Health Y(x4)\r\nEasy Kills DPAD-UP(x4)", ARRAYSIZE(g_strButtons), g_strButtons, 0, XMB_NOICON, &g_mb_result, &g_xol);
memset( &g_mb_result.rgwPasscode[0], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[1], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[2], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[3], 0x00, 0x02 );
Prompt = 0x9999;
}
if( g_mb_result.rgwPasscode[0] == Y_BUTTON && g_mb_result.rgwPasscode[1] == Y_BUTTON && g_mb_result.rgwPasscode[2] == Y_BUTTON && g_mb_result.rgwPasscode[3] == Y_BUTTON )
{
Sleep(500);
if( InfHealth == TRUE )
{
XShowMessageBoxUI(0, L"Cheat Disabled Successfully", L"Inf Health - Disabled\r\n", ARRAYSIZE(g_strButtons), g_strButtons, 0, XMB_NOICON, &g_mb_result, &g_xol);
InfHealth = FALSE;
PulseController();
}else{
XShowMessageBoxUI(0, L"Cheat Enabled Successfully", L"Inf Health - Enabled\r\n", ARRAYSIZE(g_strButtons), g_strButtons, 0, XMB_NOICON, &g_mb_result, &g_xol);
InfHealth = TRUE;
PulseController();
}
memset( &g_mb_result.rgwPasscode[0], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[1], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[2], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[3], 0x00, 0x02 );
Prompt = 0x9999;
}
if( g_mb_result.rgwPasscode[0] == DPAD_UP && g_mb_result.rgwPasscode[1] == DPAD_UP && g_mb_result.rgwPasscode[2] == DPAD_UP && g_mb_result.rgwPasscode[3] == DPAD_UP )
{
Sleep(500);
if( OneHitKo == TRUE )
{
XShowMessageBoxUI(0, L"Cheat Disabled Successfully", L"Easy AI Kills - Disabled\r\n", ARRAYSIZE(g_strButtons), g_strButtons, 0, XMB_NOICON, &g_mb_result, &g_xol);
OneHitKo = FALSE;
PulseController();
}else{
XShowMessageBoxUI(0, L"Cheat Enabled Successfully", L"Easy AI Kills - Enabled\r\nDescription: **MAY BE BUGGY**.", ARRAYSIZE(g_strButtons), g_strButtons, 0, XMB_NOICON, &g_mb_result, &g_xol);
OneHitKo = TRUE;
PulseController();
}
memset( &g_mb_result.rgwPasscode[0], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[1], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[2], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[3], 0x00, 0x02 );
Prompt = 0x9999;
}
}
I wanna thank Renegade, my mentor, for being a dick when i asked for help, to get me to figure them out myself, that really helped you magnificent bastard.
And i want to thank GoldZ, even though he is now a rival, he was a friend sometime in the past.
Here's my first cave's source, it's for Kingdoms of Amalur, right now it's just OneHitKill and InfHealth, both work perfect though.
I'm using a different engine, as you can see, you get the concept though.
#include "common.h"
bool OneHitKo = false;
bool HooksSet = false;
bool InfHealth = false;
VOID __declspec(naked) CheckHP(VOID)
{
DWORD Ptr1;
__asm
{
mr Ptr1,r6
}
__asm{
}
DWORD Ptr2;
__asm
{
mr Ptr2,r9
}
if( InfHealth == TRUE && Ptr1 != 0x00)
{
int XValue = 999;
__asm
{
stw XValue,48h(r31)
}
}else{
if( InfHealth == FALSE )
{
__asm{
stw r11,48h(r31)
}
}
}
if( OneHitKo == TRUE && Ptr2 == 0x0000000000B60B60 )
{
int ZValue = 0;
__asm
{
stw ZValue,48h(r31)
}
}else{
if( OneHitKo == FALSE )
{
__asm{
stw r11,48h(r31)
}
}
}
__asm{
lis r11,0x8253
ori r11,r11,0x0E64
mtctr r11
bctr
}
}
VOID SetHooks()
{
DWORD IHealth[4];
patchInJump( (PDWORD)IHealth, (DWORD)CheckHP, FALSE );
DoCave(0x82530E4C, &IHealth[0], 4);
DoCave(0x82530E50, &IHealth[1], 4);
DoCave(0x82530E54, &IHealth[2], 4);
DoCave(0x82530E58, &IHealth[3], 4);
HooksSet = true;
}
VOID ShowTrainerMain()
{
Prompt = XShowMessageBoxUI(0, L"Kingdoms of Amalur", L"View Codes: DPAD-DOWN(x4)\r\nCreated by Kingadent\r\n", ARRAYSIZE(g_strButtons), g_strButtons, 0, XMB_PASSCODEMODE, &g_mb_result, &g_xol);
if( HooksSet == false )
{
SetHooks();
}
}
VOID TrainerLoaded()
{
Prompt = XShowMessageBoxUI(0, L"Kingdoms of Amalur", L"Trainer Loaded!\r\nYou may now start your game\r\n", ARRAYSIZE(g_strButtons), g_strButtons, 0, XMB_NOICON, &g_mb_result, &g_xol);
}
VOID ProcessButtonPress( MESSAGEBOX_RESULT g_mb_result )
{
if( g_mb_result.rgwPasscode[0] == DPAD_DOWN && g_mb_result.rgwPasscode[1] == DPAD_DOWN && g_mb_result.rgwPasscode[2] == DPAD_DOWN && g_mb_result.rgwPasscode[3] == DPAD_DOWN )
{
Sleep(500);
XShowMessageBoxUI(0, L"Viewing All Codes", L"Inf Health Y(x4)\r\nEasy Kills DPAD-UP(x4)", ARRAYSIZE(g_strButtons), g_strButtons, 0, XMB_NOICON, &g_mb_result, &g_xol);
memset( &g_mb_result.rgwPasscode[0], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[1], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[2], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[3], 0x00, 0x02 );
Prompt = 0x9999;
}
if( g_mb_result.rgwPasscode[0] == Y_BUTTON && g_mb_result.rgwPasscode[1] == Y_BUTTON && g_mb_result.rgwPasscode[2] == Y_BUTTON && g_mb_result.rgwPasscode[3] == Y_BUTTON )
{
Sleep(500);
if( InfHealth == TRUE )
{
XShowMessageBoxUI(0, L"Cheat Disabled Successfully", L"Inf Health - Disabled\r\n", ARRAYSIZE(g_strButtons), g_strButtons, 0, XMB_NOICON, &g_mb_result, &g_xol);
InfHealth = FALSE;
PulseController();
}else{
XShowMessageBoxUI(0, L"Cheat Enabled Successfully", L"Inf Health - Enabled\r\n", ARRAYSIZE(g_strButtons), g_strButtons, 0, XMB_NOICON, &g_mb_result, &g_xol);
InfHealth = TRUE;
PulseController();
}
memset( &g_mb_result.rgwPasscode[0], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[1], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[2], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[3], 0x00, 0x02 );
Prompt = 0x9999;
}
if( g_mb_result.rgwPasscode[0] == DPAD_UP && g_mb_result.rgwPasscode[1] == DPAD_UP && g_mb_result.rgwPasscode[2] == DPAD_UP && g_mb_result.rgwPasscode[3] == DPAD_UP )
{
Sleep(500);
if( OneHitKo == TRUE )
{
XShowMessageBoxUI(0, L"Cheat Disabled Successfully", L"Easy AI Kills - Disabled\r\n", ARRAYSIZE(g_strButtons), g_strButtons, 0, XMB_NOICON, &g_mb_result, &g_xol);
OneHitKo = FALSE;
PulseController();
}else{
XShowMessageBoxUI(0, L"Cheat Enabled Successfully", L"Easy AI Kills - Enabled\r\nDescription: **MAY BE BUGGY**.", ARRAYSIZE(g_strButtons), g_strButtons, 0, XMB_NOICON, &g_mb_result, &g_xol);
OneHitKo = TRUE;
PulseController();
}
memset( &g_mb_result.rgwPasscode[0], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[1], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[2], 0x00, 0x02 );
memset( &g_mb_result.rgwPasscode[3], 0x00, 0x02 );
Prompt = 0x9999;
}
}
I wanna thank Renegade, my mentor, for being a dick when i asked for help, to get me to figure them out myself, that really helped you magnificent bastard.
And i want to thank GoldZ, even though he is now a rival, he was a friend sometime in the past.