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];
if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB)
sprintf(filepath, "%s Auto.frz", Memory.ROMFilename);
else
sprintf(filepath, "%s/%s Auto.frz", GCSettings.SaveFolder, Memory.ROMFilename);
if(!MakeFilePath(filepath, FILE_SNAPSHOT, method, Memory.ROMFilename, 0))
return false;
return NGCFreezeGame(filepath, method, silent);
}
@ -295,7 +294,7 @@ NGCUnfreezeGame (char * filepath, int method, bool silent)
if(method == METHOD_AUTO)
return 0;
AllocSaveBuffer ();
AllocSaveBuffer();
offset = LoadFile(filepath, method, silent);
@ -322,17 +321,20 @@ NGCUnfreezeGame (char * filepath, int method, bool silent)
if ( err!=Z_OK )
{
offset = 0;
sprintf (msg, "Unzip error %s",zError(err));
ErrorPrompt(msg);
}
else if ( DestBuffSize != decompressedsize )
{
offset = 0;
ErrorPrompt("Unzipped size doesn't match expected size!");
}
else
{
offset = SAVEBUFFERSIZE;
memcpy (savebuffer, zipbuffer, SAVEBUFFERSIZE);
offset = decompressedsize;
memset(savebuffer, 0, SAVEBUFFERSIZE);
memcpy (savebuffer, zipbuffer, decompressedsize);
}
free(zipbuffer);
}
@ -350,7 +352,7 @@ NGCUnfreezeGame (char * filepath, int method, bool silent)
if(!silent)
ErrorPrompt("Freeze file not found");
}
FreeSaveBuffer ();
FreeSaveBuffer();
return result;
}

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_SCOPE][CTRLR_GCPAD], "btnmap_scope_gcpad", "Superscope - GameCube Controller");
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_JUST][CTRLR_GCPAD], "btnmap_just_gcpad", "Justifier - GameCube Controller");
createXMLController(btnmap[CTRL_JUST][CTRLR_WIIMOTE], "btnmap_just_wiimote", "Justifier - Wiimote");
@ -188,10 +188,9 @@ preparePrefsData (int method)
mxmlDelete(xml);
return datasize;
return datasize+offset;
}
/****************************************************************************
* loadXMLSetting
*

View File

@ -103,8 +103,8 @@ decodesavedata (int method, int readsize)
// Check for sram comment
memcpy (sramsavecomment, savebuffer+offset, 32);
// version 0xx found!
if ( (strncmp (sramsavecomment, "Snes9x GX 0", 11) == 0) )
// Snes9x GX save found!
if ( (strncmp (sramsavecomment, "Snes9x GX", 9) == 0) )
{
// adjust offset
if(method != METHOD_MC_SLOTA && method != METHOD_MC_SLOTB)
@ -116,13 +116,13 @@ decodesavedata (int method, int readsize)
memcpy (Memory.SRAM, savebuffer + offset, size);
}
// check for SRAM from other version/platform of snes9x
else if ( readsize == size || readsize == size + SRTC_SRAM_PAD)
else if (readsize == size || readsize == size + SRTC_SRAM_PAD)
{
// SRAM data should be at the start of the file, just import it and
// ignore anything after the SRAM
memcpy (Memory.SRAM, savebuffer, size);
}
else if ( readsize == size + 512 )
else if (readsize == size + 512)
{
// SRAM has a 512 byte header - remove it, then import the SRAM,
// ignoring anything after the SRAM
@ -182,10 +182,9 @@ LoadSRAMAuto (int method, bool silent)
char filepath[1024];
if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB)
sprintf(filepath, "%s Auto.srm", Memory.ROMFilename);
else
sprintf(filepath, "%s/%s Auto.srm", GCSettings.SaveFolder, Memory.ROMFilename);
if(!MakeFilePath(filepath, FILE_SRAM, method, Memory.ROMFilename, 0))
return false;
return LoadSRAM(filepath, method, silent);
}