mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-24 03:29:22 +01:00
fix several longstanding bugs
This commit is contained in:
parent
84aaefd004
commit
31691ff94f
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +294,7 @@ NGCUnfreezeGame (char * filepath, int method, bool silent)
|
|||||||
if(method == METHOD_AUTO)
|
if(method == METHOD_AUTO)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
AllocSaveBuffer ();
|
AllocSaveBuffer();
|
||||||
|
|
||||||
offset = LoadFile(filepath, method, silent);
|
offset = LoadFile(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);
|
||||||
}
|
}
|
||||||
@ -350,7 +352,7 @@ NGCUnfreezeGame (char * filepath, int method, bool silent)
|
|||||||
if(!silent)
|
if(!silent)
|
||||||
ErrorPrompt("Freeze file not found");
|
ErrorPrompt("Freeze file not found");
|
||||||
}
|
}
|
||||||
FreeSaveBuffer ();
|
FreeSaveBuffer();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
*
|
*
|
||||||
|
@ -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)
|
||||||
@ -116,13 +116,13 @@ decodesavedata (int method, int readsize)
|
|||||||
memcpy (Memory.SRAM, savebuffer + offset, size);
|
memcpy (Memory.SRAM, savebuffer + offset, size);
|
||||||
}
|
}
|
||||||
// check for SRAM from other version/platform of snes9x
|
// 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
|
// SRAM data should be at the start of the file, just import it and
|
||||||
// ignore anything after the SRAM
|
// ignore anything after the SRAM
|
||||||
memcpy (Memory.SRAM, savebuffer, size);
|
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,
|
// SRAM has a 512 byte header - remove it, then import the SRAM,
|
||||||
// ignoring anything after the SRAM
|
// ignoring anything after the SRAM
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user