diff --git a/zsnes/src/dos/zloader.c b/zsnes/src/dos/zloader.c index 38c10324..6d2f0f31 100644 --- a/zsnes/src/dos/zloader.c +++ b/zsnes/src/dos/zloader.c @@ -39,6 +39,10 @@ extern unsigned char Palette0, SPC700sh, OffBy1Line, DSPDisable, romtype, scanlines, showallext, smallscreenon, soundon, spcon, vsyncon, DisplayS, fname, filefound, SnowOn, Triplebufen; + +// FIX STATMAT +extern unsigned char autoloadstate; +// FIX STATMAT void ccmdline(void); @@ -310,7 +314,15 @@ int pccmdline(void) } case 'z': { - StereoSound=1; + // FIX STATMAT + if(nn == 's') + { + if(!hasroom) return 4; + autoloadstate=my_atoi(argv[p+1]) + 1; + p++; + } + else StereoSound=1; + // FIX STATMAT break; } case 'd': diff --git a/zsnes/src/init.asm b/zsnes/src/init.asm index 3e3cab23..a28b28a0 100644 --- a/zsnes/src/init.asm +++ b/zsnes/src/init.asm @@ -17,6 +17,10 @@ %include "macros.mac" +; FIX STATMAT +EXTSYM loadstate2 +; FIX STATMAT + EXTSYM DosExit,UpdateDevices,InitSPC,Makemode7Table,MusicRelVol,MusicVol EXTSYM makesprprtable,romloadskip,start65816,startdebugger,SfxR0 EXTSYM MovieProcessing @@ -133,6 +137,10 @@ NEWSYM ReInitLength, dd 0 NEWSYM ForceNewGfxOff, dd 0 NEWSYM SfxAC, db 0 blah times 450 db 0 +; FIX STATMAT +NEWSYM autoloadstate, db 0 ; auto load state slot number +; FIX STATMAT + SECTION .text EXTSYM cpalval @@ -226,6 +234,51 @@ NEWSYM init .noof mov [MusicVol],al +; FIX STATMAT + ; Here's the auto-load ZST file stuff + cmp byte[autoloadstate],1 + jl .noautoloadstate + je .enddigits + mov ebx,[statefileloc] + sub byte[autoloadstate],1 + cmp byte[autoloadstate],10 + jge .2digits + mov al,byte[autoloadstate] + add al,48 + mov byte[fnamest+ebx],al + jmp .enddigits +.2digits + xor eax,eax + mov al,byte[autoloadstate] + mov dl,10 + div dl + add al,48 + add ah,48 + mov byte[fnamest+ebx-1],al + mov byte[fnamest+ebx],ah +.enddigits + + ; Load the specified state file + call loadstate2 + + ; Just skip the extension re-setup below if we don't need to do it + cmp byte[autoloadstate],9 + jbe .noautoloadstate + + ; Put back the 'ST' on the end of the extension as we changed it + ; above (by placing two digits in the extension). This is so + ; as not to break any other code later on which depends + ; on it being present. + mov ebx,[statefileloc] +%ifdef __LINUX__ + mov word[fnamest+ebx-1],'st' +%else + mov word[fnamest+ebx-1],'ST' +%endif + +.noautoloadstate +; FIX STATMAT + xor eax,eax mov al,[cvidmode] cmp byte[GUI16VID+eax],1 @@ -1465,23 +1518,6 @@ NEWSYM headerhack mov byte[ENVDisable],0 mov byte[MMXSRAMFix],0 - mov esi,[romdata] - add esi,0FFC0h - cmp dword[esi],'HORA' - jne .nothoraigakuen - cmp dword[esi+4],'I-GA' - jne .nothoraigakuen - cmp dword[esi+8],'KUEN' - jne .nothoraigakuen - cmp dword[esi+12],' ' - jne .nothoraigakuen - mov al,0h - mov edi,spcRam - mov ecx,65472 - rep stosb - ret -.nothoraigakuen - mov esi,[romdata] add esi,07FC0h cmp dword[esi],'DIGI' @@ -2164,11 +2200,12 @@ NEWSYM init65816 mov byte[cycpbl],117 mov byte[cycpblt],117 + cmp byte[SPC7110Enable],0 + jne .specialtimer cmp byte[SDD1Enable],0 jne .specialtimer jmp .nospecialtimer .specialtimer -; Which games require that?!? (_Demo_) mov byte[cycpb268],69 mov byte[cycpb358],81 mov byte[cycpbl2],69 diff --git a/zsnes/src/linux/zloaderw.c b/zsnes/src/linux/zloaderw.c index 35c7d1a6..2cc57262 100644 --- a/zsnes/src/linux/zloaderw.c +++ b/zsnes/src/linux/zloaderw.c @@ -46,6 +46,10 @@ extern unsigned char Palette0, SPC700sh, OffBy1Line, DSPDisable, spcon, vsyncon, DisplayS, fname, filefound, SnowOn, NetChatFirst,NetServer,NetNewNick, NetFilename,TCPIPAddress,NetQuitAfter,UDPConfig; + +// FIX STATMAT +extern unsigned char autoloadstate; +// FIX STATMAT int getopt(int argc, char *const argv[], const char *optstring); extern char *optarg; @@ -311,8 +315,16 @@ int main (int argc, char *argv[]) { break; } - case 'z': { - StereoSound = 1; + case 'z': { + // FIX STATMAT + if(*(argv[p]+1) == 's') + { +// if(!hasroom) return 4; + autoloadstate=my_atoi(argv[p+1]) + 1; + p++; + } + else StereoSound=1; + // FIX STATMAT break; } diff --git a/zsnes/src/ui.asm b/zsnes/src/ui.asm index 4902bf86..ead206c4 100644 --- a/zsnes/src/ui.asm +++ b/zsnes/src/ui.asm @@ -1357,6 +1357,9 @@ SECTION .data db ' -3 Enable triple buffering (disables vsync)',13,10 %endif db ' -z Enable Stereo Sound',13,10 +; FIX STATMAT + db ' -zs # Auto load specified save state slot on startup',13,10 +; FIX STATMAT db '',13,10 db ' File Formats Supported by GUI : .SMC,.SFC,.SWC,.FIG,.058,.078,.1,.USA,.JAP',13,10 %ifdef __MSDOS__ diff --git a/zsnes/src/win/zloaderw.c b/zsnes/src/win/zloaderw.c index d67ecd7d..61597674 100644 --- a/zsnes/src/win/zloaderw.c +++ b/zsnes/src/win/zloaderw.c @@ -42,6 +42,10 @@ extern unsigned char Palette0, SPC700sh, OffBy1Line, DSPDisable, NetChatFirst,NetServer,NetNewNick, NetFilename,CmdLineTCPIPAddress,NetQuitAfter,UDPConfig, CmdLineNetPlay; + +// FIX STATMAT +extern unsigned char autoloadstate; +// FIX STATMAT void ccmdline(void); @@ -597,7 +601,15 @@ int pccmdline(void) } case 'z': { - StereoSound=1; + // FIX STATMAT + if(nn == 's') + { + if(!hasroom) return 4; + autoloadstate=my_atoi(argv[p+1]) + 1; + p++; + } + else StereoSound=1; + // FIX STATMAT break; } case 'd':