Savestate: Don't change the running game's state when saving

Some DoState code meant for after a load ran on every save:
- scePower reset the bus frequency a game set (and with a locked CPU
  speed, applied the current setting to the clock).
- sceDisplay reset the lag sync baseline, and could schedule lag sync in
  the measuring pass only, which failed the save.
- GPUState dirtied the texture, sceUmd notified the UI, and sceMpeg
  dropped a pending ringbuffer fix-up for an old state.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-28 09:34:06 -06:00
1 parent 2e5edcd298
commit f96a58fb3e
5 files changed
+21 -13

No files matched your search

+5 -3
View File
@@ -261,9 +261,11 @@ void __DisplayDoState(PointerWrap &p) {
Do(p, lagSyncEvent);
Do(p, lagSyncScheduled);
CoreTiming::RestoreRegisterEvent(lagSyncEvent, "LagSync", &hleLagSync);
lastLagSync = time_now_d();
if (lagSyncScheduled != UseLagSync()) {
ScheduleLagSync();
if (p.mode == p.MODE_READ) {
lastLagSync = time_now_d();
if (lagSyncScheduled != UseLagSync()) {
ScheduleLagSync();
}
}
} else {
lagSyncEvent = -1;
+3 -1
View File
@@ -230,7 +230,9 @@ void MpegContext::DoState(PointerWrap &p) {
}
}
DoClass(p, mediaengine);
ringbufferNeedsReverse = s < 2;
if (p.mode == p.MODE_READ) {
ringbufferNeedsReverse = s < 2;
}
}
static MpegContext *getMpegCtx(u32 mpegAddr) {
+9 -7
View File
@@ -161,13 +161,15 @@ void __PowerDoState(PointerWrap &p) {
RealpllFreq = PowerPllMhzToHz(222);
RealbusFreq = PowerBusMhzToHz(111);
}
if (GetLockedCPUSpeedMhz() > 0) {
pllFreq = PowerPllMhzToHz(GetLockedCPUSpeedMhz());
busFreq = PowerBusMhzToHz(pllFreq / 2000000);
CoreTiming::SetClockFrequencyHz(PowerCpuMhzToHz(GetLockedCPUSpeedMhz(), pllFreq));
} else {
pllFreq = RealpllFreq;
busFreq = RealbusFreq;
if (p.mode == p.MODE_READ) {
if (GetLockedCPUSpeedMhz() > 0) {
pllFreq = PowerPllMhzToHz(GetLockedCPUSpeedMhz());
busFreq = PowerBusMhzToHz(pllFreq / 2000000);
CoreTiming::SetClockFrequencyHz(PowerCpuMhzToHz(GetLockedCPUSpeedMhz(), pllFreq));
} else {
pllFreq = RealpllFreq;
busFreq = RealbusFreq;
}
}
DoArray(p, powerCbSlots, ARRAY_SIZE(powerCbSlots));
Do(p, volatileMemLocked);
+1 -1
View File
@@ -106,7 +106,7 @@ void __UmdDoState(PointerWrap &p)
if (s > 1) {
Do(p, g_UMDReplacePermit);
if (g_UMDReplacePermit) {
if (g_UMDReplacePermit && p.mode == p.MODE_READ) {
System_Notify(SystemNotification::UI);
}
}
+3 -1
View File
@@ -301,7 +301,9 @@ void GPUStateCache::DoState(PointerWrap &p) {
uint8_t textureChanged = 0;
Do(p, textureChanged); // legacy
gstate_c.Dirty(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS);
if (p.mode == p.MODE_READ) {
gstate_c.Dirty(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS);
}
Do(p, textureSolidAlpha);
Do(p, vertexFullAlpha);
bool framebufChanged = false; // legacy