DS-Homebrew / TWiLightMenu

DSi Menu replacement for DS/DSi/3DS/2DS
https://wiki.ds-homebrew.com/twilightmenu/
GNU General Public License v3.0
3.23k stars 202 forks source link

Launch external applications directly via use of `.ini` files. #1690

Open lifehackerhansol opened 2 years ago

lifehackerhansol commented 2 years ago

Is your feature request related to a problem? Please describe. At the moment, all emulators are directly baked into TWiLight Menu++. There were complaints about this, especially from 3DS users, who have better alternatives for emulators in 3DS mode and do not have a use for those bundled in TWiLight at all, not to mention unnecessarily adding file size to the release archives.

An issue already exists for the 3DS: #1644. Though personally, I'd like to remove them completely, perhaps until Universal Updater receives its DSi support in the future I think the DSi release can be left alone for now.

Describe the solution you'd like @Epicpkmn11 and I have theorized the use of external .ini files that can be used to launch emulators instead. Her idea is as follows:

# jEnesisDS.ini
[EMULATOR]
USE_BOOTSTRAP=1
USE_RAMDISK=1
EMULATOR_PATH=/_nds/TWiLightMenu/emulators/jEnesisDS.nds
BANNER_PATH=/_nds/TWiLightMenu/emulators/jEnesisDS.bnr
RAMDISK_PATH=/ROM.BIN
EXTENSIONS=.gen

TWiLight can then check the extension of files, then compare with any .ini file that exists.

My idea was slightly different. Instead of having each emulator as an ini, the ini can be named the file extension itself:

# gen.ini
[EMULATOR]
USE_BOOTSTRAP=1
USE_RAMDISK=1
EMULATOR_PATH=/_nds/TWiLightMenu/emulators/jEnesisDS.nds
BANNER_PATH=/_nds/TWiLightMenu/emulators/jEnesisDS.bnr
RAMDISK_PATH=/ROM.BIN

And then we can just yeet the emus. Anyone who wants them separately can just make one of these .ini files.

Side note: this would easily allow adding other configs such as these in the issue that are still not implemented as far as I'm concerned: https://github.com/DS-Homebrew/TWiLightMenu/issues/927

lifehackerhansol commented 2 years ago

This could also be used to launch something that isn't an emulator, so long as the homebrew supports argv launching. An example of this is MPEG4 Player.

fox8091 commented 2 years ago

Personally would be more of a fan of using a single file (with a name similar to fileassoc.ini maybe?) with contents similar to the following:

...
[gen]
USE_BOOTSTRAP=1
USE_RAMDISK=1
EMULATOR_PATH=/_nds/TWiLightMenu/emulators/jEnesisDS.nds
BANNER_PATH=/_nds/TWiLightMenu/emulators/jEnesisDS.bnr
RAMDISK_PATH=/ROM.BIN
[gb]
USE_BOOTSTRAP=1
USE_RAMDISK=0
EMULATOR_PATH=/_nds/TWiLightMenu/emulators/gameyob.nds
BANNER_PATH=/_nds/TWiLightMenu/emulators/gameyob.bnr
...

This makes parsing the single file more difficult, but also reduces file clutter and simplifies parsing in other ways due to not needing to parse multiple files. Additionally, I'd recommend changing EMULATOR_PATH to something like EXTERNAL_PATH if the intention is to allow other homebrew as well (This would also imply changing the default path from TWiLightMenu/emulators to TWiLightMenu/external).

cfgexe commented 2 years ago

Personally would be more of a fan of using a single file (with a name similar to fileassoc.ini maybe?) with contents similar to the following:

...
[gen]
USE_BOOTSTRAP=1
USE_RAMDISK=1
EMULATOR_PATH=/_nds/TWiLightMenu/emulators/jEnesisDS.nds
BANNER_PATH=/_nds/TWiLightMenu/emulators/jEnesisDS.bnr
RAMDISK_PATH=/ROM.BIN
[gb]
USE_BOOTSTRAP=1
USE_RAMDISK=0
EMULATOR_PATH=/_nds/TWiLightMenu/emulators/gameyob.nds
BANNER_PATH=/_nds/TWiLightMenu/emulators/gameyob.bnr
...

This makes parsing the single file more difficult, but also reduces file clutter and simplifies parsing in other ways due to not needing to parse multiple files. Additionally, I'd recommend changing EMULATOR_PATH to something like EXTERNAL_PATH if the intention is to allow other homebrew as well (This would also imply changing the default path from TWiLightMenu/emulators to TWiLightMenu/external).

im not good at cpp, but i could try and make that!

lifehackerhansol commented 2 years ago

After fiddling with Moonshell and its extlink setup a bit, Moonshell 2, when set an extlink, will show the icon of the homebrew app itself as the icon of the related game. We may not need a banner path that way?

Just an idea.

lifehackerhansol commented 2 years ago

Something that came to mind when I saw issue https://github.com/DS-Homebrew/TWiLightMenu/issues/1744 is that this ini would also be great for adding a REQUIRED_FILES ini. If memory allows, we could change this from an INI to a JSON.

Really what I want to see is the removal of hardcoded launch options :D. If we could actually fit JSON parsing into TWiLight this could be really expandable.

NightScript370 commented 2 years ago

https://github.com/devkitPro/3ds-hbmenu/pull/81 Is this helpful for a code basis?

lifehackerhansol commented 2 years ago

devkitPro/3ds-hbmenu#81 Is this helpful for a code basis?

To an extent, yes. I genuinely can't tell what it's doing though. What goes in the fileassoc folder, and what are they supposed to be named?

leo60228 commented 1 year ago

I think it works the same as nx-hbmenu, except at /config/hbmenu/fileassoc instead of /config/nx-hbmenu/fileassoc: https://switchbrew.org/wiki/Homebrew_Menu#File_Associations