Jump to content
LaunchBox Community Forums

Ctrlr-Cyclr - select any controller you want from launchbox


Recommended Posts

This one is for the controllers hoarders.


what it does:
it basically lets you pull up a menu before you launch the game that lets you choose which controllers you like to use and in which order:
Untitled.thumb.png.0da52d47f731c3f5096a5bfcec677b13.png

how it does it:
briankendall made a dinput8.dll file that reads a .ini to know the order of the controllers, my script simply read and writes to that .ini file.
i changed the devicelister to instead of opening a gui to just list the controllers in the ini, under [ALL].
 if you want to open the gui, run from command line with any argument, for example:

start dir\devicelister.exe "1"

 

installation:
basically you put everything in the same folder as the emulator's .exe, you can also install it for entire system, read how to do it in the  devreorder page.
if you are running a 32 bit system, replace the dinput8.dll file with the one from the x86 folder.
it works best with Retroarch because of the autoconfig feature, allowing you to have config load up with the controller chosen.
but you can use it with any game/emulator you just have to provide your own button mapping.

also in devreorder.ini under [Settings] you can change the hotkeys to scroll the controllers and which player you choose.
Cycle_Players is also the hotkey that loads the gui, so basically everytime you load the gui it changes the player number.
you can change the player number by deleting the {GUID} lines under [order], so if you have 4 lines you will cycle through 4 players, if you have 2 lines you will cycle through 2 players.
you can also name your images by the {GUID}, so if you have 2 xbox controllers one in white and one in red you can have separate images for each.


Usage:
run Ctrlr_Cyclr.exe and press your Cycle_Players Hotkey (7 by default) then press your Cycle_Controllers hotkey (8 by default) to choose a controller,
the Cycle_Controllers hotkey is only active while the gui is up, so it doesn't need a dedicated button (I use the select button).
you can also cycle the controllers by pressing any joystick buttons, but currently it doesn't work on every controller.
pressing 7 again will change the player number.

you can also assign a combination hotkeys, or example:

Cycle_Players=~a & s


Leave it for 2 seconds, the gui will close and your selection will be saved (cycling the player again will cancel the selection).
you may have problems opening the gui on top of a full screen program, running it as administrator should fix it.
if you can't, try calling it from command line (can be done with joytokey or from a shortcut).
running it from command line you can load the menu in the player number you want, for example:

start <dir>\ctrlr_cyclr.exe "2"

will load the gui selecting player 2 controllers.
so if you want to have a button for each player that is the way to do it.


you can also apply a controller to a player by name without loading the gui, for example:
 

start <dir>\ctrlr_cyclr.exe "1" "DualShock 4"

will apply DualShock 4 to player 1.


in devreorder.ini:

Cycle_Players - set the hotkey that loads gui and cycles between players
Cycle_Controllers - set the hotkey that cycles between controllers
Minimize_Gui - set the hotkey that minimizes the selection window
Connect_Notify - choose if you want to see which controller was connected last
Last_Connected_First - choose if you want the last connected controller to be assigned to player 1
C+F4 kills app process


Download Latest:

https://github.com/haimbilia/Ctrlr_Cyclr/releases

Any suggestions are welcome.

Edited by haimbilia
  • Like 1
Link to comment
Share on other sites

I just built a 4 player arcade pedestal running on a Win11 mini PC- and I had everything working until I learned of this design flaw from Windows! soooo frustrating!

 

I got lucky on my first try when I booted everything up and all 4 players were by freak chance setup correctly, was like that all weekend. Then today I rebooted and connected a new bluetooth keyboard and mouse and everything got screwed up- I knew it couldn't be that easy!

 

Thanks for making these scripts, I'm going to test them out and see how they work. If you have any suggestions or advice please let me know!

 

Link to comment
Share on other sites

Ok I got it working, a friend actually told me that Joy To Key has options to choose the order of your connected controllers, I haven't tested it to see if it works, but this is what those options look like: image.thumb.png.151ae9df86b2bb8141efea2ad7ea38b7.pngimage.thumb.png.64b989e40e125bb5930a4b352652ac10.png

 

 

I'm not sure if this does the same thing as your script but in another way?

 

This is all new to me and I'm learning a lot, fast- but feels like everytime I solve a problem and get a win- 3 more new problems appear and it never ends hahah!

 

Additional question for you, with your script, when you select a controller "index" for like player one, what happens to the other players? For example, today I booted my arcade pedestal (runs on Win11) and all my 4 players were scrambled (i.e. P2 became P1, P3 became P2, etc.). I can use your script to switch the real life P1 to the correct P1 arcade stick in Win11- but does that mean that P2 = P2, P3 = P3, etc. automatically? How would you tell your script "hey now that you made the P1 blue arcade stick P1 in Windows, let's fix the other 3 players..."

Does that make sense? I was drinking a lot of rum last night so maybe my brain is just scrambled and I'm thinking too much about this...

Link to comment
Share on other sites

3 hours ago, BabyBillyFreeman said:

