Example #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);
}
Example #2
0
/****************************************************************************
 * GCFCEUSS_Save
 *
 * This is a modified version of FCEUSS_Save
 * It uses memory for it's I/O and has an added CHNK block.
 * The file is terminated with CHNK length of 0.
 ****************************************************************************/
int GCFCEUSS_Save()
{
    int totalsize = 0;
    static unsigned char header[16] = "FCS\xff";
    char chunk[] = "CHKE";
    int zero = 0;
    char Comment[2][100] = { { MENU_CREDITS_TITLE }, { "GAME" } };

    memopen();	/*** Reset Memory File ***/

    /*** Add version ID ***/
    memcpy(&header[8], &mcversion, 4);

    /*** Do internal Saving ***/
    FCEUPPU_SaveState();
    FCEUSND_SaveState();

    /*** Write Icon ***/
    memfwrite(&saveicon, sizeof(saveicon));
    totalsize += sizeof(saveicon);

    /*** And Comments ***/
    strncpy (Comment[1],romFilename,31); // we only have 32 chars to work with!
    memfwrite(&Comment[0], 64);
    totalsize += 64;

    /*** Write header ***/
    memfwrite(&header, 16);
    totalsize += 16;
    totalsize += GCSaveChunk(1, SFCPU);
    totalsize += GCSaveChunk(2, SFCPUC);
    totalsize += GCSaveChunk(3, FCEUPPU_STATEINFO);
    totalsize += GCSaveChunk(4, FCEUCTRL_STATEINFO);
    totalsize += GCSaveChunk(5, FCEUSND_STATEINFO);
    totalsize += GCSaveChunk(0x10, SFMDATA);

    /*** Add terminating CHNK ***/
    memfwrite(&chunk,4);
    memfwrite(&zero,4);
    totalsize += 8;

    /*** Update size element ***/
    memcpy(&savebuffer[FILESIZEOFFSET], &totalsize, 4);

    return totalsize;
}
Example #3
0
/****************************************************************************
 * GCFCEUSS_Save
 *
 * This is a modified version of FCEUSS_Save
 * It uses memory for it's I/O and has an added CHNK block.
 * The file is terminated with CHNK length of 0.
 ****************************************************************************/
int GCFCEUSS_Save()
{
	int totalsize = 0;
	static unsigned char header[16] = "FCS\xff";
	char chunk[] = "CHKE";
	int zero = 0;
	char Comment[2][32] = { { "FCEU GC Version 1.0.9" }, { "A GAME" } };

	memopen();	/*** Reset Memory File ***/

	/*** Add version ID ***/
	memcpy(&header[8], &mcversion, 4);	

	/*** Do internal Saving ***/
	FCEUPPU_SaveState();
	FCEUSND_SaveState();

	/*** Write Icon ***/
	memfwrite(&saveicon, sizeof(saveicon));
	totalsize += sizeof(saveicon);
	
	/*** And Comments ***/
	sprintf(Comment[1], "NES CRC 0x%08x", iNESGameCRC32);
	memfwrite(&Comment[0], 64);
	totalsize += 64;

	/*** Write header ***/
	memfwrite(&header, 16);
	totalsize += 16;
	totalsize += GCSaveChunk(1, SFCPU);
	totalsize += GCSaveChunk(2, SFCPUC);
	totalsize += GCSaveChunk(3, FCEUPPU_STATEINFO);
	totalsize += GCSaveChunk(4, FCEUCTRL_STATEINFO);
	totalsize += GCSaveChunk(5, FCEUSND_STATEINFO);
	totalsize += GCSaveChunk(0x10, SFMDATA);
	
	/*** Add terminating CHNK ***/
	memfwrite(&chunk,4);
	memfwrite(&zero,4);
	totalsize += 8;

	/*** Update size element ***/
	memcpy(&statebuffer[FILESIZEOFFSET], &totalsize, 4);

	return totalsize;
}
Example #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);
}