.386 .model flat, stdcall option casemap :none include \masm32\include\msvcrt.inc include \masm32\include\kernel32.inc include \masm32\include\user32.inc include \masm32\include\masm32.inc includelib \masm32\lib\msvcrt.lib includelib \masm32\lib\masm32.lib includelib \masm32\lib\kernel32.lib includelib \masm32\lib\user32.lib include PS3.inc system equ <_imp__system> .data str_connecting db "Connecting to PS3...", 0Ah, 0 str_con_s db "Successfully connected", 0Ah, 0 str_con_f db "Failed to connect", 0Ah, 0 str_atc_s db "Successfully attached", 0Ah, 0 str_atc_f db "Failed to attach", 0Ah, 0 game_target dd 0FFFFFFFEh game_proc_id dd 0 game_pucount dd 0 buttons_addr dd 1FC7C90h textstate_addr dd 2057217h textstr_addr dd 2056B04h mem_input dd ? mem_output dd ? og_menu_text db "~g~Menu Title!", 0Ah, 0Ah, "~w~God Mode |~w~Super Jump |~w~Unlimited Ammo |~w~Option 4 |~w~Option 5", 0 menu_text db "~g~Menu Title!", 0Ah, 0Ah, "~w~God Mode |~w~Super Jump |~w~Unlimited Ammo |~w~Option 4 |~w~Option 5", 0 menu_option dd 0 menu_option_count dd 0 menu_isopen db 0 str_button_x db "Pressed Square", 0Ah, 0 str_button_up db "Pressed Up", 0Ah, 0 str_button_down db "Pressed Down", 0Ah, 0 str_button_a db "Pressed Cross", 0Ah, 0 str_opened_menu db "Opened menu", 0Ah, 0 str_closed_menu db "Closed menu", 0Ah, 0 godmode_bytes db 038h, 060h, 07Fh, 0FFh, 0B0h, 07Fh, 0h, 0B4h nop_bytes db 060h, 0, 0, 0 ammo1_bytes db 03Bh, 0A0h, 003h, 0E7h ammo2_bytes db 038h, 0E0h, 000h, 063h .code Main: _ConnectPS3: push offset str_connecting call StdOut call SNPS3InitTargetComms push 0 push game_target call SNPS3Connect cmp eax, 0 je _con_success cmp eax, 6 je _con_success push offset str_con_f call StdOut jmp _Exit _con_success: push offset str_con_s call StdOut push offset game_proc_id push offset game_pucount push game_target call SNPS3ProcessList push offset game_proc_id push offset game_pucount push game_target call SNPS3ProcessList push game_proc_id push 0 push game_target call SNPS3ProcessAttach cmp eax, 0 je _atc_success push offset str_atc_f call StdOut jmp _Exit _atc_success: push offset str_atc_s call StdOut push game_proc_id push game_target call SNPS3ProcessContinue _looop: call MenuMonitor push 100 call Sleep jmp _looop _Exit: push 0 call ExitProcess DrawMenu proc _input mov eax, -1 mov ebx, lengthof menu_text mov ecx, 0 _loop: inc eax cmp eax, ebx je _end cmp byte ptr [og_menu_text+eax], '~' jne _next cmp byte ptr [og_menu_text+eax+1], 'w' jne _next cmp byte ptr [og_menu_text+eax+2], '~' jne _next cmp ecx, _input jne _next mov byte ptr [menu_text+eax+1], 'r' _next: cmp byte ptr [og_menu_text+eax], '|' jne _next2 mov byte ptr [menu_text+eax], 0Ah inc ecx _next2: cmp ebx, eax jne _loop _end: mov menu_option_count, ecx push offset menu_text push lengthof menu_text push textstr_addr call SetMemory cld mov esi, offset og_menu_text mov edi, offset menu_text mov ecx, lengthof og_menu_text rep movsb ret DrawMenu endp ToggleText proc _state mov byte ptr mem_input, 3h cmp _state, 0 jne _end mov byte ptr mem_input, 2h _end: push offset mem_input push 1 push textstate_addr call SetMemory ret ToggleText endp GetButton proc push 4 push buttons_addr call GetMemory ret GetButton endp ExecuteOption proc _input cmp _input, 0 je _option0 cmp _input, 1 je _option1 cmp _input, 2 je _option2 cmp _input, 3 je _option3 _option0: push offset godmode_bytes push lengthof godmode_bytes push 1185D08h call SetMemory ret _option1: push offset nop_bytes push lengthof nop_bytes push 5EE6A0h call SetMemory ret _option2: push offset ammo1_bytes push lengthof ammo1_bytes push 0FBF0A4h call SetMemory push offset ammo2_bytes push lengthof ammo2_bytes push 0FDA420h call SetMemory ret _option3: ret ret ExecuteOption endp MenuMonitor proc call GetButton cmp byte ptr [eax+1], 10h je PressedUp cmp byte ptr [eax+1], 40h je PressedDown cmp byte ptr [eax+3], 80h je PressedSquare cmp byte ptr [eax+3], 40h je PressedCross jmp _end2 PressedUp: cmp menu_isopen, 0 je _end cmp menu_option, 0 je _end dec menu_option push offset str_button_up call StdOut jmp _end PressedDown: cmp menu_isopen, 0 je _end2 mov ebx, menu_option_count cmp menu_option, ebx je _end inc menu_option push offset str_button_down call StdOut jmp _end PressedSquare: cmp menu_isopen, 0 je _end2 cmp menu_isopen, 1 jne _end2 jmp _close push offset str_button_x call StdOut jmp _end PressedCross: cmp menu_isopen, 0 je _end2 push menu_option call ExecuteOption push offset str_button_a call StdOut jmp _end _close: push offset str_closed_menu call StdOut mov menu_isopen, 0 push 0 call ToggleText jmp _end2 _end: cmp menu_isopen, 0 jne _end3 push offset str_opened_menu call StdOut _end3: mov menu_isopen, 1 push menu_option call DrawMenu push 1 call ToggleText _end2: ret MenuMonitor endp SetMemory proc _address, _length, _input push _input push _length push 0 push _address push 0 push 0 push dword ptr game_proc_id push 0 push dword ptr game_target call SNPS3ProcessSetMemory mov eax, 0 ret SetMemory endp GetMemory proc _address, _length push offset mem_output push _length push 0 push _address push 0 push 0 push dword ptr game_proc_id push 0 push dword ptr game_target call SNPS3ProcessGetMemory mov eax, offset mem_output ret GetMemory endp end Main