Disc geometry from cue TRACK mode / sector-0 sync, never file length

A raw dump with trailing bytes can be a multiple of 2048 and mounted as a cooked ISO
(Legend of Dragoon disc 1: PVD read as zeros, BIOS SystemError B/906).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matthew Stanley
2026-10-11 23:43:34 -07:00
parent 2a4824fcb8
commit 37792ac4af
8 changed files with 837 additions and 583 deletions
+3
View File
@@ -1165,6 +1165,9 @@ int main(int argc, char** argv) {
check(!psx_mod_read_disc_file("S0",nullptr,0,&bytes),"directory rejected");
std::vector<uint8_t> raw_iso(24*2352);
for(unsigned i=0;i<24;++i) {
/* A raw sector starts with the CD sync pattern; geometry is read from
* it, never from the file length. */
raw_iso[i*2352]=0; std::fill_n(raw_iso.begin()+i*2352+1,10,(uint8_t)0xFF); raw_iso[i*2352+11]=0;
raw_iso[i*2352+15]=2;
std::copy_n(iso.begin()+i*2048,2048,raw_iso.begin()+i*2352+24);
}