mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
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:
1 parent
2e5edcd298
commit
f96a58fb3e
5 files changed
+21
-13
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
@@ -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
@@ -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
|
||||
|
||||
Reference in new issue
Block a user