SndDriver::serialize saves the driver's banks, handles, slots and replies' state,
then its engine:
- the IOP memory and clocks;
- the mixer (Mixer::serialize) and libsd;
- 989SND's model (snd989::Engine::Impl). Its pointers are saved as data: a byte
of a bank as (bank, chunk, offset), a handler as (table, index), a MIDI as
(bank, index), a stream buffer as its index.
A load makes the engine when the state has one and anchors the real-time clock
again. Libraries::unsaveable no longer refuses for 989SND.
Engine::bankUnloaded destroyed the bank while busy voices still pointed into its
header: the program record that voiceVolPan reads again for SetSoundParams, a
use-after-free. Unloaded banks are kept in `retired` (headers only; 989SND reads
IOP memory, which stays until reused), so those pointers stay valid and can be
saved.
LoadedImages::images / restore let a port save the NGP files it bound.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
TMB_Recomp's runtime builds on BozoEngine (its branch bozo/m0, cmake -DTMB_BOZO=ON): its overrides run natively, each
call checked against the reference's log (tmb-check), and with no log at all (tmb-headless).
- Port API (runtime/include/bozo/port.h, bozo_port): Registry::registerFunction, BOZO_PORT, the startup check that
every registered override is an external of the generated code (port::undeclared), and what overrides use: the
kernel (changePriority, rotateReadyQueue, transfer), the EE clock (now, accountCycles), vblankCount, the hardware
registers (ioRead32 / ioWrite32: a port's own access), frameEnd, callLibrary, scratchpad, libraries, deterministic,
realTime, setStorePatch. A port::Host is behind them.
- Overrides that run guest code (kernel.md section 3b): checkpoints charge, no event is taken in place; an event due,
a call that blocks, a jump through a register, an inner call's return and a recursive call's return make guest code
leave the override there, the stop deferred to its end (Dispatcher::beginOutcall / leave / takeDeferredStop); the
override's own code runs on, as the reference's did; no exception goes through it. Every rule settled on a record.
- Generated code: bozo::checkpoint and bozo::innerReturn return true when guest code leaves, the check after each
call tests ctx->leaving, a recursive call's return inside an override calls bozo_leave; ctx->outcall,
ctx->leaving; the externals table (<prefix>_external_table); "store 0xADDR" externals (the store sets ctx->pc first).
- bozo-externals (tools/externals): the --externals list from the ELF's symbols BozoEngine answers, a port's stub names
and its override list; --check compares the stubs with a call log's.
- bozo-run as a library (bozo_run, run_main.h): a port's checker links it with its generated code and overrides,
which run natively (--overrides native|log); LogHost checks each call (context words, memory runs, traced calls, the
operations and frame end inside, where it left) and pins where the reference's override left and whether a timed
call inside it waited. The renderer's draw lists fill the record's draws (reported).
- The free host (runtime/host/free_host.cpp, bozo_host): every out-call native, libraries bound by the ELF's symbols,
free timing, a watchdog when no frame ends.
- Moved from the team's fork code (phase4-inventory.md 2.1, MIT headers): the renderer's game side
(bozo/render/renderer.h, renderer.cpp: headless, recording the published lists and their hash), Texture,
the texture and mesh packs, mesh_draw, the movie picture hook, the FramePacer (unpaced off real time) and
determinism.h (settable by the host).
- Libraries, from what only ran inside overrides before: sceGsExecLoadImage (0, no upload), T8H/T4HL/T4HH image tags as
32-bit texels, the GS CSR's FIELD, sceSifSetDma raising SIF0's DMAC interrupt, CPCOND0 counting completions from
the last FlushCache, a port's own register accesses, RotateThreadReadyQueue returning 0, libmpeg calling the movie
picture hook, PadState::multitap.
- BOZO_BUILD_TOOLS (zlib-free configure for a port), the tests only when top level.
Results: TMB boot --pinned with every override native, 3000 of 3000 frames and 4,650,558 of 4,650,558 records (ram,
scratchpad, calls, threads); match1p: see docs/phase4-m0-notes.md. bozo-run without a port still matches.
Co-Authored-By: Claude Opus 5.5 <[email protected]>