kieranhj / pop-beeb

Prince of Persia port to BBC Master
45 stars 2 forks source link

Make all LEVEL files start at the beginning of their own track on side B #139

Closed kieranhj closed 6 years ago

kieranhj commented 6 years ago

Norbert has offered to add support for the BBC version of POP to his leapop level editor. This would open up the possibility of playing fan-made mods of the original game on the Beeb - amazing!

LEVEL files are &900 bytes in size and are currently laid out consecutively on side B starting from sector &48. I discovered that the dsd format interleaves tracks from side A & B throughout the image, so any files on disc that are no fully containing within a track will not be contiguous in the dsd image.

It would be easier to mod the Beeb version of the game if all the LEVEL files were arranged at the start of a separate track on side B. It would mean losing a sector for each file but there is enough free space on the disc at the moment to afford this.

Not sure how to do this though as bbcim doesn't allow specifying the location of files on the disc. For Bad Apple I just added empty dummy files to the image to pad appropriately but we have run out of file name space on side B of POP. Doh! Need a better, proper disc layout command line tool...

EndeavourAccuracy commented 6 years ago

Unless I'm mistaken, the offsets in the .dsd, levels 0 (demo) through 14, are currently: static const unsigned long arLevelOffsetsB[15] = { 0x9800, 0xAB00, 0xBE00, 0xC700, 0xDA00, 0xED00, 0x10000, 0x11300, 0x12600, 0x13900, 0x14C00, 0x15F00, 0x17200, 0x17B00, 0x18E00 }; /*** 0 - 14 ***/ It would certainly make things easier if each level would be a single block of bytes. Two areas per level wouldn't be that bad though; I could, for each level, define the number of bytes in the first area, and then lseek() to the second offset once I've read the first block.

simondotm commented 6 years ago

@kieranhj - are you sure about the interleaving? I could have sworn it was 200K side 1 then 200K side 2

kieranhj commented 6 years ago

I looked at the binary produced by bbcim and the catalogue sector for side 2 can be found at &A00 into the file... not sure if there are interleaved and non-interleaved versions of the format?

simondotm commented 6 years ago

Hmm I'm tending to agree now. I cant find any info to suggest DSD is anything other than interleaved. Surprised that Google couldnt get me a top hit to a site with DSD format info though!

kieranhj commented 6 years ago

I desperately need that decent disc image tool but don't want to write one (time to learn Python?) Just a simple descriptor format that echos the *INFO output but referencing files on the PC disc would be great, rather than all of the individual .inf files that the current solutions use.

kieranhj commented 6 years ago

Managed to arrange the files on track boundaries by adding and deleting a one sector file in between adding each LEVEL file to the disc image - this creates a one sector hole between each LEVEL file thus rounding them up to 10 sectors each. :) In a branch to be merged.

kieranhj commented 6 years ago

Done. Offset for LEVEL N inside pop-beeb.dsd should = 0x1E00 + N * 0x1400

EndeavourAccuracy commented 6 years ago

Excellent, thanks.