From a925747bbd61bd4c78c7103879f373d817b76480 Mon Sep 17 00:00:00 2001 From: Brandon Wright Date: Sat, 25 Dec 2010 18:26:28 -0600 Subject: [PATCH] Work around PS3 version save state crash by using heap allocation for soundsnapshot. (danieldematteis) --- snapshot.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/snapshot.cpp b/snapshot.cpp index 060d5daa..1d7e029a 100644 --- a/snapshot.cpp +++ b/snapshot.cpp @@ -1272,6 +1272,7 @@ bool8 S9xUnfreezeGame (const char *filename) void S9xFreezeToStream (STREAM stream) { char buffer[1024]; + uint8 *soundsnapshot = new uint8[SPC_SAVE_STATE_BLOCK_SIZE]; S9xSetSoundMute(TRUE); @@ -1305,7 +1306,6 @@ void S9xFreezeToStream (STREAM stream) FreezeBlock (stream, "FIL", Memory.FillRAM, 0x8000); - uint8 soundsnapshot[SPC_SAVE_STATE_BLOCK_SIZE]; S9xAPUSaveState(soundsnapshot); FreezeBlock (stream, "SND", soundsnapshot, SPC_SAVE_STATE_BLOCK_SIZE); @@ -1428,6 +1428,8 @@ void S9xFreezeToStream (STREAM stream) #endif S9xSetSoundMute(FALSE); + + delete [] soundsnapshot; } int S9xUnfreezeFromStream (STREAM stream) @@ -2194,7 +2196,7 @@ static void UnfreezeStructFromCopy (void *sbase, FreezeData *fields, int num_fie case 1: if (fields[i].offset < 0) { - ptr++; + ptr++; break; }