fix several longstanding bugs

This commit is contained in:
dborth 2009-03-20 08:26:10 +00:00
parent 84aaefd004
commit 31691ff94f
4 changed files with 26 additions and 26 deletions

View File

@ -232,10 +232,9 @@ NGCFreezeGameAuto (int method, bool silent)
char filepath[1024]; char filepath[1024];
if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB) if(!MakeFilePath(filepath, FILE_SNAPSHOT, method, Memory.ROMFilename, 0))
sprintf(filepath, "%s Auto.frz", Memory.ROMFilename); return false;
else
sprintf(filepath, "%s/%s Auto.frz", GCSettings.SaveFolder, Memory.ROMFilename);
return NGCFreezeGame(filepath, method, silent); return NGCFreezeGame(filepath, method, silent);
} }
@ -322,17 +321,20 @@ NGCUnfreezeGame (char * filepath, int method, bool silent)
if ( err!=Z_OK ) if ( err!=Z_OK )
{ {
offset = 0;
sprintf (msg, "Unzip error %s",zError(err)); sprintf (msg, "Unzip error %s",zError(err));
ErrorPrompt(msg); ErrorPrompt(msg);
} }
else if ( DestBuffSize != decompressedsize ) else if ( DestBuffSize != decompressedsize )
{ {
offset = 0;
ErrorPrompt("Unzipped size doesn't match expected size!"); ErrorPrompt("Unzipped size doesn't match expected size!");
} }
else else
{ {
offset = SAVEBUFFERSIZE; offset = decompressedsize;
memcpy (savebuffer, zipbuffer, SAVEBUFFERSIZE); memset(savebuffer, 0, SAVEBUFFERSIZE);
memcpy (savebuffer, zipbuffer, decompressedsize);
} }
free(zipbuffer); free(zipbuffer);
} }

View File

@ -179,7 +179,7 @@ preparePrefsData (int method)
createXMLController(btnmap[CTRL_PAD][CTRLR_NUNCHUK], "btnmap_pad_nunchuk", "SNES Pad - Nunchuk + Wiimote"); createXMLController(btnmap[CTRL_PAD][CTRLR_NUNCHUK], "btnmap_pad_nunchuk", "SNES Pad - Nunchuk + Wiimote");
createXMLController(btnmap[CTRL_SCOPE][CTRLR_GCPAD], "btnmap_scope_gcpad", "Superscope - GameCube Controller"); createXMLController(btnmap[CTRL_SCOPE][CTRLR_GCPAD], "btnmap_scope_gcpad", "Superscope - GameCube Controller");
createXMLController(btnmap[CTRL_SCOPE][CTRLR_WIIMOTE], "btnmap_scope_wiimote", "Superscope - Wiimote"); createXMLController(btnmap[CTRL_SCOPE][CTRLR_WIIMOTE], "btnmap_scope_wiimote", "Superscope - Wiimote");
createXMLController(btnmap[CTRL_MOUSE][CTRLR_GCPAD], "btnmap_mouse_gcpad", "MMouse - GameCube Controller"); createXMLController(btnmap[CTRL_MOUSE][CTRLR_GCPAD], "btnmap_mouse_gcpad", "Mouse - GameCube Controller");
createXMLController(btnmap[CTRL_MOUSE][CTRLR_WIIMOTE], "btnmap_mouse_wiimote", "Mouse - Wiimote"); createXMLController(btnmap[CTRL_MOUSE][CTRLR_WIIMOTE], "btnmap_mouse_wiimote", "Mouse - Wiimote");
createXMLController(btnmap[CTRL_JUST][CTRLR_GCPAD], "btnmap_just_gcpad", "Justifier - GameCube Controller"); createXMLController(btnmap[CTRL_JUST][CTRLR_GCPAD], "btnmap_just_gcpad", "Justifier - GameCube Controller");
createXMLController(btnmap[CTRL_JUST][CTRLR_WIIMOTE], "btnmap_just_wiimote", "Justifier - Wiimote"); createXMLController(btnmap[CTRL_JUST][CTRLR_WIIMOTE], "btnmap_just_wiimote", "Justifier - Wiimote");
@ -188,10 +188,9 @@ preparePrefsData (int method)
mxmlDelete(xml); mxmlDelete(xml);
return datasize; return datasize+offset;
} }
/**************************************************************************** /****************************************************************************
* loadXMLSetting * loadXMLSetting
* *

View File

@ -103,8 +103,8 @@ decodesavedata (int method, int readsize)
// Check for sram comment // Check for sram comment
memcpy (sramsavecomment, savebuffer+offset, 32); memcpy (sramsavecomment, savebuffer+offset, 32);
// version 0xx found! // Snes9x GX save found!
if ( (strncmp (sramsavecomment, "Snes9x GX 0", 11) == 0) ) if ( (strncmp (sramsavecomment, "Snes9x GX", 9) == 0) )
{ {
// adjust offset // adjust offset
if(method != METHOD_MC_SLOTA && method != METHOD_MC_SLOTB) if(method != METHOD_MC_SLOTA && method != METHOD_MC_SLOTB)
@ -182,10 +182,9 @@ LoadSRAMAuto (int method, bool silent)
char filepath[1024]; char filepath[1024];
if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB) if(!MakeFilePath(filepath, FILE_SRAM, method, Memory.ROMFilename, 0))
sprintf(filepath, "%s Auto.srm", Memory.ROMFilename); return false;
else
sprintf(filepath, "%s/%s Auto.srm", GCSettings.SaveFolder, Memory.ROMFilename);
return LoadSRAM(filepath, method, silent); return LoadSRAM(filepath, method, silent);
} }