quick question, what is the ahk file for? dont think I saw it mentioned in your original post?

hi, the ahk is the source code.

3 hours ago, BabyBillyFreeman said:

but I don't see DeviceLister.exe in your zip file, what could I be missing?

you right, i forgot to add it, i added it now, download again.

1 hour ago, BabyBillyFreeman said:

I'm not sure if this does the same thing as your script but in another way?

joytokey is retaining order by GUID just like devreorder, that's true! but you have to map all the buttons to keyboard keys.
that's how i used to do it before i found devreorder, but it's not a good way, for example keyboard games,
or pc games can have conflict with your mapping, so you have to adjust for that.
anyway, that's not the problem my script is trying to fix, if all you want is a fixed order of 4 controllers, you just put thier GUID under [order] section (in the order you want) and you are done:
Capture.PNG.8aeb26974d323f093cd3146aed5ba078.PNG
that is the fundamental function of devreorder. you don't have to run Ctrlr_Cyclr.exe.
what i have done is made you a graphical menu that let's you switch between controllers
in case you feel like trying a console game that has analog inputs or something like that...

 

1 hour ago, BabyBillyFreeman said:

How would you tell your script "hey now that you made the P1 blue arcade stick P1 in Windows, let's fix the other 3 players..."

that's why you also have a cycle players (8) button, so you can assign a controller for every player.
if you only assign a controller to player 1 you leave the rest of the controllers to the mercy of the gods of windows..

Link to comment
Share on other sites

ahhhhhhh ok I think I'm starting to understand the paradigm here; let me see if I understand now:

 

  • as long as the files (dinput8.dll, devreorder.ini) are in the same dir as your emulator exe (i.e. Retroarch), everytime I run RA in this example, RA will "see" my controllers (4x arcade sticks in my case) in the order I dictate in the devreorder.ini; as long as I take my preferred list/order and place it under [order] like this:
    image.thumb.png.26960c8ff80468610ad1c63275288bf2.png
    I of course need to correct the GUID numbers in my screenshot!
     
  • if I do this for all my emus, this will be the case? do you know if this only works for some emus and not others? I guess I can test and cross fingers; because I have a huge LB build with about 8,500 games across a lot of emulators (i.e. MAME, Retroarch, OpenBOR, MUGEN, RPCS3, the list goes on!)
     
  • the way I understand it, if I use JoyToKey, it will only work as long as JoyToKey is running- which means I'd have to manually run J2K with Launchbox/BigBox somehow....I wonder if there's a way to have LB launch (no pun intended!) "additional apps" like you can with individual games?...

 

Thanks for helping me wrap my head around these new concepts to me!

 

 

Link to comment
Share on other sites

you got it right, you can also install devreorder for the entire system, read up in the github page i linked under: "Apply to your entire system".
if you install it on a system level you can see the effect in joy.cpl:
Capture.thumb.PNG.904a7b0195ee462c5bf5aabf6d12d524.PNG
 

it worked for me on every emulator i tried, but im sure there will be some odd balls.

if you like to launch a joytokey profile with an emulator you can use this script (of course change your path and profile name):

Run, -path-to\JoyToKey.exe -r profile.cfg /m
WinWait, JoyToKey.exe
WinMinimize 

in "Running Script" under LB's emulator edit.
 

 

Edited by haimbilia
  • Like 1
Link to comment
Share on other sites

On 7/11/2022 at 12:05 AM, haimbilia said:

you got it right, you can also install devreorder for the entire system, read up in the github page i linked under: "Apply to your entire system".
if you install it on a system level you can see the effect in joy.cpl:
Capture.thumb.PNG.904a7b0195ee462c5bf5aabf6d12d524.PNG
 

it worked for me on every emulator i tried, but im sure there will be some odd balls.

if you like to launch a joytokey profile with an emulator you can use this script (of course change your path and profile name):

Run, -path-to\JoyToKey.exe -r profile.cfg /m
WinWait, JoyToKey.exe
WinMinimize 

in "Running Script" under LB's emulator edit.
 

 

thanks for the help!

 

super weird, but when I use that script, it WILL launch J2K, BUT j2k will become the "active" window and I always have to ALT-TAB to the running instance of mame. It's a small issue, but not really usable with big box unless you have a keyboard nearby for Alt-Tabbing

 

also trying to use process close (Process - Syntax & Usage | AutoHotkey) upon Exit Script to close/kill JoyToKey.exe but it doesn't work

 

sorry I'm a  noob at ahk scripting and learning this stuff for the first time.

 

P.S.

custom batch files seem to work fine for closing J2K so I might use bat files instead of ahk, just using ahk I think would be cleaner and more minimalistic so it's preferrable I guess

Link to comment
Share on other sites

  • haimbilia changed the title to Ctrlr-Cyclr - select any controller you want from launchbox
  • 1 year later...
On 7/9/2022 at 1:17 PM, haimbilia said:

This one is for the controllers hoarders.


