TWiLightMenu icon indicating copy to clipboard operation
TWiLightMenu copied to clipboard

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

Open lifehackerhansol opened this issue 4 years ago • 8 comments

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 avatar Nov 20 '21 17:11 lifehackerhansol

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.

lifehackerhansol avatar Nov 20 '21 17:11 lifehackerhansol

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).

fox8091 avatar Nov 20 '21 18:11 fox8091

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!

cfgexe avatar Nov 24 '21 05:11 cfgexe

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 avatar Feb 07 '22 18:02 lifehackerhansol

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.

lifehackerhansol avatar Mar 12 '22 08:03 lifehackerhansol

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

NightScript370 avatar Aug 15 '22 19:08 NightScript370

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?

lifehackerhansol avatar Aug 15 '22 20:08 lifehackerhansol

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

leo60228 avatar Dec 18 '22 18:12 leo60228