Open hippietrail opened 2 years ago
One problem is the Loader
is currently set up only to take a path/URL.
The Zip Loader will take a path but then it will have a Data
that it will need to pass to the SNA or Z80 loader.
I can just make a version that only does SNA by copying and pasting code from the SNA loader as a proof of concept first.
I think it might be better to change the SupportedGameTypes
enum to be called SupportedFileTypes
, and add zip
as a case in there - this should ensure drag and drop still works for zip files.
Inside the Loader class we'd still get a URL, but we could add some logic to unzip and extract the first file with a valid file type (as it's possible the zip file could have multiple files) - the loader shouldn't need to change too much if we did it this way, just an extra check for a zip and and an unzip routine which returned the data.
I've previously looked at this for SpeccyMac: https://github.com/marmelroy/Zip
Then we just add it as a dependent package, and can just use it immediately.
I've actually got ZIP parsing and extracting working in pure Swift in a standalone tool. Just need to use that logic to make a new Loader.