Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Abort load state if it uses a different dsp engine, instead of crashing.
  • Loading branch information
RachelBryk committed Feb 25, 2013
1 parent 0e4b07d commit a450ba4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp
Expand Up @@ -27,6 +27,7 @@
#include "UCodes/UCodes.h"
#include "../AudioInterface.h"
#include "ConfigManager.h"
#include "Core.h"

DSPHLE::DSPHLE() {
m_InitMixer = false;
Expand Down Expand Up @@ -130,6 +131,14 @@ void DSPHLE::SwapUCode(u32 _crc)

void DSPHLE::DoState(PointerWrap &p)
{
bool isHLE = true;
p.Do(isHLE);
if (isHLE != true && p.GetMode() == PointerWrap::MODE_READ)
{
Core::DisplayMessage("Save states made with the LLE audio engine are incompatible with the HLE DSP engine. Aborting load state.", 3000);
p.SetMode(PointerWrap::MODE_VERIFY);
return;
}
bool prevInitMixer = m_InitMixer;
p.Do(m_InitMixer);
if (prevInitMixer != m_InitMixer && p.GetMode() == PointerWrap::MODE_READ)
Expand Down
9 changes: 9 additions & 0 deletions Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp
Expand Up @@ -26,6 +26,7 @@
#include "IniFile.h"
#include "ConfigManager.h"
#include "CPUDetect.h"
#include "Core.h"

#include "DSPLLEGlobals.h" // Local
#include "DSP/DSPInterpreter.h"
Expand Down Expand Up @@ -56,6 +57,14 @@ Common::Event ppcEvent;

void DSPLLE::DoState(PointerWrap &p)
{
bool isHLE = false;
p.Do(isHLE);
if (isHLE != false && p.GetMode() == PointerWrap::MODE_READ)
{
Core::DisplayMessage("Save states made with the HLE audio engine are incompatible with the LLE DSP engine. Aborting load state.", 3000);
p.SetMode(PointerWrap::MODE_VERIFY);
return;
}
p.Do(g_dsp.r);
p.Do(g_dsp.pc);
#if PROFILE
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/State.cpp
Expand Up @@ -71,7 +71,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
static std::thread g_save_thread;

// Don't forget to increase this after doing changes on the savestate system
static const u32 STATE_VERSION = 13;
static const u32 STATE_VERSION = 14;

struct StateHeader
{
Expand Down

0 comments on commit a450ba4

Please sign in to comment.