Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: New ControllerRemap utility, 7/11/13 update available (Version 0.0.11)  (Read 151700 times)

0 Members and 1 Guest are viewing this topic.

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:June 25, 2023, 02:23:57 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Fourth Beta Version of ControllerRemap now available. (Version 0.0.10)

NOTE: I've gotten several reports of version 0.0.9 throwing virus alerts. I've rebuilt version 0.0.10, scanned with NOD32 locally as well as with a couple online scanners, and posted it in a ZIP file with a TXT extension, just in case.

When you download, just rename the file to a ZIP file to extract.

If anyone still gets a virus alert, please let me know (PM or respond on this thread).

++++++++++++++++++++++
V0.0.11 What's new
Fixed a bug in handling aliased controllers when the controller is not currently connected to the machine.
Now, that controllers mappings will be ignored and not written to the config file.


++++++++++++++++++++++
V0.0.10 What's new
Added support for MESS KEYPAD entries.

++++++++++++++++++++++
V0.0.9 What's new
Fixed problem with PORT entries that have more than 1 "newseq" child element. Previously, the children wouldn't
be properly copied to the remapped section.
Also, any additional attributes would be duplicated either. Both should now work properly.
This is particularly important for things like steering wheels that make use of the "increment" and "decrement" type newseq entries. Thanks to ArcadeBliss for pointing this out!


++++++++++++++++++++++
V0.0.8 What's new
Fixed minor issue with the command line /SAVE command


++++++++++++++++++++++
V0.0.7 What's new
Added support for GUNCODE input elements. Before, GUNCODE elements were simply ignored.
Added GUNCODE sample to the Sample.cfg file (and updated the PDF documentation)


++++++++++++++++++++++
V0.0.6 What's new
Fixed the Sample.cfg file to be correct (and match the PDF documentation)
Fixed so that you can specify a partial controller ID (any amount of ID actually, starting at the beginning) and the program will first attempt to match on the +entire+ id, and if that fails, will then attempt to match the whatever portion of the ID you've specified against the actual controller ID.
Ugh, that sounds terrible.
Here's an example:

This is a controller element with the FULL ENTIRE controller id specified:
    <controlleralias>
        <id>HID#Vid_1241_Pid_1111#b_2eabd86_0_00000#</id>
        <alias>Top Trackball</alias>
    </controlleralias>

Notice that "_0_00000#" at the end? That identifies which USB port the controller is plugged into. Since that port number can change if you move the device to a different port, ControllerRemap might not find it the next time.

Instead, you can now specify any amount of the ID, beginning at the start. So, I might set up the configuration like this instead:

    <controlleralias>
        <id>HID#Vid_1241_Pid_1111#b_2eabd86</id>
        <alias>Top Trackball</alias>
    </controlleralias>

When ControllerRemap sees the shortened version and attempts to match it against the complete ID of the installed device, it won't match.

Once it's searched all devices in that manner, it goes back and checks each device ID to see if it +begins with+ the specified ID. If it finds a match this way, the device is matched up just like before.

Technically, this does mean you could specify something silly like:
    <controlleralias>
        <id>HID#Vid_12
        <alias>Top Trackball</alias>
    </controlleralias>

That ID is likely too short to uniquely identify a single device, so your result will probably not be what you want.

Just use as much of the device ID as what looks to uniquely identify the device and you should be good.
++++++++++++++++++++++


Let me start by saying this thing is serious beta at this point. Standard disclaimers apply (It work on my machine, blah blah).

You'll need the .net runtime 3.5. But otherwise, that should be it.

It does require 2 DirectX dlls, but they are part of the executable and get extracted automatically as necessary. Nothing to do there.
Though wherever you run it from will need WRITE rights.

Extract the ZIP into a folder somewhere.

There's a sample CFG file, the documentation as a PDF, and the EXE.

It's basically a simple command line app. Run ControllerRemap /? for options.

And check out the help for a quick start guide, as well as the full docs.

Let me know if you run into anything, have questions, suggestions, can't get it to work, think the docs suck, etc.





