Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Extending the Network Control Interface to allow loading games #13506

Open
Gikkman opened this issue Jan 17, 2022 · 2 comments
Labels
feature request New enhancement to RetroArch. networking

Comments

@Gikkman
Copy link

Gikkman commented Jan 17, 2022

I've been looking at the Network Control Interface (NCI), and I feel I got some cool ideas for what one could do by allowing external programs control a running instance of RetroArch. I've tinkered with similar capabilities in other emulators, but those are often single-system emulators. Bringing such capabilities to RetroArch would be very powerful I think.

The current API of the NCI can be found here:
https://docs.libretro.com/development/retroarch/network-control-interface/

One of the more central parts that's missing though would be the ability to tell the emulator to load a certain game, preferably by passing it an absolute path. From my understanding of the code, the current NCI works by simulating activating pressing certain hotkeys, such as RARCH_FAST_FORWARD_KEY or RARCH_LOAD_STATE_KEY. I recon my feature request would probably require some kind of re-architecture of how this works, or at least extend the capabilities of it. I don't understand enough of how the feature work to suggest an approach though.

There are several more things I could suggest for extending the NCI, but if this feature is put in place, it would allow for starting to tinker with some external tools.

@LibretroAdmin
Copy link
Contributor

@cthulhu-throwaway what do you make of this?

@RandomDude560
Copy link

I'd also like to load games this way, so I had a look at this.

commands are defined here

static const struct cmd_action_map action_map[] = {

network commands seem to originate here in command_network_poll

static void command_network_poll(command_t *handle)

parsing is done here, this seems to support arguments already and uses action_map if one was provided otherwise it uses map

static void command_parse_msg(

there are commands with arguments e.g. SET_SHADER

{ "SET_SHADER", command_set_shader, "<shader path>" },

bool command_set_shader(command_t *cmd, const char *arg)

can we use SET_SHADER from the network interface? how are arguments provided? 'SET_SHADER "path/to/someshader"'?
if so it should be possible to make a command_load_content method which invokes the same code path the GUI uses?

I tried 'LOAD_STATE_SLOT 0' for simplicity but with no success, LOAD_STATE worked though.

If everything works sending something like 'LOAD_CONTENT "/path/to/game.bin"' should do the same as selecting something with load content in the GUI.
Another "LOAD_CORE" command would be needed for standalone cores.
Path arguments should be UTF-8 to support unicode, no idea if command_parse_msg already does this.
This should also extend stdin and uds interfaces as they use this code as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New enhancement to RetroArch. networking
Projects
None yet
Development

No branches or pull requests

3 participants