What Amplitude_Recomp answered in its port, generic SDK behaviour:
- sceIoctl: request 1, the status a file opened with O_NOWAIT is polled with, is "done" (*arg = 0): the native
sceOpen / sceRead have finished as they return. Any other request: -1.
- sceSifInitCmd, sceSifSetDChain, isceSifSetDChain: nothing to set up or arm (Onimusha_Recomp answered
sceSifSetDChain the same way in its port).
- sceIpuInit: no IPU to reset.
- CdState::wholeStreamReads (off by default): a sceCdStRead that does not wait brings all its sectors or none,
as a console's drive fills the stream ring a bank at a time. Amplitude's movie player resumes its demux at
buffer + 0x4000 - bytes left and skipped a sector after a short read.
- texture.h: Texture::rgba carries the GS's alpha (0x80 opaque); the comment said 255.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- SetupThread with stack -1 (the SDK crt0's default _stack, Shinobido's)
asks for the end of RAM: the stack is the size bytes below 32 MB.
It returned -1 + size, an odd stack pointer inside the program.
- sceGetstat(name, struct sce_stat *): a disc file's size as a read-only
regular file (mode, size, its first sector in private[0]); -1 when the
file is not on the disc. The image is opened first, as sceOpen does.
Shinobido checks each file with it before reading it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A state is taken at the top of Dispatcher::run's loop, where no guest code is on
the host stack: memory, the dispatcher, the kernel (threads, frames, queues,
deadlines), every library's state, the native IOP host (memory, tasks, kernel
objects, RPC servers, mixer, libsd) and sections ports add (state::Sections).
Parked library lambdas become data: Resume records and native deadline kinds,
rebuilt from tables on load; ports can add their own kinds. FreeHost serves
requestSave / requestLoad from any thread, rolls back a failed load, and takes
FreeOptions (gameTag, loadState[Frame], saveState[Frame]). Windows get ten slots:
F5 save, F7 load, F6 / Shift+F6 select, and a Save states tab in F2.
989SND's engine and a playing movie are not covered: a save waits, saying why.
docs/save-states.md tells a port how to use and check it; tests/runtime/state_tests.cpp
covers the archive, files and a dispatcher round trip.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
With CdState::timedCompletion set, sceCdRead returns at once and its
callback runs on a kernel deadline when the drive's time has passed, as on
a PS2, so the caller's other threads run meanwhile. Off by default: the
reference's timing (the read charges its time to the caller, the callback
queued as it returns) is unchanged for the other ports. JC2 needs it: its
title menu clears a texture pointer right after requesting the texture and
counts on the read's callback setting it later.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Champions of Norrath loads its sound banks straight into IOP memory. The
sectors go to the port's compiled modules through SifState::transfer; the
call fails when the port has no such memory.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
DiscImage::layer1Start finds the second layer's volume (its descriptor at the sector after the first layer's volume,
its sectors counted from 16 before it); findFile takes a layer and returns the disc's own sectors. Champions of Norrath
reads its level folders on both layers through these calls.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Answer SDK CD status from native service lifecycle and jobs
* Report native read-job byte progress through SDK query
---------
Co-authored-by: Thomas Martin <[email protected]>
SIF (sif): RPC bind and call with the reference's client and server-data words,
CheckStat, the SIF registers, module loading (ids only), reboot and sync, the
IOP heap (16-byte blocks, first fit, from 0x7fe60), SIF DMA ids.
989SND (snd), the IOP side of RPC service 0x123456: command batches (0x4a) and
direct calls decoded, the reply (-1, results, -1, a command with no result
leaving the driver's last one), banks loaded by sector from the disc image and
placed in IOP memory as the reference did, master volumes, reverb, stops,
streams, the movie buffer, handles and their liveness where it is certain. What
the reference's IOP time decided (one-shot sounds' lifetimes, the handler slots
they free) a pinned run takes from the log's reply (Function::logReply,
Pin::logWord); free mode has native models. The driver follows the 989SND calls
of port overrides answered from the log, and sends what should play to a
SoundSink for the future mixer.
boot and match1p --pinned: every frame and record, 0 divergences; sif 7,212 /
245,108 calls native; 989SND 3,591 / 119,225 replies native, 1 / 3,294 pinned.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
sceCdInit, sceCdMmode, sceCdDiskReady, sceFsReset, sceCdReadClock, sceCdRead, sceCdSync, sceCdGetError and the
stream (sceCdStInit, sceCdStStart, sceCdStRead, sceCdStStop) answered from an ISO 9660 image (bozo-run --iso, or
BOZO_ISO). Every sector a call or a stream continuation wrote in boot and match1p equals the image's.
Timed calls: a read takes a PS2 drive's time (114,400 EE cycles a sector) and a stream read waits for the vblank by
which its sectors have arrived (free mode). In a pinned run the reference's points (its IOP's) come from the log:
the call's EE time, whether it waited and until which vblank, and how much of a stream read had arrived (Libraries::pin).
A native library's wait with a completion (waitVblank) is finished by the library as its thread resumes; bozo-run
checks it against the log's MEM records of that point.
boot: 378 calls and 9 continuations native, match1p: 587 and 33, 0 divergences; both match on every frame and record.
Co-Authored-By: Claude Opus 5.5 <[email protected]>