what it does:
it basically lets you pull up a menu before you launch the game that lets you choose which controllers you like to use and in which order:
Untitled.thumb.png.0da52d47f731c3f5096a5bfcec677b13.png

how it does it:
briankendall made a dinput8.dll file that reads a .ini to know the order of the controllers, my script simply read and writes to that .ini file.
i changed the devicelister to instead of opening a gui to just list the controllers in the ini, under [ALL].
 if you want to open the gui, run from command line with any argument, for example:

start dir\devicelister.exe "1"

 

installation:
basically you put everything in the same folder as the emulator's .exe, you can also install it for entire system, read how to do it in the  devreorder page.
if you are running a 32 bit system, replace the dinput8.dll file with the one from the x86 folder.
it works best with Retroarch because of the autoconfig feature, allowing you to have config load up with the controller chosen.
but you can use it with any game/emulator you just have to provide your own button mapping.

also in devreorder.ini under [Settings] you can change the hotkeys to scroll the controllers and which player you choose.
Cycle_Players is also the hotkey that loads the gui, so basically everytime you load the gui it changes the player number.
you can change the player number by deleting the {GUID} lines under [order], so if you have 4 lines you will cycle through 4 players, if you have 2 lines you will cycle through 2 players.
you can also name your images by the {GUID}, so if you have 2 xbox controllers one in white and one in red you can have separate images for each.


Usage:
run Ctrlr_Cyclr.exe and press your Cycle_Players Hotkey (7 by default) then press your Cycle_Controllers hotkey (8 by default) to choose a controller,
the Cycle_Controllers hotkey is only active while the gui is up, so it doesn't need a dedicated button (I use the select button).
you can also cycle the controllers by pressing any joystick buttons, but currently it doesn't work on every controller.
pressing 7 again will change the player number.

you can also assign a combination hotkeys, or example:

Cycle_Players=~a & s


Leave it for 2 seconds, the gui will close and your selection will be saved (cycling the player again will cancel the selection).
you may have problems opening the gui on top of a full screen program, running it as administrator should fix it.
if you can't, try calling it from command line (can be done with joytokey or from a shortcut).
running it from command line you can load the menu in the player number you want, for example:

start <dir>\ctrlr_cyclr.exe "2"

will load the gui selecting player 2 controllers.
so if you want to have a button for each player that is the way to do it.


you can also apply a controller to a player by name without loading the gui, for example:
 

start <dir>\ctrlr_cyclr.exe "1" "DualShock 4"

will apply DualShock 4 to player 1.


in devreorder.ini:

Cycle_Players - set the hotkey that loads gui and cycles between players
Cycle_Controllers - set the hotkey that cycles between controllers
Minimize_Gui - set the hotkey that minimizes the selection window
Connect_Notify - choose if you want to see which controller was connected last
Last_Connected_First - choose if you want the last connected controller to be assigned to player 1
C+F4 kills app process


Download Latest:

https://github.com/haimbilia/Ctrlr_Cyclr/releases

Any suggestions are welcome.

wow it's very nice. this software is very interesting and has a lot of potential. do you think it could be turned into a launchbox plugin? i would like it to be active only when bigbox is maximized. how could it be done? During games i don't want it to intervene because although it is started as administrator for some emulators it causes the game to be minimised, also it is not needed during the game but is needed before starting it.

Link to comment
Share on other sites

1 hour ago, Sbaby said:

wow it's very nice. this software is very interesting and has a lot of potential. do you think it could be turned into a launchbox plugin? i would like it to be active only when bigbox is maximized. how could it be done? During games i don't want it to intervene because although it is started as administrator for some emulators it causes the game to be minimised, also it is not needed during the game but is needed before starting it.

i have no idea how to make it a plugin if someone want to help it will be great. you can kill the process when launching an emulator by putting:

Process,Close,Ctrlr-Cyclr.exe

in the emulator running script, and you can re-run it with the emulator exit script:

Run "C:\ProgramData\devreorder\Ctrlr-Cyclr.exe"

 

Link to comment
Share on other sites

59 minutes ago, haimbilia said:

i have no idea how to make it a plugin if someone want to help it will be great. you can kill the process when launching an emulator by putting:

Process,Close,Ctrlr-Cyclr.exe

in the emulator running script, and you can re-run it with the emulator exit script:

Run "C:\ProgramData\devreorder\Ctrlr-Cyclr.exe"

 

 

Yes I had thought about it but to put it in all emulators and games, there are thousands, you cannot.

Looks like an ahk script, I ask you if it is not possible to add an option where the script pauses while bigbox is not in focus.
With the right mouse button I see that it is possible.

Also, I would like to point out that I did a lot of tests with the folder "C:\ProgramData\devreorder" but it did not work for me, and I came to the conclusion that my folder where it works perfectly is 

"C:\Users\*USER*\AppData\Local\VirtualStore\ProgramData\Devreorder"

I have no idea for what strange reason my Windows goes to write in that folder but it works (maybe because I have a dual boot)

Edited by Sbaby
Link to comment
Share on other sites

  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...