Пример #1
0
int FCEUSS_SaveFP(MEM_TYPE *st) {
	static uint32 totalsize;
	uint8 header[16] = { 0 };

	header[0] = 'F';
	header[1] = 'C';
	header[2] = 'S';
	header[3] = 0xFF;

	header[3] = 0xFF;
	FCEU_en32lsb(header + 8, FCEU_VERSION_NUMERIC);
	fwrite(header, 1, 16, st);
	FCEUPPU_SaveState();
	FCEUSND_SaveState();
	totalsize = WriteStateChunk(st, 1, SFCPU);
	totalsize += WriteStateChunk(st, 2, SFCPUC);
	totalsize += WriteStateChunk(st, 3, FCEUPPU_STATEINFO);
	totalsize += WriteStateChunk(st, 4, FCEUCTRL_STATEINFO);
	totalsize += WriteStateChunk(st, 5, FCEUSND_STATEINFO);
	if (SPreSave) SPreSave();
	totalsize += WriteStateChunk(st, 0x10, SFMDATA);
	if (SPreSave) SPostSave();

	fseek(st, 4, SEEK_SET);
	write32le(totalsize, st);
	return(1);
}
Пример #2
0
void SaveState(void)
{
	FILE *st=NULL;
	char *fname;

	TempAddrT=TempAddr;
	RefreshAddrT=RefreshAddr;

	if(geniestage==1)
	{
	 FCEU_DispMessage("Cannot save FCS in GG screen.");
	 return;
        }

	 fname = FCEU_MakeFName(FCEUMKF_STATE,CurrentState,0);
	 st=fopen(fname,"wb");
	 free(fname);

	 if(st!=NULL)
	 {
	  static uint32 totalsize;
	  static uint8 header[16]="FCS";
	  memset(header+4,0,13);
	  header[3]=VERSION_NUMERIC;
	  fwrite(header,1,16,st);

#ifdef ASM_6502
          asmcpu_pack();
#endif
	  totalsize=WriteStateChunk(st,1,SFCPU);
	  totalsize+=WriteStateChunk(st,2,SFCPUC);
	  totalsize+=WriteStateChunk(st,3,FCEUPPU_STATEINFO);
	  totalsize+=WriteStateChunk(st,4,FCEUCTRL_STATEINFO);
	  totalsize+=WriteStateChunk(st,5,SFSND);


	  if(SPreSave) SPreSave();
	  totalsize+=WriteStateChunk(st,0x10,SFMDATA);
	  if(SPostSave) SPostSave();

	  fseek(st,4,SEEK_SET);
	  write32(totalsize,st);
	  SaveStateStatus[CurrentState]=1;
	  fclose(st);
#ifdef GP2X
	  sync();
#endif
	  FCEU_DispMessage("State %d saved.",CurrentState);
	 }
	 else
	  FCEU_DispMessage("State %d save error.",CurrentState);
}
Пример #3
0
void SaveState(const char *fname)
{
	MEMFILE *st=NULL;

	TempAddrT=TempAddr;
	RefreshAddrT=RefreshAddr;

	if(geniestage==1)
	{
	 FCEU_DispMessage("Cannot save FCS in GG screen.");
	 return;
        }

	st=mem_fopen_write(fname);

	 if(st!=NULL)
	 {
	  static uint32 totalsize;
	  static uint8 header[16]="FCS";
	  memset(header+4,0,13);
	  header[3]=VERSION_NUMERIC;
	  mem_fwrite(header,1,16,st);

#ifdef ASM_6502
          asmcpu_pack();
#endif
	  totalsize=WriteStateChunk(st,1,SFCPU);
	  totalsize+=WriteStateChunk(st,2,SFCPUC);
	  totalsize+=WriteStateChunk(st,3,FCEUPPU_STATEINFO);
	  totalsize+=WriteStateChunk(st,4,FCEUCTRL_STATEINFO);
	  totalsize+=WriteStateChunk(st,5,SFSND);


	  if(SPreSave) SPreSave();
	  totalsize+=WriteStateChunk(st,0x10,SFMDATA);
	  if(SPostSave) SPostSave();

	  mem_fseek(st,4,SEEK_SET);
	  mem_write32(totalsize,st);
	  SaveStateStatus[CurrentState]=1;
	  mem_fclose(st);
	 }
}
Пример #4
0
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);
  FCEUPPU_SaveState();
  FCEUSND_SaveState();
  totalsize=WriteStateChunk(st,1,SFCPU);
  totalsize+=WriteStateChunk(st,2,SFCPUC);
  totalsize+=WriteStateChunk(st,3,FCEUPPU_STATEINFO);
  totalsize+=WriteStateChunk(st,4,FCEUCTRL_STATEINFO);
  totalsize+=WriteStateChunk(st,5,FCEUSND_STATEINFO);
  if(SPreSave) SPreSave();
  totalsize+=WriteStateChunk(st,0x10,SFMDATA);
  if(SPreSave) SPostSave();

  fseek(st,4,SEEK_SET);
  write32le(totalsize,st);
  return(1);
}