Joytokey and rocketlauncher causing BigBox to lose focus

elements604

New member
RL Member
Hello, I have joytokey profiles setup with each of my rocket launcher systems. When I launch a system through BigBox it loads the correct profile and everything works correctly. When I close the game back into BigBox, rocket launcher loads the front end profile, which causes big box to lose focus. This means I cant control big box again unless I physically click on the screen with my mouse.

Anyone know what is causing this issue? I tried not having a front end profile and using BigBox built in controller settings, but then what happens is rocket launcher does not switch profiles correctly when launching another system.

I have tried enabling restore and click front end on exit in rocket launcher, however it looks like rocket launcher loads the front end first, then switches the joytokey profile to the front end profile which causes bigbox to lose focus.

I have everything working in hyperspin, however would really like to switch over to BigBox and this is the main thing stopping me.
 

SupraKarma

Member
Supporter
RL Member
I've figured out 'a' solution to this, but I'm sure it's not proper. In RocketLauncher\Lib\Keymapper.ahk, there's the following code, my additions are in red.

RunXpadder(keymapperPath,keymapperExe,ProfilesInIdOrder,joystickArray)
} Else If (keymapper="joy2key") OR (keymapper = "joytokey")
{ Log("RunKeymapper - Looping through controllers to find joytokey profiles for each one",5)
If (keymapperLoad_Or_Unload = "load")
Profile2Load := GetProfile(keymapper, romProfile . "\" . dbName . "|" . emuProfile . "\" . emuName . "|" . systemProfile . "\" . systemName . "|" . defaultProfile . "\_Default", keymapperLoad_Or_Unload)
Else If (keymapperLoad_Or_Unload = "unload" && keymapperFrontEndProfile = "joytokey" && !contextOnExit)
Profile2Load := GetProfile(keymapper, FEProfile . "\" . keymapperFrontEndProfileName, keymapperLoad_Or_Unload)
Else If (keymapperLoad_Or_Unload = "unload" && keymapperFrontEndProfile != "joytokey" && !contextOnExit)
Profile2Load := ; user does not have joytokey set as their FE profile choice, keeping this blank will unload joytokey
Else If (keymapperLoad_Or_Unload = "menu")
Profile2Load := GetProfile(keymapper, RocketLauncherProfile . "\RocketLauncher", keymapperLoad_Or_Unload)

RunJoyToKey(keymapperPath,keymapperExe,Profile2Load)
}
Log("RunKeymapper - Ended")
If (keymapperLoad_Or_Unload = "load")
Sleep, 250
If (keymapperLoad_Or_Unload = "unload" && keymapperFrontEndProfile = "joytokey" && !contextOnExit)
Send, {Click down}{Click up}

Return %FEProfile%
}




The 'Restore Frontend on Exit/Restore and click' setting in RLUI does nothing in this situation. Adjusting the sleep time higher does two things - it delays the time to launch a game in BigBox, and after exiting, BigBox will briefly regain focus, then lose focus for however long the sleep time is, then regain it.

Lowering the sleep time or even eliminating it entirely is possible, BigBox will still work, but things will look weird when you exit BigBox - namely, the video won't 3D-spin back into focus, and your data won't scroll up showing your 'play count' going up one.

250 milliseconds is the sweet spot, at least on my system, where everything seems to look right.

I know absolutely nothing of code, what the problem is here exactly, or why this fixed it. I got lucky like I usually do whenever I 'fix' something. :) It would have seemed more intuitive to place the mouse click AFTER the Return %FEProfile% (because manually clicking your mouse certainly works), but that doesn't solve the problem.

I'm hoping someone more knowledgeable than myself is willing to chime in and offer some feedback. I'm glad I got it working, but seems more like a hack than a fix, and I don't know if it will fix the problem for everyone.
 
Last edited:

SupraKarma

Member
Supporter
RL Member
I've updated my last post, in case anyone is interested in this.

Before, it was sending a mouse click both before loading a game, and when the frontend profile is loaded again. That would cause problems with HyperSpin running properly - it would keep focus even while a game was running.

I've tinkered with it some more - the delay is still necessary when first loading a game for BigBox to make everything display as intended. A game is supposed to load, and upon exit, the video pan spins in 3d, and the text scrolls up or down and you have a higher play count in your data/info. Without the delay, this wouldn't happen. A 250 millisecond delay is the bare minimum, at least on my system, that would work. Anything less, and you'd run into issues, such as the video not playing at all upon exit (although you'd still have your joytokey profile properly loaded, at the least).

The 'If' statements (if I did it correctly, and understand it correctly) makes it so that the delay only occurs upon load, giving your keymapper time to load before the game does (necessary to prevent issues). And then the 'click' only occurs upon exit, which is what you want (since this is the only time you need it).

If anyone else has anymore problems with this, please feel free to ask for help, I'll see what I can do.
 
Last edited:

SupraKarma

Member
Supporter
RL Member
I've encountered yet another problem. JoytoKey also makes MAME lose focus (if you're using bezels at least) after exiting Pause. Typically you have to navigate in Pause left or right once to make it happen.

I'm about fed up with this... RocketLauncher's keymapping functionality is great in theory but it just causes too many problems. Standalone JoytoKey won't let you map per game, but at least you never lose focus.

I'd welcome any more input on this subject.
 

elements604

New member
RL Member
I've encountered yet another problem. JoytoKey also makes MAME lose focus (if you're using bezels at least) after exiting Pause. Typically you have to navigate in Pause left or right once to make it happen.

I'm about fed up with this... RocketLauncher's keymapping functionality is great in theory but it just causes too many problems. Standalone JoytoKey won't let you map per game, but at least you never lose focus.

I'd welcome any more input on this subject.

Hi Suprakarma,

I tried your ahk method, it worked however it causes launchbox to behave strange (launchbox fails to load menus and what not when it regains focus)

Anyways I dont seem to have an issue with mame pause menu but I did notice that I when I went into pause with retroarch and then exited pause in snes I had some issue where I would lose control after pressing the menu button.

So to sum it all up I have gone back to disabling the front end profile and just controlling launchbox with xinput controllers and everything is working fine again.
 

SupraKarma

Member
Supporter
RL Member
Completely understandable... thanks for trying it out and giving me some feedback.

I'm trying to figure out if there's a way to make JoytoKey run invisible/hidden - if it can, that might fix the problem. The reason the frontend is losing focus is because the JoytoKey window flashes in the task bar briefly.

I tried disabling the task bar, killing the task bar, nothing worked.

Xpadder isn't an option, because well... Xpadder sucks. :) Namely, it scrambles profiles when you have multiple players.
 
Top