-
-
Save Inndy/e82499caba9b0649a963 to your computer and use it in GitHub Desktop.
Some useful code with game hacking.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define FPHook(adr, func) (*(void**)adr = (void*)func) ; | |
#define R(adr) (long)(*(long**)(adr)) // Watch out the size of long | |
#define P(adr, off) ( R( (R(adr) + off) ) ) | |
#define SCRIPT_INCLUDE(SCRIPT) void __declspec(naked) SCRIPT () ; | |
#define SCRIPT_START(SCRIPT) void __declspec(naked) SCRIPT () { __asm { | |
#define SCRIPT_END }} | |
#define ACALL(ADDRESS) mov [esp-0x08], ADDRESS; call [esp-0x08] | |
#define AJUMP(ADDRESS) push ADDRESS; ret | |
/**********************************************/ | |
/* | |
* // CheatScript for Taiwan MapleStory v166.2 | |
* // No Player Knockback Hack | |
* [ENABLE] | |
* 012CE528: | |
* DD 00CD1FE9 | |
* [DISABLE] | |
* 012CE528: | |
* DD 00CD1FB0 | |
*/ | |
long Switch_NoPlayerKnockback = 0; | |
SCRIPT_INCLUDE(NoPlayerKnockback); | |
FPHook(0x012CE528, NoPlayerKnockback); | |
SCRIPT_START(NoPlayerKnockback) | |
Cmp [Switch_NoPlayerKnockback], 0 | |
Je Normal_Knockback | |
AJUMP(0x00CD1FE9) | |
Normal_Knockback: | |
AJUMP(0x00CD1FB0) | |
SCRIPT_END | |
/**********************************************/ | |
// Read a value | |
// Equals to... | |
// Mov Eax, [0x00987654] | |
// Mov [val], Eax | |
long val = R(0x00987654); | |
// Write a value | |
// Equals to... | |
// Mov [0x00987654], 789 | |
R(0x00987654) = 789; | |
/**********************************************/ | |
// Read a pointer | |
// Equals to... | |
// Mov Eax, [0x00987654] | |
// Mov Eax, [Eax+0x1234] | |
// Mov [val], Eax | |
long val = P(0x00987654, 0x1234); | |
// Write a pointer | |
// Equals to... | |
// Mov Eax, [0x00987654] | |
// Mov [Eax+0x1234], 789 | |
P(0x00987654, 0x1234) = 789; | |
/**********************************************/ | |
unsigned char GetVirtualKeyCodeByName(char * KeyName) { | |
if (!KeyName || KeyName[0] == 0) | |
return 0; | |
else if (KeyName[0] == '`' || KeyName[0] == '~') | |
return VK_OEM_3; | |
else if (stricmp(KeyName, "SPACE") == 0 || strcmp(KeyName, " ") == 0) | |
return VK_SPACE; | |
else if (stricmp(KeyName, "INS") == 0 || stricmp(KeyName, "INSERT") == 0) | |
return VK_INSERT; | |
else if (stricmp(KeyName, "DEL") == 0 || stricmp(KeyName, "DELETE") == 0) | |
return VK_DELETE; | |
else if (stricmp(KeyName, "HOME") == 0) | |
return VK_HOME; | |
else if (stricmp(KeyName, "END") == 0) | |
return VK_END; | |
else if (stricmp(KeyName, "PGUP") == 0 || stricmp(KeyName, "PAGEUP") == 0) | |
return VK_PRIOR; | |
else if (stricmp(KeyName, "PGDOWN") == 0 || stricmp(KeyName, "PAGEDOWN") == 0) | |
return VK_NEXT; | |
else if (stricmp(KeyName, "CTRL") == 0 || stricmp(KeyName, "CONTROL") == 0) | |
return VK_CONTROL; | |
else if (stricmp(KeyName, "ALT") == 0 || stricmp(KeyName, "ALTERNATE") == 0) | |
return VK_MENU; | |
else if (stricmp(KeyName, "SHIFT") == 0 || stricmp(KeyName, "LSHIFT") == 0) | |
return VK_LSHIFT; | |
else if (stricmp(KeyName, "RSHIFT") == 0) | |
return VK_RSHIFT; | |
else if ('0' <= KeyName[0] && KeyName[0] <= '9' || 'A' <= KeyName[0] && KeyName[0] <= 'Z') | |
return KeyName[0]; | |
else if ('a' <= KeyName[0] && KeyName[0] <= 'z') | |
return KeyName[0] - 'a' + 'A'; | |
return 0; | |
} | |
const char * GetKeyNameByKeyCode(unsigned char KeyCode) { | |
switch (KeyCode) { | |
case VK_OEM_3: return "~"; | |
case VK_SPACE: return "Space"; | |
case VK_INSERT: return "Insert"; | |
case VK_DELETE: return "Delete"; | |
case VK_HOME: return "Home"; | |
case VK_END: return "End"; | |
case VK_PRIOR: return "PgUp"; | |
case VK_NEXT: return "PgDown"; | |
case VK_CONTROL: return "Ctrl"; | |
case VK_MENU: return "Alt"; | |
case VK_LSHIFT: return "Shift"; | |
} | |
if ('0' <= KeyCode && KeyCode <= '9') return &("0\01\02\03\04\05\06\07\08\09\0"[(KeyCode - '0') * 2]); | |
if ('A' <= KeyCode && KeyCode <= 'Z') return &("A\0B\0C\0D\0E\0F\0G\0H\0I\0J\0K\0L\0M\0N\0O\0P\0Q\0R\0S\0T\0U\0V\0W\0X\0Y\0Z\0"[(KeyCode - 'A') * 2]); | |
return "Unknow"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment