⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guicheat.inc

📁 linux下的任天堂模拟器代码。供大家参考。
💻 INC
📖 第 1 页 / 共 2 页
字号:
;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach );;http://www.zsnes.com;http://sourceforge.net/projects/zsnes;https://zsnes.bountysource.com;;This program is free software; you can redistribute it and/or;modify it under the terms of the GNU General Public License;version 2 as published by the Free Software Foundation.;;This program is distributed in the hope that it will be useful,;but WITHOUT ANY WARRANTY; without even the implied warranty of;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the;GNU General Public License for more details.;;You should have received a copy of the GNU General Public License;along with this program; if not, write to the Free Software;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.SECTION .text; GUI Cheat Code RoutinesAddCSCheatCode:    cmp byte[CSInputDisplay],'_'    je .nodisplay    jmp .okay.nodisplay    ret.okay    mov eax,[curentryval]    mov [curaddrvalcs],eax    mov eax,[CSCurValue]    mov [curvaluecs],eax    xor ecx,ecx    mov cl,[CheatSrcByteSize]    inc cl    cmp byte[CheatUpperByteOnly],0    je .cspardisploop    mov cl,1.cspardispagain    cmp dword[curvaluecs],0FFh    jbe .cspardisploop    shr dword[curvaluecs],8    inc dword[curaddrvalcs]    jmp .cspardispagain.cspardisploop    push ecx    mov esi,GUICSrcTextG1    mov ecx,3    mov eax,[curaddrvalcs]    add eax,7E0000h    mov bl,[curvaluecs]    ; write bl at address eax    call AddCheatCode    shr dword[curvaluecs],8    mov byte[GUItextcolor],223    add dword[CheatSearchYPos],10    inc dword[curaddrvalcs]    pop ecx    dec ecx    jnz near .cspardisploop    mov byte[CheatWinMode],2    ret%macro SearchCMPByte 0    mov bl,[edi]    cmp bl,[esi]%endmacro%macro SearchCMP2Bytes 0    mov bx,[edi]    cmp bx,[esi]%endmacro%macro SearchCMP3Bytes 0    push ecx    mov ebx,[edi]    mov ecx,[esi]    and ebx,0FFFFFFh    and ecx,0FFFFFFh    cmp ebx,ecx    pop ecx%endmacro%macro SearchCMP4Bytes 0    mov ebx,[edi]    cmp ebx,[esi]%endmacro%macro SearchMacro 2    mov dl,0FEh%%searchloop    %2    %1 %%nofail    and [eax],dl%%nofail    inc edi    inc esi    cmp dl,7Fh    jne %%noinceax    inc eax%%noinceax    rol dl,1;    loop %%searchloop    dec ecx    jnz %%searchloop%endmacro%macro SearchMacroB 1    cmp byte[CheatCompareValue],0    je near %%greater    cmp byte[CheatCompareValue],1    je near %%lessthan    cmp byte[CheatCompareValue],3    je near %%notequalthan    SearchMacro je, %1    jmp .end%%greater    SearchMacro ja, %1    jmp .end%%lessthan    SearchMacro jb, %1    jmp .end%%notequalthan    SearchMacro jne, %1    jmp .end%endmacroCheatCodeSearchProcess:    cmp byte[CheatSrcSearchType],1    je near .comparative    cmp byte[CSInputDisplay],0    je near .nodisplay    cmp byte[CSInputDisplay],'_'    je near .nodisplay    cmp byte[CSOverValue],1    je near .nodisplay    mov byte[CSInputDisplay],'_'    mov byte[CSInputDisplay+1],0    ; Process Cheat Search    mov ecx,65536*2    xor ebx,ebx    mov bl,[CheatSrcByteSize]    sub ecx,ebx    mov edx,[SrcMask+ebx*4]    mov edi,[vidbuffer]    add edi,129600+65536*2    mov esi,[wramdata]    mov bl,0FEh    mov bh,01h.exactloop    mov eax,[esi]    and eax,edx    cmp eax,[CSCurValue]    je .found    inc eax    and eax,edx    cmp eax,[CSCurValue]    je .foundb.failedfind    and [edi],bl    jmp .foundc.found    test byte[edi+16384],bh    jz .failedfind    jmp .foundc.foundb    cmp byte[FirstSearch],1    je .clear    test byte[edi+16384],bh    jnz .failedfind    jmp .foundc.clear    and byte[edi+16384],bl.foundc    cmp bl,7Fh    jne .noincedi    inc edi.noincedi    rol bl,1    rol bh,1    inc esi    dec ecx    jnz .exactloop    mov byte[CopyRamToggle],1    mov byte[CheatSearchStatus],1.nodisplay    ret.comparative    mov byte[CSInputDisplay],'_'    mov byte[CSInputDisplay+1],0    mov byte[CheatSearchStatus],1    mov eax,[vidbuffer]    add eax,129600+65536*2    mov esi,[vidbuffer]    add esi,129600    mov edi,[wramdata]    mov ecx,65536*2    cmp byte[CheatSrcByteSize],1    je near .bytesize2    cmp byte[CheatSrcByteSize],2    je near .bytesize3    cmp byte[CheatSrcByteSize],3    je near .bytesize4    SearchMacroB SearchCMPByte.bytesize2    dec ecx    SearchMacroB SearchCMP2Bytes.bytesize3    sub ecx,2    SearchMacroB SearchCMP3Bytes.bytesize4    sub ecx,3    SearchMacroB SearchCMP4Bytes.end    mov byte[CopyRamToggle],1    retSECTION .bssCopyRamToggle resb 1FirstSearch   resb 1SECTION .textCheatCodeSearchInit:    mov byte[CSInputDisplay],'_'    mov byte[CSInputDisplay+1],0    mov byte[CheatWinMode],1    mov byte[CheatSearchStatus],0    mov byte[FirstSearch],1    mov eax,[vidbuffer]    add eax,129600    ; copy 128k ram    mov ebx,[wramdata]    mov ecx,32768.loop    mov edx,[ebx]    mov [eax],edx    add ebx,4    add eax,4    dec ecx    jnz .loop    ; fill searched buffer with 0xFF    mov eax,[vidbuffer]    add eax,129600+65536*2    mov ecx,8192.loop2    mov dword[eax],0FFFFFFFFh    add eax,4    dec ecx    jnz .loop2    cmp byte[CheatSrcSearchType],1    jne .nottype1    mov byte[CheatSearchStatus],1.nottype1    mov dword[CheatCompareValue],0    mov eax,[vidbuffer]    add eax,129600+65536*2    cmp byte[CheatSrcByteSize],1    je near .bytesize2    cmp byte[CheatSrcByteSize],2    je near .bytesize3    cmp byte[CheatSrcByteSize],3    je near .bytesize4    ret.bytesize2    and byte[eax+16383],07Fh    ret.bytesize3    and byte[eax+16383],03Fh    ret.bytesize4    and byte[eax+16383],01Fh    retNEWSYM DisableCheatsOnLoad     ; Disable all codes    mov esi,cheatdata    mov ecx,[NumCheats]    cmp ecx,0    je .skip.loop2    test byte[esi],4    jnz .disabled2    push esi    push ecx    call DisableCheatCode    pop ecx    pop esi.disabled2    add esi,28    dec ecx    jnz .loop2.skip    retNEWSYM EnableCheatsOnLoad    ; Enable all ON toggled cheat codes    mov esi,cheatdata    mov ecx,[NumCheats]    cmp ecx,0    je .skip2.loop    test byte[esi],4    jnz .disabled    push esi    push ecx    call EnableCheatCode    pop ecx    pop esi.disabled    add esi,28    dec ecx    jnz .loop.skip2    retCheatCodeRemove:    mov byte[GUICBHold],0    cmp dword[NumCheats],0    jne .nonone    ret.nonone    mov esi,[GUIcurrentcheatcursloc]    shl esi,5    sub esi,[GUIcurrentcheatcursloc]    sub esi,[GUIcurrentcheatcursloc]    sub esi,[GUIcurrentcheatcursloc]    sub esi,[GUIcurrentcheatcursloc]    add esi,cheatdata    push esi    call DisableCheatCode    pop esi    mov eax,255    sub eax,[GUIcurrentcheatcursloc]    mov ebx,eax    shl eax,4    add eax,ebx    add eax,ebx.loop    mov bl,[esi+28]    mov [esi],bl    inc esi    dec eax    jnz .loop    dec dword[NumCheats]    mov eax,[GUIcurrentcheatcursloc]    cmp dword[NumCheats],0    je .okay    cmp eax,[NumCheats]    jne .okay    dec eax    mov [GUIcurrentcheatcursloc],eax    sub eax,11    mov [GUIcurrentcheatviewloc],eax    test dword[GUIcurrentcheatviewloc],80000000h    jz .noview    mov dword[GUIcurrentcheatviewloc],0.noview.okay    cmp byte[NumCheats],0    jne .cheatexists    mov byte[CheatOn],0.cheatexists    retCheatCodeFix:    mov byte[GUICBHold],0    cmp dword[NumCheats],0    jne .nonone    ret.nonone    mov esi,[GUIcurrentcheatcursloc]    shl esi,5    sub esi,[GUIcurrentcheatcursloc]    sub esi,[GUIcurrentcheatcursloc]    sub esi,[GUIcurrentcheatcursloc]    sub esi,[GUIcurrentcheatcursloc]    add esi,cheatdata    push esi    call DisableCheatCode    pop esi    xor byte[esi+3],80h    call EnableCheatCodeNoPrevMod    retCheatCodeToggle:    mov byte[GUICBHold],0    cmp dword[NumCheats],0    jne .nonone    ret.nonone    mov esi,[GUIcurrentcheatcursloc]    shl esi,5    sub esi,[GUIcurrentcheatcursloc]    sub esi,[GUIcurrentcheatcursloc]    sub esi,[GUIcurrentcheatcursloc]    sub esi,[GUIcurrentcheatcursloc]    add esi,cheatdata    test byte[esi],4    jz DisableCheatCode    jmp EnableCheatCodeNoPrevModDisableCheatCode:    ; code is at esi    xor ecx,ecx    xor ebx,ebx    or byte[esi],4    test byte[esi],1    jnz .gfrom    mov al,[esi+5]    mov cx,[esi+2]    mov bl,[esi+4]    mov byte[writeon],1    test byte[esi],80h    jnz .nowrite    test byte[esi-28],80h    jnz .nowrite    call dword near [memtablew8+ebx*4].nowrite    mov byte[writeon],0    ret.gfrom    mov al,[esi+5]    mov ecx,[esi+2]    and ecx,0FFFFFFh    mov esi,[romdata]    mov [esi+ecx],al    ret.gfram    mov al,[esi+5]    mov ecx,[esi+2]    and ecx,0FFFFFFh    mov esi,[sram]    mov [esi+ecx],al    retEnableCheatCode:    ; code is at esi    xor ecx,ecx    xor ebx,ebx    and byte[esi],0FBh    test byte[esi],1    jnz .gfrom    mov al,[esi+1]    mov cx,[esi+2]    mov bl,[esi+4]    push ecx    push eax    push ebx    push edx    call dword near [memtabler8+ebx*4]    pop edx    mov [esi+5],al    pop ebx    pop eax    pop ecx    mov byte[writeon],1    test byte[esi],80h    jnz .nowrite    test byte[esi-28],80h    jnz .nowrite    call dword near [memtablew8+ebx*4].nowrite    mov byte[writeon],0    ret.gfrom    mov al,[esi+1]    mov ecx,[esi+2]    and ecx,0FFFFFFh    mov esi,[romdata]    mov bl,[esi+ecx]    mov [esi+ecx],al    mov [esi+5],bl    ret.gfram    mov al,[esi+1]    mov ecx,[esi+2]    and ecx,0FFFFFFh    mov esi,[sram]    mov bl,[esi+ecx]    mov [esi+ecx],al    mov [esi+5],bl    retEnableCheatCodeNoPrevMod:    ; code is at esi    xor ecx,ecx    xor ebx,ebx    and byte[esi],0FBh    test byte[esi],1    jnz .gfrom    mov al,[esi+1]    mov cx,[esi+2]    mov bl,[esi+4]    mov byte[writeon],1    test byte[esi],80h    jnz .nowrite    test byte[esi-28],80h    jnz .nowrite    call dword near [memtablew8+ebx*4].nowrite    mov byte[writeon],0    ret.gfrom    mov al,[esi+1]    mov ecx,[esi+2]    and ecx,0FFFFFFh    mov esi,[romdata]    mov bl,[esi+ecx]    mov [esi+ecx],al    mov [esi+5],bl    ret.gfram    mov al,[esi+1]    mov ecx,[esi+2]    and ecx,0FFFFFFh    mov esi,[sram]    mov bl,[esi+ecx]    mov [esi+ecx],al    mov [esi+5],bl    retAddCheatCode:    mov byte[GUICBHold],0    cmp dword[NumCheats],255    jne .okay    ret.okay    push eax    push ebx    ; transfer description    mov eax,[NumCheats]    shl eax,5    sub eax,[NumCheats]    sub eax,[NumCheats]    sub eax,[NumCheats]    sub eax,[NumCheats]    add eax,cheatdata    mov edx,eax    push edx    add eax,6    mov ebx,CSDescDisplay    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    pop edx    pop ebx    pop eax    ; toggle, value, address, pvalue, name(12)    mov byte[edx],0    mov [edx+1],bl    push eax    sub eax,7E0000h    add eax,[wramdata]    mov bh,[eax]    mov [eax],bl    pop eax    mov [edx+2],eax    mov [edx+5],bh    inc dword[NumCheats]    mov edx,7    mov al,[GUIpmenupos]    push eax    call CheckMenuItemHelp    pop eax    mov [GUIpmenupos],al    mov byte[CheatOn],1    retProcessCheatCode:    mov byte[GUICBHold],0    cmp dword[NumCheats],255

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -