Author Topic: Smart Joystick or gamepad configuration maping  (Read 3995 times)

djesoph

  • Newbie
  • *
  • Posts: 2
    • View Profile
Smart Joystick or gamepad configuration maping
« on: November 14, 2019, 07:09:13 AM »
hello.
I'm using attractmode under windows, and it's great. But I have several controlers :  joysticks, gamepads and racing weel. when I want to play racing game, for example, I unplug my gamepad then plug in my racing weel. But I have to remap all buttons for Attract Mode and emulators. it's boring for me and my friends who are waiting to play.

Is there a way (a plugin or a third program) to map each controler one time, and each time you plug in this controler, use this configuration. I think about "RECALBOX" which is an Emulator OS based on Emulation Station. It works like this :
- When you plug-in a unknown controler, and push a button for a while, it ask you if you want to map this controler.
- You map all buttons POV-Hat, 2 analog sticks, start, select, A,B,X,Y,L1,L2,R1,R2...etc and 'hot key'. Then it saves this configuration associed to the controler ID.
- So when you want to navigate in the front-end, to select a game for example, the front-end allways use the button you've maped to 'A' for the pluged controler ID, instead of 'button0' ,which may not be the good button if you've change your controler.
- In addition, when you launch a game, "RECALBOX" execute a scritpt that modify the configuration file of the emulator you're launching to remap all buttons for the pluged controler ID.

It's very smart and convenient!!

Do you know if there is a way to do somethig aproching? a third program or do I have to create a plug-in? what's the best aproach?
Thank you.  (and scuse for my bad english)
« Last Edit: November 14, 2019, 07:11:42 AM by djesoph »

myriadgamers

  • Full Member
  • ***
  • Posts: 43
    • View Profile
Re: Smart Joystick or gamepad configuration maping
« Reply #1 on: November 14, 2019, 08:54:37 AM »
I would be interested in something similar if not for different reasons. I have an arcade machine which currently has 2 joystick set ups and 4 Gamecube controller connections. Often times when windows updates it loves to change the order of priority and I have to fix it. Would love to have a set order of priority.. especially since I plan on adding in 4 more USB controllers to the system soon
Arcade Machine 1:
AMD 8350 black 4ghz 8 Cores
20 gigs of DDR 3 Ram
500 gb SSD
4 tb Storage drive

hermine.potter

  • Hero Member
  • *****
  • Posts: 767
    • View Profile
Re: Smart Joystick or gamepad configuration maping
« Reply #2 on: November 15, 2019, 01:03:55 AM »
@ all
have a look at joytokey
there are different settings available (specify a prefered joystick number, when this device is connected, and so on).
AM Version : 2.6.1
Input : Mad Catz Brawlstick; Mouse; Keyboard; Xbox360 Wireless
Cabinet : Yes
OS : Windows10 Pro
System : Dell Precision T3500 ; Intel X5650 ; 12GB RAM

myriadgamers

  • Full Member
  • ***
  • Posts: 43
    • View Profile
Re: Smart Joystick or gamepad configuration maping
« Reply #3 on: November 15, 2019, 08:43:28 AM »
I actually use joy2key, which is wonderful but unless I am missing something about the software it doesn't really help with priority order of USB devices (controllers). I have to be honest my past couple of updates on windows 10 havent actually cause the issue but moving forward after this weekend I plan on adding 4 more USB controller connections (with eventual Additions of 2 Light guns also).
Arcade Machine 1:
AMD 8350 black 4ghz 8 Cores
20 gigs of DDR 3 Ram
500 gb SSD
4 tb Storage drive

toothlessgrinn

  • Sr. Member
  • ****
  • Posts: 190
    • View Profile
Re: Smart Joystick or gamepad configuration maping
« Reply #4 on: November 15, 2019, 02:26:59 PM »
i use win7 have 5 joys,1 flight stick,1 trackball and occasionally use wiimotes (bluetooth) for light guns (still waiting for the lcd guns to come out) and ps3 controllers when needed . ive had 4 ps3 with all my  other controllers connected and only problem i have is with the wii motes but thats cuz they all carry the same id number.
also just a observation here if your using other frontends with attract mode it will conflict. (not that anyone thinks i know what im talking about)
maybe try windows 7 cuz mine works great and i can connect many controllers without having to remap anything.( except for the wiimotes but thats why i use them occasionally)
cuz it should remember all configs. or mark them as read only when your done configuring everything.
good luck ! hope you get it resolved!
we came , we saw , we lost LOTS of quarters...

Win 7
Asus mobo amd 64bit 3core
12g ram
4 player. Custom built woody cab
46" plasma screen with 22" marquee

djesoph

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Smart Joystick or gamepad configuration maping
« Reply #5 on: November 21, 2019, 01:08:50 AM »
Hi, and thanks for all your comments. I've took a look at joy2key. It seems great, although it's not free.

My goal is , for example, that  when I push the lowest button, (the X button on a playstation controller), it fires always the same action regardless of what controller is plugged in.

The only way I've found to do it with joytokey, is to map contolers's buttons as a specific keyboard key. Is there on other solution?

I've also tryed to use the program X360ce v4.x alpha, not the v3.x.
V4.x creates a virtual xbox360 controller instead of hook directx dll like in v3.x
With v4, you can also mask original controller.
https://github.com/x360ce/x360ce/releases

