mirror of
https://github.com/dborth/fceugx.git
synced 2024-10-31 22:45:05 +01:00
FDS saving works now!
This commit is contained in:
parent
219e471f83
commit
6ee208a9c3
@ -41,8 +41,8 @@
|
||||
#include "video.h"
|
||||
|
||||
|
||||
static void (*SPreSave)(void);
|
||||
static void (*SPostSave)(void);
|
||||
void (*SPreSave)(void);
|
||||
void (*SPostSave)(void);
|
||||
|
||||
static int SaveStateStatus[10];
|
||||
static int StateShow;
|
||||
@ -113,15 +113,15 @@ static int SubWrite(FILE *st, SFORMAT *sf)
|
||||
if(sf->s&RLSB)
|
||||
FlipByteOrder(sf->v,sf->s&(~RLSB));
|
||||
#endif
|
||||
|
||||
|
||||
fwrite((uint8 *)sf->v,1,sf->s&(~RLSB),st);
|
||||
/* Now restore the original byte order. */
|
||||
#ifndef LSB_FIRST
|
||||
if(sf->s&RLSB)
|
||||
if(sf->s&RLSB)
|
||||
FlipByteOrder(sf->v,sf->s&(~RLSB));
|
||||
#endif
|
||||
}
|
||||
sf++;
|
||||
sf++;
|
||||
}
|
||||
|
||||
return(acc);
|
||||
@ -132,9 +132,9 @@ static int WriteStateChunk(FILE *st, int type, SFORMAT *sf)
|
||||
int bsize;
|
||||
|
||||
fputc(type,st);
|
||||
|
||||
|
||||
bsize=SubWrite(0,sf);
|
||||
write32le(bsize,st);
|
||||
write32le(bsize,st);
|
||||
|
||||
if(!SubWrite(st,sf)) return(0);
|
||||
return (bsize+5);
|
||||
@ -235,11 +235,11 @@ int FCEUSS_SaveFP(FILE *st)
|
||||
{
|
||||
static uint32 totalsize;
|
||||
static uint8 header[16]="FCS";
|
||||
|
||||
|
||||
memset(header+4,0,13);
|
||||
header[3]=0xFF;
|
||||
FCEU_en32lsb(header + 8, FCEU_VERSION_NUMERIC);
|
||||
fwrite(header,1,16,st);
|
||||
fwrite(header,1,16,st);
|
||||
FCEUPPU_SaveState();
|
||||
FCEUSND_SaveState();
|
||||
totalsize=WriteStateChunk(st,1,SFCPU);
|
||||
@ -305,12 +305,12 @@ int FCEUSS_LoadFP(FILE *st)
|
||||
|
||||
x=ReadStateChunks(st,*(uint32*)(header+4));
|
||||
if(stateversion<9500) X.IRQlow=0;
|
||||
|
||||
|
||||
if(GameStateRestore) GameStateRestore(stateversion);
|
||||
if(x)
|
||||
{
|
||||
FCEUPPU_LoadState(stateversion);
|
||||
FCEUSND_LoadState(stateversion);
|
||||
FCEUSND_LoadState(stateversion);
|
||||
}
|
||||
return(x);
|
||||
}
|
||||
@ -348,7 +348,7 @@ int FCEUSS_Load(char *fname)
|
||||
SaveStateStatus[CurrentState]=1;
|
||||
fclose(st);
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveStateStatus[CurrentState]=1;
|
||||
@ -418,7 +418,7 @@ void FCEUI_SelectState(int w)
|
||||
CurrentState=w;
|
||||
StateShow=180;
|
||||
FCEU_DispMessage("-select state-");
|
||||
}
|
||||
}
|
||||
|
||||
void FCEUI_SaveState(char *fname)
|
||||
{
|
||||
@ -448,7 +448,7 @@ void FCEUI_LoadState(char *fname)
|
||||
if(FCEUSS_SaveFP(fp))
|
||||
{
|
||||
fclose(fp);
|
||||
FCEUNET_SendFile(FCEUNPCMD_LOADSTATE, fn);
|
||||
FCEUNET_SendFile(FCEUNPCMD_LOADSTATE, fn);
|
||||
}
|
||||
else fclose(fp);
|
||||
/*** REMOVED GC V1.0
|
||||
|
@ -221,6 +221,9 @@ int GCSaveChunk(int chunkid, SFORMAT *sf) {
|
||||
* It uses memory for it's I/O and has an added CHNK block.
|
||||
* The file is terminated with CHNK length of 0.
|
||||
****************************************************************************/
|
||||
extern void (*SPreSave)(void);
|
||||
extern void (*SPostSave)(void);
|
||||
|
||||
int GCFCEUSS_Save()
|
||||
{
|
||||
int totalsize = 0;
|
||||
@ -244,6 +247,7 @@ int GCFCEUSS_Save()
|
||||
|
||||
/*** And Comments ***/
|
||||
strncpy (Comment[1],romFilename,31); // we only have 32 chars to work with!
|
||||
Comment[1][31] = 0;
|
||||
memfwrite(&Comment[0], 64);
|
||||
totalsize += 64;
|
||||
|
||||
@ -255,8 +259,15 @@ int GCFCEUSS_Save()
|
||||
totalsize += GCSaveChunk(3, FCEUPPU_STATEINFO);
|
||||
totalsize += GCSaveChunk(4, FCEUCTRL_STATEINFO);
|
||||
totalsize += GCSaveChunk(5, FCEUSND_STATEINFO);
|
||||
|
||||
if(nesGameType == 4) // FDS
|
||||
SPreSave();
|
||||
|
||||
totalsize += GCSaveChunk(0x10, SFMDATA);
|
||||
|
||||
if(nesGameType == 4) // FDS
|
||||
SPostSave();
|
||||
|
||||
/*** Add terminating CHNK ***/
|
||||
memfwrite(&chunk,4);
|
||||
memfwrite(&zero,4);
|
||||
@ -270,13 +281,6 @@ int GCFCEUSS_Save()
|
||||
|
||||
bool SaveState (int method, bool silent)
|
||||
{
|
||||
if(nesGameType == 4)
|
||||
{
|
||||
if(!silent)
|
||||
WaitPrompt((char *)"Saving is not available for FDS games!");
|
||||
return false;
|
||||
}
|
||||
|
||||
ShowAction ((char*) "Saving...");
|
||||
|
||||
if(method == METHOD_AUTO)
|
||||
@ -326,13 +330,6 @@ bool SaveState (int method, bool silent)
|
||||
|
||||
bool LoadState (int method, bool silent)
|
||||
{
|
||||
if(nesGameType == 4)
|
||||
{
|
||||
if(!silent)
|
||||
WaitPrompt((char *)"Saving is not available for FDS games!");
|
||||
return false;
|
||||
}
|
||||
|
||||
ShowAction ((char*) "Loading...");
|
||||
|
||||
if(method == METHOD_AUTO)
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#define SAVEBUFFERSIZE (64 * 1024)
|
||||
#define SAVEBUFFERSIZE (512 * 1024)
|
||||
#define MAXJOLIET 255
|
||||
#define MAXDISPLAY 54
|
||||
|
||||
|
@ -241,6 +241,10 @@ PreferencesMenu ()
|
||||
GCSettings.SaveMethod++;
|
||||
if(GCSettings.SaveMethod == METHOD_MC_SLOTB)
|
||||
GCSettings.SaveMethod++;
|
||||
prefmenu[6][0] = '\0';
|
||||
#else
|
||||
sprintf (prefmenu[6], "Verify MC Saves %s",
|
||||
GCSettings.VerifySaves == true ? " ON" : "OFF");
|
||||
#endif
|
||||
|
||||
// correct load/save methods out of bounds
|
||||
@ -279,9 +283,6 @@ PreferencesMenu ()
|
||||
else if (GCSettings.AutoSave == 2) sprintf (prefmenu[5],"Auto Save STATE");
|
||||
else if (GCSettings.AutoSave == 3) sprintf (prefmenu[5],"Auto Save BOTH");
|
||||
|
||||
sprintf (prefmenu[6], "Verify MC Saves %s",
|
||||
GCSettings.VerifySaves == true ? " ON" : "OFF");
|
||||
|
||||
ret = RunMenu (prefmenu, prefmenuCount, (char*)"Preferences", 16, -1);
|
||||
|
||||
switch (ret)
|
||||
@ -354,6 +355,13 @@ GameMenu ()
|
||||
|
||||
while (quit == 0)
|
||||
{
|
||||
// disable RAM saving/loading for FDS games
|
||||
if(nesGameType == 4)
|
||||
{
|
||||
gamemenu[3][0] = '\0';
|
||||
gamemenu[4][0] = '\0';
|
||||
}
|
||||
|
||||
// disable RAM/STATE saving/loading if AUTO is on
|
||||
if (GCSettings.AutoLoad == 1) // Auto Load RAM
|
||||
gamemenu[3][0] = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user