Skip to content

Save states: read pad, mpeg, sif and 989SND sections written before their newer fields - #139

Open
boubou666 wants to merge 1 commit into
masterfrom
jc2/state-older-sections
Open

boubou666 wants to merge 1 commit into
masterfrom
jc2/state-older-sections

Conversation

@boubou666

Copy link
Copy Markdown
Contributor

States saved before four library sections grew no longer load on master: the run fails with "section pad ends before its fields" (then mpeg, then sif) and the game starts from the boot. JC2's states from before 2026-11-24 hit all four.

Each section keeps writing as it does now; the readers accept the older layouts too, the same way #133 and #134 did for mixer, libsd and gsVideo:

Section Added field Older state
pad libpad2's pad2Sockets, pad2Next (after multitapAttached) the section ends there: no socket open
mpeg inputEnded (before the sound) exactly the sound is left: the input goes on
sif the IOP's iopSreg (before the heap) the older layout is tried first and kept only if it reads the section exactly (Archive::end checks it); registers cleared
snd the whole 989SND section timers is next: the driver stays as it is

New Archive::sectionLeft(): the bytes left in the open section when reading.

Tests

  • bozo-state-tests covers sectionLeft.
  • The engine suite passes (run on jc2/native-irx-host, which has these files identical). The one exception is symbol_maps, which failed only because my build's temp directory has "game" in its path.
  • JC2: s24300_arena.state, saved before these fields existed, loads again and the run carries on from it.

🤖 Generated with Claude Code

…re their newer fields

States saved before these sections grew fail to load ("section pad ends before its fields"; then mpeg, sif) and the
game starts from the boot. JC2's states from before 2026-11-24 hit all four:
- pad: libpad2's sockets (pad2Sockets, pad2Next) came after multitapAttached; an older section ends there, and no
  socket is open.
- mpeg: inputEnded (MpegOptions::sdkNodata) came before the sound; an older section has exactly the sound left, and
  the input goes on.
- sif: the IOP side's software registers came before the heap; the older layout is tried first and kept only when it
  reads the section exactly (Archive::end checks it), with the registers cleared; otherwise the reader rewinds.
- snd: a state from before the 989SND driver was saved has "timers" next; the driver stays as it is.

Archive::sectionLeft(): the bytes the open section has left when reading. What is written does not change.

bozo-state-tests (sectionLeft) passes, with the whole engine suite on jc2/native-irx-host (symbol_maps aside: the
build's temp directory has "game" in its path). JC2: s24300_arena.state, saved on the engine before these fields,
loads again and the run goes on in the scene it was saved in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
boubou666 added a commit to TheBozos/JC2_Recomp that referenced this pull request Nov 24, 2026
…mute; engine on master

Scene D001 (581) stopped on its first IPU register write: besides its PSS movies the game plays ".ipu" streams itself
as animated textures (D001's water: 64 x 64, 298 frames), driving the IPU and its DMA. runtime/jc2_ipu.cpp answers the
player's frame start (0x2B0DA0) and its object walk (0x2B1AC0) with BozoEngine's IpuStream (FFmpeg's ipu decoder):
each object's next frames are decoded into its ring as the IPU's CSC lays them out, with the end-of-frame
bookkeeping. From s24300_arena with --scene 581 the run goes on; the stream opens and the game takes the frames. The
water is not seen in the arrival view yet (to find). JC2_TRACE_IPU=1 traces the streams, the group and the calls.

jc2: --hidden (the engine's hidden window, captures offscreen) now also mutes, and --mute alone keeps the audio
device closed.

BozoEngine 24dddf4 (jc2/native-irx-host): master f93b5af..0a2459a merged (TMB's float fix e15775a, the save-state
fixes up to 36991be), libs IpuStream, and TheBozos/BozoEngine#139, which reads the save states JC2 wrote before the
pad, mpeg, sif and 989SND sections grew. Checked: D001 and s21900_battle_tamatoch, headless.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant