Button combos in config

I’m make retro-console from Raspberry Pi and don’t want to use keyboard with console, only gamepads. And my problem is a define hotkey to exit game. If RetroArch support combos, it will be simple way to exit game via pressing Select+Start, for example.

P.S. Does RetroArch support additional multimedia keys from multimedia keyboards?

Currently, multiple-key combinations aren’t implemented due to game consoles’ input polling systems, which capture the entire gamepad state each frame without waiting for a PC-like “keyup” event. In other words, RetroArch reliably and immediately sends all actual game system input (such as Start, Select, A, and B) directly to the emulator core when the corresponding keybinds are pressed (on the “keydown” event) and the emulator core handles that input data from there.

Combinations like you’re describing would be possible to implement, but in the case of the user pressing your example combination, RetroArch would be sending the Start and Select input states to the emulator core which would be using that input in its emulation immediately as the user pressed them. RetroArch would have to be simultaneously checking whether that particular combination was held during each of its main loop executions, either after or before the emulation part of the loop. It’s possible, but not implemented probably because it takes extra work and the UI design for configuration is difficult.

I agree that it would be excellent to have button combinations implemented.

Human input is always a difficult topic for software designers and users alike, since humans vary greatly in how they prefer to give input to their computers. Disclaimer: I do not claim to be a software designer.

Lex, does your post explain why RetroArch doesn’t respond to the AHK script I just made to kill my Emulators and force-maximize XBMC?


Joy6::
  If GetKeyState("Joy5", "p") && GetKeyState("Joy9", "p") && GetKeyState("Joy10", "p") {
    send !{F4}
    sleep 100      
    send {ESC}

    sleep 500
    WinMaximize, XBMC  
  }
return

I made this script for two reasons: 1) I don’t want to “accidentally” kill my emulator, so having to press 4 buttons at once (start/select/both triggers) prevents that. 2) XBMC doesn’t properly maximize itself after exiting the ROM. I kill two birds with one stone here.

My script works fine for the standalone Mednafen emulator I use for TurboGrafx, as well as Project64 for N64 roms. But the rest of my consoles are run through RetroArch, and it won’t let me use the controller to exit. =/

I won’t have a keyboard attached to the machine once it’s done, so I need to be able to use the controller to close it.

I don’t know. AHK is funny sometimes. What happens if you disable vsync in RetroArch, then try that same script? Also, what happens if you add “#InstallKeybdHook” to the top of your script? It’s probable that neither of these things will change anything. I’m unsure.

My boys are in the middle of their first exposure to Super Mario Bros 3, so I hate to interrupt that. =) (the better video gamer of the two is doing well, but his brother is raging right now. “OH COME ON, I JUMPED!”)

I’ll try both after they go to bed and report back here with the results.

Is AHK not getting the feedback while RetroArch is the focus? Or is RetroArch just ignoring the keypress? That’s probably important information. I’ll have it trigger a desktop message box or something to figure out which is which.

Neither of these worked, unfortunately.

However, I did learn that AutoHotkey is definitely recognizing the keypresses while a rom is up full screen. I changed to to do a message box instead, and executing my combo will play the system sound for the message box and minimize the game to display said msg box. The mouse is stuck in the upper left hand corner of the screen, but hitting enter clears the msg box, and I can alt-tab back into the rom.

So AHK is most likely sending the key command, but RetroArch is simply ignoring it. :frowning:

I also changed the script to send Joy8 (Start) to see if the game itself would respond to an in-game command (by pausing) and it didn’t.

Finally, I tested changing the exit hotkey to “z” on the off-chance that a different exit hotkey would work, but that also failed.

I’m SO close to being done with this build and being able to move on to the mass-importing of games. =/

I encountered something like this too - in my case RetroArch wouldn’t natively detect the ‘Back’ button on my MCE remote control so I attempted to remap it to send a key press instead (which RetroArch wouldn’t see either).

My solution in the end was to use EventGhost to look for and (if found) forcibly close RetroArch whenever I pressed the button on my remote.

I’m trying to avoid spending even more money on this by adding a fancy remote and IR detection. The goal is to operate 100% with just the Xbox 360 controllers.

I wonder if eventghost can be set up to detect and discriminate for multiple keypresses simultaneously.

I was just giving my own example to help give you ideas.

You could try using ‘Process, Close, retroarch.exe’ in your AHK script instead of trying to send a keystroke (though you may have to run AHK as administrator to get it to work if you’re using Windows 7).

Yes, EventGhost can detect multiple keypresses, you’d most likely want to use the HID plugin for use with your 360 controller if you decide to go that route.

Process command didn’t work.

However, WinKill (not WinClose, which is what I first tried yesterday) was successful. Now I’m just going to tweak the script to account for the other emulators, and I should be all set!

Well, in the event that the google bots send some poor future soul who also has problems closing RetroArch with a controller (XBOX 360 controller or otherwise) I will post the AutoHotkey script that I’m using successfully.

There are two hotkeys here. One is triggered by holding down both thumb sticks, the left button (not trigger) and hitting the right button. This one simply exits RetroArch, Mednafen, or Project64 if any of them are currently open. Finally, it forces XBMC to maximize itself since Advanced Launcher fails to re-maximize often.

The second hotkey triggers by holding down back/start/right button and then hitting the left button, and is for all the times when XBMC crashes and won’t maximize (I haven’t figured out why this happens). It kills the XBMC process, and then opens a new instance of it after waiting 3 seconds for the process to close.

#InstallKeybdHook

Joy6::
  If GetKeyState("Joy5", "p") && GetKeyState("Joy9", "p") && GetKeyState("Joy10", "p") {
    
    IfWinExist, RetroArch 
    {
      WinKill, RetroArch
      WinWaitClose
    }

    process, exist, mednafen.exe
    {
      NewPID = %ErrorLevel%  
      if NewPID = 0
        sleep 10
      else
        Process, Close, %NewPID%
    }

    process, exist, project64.exe
    {
      NewPID = %ErrorLevel%  
      if NewPID = 0
        sleep 10
      else
        Process, Close, %NewPID%  
    }
    
    NewPID = 0

    sleep 1000
    WinMaximize, XBMC  
  }
return

Joy5::
  If GetKeyState("Joy6", "p") && GetKeyState("Joy7", "p") && GetKeyState("Joy8", "p") {

    process, exist, XBMC.exe
    {
      NewPID = %ErrorLevel%  
        if NewPID = 0
          sleep 10
        else
          Process, Close, %NewPID%
    }

  sleep 3000
  run,C:\Program Files\XBMC\XBMC.exe


  }
return    

Hopefully all of this will still work once I set Windows to boot directly into XBMC instead of Explorer as a shell.

Forgive me if I’m missing something (quite possible), but couldn’t you use Xpadder or similar to map a controller input to the desired kill key? With Xpadder you could even make it activate after being held a certain length of time. Like, hold select for four seconds or whatnot.

This is how I manage it for my setup, although I use a combination of Start+B mapped to each emulator’s exit control and it works beautifully. :slight_smile:

(Finding a combination that won’t conflict with any game took me a while, as I forgot some SNES RPGs allow you to reset the game with L+R+Start+Select.)

Kirby Super Star isn’t an RPG! :stuck_out_tongue:

Might look into Xpadder again then in order to tweak the savestate/load buttons to simple combos.

I saw that suggested around the web, but the website to download it wanted money from me, and I figured I could get what I wanted done for free.

It is a pay program, but it’s some of the best money I’ve ever spent on software. Highly recommended.

Bought Xpadder, it does not disappoint.

Still figuring things out, but I’ve been able to do everything I wanted so far. Great program! Thanks for the encouragement to buy it.

You’re welcome, glad you like it. I find it indispensable, particularly as I’ve started playing most non-FPS PC games with a pad. I find it kinda fun to see how I can cram all a game’s functions onto one controller.

Check out their forums for info on more advanced functionality. Particularly useful are while-held set toggles (hold a button to temporarily swap to a different set of mappings) and the ability to make one button do different actions depending on how long it’s pressed.

If you want to send commands in a more controlled manner to RetroArch, you can do so over UDP. Instead of forcing keypresses, you can try doing:

retroarch --command “QUIT” for example. Remember to enable UDP command processing in config (General -> Enable external command interface). If you’re on windows, I guess you need to disable the cmd.exe window popping up all the time, but :stuck_out_tongue: It also possible to just send a plain UDP packet to port 55355 if you have an easy way to do that.

Awesome, I just switched to using this method and it’s working out great. Fortunately EventGhost has the ability to hide the console window for when I’m sending commands to RetroArch in this manner as well.

Here’s a current list of commands for those who are curious:

FAST_FORWARD FAST_FORWARD_HOLD LOAD_STATE SAVE_STATE FULLSCREEN_TOGGLE QUIT STATE_SLOT_PLUS STATE_SLOT_MINUS AUDIO_INPUT_RATE_PLUS AUDIO_INPUT_RATE_MINUS REWIND MOVIE_RECORD_TOGGLE PAUSE_TOGGLE FRAMEADVANCE RESET SHADER_NEXT SHADER_PREV CHEAT_INDEX_PLUS CHEAT_INDEX_MINUS CHEAT_TOGGLE SCREENSHOT DSP_CONFIG MUTE NETPLAY_FLIP SLOWMOTION