Abort load state if it uses a different dsp engine, instead of crashing.

This commit is contained in:
Rachel Bryk 2013-02-25 15:58:12 -05:00
parent 0e4b07ddf9
commit a450ba4420
3 changed files with 19 additions and 1 deletions

View File

@ -27,6 +27,7 @@
#include "UCodes/UCodes.h"
#include "../AudioInterface.h"
#include "ConfigManager.h"
#include "Core.h"
DSPHLE::DSPHLE() {
m_InitMixer = false;
@ -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)

View File

@ -26,6 +26,7 @@
#include "IniFile.h"
#include "ConfigManager.h"
#include "CPUDetect.h"
#include "Core.h"
#include "DSPLLEGlobals.h" // Local
#include "DSP/DSPInterpreter.h"
@ -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

View File

@ -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
{