16 Commits
Author SHA1 Message Date
Thomas MartinandClaude Opus 5.5 7b3f7dff26 libs: sceIoctl's status poll, sceSifInitCmd, sceSifSetDChain, sceIpuInit; whole stream reads (opt-in)
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]>
2026-11-27 10:16:20 +01:00
Thomas MartinandClaude Opus 5.5 0058e8234e Kernel: SetupThread's stack -1; libcdvd: sceGetstat
- 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]>
2026-11-23 16:32:45 +01:00
Thomas MartinandClaude Opus 5.5 b73692ed37 Save states: the whole runtime saved and loaded at the dispatcher's safe point
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]>
2026-11-18 18:22:15 +01:00
Thomas MartinandClaude Opus 5.5 5ffadf8053 CD: opt-in timed completion of sceCdRead
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]>
2026-11-18 10:02:42 +01:00
ArzarothandClaude Opus 5.5 fb8ae7a153 [champions/cd-stream-pause] feat(libs): sceCdStPause and sceCdStResume answered natively
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 04:37:10 +01:00
Marc-Etienne Barrut 5f4f3b69d5 Merge pull request #55 from TheBozos/norrath/cd-read-iop
Native sceCdReadIOPm
2026-11-06 23:27:00 +01:00
ArzarothandClaude Opus 5.5 acaf93638f [norrath/cd-read-iop] merge main
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 23:21:40 +01:00
ArzarothandClaude Opus 5.5 ffd49e0f9d [sc3/libs-cd] feat(cd): sceCdSeek, sceCdBreak, sceCdNcmdDiskReady, sceCdSyncS, sceCdGetDiskType
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 21:40:43 +01:00
ArzarothandClaude Opus 5.5 7cbcd281f4 [con/cd-read-iop] feat(cd): native sceCdReadIOPm
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]>
2026-11-06 20:59:25 +01:00
ArzarothandClaude Opus 5.5 ca8330f9b1 [con/cd-read-iop] refactor(cd): the common end of a read in its own function
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 20:58:55 +01:00
ArzarothandClaude Opus 5.5 f20eb76c2a [con/cd-dual-layer] cd: sceCdReadDvdDualInfo, sceCdLayerSearchFile, file search on a DVD9's second layer
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]>
2026-11-06 19:53:14 +01:00
boubou666andThomas Martin cca56530f9 Answer SDK CD status and progress from native read jobs (#13)
* 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]>
2026-11-06 15:25:47 +01:00
boubou666andThomas Martin 63ac504f25 Deliver native CD read callbacks without SDK semaphore worker (#11)
Co-authored-by: Thomas Martin <[email protected]>
2026-11-06 15:16:11 +01:00
Thomas Martin 11cb6df323 Add reusable native image, compiled-library and port services 2026-11-06 02:47:13 +01:00
Thomas MartinandClaude Opus 5.5 cc6d6ead9d Native libraries: the SIF layer and the 989SND sound driver (phase 3, batch B3)
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]>
2026-11-03 20:47:26 +01:00
Thomas MartinandClaude Opus 5.5 0d418b36dc Native libraries: libcdvd, sectors and the movie stream from the disc image (phase 3, batch B1 1)
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]>
2026-11-03 18:56:25 +01:00