Simplify savestate code so it's all automagical.

If you can't beat 'em, join 'em?
This commit is contained in:
Unknown W. Brackets 2013-02-04 01:31:02 -08:00
parent 8f10c7f161
commit a4032c5170
9 changed files with 108 additions and 165 deletions

View file

@ -198,27 +198,11 @@ public:
}
void DoState(PointerWrap &p) {
int n = (int) calls_.size();
p.Do(n);
// Gotta delete the calls.
if (p.mode == p.MODE_READ) {
clear();
for (int i = 0; i < n; ++i) {
int k;
p.Do(k);
MipsCall *call = new MipsCall();
call->DoState(p);
calls_[k] = call;
}
} else {
std::map<int, MipsCall *>::iterator it, end;
for (it = calls_.begin(), end = calls_.end(); it != end; ++it) {
p.Do(it->first);
it->second->DoState(p);
}
}
p.Do(calls_);
p.Do(idGen_);
p.DoMarker("MipsCallManager");
}
@ -631,28 +615,7 @@ void __KernelThreadingDoState(PointerWrap &p)
p.Do(dispatchEnabled);
p.Do(curModule);
int n = (int) threadReadyQueue.size();
p.Do(n);
if (p.mode == p.MODE_READ)
{
threadReadyQueue.clear();
for (int i = 0; i < n; ++i)
{
u32 prio;
p.Do(prio);
ThreadList threads;
p.Do(threads, dv);
threadReadyQueue[prio] = threads;
}
}
else
{
for (auto it = threadReadyQueue.begin(), end = threadReadyQueue.end(); it != end; ++it)
{
p.Do(it->first);
p.Do(it->second, dv);
}
}
p.Do(threadReadyQueue);
p.Do(eventScheduledWakeup);
CoreTiming::RestoreRegisterEvent(eventScheduledWakeup, "ScheduledWakeup", &hleScheduledWakeup);