14 Commits
Author SHA1 Message Date
moonpower 208250ec4f Identify SAF games through a scan-time descriptor lease, restoring their cover art 2026-08-04 23:58:23 +02:00
moonpower dc5c9b494d Fix Android rendering, audio, and SAF lifecycle 2026-08-04 22:38:40 +02:00
jpolo1224 189e264bb4 Identify .chd discs through the core's own disc reader, so they get cover art
A CHD never produced a serial. Ps1DiscId reads SYSTEM.CNF itself, and it cannot see
inside a compressed container, so every .chd fell through to Ps1TitleSerials -- a
curated filename table of two dozen USA titles behind a USA-only region filter. A CHD
library therefore showed placeholder tiles for everything the table did not list, and
the new Download cover art action could not help because it fetches by serial.

The serial is not only art: RetroAchievements identifies against it, per-game settings
key off it and play time accrues under it. A CHD had none of that either.

Writing a CHD parser in Kotlin would have been wrong twice over. CHD v5 Huffman-
compresses its own hunk map, so it is a few hundred lines of bit-level decoding before
the filesystem is even reachable; and a decoder that is slightly wrong returns a
PLAUSIBLE WRONG serial rather than failing, which silently attaches one game's art,
settings and achievements to another. Relaxing the region filter has the same defect --
a USA serial fetches the wrong regional box art with total confidence.

So the disc goes to the reader that already boots it. psx/discid.c walks the ISO9660
root directory to SYSTEM.CNF and parses its BOOT line through the same psx_disc_t
vtable the emulated drive reads through, which means the build still contains exactly
ONE CHD decoder and there is nothing for a second one to disagree with. Everything
psx_disc_open handles comes along for free: .cue, .bin, .iso, .pbp and .chd.

Geometry is detected, not assumed. The same filesystem arrives in four shapes and
nothing in the container says which: a CHD puts ISO sector 0 at LBA 150 because its
LBA space includes the lead-in, a raw rip puts it at 0 -- or a few sectors in, if the
dump captured the pregap -- and the user data sits 24, 16 or 0 bytes into the sector
depending on MODE2/MODE1/2048. Each candidate is carried through to a serial-shaped
BOOT line before being accepted, so a geometry that finds a plausible volume descriptor
but no SYSTEM.CNF falls through to the next instead of becoming a wrong answer. The
normalisation accepts the same shape Ps1DiscId.kt does, on purpose: the two are routes
to one identity and a disagreement would split a game's settings in half.

Kotlin keeps the fast path. It still reads .bin/.cue/.iso/.pbp itself and only calls
native for containers it cannot open, plus as a last resort when its own walk and byte
scan both came up empty -- which can only add serials where there were none. That does
mean identification can touch native now; it costs nothing, because Pasx2Application
already loads SDL2 + libarmsx on its warm-up thread at process start and MainActivity
calls initializeOnce regardless. Every call is guarded, so a process without the
library degrades to exactly the previous behaviour and says so in serial_probe.log.

Gated by tests/disc_serial.c (make test-disc-serial): the CHD addressing driven through
a synthetic vtable that mimics it, MODE1/MODE2/2048 sectors, pregap rips, a track table
that disagrees with the filesystem, SYSTEM.CNF 9000 sectors in, fourteen BOOT spellings,
and the cases that must yield NOTHING -- PSX.EXE, MAIN.EXE, a PS2 BOOT2 line, a short
serial, a missing SYSTEM.CNF, no volume descriptor, a corrupt root extent. libchdr's
decompression is deliberately not re-tested; it is what already boots these discs.
Pass --image <path> to identify a real image end to end.

One consequence worth knowing: a .chd with no serial in its filename keyed its per-game
settings off the filename stem and now keys off the real serial, so per-game settings,
cheats, custom names, per-game BIOS and the per-game memory card ASSIGNMENT revert to
global once for those entries. Save states are untouched (they key on disc path plus
fingerprint, not serial) and no memory card file is affected.
2026-08-03 14:04:27 -04:00
jpolo1224 3a715576a3 Add PBP (PSP EBOOT) disc support: multi-disc PSTITLEIMG, deflate block reader, serial probe 2026-08-03 13:25:23 -04:00
jpolo1224 80469ad93a Default Skip BIOS off: it breaks some games, so the faithful boot is the right default 2026-08-03 13:25:23 -04:00
jpolo1224 cf8f441ce1 Pre-fetch cover art to <DataRoot>/covers with a Download cover art action 2026-08-03 13:25:23 -04:00
jpolo1224 5eb3fb119a Onboarding: require all-files access before adding a game folder, not only for a custom data root 2026-08-03 13:25:23 -04:00
jpolo1224 f0c3c6793f Reject non-PS1 images in the BIOS picker instead of accepting any 128KB-8MB file 2026-08-03 11:30:13 -04:00
jpolo1224 4c5c5ee2d8 Onboarding: write the chosen BIOS into settings.toml, not just a SharedPreference 2026-08-03 11:30:13 -04:00
jpolo1224 9f28d82a9a Default new installs to Material You on Android 12+ instead of the blue baseline palette 2026-08-03 11:07:15 -04:00
jpolo1224 a557b17931 Enable R8 for release; keep the JNI bridge and app packages so native callbacks survive 2026-08-03 10:49:08 -04:00
jpolo1224 16d0e8e045 Default GPU presentation to OpenGL ES instead of software 2026-08-03 10:49:08 -04:00
jpolo1224 0d22376375 Known-good: GPUINFO(5) E5 layout fix, five CD-ROM fixes, SIO0 deselect fix, RA toasts, mcard divergence warning, serial extraction, SPU widths, session instrumentation 2026-08-02 12:08:37 -04:00
jpolo1224 3a12d1a066 Known-good baseline: BIOS text, MGS audio, Silent Hill, present geometry 2026-08-02 07:01:46 -04:00