* store all 32 matrix stack entries in savestates instead of 31.
* bump savestate version up. will break compatibility, but the alternative would be guessing the missing matrix entries somehow, so blarg. * avoid relocating the savefile if loading a savestate fails.
This commit is contained in:
parent
9b32418367
commit
fa4fa164cb
|
@ -387,8 +387,8 @@ void DoSavestate(Savestate* file)
|
||||||
file->VarArray(TexMatrix, 16*4);
|
file->VarArray(TexMatrix, 16*4);
|
||||||
|
|
||||||
file->VarArray(ProjMatrixStack, 16*4);
|
file->VarArray(ProjMatrixStack, 16*4);
|
||||||
file->VarArray(PosMatrixStack, 31*16*4);
|
file->VarArray(PosMatrixStack, 32*16*4);
|
||||||
file->VarArray(VecMatrixStack, 31*16*4);
|
file->VarArray(VecMatrixStack, 32*16*4);
|
||||||
file->VarArray(TexMatrixStack, 16*4);
|
file->VarArray(TexMatrixStack, 16*4);
|
||||||
|
|
||||||
file->Var32((u32*)&ProjMatrixStackPointer);
|
file->Var32((u32*)&ProjMatrixStackPointer);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#define SAVESTATE_MAJOR 1
|
#define SAVESTATE_MAJOR 2
|
||||||
#define SAVESTATE_MINOR 0
|
#define SAVESTATE_MINOR 0
|
||||||
|
|
||||||
class Savestate
|
class Savestate
|
||||||
|
|
|
@ -922,6 +922,8 @@ void LoadState(int slot)
|
||||||
NDS::DoSavestate(backup);
|
NDS::DoSavestate(backup);
|
||||||
delete backup;
|
delete backup;
|
||||||
|
|
||||||
|
bool failed = false;
|
||||||
|
|
||||||
Savestate* state = new Savestate(filename, false);
|
Savestate* state = new Savestate(filename, false);
|
||||||
if (state->Error)
|
if (state->Error)
|
||||||
{
|
{
|
||||||
|
@ -931,26 +933,30 @@ void LoadState(int slot)
|
||||||
|
|
||||||
// current state might be crapoed, so restore from sane backup
|
// current state might be crapoed, so restore from sane backup
|
||||||
state = new Savestate("timewarp.mln", false);
|
state = new Savestate("timewarp.mln", false);
|
||||||
|
failed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
NDS::DoSavestate(state);
|
NDS::DoSavestate(state);
|
||||||
delete state;
|
delete state;
|
||||||
|
|
||||||
if (Config::SavestateRelocSRAM && ROMPath[0]!='\0')
|
if (!failed)
|
||||||
{
|
{
|
||||||
strncpy(PrevSRAMPath, SRAMPath, 1024);
|
if (Config::SavestateRelocSRAM && ROMPath[0]!='\0')
|
||||||
|
{
|
||||||
|
strncpy(PrevSRAMPath, SRAMPath, 1024);
|
||||||
|
|
||||||
strncpy(SRAMPath, filename, 1019);
|
strncpy(SRAMPath, filename, 1019);
|
||||||
int len = strlen(SRAMPath);
|
int len = strlen(SRAMPath);
|
||||||
strcpy(&SRAMPath[len], ".sav");
|
strcpy(&SRAMPath[len], ".sav");
|
||||||
SRAMPath[len+4] = '\0';
|
SRAMPath[len+4] = '\0';
|
||||||
|
|
||||||
NDS::RelocateSave(SRAMPath, false);
|
NDS::RelocateSave(SRAMPath, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
SavestateLoaded = true;
|
||||||
|
uiMenuItemEnable(MenuItem_UndoStateLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
SavestateLoaded = true;
|
|
||||||
uiMenuItemEnable(MenuItem_UndoStateLoad);
|
|
||||||
|
|
||||||
EmuRunning = prevstatus;
|
EmuRunning = prevstatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue