guicheat.inc
来自「linux下的任天堂模拟器代码。供大家参考。」· INC 代码 · 共 1,166 行 · 第 1/2 页
INC
1,166 行
je .fail cmp byte[GUICheatPosA],0 je .fail jmp .okay.fail ret.okay ; make sure flashing cursor doesn't exist xor ebx,ebx mov bl,[GUICheatPosB] mov byte[GUICheatTextZ2+ebx],0 ; transfer description mov eax,[NumCheats] shl eax,5 sub eax,[NumCheats] sub eax,[NumCheats] sub eax,[NumCheats] sub eax,[NumCheats] add eax,cheatdata add eax,6 mov ebx,GUICheatTextZ2 mov ecx,20.dloop mov dl,[ebx] mov [eax+2],dl mov [eax+18+2],dl mov [eax+18*2+2],dl inc ebx inc eax dec ecx jnz .dloop ; determine whether it is gamegenie, par, or GF ; uppercase all codes if necessary mov eax,GUICheatTextZ1 mov ecx,14.loop mov bl,[eax] cmp bl,'a' jb .nolower cmp bl,'z' ja .nolower sub bl,'a'-'A' mov [eax],bl.nolower inc eax dec ecx jnz .loop mov byte[guicheatvalrep],0 xor eax,eax mov al,[GUICheatPosA] dec al cmp byte[GUICheatTextZ1+eax],'R' jne .notrep mov byte[guicheatvalrep],80h dec byte[GUICheatPosA].notrep cmp byte[GUICheatPosA],8 je near .par cmp byte[GUICheatPosA],9 je near .gg cmp byte[GUICheatPosA],14 je near .gf.invalidpar jmp guicheaterror.par ; check if code is valid mov eax,GUICheatTextZ1 mov ecx,8.looppar mov bl,[eax] cmp bl,'0' jb .invalidpar cmp bl,'9' jbe .okaypar cmp bl,'A' jb .invalidpar cmp bl,'F' ja .invalidpar.okaypar inc eax dec ecx jnz .looppar jmp decodepar.invalidgg jmp guicheaterror.gg ; check if code is valid mov eax,GUICheatTextZ1 mov ecx,9.loopgg cmp ecx,5 jne .nomid cmp byte[eax],'-' jne .invalidgg inc eax dec ecx.nomid mov bl,[eax] cmp bl,'0' jb .invalidgg cmp bl,'9' jbe .okaygg cmp bl,'A' jb .invalidgg cmp bl,'F' ja .invalidgg.okaygg inc eax dec ecx jnz .loopgg jmp decodegg ret.invalidgf jmp guicheaterror.gf ; check if code is valid mov eax,GUICheatTextZ1 mov ecx,5.loopgf mov bl,[eax] cmp bl,'0' jb .invalidgf cmp bl,'9' jbe .okaygf cmp bl,'A' jb .invalidgf cmp bl,'F' ja .invalidgf.okaygf inc eax dec ecx jnz .loopgf mov eax,GUICheatTextZ1+5 mov ecx,6.loopgf2 mov bl,[eax] cmp bl,'X' je .okaygf2 cmp bl,'0' jb .invalidgf cmp bl,'9' jbe .okaygf2 cmp bl,'A' jb near .invalidgf cmp bl,'F' ja near .invalidgf.okaygf2 inc eax dec ecx jnz .loopgf2 mov bl,[GUICheatTextZ1+13] cmp bl,'0' je .okaygf3 cmp bl,'1' jne near .invalidgf.okaygf3 jmp decodegfdecodegf: ; convert code to number format mov ecx,14 mov esi,GUICheatTextZ1.loopb2 mov al,[esi] cmp al,'X' je .let2 cmp al,'A' jb .num2 sub al,'A' add al,10 jmp .let2.num2 sub al,'0'.let2 mov [esi],al inc esi dec ecx jnz .loopb2 ; get address xor ebx,ebx xor ecx,ecx mov cl,[GUICheatTextZ1] shl ecx,4 add cl,[GUICheatTextZ1+1] shl ecx,4 add cl,[GUICheatTextZ1+2] shl ecx,4 add cl,[GUICheatTextZ1+3] shl ecx,4 add cl,[GUICheatTextZ1+4] mov edx,[NumCheats] shl edx,5 sub edx,[NumCheats] sub edx,[NumCheats] sub edx,[NumCheats] sub edx,[NumCheats] ; Write data to memory cmp byte[GUICheatTextZ1+13],1 je near .modifysram ; get data cmp byte[GUICheatTextZ1+5],'X' je near .nocode cmp byte[GUICheatTextZ1+6],'X' je near .nocode mov bl,[GUICheatTextZ1+5] shl bl,4 add bl,[GUICheatTextZ1+6] mov esi,[romdata] mov al,[esi+ecx] mov [esi+ecx],bl mov byte[cheatdata+edx],1 mov [cheatdata+edx+2],ecx mov [cheatdata+edx+1],bl mov [cheatdata+edx+5],al push eax mov al,[guicheatvalrep] or [cheatdata+edx],al pop eax inc byte[NumCheats] add edx,28.nocode inc ecx cmp byte[GUICheatTextZ1+7],'X' je near .nocode1 cmp byte[GUICheatTextZ1+8],'X' je near .nocode1 cmp byte[NumCheats],255 je near .nocode1 mov bl,[GUICheatTextZ1+7] shl bl,4 add bl,[GUICheatTextZ1+8] mov esi,[romdata] mov al,[esi+ecx] mov [esi+ecx],bl mov byte[cheatdata+edx],1 mov [cheatdata+edx+2],ecx mov [cheatdata+edx+1],bl mov [cheatdata+edx+5],al inc byte[NumCheats] add edx,28.nocode1 inc ecx cmp byte[GUICheatTextZ1+9],'X' je near .nocode2 cmp byte[GUICheatTextZ1+10],'X' je near .nocode2 cmp byte[NumCheats],255 je near .nocode2 mov bl,[GUICheatTextZ1+9] shl bl,4 add bl,[GUICheatTextZ1+10] mov esi,[romdata] mov al,[esi+ecx] mov [esi+ecx],bl mov byte[cheatdata+edx],1 mov [cheatdata+edx+2],ecx mov [cheatdata+edx+1],bl mov [cheatdata+edx+5],al inc byte[NumCheats].nocode2 jmp .quit.modifysram cmp ecx,65535 ja near .quit mov esi,[sram] ; get data cmp byte[GUICheatTextZ1+5],'X' je .nocodeb cmp byte[GUICheatTextZ1+6],'X' je .nocodeb mov bl,[GUICheatTextZ1+5] shl bl,4 add bl,[GUICheatTextZ1+6] mov al,[esi+ecx] mov [esi+ecx],bl mov byte[cheatdata+edx],2 mov [cheatdata+edx+2],ecx mov [cheatdata+edx+1],bl mov [cheatdata+edx+5],al inc byte[NumCheats] add edx,28.nocodeb inc ecx cmp byte[GUICheatTextZ1+7],'X' je .nocode1b cmp byte[GUICheatTextZ1+8],'X' je .nocode1b cmp byte[NumCheats],255 je .nocode1b cmp ecx,65535 ja .nocode1b mov bl,[GUICheatTextZ1+7] shl bl,4 add bl,[GUICheatTextZ1+8] mov al,[esi+ecx+1] mov [esi+ecx+1],bl mov byte[cheatdata+edx],2 mov [cheatdata+edx+2],ecx mov [cheatdata+edx+1],bl mov [cheatdata+edx+5],al inc byte[NumCheats] add edx,28.nocode1b inc ecx cmp byte[GUICheatTextZ1+9],'X' je .nocode2c cmp byte[GUICheatTextZ1+10],'X' je .nocode2c cmp byte[NumCheats],255 je .nocode2c cmp ecx,65535 ja .nocode2c mov bl,[GUICheatTextZ1+9] shl bl,4 add bl,[GUICheatTextZ1+10] mov al,[esi+ecx+2] mov [esi+ecx+2],bl mov byte[cheatdata+edx],2 mov [cheatdata+edx+2],ecx mov [cheatdata+edx+1],bl mov [cheatdata+edx+5],al inc byte[NumCheats].nocode2c.quit cmp byte[NumCheats],0 je .nocheat mov byte[CheatOn],1 mov dword[GUIcurrentcheatwin],1 mov eax,[NumCheats] dec eax mov [GUIcurrentcheatcursloc],eax sub eax,11 mov [GUIcurrentcheatviewloc],eax test dword[GUIcurrentcheatviewloc],80000000h jz .noview mov dword[GUIcurrentcheatviewloc],0.noview.nocheat mov dword[GUICheatTextZ1],0 mov dword[GUICheatTextZ2],0 mov byte[GUICheatPosA],0 mov byte[GUICheatPosB],0 retdecodegg:;Genie Hex: D F 4 7 0 9 1 5 6 B C 8 A 2 3 E;Normal Hex: 0 1 2 3 4 5 6 7 8 9 A B C D E F; 4 6 D E 2 7 8 3 B 5 C 9 A 0 F 1 ; Convert code mov esi,GUICheatTextZ1 mov eax,[esi+5] mov [esi+4],eax ; convert code to number format mov ecx,8 xor eax,eax.loopb3 mov al,[esi] cmp al,'A' jb .num3 sub al,'A' add al,10 jmp .let3.num3 sub al,'0'.let3 mov al,[.GG2Norm+eax] mov [esi],al inc esi dec ecx jnz .loopb3 mov esi,GUICheatTextZ1 xor ecx,ecx mov cl,[esi+2] shl ecx,4 add cl,[esi+3] shl ecx,4 add cl,[esi+4] shl ecx,4 add cl,[esi+5] shl ecx,4 add cl,[esi+6] shl ecx,4 add cl,[esi+7]; 0123456789ABCDEF01234567; 24bit encoded address: ijklqrstopabcduvwxefghmn; abcdefghijklmnopqrstuvwx; >8 >12 >6<10 >6 <14 <10 mov ebx,ecx and ebx,000000000011110000000000b ;abcd shl ebx,10 mov eax,ecx and eax,000000000000000000111100b ;efgh shl eax,14 add ebx,eax mov eax,ecx and eax,111100000000000000000000b ;ijkl shr eax,8 add ebx,eax mov eax,ecx and eax,000000000000000000000011b ;mn shl eax,10 add ebx,eax mov eax,ecx and eax,000000001100000000000000b ;op shr eax,6 add ebx,eax mov eax,ecx and eax,000011110000000000000000b ;qrst shr eax,12 add ebx,eax mov eax,ecx and eax,000000000000001111000000b ;uvwx shr eax,6 add ebx,eax xor ecx,ecx mov cx,bx shr ebx,16 test bl,40h jz .noover; xor cx,8000h.noover mov al,[esi] shl al,4 add al,[esi+1] ; store into cheatdata mov edx,[NumCheats] shl edx,5 sub edx,[NumCheats] sub edx,[NumCheats] sub edx,[NumCheats] sub edx,[NumCheats] mov byte[cheatdata+edx],0 mov [cheatdata+edx+1],al mov [cheatdata+edx+2],cx mov [cheatdata+edx+4],bl push eax mov al,[guicheatvalrep] or [cheatdata+edx],al pop eax push ecx push eax push ebx push edx call dword near [memtabler8+ebx*4] pop edx mov [cheatdata+edx+5],al pop ebx pop eax pop ecx mov byte[writeon],1 test byte[cheatdata+edx],80h jnz .nowrite test byte[cheatdata+edx-28],80h jnz .nowrite call dword near [memtablew8+ebx*4].nowrite mov byte[writeon],0 mov byte[CheatOn],1 inc byte[NumCheats] mov dword[GUICheatTextZ1],0 mov dword[GUICheatTextZ2],0 mov byte[GUICheatPosA],0 mov byte[GUICheatPosB],0 mov dword[GUIcurrentcheatwin],1 mov eax,[NumCheats] dec eax mov [GUIcurrentcheatcursloc],eax sub eax,11 mov [GUIcurrentcheatviewloc],eax test dword[GUIcurrentcheatviewloc],80000000h jz .noview mov dword[GUIcurrentcheatviewloc],0.noview retSECTION .data.GG2Norm db 04h,06h,0Dh,0Eh,02h,07h,08h,03h,0Bh,05h,0Ch,09h,0Ah,00h,0Fh,01hSECTION .textdecodepar: ; convert code to number format mov ecx,8 mov esi,GUICheatTextZ1.loopb mov al,[esi] cmp al,'A' jb .num sub al,'A' add al,10 jmp .let.num sub al,'0'.let mov [esi],al inc esi dec ecx jnz .loopb ; get address xor ebx,ebx xor ecx,ecx mov bl,[GUICheatTextZ1] shl bl,4 add bl,[GUICheatTextZ1+1] mov cl,[GUICheatTextZ1+2] shl cx,4 add cl,[GUICheatTextZ1+3] shl cx,4 add cl,[GUICheatTextZ1+4] shl cx,4 add cl,[GUICheatTextZ1+5] mov al,[GUICheatTextZ1+6] shl al,4 add al,[GUICheatTextZ1+7] ; store into cheatdata xor edx,edx mov dl,[NumCheats] push ebx mov ebx,edx shl edx,5 sub edx,ebx sub edx,ebx sub edx,ebx sub edx,ebx pop ebx mov byte[cheatdata+edx],0 mov [cheatdata+edx+1],al mov [cheatdata+edx+2],cx mov [cheatdata+edx+4],bl push eax mov al,[guicheatvalrep] or [cheatdata+edx],al pop eax push ecx push eax push ebx push edx call dword near [memtabler8+ebx*4] pop edx mov [cheatdata+edx+5],al pop ebx pop eax pop ecx mov byte[writeon],1 test byte[cheatdata+edx],80h jnz .nowrite test byte[cheatdata+edx-28],80h jnz .nowrite call dword near [memtablew8+ebx*4].nowrite mov byte[writeon],0 mov byte[CheatOn],1 inc dword[NumCheats] mov dword[GUICheatTextZ1],0 mov dword[GUICheatTextZ2],0 mov byte[GUICheatPosA],0 mov byte[GUICheatPosB],0 mov dword[GUIcurrentcheatwin],1 mov eax,[NumCheats] dec eax mov [GUIcurrentcheatcursloc],eax sub eax,11 mov [GUIcurrentcheatviewloc],eax test dword[GUIcurrentcheatviewloc],80000000h jz .noview mov dword[GUIcurrentcheatviewloc],0.noview retSECTION .bssguicheatvalrep resb 1
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?