Make Retroplay set of WHDLoads in lha's work
Created by: i30817
Whdloads in this set are done to be extracted on a 'real amiga' and won't be correctly extracted on normal unzip utilities. The retroplay set is all lhas. Strangely there are some hdf images, but I think they're also compressed with lha, which makes sense if they are supposed to be extracted on a amiga. I'm not certain because there is no real way to verify the lha archive directory structure in linux nowadays.
tl;dr:
- create a native lha extractor and parse the whdload.slave file inside the lha passed to the core, to figure out the final machine type and other exotic configs it needs (extra memory, cd32 controller added support, things like that). If it's already a hdf inside, extract that as the 'new file' and parse the slave from it, possibly by extracting it from inside emulation with another amiga program.
- create a sufficiently big hdf image (somehow) to contain the new game if the final file doesn't exist in retroarch/saves yet goto 3, if it does, goto 4.
- create a native mounter for the hdf file and extractor of lha that preserves amiga file properties and weird amiga names (this might be difficult because the amiga has different forbidden characters and file attributes, so the normal filesystem interfaces - mount, normal cp etc, might not serve) OR create a auto running amiga program that does the extraction into the hdf from inside emulation and run it.
- finally mount whichever hdf resulted with the properties from step 1.
Then later a prs could be added for libretro-database so the scanner recognizes these lha's as the games they are, and kept uptodate periodically. As the entry points, they'd be read only and the 'real cached game' would be on retroarch/saves or similar, like certain other cores handle writable memory in 'ROMs' from early consoles.
Retroplay warns that it's difficult to make a extractor that works on the native side (because people apparently constantly break the installs trying with some 'standard' unix lha extractor):
https://forums.libretro.com/t/uae-core-for-retroarch/15599/46
So basically two paths; either create a specialized extractor that preserves the extra metadata and names from the amiga created lha (probably by not touching the 'modern' filesystems and using a library that can write hdf files and attributes directly from in-memory bytes) to output a valid amiga filesystem, or create amiga autoboot programs that extract lhas, create hdfs and somehow return to outside emulation the data in the whdload.slave for config, which is basically the same but with less filesystem 'fun' and more amiga 'fun'.
This library: https://github.com/lclevy/ADFlib (literally found by search 'amiga filesystem' on github)
which purports to be a "A free, portable and open implementation of the Amiga filesystem" and specifically says it supports 'UAE hardfiles' (hdf) may help for both.