libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.16k stars 1.82k forks source link

[3DS] Provide autorun functionality for forwarders and custom frontends #12938

Open Daeymon opened 3 years ago

Daeymon commented 3 years ago

It would be useful to have autorun functionality on the 3DS version of RetroArch. Other systems have this with command lines, but this isn't an option with 3DS homebrew development.

On the 3DS, the community has already developed "forwarders", which allow users to create items on the Home Menu to launch specific roms in RetroArch. The issue here, is it requires a custom copy of RA for every rom baked into the forwarder. This seems highly inefficient, and there is no way for the users to update the version of RetroArch these forwarders use.

What would be useful would be for 3DS RetroArch to detect for the existence of a autorun ini or cfg file. And if this file exists, read the file path from it. The file would be created by an external app (either a forwarder or custom frontend). Once read, delete the file, and autoload the rom at the target path if its compatible with the core in "retroarch-salamander.cfg".

This would bring autorun functionality to the 3DS, meaning more efficient forwarders could be built by the homebrew community, which would utilise a centralised and user updatable copy of RetroArch.

MrHuu commented 3 years ago

Retroarch on 3DS is already launched with a commandline. Not read from a file, but set in memory before doing the application jump. I see no reason why a forwarder couldn't do the same thing with a static argument. No need for custom retroarch builds which the currently available 'forwarders' basicaly are.

An actual forwarder capable of launching a regular retroarch core would be the sollution here. But that's out of the scope of Retroarch.

As for .3dsx, launching with an argument passed from an .xml shortcut may be an option.

Daeymon commented 1 year ago

Retroarch on 3DS is already launched with a commandline. Not read from a file, but set in memory before doing the application jump. I see no reason why a forwarder couldn't do the same thing with a static argument. No need for custom retroarch builds which the currently available 'forwarders' basicaly are.

An actual forwarder capable of launching a regular retroarch core would be the sollution here. But that's out of the scope of Retroarch.

As for .3dsx, launching with an argument passed from an .xml shortcut may be an option.

I've been revisting this recently with a personal project. So am I right in understanding, that you are saying that I can use a APT_DoApplicationJump on a core CIA, and if I pass the rom path in the "param" parameter, then RetroArch will be able to consume this parameter and launch the game? I'm going through the code here on GitHub, but being a Microsoft stack C# web developer, I'm a little out of my element.

Update: Finally got my head round the code and that is exactly how it works. Just tried it and it works. Very nice.

MrHuu commented 1 year ago

Yes, that's correct when using the CIA builds. This can be implemented in a very simple launcher application which reads the values from a file for example.

https://github.com/libretro/RetroArch/blob/8b3965436806f0a21a65e2c5bd4a9c0f7649722b/ctr/exec-3dsx/exec_cia.c#L227-L244

Set the titleid of the installed .cia you wish to launch: APT_PrepareToDoApplicationJump(0, ciaInfo.titleID, 0x1);

Launch the title with the path to the content you wish to load: APT_DoApplicationJump(&param, sizeof(param.argc) + argsLength, argvHmac);