SRAM preserved for power-on movies.

This commit is contained in:
grinvader
2005-03-27 10:38:27 +00:00
parent e38af682c8
commit e4b14bf130
3 changed files with 125 additions and 97 deletions

View File

@@ -80,10 +80,10 @@ extern unsigned char spcon;
void procexecloop() void procexecloop()
{ {
curexecstate &= 0xFFFFFF00; curexecstate &= 0xFFFFFF00;
if (spcon) { curexecstate += 3; } if (spcon) { curexecstate += 3; }
else { curexecstate += 1; } else { curexecstate += 1; }
} }
void Debug_WriteString(char *str) void Debug_WriteString(char *str)
@@ -1807,14 +1807,31 @@ unsigned int showinfogui()
extern unsigned int nmiprevaddrl, nmiprevaddrh, nmirept, nmiprevline, nmistatus; extern unsigned int nmiprevaddrl, nmiprevaddrh, nmirept, nmiprevline, nmistatus;
extern unsigned int spcnumread, spchalted; extern unsigned int spcnumread, spchalted;
extern unsigned char NextLineCache, sramsavedis, sndrot, regsbackup[3019]; extern unsigned char NextLineCache, sramsavedis, sndrot, regsbackup[3019];
extern unsigned char yesoutofmemory; extern unsigned char yesoutofmemory, fnames[512];
void SetupROM(); void SetupROM();
void initsnes(); void initsnes();
void outofmemfix(); void outofmemfix();
void GUIDoReset(); void GUIDoReset();
void powercycle() bool loadSRAM(char *sramname)
{
FILE *sramfp;
int sramsize;
if ((sramfp = fopen(sramname, "rb")))
{
fseek(sramfp, 0, SEEK_END);
sramsize = ftell(sramfp);
rewind(sramfp);
if (sramsize) { fread(sram, 1, sramsize, sramfp); }
fclose(sramfp);
return (true);
}
else { return(false); }
}
void powercycle(bool sramload)
{ {
memset(sram, 0xFF, 8192*4); memset(sram, 0xFF, 8192*4);
clearSPCRAM(); clearSPCRAM();
@@ -1829,6 +1846,7 @@ void powercycle()
NextLineCache = 0; NextLineCache = 0;
curexecstate = 1; curexecstate = 1;
if (sramload) { loadSRAM(fnames+1); }
asm_call(SetupROM); asm_call(SetupROM);
asm_call(initsnes); asm_call(initsnes);

View File

@@ -49,13 +49,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
extern unsigned int versionNumber, CRC32, cur_zst_size; extern unsigned int versionNumber, CRC32, cur_zst_size;
extern unsigned int JoyAOrig, JoyBOrig, JoyCOrig, JoyDOrig, JoyEOrig; extern unsigned int JoyAOrig, JoyBOrig, JoyCOrig, JoyDOrig, JoyEOrig;
extern unsigned int MsgCount, MessageOn; extern unsigned int MsgCount, MessageOn;
extern unsigned char MovieStartMethod, GUIReset, ReturnFromSPCStall; extern unsigned char MovieStartMethod, GUIReset, ReturnFromSPCStall, GUIQuit;
extern unsigned char MovieProcessing, *Msgptr; extern unsigned char MovieProcessing, *Msgptr, fnamest[512];
extern unsigned char CMovieExt;
extern bool romispal; extern bool romispal;
bool firstloop; bool firstloop;
void GUIDoReset(); void GUIDoReset();
void powercycle(); void powercycle(bool);
void zst_sram_load(FILE *);
void zst_save(FILE *, bool); void zst_save(FILE *, bool);
bool zst_load(FILE *); bool zst_load(FILE *);
@@ -556,14 +558,14 @@ static void zmv_create(char *filename)
case zmv_sm_zst: case zmv_sm_zst:
break; break;
case zmv_sm_power: case zmv_sm_power:
powercycle(); powercycle(true);
break; break;
case zmv_sm_reset: case zmv_sm_reset:
GUIReset = 1; GUIReset = 1;
asm_call(GUIDoReset); asm_call(GUIDoReset);
ReturnFromSPCStall = 0; ReturnFromSPCStall = 0;
break; break;
} }
zst_save(zmv_vars.fp, false); zst_save(zmv_vars.fp, false);
zmv_vars.filename = (char *)malloc(filename_len+1); //+1 for null zmv_vars.filename = (char *)malloc(filename_len+1); //+1 for null
@@ -712,6 +714,8 @@ static bool zmv_open(char *filename)
} }
MovieStartMethod = (unsigned char)zmv_vars.header.zmv_flag.start_method;
if (zmv_vars.header.zsnes_version != (versionNumber & 0xFFFF)) if (zmv_vars.header.zsnes_version != (versionNumber & 0xFFFF))
{ {
zst_load(zmv_vars.fp); zst_load(zmv_vars.fp);
@@ -725,23 +729,22 @@ static bool zmv_open(char *filename)
zst_load(zmv_vars.fp); zst_load(zmv_vars.fp);
break; break;
case zmv_sm_power: case zmv_sm_power:
powercycle(); powercycle(false);
fseek(zmv_vars.fp, zmv_vars.header.zst_size, SEEK_CUR); zst_sram_load(zmv_vars.fp);
break; break;
case zmv_sm_reset: case zmv_sm_reset:
GUIReset = 1; GUIReset = 1;
asm_call(GUIDoReset); asm_call(GUIDoReset);
ReturnFromSPCStall = 0; ReturnFromSPCStall = 0;
fseek(zmv_vars.fp, zmv_vars.header.zst_size, SEEK_CUR); zst_sram_load(zmv_vars.fp);
break; break;
} }
zmv_open_vars.input_start_pos = ftell(zmv_vars.fp);
Msgptr = "MOVIE STARTED."; Msgptr = "MOVIE STARTED.";
} }
firstloop = true; firstloop = true;
zmv_open_vars.input_start_pos = ftell(zmv_vars.fp);
fseek(zmv_vars.fp, -(EXT_CHAP_COUNT_END_DIST), SEEK_END); fseek(zmv_vars.fp, -(EXT_CHAP_COUNT_END_DIST), SEEK_END);
zmv_open_vars.external_chapter_count = fread2(zmv_vars.fp); zmv_open_vars.external_chapter_count = fread2(zmv_vars.fp);
@@ -1314,6 +1317,7 @@ static void MovieSub_Close()
{ {
if (MovieSub.fp) if (MovieSub.fp)
{ {
MessageOn = 0;
fclose(MovieSub.fp); fclose(MovieSub.fp);
MovieSub.fp = 0; MovieSub.fp = 0;
} }
@@ -1390,6 +1394,14 @@ MovieProcessing
*/ */
extern bool SRAMState, SloMo50;
bool PrevSRAMState;
extern unsigned int statefileloc;
extern unsigned char ComboCounter, MovieRecordWinVal, RewindStates;
char MovieFrameStr[10];
void SRAMChdir();
void ChangetoLOADdir();
void MovieInsertChapter() void MovieInsertChapter()
{ {
switch (MovieProcessing) switch (MovieProcessing)
@@ -1452,9 +1464,6 @@ void MovieSeekBehind()
MessageOn = MsgCount; MessageOn = MsgCount;
} }
extern bool SRAMState;
bool PrevSRAMState;
void Replay() void Replay()
{ {
if (zmv_replay()) if (zmv_replay())
@@ -1486,19 +1495,12 @@ void Replay()
} }
} }
extern bool SloMo50;
extern unsigned char ComboCounter;
void ProcessMovies() void ProcessMovies()
{ {
if (MovieProcessing == 2) { zmv_record(SloMo50 ? true : false, ComboCounter); } if (MovieProcessing == 2) { zmv_record(SloMo50 ? true : false, ComboCounter); }
else { Replay(); } else { Replay(); }
} }
// The following will maybe end up in guic.c once we get it started.
// It came from guiwindp.inc and gui.asm, after all
extern unsigned char MovieRecordWinVal;
void SkipMovie() void SkipMovie()
{ {
MovieRecordWinVal = 0; MovieRecordWinVal = 0;
@@ -1513,6 +1515,7 @@ void MovieStop()
case 1: case 1:
zmv_replay_finished(); zmv_replay_finished();
MovieSub_Close(); MovieSub_Close();
SRAMState = PrevSRAMState;
break; break;
case 2: case 2:
@@ -1527,27 +1530,19 @@ void MovieStop()
zmv_dealloc_rewind_buffer(); zmv_dealloc_rewind_buffer();
MovieProcessing = 0; MovieProcessing = 0;
SRAMState = PrevSRAMState;
} }
else { firstloop = false; } else { firstloop = false; }
} }
extern unsigned int statefileloc;
extern unsigned char GUIQuit, fnamest[512], CMovieExt;
extern unsigned char RewindStates;
void SRAMChdir();
void ChangetoLOADdir();
void MoviePlay() void MoviePlay()
{ {
unsigned char FileExt[4]; unsigned char FileExt[4];
PrevSRAMState = SRAMState;
SRAMState = true;
if (!MovieProcessing) if (!MovieProcessing)
{ {
PrevSRAMState = SRAMState;
SRAMState = true;
GUIQuit = 2; GUIQuit = 2;
memcpy(FileExt, &fnamest[statefileloc-3], 4); memcpy(FileExt, &fnamest[statefileloc-3], 4);
memcpy(&fnamest[statefileloc-3], ".zmv", 4); memcpy(&fnamest[statefileloc-3], ".zmv", 4);
@@ -1602,9 +1597,6 @@ void MovieRecord()
if (!(tempfhandle = fopen(fnamest+1,"rb"))) if (!(tempfhandle = fopen(fnamest+1,"rb")))
{ {
PrevSRAMState = SRAMState;
SRAMState = true;
zmv_create(fnamest+1); zmv_create(fnamest+1);
zmv_alloc_rewind_buffer(RewindStates); zmv_alloc_rewind_buffer(RewindStates);
MovieProcessing = 2; MovieProcessing = 2;
@@ -1618,12 +1610,11 @@ void MovieRecord()
} }
asm_call(ChangetoLOADdir); asm_call(ChangetoLOADdir);
memcpy (&fnamest[statefileloc-3], FileExt, 4); memcpy (&fnamest[statefileloc-3], FileExt, 4);
} }
} }
char MovieFrameStr[10];
void GetMovieFrameStr() void GetMovieFrameStr()
{ {
*MovieFrameStr = 0; *MovieFrameStr = 0;

View File

@@ -84,11 +84,11 @@ static unsigned int zst_version;
static void copy_state_data(unsigned char *buffer, void (*copy_func)(unsigned char **, void *, size_t), bool read) static void copy_state_data(unsigned char *buffer, void (*copy_func)(unsigned char **, void *, size_t), bool read)
{ {
copy_snes_data(&buffer, copy_func); copy_snes_data(&buffer, copy_func);
//WRAM (128k), VRAM (64k) //WRAM (128k), VRAM (64k)
copy_func(&buffer, wramdata, 8192*16); copy_func(&buffer, wramdata, 8192*16);
copy_func(&buffer, vram, 4096*16); copy_func(&buffer, vram, 4096*16);
if (spcon) if (spcon)
{ {
copy_spc_data(&buffer, copy_func); copy_spc_data(&buffer, copy_func);
@@ -97,18 +97,18 @@ static void copy_state_data(unsigned char *buffer, void (*copy_func)(unsigned ch
copy_func(&buffer, &echoon0, PHdspsave2); copy_func(&buffer, &echoon0, PHdspsave2);
} }
} }
if (C4Enable) if (C4Enable)
{ {
copy_func(&buffer, C4Ram, 2048*4); copy_func(&buffer, C4Ram, 2048*4);
} }
if (SFXEnable) if (SFXEnable)
{ {
copy_func(&buffer, sfxramdata, 8192*16); copy_func(&buffer, sfxramdata, 8192*16);
copy_func(&buffer, &SfxR0, PHnum2writesfxreg); copy_func(&buffer, &SfxR0, PHnum2writesfxreg);
} }
if (SA1Enable) if (SA1Enable)
{ {
copy_func(&buffer, &SA1Mode, PHnum2writesa1reg); copy_func(&buffer, &SA1Mode, PHnum2writesa1reg);
@@ -120,7 +120,7 @@ static void copy_state_data(unsigned char *buffer, void (*copy_func)(unsigned ch
copy_func(&buffer, &sa1dmaptr, 2*4); copy_func(&buffer, &sa1dmaptr, 2*4);
} }
} }
if (DSP1Type && !loading_old_state) if (DSP1Type && !loading_old_state)
{ {
copy_func(&buffer, &DSP1COp, 70+128); copy_func(&buffer, &DSP1COp, 70+128);
@@ -142,9 +142,9 @@ static void copy_state_data(unsigned char *buffer, void (*copy_func)(unsigned ch
} }
if (SETAEnable) if (SETAEnable)
{ {
copy_func(&buffer, setaramdata, 256*16); copy_func(&buffer, setaramdata, 256*16);
//Todo: copy the SetaCmdEnable? For completeness we should do it //Todo: copy the SetaCmdEnable? For completeness we should do it
//but currently we ignore it anyway. //but currently we ignore it anyway.
} }
@@ -154,16 +154,16 @@ static void copy_state_data(unsigned char *buffer, void (*copy_func)(unsigned ch
copy_func(&buffer, romdata+0x510000, 65536); copy_func(&buffer, romdata+0x510000, 65536);
copy_func(&buffer, &SPCMultA, PHnum2writespc7110reg); copy_func(&buffer, &SPCMultA, PHnum2writespc7110reg);
} }
if (!loading_old_state) if (!loading_old_state)
{ {
copy_extra_data(&buffer, copy_func); copy_extra_data(&buffer, copy_func);
if (!loading_state_no_sram) if (!loading_state_no_sram)
{ {
copy_func(&buffer, sram, ramsize); copy_func(&buffer, sram, ramsize);
} }
if (buffer) //Not to a file, i.e. rewind if (buffer) //Not to a file, i.e. rewind
{ {
copy_func(&buffer, &tempesi, 4); copy_func(&buffer, &tempesi, 4);
@@ -226,7 +226,7 @@ void RestoreCVFrame()
if (RewindPos != RewindEarliestPos) if (RewindPos != RewindEarliestPos)
{ {
unsigned char *RewindBufferPos; unsigned char *RewindBufferPos;
if (!RewindPos) if (!RewindPos)
{ {
RewindPos = RewindStates; RewindPos = RewindStates;
@@ -236,12 +236,12 @@ void RestoreCVFrame()
RewindBufferPos = StateBackup + RewindPos*rewind_state_size; RewindBufferPos = StateBackup + RewindPos*rewind_state_size;
printf("Restoring rewind in slot #%u\n", RewindPos); printf("Restoring rewind in slot #%u\n", RewindPos);
copy_state_data(RewindBufferPos, memcpyrinc, true); copy_state_data(RewindBufferPos, memcpyrinc, true);
//Clear Cache Check //Clear Cache Check
memset(vidmemch2, 1, sizeof(vidmemch2)); memset(vidmemch2, 1, sizeof(vidmemch2));
memset(vidmemch4, 1, sizeof(vidmemch4)); memset(vidmemch4, 1, sizeof(vidmemch4));
memset(vidmemch8, 1, sizeof(vidmemch8)); memset(vidmemch8, 1, sizeof(vidmemch8));
RewindTimer = 60*3; RewindTimer = 60*3;
} }
} }
@@ -262,7 +262,7 @@ void MultipleFrameBack(unsigned int i)
{ {
break; break;
} }
} }
} }
void SetupRewindBuffer() void SetupRewindBuffer()
@@ -296,7 +296,7 @@ void BackupCVFrame()
} }
RewindTimer = ActualRewindFrames; RewindTimer = ActualRewindFrames;
} }
void RestoreCVFrame() void RestoreCVFrame()
{ {
unsigned char *RewindBufferPos = StateBackup + PBackupPos*rewind_state_size; unsigned char *RewindBufferPos = StateBackup + PBackupPos*rewind_state_size;
@@ -305,7 +305,7 @@ void RestoreCVFrame()
if (MovieProcessing) if (MovieProcessing)
{ {
zmv_rewind_load(PBackupPos, MovieProcessing == 1 ? true : false); zmv_rewind_load(PBackupPos, MovieProcessing == 1 ? true : false);
} }
RewindTimer = ActualRewindFrames; RewindTimer = ActualRewindFrames;
} }
@@ -317,9 +317,9 @@ void SetupRewindBuffer()
RewindStates = 16; RewindStates = 16;
StateBackup = 0; StateBackup = 0;
StateBackup = (unsigned char *)malloc(rewind_state_size*RewindStates); StateBackup = (unsigned char *)malloc(rewind_state_size*RewindStates);
if (!StateBackup) if (!StateBackup)
{ {
asm_call(outofmemory); asm_call(outofmemory);
} }
} }
@@ -493,7 +493,7 @@ void repackfunct()
if (block && 0xC0) if (block && 0xC0)
{ {
Voice0Status = Voice1Status = Voice2Status = Voice3Status = 0; Voice0Status = Voice1Status = Voice2Status = Voice3Status = 0;
Voice4Status = Voice5Status = Voice6Status = Voice7Status = 0; Voice4Status = Voice5Status = Voice6Status = Voice7Status = 0;
} }
NoiseInc = (((NoiseSpeeds[(block & 0x1F)] * dspPAdj) >> 17) & 0xFFFFFFFF); NoiseInc = (((NoiseSpeeds[(block & 0x1F)] * dspPAdj) >> 17) & 0xFFFFFFFF);
@@ -656,7 +656,7 @@ static const char zst_header_old[] = "ZSNES Save State File V0.6\x1a\x3c";
static const char zst_header_cur[] = "ZSNES Save State File V143\x1a\x8f"; static const char zst_header_cur[] = "ZSNES Save State File V143\x1a\x8f";
void calculate_state_sizes() void calculate_state_sizes()
{ {
state_size = 0; state_size = 0;
zst_version = 143; zst_version = 143;
copy_state_data(0, state_size_tally, false); copy_state_data(0, state_size_tally, false);
@@ -691,12 +691,12 @@ void zst_save(FILE *fp, bool Thumbnail)
SfxRomBuffer -= SfxCROM; SfxRomBuffer -= SfxCROM;
SfxLastRamAdr -= SfxRAMMem; SfxLastRamAdr -= SfxRAMMem;
} }
if (SA1Enable) if (SA1Enable)
{ {
SaveSA1(); //Convert SA-1 stuff to standard, non displacement format SaveSA1(); //Convert SA-1 stuff to standard, non displacement format
} }
fhandle = fp; //Set global file handle fhandle = fp; //Set global file handle
copy_state_data(0, write_save_state_data, false); copy_state_data(0, write_save_state_data, false);
@@ -710,20 +710,20 @@ void zst_save(FILE *fp, bool Thumbnail)
{ {
RestoreSA1(); //Convert back SA-1 stuff RestoreSA1(); //Convert back SA-1 stuff
} }
if (Thumbnail) if (Thumbnail)
{ {
CapturePicture(); CapturePicture();
fwrite(PrevPicture, 1, 64*56*sizeof(unsigned short), fp); fwrite(PrevPicture, 1, 64*56*sizeof(unsigned short), fp);
} }
ResetOffset(); ResetOffset();
ResetState(); ResetState();
} }
void statesaver() void statesaver()
{ {
//Save State code //Save State code
#ifdef __LINUX__ #ifdef __LINUX__
SRAMChdir(); SRAMChdir();
#endif #endif
@@ -734,11 +734,11 @@ void statesaver()
if (mzt_save(fnamest+1, (cbitmode && !NoPictureSave) ? true : false, false)) if (mzt_save(fnamest+1, (cbitmode && !NoPictureSave) ? true : false, false))
{ {
Msgptr = "RR STATE SAVED."; Msgptr = "RR STATE SAVED.";
MessageOn = MsgCount; MessageOn = MsgCount;
} }
return; return;
} }
//'Auto increment savestate slot' code //'Auto increment savestate slot' code
if (AutoIncSaveSlot) if (AutoIncSaveSlot)
{ {
@@ -763,13 +763,13 @@ void statesaver()
} }
clim(); clim();
if ((fhandle = fopen(fnamest+1,"wb"))) if ((fhandle = fopen(fnamest+1,"wb")))
{ {
zst_save(fhandle, (cbitmode && !NoPictureSave) ? true : false); zst_save(fhandle, (cbitmode && !NoPictureSave) ? true : false);
fclose(fhandle); fclose(fhandle);
//Display message on the screen, 'STATE X SAVED.' //Display message on the screen, 'STATE X SAVED.'
if (fnamest[statefileloc] == 't') if (fnamest[statefileloc] == 't')
{ {
@@ -782,7 +782,7 @@ void statesaver()
Msgptr = txtsavemsg; Msgptr = txtsavemsg;
MessageOn = MsgCount; MessageOn = MsgCount;
} }
else else
{ {
//Display message on the screen, 'UNABLE TO SAVE.' //Display message on the screen, 'UNABLE TO SAVE.'
@@ -913,9 +913,9 @@ static void read_save_state_data(unsigned char **dest, void *data, size_t len)
bool zst_load(FILE *fp) bool zst_load(FILE *fp)
{ {
char zst_header_check[sizeof(zst_header_cur)-1]; char zst_header_check[sizeof(zst_header_cur)-1];
zst_version = 0; zst_version = 0;
Totalbyteloaded += fread(zst_header_check, 1, sizeof(zst_header_check), fp); Totalbyteloaded += fread(zst_header_check, 1, sizeof(zst_header_check), fp);
if (!memcmp(zst_header_check, zst_header_cur, sizeof(zst_header_check)-2)) if (!memcmp(zst_header_check, zst_header_cur, sizeof(zst_header_check)-2))
{ {
@@ -925,14 +925,14 @@ bool zst_load(FILE *fp)
{ {
zst_version = 60; //v0.60 - v1.42 zst_version = 60; //v0.60 - v1.42
} // the -2 means we only check the text - trust me, that's ok } // the -2 means we only check the text - trust me, that's ok
if (!zst_version) { return(false); } //Pre v0.60 saves are no longer loaded if (!zst_version) { return(false); } //Pre v0.60 saves are no longer loaded
load_save_size = 0; load_save_size = 0;
fhandle = fp; //Set global file handle fhandle = fp; //Set global file handle
copy_state_data(0, read_save_state_data, true); copy_state_data(0, read_save_state_data, true);
Totalbyteloaded += load_save_size; Totalbyteloaded += load_save_size;
if (SFXEnable) if (SFXEnable)
{ {
SfxCPB = SfxMemTable[(SfxPBR & 0xFF)]; SfxCPB = SfxMemTable[(SfxPBR & 0xFF)];
@@ -949,10 +949,10 @@ bool zst_load(FILE *fp)
All UpdateBanks() seems to do is break Oshaberi Parodius... All UpdateBanks() seems to do is break Oshaberi Parodius...
The C port is still present, just commented out The C port is still present, just commented out
*/ */
//UpdateBanks(); //UpdateBanks();
SA1UpdateDPageC(); SA1UpdateDPageC();
} }
if (SDD1Enable) if (SDD1Enable)
{ {
UpdateBanksSDD1(); UpdateBanksSDD1();
@@ -969,10 +969,29 @@ bool zst_load(FILE *fp)
ResetOffset(); ResetOffset();
ResetState(); ResetState();
procexecloop(); procexecloop();
return(true); return(true);
} }
void zst_sram_load(FILE *fp)
{
fseek(fp, sizeof(zst_header_cur)-1 + PH65816regsize + 199635, SEEK_CUR);
if (spcon) { fseek(fp, PHspcsave + PHdspsave + sizeof(DSPMem), SEEK_CUR); }
if (C4Enable) { fseek(fp, 8192, SEEK_CUR); }
if (SFXEnable) { fseek(fp, PHnum2writesfxreg + 131072, SEEK_CUR); }
if (SA1Enable)
{
fseek(fp, PHnum2writesa1reg, SEEK_CUR);
fread(SA1RAMArea, 1, 131072, fp); // SA-1 sram
fseek(fp, 15, SEEK_CUR);
}
if (DSP1Type) { fseek(fp, 2874, SEEK_CUR); }
if (SETAEnable) { fread(setaramdata, 1, 4096, fp); } // SETA sram
if (SPC7110Enable) { fseek(fp, PHnum2writespc7110reg + 65536, SEEK_CUR); }
fseek(fp, 227, SEEK_CUR);
if (ramsize) { fread(sram, 1, ramsize, fp); } // normal sram
}
void stateloader (unsigned char *statename, unsigned char keycheck, unsigned char xfercheck) void stateloader (unsigned char *statename, unsigned char keycheck, unsigned char xfercheck)
{ {
#ifdef __LINUX__ #ifdef __LINUX__
@@ -982,7 +1001,7 @@ void stateloader (unsigned char *statename, unsigned char keycheck, unsigned cha
if (keycheck) if (keycheck)
{ {
unsigned char statevalue; unsigned char statevalue;
pressed[1] = 0; pressed[1] = 0;
pressed[KeyLoadState] = 2; pressed[KeyLoadState] = 2;
multchange = 1; multchange = 1;
@@ -1001,19 +1020,19 @@ void stateloader (unsigned char *statename, unsigned char keycheck, unsigned cha
txtconvmsg[6] = statevalue; txtconvmsg[6] = statevalue;
txtnfndmsg[21] = statevalue; txtnfndmsg[21] = statevalue;
} }
switch (MovieProcessing) switch (MovieProcessing)
{ {
bool mzt_load(char *, bool); bool mzt_load(char *, bool);
case 1: case 1:
if (mzt_load(statename, true)) if (mzt_load(statename, true))
{ {
Msgptr = "RR STATE LOADED."; Msgptr = "RR STATE LOADED.";
MessageOn = MsgCount; MessageOn = MsgCount;
} }
return; return;
case 2: case 2:
if (mzt_load(statename, false)) if (mzt_load(statename, false))
{ {
@@ -1021,15 +1040,15 @@ void stateloader (unsigned char *statename, unsigned char keycheck, unsigned cha
MessageOn = MsgCount; MessageOn = MsgCount;
} }
return; return;
} }
clim(); clim();
//Actual state loading code //Actual state loading code
if ((fhandle = fopen(statename,"rb")) != NULL) if ((fhandle = fopen(statename,"rb")) != NULL)
{ {
if (xfercheck) { Totalbyteloaded = 0; } if (xfercheck) { Totalbyteloaded = 0; }
if (zst_load(fhandle)) if (zst_load(fhandle))
{ {
Msgptr = txtloadmsg; // 'STATE X LOADED.' Msgptr = txtloadmsg; // 'STATE X LOADED.'
@@ -1038,14 +1057,14 @@ void stateloader (unsigned char *statename, unsigned char keycheck, unsigned cha
{ {
Msgptr = txtconvmsg; // 'STATE X TOO OLD.' Msgptr = txtconvmsg; // 'STATE X TOO OLD.'
} }
fclose(fhandle); fclose(fhandle);
} }
else else
{ {
Msgptr = txtnfndmsg; // 'UNABLE TO LOAD STATE X.' Msgptr = txtnfndmsg; // 'UNABLE TO LOAD STATE X.'
} }
stim(); stim();
if (keycheck) if (keycheck)