GE dump playback: Restore old-layout contexts from old dumps

Dumps recorded before savedContextVersion 1 hold PPSSPP's old context layout, with the matrices
as raw floats, but GEState::Restore picks the layout from savedContextVersion, which only a
savestate sets. Playback restored them as the new layout, so the matrices became garbage and
the scene vanished (4140 drew only its HUD). Tell the layouts apart by the END the new one ends
with, as the PSP replayer does. Other callers are unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-08 18:37:32 +02:00
1 parent 937053063c
commit a26ef51a0c
3 files changed
+19 -2

No files matched your search

+12 -1
View File
@@ -610,7 +610,18 @@ void DumpExecute::SubmitListEnd() {
}
void DumpExecute::Init(u32 ptr, u32 sz) {
gstate.Restore((u32_le *)(pushbuf_.data() + ptr));
// Dumps from before savedContextVersion 1 hold PPSSPP's old context layout, with the matrices as raw
// floats; the new one ends its commands with an END. Restoring an old one as new turned its matrices
// into garbage and the scene disappeared (4140). The PSP replayer tells them apart the same way.
const u32_le *context = (const u32_le *)(pushbuf_.data() + ptr);
bool oldLayout = true;
for (int i = 17; i < 512; ++i) {
if (context[i] == GE_CMD_END << 24) {
oldLayout = false;
break;
}
}
gstate.Restore(context, oldLayout);
ExecuteOnMain(Operation{ OpType::ReapplyGfxState });
fbPtr_ = gstate.fbptr & 0x00FFFFFF;
fbWidth_ = gstate.fbwidth & 0x00FFFFFF;
+5 -1
View File
@@ -205,6 +205,10 @@ void GEState::FastLoadBoneMatrix(u32 addr) {
}
void GEState::Restore(const u32_le *ptr) {
Restore(ptr, savedContextVersion == 0);
}
void GEState::Restore(const u32_le *ptr, bool oldLayout) {
// Not sure what the first 10 values are, exactly, but these seem right.
gstate_c.vertexAddr = ptr[5];
gstate_c.indexAddr = ptr[6];
@@ -218,7 +222,7 @@ void GEState::Restore(const u32_le *ptr) {
}
}
if (savedContextVersion == 0) {
if (oldLayout) {
if (Memory::IsValidAddress(getClutAddress()))
loadclut = *cmds++;
boneMatrixNumber = *cmds++;
+2
View File
@@ -439,6 +439,8 @@ struct GEState {
static void Reset();
void Save(u32_le *ptr);
void Restore(const u32_le *ptr);
// oldLayout: PPSSPP's layout before savedContextVersion 1, with the matrices as raw floats.
void Restore(const u32_le *ptr, bool oldLayout);
};
bool vertTypeIsSkinningEnabled(u32 vertType);