From 043376d3886fc4072bc67a09d9b4c40a16e89b49 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 8 Dec 2014 20:22:21 +0100 Subject: [PATCH] Backport some patches http://github.com/libretro/fceu-next/commit/b2b1162bc46fe4f849c3373094339fb82609a71b --- src/drivers/libretro/fceu/state.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/drivers/libretro/fceu/state.c b/src/drivers/libretro/fceu/state.c index 057af7a..0c8bcd6 100644 --- a/src/drivers/libretro/fceu/state.c +++ b/src/drivers/libretro/fceu/state.c @@ -183,7 +183,7 @@ static int WriteStateChunk_Mem(memstream_t *mem, int type, SFORMAT *sf) memstream_putc(mem, type); - bsize = SubWrite(0,sf); + bsize = SubWrite_Mem(0,sf); write32le_mem(bsize, mem); if (!SubWrite_Mem(mem, sf)) @@ -385,15 +385,14 @@ extern int geniestage; int FCEUSS_SaveFP(MEM_TYPE *st) { - static uint32 totalsize; - uint8 header[16] = { 0 }; + 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(); @@ -418,11 +417,14 @@ void FCEUSS_Save_Mem(void) { memstream_t *mem = memstream_open(1); - static uint32 totalsize; - static uint8 header[16] = "FCS"; - - memset(header + 4, 0, 12); + uint32 totalsize; + uint8 header[16] = {0}; + + header[0] = 'F'; + header[1] = 'C'; + header[2] = 'S'; header[3] = 0xFF; + FCEU_en32lsb(header + 8, FCEU_VERSION_NUMERIC); memstream_write(mem, header, 16);