diff options
author | StapleButter <thetotalworm@gmail.com> | 2018-11-05 16:14:48 +0100 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2018-11-05 16:14:48 +0100 |
commit | fa4fa164cb56b9fa6b3c727f0254ac4887d93501 (patch) | |
tree | 1b5485873e826e069b0ef8253eb958fd3ce4deec /src | |
parent | 9b32418367ee09628b499abdf9a8be7e9c989952 (diff) |
* 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.
Diffstat (limited to 'src')
-rw-r--r-- | src/GPU3D.cpp | 4 | ||||
-rw-r--r-- | src/Savestate.h | 2 | ||||
-rw-r--r-- | src/libui_sdl/main.cpp | 26 |
3 files changed, 19 insertions, 13 deletions
diff --git a/src/GPU3D.cpp b/src/GPU3D.cpp index 8aaef7d..79863ef 100644 --- a/src/GPU3D.cpp +++ b/src/GPU3D.cpp @@ -387,8 +387,8 @@ void DoSavestate(Savestate* file) file->VarArray(TexMatrix, 16*4); file->VarArray(ProjMatrixStack, 16*4); - file->VarArray(PosMatrixStack, 31*16*4); - file->VarArray(VecMatrixStack, 31*16*4); + file->VarArray(PosMatrixStack, 32*16*4); + file->VarArray(VecMatrixStack, 32*16*4); file->VarArray(TexMatrixStack, 16*4); file->Var32((u32*)&ProjMatrixStackPointer); diff --git a/src/Savestate.h b/src/Savestate.h index fa01f6b..81541f9 100644 --- a/src/Savestate.h +++ b/src/Savestate.h @@ -22,7 +22,7 @@ #include <stdio.h> #include "types.h" -#define SAVESTATE_MAJOR 1 +#define SAVESTATE_MAJOR 2 #define SAVESTATE_MINOR 0 class Savestate diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index 4c19314..9ca829e 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -922,6 +922,8 @@ void LoadState(int slot) NDS::DoSavestate(backup); delete backup; + bool failed = false; + Savestate* state = new Savestate(filename, false); if (state->Error) { @@ -931,26 +933,30 @@ void LoadState(int slot) // current state might be crapoed, so restore from sane backup state = new Savestate("timewarp.mln", false); + failed = true; } NDS::DoSavestate(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); + int len = strlen(SRAMPath); + strcpy(&SRAMPath[len], ".sav"); + SRAMPath[len+4] = '\0'; - strncpy(SRAMPath, filename, 1019); - int len = strlen(SRAMPath); - strcpy(&SRAMPath[len], ".sav"); - SRAMPath[len+4] = '\0'; + NDS::RelocateSave(SRAMPath, false); + } - NDS::RelocateSave(SRAMPath, false); + SavestateLoaded = true; + uiMenuItemEnable(MenuItem_UndoStateLoad); } - SavestateLoaded = true; - uiMenuItemEnable(MenuItem_UndoStateLoad); - EmuRunning = prevstatus; } |