----- OLD MESSAGE BELOW  -------
I've been working out the kinks on a little utility I'm calling ControllerRemap.

Essentially, it's my take on trying to solve the problem of what happens when you have a cab that supports USB input devices that might be disconnected or reconnected in various combinations at various times.

Many games support the concept of a JoystickID (and you can use another utility called JoyIDs to set those id's easily). The idea being that it assigns an ID to a joystick and that ID persists for that particular joystick, even if it's unplugged, other devices are plugged in and then the original device is reconnected.

However, from what I can tell of Mame, it doesn't support Joystick IDs. It appears that mame simply enumerates the devices current connected to the system when Mame is run, and subsequently uses those numbers in all the CFG and controller files it reads.

And since windows enumerates USB devices by Vendor ID, and since the vendor ID is essentially a random hex number, there's no telling where specific devices will end up in the enumeration order.

Soooo.. If you have 2 U360's, and you map them in MAME as Joystick 1 and 2, but then you plug in a game pad and it happens to sort BEFORE the U360s, mame will now think they're sticks 2 and 3.

I've seen plenty of projects around that appear to make use of disconnectable devices, but I've never seen any info on how to get mame to play reasonably well with them, without having to manually remap devices constantly.

At any rate, ControllerRemap, essentially allows you to define mame port mappings connected specifically to a controller by it's unique ID, including joysticks and RawMouse devices (like multiple trackballs or spinners if you have them).

It also allows you to set those maps for specific "systems" (ie drivers, or BIOS's, or specific games), just like the mame controller and CFG files currently allow, but with the added benefit of being able to specifically indicate which controllers map to what mame ports.

So, right before you run MAME, you run ControllerRemap, which basically just looks at the current controllers installed in the system and rebuilds the <INPUT> sections in your controller file to match what you +actually+ have installed.



Would anyone else find this concept useful? Have I completely missed some capability of Mame that would provide for this?

Right now the code is a little rough around the edges, but if there's interest, I could clean it up a bit and make it publicly available.

Just wanted to gauge interest (and see if I've totally wasted my time for a feature that Mame already has  ::) )

« Last Edit: July 11, 2013, 07:49:03 am by drventure »

Blanka

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2248
  • Last login:January 25, 2018, 03:19:28 pm
Re: New ControllerRemap utility, would anyone else find it useful?
« Reply #1 on: January 23, 2011, 01:22:33 am »
Sounds cool (if it was on mac)!
Maybe include remapping of keys as well. We have a tool on mac that does this, but I don't know if it exists for Windows. It allows you to map U360 to keyboard keypresses, U360 to mouse coordinates, mouse to keyboard mapping, adding macro's to any key, well pretty much mess up any controller to do anything else.

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:June 25, 2023, 02:23:57 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: New ControllerRemap utility, would anyone else find it useful?
« Reply #2 on: January 23, 2011, 10:12:43 am »
Unless I'm mistaken, JoyToKey and XPadder already do those sorts of things for Windows.

So far, any way, I haven't needed to use anything like that (that actually converts joystick input to keyboard presses) with Mame, it seems to handle all the various input devices I have pretty seamlessly.

However, I could see a small benefit with a utility like that. Since it would convert u360 stick movements to keypresses, Mame wouldn't have to have the sticks mapped at all, it would just use it's default keyboard mappings. Assuming JoyToKey or XPadder used JoystickID's to connect with specific joysticks, no matter when they were connected, that might work well.

But.... If you did want to play games using an Analog stick in mame, you might still have problems.

My little utility doesn't actually take input from any of the devices. It literally rewrites the Mame CFG controller file and exits. That's it.

SammyWI

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 457
  • Last login:August 16, 2022, 07:58:00 pm
Re: New ControllerRemap utility, would anyone else find it useful?
« Reply #3 on: January 23, 2011, 10:57:00 am »
Sounds like a useful tool.  I do disconnect my stand alone CP occasionally and remapping every time is a pain.

I've never needed joytokey in MAME, but I do use it for Daphne with a U360.  In that case, I don't think I've had any issues with unplugging things.  But it's been a while.

Cananas

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 299
  • Last login:August 27, 2017, 07:39:03 am
  • and the seventh day... PacMan was created
Re: New ControllerRemap utility, would anyone else find it useful?
« Reply #4 on: January 23, 2011, 11:07:16 am »
Yes. It seems very interesting tool.

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:June 25, 2023, 02:23:57 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: New ControllerRemap utility, would anyone else find it useful?
« Reply #5 on: January 23, 2011, 11:50:03 am »
I haven't worked with Daphne yet, but I believe JoyToKey makes use of JoystickIDs, which typically won't change even if you unplug the controller, plug it back in later, and plug other controllers in in conjunction with it. BUT to set JoystickID's effectively, you really need to grab a copy of JoyIDs.

But, it sounds like there's enough interest that I'll go ahead and clean this up and put it up online for some peer review  :)

I'll post back when I've got it a little farther along

Thanks for the comments, guys!

Bender

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1919
  • Last login:November 28, 2016, 08:12:21 pm
    • Happ to Tron Conversion tutorial
Re: New ControllerRemap utility, would anyone else find it useful?
« Reply #6 on: January 23, 2011, 12:30:08 pm »
This sounds great!
I have a big project for down the road that this is going to be essential for, I have always been concerned about how I'd over come disconnecting and reconnecting devices and not have the MAME controls all f*ed up
Keep us posted!
« Last Edit: January 23, 2011, 12:31:48 pm by Bender »

NickG

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 586
  • Last login:September 26, 2022, 05:25:23 am
  • Dig.
    • My Projects Page
Re: New ControllerRemap utility, would anyone else find it useful?
« Reply #7 on: January 23, 2011, 03:11:07 pm »
+1 interested party

animatorJustin

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 59
  • Last login:January 14, 2023, 11:09:32 pm
Re: New ControllerRemap utility, would anyone else find it useful?
« Reply #8 on: January 23, 2011, 09:57:18 pm »
+1 very, very interested. Trying to get wireless xbox controllers to work... :banghead: 

Bender

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1919
  • Last login:November 28, 2016, 08:12:21 pm
    • Happ to Tron Conversion tutorial
Re: New ControllerRemap utility, would anyone else find it useful?
« Reply #9 on: January 23, 2011, 10:01:07 pm »
+1 very, very interested. Trying to get wireless xbox controllers to work... :banghead: 

oh yeah, that too, I've given up on that cause when the computer doesn't detect the controller all my settings are off in mame

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:June 25, 2023, 02:23:57 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: New ControllerRemap utility, would anyone else find it useful?
« Reply #10 on: January 23, 2011, 10:16:27 pm »
This should definitely help to rectify those situations.

That's the main reason I ended up writing it. If I plugged in my xbox drums and PS2 guitar controllers, and then didn't think to unplug them before running mame, mame was all messed up.

And lets say I want to use an AIMtrak. It won't be plugged in all the time, but when it is, it'll suffer the same problems, I'm sure.

I should be able to post a workable version here in the next few days. This gizmo's a WHOLE LOT simpler than the Engine18 plugin  ::)

Stay tuned!

SavannahLion

  • Wiki Contributor
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5986
  • Last login:December 19, 2015, 02:28:15 am
Re: New ControllerRemap utility, would anyone else find it useful?
« Reply #11 on: January 24, 2011, 10:34:25 am »
+1

bkenobi

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1668
  • Last login:August 16, 2021, 10:41:52 pm
Re: New ControllerRemap utility, would anyone else find it useful?
« Reply #12 on: January 24, 2011, 12:03:22 pm »
Does this sound similar (not the same) to CFG Magician?  It can remap controls similar to what you are describing (I think).

markronz

  • We traced the call, and it came from....INSIDE YOUR ARCADE MACHINE!
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 821
  • Last login:April 12, 2019, 12:03:08 am
  • Game on!
Re: New ControllerRemap utility, would anyone else find it useful?
« Reply #13 on: January 24, 2011, 02:53:55 pm »
Plus one for the interest.

My current project does not have a need for such a thing, however, much like you're describing, some day I do plan on adding other controllers, guitars and etc, which would be plugged and unplugged on an as needed basis.   I've often wondered how I would handle such a scenario and think a tool like this would be AMAZING to solve that issue! 

vault

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 6
  • Last login:February 16, 2011, 01:45:03 pm
Re: New ControllerRemap utility, would anyone else find it useful?
« Reply #14 on: January 25, 2011, 05:27:03 pm »
+1 for interest.
I am building a cabinet with an embedded U360.  I need to plug in a Logitech gamepad occasionally to support a second player but whenever I do that the Logitech device shows up as Joy1 in mame...
I am using Mala as a frontend so I would be really interested in seeing your code eventually being ported as a Mala plugin. (by the way Mala does not get confused with the usb changes, I suppose it is using the IDs correctly)
I am only interested in overwriting the default.cfg file prior to mame start. How would you recommend that your code gets executed before mame? (a wrapper script around the mame executable?)
If I get this right your utility would detect whenever I connect the Logitech gamepad and then remap Player1 to use Joy2 (i.e. U360) amd Player2 to use Joy1(i.e. Logitech).
When just the U360 is present then the mapping should be Player1 to use Joy1 (U360) and Player2 none.
I hope we have your tool soon...

P.S. I have attached the U360 on my panel in a reverse direction because of problems with space so now I have the U360 joystick mapped in reverse in Mame (i.e. Joy1 up is actually U360 down). I hope your tool is flexible enough to cater for this as well...

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:June 25, 2023, 02:23:57 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #15 on: January 25, 2011, 10:57:48 pm »
@bkenobi

I haven't checked out CFGMagician. Sounds like I need to! Thanks

@Vault

The wrapper idea is exactly right. I just start a BAT file from Mala, and in the BAT file, I run ControllerRemap, and then start Mame.

I've actually got some code in ControllerRemap to echo all command line parms down to mame and launch it automatically, but i haven't had time to fully test that feature out, so it's not documented yet.

Check out the top post on this thread, I've updated it with an attachment for the first beta release of ControllerRemap.

Let me know what you think!

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:June 25, 2023, 02:23:57 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #16 on: January 25, 2011, 11:05:14 pm »
Answering the Question about CFGMagician. I just checked out the website and docs. It looks like it's more of a CFG Generator that run based on lists of games. I'm still not quite sure about it, as I've never really noticed that I've needed to set up configs for specific games. Usually, just defining the DEFAULT mappings works for me.

ControllerRemap wouldn't really work well with CFGMagician, mainly because ControllerRemap is intended to be used against a single CFG file located in Mame's CTRLR folder.

But that ctrlr file can contain input port mappings for any number of games, bios's, and drivers as well as the DEFAULT set of mappings.

So in theory, you COULD run CFGMagician to generate various CFG files that you need, and then move their contents into your controller CFG file.

But it'd still be a pretty manual process at this point.

vault

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 6
  • Last login:February 16, 2011, 01:45:03 pm
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #17 on: January 26, 2011, 10:50:41 am »
Absolutely amazing work !!!.
And it works too. I just finished testing it. I struggled a bit until I realized I had to delete my existing cfg\default.cfg because it was overwriting everything else.
After that the remapping works like a charm.
My startMame.cmd file that I placed in C:\mame0138 consists of just 3 lines. The % vars are for Mala to send the romname and sometimes other staff like -triplebuffer

@echo off
C:\utilities\ControllerRemap.exe /Remap:C:\mame0138\ctrlr\MikesArcade.cfg > NUL
call C:\mame0138\mame.exe %1 %2 %3 %4 -ctrlr MikesArcade
« Last Edit: January 26, 2011, 01:02:33 pm by vault »

vault

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 6
  • Last login:February 16, 2011, 01:45:03 pm
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #18 on: January 26, 2011, 11:23:09 am »
In fact just to play it safe and avoid any interoperability issues between controllers I just put the default.cfg file back in the config folder.
However this time I removed all the ports that ControllerRemap is handling and I am using it for all the rest of the ports.
This way I can set to None whatever defaults Mame comes with that can cause trouble while playing.

What would be great is if ControllerRemap could automatically detect the conflicts in the cfg\default.cfg and simply remove from it the ports that itself is trying to remap.
« Last Edit: January 26, 2011, 01:52:40 pm by vault »

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:June 25, 2023, 02:23:57 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #19 on: January 26, 2011, 09:46:31 pm »
Great news! Thanks for letting me know.

Yeah, the default file can interfere with the ctrlr file if there are conflicting port assignments. Mame doesn't seem to combine them, it just reads them in a certain order and the assignments it reads later overwrite the earlier read assigments.

I just set all my assignments up in my ctrlr file and blanked out the default.cfg.

But, you could also set up a few constant keyboard mappings in your default and not worry about them in the ctrlr file.

Interesting idea about altering  the default.cfg file... I'm not sure. If you set those ports deliberately in default.cfg, they could get wiped out inadvertently.

At any rate, glad to hear it's working for you!

MacGyver

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 317
  • Last login:December 18, 2023, 12:49:00 am
    • Project Build
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #20 on: March 30, 2011, 04:51:05 am »
Drventure, thank you. This utility make those of us with 5+ usb devices be able to spend more time playing games instead of spending time resetting them up.
You should know there is an error in your PDF on the configuration file layout, the order has it as <system=default><input><system=gamespecific><input></input></system></input></system>, when I think it is supposed to be <system=default><input></input></system><system=gamespecific><input></input></system>.

The utility works perfectly unless the USB device is changed to a different port, when this happens the sub IDs change, and you have to re-create the alias portion again with the new sub IDs. 
Is there a way to have ControllerRemap match from left to right only the portion of the ID in the alias ID and ignore anything longer then the alias ID that it detects from windows?
Basically give us the ability to ignore the sub IDs if we want?  So that an Aimtrak showing up as VEN_1234&DEV1602&0001_34fedsaa could simply have VEN_1234&DEV1602 in the .cfg file under the alias ID, so that moving the device to a different port won't require a "ControllerRemap /list" and editing the new sub IDs into the .cfg?  The Vendor and Device portion should be sufficient, and doesn't ever change no matter what port you change it to.

I will use your wonderful utility as is when I finally build my cabinet, but people with control panel only setups (like mine currently is until I build my cabinet) sometimes use different USB ports when they plug them in, and that requires me to edit the .cfg.

Thanks again, it was a brilliant idea, and was defiantly needed. :applaud:

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:June 25, 2023, 02:23:57 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #21 on: March 30, 2011, 07:52:41 am »
@McGyver

Thanks for the comments. I'll check on the PDF get an update posted. It's entirely possible I flubbed the docs there  :-[

As for the subid bit, I never noticed that while I was working on it, but hell yeah, that should be an easy fix and what you describe is exactly how I'd want it to work in that situation (plugging USB devices into different ports). Thanks for the heads up. Just monitor this thread for updates. I'll post back here once I've got the fix done.

VanillaGorilla

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 480
  • Last login:March 08, 2019, 10:23:51 pm
  • Coin detected in pocket
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #22 on: March 30, 2011, 09:17:30 am »
Awesome Idea. Long time coming, too. Cant wait to check it out this weekend! Now I wont have panel swap anxiety anymore ;)

MacGyver

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 317
  • Last login:December 18, 2023, 12:49:00 am
    • Project Build
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #23 on: March 30, 2011, 11:01:43 am »
Cool. I will keep checking back.  ;D
Also, I was wrong about the tag order error, it's not in the PDF, it's in the Sample.cfg that was included, at the very end:
Code: [Select]
    </controller>
    <!-- ###################################################
         ACTUAL INPUT MAPPING STARTS HERE
         DO NOT actually put anything in this section.
         It is completely cleared and regenerated!
         ###################################################
    -->
    <input>
      <!-- ###################################################
           This is a GAME specific section
           Add additional <controller> sections here
           to define how those controllers should map for this
           particular game
           ###################################################
      -->
      <system name="ribbit">
        <!-- This would be stupid to actually use, but as an example
             For this game ("Ribbit"), reverse the UP and DOWN directions
             on the joystick -->
        <controller id="U360 Player1">
          <input>
            <port type="P1_JOYSTICK_UP">
              <newseq type="standard">
              JOYCODE_YAXIS_DOWN_SWITCH</newseq>
            </port>
            <port type="P1_JOYSTICK_DOWN">
              <newseq type="standard">
              JOYCODE_YAXIS_UP_SWITCH</newseq>
            </port>
          </input>
        </controller>
        <!-- ###################################################
             ACTUAL INPUT MAPPING STARTS HERE
             DO NOT actually put anything in this section.
             It is completely cleared and regenerated!
             ###################################################
        -->
        <input></input>
      </system>
    </input>
  </system>
</mameconfig>

The PDF is correct, I remember now, I couldn't get the .cfg file I made to work because I was going solely off the Sample.cfg, then read the through the PDF and decided the PDF must be correct, and fixed the Sample to match the PDF.  It just took a little longer to figure out which one was correct.

Again, thanks for a great utility.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:March 16, 2024, 05:59:16 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #24 on: March 30, 2011, 01:00:14 pm »
drventure: 

I know nobody likes to hear it when they've done a ton of work, but I'm pretty sure there is a better way.  I remember reading that mame supports generic joystick flags, as well as device specific joystick flags.  In other words insted of say "JOYCODE_YAXIS_UP" you can put "MADCATZ_GAMEPAD_YAXIS_UP" and this solves the enumeration issue most of the time. 

Keep in mind I've never actually used this feature before, so I can't tell you if, how or how well it works. 

I think the utility is still needed though because when changing inputs inside mame, it uses the generic flags.  You might use this to alter how your program works though as it could simply convert the generic flags to specific flags without all the swapping. 

MacGyver

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 317
  • Last login:December 18, 2023, 12:49:00 am
    • Project Build
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #25 on: March 30, 2011, 04:08:13 pm »
Any specifics Howard_Casto?  I looked for about an hour, and all I found were posts of people describing the problem, but not understanding why.  I understand why, and the fact mame doesn't lock the vendor & device id to "mouse #" by default is surprising. For me the "MADCATZ_GAMEPAD_YAXIS_UP" setting would be ok for the aimtraks, something like "ATRAK Device #1_YAXIS_UP" most likely, but my spinners and trackball don't enumerate as joysticks, and would probably never keep their "mouse #" moniker after a reboot or being unplugged.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:March 16, 2024, 05:59:16 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #26 on: March 30, 2011, 05:48:44 pm »
Any specifics Howard_Casto?  I looked for about an hour, and all I found were posts of people describing the problem, but not understanding why.  I understand why, and the fact mame doesn't lock the vendor & device id to "mouse #" by default is surprising. For me the "MADCATZ_GAMEPAD_YAXIS_UP" setting would be ok for the aimtraks, something like "ATRAK Device #1_YAXIS_UP" most likely, but my spinners and trackball don't enumerate as joysticks, and would probably never keep their "mouse #" moniker after a reboot or being unplugged.


It's been a year or two since I ran across it.  I actually found it while mucking about in the source code so afaik it's an undocumented feature.  I'll try to find an example for you guys later this week. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:March 16, 2024, 05:59:16 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #27 on: March 30, 2011, 07:11:43 pm »
Hmm.. it looks like it's been removed.  There are remnants of it there, but at the top of the input.c file it reads:

Code: [Select]
To do:
        * auto-selecting joystick configs
        * per-joystick configs?
        * test half-axis selections
        * add input test menu
        * get rid of osd_customize_inputport_list
But you know, it wouldn't be terribly hard to implement the use of joystick ids.  The function for initalizing dx devices simply enumerates them in the order to which they are found, after that the variables are unchanged until mame exits.  All that would have to be done is re-arrange the enumeration function to work via joyid.  It would be helpful to get some other people to look at this, but I think it is quite possible to fix this issue with mame and submit it to the mame devs.

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:June 25, 2023, 02:23:57 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #28 on: March 30, 2011, 07:39:47 pm »
Hey Howard

Yeah, I noticed something in the source (I'd been able to hone in on the input.c file), but from what it looked like to me, +everything+ in mame keyed off the ordinal of the enumerated devices, and the device info was simply stored in an array, in the enumerated order, which seemed like it'd make reworking that quite challenging, but, I'm definitely no MameDev, and I didn't spend a whole lot of time investigating either. The bigger prob is that I don't think you'd be able to just change the way the sticks are stored in the array, because you'd need to continue to support BOTH methods of identifying devices for backwards compat (otherwise peoples config files would get nuked). Maybe that's not a big concern though....

Using the Joystick ID's would be fine for sticks, but there's still an issue with Mice (ie trackballs and spinners) that are USB devices but aren't joysticks and can still move around when devices are plugged and unplugged. I suspect a solution that just uses stick ID's wouldn't quite cover the bases.

But, I'm happy to make my code open source if that'd help anyone. I'm not sure it would (it's all .net), and to be honest, I doubt I'm going to have any time to much around in Mame internals any time soon, other than just really simple tweaks. Which sucks, cause I'd like to  :(

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:June 25, 2023, 02:23:57 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #29 on: March 30, 2011, 07:52:50 pm »
And Howard.

No worries about "a better way". I'm always open to a better way!

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:June 25, 2023, 02:23:57 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #30 on: March 30, 2011, 08:08:07 pm »
@Mcgyver.

I'm thinking this.

You specify a device ID (or the first PART of a device ID) in the config file.

When I search, i try to match the full ID, if that doesn't work, go back through and match with a "begins with" logic.

Assuming the device id's are unique from the beginning that should work.

Alternatively, I could support a wildcard match....

Hmmm, that might work better, actually....

I'll look into it.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:March 16, 2024, 05:59:16 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: New ControllerRemap utility, Now available (Serious Beta!)
« Reply #31 on: March 30, 2011, 11:56:58 pm »
Well they had started to implement it years ago if I remember correctly, but I think that was just around the time that ctrlr and cfg files switched from being ini based to xml based, so I'm guessing it got lost in the shuffle. 

I'm not sure if stright joystick ids would be the best solution anyway, as you said... multi mice and all that.  You wouldn't change the enumeration of the joystick, but rather store more info about it in the joylist array and use it as search flags when reading in the ctrlr file (which is only done once, so speed isn't an issue).  A specific entry would look something like this: 

Code: [Select]
<port type="P1_JOYSTICK_UP">
              <newseq type="standard" devname="MADCATZ Xbox 360 Controller" id="1">
              JOYCODE_1_YAXIS_DOWN_SWITCH</newseq>
 </port>

Note the two new flags... both of which would be optional and most likely have to be manually inserted. 

DevName would represent the device name, which mame already parses for verbose printout.  Id would represent the joystick id or device id respectively.  When mame parses a xml file, if it finds a devname or id entry, it ignores the number in the joycode flag and does a search through the array to find the device with the matching devname and/or id.  If devname and id are missing, it handles the binding normally.  Joystick id probably wouldn't be the best id to use anyway, the device address might be better.


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:March 16, 2024, 05:59:16 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: New ControllerRemap utility, 3/30/11 update available (Version 0.0.6)
« Reply #32 on: March 31, 2011, 12:17:08 am »
I did a little bit of reasearch about joystickIDs because I realized that aside from a preferred device, they aren't used in vista/win 7 anymore. 
Apparently joystick ids are created just how mame does it, by enumerating all joysticks.  The only difference is that the device name can be used to override this enumeration. 

HOWEVER, joystick ids stil can't tell two identical devices apart.  If you had 4 identical xbox 360 controllers and a flightstick, for example....

You could put the flightstick anywhere in the order you want, but when it comes to the 360 pads, the first one plugged in is the first, ect.....

The way you are doing it with the device address is the ONLY way to be certain of which device it is, and only then if you plug it into the same port.

I don't think this is an issue anyway, I just thought it might be interesting to note why mame didn't use joyids. 

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:June 25, 2023, 02:23:57 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: New ControllerRemap utility, 3/30/11 update available (Version 0.0.6)
« Reply #33 on: March 31, 2011, 12:15:26 pm »
Hi Howard

Thanks for the info. Yeah, I searched through all the stuff I could find about USB device ID's and when you have two identical devices, they really are identical. There's just not a lot to go on to uniquely id them.

still, i like the idea of the ability to specify a partial ID and have it match, in those cases where the partial ID still uniquely ID's a device.

But thanks for the extra info!

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:June 25, 2023, 02:23:57 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: New ControllerRemap utility, 3/30/11 update available (Version 0.0.6)
« Reply #34 on: March 31, 2011, 12:17:19 pm »
@Macgyver

Just in case you didn't see the root post, i've updated the EXE (and the sample.cfg file) with the new capability. the PDF is updated as well with some example info.

Let me know if it works any better for you. It was a quick mod while my daughter was in the tub, so it's entirely possible I've missed a bit, but, as usual, it works on my machine  ;)

MacGyver

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 317
  • Last login:December 18, 2023, 12:49:00 am
    • Project Build
Re: New ControllerRemap utility, 3/30/11 update available (Version 0.0.6)
« Reply #35 on: March 31, 2011, 12:43:00 pm »
I tried the new one, works absolutely perfectly. :) I bounced the guns and spinners all over with the shortened IDs, they work perfectly.  Everyone should use this program, at least until they fix the usb device issues with mame for windows. 
I cut back my utrak, aimtraks, and spinners to just the VEN and DEV, and they are picked up everywhere and mapped correctly in mame everytime, but people with usb gamepads probably will want to use the whole ID.

Thank you again.  :applaud:

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:June 25, 2023, 02:23:57 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: New ControllerRemap utility, 3/30/11 update available (Version 0.0.6)
« Reply #36 on: March 31, 2011, 01:42:54 pm »
Great. Glad to hear it's working!

Nephasth

  • Guest
  • Trade Count: (0)
Re: New ControllerRemap utility, 3/30/11 update available (Version 0.0.6)
« Reply #37 on: March 31, 2011, 06:31:18 pm »
Glad I finally read through this thread. I thought this utility was like Xpadder, "remap" threw me off. I've been thinking of a solution for this problem since I read about it a few months back. What I came up with was to keep all USB controllers plugged in all the time (simple hardware solution). And to keep everything neat and organized I wanted to use retractable cable reels, but damn those are expensive. It will still be many moons before I will actually need to worry about this problem, but I will definitely be using this. :applaud:

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:June 25, 2023, 02:23:57 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: New ControllerRemap utility, 3/30/11 update available (Version 0.0.6)
« Reply #38 on: March 31, 2011, 07:11:00 pm »
Wow. Those are cool, but 150$  :dizzy:

Ugh.

Well, one day, I might dust off my C knowledge and go hacking through mame to make the mods and try to get it accepted, but I'd hate to do the work and then find that it's not the sort of thing the mame devs want in the code. And I wouldn't want to have to leave it as a patch.

So... I think my little utility will work right nice for now   :)

If you can leave everything hooked, that's probably easiest, though!

ArcadeBliss

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 167
  • Last login:October 08, 2023, 11:47:26 pm
Re: New ControllerRemap utility, 3/30/11 update available (Version 0.0.6)
« Reply #39 on: April 01, 2011, 01:32:02 am »
Now this is just too cool. I have a multipanel setup including some with u360s and aimtraks plus joyless. This will now fix my woes! Thanks sooooooooooooo much for this.

Now only to get ledblinky to remap my u360s even if it did not detect them during the start of ledblinky   ;) :w00t