Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorder savestates to put memory before CoreTiming. #16965

Merged
merged 1 commit into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Core/MIPS/x86/Jit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ void Jit::DoState(PointerWrap &p) {
Do(p, js.startDefaultPrefix);
if (s >= 2) {
Do(p, js.hasSetRounding);
js.lastSetRounding = 0;
if (p.mode == PointerWrap::MODE_READ) {
js.lastSetRounding = 0;
}
} else {
js.hasSetRounding = 1;
}
Expand Down
12 changes: 9 additions & 3 deletions Core/SaveState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ namespace SaveState

void SaveStart::DoState(PointerWrap &p)
{
auto s = p.Section("SaveStart", 1, 2);
auto s = p.Section("SaveStart", 1, 3);
if (!s)
return;

Expand All @@ -357,8 +357,10 @@ namespace SaveState
saveDataGeneration = 0;
}

// Gotta do CoreTiming first since we'll restore into it.
CoreTiming::DoState(p);
// Gotta do CoreTiming before HLE, but from v3 we've moved it after the memory stuff.
if (s <= 2) {
CoreTiming::DoState(p);
}

// Memory is a bit tricky when jit is enabled, since there's emuhacks in it.
auto savedReplacements = SaveAndClearReplacements();
Expand All @@ -376,6 +378,10 @@ namespace SaveState
Memory::DoState(p);
}

if (s >= 3) {
CoreTiming::DoState(p);
}

// Don't bother restoring if reading, we'll deal with that in KernelModuleDoState.
// In theory, different functions might have been runtime loaded in the state.
if (p.mode != p.MODE_READ)
Expand Down