It almost responds to my goal : With this program, I can remap all buttons of any controller to emulate a virtual xbox360 controller.
the only problem, is that it's not plug'n play. Each time I unplug or replug a new controller, i've to change a little the configuration in x360ce.
Doese any body know this problem?

thanks.

hermine.potter

  • Hero Member
  • *****
  • Posts: 767
    • View Profile
Re: Smart Joystick or gamepad configuration maping
« Reply #6 on: May 22, 2020, 01:07:13 PM »
@ djesoph
I remembered that, you asking for controller detection. Maybe this helps or give you another idea:

my AM keymappings are stored here : C:\attract\attract.cfg

the problem:
if you edit keymap in attract.cfg, while AM is started :
it don't works immediatly / you have to close and start AM again



So try this:

-do not connect any of your "special" Joysticks

-start AM and make your standard keymappings

-close AM

-make a copy of this attract.cfg
for example : attract_STANDARD.cfg (or attract_ORIGINAL.cfg or something like this)




-connect your Joystick1

-start AM and make your keymappings for Joystick1

-close AM

-make a copy of this attract.cfg
for example : attract_Joystick1.cfg


-goto windows device manager

-goto Inputdevices HID (Human Interface Devices) (depends on windows language)

-look for your Joystick1


-right Mousbutton on this entry > Properties

-Details

-Device Instance Path

-there is something like this : USB\VID_045E&PID_0289\7&151A9CAF&0&1
(similar here)



-remove Joystick 1

-connect your Joystick2

-start AM and make your keymappings for Joystick2

-close AM

-make a copy of this attract.cfg
for example : attract_Joystick2.cfg


-goto windows device manager

-goto Inputdevices HID (Human Interface Devices) (depends on windows language)

-look for your Joystick2


-right Mousbutton on this entry > Properties

-Details

-Device Instance Path

-there is something like this : HID\VID_0079&PID_0011\7&1FE55BBD&0&0000
(similar here)



-use this autoit script:
Code: [Select]
; Original Script from here :
; https://www.autoitscript.com/forum/topic/155213-detect-usb-devices-connected/?tab=comments#comment-1121434

;specific Joystick 1 is connected
$vObjWMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
$vObjItems = $vObjWMI.ExecQuery('SELECT * FROM Win32_PnPEntity')

If IsObj($vObjItems) Then
For $vObjItem In $vObjItems
if $vObjItem.DeviceID == "USB\VID_045E&PID_0289\7&151A9CAF&0&1" Then
sleep(300)
FileCopy("C:\attract\attract_Joystick1.cfg", "C:\attract\attract.cfg", 9 )
sleep(300)
ShellExecute('C:\attract\attract.exe', '-c "C:\attract"')
Exit
Else
EndIf
Next
EndIf

;specific Joystick 2 is connected
$vObjWMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
$vObjItems = $vObjWMI.ExecQuery('SELECT * FROM Win32_PnPEntity')

If IsObj($vObjItems) Then
For $vObjItem In $vObjItems
if $vObjItem.DeviceID == "HID\VID_0079&PID_0011\7&1FE55BBD&0&0000" Then
sleep(300)
FileCopy("C:\attract\attract_Joystick2.cfg", "C:\attract\attract.cfg", 9 )
sleep(300)
ShellExecute('C:\attract\attract.exe', '-c "C:\attract"')
Exit
Else
EndIf
Next
EndIf

;Standard - no specific joystick / joypad is connected
sleep(300)
FileCopy("C:\attract\attract_STANDARD.cfg", "C:\attract\attract.cfg", 9 )
sleep(300)
ShellExecute('C:\attract\attract.exe', '-c "C:\attract"')



What does the script?

if you start script + Joystick1 is connected : the script replace attract.cfg with your settings of attract_Joystick1.cfg + starts AM
if you start script + Joystick2 is connected : the script replace attract.cfg with your settings of attract_Joystick2.cfg + starts AM
if you start script + Joystick1 or Joystick2 are NOT connected : the script replace attract.cfg with yor settings of attract_STANDARD.cfg + starts AM



make the same with your emulators. the most saves keybinds in .ini-files/config-files.
add further codelines with FileCopy commands, to replace emulator settings too.
« Last Edit: May 23, 2020, 12:56:29 AM by hermine.potter »
AM Version : 2.6.1
Input : Mad Catz Brawlstick; Mouse; Keyboard; Xbox360 Wireless
Cabinet : Yes
OS : Windows10 Pro
System : Dell Precision T3500 ; Intel X5650 ; 12GB RAM

superdan

  • Jr. Member
  • **
  • Posts: 23
    • View Profile
    • cdlab
Re: Smart Joystick or gamepad configuration maping
« Reply #7 on: January 16, 2023, 12:39:45 AM »
very cool!!!
Is there a corresponding script for linux?
It would be very nice not to have to replace the whole attract.cfg file but only the part about mapping. Is there any way to do an include in attract.cfg? That way you could have just the gamepad settings on one file and replace just that. That way if you make changes to attract.cfg you would do it in one file. Thank you
« Last Edit: January 16, 2023, 01:16:24 AM by superdan »
If you want, contact me with the form @ cdlab