Homepage Forums RetroPie Project Controller Configuration in RetroPie Can Raspbian commands be assigned to buttons in a .map file?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #117305
    keem85
    Participant

    I’m asking because I use Moonlight stream to stream my PS2 emulator, Steam and Dolphin.. When I exit my apps, the Moonlight keeps streaming, because Moonlight hasn’t received it’s end-command “moonlight quit <IP>”…

    So, is it possible for me to alter my controller.map file, and add that command to my “special” button somehow? Or are there any other tips for this?.. Now I have to open up SSH on my mobile and “kill” the moonlight stream every time I exit a game.

    #117307
    labelwhore
    Participant

    I’ve got a better idea. If you need this to run every time you quit an emulator, then simply modify the launch commands in your /opt/retropie/configs/{system}/emulators.cfg files.

    So in those files you’ll see some lines like kind of this
    emulator-name=”/path/to/runcommand.sh command/line/to_start/emulator %ROM%”

    All you need to do is add this && moonlight quit <IP> between the %ROM% and the last “. so they’ll look something like this:
    emulator-name=”/path/to/runcommand.sh command/line/to_start/emulator %ROM% && moonlight quit <IP>”

    If you don’t actually need that to run every time, it’ll produce an error message when you close the emulator and moonlight was not running. To supress that error messag you could modify the line like this instead:

    emulator-name=”/path/to/runcommand.sh command/line/to_start/emulator %ROM% && moonlight quit <IP> 2&>1 >/dev/null”

    #117319
    keem85
    Participant

    Nice, once again you are very helpful! I think I need to do a backup first.. But I’m curious; Why does it work? I’m curious to the technical part of %ROM% etc.. The whole line there.. What’s it for?

    Edit: I cannot find the emulator to use. I’m using Moonlight-embedded, and that does not have that .cfg file

    #117322
    labelwhore
    Participant

    It’s the command line that starts the emulator. Basically, ES is just a nice looking interface that runs things from command line for you.

    To break it down the runcommand.sh script does a handful of things, it logs errors and does some cleanup after emulators quit, gives you that little interface to switch emulators and settings, and probably some other things I’m not aware of. The next piece is the actual command line that you would run if you were to start the emulator from command line directly. The part before the equal sign is just the name of the emulator that appears if you hit a button before the emulator were to start.

    So what we’re doing is simply adding another command that always runs after you exit the emulator. From the command line you can run multiple commands one after another by stringing them together and separating them by &&. The %ROM% is just a variable that gets swapped out with the path to the rom that’s being started.

    #117368
    labelwhore
    Participant

    edit: wrong thrad

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Controller Configuration in RetroPie’ is closed to new topics and replies.