diff --git a/src/d3d9hook.asm b/src/d3d9hook.asm index 41ddfae..d3abd63 100644 --- a/src/d3d9hook.asm +++ b/src/d3d9hook.asm @@ -14,150 +14,150 @@ global _GetProcessWindow global _GetD3D9Device@8 _EnumWindowsCallback@8: - push ebx ; 10001360: 53 - sub esp,0x28 ; 10001361: 83 ec 28 - mov ebx,dword [esp+0x30] ; 10001364: 8b 5c 24 30 - lea eax,[esp+0x1c] ; 10001368: 8d 44 24 1c - mov dword [esp+0x4],eax ; 1000136c: 89 44 24 04 - mov dword [esp],ebx ; 10001370: 89 1c 24 - call _GetWindowThreadProcessId@8 ; 10001373: ff 15 ec 80 00 10 - sub esp,0x8 ; 10001379: 83 ec 08 - call _GetCurrentProcessId@0 ; 1000137c: ff 15 c0 80 00 10 - mov edx,eax ; 10001382: 89 c2 - mov eax,0x1 ; 10001384: b8 01 00 00 00 - cmp edx,dword [esp+0x1c] ; 10001389: 3b 54 24 1c - jne callback_exit ; 1000138d: 75 08 - mov dword [g_window],ebx ; 1000138f: 89 1d 00 60 00 10 - xor eax,eax ; 10001395: 31 c0 + push ebx ; 10001360: 53 + sub esp,0x28 ; 10001361: 83 ec 28 + mov ebx,dword [esp+0x30] ; 10001364: 8b 5c 24 30 + lea eax,[esp+0x1c] ; 10001368: 8d 44 24 1c + mov dword [esp+0x4],eax ; 1000136c: 89 44 24 04 + mov dword [esp],ebx ; 10001370: 89 1c 24 + call _GetWindowThreadProcessId@8 ; 10001373: ff 15 ec 80 00 10 + sub esp,0x8 ; 10001379: 83 ec 08 + call _GetCurrentProcessId@0 ; 1000137c: ff 15 c0 80 00 10 + mov edx,eax ; 10001382: 89 c2 + mov eax,0x1 ; 10001384: b8 01 00 00 00 + cmp edx,dword [esp+0x1c] ; 10001389: 3b 54 24 1c + jne callback_exit ; 1000138d: 75 08 + mov dword [g_window],ebx ; 1000138f: 89 1d 00 60 00 10 + xor eax,eax ; 10001395: 31 c0 callback_exit: - add esp,0x28 ; 10001397: 83 c4 28 - pop ebx ; 1000139a: 5b - ret 0x8 ; 1000139b: c2 08 00 - xchg ax,ax ; 1000139e: 66 90 + add esp,0x28 ; 10001397: 83 c4 28 + pop ebx ; 1000139a: 5b + ret 0x8 ; 1000139b: c2 08 00 + xchg ax,ax ; 1000139e: 66 90 _GetProcessWindow: - sub esp,0x1c ; 100013a0: 83 ec 1c - mov dword [esp+0x4],0x0 ; 100013a3: c7 44 24 04 00 00 00 - ; 100013aa: 00 - mov dword [esp],_EnumWindowsCallback@8 ; 100013ab: c7 04 24 60 13 00 10 - mov dword [g_window],0x0 ; 100013b2: c7 05 00 60 00 10 00 - ; 100013b9: 00 00 00 - call _EnumWindows@8 ; 100013bc: ff 15 e4 80 00 10 - sub esp,0x8 ; 100013c2: 83 ec 08 - mov eax,[g_window] ; 100013c5: a1 00 60 00 10 - add esp,0x1c ; 100013ca: 83 c4 1c - ret ; 100013cd: c3 - xchg ax,ax ; 100013ce: 66 90 + sub esp,0x1c ; 100013a0: 83 ec 1c + mov dword [esp+0x4],0x0 ; 100013a3: c7 44 24 04 00 00 00 + ; 100013aa: 00 + mov dword [esp],_EnumWindowsCallback@8 ; 100013ab: c7 04 24 60 13 00 10 + mov dword [g_window],0x0 ; 100013b2: c7 05 00 60 00 10 00 + ; 100013b9: 00 00 00 + call _EnumWindows@8 ; 100013bc: ff 15 e4 80 00 10 + sub esp,0x8 ; 100013c2: 83 ec 08 + mov eax,[g_window] ; 100013c5: a1 00 60 00 10 + add esp,0x1c ; 100013ca: 83 c4 1c + ret ; 100013cd: c3 + xchg ax,ax ; 100013ce: 66 90 _GetD3D9Device@8: - push ebp ; 100013d0: 55 - push edi ; 100013d1: 57 - push esi ; 100013d2: 56 - push ebx ; 100013d3: 53 - sub esp,0x6c ; 100013d4: 83 ec 6c - mov esi,dword [esp+0x80] ; 100013d7: 8b b4 24 80 00 00 00 - test esi,esi ; 100013de: 85 f6 - je d3d9_exit ; 100013e0: 0f 84 15 01 00 00 - mov dword [esp],0x20 ; 100013e6: c7 04 24 20 00 00 00 - call _Direct3DCreate9@4 ; 100013ed: e8 8e 18 00 00 - sub esp,0x4 ; 100013f2: 83 ec 04 - mov ebx,eax ; 100013f5: 89 c3 - test eax,eax ; 100013f7: 85 c0 - je d3d9_exit ; 100013f9: 0f 84 fc 00 00 00 - lea ebp,[esp+0x28] ; 100013ff: 8d 6c 24 28 - xor eax,eax ; 10001403: 31 c0 - mov ecx,0xe ; 10001405: b9 0e 00 00 00 - mov edi,ebp ; 1000140a: 89 ef - rep stosd; dword es:[edi],eax ; 1000140c: f3 ab - mov dword [esp+0x24],0x0 ; 1000140e: c7 44 24 24 00 00 00 - ; 10001415: 00 - mov dword [esp+0x40],0x1 ; 10001416: c7 44 24 40 01 00 00 - ; 1000141d: 00 - lea edi,[esp+0x24] ; 1000141e: 8d 7c 24 24 - call _GetProcessWindow ; 10001422: e8 17 fc ff ff - mov dword [esp+0x44],eax ; 10001427: 89 44 24 44 - mov edx,dword [ebx] ; 1000142b: 8b 13 - mov dword [esp+0x48],0x1 ; 1000142d: c7 44 24 48 01 00 00 - ; 10001434: 00 - mov dword [esp+0x18],edi ; 10001435: 89 7c 24 18 - mov dword [esp+0x14],ebp ; 10001439: 89 6c 24 14 - mov dword [esp+0x10],0x20 ; 1000143d: c7 44 24 10 20 00 00 - ; 10001444: 00 - mov dword [esp+0xc],eax ; 10001445: 89 44 24 0c - mov dword [esp+0x8],0x1 ; 10001449: c7 44 24 08 01 00 00 - ; 10001450: 00 - mov dword [esp+0x4],0x0 ; 10001451: c7 44 24 04 00 00 00 - ; 10001458: 00 - mov dword [esp],ebx ; 10001459: 89 1c 24 - call dword [edx+0x40] ; 1000145c: ff 52 40 - sub esp,0x1c ; 1000145f: 83 ec 1c - test eax,eax ; 10001462: 85 c0 - je clean_exit ; 10001464: 74 46 - mov eax,dword [esp+0x48] ; 10001466: 8b 44 24 48 - xor ecx,ecx ; 1000146a: 31 c9 - test eax,eax ; 1000146c: 85 c0 - mov eax,dword [ebx] ; 1000146e: 8b 03 - mov dword [esp+0x14],ebp ; 10001470: 89 6c 24 14 - mov ebp,dword [esp+0x44] ; 10001474: 8b 6c 24 44 - sete cl ; 10001478: 0f 94 c1 - mov dword [esp+0x48],ecx ; 1000147b: 89 4c 24 48 - mov dword [esp+0x18],edi ; 1000147f: 89 7c 24 18 - mov dword [esp+0x10],0x20 ; 10001483: c7 44 24 10 20 00 00 - ; 1000148a: 00 - mov dword [esp+0xc],ebp ; 1000148b: 89 6c 24 0c - mov dword [esp+0x8],0x1 ; 1000148f: c7 44 24 08 01 00 00 - ; 10001496: 00 - mov dword [esp+0x4],0x0 ; 10001497: c7 44 24 04 00 00 00 - ; 1000149e: 00 - mov dword [esp],ebx ; 1000149f: 89 1c 24 - call dword [eax+0x40] ; 100014a2: ff 50 40 - sub esp,0x1c ; 100014a5: 83 ec 1c - test eax,eax ; 100014a8: 85 c0 - jne d3d9_exit ; 100014aa: 75 44 + push ebp ; 100013d0: 55 + push edi ; 100013d1: 57 + push esi ; 100013d2: 56 + push ebx ; 100013d3: 53 + sub esp,0x6c ; 100013d4: 83 ec 6c + mov esi,dword [esp+0x80] ; 100013d7: 8b b4 24 80 00 00 00 + test esi,esi ; 100013de: 85 f6 + je d3d9_exit ; 100013e0: 0f 84 15 01 00 00 + mov dword [esp],0x20 ; 100013e6: c7 04 24 20 00 00 00 + call _Direct3DCreate9@4 ; 100013ed: e8 8e 18 00 00 + sub esp,0x4 ; 100013f2: 83 ec 04 + mov ebx,eax ; 100013f5: 89 c3 + test eax,eax ; 100013f7: 85 c0 + je d3d9_exit ; 100013f9: 0f 84 fc 00 00 00 + lea ebp,[esp+0x28] ; 100013ff: 8d 6c 24 28 + xor eax,eax ; 10001403: 31 c0 + mov ecx,0xe ; 10001405: b9 0e 00 00 00 + mov edi,ebp ; 1000140a: 89 ef + rep stosd; dword es:[edi],eax ; 1000140c: f3 ab + mov dword [esp+0x24],0x0 ; 1000140e: c7 44 24 24 00 00 00 + ; 10001415: 00 + mov dword [esp+0x40],0x1 ; 10001416: c7 44 24 40 01 00 00 + ; 1000141d: 00 + lea edi,[esp+0x24] ; 1000141e: 8d 7c 24 24 + call _GetProcessWindow ; 10001422: e8 17 fc ff ff + mov dword [esp+0x44],eax ; 10001427: 89 44 24 44 + mov edx,dword [ebx] ; 1000142b: 8b 13 + mov dword [esp+0x48],0x1 ; 1000142d: c7 44 24 48 01 00 00 + ; 10001434: 00 + mov dword [esp+0x18],edi ; 10001435: 89 7c 24 18 + mov dword [esp+0x14],ebp ; 10001439: 89 6c 24 14 + mov dword [esp+0x10],0x20 ; 1000143d: c7 44 24 10 20 00 00 + ; 10001444: 00 + mov dword [esp+0xc],eax ; 10001445: 89 44 24 0c + mov dword [esp+0x8],0x1 ; 10001449: c7 44 24 08 01 00 00 + ; 10001450: 00 + mov dword [esp+0x4],0x0 ; 10001451: c7 44 24 04 00 00 00 + ; 10001458: 00 + mov dword [esp],ebx ; 10001459: 89 1c 24 + call dword [edx+0x40] ; 1000145c: ff 52 40 + sub esp,0x1c ; 1000145f: 83 ec 1c + test eax,eax ; 10001462: 85 c0 + je clean_exit ; 10001464: 74 46 + mov eax,dword [esp+0x48] ; 10001466: 8b 44 24 48 + xor ecx,ecx ; 1000146a: 31 c9 + test eax,eax ; 1000146c: 85 c0 + mov eax,dword [ebx] ; 1000146e: 8b 03 + mov dword [esp+0x14],ebp ; 10001470: 89 6c 24 14 + mov ebp,dword [esp+0x44] ; 10001474: 8b 6c 24 44 + sete cl ; 10001478: 0f 94 c1 + mov dword [esp+0x48],ecx ; 1000147b: 89 4c 24 48 + mov dword [esp+0x18],edi ; 1000147f: 89 7c 24 18 + mov dword [esp+0x10],0x20 ; 10001483: c7 44 24 10 20 00 00 + ; 1000148a: 00 + mov dword [esp+0xc],ebp ; 1000148b: 89 6c 24 0c + mov dword [esp+0x8],0x1 ; 1000148f: c7 44 24 08 01 00 00 + ; 10001496: 00 + mov dword [esp+0x4],0x0 ; 10001497: c7 44 24 04 00 00 00 + ; 1000149e: 00 + mov dword [esp],ebx ; 1000149f: 89 1c 24 + call dword [eax+0x40] ; 100014a2: ff 50 40 + sub esp,0x1c ; 100014a5: 83 ec 1c + test eax,eax ; 100014a8: 85 c0 + jne d3d9_exit ; 100014aa: 75 44 clean_exit: - mov edi,dword [esp+0x24] ; 100014ac: 8b 7c 24 24 - mov edx,dword [esp+0x84] ; 100014b0: 8b 94 24 84 00 00 00 - mov ecx,dword [edi] ; 100014b7: 8b 0f - mov dword [esp+0x8],edx ; 100014b9: 89 54 24 08 - mov dword [esp+0x4],ecx ; 100014bd: 89 4c 24 04 - mov dword [esp],esi ; 100014c1: 89 34 24 - call _memcpy ; 100014c4: e8 07 18 00 00 - mov esi,dword [edi] ; 100014c9: 8b 37 - mov dword [esp],edi ; 100014cb: 89 3c 24 - call dword [esi+0x8] ; 100014ce: ff 56 08 - sub esp,0x4 ; 100014d1: 83 ec 04 - mov eax,dword [ebx] ; 100014d4: 8b 03 - mov dword [esp],ebx ; 100014d6: 89 1c 24 - call dword [eax+0x8] ; 100014d9: ff 50 08 - sub esp,0x4 ; 100014dc: 83 ec 04 - add esp,0x6c ; 100014df: 83 c4 6c - pop ebx ; 100014e2: 5b - pop esi ; 100014e3: 5e - pop edi ; 100014e4: 5f - mov eax,0x1 ; 100014e5: b8 01 00 00 00 - pop ebp ; 100014ea: 5d - ret ; 100014eb: c3 - lea esi,[esi+0x0] ; 100014ec: 8d 74 26 00 - mov ebp,dword [ebx] ; 100014f0: 8b 2b - mov dword [esp],ebx ; 100014f2: 89 1c 24 - call dword [ebp+0x8] ; 100014f5: ff 55 08 - sub esp,0x4 ; 100014f8: 83 ec 04 + mov edi,dword [esp+0x24] ; 100014ac: 8b 7c 24 24 + mov edx,dword [esp+0x84] ; 100014b0: 8b 94 24 84 00 00 00 + mov ecx,dword [edi] ; 100014b7: 8b 0f + mov dword [esp+0x8],edx ; 100014b9: 89 54 24 08 + mov dword [esp+0x4],ecx ; 100014bd: 89 4c 24 04 + mov dword [esp],esi ; 100014c1: 89 34 24 + call _memcpy ; 100014c4: e8 07 18 00 00 + mov esi,dword [edi] ; 100014c9: 8b 37 + mov dword [esp],edi ; 100014cb: 89 3c 24 + call dword [esi+0x8] ; 100014ce: ff 56 08 + sub esp,0x4 ; 100014d1: 83 ec 04 + mov eax,dword [ebx] ; 100014d4: 8b 03 + mov dword [esp],ebx ; 100014d6: 89 1c 24 + call dword [eax+0x8] ; 100014d9: ff 50 08 + sub esp,0x4 ; 100014dc: 83 ec 04 + add esp,0x6c ; 100014df: 83 c4 6c + pop ebx ; 100014e2: 5b + pop esi ; 100014e3: 5e + pop edi ; 100014e4: 5f + mov eax,0x1 ; 100014e5: b8 01 00 00 00 + pop ebp ; 100014ea: 5d + ret ; 100014eb: c3 + lea esi,[esi+0x0] ; 100014ec: 8d 74 26 00 + mov ebp,dword [ebx] ; 100014f0: 8b 2b + mov dword [esp],ebx ; 100014f2: 89 1c 24 + call dword [ebp+0x8] ; 100014f5: ff 55 08 + sub esp,0x4 ; 100014f8: 83 ec 04 d3d9_exit: - add esp,0x6c ; 100014fb: 83 c4 6c - pop ebx ; 100014fe: 5b - pop esi ; 100014ff: 5e - pop edi ; 10001500: 5f - xor eax,eax ; 10001501: 31 c0 - pop ebp ; 10001503: 5d - ret ; 10001504: c3 - nop ; 10001505: 90 - nop ; 10001506: 90 - nop ; 10001507: 90 - nop ; 10001508: 90 - nop ; 10001509: 90 - nop ; 1000150a: 90 - nop ; 1000150b: 90 - nop ; 1000150c: 90 - nop ; 1000150d: 90 - nop ; 1000150e: 90 - nop ; 1000150f: 90 + add esp,0x6c ; 100014fb: 83 c4 6c + pop ebx ; 100014fe: 5b + pop esi ; 100014ff: 5e + pop edi ; 10001500: 5f + xor eax,eax ; 10001501: 31 c0 + pop ebp ; 10001503: 5d + ret ; 10001504: c3 + nop ; 10001505: 90 + nop ; 10001506: 90 + nop ; 10001507: 90 + nop ; 10001508: 90 + nop ; 10001509: 90 + nop ; 1000150a: 90 + nop ; 1000150b: 90 + nop ; 1000150c: 90 + nop ; 1000150d: 90 + nop ; 1000150e: 90 + nop ; 1000150f: 90 diff --git a/src/dll_main.asm b/src/dll_main.asm index dcb1960..39aa97b 100644 --- a/src/dll_main.asm +++ b/src/dll_main.asm @@ -1,24 +1,24 @@ -extern _DisableThreadLibraryCalls@4 -extern _MainThread@4 -extern _CreateThread@24 +extern _DisableThreadLibraryCalls@4 +extern _MainThread@4 +extern _CreateThread@24 -section .text -global _DllMain@12 +section .text +global _DllMain@12 -%define DLL_PROCESS_ATTACH 1 +%define DLL_PROCESS_ATTACH 1 _DllMain@12: - cmp byte [ esp + 0x8 ], DLL_PROCESS_ATTACH - jne exit - push dword [ esp + 0x4 ] - call _DisableThreadLibraryCalls@4 - push 0 - push 0 - push dword [ esp + 0x4 ] - push _MainThread@4 - push 0 - push 0 - call _CreateThread@24 + cmp byte [ esp + 0x8 ], DLL_PROCESS_ATTACH + jne exit + push dword [ esp + 0x4 ] + call _DisableThreadLibraryCalls@4 + push 0 + push 0 + push dword [ esp + 0x4 ] + push _MainThread@4 + push 0 + push 0 + call _CreateThread@24 exit: - mov eax, 1 - ret 12 + mov eax, 1 + ret 12 diff --git a/src/drawing.asm b/src/drawing.asm index 135b278..2cf6236 100644 --- a/src/drawing.asm +++ b/src/drawing.asm @@ -1,153 +1,153 @@ -section .text +section .text -global _drawing_draw_border_box -global _drawing_draw_filled_rect +global _drawing_draw_border_box +global _drawing_draw_filled_rect _drawing_draw_border_box: - push ebp ; 0: 55 - push edi ; 1: 57 - push esi ; 2: 56 - push ebx ; 3: 53 - sub esp, 0x4c ; 4: 83 ec 4c - mov esi, dword [esp+0x60] ; 7: 8b 74 24 60 - mov eax, dword [esp+0x64] ; b: 8b 44 24 64 - mov edx, dword [esp+0x68] ; f: 8b 54 24 68 - mov ebx, dword [esp+0x78] ; 13: 8b 5c 24 78 - mov ecx, dword [esp+0x74] ; 17: 8b 4c 24 74 - lea ebp, [esp+0x30] ; 1b: 8d 6c 24 30 - add edx, esi ; 1f: 01 f2 - mov dword [esp+0x34], eax ; 21: 89 44 24 34 - add eax, dword [esp+0x70] ; 25: 03 44 24 70 - mov edi, dword [ebx] ; 29: 8b 3b - mov dword [esp+0x30], esi ; 2b: 89 74 24 30 - mov dword [esp+0x38], edx ; 2f: 89 54 24 38 - mov dword [esp+0x10], ecx ; 33: 89 4c 24 10 - mov dword [esp+0x8], ebp ; 37: 89 6c 24 08 - mov dword [esp], ebx ; 3b: 89 1c 24 - mov dword [esp+0x3c], eax ; 3e: 89 44 24 3c - mov dword [esp+0x18], 0x0 ; 42: c7 44 24 18 00 00 00 - ; 49: 00 - mov dword [esp+0x14], 0x0 ; 4a: c7 44 24 14 00 00 00 - ; 51: 00 - mov dword [esp+0xc], 0x7 ; 52: c7 44 24 0c 07 00 00 - ; 59: 00 - mov dword [esp+0x4], 0x1 ; 5a: c7 44 24 04 01 00 00 - ; 61: 00 - mov dword [esp+0x2c], edx ; 62: 89 54 24 2c - call dword [edi+0xac] ; 66: ff 97 ac 00 00 00 - sub esp, 0x1c ; 6c: 83 ec 1c - mov edx, dword [esp+0x70] ; 6f: 8b 54 24 70 - mov edi, dword [esp+0x64] ; 73: 8b 7c 24 64 - mov eax, dword [esp+0x64] ; 77: 8b 44 24 64 - mov ecx, dword [esp+0x74] ; 7b: 8b 4c 24 74 - add edi, dword [esp+0x6c] ; 7f: 03 7c 24 6c - add edx, esi ; 83: 01 f2 - mov dword [esp+0x30], esi ; 85: 89 74 24 30 - mov dword [esp+0x34], eax ; 89: 89 44 24 34 - mov dword [esp+0x38], edx ; 8d: 89 54 24 38 - mov eax, dword [ebx] ; 91: 8b 03 - mov dword [esp+0x3c], edi ; 93: 89 7c 24 3c - mov dword [esp+0x10], ecx ; 97: 89 4c 24 10 - mov dword [esp+0x8], ebp ; 9b: 89 6c 24 08 - mov dword [esp], ebx ; 9f: 89 1c 24 - mov dword [esp+0x18], 0x0 ; a2: c7 44 24 18 00 00 00 - ; a9: 00 - mov dword [esp+0x14], 0x0 ; aa: c7 44 24 14 00 00 00 - ; b1: 00 - mov dword [esp+0xc], 0x7 ; b2: c7 44 24 0c 07 00 00 - ; b9: 00 - mov dword [esp+0x4], 0x1 ; ba: c7 44 24 04 01 00 00 - ; c1: 00 - call dword [eax+0xac] ; c2: ff 90 ac 00 00 00 - sub esp, 0x1c ; c8: 83 ec 1c - mov edx, dword [esp+0x2c] ; cb: 8b 54 24 2c - mov eax, dword [esp+0x64] ; cf: 8b 44 24 64 - mov ecx, dword [esp+0x74] ; d3: 8b 4c 24 74 - mov dword [esp+0x30], edx ; d7: 89 54 24 30 - add edx, dword [esp+0x70] ; db: 03 54 24 70 - mov dword [esp+0x34], eax ; df: 89 44 24 34 - mov dword [esp+0x38], edx ; e3: 89 54 24 38 - mov eax, dword [ebx] ; e7: 8b 03 - mov dword [esp+0x3c], edi ; e9: 89 7c 24 3c - mov dword [esp+0x10], ecx ; ed: 89 4c 24 10 - mov dword [esp+0x8], ebp ; f1: 89 6c 24 08 - mov dword [esp], ebx ; f5: 89 1c 24 - mov dword [esp+0x18], 0x0 ; f8: c7 44 24 18 00 00 00 - ; ff: 00 - mov dword [esp+0x14], 0x0 ; 100: c7 44 24 14 00 00 00 - ; 107: 00 - mov dword [esp+0xc], 0x7 ; 108: c7 44 24 0c 07 00 00 - ; 10f: 00 - mov dword [esp+0x4], 0x1 ; 110: c7 44 24 04 01 00 00 - ; 117: 00 - call dword [eax+0xac] ; 118: ff 90 ac 00 00 00 - sub esp, 0x1c ; 11e: 83 ec 1c - mov edx, dword [esp+0x68] ; 121: 8b 54 24 68 - mov dword [esp+0x30], esi ; 125: 89 74 24 30 - add edx, dword [esp+0x70] ; 129: 03 54 24 70 - add esi, edx ; 12d: 01 d6 - mov dword [esp+0x38], esi ; 12f: 89 74 24 38 - mov esi, dword [esp+0x70] ; 133: 8b 74 24 70 - mov dword [esp+0x34], edi ; 137: 89 7c 24 34 - add esi, edi ; 13b: 01 fe - mov edi, dword [esp+0x74] ; 13d: 8b 7c 24 74 - mov eax, dword [ebx] ; 141: 8b 03 - mov dword [esp+0x3c], esi ; 143: 89 74 24 3c - mov dword [esp+0x10], edi ; 147: 89 7c 24 10 - mov dword [esp+0x8], ebp ; 14b: 89 6c 24 08 - mov dword [esp], ebx ; 14f: 89 1c 24 - mov dword [esp+0x18], 0x0 ; 152: c7 44 24 18 00 00 00 - ; 159: 00 - mov dword [esp+0x14], 0x0 ; 15a: c7 44 24 14 00 00 00 - ; 161: 00 - mov dword [esp+0xc], 0x7 ; 162: c7 44 24 0c 07 00 00 - ; 169: 00 - mov dword [esp+0x4], 0x1 ; 16a: c7 44 24 04 01 00 00 - ; 171: 00 - call dword [eax+0xac] ; 172: ff 90 ac 00 00 00 - sub esp, 0x1c ; 178: 83 ec 1c - add esp, 0x4c ; 17b: 83 c4 4c - pop ebx ; 17e: 5b - pop esi ; 17f: 5e - pop edi ; 180: 5f - pop ebp ; 181: 5d - ret ; 182: c3 - lea esi, [esi+0x0] ; 183: 8d b4 26 00 00 00 00 - lea esi, [esi+0x0] ; 18a: 8d b6 00 00 00 00 - + push ebp ; 0 : 55 + push edi ; 1 : 57 + push esi ; 2 : 56 + push ebx ; 3 : 53 + sub esp, 0x4c ; 4 : 83 ec 4c + mov esi, dword [esp+0x60] ; 7 : 8b 74 24 60 + mov eax, dword [esp+0x64] ; b : 8b 44 24 64 + mov edx, dword [esp+0x68] ; f : 8b 54 24 68 + mov ebx, dword [esp+0x78] ; 13 : 8b 5c 24 78 + mov ecx, dword [esp+0x74] ; 17 : 8b 4c 24 74 + lea ebp, [esp+0x30] ; 1b : 8d 6c 24 30 + add edx, esi ; 1f : 01 f2 + mov dword [esp+0x34], eax ; 21 : 89 44 24 34 + add eax, dword [esp+0x70] ; 25 : 03 44 24 70 + mov edi, dword [ebx] ; 29 : 8b 3b + mov dword [esp+0x30], esi ; 2b : 89 74 24 30 + mov dword [esp+0x38], edx ; 2f : 89 54 24 38 + mov dword [esp+0x10], ecx ; 33 : 89 4c 24 10 + mov dword [esp+0x8], ebp ; 37 : 89 6c 24 08 + mov dword [esp], ebx ; 3b : 89 1c 24 + mov dword [esp+0x3c], eax ; 3e : 89 44 24 3c + mov dword [esp+0x18], 0x0 ; 42 : c7 44 24 18 00 00 00 + ; 49 : 00 + mov dword [esp+0x14], 0x0 ; 4a : c7 44 24 14 00 00 00 + ; 51 : 00 + mov dword [esp+0xc], 0x7 ; 52 : c7 44 24 0c 07 00 00 + ; 59 : 00 + mov dword [esp+0x4], 0x1 ; 5a : c7 44 24 04 01 00 00 + ; 61 : 00 + mov dword [esp+0x2c], edx ; 62 : 89 54 24 2c + call dword [edi+0xac] ; 66 : ff 97 ac 00 00 00 + sub esp, 0x1c ; 6c : 83 ec 1c + mov edx, dword [esp+0x70] ; 6f : 8b 54 24 70 + mov edi, dword [esp+0x64] ; 73 : 8b 7c 24 64 + mov eax, dword [esp+0x64] ; 77 : 8b 44 24 64 + mov ecx, dword [esp+0x74] ; 7b : 8b 4c 24 74 + add edi, dword [esp+0x6c] ; 7f : 03 7c 24 6c + add edx, esi ; 83 : 01 f2 + mov dword [esp+0x30], esi ; 85 : 89 74 24 30 + mov dword [esp+0x34], eax ; 89 : 89 44 24 34 + mov dword [esp+0x38], edx ; 8d : 89 54 24 38 + mov eax, dword [ebx] ; 91 : 8b 03 + mov dword [esp+0x3c], edi ; 93 : 89 7c 24 3c + mov dword [esp+0x10], ecx ; 97 : 89 4c 24 10 + mov dword [esp+0x8], ebp ; 9b : 89 6c 24 08 + mov dword [esp], ebx ; 9f : 89 1c 24 + mov dword [esp+0x18], 0x0 ; a2 : c7 44 24 18 00 00 00 + ; a9 : 00 + mov dword [esp+0x14], 0x0 ; aa : c7 44 24 14 00 00 00 + ; b1 : 00 + mov dword [esp+0xc], 0x7 ; b2 : c7 44 24 0c 07 00 00 + ; b9 : 00 + mov dword [esp+0x4], 0x1 ; ba : c7 44 24 04 01 00 00 + ; c1 : 00 + call dword [eax+0xac] ; c2 : ff 90 ac 00 00 00 + sub esp, 0x1c ; c8 : 83 ec 1c + mov edx, dword [esp+0x2c] ; cb : 8b 54 24 2c + mov eax, dword [esp+0x64] ; cf : 8b 44 24 64 + mov ecx, dword [esp+0x74] ; d3 : 8b 4c 24 74 + mov dword [esp+0x30], edx ; d7 : 89 54 24 30 + add edx, dword [esp+0x70] ; db : 03 54 24 70 + mov dword [esp+0x34], eax ; df : 89 44 24 34 + mov dword [esp+0x38], edx ; e3 : 89 54 24 38 + mov eax, dword [ebx] ; e7 : 8b 03 + mov dword [esp+0x3c], edi ; e9 : 89 7c 24 3c + mov dword [esp+0x10], ecx ; ed : 89 4c 24 10 + mov dword [esp+0x8], ebp ; f1 : 89 6c 24 08 + mov dword [esp], ebx ; f5 : 89 1c 24 + mov dword [esp+0x18], 0x0 ; f8 : c7 44 24 18 00 00 00 + ; ff : 00 + mov dword [esp+0x14], 0x0 ; 100 : c7 44 24 14 00 00 00 + ; 107 : 00 + mov dword [esp+0xc], 0x7 ; 108 : c7 44 24 0c 07 00 00 + ; 10f : 00 + mov dword [esp+0x4], 0x1 ; 110 : c7 44 24 04 01 00 00 + ; 117 : 00 + call dword [eax+0xac] ; 118 : ff 90 ac 00 00 00 + sub esp, 0x1c ; 11e : 83 ec 1c + mov edx, dword [esp+0x68] ; 121 : 8b 54 24 68 + mov dword [esp+0x30], esi ; 125 : 89 74 24 30 + add edx, dword [esp+0x70] ; 129 : 03 54 24 70 + add esi, edx ; 12d : 01 d6 + mov dword [esp+0x38], esi ; 12f : 89 74 24 38 + mov esi, dword [esp+0x70] ; 133 : 8b 74 24 70 + mov dword [esp+0x34], edi ; 137 : 89 7c 24 34 + add esi, edi ; 13b : 01 fe + mov edi, dword [esp+0x74] ; 13d : 8b 7c 24 74 + mov eax, dword [ebx] ; 141 : 8b 03 + mov dword [esp+0x3c], esi ; 143 : 89 74 24 3c + mov dword [esp+0x10], edi ; 147 : 89 7c 24 10 + mov dword [esp+0x8], ebp ; 14b : 89 6c 24 08 + mov dword [esp], ebx ; 14f : 89 1c 24 + mov dword [esp+0x18], 0x0 ; 152 : c7 44 24 18 00 00 00 + ; 159 : 00 + mov dword [esp+0x14], 0x0 ; 15a : c7 44 24 14 00 00 00 + ; 161 : 00 + mov dword [esp+0xc], 0x7 ; 162 : c7 44 24 0c 07 00 00 + ; 169 : 00 + mov dword [esp+0x4], 0x1 ; 16a : c7 44 24 04 01 00 00 + ; 171 : 00 + call dword [eax+0xac] ; 172 : ff 90 ac 00 00 00 + sub esp, 0x1c ; 178 : 83 ec 1c + add esp, 0x4c ; 17b : 83 c4 4c + pop ebx ; 17e : 5b + pop esi ; 17f : 5e + pop edi ; 180 : 5f + pop ebp ; 181 : 5d + ret ; 182 : c3 + lea esi, [esi+0x0] ; 183 : 8d b4 26 00 00 00 00 + lea esi, [esi+0x0] ; 18a : 8d b6 00 00 00 00 + _drawing_draw_filled_rect: - sub esp, 0x3c ; 190: 83 ec 3c - mov edx, dword [esp+0x40] ; 193: 8b 54 24 40 - mov eax, dword [esp+0x44] ; 197: 8b 44 24 44 - mov dword [esp+0x20], edx ; 19b: 89 54 24 20 - add edx, dword [esp+0x48] ; 19f: 03 54 24 48 - mov ecx, dword [esp+0x54] ; 1a3: 8b 4c 24 54 - mov dword [esp+0x28], edx ; 1a7: 89 54 24 28 - mov edx, dword [esp+0x50] ; 1ab: 8b 54 24 50 - mov dword [esp+0x24], eax ; 1af: 89 44 24 24 - add eax, dword [esp+0x4c] ; 1b3: 03 44 24 4c - mov dword [esp+0x2c], eax ; 1b7: 89 44 24 2c - mov eax, dword [ecx] ; 1bb: 8b 01 - mov dword [esp+0x10], edx ; 1bd: 89 54 24 10 - lea edx, [esp+0x20] ; 1c1: 8d 54 24 20 - mov dword [esp+0x18], 0x0 ; 1c5: c7 44 24 18 00 00 00 - ; 1cc: 00 - mov dword [esp+0x14], 0x0 ; 1cd: c7 44 24 14 00 00 00 - ; 1d4: 00 - mov dword [esp+0xc], 0x7 ; 1d5: c7 44 24 0c 07 00 00 - ; 1dc: 00 - mov dword [esp+0x8], edx ; 1dd: 89 54 24 08 - mov dword [esp+0x4], 0x1 ; 1e1: c7 44 24 04 01 00 00 - ; 1e8: 00 - mov dword [esp], ecx ; 1e9: 89 0c 24 - call dword [eax+0xac] ; 1ec: ff 90 ac 00 00 00 - sub esp, 0x1c ; 1f2: 83 ec 1c - add esp, 0x3c ; 1f5: 83 c4 3c - ret ; 1f8: c3 - nop ; 1f9: 90 - nop ; 1fa: 90 - nop ; 1fb: 90 - nop ; 1fc: 90 - nop ; 1fd: 90 - nop ; 1fe: 90 - nop ; 1ff: 90 + sub esp, 0x3c ; 190 : 83 ec 3c + mov edx, dword [esp+0x40] ; 193 : 8b 54 24 40 + mov eax, dword [esp+0x44] ; 197 : 8b 44 24 44 + mov dword [esp+0x20], edx ; 19b : 89 54 24 20 + add edx, dword [esp+0x48] ; 19f : 03 54 24 48 + mov ecx, dword [esp+0x54] ; 1a3 : 8b 4c 24 54 + mov dword [esp+0x28], edx ; 1a7 : 89 54 24 28 + mov edx, dword [esp+0x50] ; 1ab : 8b 54 24 50 + mov dword [esp+0x24], eax ; 1af : 89 44 24 24 + add eax, dword [esp+0x4c] ; 1b3 : 03 44 24 4c + mov dword [esp+0x2c], eax ; 1b7 : 89 44 24 2c + mov eax, dword [ecx] ; 1bb : 8b 01 + mov dword [esp+0x10], edx ; 1bd : 89 54 24 10 + lea edx, [esp+0x20] ; 1c1 : 8d 54 24 20 + mov dword [esp+0x18], 0x0 ; 1c5 : c7 44 24 18 00 00 00 + ; 1cc : 00 + mov dword [esp+0x14], 0x0 ; 1cd : c7 44 24 14 00 00 00 + ; 1d4 : 00 + mov dword [esp+0xc], 0x7 ; 1d5 : c7 44 24 0c 07 00 00 + ; 1dc : 00 + mov dword [esp+0x8], edx ; 1dd : 89 54 24 08 + mov dword [esp+0x4], 0x1 ; 1e1 : c7 44 24 04 01 00 00 + ; 1e8 : 00 + mov dword [esp], ecx ; 1e9 : 89 0c 24 + call dword [eax+0xac] ; 1ec : ff 90 ac 00 00 00 + sub esp, 0x1c ; 1f2 : 83 ec 1c + add esp, 0x3c ; 1f5 : 83 c4 3c + ret ; 1f8 : c3 + nop ; 1f9 : 90 + nop ; 1fa : 90 + nop ; 1fb : 90 + nop ; 1fc : 90 + nop ; 1fd : 90 + nop ; 1fe : 90 + nop ; 1ff : 90 diff --git a/src/health_detour.asm b/src/health_detour.asm index 9f8d672..867160d 100644 --- a/src/health_detour.asm +++ b/src/health_detour.asm @@ -1,17 +1,17 @@ -segment .text +section .text -global _health_detour +global _health_detour _health_detour: - cmp dword [edi], 0x110E8B50 - je $ + 0x08 - xor eax, eax - mov eax, eax - mov dword [ebx], eax - mov ebx, eax - mov eax, dword [esp + 0x14] - pop esi - mov dword [eax], ebx - pop ebx - pop ecx - ret 0x8 + cmp dword [edi], 0x110E8B50 + je $ + 0x08 + xor eax, eax + mov eax, eax + mov dword [ebx], eax + mov ebx, eax + mov eax, dword [esp + 0x14] + pop esi + mov dword [eax], ebx + pop ebx + pop ecx + ret 0x8 diff --git a/src/hook_end_scene.asm b/src/hook_end_scene.asm index ff8e04a..2eb8a92 100644 --- a/src/hook_end_scene.asm +++ b/src/hook_end_scene.asm @@ -1,13 +1,13 @@ -extern _oEndScene -extern _render_menu@4 +extern _oEndScene +extern _render_menu@4 -section .text -global _hook_end_scene +section .text +global _hook_end_scene _hook_end_scene: - push dword [ esp + 0x4 ] - call _render_menu@4 - jmp [_oEndScene] + push dword [ esp + 0x4 ] + call _render_menu@4 + jmp [_oEndScene] ;push ebx ;sub esp,0x18 ;mov ebx, dword [esp+0x20] diff --git a/src/main_thread.asm b/src/main_thread.asm index b1ffafb..6f769df 100644 --- a/src/main_thread.asm +++ b/src/main_thread.asm @@ -1,61 +1,61 @@ -section .data -global _oEndScene -global _g_module_base_addr +section .data +global _oEndScene +global _g_module_base_addr _g_module_base_addr: - dd 0 + dd 0 _oEndScene: - dd 0 + dd 0 -section .text -extern _FreeLibraryAndExitThread@8 -extern _VirtualFree@12 -extern _GetModuleHandleA@4 -extern _GetD3D9Device@8 -extern _events_handle_keyboard -extern _memory_tramp_hook -extern _memory_patch -extern _hook_end_scene +section .text +extern _FreeLibraryAndExitThread@8 +extern _VirtualFree@12 +extern _GetModuleHandleA@4 +extern _GetD3D9Device@8 +extern _events_handle_keyboard +extern _memory_tramp_hook +extern _memory_patch +extern _hook_end_scene -global _MainThread@4 -_MainThread@4: ; 10002480 <_MainThread@4>: - push edi ; 10002480: 57 - push esi ; 10002481: 56 - push ebx ; 10002482: 53 - sub esp,0x200 ; 10002483: 81 ec 00 02 00 00 - mov dword [esp],0x0 ; 10002489: c7 04 24 00 00 00 00 - call _GetModuleHandleA@4 ; 10002490: ff 15 c4 80 00 10 - sub esp,0x4 ; 10002496: 83 ec 04 - lea edx,[esp+0x24] ; 10002499: 8d 54 24 24 - mov [_g_module_base_addr], eax ; 1000249d: a3 08 60 00 10 - xor eax,eax ; 100024a2: 31 c0 - mov word [esp+0x21],ax ; 100024a4: 66 89 44 24 21 - mov edi,edx ; 100024a9: 89 d7 - xor eax,eax ; 100024ab: 31 c0 - mov ecx,0x77 ; 100024ad: b9 77 00 00 00 - rep stosd ;dword [edi], eax ; 100024b2: f3 ab - mov dword [esp+0x4],0x1dc ; 100024b4: c7 44 24 04 dc 01 00 - ; 100024bb: 00 - mov dword [esp],edx ; 100024bc: 89 14 24 - mov dword [esp+0x1d],0x0 ; 100024bf: c7 44 24 1d 00 00 00 - ; 100024c6: 00 - mov byte [esp+0x23],0x0 ; 100024c7: c6 44 24 23 00 - xor edi,edi ; 100024cc: 31 ff - call _GetD3D9Device@8 ; 100024ce: e8 fd eb ff ff - lea ebx,[esp+0x1d] ; 100024d3: 8d 5c 24 1d - test eax,eax ; 100024d7: 85 c0 - jne hook ; 100024d9: 75 5d - ;lea esi,[esi+0x0] ; 100024db: 8d 74 26 00 +global _MainThread@4 +_MainThread@4: ; 10002480: <_MainThread@4>: + push edi ; 10002480: 57 + push esi ; 10002481: 56 + push ebx ; 10002482: 53 + sub esp,0x200 ; 10002483: 81 ec 00 02 00 00 + mov dword [esp],0x0 ; 10002489: c7 04 24 00 00 00 00 + call _GetModuleHandleA@4 ; 10002490: ff 15 c4 80 00 10 + sub esp,0x4 ; 10002496: 83 ec 04 + lea edx,[esp+0x24] ; 10002499: 8d 54 24 24 + mov [_g_module_base_addr], eax ; 1000249d: a3 08 60 00 10 + xor eax,eax ; 100024a2: 31 c0 + mov word [esp+0x21],ax ; 100024a4: 66 89 44 24 21 + mov edi,edx ; 100024a9: 89 d7 + xor eax,eax ; 100024ab: 31 c0 + mov ecx,0x77 ; 100024ad: b9 77 00 00 00 + rep stosd ;dword [edi], eax ; 100024b2: f3 ab + mov dword [esp+0x4],0x1dc ; 100024b4: c7 44 24 04 dc 01 00 + ; 100024bb: 00 + mov dword [esp],edx ; 100024bc: 89 14 24 + mov dword [esp+0x1d],0x0 ; 100024bf: c7 44 24 1d 00 00 00 + ; 100024c6: 00 + mov byte [esp+0x23],0x0 ; 100024c7: c6 44 24 23 00 + xor edi,edi ; 100024cc: 31 ff + call _GetD3D9Device@8 ; 100024ce: e8 fd eb ff ff + lea ebx,[esp+0x1d] ; 100024d3: 8d 5c 24 1d + test eax,eax ; 100024d7: 85 c0 + jne hook ; 100024d9: 75 5d + ;lea esi,[esi+0x0] ; 100024db: 8d 74 26 00 nop nop nop nop nop - nop ; 100024df: 90 + nop ; 100024df: 90 main_loop: - call _events_handle_keyboard ; 100024e0: e8 4b ef ff ff - test eax,eax ; 100024e5: 85 c0 - je main_loop ; 100024e7: 74 f7 + call _events_handle_keyboard ; 100024e0: e8 4b ef ff ff + test eax,eax ; 100024e5: 85 c0 + je main_loop ; 100024e7: 74 f7 nop nop nop @@ -64,41 +64,41 @@ main_loop: nop nop exit: - mov dword [esp+0x8],0x8000 ; 100024e9: c7 44 24 08 00 80 00 - ; 100024f0: 00 - mov dword [esp+0x4],0xc ; 100024f1: c7 44 24 04 0c 00 00 - ; 100024f8: 00 - mov dword [esp],edi ; 100024f9: 89 3c 24 - call _VirtualFree@12 ; 100024fc: ff 15 cc 80 00 10 - sub esp,0xc ; 10002502: 83 ec 0c - mov eax,dword [esp+0xcc] ; 10002505: 8b 84 24 cc 00 00 00 - mov dword [esp+0x4],ebx ; 1000250c: 89 5c 24 04 - mov dword [esp+0x8],0x7 ; 10002510: c7 44 24 08 07 00 00 - ; 10002517: 00 - mov dword [esp],eax ; 10002518: 89 04 24 - call _memory_patch ; 1000251b: e8 f0 01 00 00 - mov ebx,dword [esp+0x210] ; 10002520: 8b 9c 24 10 02 00 00 - mov dword [esp+0x4],0x0 ; 10002527: c7 44 24 04 00 00 00 - ; 1000252e: 00 - mov dword [esp],ebx ; 1000252f: 89 1c 24 - call _FreeLibraryAndExitThread@8 ; 10002532: ff 15 bc 80 00 10 + mov dword [esp+0x8],0x8000 ; 100024e9: c7 44 24 08 00 80 00 + ; 100024f0: 00 + mov dword [esp+0x4],0xc ; 100024f1: c7 44 24 04 0c 00 00 + ; 100024f8: 00 + mov dword [esp],edi ; 100024f9: 89 3c 24 + call _VirtualFree@12 ; 100024fc: ff 15 cc 80 00 10 + sub esp,0xc ; 10002502: 83 ec 0c + mov eax,dword [esp+0xcc] ; 10002505: 8b 84 24 cc 00 00 00 + mov dword [esp+0x4],ebx ; 1000250c: 89 5c 24 04 + mov dword [esp+0x8],0x7 ; 10002510: c7 44 24 08 07 00 00 + ; 10002517: 00 + mov dword [esp],eax ; 10002518: 89 04 24 + call _memory_patch ; 1000251b: e8 f0 01 00 00 + mov ebx,dword [esp+0x210] ; 10002520: 8b 9c 24 10 02 00 00 + mov dword [esp+0x4],0x0 ; 10002527: c7 44 24 04 00 00 00 + ; 1000252e: 00 + mov dword [esp],ebx ; 1000252f: 89 1c 24 + call _FreeLibraryAndExitThread@8 ; 10002532: ff 15 bc 80 00 10 nop nop nop hook: - mov edx,dword [esp+0xcc] ; 10002538: 8b 94 24 cc 00 00 00 - mov ecx,0x7 ; 1000253f: b9 07 00 00 00 - mov esi,edx ; 10002544: 89 d6 - mov edi,ebx ; 10002546: 89 df - rep movsb ;byte [edi], byte [esi] ; 10002548: f3 a4 - mov dword [esp+0x8],0x7 ; 1000254a: c7 44 24 08 07 00 00 - ; 10002551: 00 - mov dword [esp+0x4], _hook_end_scene ; 10002552: c7 44 24 04 50 10 00 - ; 10002559: 10 - mov dword [esp],edx ; 1000255a: 89 14 24 - call _memory_tramp_hook ; 1000255d: e8 9e 02 00 00 - mov [_oEndScene], eax ; 10002562: a3 04 60 00 10 - mov edi,eax ; 10002567: 89 c7 - jmp main_loop ; 10002569: e9 72 ff ff ff - nop ; 1000256e: 90 - nop ; 1000256f: 90 + mov edx,dword [esp+0xcc] ; 10002538: 8b 94 24 cc 00 00 00 + mov ecx,0x7 ; 1000253f: b9 07 00 00 00 + mov esi,edx ; 10002544: 89 d6 + mov edi,ebx ; 10002546: 89 df + rep movsb ;byte [edi], byte [esi] ; 10002548: f3 a4 + mov dword [esp+0x8],0x7 ; 1000254a: c7 44 24 08 07 00 00 + ; 10002551: 00 + mov dword [esp+0x4], _hook_end_scene ; 10002552: c7 44 24 04 50 10 00 + ; 10002559: 10 + mov dword [esp],edx ; 1000255a: 89 14 24 + call _memory_tramp_hook ; 1000255d: e8 9e 02 00 00 + mov [_oEndScene], eax ; 10002562: a3 04 60 00 10 + mov edi,eax ; 10002567: 89 c7 + jmp main_loop ; 10002569: e9 72 ff ff ff + nop ; 1000256e: 90 + nop ; 1000256f: 90 diff --git a/src/mem.c b/src/mem.c deleted file mode 100644 index 0f7a01f..0000000 --- a/src/mem.c +++ /dev/null @@ -1,89 +0,0 @@ -#include "mem.h" - -#include - -__attribute__((always_inline)) -uintptr_t memory_find_dynamic_address(uintptr_t ptr, uint16_t* offsets, size_t size) -{ - uintptr_t addr = ptr; - - for (size_t i = 0; i < size; i++) - { - addr = *(uintptr_t *)addr; - addr += offsets[i]; - - if (*(uintptr_t *)addr == 0) - { - return 0; - } - } - - return addr; -} - -__attribute__((always_inline)) -void memory_nop(void* dst, size_t size) -{ - DWORD oldprotect; - - VirtualProtect(dst, size, PAGE_EXECUTE_WRITECOPY, &oldprotect); - memset(dst, 0x90, size); - VirtualProtect(dst, size, oldprotect, &oldprotect); -} - -__attribute__((always_inline)) -void memory_patch(void* dst, const void* src, size_t size) -{ - DWORD oldprotect; - - VirtualProtect(dst, size, PAGE_EXECUTE_WRITECOPY, &oldprotect); - memcpy(dst, src, size); - VirtualProtect(dst, size, oldprotect, &oldprotect); -} - -__attribute__((always_inline)) -int memory_detour(void* targetFunc, void(* myFunc)(), size_t size) -{ - if (size < 5) - { - return FALSE; - } - - DWORD dwProtect; - VirtualProtect(targetFunc, size, PAGE_EXECUTE_READWRITE, &dwProtect); - - memset(targetFunc, 0x90, size); // memset nop - uintptr_t relative_addr = ((uintptr_t)myFunc - (uintptr_t)targetFunc) - 5; - - *(unsigned char *)targetFunc = 0xE9; // replace with jmp - *(uintptr_t *)((uintptr_t)targetFunc + 1) = relative_addr; - VirtualProtect(targetFunc, size, dwProtect, &dwProtect); - - return TRUE; -} - -__attribute__((always_inline)) -char* memory_tramp_hook(char* src, char* dst, size_t size) -{ - if (size < 5) - { - return 0; - } - - char* gateway = (char *)VirtualAlloc(0, size + 5, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); - memcpy(gateway, src, size); - - uintptr_t gateJmpAddress = (uintptr_t)(src - gateway - 5); - *(gateway + size) = (char)0xE9; - *(uintptr_t *)(gateway + size + 1) = gateJmpAddress; - - if (memory_detour(src, (void(*)())dst, size)) - { - return gateway; - } - else - { - VirtualFree(gateway, size+5, MEM_RELEASE); - return NULL; - } -} diff --git a/src/memory.asm b/src/memory.asm new file mode 100644 index 0000000..b515def --- /dev/null +++ b/src/memory.asm @@ -0,0 +1,327 @@ +section .text + +extern _VirtualProtect@16 +extern _VirtualAlloc@16 +extern _VirtualFree@12 +extern _memset +extern _memcpy + +global _memory_find_dynamic_address +global _memory_tramp_hook +global _memory_detour +global _memory_patch +global _memory_nop + +_memory_find_dynamic_address: + push esi ; 100025d0: 56 + push ebx ; 100025d1: 53 + mov esi,dword [esp+0x14] ; 100025d2: 8b 74 24 14 + mov ecx,dword [esp+0x10] ; 100025d6: 8b 4c 24 10 + mov eax,dword [esp+0xc] ; 100025da: 8b 44 24 0c + test esi,esi ; 100025de: 85 f6 + je dynamic_exit ; 100025e0: 0f 84 f3 00 00 00 + mov ebx,esi ; 100025e6: 89 f3 + mov eax,dword [eax] ; 100025e8: 8b 00 + xor edx,edx ; 100025ea: 31 d2 + and ebx,0x7 ; 100025ec: 83 e3 07 + je one_depth ; 100025ef: 74 7f + cmp ebx,0x1 ; 100025f1: 83 fb 01 + je two_depth ; 100025f4: 74 69 + cmp ebx,0x2 ; 100025f6: 83 fb 02 + je three_depth ; 100025f9: 74 58 + cmp ebx,0x3 ; 100025fb: 83 fb 03 + je four_depth ; 100025fe: 74 43 + cmp ebx,0x4 ; 10002600: 83 fb 04 + je five_depth ; 10002603: 74 2e + cmp ebx,0x5 ; 10002605: 83 fb 05 + je six_depth ; 10002608: 74 19 + cmp ebx,0x6 ; 1000260a: 83 fb 06 + jne e0_exit ; 1000260d: 0f 85 cd 00 00 00 +seven_depth: + movzx ebx,word [ecx+edx*2] ; 10002613: 0f b7 1c 51 + mov eax,dword [ebx+eax*1] ; 10002617: 8b 04 03 + test eax,eax ; 1000261a: 85 c0 + je dynamic_exit ; 1000261c: 0f 84 b7 00 00 00 + inc edx ; 10002622: 42 +six_depth: + movzx ebx,word [ecx+edx*2] ; 10002623: 0f b7 1c 51 + mov eax,dword [ebx+eax*1] ; 10002627: 8b 04 03 + test eax,eax ; 1000262a: 85 c0 + je dynamic_exit ; 1000262c: 0f 84 a7 00 00 00 + inc edx ; 10002632: 42 +five_depth: + movzx ebx,word [ecx+edx*2] ; 10002633: 0f b7 1c 51 + mov eax,dword [ebx+eax*1] ; 10002637: 8b 04 03 + test eax,eax ; 1000263a: 85 c0 + je dynamic_exit ; 1000263c: 0f 84 97 00 00 00 + inc edx ; 10002642: 42 +four_depth: + movzx ebx,word [ecx+edx*2] ; 10002643: 0f b7 1c 51 + mov eax,dword [ebx+eax*1] ; 10002647: 8b 04 03 + test eax,eax ; 1000264a: 85 c0 + je dynamic_exit ; 1000264c: 0f 84 87 00 00 00 + inc edx ; 10002652: 42 +three_depth: + movzx ebx,word [ecx+edx*2] ; 10002653: 0f b7 1c 51 + mov eax,dword [ebx+eax*1] ; 10002657: 8b 04 03 + test eax,eax ; 1000265a: 85 c0 + je dynamic_exit ; 1000265c: 74 7b + inc edx ; 1000265e: 42 +two_depth: + movzx ebx,word [ecx+edx*2] ; 1000265f: 0f b7 1c 51 + add ebx,eax ; 10002663: 01 c3 + mov eax,dword [ebx] ; 10002665: 8b 03 + test eax,eax ; 10002667: 85 c0 + je dynamic_exit ; 10002669: 74 6e + inc edx ; 1000266b: 42 + cmp esi,edx ; 1000266c: 39 d6 + je pre_dynamic_exit ; 1000266e: 74 67 +one_depth: + movzx ebx,word [ecx+edx*2] ; 10002670: 0f b7 1c 51 + mov eax,dword [ebx+eax*1] ; 10002674: 8b 04 03 + test eax,eax ; 10002677: 85 c0 + je dynamic_exit ; 10002679: 74 5e + movzx ebx,word [ecx+edx*2+0x2] ; 1000267b: 0f b7 5c 51 02 + mov eax,dword [ebx+eax*1] ; 10002680: 8b 04 03 + test eax,eax ; 10002683: 85 c0 + je dynamic_exit ; 10002685: 74 52 + movzx ebx,word [ecx+edx*2+0x4] ; 10002687: 0f b7 5c 51 04 + mov eax,dword [ebx+eax*1] ; 1000268c: 8b 04 03 + test eax,eax ; 1000268f: 85 c0 + je dynamic_exit ; 10002691: 74 46 + movzx ebx,word [ecx+edx*2+0x6] ; 10002693: 0f b7 5c 51 06 + mov eax,dword [ebx+eax*1] ; 10002698: 8b 04 03 + test eax,eax ; 1000269b: 85 c0 + je dynamic_exit ; 1000269d: 74 3a + movzx ebx,word [ecx+edx*2+0x8] ; 1000269f: 0f b7 5c 51 08 + mov eax,dword [ebx+eax*1] ; 100026a4: 8b 04 03 + test eax,eax ; 100026a7: 85 c0 + je dynamic_exit ; 100026a9: 74 2e + movzx ebx,word [ecx+edx*2+0xa] ; 100026ab: 0f b7 5c 51 0a + mov eax,dword [ebx+eax*1] ; 100026b0: 8b 04 03 + test eax,eax ; 100026b3: 85 c0 + je dynamic_exit ; 100026b5: 74 22 + movzx ebx,word [ecx+edx*2+0xc] ; 100026b7: 0f b7 5c 51 0c + mov eax,dword [ebx+eax*1] ; 100026bc: 8b 04 03 + test eax,eax ; 100026bf: 85 c0 + je dynamic_exit ; 100026c1: 74 16 + movzx ebx,word [ecx+edx*2+0xe] ; 100026c3: 0f b7 5c 51 0e + add ebx,eax ; 100026c8: 01 c3 + mov eax,dword [ebx] ; 100026ca: 8b 03 + test eax,eax ; 100026cc: 85 c0 + je dynamic_exit ; 100026ce: 74 09 + add edx,0x8 ; 100026d0: 83 c2 08 + cmp esi,edx ; 100026d3: 39 d6 + jne one_depth ; 100026d5: 75 99 +pre_dynamic_exit: + mov eax,ebx ; 100026d7: 89 d8 +dynamic_exit: + pop ebx ; 100026d9: 5b + pop esi ; 100026da: 5e + ret ; 100026db: c3 + lea esi,[esi+0x0] ; 100026dc: 8d 74 26 00 +e0_exit: + movzx edx,word [ecx] ; 100026e0: 0f b7 11 + mov eax,dword [edx+eax*1] ; 100026e3: 8b 04 02 + test eax,eax ; 100026e6: 85 c0 + je dynamic_exit ; 100026e8: 74 ef + mov edx,0x1 ; 100026ea: ba 01 00 00 00 + jmp seven_depth ; 100026ef: e9 1f ff ff ff + lea esi,[esi+0x0] ; 100026f4: 8d b4 26 00 00 00 00 + lea esi,[esi+0x0] ; 100026fb: 8d 74 26 00 + nop ; 100026ff: 90 + +_memory_nop: ; 10002700: <_memory_nop> + push ebp ; 10002700: 55 + push edi ; 10002701: 57 + push esi ; 10002702: 56 + push ebx ; 10002703: 53 + sub esp,0x2c ; 10002704: 83 ec 2c + mov ebx,dword [esp+0x40] ; 10002707: 8b 5c 24 40 + mov esi,dword [esp+0x44] ; 1000270b: 8b 74 24 44 + lea ebp,[esp+0x1c] ; 1000270f: 8d 6c 24 1c + mov dword [esp+0xc],ebp ; 10002713: 89 6c 24 0c + mov dword [esp+0x4],esi ; 10002717: 89 74 24 04 + mov dword [esp],ebx ; 1000271b: 89 1c 24 + mov dword [esp+0x8],0x80 ; 1000271e: c7 44 24 08 80 00 00 + ; 10002725: 00 + mov edi,_VirtualProtect@16 ; 10002726: 8b 3d d0 80 00 10 + call edi ; 1000272c: ff d7 + sub esp,0x10 ; 1000272e: 83 ec 10 + mov dword [esp+0x8],esi ; 10002731: 89 74 24 08 + mov dword [esp],ebx ; 10002735: 89 1c 24 + mov dword [esp+0x4],0x90 ; 10002738: c7 44 24 04 90 00 00 + ; 1000273f: 00 + call _memset ; 10002740: e8 8b 05 00 00 + mov eax,dword [esp+0x1c] ; 10002745: 8b 44 24 1c + mov dword [esp+0xc],ebp ; 10002749: 89 6c 24 0c + mov dword [esp+0x4],esi ; 1000274d: 89 74 24 04 + mov dword [esp],ebx ; 10002751: 89 1c 24 + mov dword [esp+0x8],eax ; 10002754: 89 44 24 08 + call edi ; 10002758: ff d7 + sub esp,0x10 ; 1000275a: 83 ec 10 + add esp,0x2c ; 1000275d: 83 c4 2c + pop ebx ; 10002760: 5b + pop esi ; 10002761: 5e + pop edi ; 10002762: 5f + pop ebp ; 10002763: 5d + ret ; 10002764: c3 + lea esi,[esi+0x0] ; 10002765: 8d b4 26 00 00 00 00 + lea esi,[esi+0x0] ; 1000276c: 8d 74 26 00 + +_memory_patch: ; 10002770: <_memory_patch> + push ebp ; 10002770: 55 + push edi ; 10002771: 57 + push esi ; 10002772: 56 + push ebx ; 10002773: 53 + sub esp,0x2c ; 10002774: 83 ec 2c + mov ebx,dword [esp+0x40] ; 10002777: 8b 5c 24 40 + mov esi,dword [esp+0x48] ; 1000277b: 8b 74 24 48 + lea ebp,[esp+0x1c] ; 1000277f: 8d 6c 24 1c + mov dword [esp+0xc],ebp ; 10002783: 89 6c 24 0c + mov dword [esp+0x4],esi ; 10002787: 89 74 24 04 + mov dword [esp],ebx ; 1000278b: 89 1c 24 + mov dword [esp+0x8],0x80 ; 1000278e: c7 44 24 08 80 00 00 + ; 10002795: 00 + mov edi,_VirtualProtect@16 ; 10002796: 8b 3d d0 80 00 10 + call edi ; 1000279c: ff d7 + sub esp,0x10 ; 1000279e: 83 ec 10 + mov eax,dword [esp+0x44] ; 100027a1: 8b 44 24 44 + mov dword [esp+0x8],esi ; 100027a5: 89 74 24 08 + mov dword [esp],ebx ; 100027a9: 89 1c 24 + mov dword [esp+0x4],eax ; 100027ac: 89 44 24 04 + call _memcpy ; 100027b0: e8 23 05 00 00 + mov edx,dword [esp+0x1c] ; 100027b5: 8b 54 24 1c + mov dword [esp+0xc],ebp ; 100027b9: 89 6c 24 0c + mov dword [esp+0x4],esi ; 100027bd: 89 74 24 04 + mov dword [esp],ebx ; 100027c1: 89 1c 24 + mov dword [esp+0x8],edx ; 100027c4: 89 54 24 08 + call edi ; 100027c8: ff d7 + sub esp,0x10 ; 100027ca: 83 ec 10 + add esp,0x2c ; 100027cd: 83 c4 2c + pop ebx ; 100027d0: 5b + pop esi ; 100027d1: 5e + pop edi ; 100027d2: 5f + pop ebp ; 100027d3: 5d + ret ; 100027d4: c3 + lea esi,[esi+0x0] ; 100027d5: 8d b4 26 00 00 00 00 + lea esi,[esi+0x0] ; 100027dc: 8d 74 26 00 + +_memory_detour: ; 100027e0: <_memory_detour> + push ebp ; 100027e0: 55 + xor eax,eax ; 100027e1: 31 c0 + push edi ; 100027e3: 57 + push esi ; 100027e4: 56 + push ebx ; 100027e5: 53 + sub esp,0x2c ; 100027e6: 83 ec 2c + mov esi,dword [esp+0x48] ; 100027e9: 8b 74 24 48 + mov ebx,dword [esp+0x40] ; 100027ed: 8b 5c 24 40 + cmp esi,0x4 ; 100027f1: 83 fe 04 + jbe detour_exit ; 100027f4: 76 62 + lea ebp,[esp+0x1c] ; 100027f6: 8d 6c 24 1c + mov dword [esp+0xc],ebp ; 100027fa: 89 6c 24 0c + mov dword [esp+0x8],0x40 ; 100027fe: c7 44 24 08 40 00 00 + ; 10002805: 00 + mov dword [esp+0x4],esi ; 10002806: 89 74 24 04 + mov dword [esp],ebx ; 1000280a: 89 1c 24 + mov edi,_VirtualProtect@16 ; 1000280d: 8b 3d d0 80 00 10 + call edi ; 10002813: ff d7 + sub esp,0x10 ; 10002815: 83 ec 10 + mov dword [esp+0x8],esi ; 10002818: 89 74 24 08 + mov dword [esp+0x4],0x90 ; 1000281c: c7 44 24 04 90 00 00 + ; 10002823: 00 + mov dword [esp],ebx ; 10002824: 89 1c 24 + call _memset ; 10002827: e8 a4 04 00 00 + mov eax,dword [esp+0x44] ; 1000282c: 8b 44 24 44 + mov edx,dword [esp+0x1c] ; 10002830: 8b 54 24 1c + sub eax,0x5 ; 10002834: 83 e8 05 + sub eax,ebx ; 10002837: 29 d8 + mov byte [ebx],0xe9 ; 10002839: c6 03 e9 + mov dword [ebx+0x1],eax ; 1000283c: 89 43 01 + mov dword [esp+0xc],ebp ; 1000283f: 89 6c 24 0c + mov dword [esp+0x8],edx ; 10002843: 89 54 24 08 + mov dword [esp+0x4],esi ; 10002847: 89 74 24 04 + mov dword [esp],ebx ; 1000284b: 89 1c 24 + call edi ; 1000284e: ff d7 + sub esp,0x10 ; 10002850: 83 ec 10 + mov eax,0x1 ; 10002853: b8 01 00 00 00 +detour_exit: + add esp,0x2c ; 10002858: 83 c4 2c + pop ebx ; 1000285b: 5b + pop esi ; 1000285c: 5e + pop edi ; 1000285d: 5f + pop ebp ; 1000285e: 5d + ret ; 1000285f: c3 + +_memory_tramp_hook: ; 10002830: <_memory_tramp_hook>: + push ebp ; 10002830: 55 + push edi ; 10002831: 57 + push esi ; 10002832: 56 + push ebx ; 10002833: 53 + xor ebx,ebx ; 10002834: 31 db + sub esp,0x1c ; 10002836: 83 ec 1c + mov esi,dword [esp+0x38] ; 10002839: 8b 74 24 38 + mov edi,dword [esp+0x30] ; 1000283d: 8b 7c 24 30 + cmp esi,0x4 ; 10002841: 83 fe 04 + jbe tramp_exit ; 10002844: 76 60 + lea ebp,[esi+0x5] ; 10002846: 8d 6e 05 + mov dword [esp+0xc],0x40 ; 10002849: c7 44 24 0c 40 00 00 + ; 10002850: 00 + mov dword [esp+0x8],0x3000 ; 10002851: c7 44 24 08 00 30 00 + ; 10002858: 00 + mov dword [esp+0x4],ebp ; 10002859: 89 6c 24 04 + mov dword [esp],0x0 ; 1000285d: c7 04 24 00 00 00 00 + call _VirtualAlloc@16 ; 10002864: ff 15 c8 80 00 10 + sub esp,0x10 ; 1000286a: 83 ec 10 + mov dword [esp+0x8],esi ; 1000286d: 89 74 24 08 + mov dword [esp+0x4],edi ; 10002871: 89 7c 24 04 + mov dword [esp],eax ; 10002875: 89 04 24 + mov ebx,eax ; 10002878: 89 c3 + call _memcpy ; 1000287a: e8 29 04 00 00 + mov eax,edi ; 1000287f: 89 f8 + sub eax,ebx ; 10002881: 29 d8 + mov edx,dword [esp+0x34] ; 10002883: 8b 54 24 34 + sub eax,0x5 ; 10002887: 83 e8 05 + mov byte [ebx+esi*1],0xe9 ; 1000288a: c6 04 33 e9 + mov dword [ebx+esi*1+0x1],eax ; 1000288e: 89 44 33 01 + mov dword [esp+0x8],esi ; 10002892: 89 74 24 08 + mov dword [esp+0x4],edx ; 10002896: 89 54 24 04 + mov dword [esp],edi ; 1000289a: 89 3c 24 + call _memory_detour ; 1000289d: e8 3e ed ff ff + test eax,eax ; 100028a2: 85 c0 + je detour_fail_exit ; 100028a4: 74 0a +tramp_exit: + add esp,0x1c ; 100028a6: 83 c4 1c + mov eax,ebx ; 100028a9: 89 d8 + pop ebx ; 100028ab: 5b + pop esi ; 100028ac: 5e + pop edi ; 100028ad: 5f + pop ebp ; 100028ae: 5d + ret ; 100028af: c3 +detour_fail_exit: + mov dword [esp+0x4],ebp ; 100028b0: 89 6c 24 04 + mov dword [esp],ebx ; 100028b4: 89 1c 24 + mov dword [esp+0x8],0x8000 ; 100028b7: c7 44 24 08 00 80 00 + ; 100028be: 00 + xor ebx,ebx ; 100028bf: 31 db + call _VirtualFree@12 ; 100028c1: ff 15 cc 80 00 10 + sub esp,0xc ; 100028c7: 83 ec 0c + add esp,0x1c ; 100028ca: 83 c4 1c + mov eax,ebx ; 100028cd: 89 d8 + pop ebx ; 100028cf: 5b + pop esi ; 100028d0: 5e + pop edi ; 100028d1: 5f + pop ebp ; 100028d2: 5d + ret ; 100028d3: c3 + nop ; 100028d4: 90 + nop ; 100028d5: 90 + nop ; 100028d6: 90 + nop ; 100028d7: 90 + nop ; 100028d8: 90 + nop ; 100028d9: 90 + nop ; 100028da: 90 + nop ; 100028db: 90 + nop ; 100028dc: 90 + nop ; 100028dd: 90 + nop ; 100028de: 90 + nop ; 100028df: 90 diff --git a/src/render.asm b/src/render.asm new file mode 100644 index 0000000..8827324 --- /dev/null +++ b/src/render.asm @@ -0,0 +1,259 @@ +section .data +global _g_resolution +global _g_maximized +global _g_coordinates +global _g_hack_menu +global _coordinates_x +global _coordinates_y + +_g_resolution: + dd 0 +_g_maximized: + dd 1 +_g_hack_menu: + times 408 db 0 +_g_coordinates: +_coordinates_x: + dw 30 +_coordinates_y: + dw 25 + +section .text +extern _drawing_draw_filled_rect +extern _drawing_draw_border_box + +global _render_menu@4 +_render_menu@4: ; 100028e0: <_render_menu@4> + push ebp ; 100028e0: 55 + push edi ; 100028e1: 57 + push esi ; 100028e2: 56 + push ebx ; 100028e3: 53 + sub esp,0x2c ; 100028e4: 83 ec 2c + mov ecx,[_g_maximized] ; 100028e7: 8b 0d 54 30 00 10 + mov eax,ds:0x9d2a8 ; 100028ed: a1 a8 d2 09 00 + mov ebx,dword [esp+0x40] ; 100028f2: 8b 5c 24 40 + test ecx,ecx ; 100028f6: 85 c9 + mov [_g_resolution], eax ; 100028f8: a3 98 61 00 10 + mov dword [esp+0x14],ebx ; 100028fd: 89 5c 24 14 + mov dword [esp+0x10],0xff191919 ; 10002901: c7 44 24 10 19 19 19 + ; 10002908: ff + je render_minimized ; 10002909: 0f 84 c1 01 00 00 + movzx ecx, word [_coordinates_y] ; 1000290f: 0f b7 0d 52 30 00 10 S + movzx edi, word [_coordinates_x] ; 10002916: 0f b7 3d 50 30 00 10 + mov dword [esp+0x4],ecx ; 1000291d: 89 4c 24 04 + mov dword [esp],edi ; 10002921: 89 3c 24 + mov dword [esp+0xc],0x64 ; 10002924: c7 44 24 0c 64 00 00 + ; 1000292b: 00 + mov dword [esp+0x8],0x8c ; 1000292c: c7 44 24 08 8c 00 00 + ; 10002933: 00 + mov edi,0x14 ; 10002934: bf 14 00 00 00 + call _drawing_draw_filled_rect ; 10002939: e8 29 ea ff ff + movzx esi, word [_coordinates_y] ; 1000293e: 0f b7 35 52 30 00 10 + movzx edx, word [_coordinates_x] ; 10002945: 0f b7 15 50 30 00 10 + mov dword [esp+0x4],esi ; 1000294c: 89 74 24 04 + mov dword [esp+0x18],ebx ; 10002950: 89 5c 24 18 + mov dword [esp+0x14],0xff000000 ; 10002954: c7 44 24 14 00 00 00 + ; 1000295b: ff + mov dword [esp+0x10],0x4 ; 1000295c: c7 44 24 10 04 00 00 + ; 10002963: 00 + mov dword [esp+0xc],0x64 ; 10002964: c7 44 24 0c 64 00 00 + ; 1000296b: 00 + mov dword [esp+0x8],0x8c ; 1000296c: c7 44 24 08 8c 00 00 + ; 10002973: 00 + mov dword [esp],edx ; 10002974: 89 14 24 + mov esi,_g_hack_menu ; 10002977: be 00 60 00 10 + mov ebp,esi ; 1000297c: 89 f5 + call _drawing_draw_border_box ; 1000297e: e8 5d e8 ff ff +top_menu_max: + cmp dword [ebp+0xcc],0x1 ; 10002983: 83 bd cc 00 00 00 01 + sbb eax,eax ; 1000298a: 19 c0 + movzx ecx, word [_coordinates_y] ; 1000298c: 0f b7 0d 52 30 00 10 + movzx edx, word [_coordinates_x] ; 10002993: 0f b7 15 50 30 00 10 + and eax,0x458846 ; 1000299a: 25 46 88 45 00 + add edx,edi ; 1000299f: 01 fa + sub eax,0xf537f6 ; 100029a1: 2d f6 37 f5 00 + add ecx,0xf ; 100029a6: 83 c1 0f + mov dword [esp+0x10],eax ; 100029a9: 89 44 24 10 + mov dword [esp+0x4],ecx ; 100029ad: 89 4c 24 04 + mov dword [esp],edx ; 100029b1: 89 14 24 + mov dword [esp+0x14],ebx ; 100029b4: 89 5c 24 14 + mov dword [esp+0xc],0x14 ; 100029b8: c7 44 24 0c 14 00 00 + ; 100029bf: 00 + mov dword [esp+0x8],0x19 ; 100029c0: c7 44 24 08 19 00 00 + ; 100029c7: 00 + add ebp,0x44 ; 100029c8: 83 c5 44 + call _drawing_draw_filled_rect ; 100029cb: e8 97 e9 ff ff + movzx eax, word [_coordinates_y] ; 100029d0: 0f b7 05 52 30 00 10 + movzx ecx, word [_coordinates_x] ; 100029d7: 0f b7 0d 50 30 00 10 + add eax,0xf ; 100029de: 83 c0 0f + add ecx,edi ; 100029e1: 01 f9 + mov dword [esp+0x18],ebx ; 100029e3: 89 5c 24 18 + mov dword [esp+0x14],0xff000000 ; 100029e7: c7 44 24 14 00 00 00 + ; 100029ee: ff + mov dword [esp+0x10],0x2 ; 100029ef: c7 44 24 10 02 00 00 + ; 100029f6: 00 + mov dword [esp+0xc],0x14 ; 100029f7: c7 44 24 0c 14 00 00 + ; 100029fe: 00 + mov dword [esp+0x8],0x19 ; 100029ff: c7 44 24 08 19 00 00 + ; 10002a06: 00 + mov dword [esp+0x4],eax ; 10002a07: 89 44 24 04 + mov dword [esp],ecx ; 10002a0b: 89 0c 24 + add edi,0x28 ; 10002a0e: 83 c7 28 + call _drawing_draw_border_box ; 10002a11: e8 ca e7 ff ff + cmp edi,0x8c ; 10002a16: 81 ff 8c 00 00 00 + jne top_menu_max ; 10002a1c: 0f 85 61 ff ff ff + mov ebp,0x14 ; 10002a22: bd 14 00 00 00 +bottom_menu_max: + cmp dword [esi],0x1 ; 10002a27: 83 3e 01 + sbb edi,edi ; 10002a2a: 19 ff + movzx edx, word [_coordinates_y] ; 10002a2c: 0f b7 15 52 30 00 10 + movzx eax, word [_coordinates_x] ; 10002a33: 0f b7 05 50 30 00 10 + and edi,0x458846 ; 10002a3a: 81 e7 46 88 45 00 + add eax,ebp ; 10002a40: 01 e8 + add edx,0x37 ; 10002a42: 83 c2 37 + sub edi,0xf537f6 ; 10002a45: 81 ef f6 37 f5 00 + mov dword [esp+0x10],edi ; 10002a4b: 89 7c 24 10 + mov dword [esp+0x4],edx ; 10002a4f: 89 54 24 04 + mov dword [esp],eax ; 10002a53: 89 04 24 + mov dword [esp+0x14],ebx ; 10002a56: 89 5c 24 14 + mov dword [esp+0xc],0x14 ; 10002a5a: c7 44 24 0c 14 00 00 + ; 10002a61: 00 + mov dword [esp+0x8],0x19 ; 10002a62: c7 44 24 08 19 00 00 + ; 10002a69: 00 + add esi,0x44 ; 10002a6a: 83 c6 44 + call _drawing_draw_filled_rect ; 10002a6d: e8 f5 e8 ff ff + movzx ecx, word [_coordinates_y] ; 10002a72: 0f b7 0d 52 30 00 10 + movzx edi, word [_coordinates_x] ; 10002a79: 0f b7 3d 50 30 00 10 + add ecx,0x37 ; 10002a80: 83 c1 37 + add edi,ebp ; 10002a83: 01 ef + mov dword [esp+0x18],ebx ; 10002a85: 89 5c 24 18 + mov dword [esp+0x14],0xff000000 ; 10002a89: c7 44 24 14 00 00 00 + ; 10002a90: ff + mov dword [esp+0x10],0x2 ; 10002a91: c7 44 24 10 02 00 00 + ; 10002a98: 00 + mov dword [esp+0xc],0x14 ; 10002a99: c7 44 24 0c 14 00 00 + ; 10002aa0: 00 + mov dword [esp+0x8],0x19 ; 10002aa1: c7 44 24 08 19 00 00 + ; 10002aa8: 00 + mov dword [esp+0x4],ecx ; 10002aa9: 89 4c 24 04 + mov dword [esp],edi ; 10002aad: 89 3c 24 + add ebp,0x28 ; 10002ab0: 83 c5 28 + call _drawing_draw_border_box ; 10002ab3: e8 28 e7 ff ff + cmp ebp,0x8c ; 10002ab8: 81 fd 8c 00 00 00 + jne bottom_menu_max ; 10002abe: 0f 85 63 ff ff ff +not_a_clue: + add esp,0x2c ; 10002ac4: 83 c4 2c + pop ebx ; 10002ac7: 5b + pop esi ; 10002ac8: 5e + pop edi ; 10002ac9: 5f + pop ebp ; 10002aca: 5d + ret 0x4 ; 10002acb: c2 04 00 + xchg ax,ax ; 10002ace: 66 90 +render_minimized: + mov dword [esp+0xc],0x19 ; 10002ad0: c7 44 24 0c 19 00 00 + ; 10002ad7: 00 + mov dword [esp+0x8],0x23 ; 10002ad8: c7 44 24 08 23 00 00 + ; 10002adf: 00 + mov dword [esp+0x4],0x14 ; 10002ae0: c7 44 24 04 14 00 00 + ; 10002ae7: 00 + mov dword [esp],0x1e ; 10002ae8: c7 04 24 1e 00 00 00 + mov edi,0x10006000 ; 10002aef: bf 00 60 00 10 + mov ebp,edi ; 10002af4: 89 fd + call _drawing_draw_filled_rect ; 10002af6: e8 6c e8 ff ff + mov dword [esp+0x18],ebx ; 10002afb: 89 5c 24 18 + mov dword [esp+0x14],0xff000000 ; 10002aff: c7 44 24 14 00 00 00 + ; 10002b06: ff + mov dword [esp+0x10],0x2 ; 10002b07: c7 44 24 10 02 00 00 + ; 10002b0e: 00 + mov dword [esp+0xc],0x19 ; 10002b0f: c7 44 24 0c 19 00 00 + ; 10002b16: 00 + mov dword [esp+0x8],0x23 ; 10002b17: c7 44 24 08 23 00 00 + ; 10002b1e: 00 + mov dword [esp+0x4],0x14 ; 10002b1f: c7 44 24 04 14 00 00 + ; 10002b26: 00 + mov dword [esp],0x1e ; 10002b27: c7 04 24 1e 00 00 00 + mov esi,0x23 ; 10002b2e: be 23 00 00 00 + call _drawing_draw_border_box ; 10002b33: e8 a8 e6 ff ff +idek: + mov edx,dword [ebp+0xcc] ; 10002b38: 8b 95 cc 00 00 00 + mov dword [esp+0x14],ebx ; 10002b3e: 89 5c 24 14 + test edx,edx ; 10002b42: 85 d2 + je inactive_color ; 10002b44: 0f 84 f6 00 00 00 + mov dword [esp+0x10],0xff0ac80a ; 10002b4a: c7 44 24 10 0a c8 0a + ; 10002b51: ff +jmp_2b52: + mov dword [esp],esi ; 10002b52: 89 34 24 + mov dword [esp+0xc],0x5 ; 10002b55: c7 44 24 0c 05 00 00 + ; 10002b5c: 00 + mov dword [esp+0x8],0x5 ; 10002b5d: c7 44 24 08 05 00 00 + ; 10002b64: 00 + mov dword [esp+0x4],0x19 ; 10002b65: c7 44 24 04 19 00 00 + ; 10002b6c: 00 + add ebp,0x44 ; 10002b6d: 83 c5 44 + call _drawing_draw_filled_rect ; 10002b70: e8 f2 e7 ff ff + mov dword [esp],esi ; 10002b75: 89 34 24 + mov dword [esp+0x18],ebx ; 10002b78: 89 5c 24 18 + mov dword [esp+0x14],0xff000000 ; 10002b7c: c7 44 24 14 00 00 00 + ; 10002b83: ff + mov dword [esp+0x10],0x1 ; 10002b84: c7 44 24 10 01 00 00 + ; 10002b8b: 00 + mov dword [esp+0xc],0x5 ; 10002b8c: c7 44 24 0c 05 00 00 + ; 10002b93: 00 + mov dword [esp+0x8],0x5 ; 10002b94: c7 44 24 08 05 00 00 + ; 10002b9b: 00 + mov dword [esp+0x4],0x19 ; 10002b9c: c7 44 24 04 19 00 00 + ; 10002ba3: 00 + add esi,0xa ; 10002ba4: 83 c6 0a + call _drawing_draw_border_box ; 10002ba7: e8 34 e6 ff ff + cmp esi,0x41 ; 10002bac: 83 fe 41 + jne idek ; 10002baf: 75 87 + mov eax,dword [edi] ; 10002bb1: 8b 07 + mov ebp,0x23 ; 10002bb3: bd 23 00 00 00 + test eax,eax ; 10002bb8: 85 c0 + mov dword [esp+0x14],ebx ; 10002bba: 89 5c 24 14 + je inactive_color_2 ; 10002bbe: 74 75 +jmp_2bc0: + mov dword [esp+0x10],0xff0ac80a ; 10002bc0: c7 44 24 10 0a c8 0a + ; 10002bc7: ff +jmp_2bc8: + mov dword [esp],ebp ; 10002bc8: 89 2c 24 + mov dword [esp+0xc],0x5 ; 10002bcb: c7 44 24 0c 05 00 00 + ; 10002bd2: 00 + mov dword [esp+0x8],0x5 ; 10002bd3: c7 44 24 08 05 00 00 + ; 10002bda: 00 + mov dword [esp+0x4],0x23 ; 10002bdb: c7 44 24 04 23 00 00 + ; 10002be2: 00 + add edi,0x44 ; 10002be3: 83 c7 44 + call _drawing_draw_filled_rect ; 10002be6: e8 7c e7 ff ff + mov dword [esp],ebp ; 10002beb: 89 2c 24 + mov dword [esp+0x18],ebx ; 10002bee: 89 5c 24 18 + mov dword [esp+0x14],0xff000000 ; 10002bf2: c7 44 24 14 00 00 00 + ; 10002bf9: ff + mov dword [esp+0x10],0x1 ; 10002bfa: c7 44 24 10 01 00 00 + ; 10002c01: 00 + mov dword [esp+0xc],0x5 ; 10002c02: c7 44 24 0c 05 00 00 + ; 10002c09: 00 + mov dword [esp+0x8],0x5 ; 10002c0a: c7 44 24 08 05 00 00 + ; 10002c11: 00 + mov dword [esp+0x4],0x23 ; 10002c12: c7 44 24 04 23 00 00 + ; 10002c19: 00 + add ebp,0xa ; 10002c1a: 83 c5 0a + call _drawing_draw_border_box ; 10002c1d: e8 be e5 ff ff + cmp ebp,0x41 ; 10002c22: 83 fd 41 + je not_a_clue ; 10002c25: 0f 84 99 fe ff ff + mov eax,dword [edi] ; 10002c2b: 8b 07 + mov dword [esp+0x14],ebx ; 10002c2d: 89 5c 24 14 + test eax,eax ; 10002c31: 85 c0 + jne jmp_2bc0 ; 10002c33: 75 8b +inactive_color_2: + mov dword [esp+0x10],0xff505050 ; 10002c35: c7 44 24 10 50 50 50 + ; 10002c3c: ff + jmp jmp_2bc8 ; 10002c3d: eb 89 + nop ; 10002c3f: 90 +inactive_color: + mov dword [esp+0x10],0xff505050 ; 10002c40: c7 44 24 10 50 50 50 + ; 10002c47: ff + jmp jmp_2b52 ; 10002c48: e9 05 ff ff ff + nop ; 10002c4d: 90 + nop ; 10002c4e: 90 + nop ; 10002c4f: 90 diff --git a/src/render.c b/src/render.c deleted file mode 100644 index e089218..0000000 --- a/src/render.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "render.h" - -#include "assembly.h" -#include "hacks.h" - -int g_maximized = 1; -Resolution g_resolution = { 0, 0 }; -Coordinates g_coordinates = { 30, 25 }; -HackMenu g_hack_menu[MAX_MENU_ITEMS] = { 0 }; - -static const D3DCOLOR c_light_grey = D3DCOLOR_ARGB( 255, 80, 80, 80 ); -static const D3DCOLOR c_dark_grey = D3DCOLOR_ARGB( 255, 25, 25, 25 ); -static const D3DCOLOR c_black = D3DCOLOR_ARGB( 255, 0, 0, 0 ); -static const D3DCOLOR c_neon_green = D3DCOLOR_ARGB( 255, 10, 200, 10 ); - -void -WINAPI -render_menu(IDirect3DDevice9* d3dDevice) -{ - g_resolution = *((Resolution *)(0x0009D2A8)); - - float factor = 1.0; - if (g_maximized) - { - // Title Template - drawing_draw_filled_rect(g_coordinates.x, g_coordinates.y, 140, 100, c_dark_grey, d3dDevice); - drawing_draw_border_box(g_coordinates.x, g_coordinates.y, 140, 100, 4, c_black, d3dDevice); - - // Row one - int x1 = 20; - int y1 = 15; - for (int i = 3; i < MAX_MENU_ITEMS; i++) - { - // If hack is on we display the text colour in green - drawing_draw_filled_rect(g_coordinates.x + x1, g_coordinates.y + y1, 25, 20, g_hack_menu[i].bEnabled ? c_neon_green : c_light_grey, d3dDevice); - drawing_draw_border_box(g_coordinates.x + x1, g_coordinates.y + y1, 25, 20, 2, c_black, d3dDevice); - - //used to position the next item below - x1 += 40; - } - // Row two - int x2 = 20; - int y2 = 55; - for (int i = 0; i < MAX_MENU_ITEMS - 3; i++) - { - // If hack is on we display the text colour in green - drawing_draw_filled_rect(g_coordinates.x + x2, g_coordinates.y + y2, 25, 20, g_hack_menu[i].bEnabled ? c_neon_green : c_light_grey, d3dDevice); - drawing_draw_border_box(g_coordinates.x + x2, g_coordinates.y + y2, 25, 20, 2, c_black, d3dDevice); - - //used to position the next item - x2 += 40; - } - } - else - { - factor = 0.25; - // Title Template - drawing_draw_filled_rect(30, 20, (int)(factor*140), (int)(factor*100), c_dark_grey, d3dDevice); - drawing_draw_border_box(30, 20, (int)(factor*140), (int)(factor*100), 2, c_black, d3dDevice); - - // Row one - int x1 = 35; - int y1 = 25; - for (int i = 3; i < MAX_MENU_ITEMS; i++) - { - // If hack is on we display the text colour in green - drawing_draw_filled_rect(x1, y1, (int)(factor*20), (int)(factor*20), g_hack_menu[i].bEnabled ? c_neon_green : c_light_grey, d3dDevice); - drawing_draw_border_box(x1, y1, (int)(factor*20), (int)(factor*20), 1, c_black, d3dDevice); - - //used to position the next item below - x1 += (int)(factor*40); - } - // Row two - int x2 = 35; - int y2 = 35; - for (int i = 0; i < MAX_MENU_ITEMS - 3; i++) - { - // If hack is on we display the text colour in green - drawing_draw_filled_rect(x2, y2, (int)(factor*20), (int)(factor*20), g_hack_menu[i].bEnabled ? c_neon_green : c_light_grey, d3dDevice); - drawing_draw_border_box(x2, y2, (int)(factor*20), (int)(factor*20), 1, c_black, d3dDevice); - - //used to position the next item - x2 += (int)(factor*40); - } - } -}