DSPHLE: Try to make zelda ucode savestates safer (sorry, this'll break your current states, as usual).

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3788 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2009-07-13 20:56:49 +00:00
parent 48a5c4211c
commit fda61d91d5
8 changed files with 68 additions and 9 deletions

View file

@ -93,4 +93,41 @@ void CMailHandler::Update()
}
}
void CMailHandler::DoState(PointerWrap &p)
{
if (p.GetMode() == PointerWrap::MODE_READ)
{
Clear();
int sz;
p.Do(sz);
for (int i = 0; i < sz; i++)
{
u32 mail;
p.Do(mail);
m_Mails.push(mail);
}
}
else // WRITE and MEASURE
{
std::queue<u32> temp;
int sz = m_Mails.size();
p.Do(sz);
for (int i = 0; i < sz; i++)
{
u32 value = m_Mails.front();
m_Mails.pop();
p.Do(value);
temp.push(value);
}
if (!m_Mails.empty())
PanicAlert("CMailHandler::DoState - WTF?");
// Restore queue.
for (int i = 0; i < sz; i++)
{
u32 value = temp.front();
temp.pop();
m_Mails.push(value);
}
}
}