Just been thinking about the way Gemus extracts and rezips games, and I've come up with the following (hopefully improved) system, so I'm running it by you guys to see you if can spot anything I've missed, conceptually or algorithmically!...
This example assumes that
d64 is a Gemus emulator compatible filetype and you have an archive
game.zip, containing the following: -
Code: Select all
game.zip
-> a.zip
-> b.zip
-> c.zip
-> foo\bar.d64
-> foo.d64
-> foo\d.7z
-> bar\baz.d64
-> x.d64
EXTRACTING THE GAME
1. extract game.zip to \GBGame\P1\: -
Code: Select all
\GBGame\P1\a.zip
\GBGame\P1\b.zip
\GBGame\P1\x.d64
2. ask user to pick either a sub-archive or a compatible file (user picks b.zip).
3. create gemus log file in P1\ to store chosen sub-archive: -
Code: Select all
\GBGame\P1\__gemus (contains text: "b.zip")
4. extract b.zip to \GBGame\P2\: -
Code: Select all
\GBGame\P2\c.zip
\GBGame\P2\foo\bar.d64
\GBGame\P2\foo.d64
\GBGame\P2\foo\d.7z
5. ask user to pick either a sub-archive or a compatible file (user picks foo\d.7z).
6. create gemus log file in P2\ to store chosen sub-archive: -
Code: Select all
\GBGame\P2\__gemus (contains text: "foo\d.7z")
7. extract d.7z to \GBGame\P3\: -
8. single compatible file found, no further sub-archives found. Stores the default runnable file for game.zip (in the db) as: -
When running games from GameBase, the above string is used to auto-select sub-archives and the default file to "run", so it doesn't ask the user every time. This should be backwards compatible with the existing gemus extraction routine.
REZIPPING THE GAME
9. game is run and emulator closes, user chose to rezip....
10. starting at last \GBGame\Px folder (e.g. P3\ in this example), it checks for additional files and asks use whether he/she wants to rezip them also.
11. chosen P3\ contents are zipped into whatever is stored in P2\__gemus file (foo\d.7z), overwriting the existing file (\GBGame\P2\foo\d.7z)
12. Contents of P2\ are zipped into whatever is stored in P1\__gemus file (b.zip), overwriting the existing file (\GBGame\P1\b.zip)
13. Contents of P1\ are zipped into game.zip
14. game.zip copied back to game path