@Robz8 @GerbilSoft @umbjolt
Here I suggest a few changes that will provide the following benefits:
* folder/file structure issues completely solved
* twloader can be completely installed from just the twloader cia, no more need to remove the sd card (flashcard sd is still manually)
* per flashcard settings (handy for testing and users with multiple cards)
* no more files or path's with things you will never user
Here is a list of changes needed to have these benefits
1: parsing the main ini file and updating twloader to prevent having to do the other checks twice
Code:
1 On startup twloader needs to load its settings file before anything else
1: check if ini file exists
no go-to 2
yes go-to 3
2: create versioned ini file using defaults and go-to 1
3: check ini file version
old/no-version go-to 4
current go-to 7
4: parse the ini file using legacy parser
5: perform sanity check on old values
5: fill new or broken values with defaults
6: create versioned ini file using values just created and go-to 1
7: is (auto) updating allowed?
yes go-to 8
no go-to 12
8: download version number from server
9: compare remote and local version numbers
old go-to 10
current go-to 12
10: download binary
11: update version in ini file after successfull download and go-to 2
12: continue to path check/creation code
2: create the file structure
Code:
1 after parsing the ini so twloader knows which paths to create check and create paths
1: Generate list of paths
2: check if path's exists
no go-to 3
yes go-to 4
3: run recursive mkdir to create missing path and go-to 2
4: Remove path from list
5: Are there any more paths to check in the list?
no go-to 6
yes, select path and go-to 2
6: contine to file checking/downloading code
3: create binaries and their ini files
Code:
1 after parsing the ini so twloader knows which binary files need to be created
1: generate list of binaries
2: check if ini file exists
no go-to 3
yes go-to 4
3: create versioned ini file using defaults, set the binary version to -1 (do not trust unversioned files)
4: check ini file version
old/no-value go-to 5
current go-to 9
5: parse the ini file using legacy parser
6: perform sanity check on old values
7: fill new or broken values with defaults
8: create versioned ini file using values just created and go-to 2
9: is (auto) updating allowed?
yes go-to 10
no go-to 14 (force update)
10: download version number from server
11: compare remote and local version numbers
old go-to 12
current go-to 14
12: download binary
13: update version in ini file after successfull download and go-to 2
14: verify binary exists
no go-to 12
yes go-to 14
15: Remove binary from list
16: Are there any more binaries to check in the list?
no go-to 17
yes, select path and go-to 2
17: continue to game specific ini file verifications
4: verify game specific ini files and
Code:
1 after parsing the ini so twloader knows which folders need to be checked
1: generate list of ini's found
2: check ini file version
old/no-version go-to 3
current go-to 7
4: parse the ini file using legacy parser
5: perform sanity check on old values
5: fill new or broken values with defaults
6: create versioned ini file using values just created and go-to 2
7: Remove ini from list
8: Are there any more ini's to check in the list?
no go-to 9
yes, select path and go-to 2
9: continue to existing banner/boxart checking code
missing from these proces flows are:
Code:
1 hard limit on the amount of times any check is allowed to loop on a single path/file/ini
2 checking if there is enough room on the sdcard to do the write actions
3 checking if binaries are correct by running a hash check (known hash from server version file)
4 using timestamps to prevent checking the server more than once per period
5 using similar logic for checking/updating banners and boxart
6 error handling for failing downloads and failed writes
7 rejecting garbage values from ini files that are not upgraded
8 user selectable auto updating of all file types including boxart, warnings about forced updates
9 the option to use similar system to build flashcard side sd card files on a per flashcard basis. so that the user just has to copy the for_flashcard_sd contents over to the flashcard from the pc (or at some point twloader may be able to write directly to the flashcard)
I would like to suggest we auto create everything on the 3ds sd card instead of relying on the 7z file and manual copying.
This will make it so twloader works out of the box from installing just twloader.cia.
Code:
sdroot:
_nds/ (create automatically on startup)
_nds/dstwoautoboot.ini (create or upgrade automatically on startup only if dstwo is selected as flashcard, run this check again when dstwo flashcard selection is saved)
_nds/bootstrap.nds (create or upgrade automatically on startup)
_nds/gbarunner2.nds (create or upgrade automatically on startup)
_nds/lastsave.ini (create or upgrade automatically on startup)
_nds/loadcard_dstt.nds (create or upgrade automatically on startup only if dstt is selected as flashcard, run this check again when dstt flashcard selection is saved)
_nds/nds-bootstrap.ini (create or upgrade automatically on startup)
_nds/YSMenu.ini (create or upgrade automatically on startup only if a flashcard is selected, run this check again when flashcard selection is saved to any card but none) (ps add a no flashcard option to the menu)
_nds/twloader/ (create automatically on startup)
_nds/twloader/NTR_Launcher.nds (create or upgrade automatically on startup)
_nds/twloader/settings.ini (create or upgrade automatically on startup)
_nds/twloader/bnricons/ (create automatically on startup)
_nds/twloader/bnricons/flashcard/ (create automatically on startup only if a flashcard is selected, run this check again when flashcard selection is saved to any card but none) (ps add a no flashcard option to the menu) (ps2 do we really need seperate bnricon folders for bootstrap and flashcard?)
_nds/twloader/boxart/ (create automatically on startup)
_nds/twloader/boxart/flashcard/ (create automatically on startup only if a flashcard is selected, run this check again when flashcard selection is saved to any card but none) (ps add a no flashcard option to the menu) (ps2 do we really need seperate boxart folders for bootstrap and flashcard?)
_nds/twloader/cia/ (create automatically on startup)
_nds/twloader/cia/TWLoader - TWLNAND side.cia (create or upgrade automatically on startup)
_nds/twloader/loadflashcard/(create automatically on startup only if a flashcard is selected, run this check again when flashcard selection is saved to any card but none) (ps add a no flashcard option to the menu)
_nds/twloader/loadflashcard/ace_rpg.nds (create or upgrade automatically on startup only if ace_rpg is selected as flashcard, run this check again when ace_rpg flashcard selection is saved)
_nds/twloader/loadflashcard/r4.nds (create or upgrade automatically on startup only if r4 is selected as flashcard, run this check again when r4 flashcard selection is saved)
_nds/twloader/loadflashcard/r4idsn.nds (create or upgrade automatically on startup only if r4idsn is selected as flashcard, run this check again when r4idsn flashcard selection is saved)
While i did this i realized there may be a better way to order the 3ds sd card folder structure, so i suggest the following
Code:
_nds/art/
_nds/art/bnricons
_nds/art/boxart
_nds/launchers/ (loaders, forwarders,etc..)
_nds/launchers/GBARunner2/
_nds/launchers/GBARunner2/GBARunner2.ini
_nds/launchers/GBARunner2/GBARunner2.nds
_nds/launchers/GBARunner2/romsettings/
_nds/launchers/GBARunner2/romsettings/[per_rom_settings].ini
_nds/launchers/ace_rpg/
_nds/launchers/ace_rpg/ace_rpg.ini
_nds/launchers/ace_rpg/ace_rpg.nds
_nds/launchers/ace_rpg/romsettings/
_nds/launchers/ace_rpg/romsettings/[per_rom_settings].ini
_nds/launchers/bootstrap.ini
_nds/launchers/bootstrap.nds
_nds/launchers/bootstrap/
_nds/launchers/bootstrap/romsettings/
_nds/launchers/bootstrap/romsettings/[per_rom_settings].ini
_nds/launchers/dstt/
_nds/launchers/dstt/loadcard_dstt.ini
_nds/launchers/dstt/loadcard_dstt.nds
_nds/launchers/dstt/romsettings/
_nds/launchers/dstt/romsettings/[per_rom_settings].ini
_nds/launchers/dstwo/
_nds/launchers/dstwo/*.nds (missing?)
_nds/launchers/dstwo/dstwoautoboot.ini
_nds/launchers/dstwo/romsettings/
_nds/launchers/dstwo/romsettings/[per_rom_settings].ini
_nds/launchers/ntr_launcher/
_nds/launchers/ntr_launcher/NTR_Launcher.ini
_nds/launchers/ntr_launcher/NTR_Launcher.nds
_nds/launchers/ntr_launcher/romsettings/
_nds/launchers/ntr_launcher/romsettings/[per_rom_settings].ini
_nds/launchers/r4/
_nds/launchers/r4/r4.ini
_nds/launchers/r4/r4.nds
_nds/launchers/r4/romsettings/
_nds/launchers/r4/romsettings/[per_rom_settings].ini
_nds/launchers/r4idsn/
_nds/launchers/r4idsn/r4idsn.ini
_nds/launchers/r4idsn/r4idsn.nds
_nds/launchers/r4idsn/romsettings/
_nds/launchers/r4idsn/romsettings/[per_rom_settings].ini
_nds/roms/
_nds/roms/*.gba
_nds/roms/*.nds
_nds/twloader/
_nds/twloader/lastsave.ini
_nds/twloader/nandside_cia/TWLoader - TWLNAND side.cia
_nds/twloader/settings.ini
sample ini file with ini versioning and nds versioning
Code:
iniversion="0.1"
ndsversion="1.4"
server side you would have a "version.ini" that contains the version and you make twlauncher download that and compare it to the version in the local ini file. it the server side version is higher you update, if its the same, lower or corrupt you abort.