diff --git a/zsnes/src/cpu/execute.asm b/zsnes/src/cpu/execute.asm index 90edc328..1132abd1 100644 --- a/zsnes/src/cpu/execute.asm +++ b/zsnes/src/cpu/execute.asm @@ -33,7 +33,7 @@ EXTSYM frameskip,initvideo,newgfx16b,oldhandSBo,oldhandSBs,soundon,cvidmode EXTSYM vidbuffer,vidbufferofsa,vidbufferofsb,disable65816sh,GUISaveVars,virqnodisable EXTSYM KeySaveState,KeyLoadState,KeyQuickExit,KeyQuickLoad,KeyQuickRst,GUIDoReset EXTSYM KeyOnStA,KeyOnStB,ProcessKeyOn,printnum,sramsavedis,DSPDisable,C4Enable -EXTSYM KeyQuickClock,KeyQuickMinimize,TimerEnable +EXTSYM KeyQuickClock,KeyQuickMinimize,TimerEnable,AutoIncSaveSlot EXTSYM IRQHack,HIRQLoc,Offby1line,splitflags,joinflags,KeyQuickSnapShot EXTSYM csounddisable,videotroub,Open_File,Close_File,Read_File,ResetTripleBuf EXTSYM Write_File,Output_Text,Create_File,Check_Key,Get_Key,Change_Dir,InitPreGame @@ -1498,18 +1498,53 @@ NEWSYM sramsave .savesrmmsg1 db 'SRAM DATA SAVED.',0 .savesrmmsg2 db 'NO SRAM DATA.',0 - +NEWSYM firstsaveinc, db 0 NEWSYM statesaver clim - sub dword[Curtableaddr],tableA sub dword[spcPCRam],spcRam sub dword[spcRamDP],spcRam call PrepareSaveState call unpackfunct call initrevst + + ; Auto increment save state slot + + cmp byte[AutoIncSaveSlot],0 + je .donesaveinc + cmp byte[firstsaveinc],1 + je .clearfirstinc + mov eax,[statefileloc] + mov dh,[fnamest+eax] +%ifndef __LINUX__ + cmp dh,'T' +%else + cmp dh,'t' +%endif + je .secondstate + cmp dh,'9' + je .jumptofirststate + inc dh + jmp .donextstate +.secondstate + mov dh,'1' + jmp .donextstate +.jumptofirststate +%ifndef __LINUX__ + mov dh,'T' +%else + mov dh,'t' +%endif +.donextstate + mov byte[fnamest+eax],dh + xor dh,dh + jmp .donesaveinc +.clearfirstinc + mov byte[firstsaveinc],0 +.donesaveinc + ; jmp .skipsaves ; Save State %ifdef __LINUX__ @@ -1636,6 +1671,7 @@ NEWSYM statesaver mov eax,[MsgCount] mov [MessageOn],eax ret + .nosavestuff add dword[Curtableaddr],tableA add dword[spcPCRam],spcRam diff --git a/zsnes/src/gui/gui.asm b/zsnes/src/gui/gui.asm index d5f85640..318ddd23 100644 --- a/zsnes/src/gui/gui.asm +++ b/zsnes/src/gui/gui.asm @@ -170,6 +170,7 @@ EXTSYM DeInitModemC EXTSYM ipxgetchar,ipxsendchar,TCPIPStoreByte EXTSYM TCPIPGetByte,GUIBIFIL EXTSYM ModemSendChar +EXTSYM firstsaveinc %ifdef __LINUX__ EXTSYM numlockptr %endif @@ -584,6 +585,7 @@ NEWSYM DisableScreenSaver, db 0 NEWSYM TrapMouseCursor, db 1 NEWSYM KeyQuickClock, dd 0 NEWSYM KeyQuickMinimize, dd 0 +NEWSYM AutoIncSaveSlot, db 0 GUIsave equ $-GUIRAdd diff --git a/zsnes/src/gui/guikeys.inc b/zsnes/src/gui/guikeys.inc index 35ef7543..591e8e36 100644 --- a/zsnes/src/gui/guikeys.inc +++ b/zsnes/src/gui/guikeys.inc @@ -826,12 +826,11 @@ GUIOptionKeys: mov [cfgnewgfx],al .invalidng .nonewgfx -; cmp dh,'V' -; jne .novsync -; xor byte[vsyncon],1 -; mov al,[vsyncon] -; mov [cfgvsync],al -;.novsync + cmp dh,'T' + jne .noautoincsave + xor byte[AutoIncSaveSlot],1 + mov byte[firstsaveinc],1 +.noautoincsave cmp dh,'M' jne .nommxcopy xor byte[FPUCopy],2 diff --git a/zsnes/src/gui/guimouse.inc b/zsnes/src/gui/guimouse.inc index 9d3bec04..2c86275b 100644 --- a/zsnes/src/gui/guimouse.inc +++ b/zsnes/src/gui/guimouse.inc @@ -1332,6 +1332,20 @@ GUIWinClicked: %%noclick %endmacro +%macro GUIClickCButtonAS 3 + cmp eax,%1+1 + jl %%noclick + cmp edx,%2+3 + jl %%noclick + cmp eax,%1+6 + jg %%noclick + cmp edx,%2+8 + jg %%noclick + xor %3,1 + mov byte[firstsaveinc],1 +%%noclick +%endmacro + %macro GUISlidebarPostImpl 13 ; x1,y1,x2,y2,upjump,downjump,holdpos,scsize,view,cur,listsize cmp dword[%11],0 je near %%nolower @@ -2153,7 +2167,7 @@ DisplayGUIOptionClick: jne near .invalidng GUIClickCButton2 11,36,byte[newengen],byte[cfgnewgfx],1 .invalidng -; GUIClickCButton2 11,46,byte[vsyncon],byte[cfgvsync],1 + GUIClickCButtonAS 11,46,byte[AutoIncSaveSlot] GUIClickCButtonMMX 11,56,byte[FPUCopy] GUIClickCButtonM 11,66,byte[pl12s34] %ifdef __MSDOS__ diff --git a/zsnes/src/gui/guiwindp.inc b/zsnes/src/gui/guiwindp.inc index a949c4ee..5d350a18 100644 --- a/zsnes/src/gui/guiwindp.inc +++ b/zsnes/src/gui/guiwindp.inc @@ -1391,7 +1391,7 @@ DisplayGUIOption: GUIOuttextwin2 4,6,16,[GUITemp] GUIOuttextwin2u 4,26,31,GUIOptionText2,0 GUIOuttextwin2u 4,26,41,GUIOptionText4,0 -; GUIOuttextwin2u 4,26,51,GUIOptionText5,0 + GUIOuttextwin2u 4,26,51,GUIOptionText5,2 GUIOuttextwin2u 4,26,61,GUIOptionText6,0 GUIOuttextwin2u 4,26,71,GUIOptionText7,0 %ifdef __MSDOS__ @@ -1417,7 +1417,7 @@ DisplayGUIOption: GUIOuttextwin2 4,5,15,[GUITemp] GUIOuttextwin2 4,25,30,GUIOptionText2 GUIOuttextwin2 4,25,40,GUIOptionText4 -; GUIOuttextwin2 4,25,50,GUIOptionText5 + GUIOuttextwin2 4,25,50,GUIOptionText5 GUIOuttextwin2 4,25,60,GUIOptionText6 GUIOuttextwin2 4,25,70,GUIOptionText7 %ifdef __MSDOS__ @@ -1458,12 +1458,12 @@ DisplayGUIOption: mov dword[GUITemp],GUIIconDataCheckBoxC .nocheckbox1 GUIDisplayIconWin 4,11,36,[GUITemp] -; mov dword[GUITemp],GUIIconDataCheckBoxUC -; cmp byte[vsyncon],0 -; je .nocheckbox2 -; mov dword[GUITemp],GUIIconDataCheckBoxC -;.nocheckbox2 -; GUIDisplayIconWin 4,11,46,[GUITemp] + mov dword[GUITemp],GUIIconDataCheckBoxUC + cmp byte[AutoIncSaveSlot],0 + je .nocheckbox2 + mov dword[GUITemp],GUIIconDataCheckBoxC +.nocheckbox2 + GUIDisplayIconWin 4,11,46,[GUITemp] mov dword[GUITemp],GUIIconDataCheckBoxUC cmp byte[FPUCopy],2 jne .nocheckbox3 @@ -1602,7 +1602,7 @@ GUIOptionText1 db 'FRAME RATE',0 GUIOptionText2 db 'AUTO FRAME RATE',0 GUIOptionText3 db 'MAX FRAME SKIP',0 GUIOptionText4 db 'NEW GFX ENGINE',0 -;GUIOptionText5 db 'VSYNC',0 +GUIOptionText5 db 'AUTO INCRMNT SAVE SLOT',0 GUIOptionText6 db 'MMX SUPPORT',0 GUIOptionText7 db 'USE PL3/4 AS PL1/2',0 GUIOptionTextA db 'SIDEWINDER FIX',0 diff --git a/zsnes/src/ui.asm b/zsnes/src/ui.asm index d2e5c249..366c93bf 100644 --- a/zsnes/src/ui.asm +++ b/zsnes/src/ui.asm @@ -30,7 +30,7 @@ EXTSYM StateBackup EXTSYM ADSRGAINSwitch,FPUCopy,ScreenScale,SoundQuality EXTSYM debugger,pl1contrl,pl2contrl,romtype,smallscreence EXTSYM smallscreenon,spcon -EXTSYM statefileloc,LatestSave +EXTSYM statefileloc,LatestSave,firstsaveinc EXTSYM Create_File,Delete_File,Open_File,Get_File_Date,Close_File,Change_Dir,Get_Dir EXTSYM romloadskip EXTSYM cfgloadgdir,cfgloadsdir @@ -1224,10 +1224,11 @@ NEWSYM makeextension mov [fnames],ah mov [fnamest],ah %ifdef __LINUX__ - pushad - call GetFilename - popad + pushad + call GetFilename + popad %endif + mov byte[firstsaveinc],1 cmp byte[LatestSave],1 je .latestsave ret