Main > Software Forum

New ControllerRemap utility, 7/11/13 update available (Version 0.0.11)

<< < (46/47) > >>

I wanted to give back, since i've pulled so much info from arcadecontrols in the past couple years! drventure and tverona have helped greatly to solve a problem i have with one of my machines that has 12 emulators, and 7 controllers that get reordered constantly..

Since drventure's configuration works only for MAME, I wrote a script which uses the output of your controllerRemap /list command to enumerate the joysticks, and get the directinput ID. it then goes through a file, replaces certain joystick identifiers with the directinput ID, and writes it out to the config file that the emulator exists. This can be a mame cfg, or any other emulator's .ini file.

0) use joyID to list change the device order to something expected. This usually sticks unless you add another controller, but games do not use it.. drVenture's app displays the controller with this identifier though!!
1) Save the below script as a vbs file in the same directory as controllerremap.exe
2) copy your emulators config file (i used a name like  replace.xxxxxxx so i could keep track of them easily)
3) find the controller names in controllerRemap list, and copy the identifying info. for this example i used ''SNES Controller', ID=5" and "'SNES Controller', ID=6"
4) in the copy of your emulators config, replace the joystick number with double brackets surrounding your unique information (ie. <<'SNES Controller', ID=5>>).

the script then goes through, pulls the current directinput ID from controllerRemap, and rewrites your .cfg or .ini file, replacing the controllers unique identifier with the DirectInput ID...
I run this at hyperspin startup, and works great!

I know its WAAY overcomplicated, and i might write a console app to take care of it instead of having to modify a script every..  but
if i did that, i would probably just find a way to grab the directInput IDs directly, without using controllerRemap /list..  and this way was quicker, since you have already done the legwork!

My Devices List
D:\Tools\Controller Remapper>ControllerRemap.exe /list

ControllerRemap Utility v0.0.11.0 - For Mame
(c) 2011 drventure Enterprises

Joystick Device List (Devices are in enumeration order) ...

   1.  'N64 Controller', ID=2
   2.  'NES Controller', ID=3
   3.  'SNES Controller', ID=6
   4.  'ATRAK Device #1', ID=7
   5.  'NES Controller', ID=4
   6.  'SNES Controller', ID=5
   7.  'N64 Controller', ID=1
   8.  'GP-Wiz40', ID=0

Mouse Device List (Devices are in enumeration order) ...

   1.  'HID#VID_047D_PID_1022#8_17f6d9fc_0_0000#'
   2.  'HID#VID_0409_PID_2433_MI_01_Col01#7_8e0c882_0_0000#'
   3.  'HID#VID_D209_PID_1601_MI_02#7_6f69e7b_0_0000#'

End of list

#############Start of script ################ (its ugly, i know, didn't have a lot of time to clean it up!)(might rewrite as console app)

Option Explicit
dim remappath
remappath = "ControllerRemap.exe"

Dim WshShell
Dim fso, file
Dim srcfile, destfile, strText

dim interested_control1
dim interested_control1_enum

dim interested_control2
dim interested_control2_enum

dim interested_control3
dim interested_control3_enum

'Create the object that is used to execute the command-line output.
Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.CurrentDirectory = "D:\Tools\Controller Remapper"

'Set controller names to find in enumerator list. This should match what is in the sample file
interested_control1 = "GP"
interested_control2 = "'SNES Controller', ID=5'"
interested_control3 = "'SNES Controller', ID=6"

WshShell.Run "%comspec% /c " & remappath  & " /list > " & "controllerlist.out"
'Wscript.echo "Rewriting Configs.." & vbcrlf & "%comspec% /c " & remappath  & " /list > " & "controllerlist.out"

'Create the object that is used to create your destination file.
Set fso = WScript.CreateObject("Scripting.FileSystemObject")

Set file = fso.OpenTextFile("D:\Tools\Controller Remapper\controllerlist.out", 1)
Dim strLine
do while not file.AtEndOfStream
     strLine = file.ReadLine()
     'Do something with the line
    'if instr(strLine, interested_control1) then wscript.echo strline
    if instr(strLine, interested_control1) then interested_control1_enum = left(trim(strLine), 1)
    if instr(strLine, interested_control2) then interested_control2_enum = left(trim(strLine), 1)
    if instr(strLine, interested_control3) then interested_control3_enum = left(trim(strLine), 1)
    'if instr(strLine, interested_control2) then wscript.echo interested_control2_enum
Set file = Nothing

'Open other files, loop through, and replace with enum
Set srcfile = fso.OpenTextFile("D:\Hyperspin\Emulators\MAME\174\cfg\replace.a2600.cfg", 1)
strText = srcfile.ReadAll
Set srcfile = Nothing

'Do all replacements needed
strText = replace(strText, "<<" & interested_control1 & ">>", interested_control1_enum)

'Write File Back
Set destfile = fso.OpenTextFile("D:\Hyperspin\Emulators\MAME\174\cfg\a2600.cfg", 2)
Set destfile = Nothing

Set srcfile = fso.OpenTextFile("D:\Hyperspin\Emulators\Snes9x\replace.snes9x.conf", 1)
strText = srcfile.ReadAll
Set srcfile = Nothing

'Do all replacements needed
strText = replace(strText, "<<" & interested_control2 & ">>", interested_control2_enum)
strText = replace(strText, "<<" & interested_control3 & ">>", interested_control3_enum)

'Write File Back
Set destfile = fso.OpenTextFile("D:\Hyperspin\Emulators\Snes9x\snes9x.conf", 2)
Set destfile = Nothing

Set srcfile = fso.OpenTextFile("D:\Hyperspin\Emulators\Fusion364\replace.alien.fusion.ini", 1)
strText = srcfile.ReadAll
Set srcfile = Nothing

'Do all replacements needed
strText = replace(strText, "<<" & interested_control1 & ">>", interested_control1_enum+2)

'Write File Back
Set destfile = fso.OpenTextFile("D:\Hyperspin\Emulators\Fusion364\fusion.ini", 2)
Set destfile = Nothing

Does this work to retain light guns ids as well? ive tried but not results, thxs

seems to work on my end with caveat:

when exiting a game, the utility stays in focus, the FE licks up.  a quick click on the FE and it unfreezes.

hi struggling to get download link to work can any one help please.


--- Quote from: tverona on September 19, 2016, 01:34:47 pm ---FYI, I submitted a pull request to fix this issue in MAME itself - see,151710.0.html. Take a look at the approach and let me know what you think.

--- End quote ---

I still have the same problem today with MAME .197

I did try the Arcade Guns Pro utility and it's very easy to setup which is it's biggest flaw. Very user friendly but not no customizing for the UI controlls as far as I can tell. I wasn't able to get it working from within Hyperspin as well, just by launching Mame directly. I did however work with the Dial/Trimmer for my spinners. I whish I could get those to be recognized correctly with RemapGui. Any suggestions?


[0] Message Index

[#] Next page

[*] Previous page

Go to full version