Command-line savestate fix [StatMat]

This commit is contained in:
pagefault
2002-09-13 23:32:56 +00:00
parent e7ecbec23f
commit 271c835ed9
5 changed files with 98 additions and 22 deletions

View File

@@ -40,6 +40,10 @@ extern unsigned char Palette0, SPC700sh, OffBy1Line, DSPDisable,
spcon, vsyncon, DisplayS, fname, filefound, SnowOn,
Triplebufen;
// FIX STATMAT
extern unsigned char autoloadstate;
// FIX STATMAT
void ccmdline(void);
char *ers[] =
@@ -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':

View File

@@ -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

View File

@@ -47,6 +47,10 @@ extern unsigned char Palette0, SPC700sh, OffBy1Line, DSPDisable,
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;
extern int optind, opterr, optopt;
@@ -312,7 +316,15 @@ int main (int argc, char *argv[]) {
}
case 'z': {
StereoSound = 1;
// 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;
}

View File

@@ -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__

View File

@@ -43,6 +43,10 @@ extern unsigned char Palette0, SPC700sh, OffBy1Line, DSPDisable,
NetFilename,CmdLineTCPIPAddress,NetQuitAfter,UDPConfig,
CmdLineNetPlay;
// FIX STATMAT
extern unsigned char autoloadstate;
// FIX STATMAT
void ccmdline(void);
char *ers[] =
@@ -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':