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: CPWizard's interactions with MAME ctrlr file  (Read 7247 times)

0 Members and 1 Guest are viewing this topic.

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
CPWizard's interactions with MAME ctrlr file
« on: September 26, 2011, 11:46:10 pm »
HeadKaze:

I've tried all sorts of things for hours and reached peak levels of frustrations.
Would you mind testing out these layout and ctrl files?

Many games just don't display controls correctly.  I've whittled down the ctrlr file to just two games of the many that don't work right (umk3 and asteroid).  Of course, I've tested the whittled down file as well and get exactly the same problem as with my full ctrlr file.

The two examples games included:
umk3: does not show controls for P2
asteroid: mapping is messed up (this is the most typical problem I see)

I was ready to jump on CPWizard but this is really holding me back.  I'll appreciate it if you could take a quick look.

I had to change the extensions to be able to upload.

Best regards.
« Last Edit: September 28, 2011, 08:47:20 am by TheManuel »
"The Manuel"

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard not playing nice with ctrlr file
« Reply #1 on: September 26, 2011, 11:47:36 pm »
By the way, some games do display correctly, like SF2 and MAME reads ctrlr file perfectly.
"The Manuel"

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard not playing nice with ctrlr file
« Reply #2 on: September 27, 2011, 01:23:59 am »
If you have a look you will see the default layout displays the controls okay.

In MyLayout it's using your ctrlr file which has custom entries for umk3 and asteroid.

Now in MyLayout2 I have removed the custom entries and it displays the controls okay.

So my advice is to remove your custom entries from the ctrlr file.

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard not playing nice with ctrlr file
« Reply #3 on: September 27, 2011, 08:31:57 am »
But Headkaze, isn't the point of having a ctrlr file to be able to remap the controls to your hearts content?  If CPW cannot read the ctrlr files correctly, this deals a major blow to my quest of CPWizardry.  This program is one of the best ideas in the emulation scene but if I can't use my custom mappings, I guess the control panel viewer functionality of CPW is not for me (not your problem, of course)  :'(.

What is it about ctrlr files that makes it hard to implement in CPW?  I'm pretty sure I also tried disabling the ctrlr file and adding the changes to a game specific cfg file and the result was the same so the issue might not be limited to ctrlr files.

Now, I did mess around a little more after I posted and found that, in the case of asteroid, it is the controls.xml file that throws CPW off.  If I get rid of it, my controls display correctly (minus the button names, of course) so this is definitely related to how CPWizard reads controls.xml.  The problem there is that the asteroid entry in controls.xml, names inputs for joystick left and right for rotating the ship (MAME's control behavior) and I have remapped those functions to two buttons in my panel, to match the original machine.  However, CPW does not recognize this remapping and and assigns rotate left and right to the joystick, as called out in the controls.ini file, rather than using my own mapping.

However, the umk3 issue is entirely different.  There is not an entry for it in the controls.xml file but I can't find any way to make it display P2 controls.

I realize you probably have your own setup working to your liking so there is likely very little incentive to keep finding weird bugs that don't seem to affect everybody but, if you feel some interest in getting this working correctly, please let me know how I can help with the debugging.  I'm more than willing to do however many tests you need, bug the MAME people (the few that are left), etc.

Thank your very much for taking the time to try my files.

"The Manuel"

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard not playing nice with ctrlr file
« Reply #4 on: September 27, 2011, 09:58:14 am »
CPW does work with ctrlr files but it just blindly maps keycodes so sometimes you have do things like map keys to KEYCODE_NONE so it doesn't use them. It's been so long since I looked into it but AFAIK an entry in a ctrlr file for a specific game overrides the default entry. So CPW uses MAME's internal defaults (stored in CPWizard\Data\InputCodes\MameDefault.txt), default.cfg then ROM specific cfg's then the default entry in a ctrlr and then game specific entries in the ctrlr. So yes it should take all your key settings into account it's just much more fussy about it than MAME is.

From what I could see CPW was mapping the keycodes correctly as per your ctrlr file using the "asteroid" entry.

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard not playing nice with ctrlr file
« Reply #5 on: September 27, 2011, 11:31:25 am »
From what I could see CPW was mapping the keycodes correctly as per your ctrlr file using the "asteroid" entry.

Well, not really.  I mapped rotate left and right to:
rotate left:  KEYCODE_LEFT OR KEYCODE_T
rotate right: KEYCODE RIGHT OR KEYCODE_Y
The displayed control panel does not show this mapping.

Something can't be right if MAME reads everything fine and CPW doesn't.
Oh well. 
I'll play around a bit more in an effort to make it work and will have to resort to overrides for each game if it doesn't.

Thanks for looking into it, anyway.

By the way, when defining inputs globally for a driver, say midwunit.c, MAME requires the ".c" be added but CPW doesn't like it.  This does not apply to neogeo because it is both a driver and a parent clone to all NeoGeo games, so it will work either way.

"The Manuel"

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard not playing nice with ctrlr file
« Reply #6 on: September 27, 2011, 12:07:33 pm »
In your ctrlr file you have those keys mapped as follows

Code: [Select]
<port type="P1_BUTTON1">
<newseq type="standard">KEYCODE_LEFT OR KEYCODE_T</newseq>
</port>
<port type="P1_BUTTON2">
<newseq type="standard">KEYCODE_RIGHT OR KEYCODE_Y</newseq>
</port>

In controls.xml they are labelled as

Code: [Select]
<label name="P1_BUTTON1" value="FIRE"/>
<label name="P1_BUTTON2" value="THRUST"/>
<label name="P1_BUTTON3" value="HYPER SPACE"/>
<label name="P1_JOYSTICK_LEFT" value="Rotate Left"/>
<label name="P1_JOYSTICK_RIGHT" value="Rotate Right"/>

So for your layout KEYCODE_LEFT / KEYCODE_T is labelled "FIRE" and KEYCODE_RIGHT / KEYCODE_Y is labelled "THRUST". That seems right to me.

If you wanted "Rotate Left" and "Rotate Right" labels mapped you would have the following in your ctrlr file.

Code: [Select]
<port type="P1_JOYSTICK_LEFT">
<newseq type="standard">KEYCODE_LEFT OR KEYCODE_T</newseq>
</port>
<port type="P1_JOYSTICK_RIGHT">
<newseq type="standard">KEYCODE_RIGHT OR KEYCODE_Y</newseq>
</port>

As I said CPW just blindly maps keycodes to labels.

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard not playing nice with ctrlr file
« Reply #7 on: September 27, 2011, 12:15:12 pm »
Ok.  Thanks for your patience.  I'll re-check tonight to verify that MAME would behave the way I need it to with that change.  Like I said, CPW shows the controls fine without controls.xml but I definitely want to use that file.

As for umk3, any clues as to why P2 controls don't show up?
"The Manuel"

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard not playing nice with ctrlr file
« Reply #8 on: September 27, 2011, 12:34:34 pm »
The buttons are showing correctly when I use your ctrlr file and layout.

Code: [Select]
<system name="umk3">
<input>
<!-- Mortal Kombat 3 and Ultimate but applies to I and II as well -->
<port type="P1_BUTTON1">
<newseq type="standard">KEYCODE_Z</newseq>
</port>
<port type="P1_BUTTON2">
<newseq type="standard">KEYCODE_Y</newseq>
</port>
<port type="P1_BUTTON3">
<newseq type="standard">KEYCODE_C</newseq>
</port>
<port type="P1_BUTTON4">
<newseq type="standard">KEYCODE_T</newseq>
</port>
<port type="P1_BUTTON5">
<newseq type="standard">KEYCODE_U</newseq>
</port>
<port type="P1_BUTTON6">
<newseq type="standard">KEYCODE_X</newseq>
</port>
<port type="P2_BUTTON1">
<newseq type="standard">KEYCODE_A</newseq>
</port>
<port type="P2_BUTTON2">
<newseq type="standard">KEYCODE_I</newseq>
</port>
<port type="P2_BUTTON3">
<newseq type="standard">KEYCODE_Q</newseq>
</port>
<port type="P2_BUTTON4">
<newseq type="standard">KEYCODE_W</newseq>
</port>
<port type="P2_BUTTON5">
<newseq type="standard">KEYCODE_K</newseq>
</port>
<port type="P2_BUTTON6">
<newseq type="standard">KEYCODE_S</newseq>
</port>
</input>
</system>

I don't see any mappings in your umk3 entry for the joysticks controls though so that is why they're greyed out. There is no Controls.xml entry for this game either so CPW just makes the labels 1, 2, 3 etc for each respective button.

So everything looks right here to me.

BTW If you make a change to your ctrlr file you must shutdown CPW and restart it for it to take effect. Also to preview games without having to launch MAME check out the View->Preview option in CPW.

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard not playing nice with ctrlr file
« Reply #9 on: September 27, 2011, 12:44:29 pm »
Hmm.   When display the CP on my machine, I don't get anything on the P2 side, not even buttons, but you do.  That's perplexing.

Also, I'm starting to see some of the differences in how CPWizard interprets controls vs. MAME.  In MAME, I don't have to specify joysticks for a game that has a custom entry in ctrlr, because MAME will simply use the defaults.  However, it appears that for CPW to display custom entries in the ctrlr file, I have to specify every single control since it will not fill the rest with defaults.

Quote
BTW If you make a change to your ctrlr file you must shutdown CPW and restart it for it to take effect. Also to preview games without having to launch MAME check out the View->Preview option in CPW.
Yep, I ran into that last night so I've been restarting like crazy. 
Does dynamic data loading get around this?
"The Manuel"

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard not playing nice with ctrlr file
« Reply #10 on: September 27, 2011, 12:53:19 pm »
AFAIK in CPW ctrlr files override everything so yeah you have to put in every control for the game for it to label correctly.

I would check for a default.cfg and umk3.cfg file in MAME's cfg folder. They might be causing CPW some problems. Deleting them should be okay.

Yes CPW doesn't map controls exactly like MAME but it will work if you put in all the keycodes you want mapped to labels into your config files.

Dynamic data loading might work.. I really can't remember TBH.

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard not playing nice with ctrlr file
« Reply #11 on: September 27, 2011, 01:24:05 pm »
Quote
I would check for a default.cfg and umk3.cfg file in MAME's cfg folder. They might be causing CPW some problems. Deleting them should be okay.
I did that last night and deleted everything just in case so I can discard that.  It's a good observation, though.
I'll have to keep hacking at it.

Quote
Dynamic data loading might work.. I really can't remember TBH.
If it does, it will help with testing/debugging, so I'll check.
"The Manuel"

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard not playing nice with ctrlr file
« Reply #12 on: September 27, 2011, 02:20:22 pm »
I think you may have something in your setup that I don't.
I just downloaded CPW 2.37 and installed it on my work computer.  I also downloaded MAME 0.142 and applied the ctrlr and layout files I posted in this thread.  When I run a preview on umk3, I still don't get the P2 buttons like you did in the picture you attached  :banghead:.
I wonder if I'm missing some file you might have and not realize it.
"The Manuel"

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard not playing nice with ctrlr file
« Reply #13 on: September 27, 2011, 02:56:31 pm »
Okay you're right the latest version is not showing the player 2 controls. I'll fix it in a sec.

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard not playing nice with ctrlr file
« Reply #14 on: September 27, 2011, 04:07:00 pm »
You can't see me right now, but I'm doing the worm on the floor, followed by the sprinkler, while my co-workers gawk in astonishment.  ;D

But seriously, thank you for not assuming I was just clueless, or the issue would have remained unadressed.  :cheers:

While you are repairing stuff, could you look at allowing mapping at the driver level?
Like I explained earlier, if I define controls for multiple games within the same driver like midwunit, for MAME to recognize the entry, I have to name the entry midwunit.c or it will be ignored.  However, CPW will not recognize my mapping unless I remove the ".c", which puts me in a catch-22 situation.

To test it out, in the ctrlr file I attached, replace:
   <system name="umk3">
With:
   <system name="midwunit">
And then with:
   <system name="midwunit.c">

Look at the control planel view in both cases and you'll that, without ".c", the controls show up with the correct mapping but MAME doesn't like it.  With ".c" my mapping does not show up (numered 1 through 6 in order left to right, top to bottom) but MAME likes it.

I tested it here at work and I've attached images of both examples (I'm going to get fired).
« Last Edit: September 27, 2011, 04:24:35 pm by TheManuel »
"The Manuel"

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard not playing nice with ctrlr file
« Reply #15 on: September 27, 2011, 04:16:28 pm »
I always try to give people the benefit of the doubt since I don't get a whole lot of time to test CPWizard these days so I pretty much rely on feedback for finding bugs.

Funny you mentioned the source file thing as I did address that in the update. So please give it a try and get back to me. Player 2 controls should also display correctly now.

Download it from here.

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard not playing nice with ctrlr file
« Reply #16 on: September 27, 2011, 04:23:53 pm »
You are awesome.  I'll sure give it a try as soon as possible.
"The Manuel"

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard not playing nice with ctrlr file
« Reply #17 on: September 27, 2011, 04:26:02 pm »
By the way, even though you've already fixed the driver issues, I edited my post above to add the attachments, since I forgot the first time around.
"The Manuel"

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard not playing nice with ctrlr file
« Reply #18 on: September 27, 2011, 04:35:08 pm »
Okay I tried changing "umk3" to "midwunit.c" in the latest version and it shows up the same as your "correct mapping" image. So it looks like it's working as expected now.

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard not playing nice with ctrlr file
« Reply #19 on: September 27, 2011, 04:45:23 pm »
Soooeeet!
"The Manuel"

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard not playing nice with ctrlr file
« Reply #20 on: September 27, 2011, 05:08:59 pm »
Are you sure you updated the download link?
The file I download has the exact same size as 2.37, shows "2.37" as the version and behaves the same as 2.37.
"The Manuel"

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard not playing nice with ctrlr file
« Reply #21 on: September 27, 2011, 05:17:22 pm »
The latest version is 2.38 so that's not it.

Perhaps you're downloading a cached version? Try this link.

I'll download it myself to make sure.

EDIT: I downloaded 2.38 okay so it's definately the version on my website.
« Last Edit: September 27, 2011, 05:24:54 pm by headkaze »

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard not playing nice with ctrlr file
« Reply #22 on: September 27, 2011, 05:30:14 pm »
Your new link works.  The old ones stills downloads 2.37 for me.   May be a local issue here.

Anyway, I tried 2.38 and it works fantastic!

I have some homework for me:
- update my copy of controls.xml to add umk3 (copy from mk3)
- double check if asteroid indeed works in my cab as intended (perhaps MAME defaults changed)
- enter all inputs on my custom ctrlr entries to make sure they show up in CPW

I'll keep reporting issues, as long as you're OK with it.
I realize I've bugged you quite a bit today.

 :cheers:
"The Manuel"

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard not playing nice with ctrlr file
« Reply #23 on: September 27, 2011, 05:37:44 pm »
LOL No problems  :cheers:

PS The "new link" I gave you was the same as the old link but with a "?2" added on the end. That was to ensure you wern't getting a cached copy.

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard not playing nice with ctrlr file
« Reply #24 on: September 28, 2011, 01:06:30 am »
UPDATE:
Good News: I installed the latest at home, and when I launched a preview of umk3, not only are the buttons correct, but also the joysticks show up so I wont' really have to explicitly define joysticks that are the same as the default.  I'm not sure what changed but it works great.

As far as asteroid is concern, this is one weird puppy.  It has hard-coded defaults that override the ctrlr files so I wasn't even getting to work in MAME.  I then remembered I ran into this 4 years ago in this post.
This has nothing to do with CPW, but below is the most important part, for your entertainment:

Code: [Select]
FYI:

This (hardcoded inputs overriding ctrlr files) has how ctrlr files have worked since it was added, from the first ctrlr.ini files up to the current .cfg version.

There is a way to get the ctrlr files to "override" the hardcoded mappings. Game specific remap the input(s) to "default": tab, "Input (this game)", goto hardcoded input (highlighted input), enter, esc, enter, esc. (Repeat for each input.) And yes, that's enter, esc twice. If you look in the cfg file, the input will show "DEFAULT". For example, Ikari rotational part of the joystick, remapped to default, (with "less than" and "greater than" shown as '{' & '}':

Code:

{port type="P1_POSITIONAL" mask="240" index="14" defvalue="0"}
{newseq type="decrement"}
DEFAULT
{/newseq}
{newseq type="increment"}
DEFAULT
{/newseq}
{/port}


Of course, the problem of needing to remap all those games with hardcoded inputs still is there. The difference is every input is mapped to the same thing ("default"), and afterwards the ctrlr files are working for those inputs, too.


Basically, mame keeps three lists of input mappings: defaults, "general", and "this game". The game level overrides general, and general overrides default. Ctrlr files change the general list, before the cfg/default.cfg file changes the same list. The hardcoded inputs changes the game list, before the cfg/gamename.cfg file changes the same list. The key is how the overrides work. The "this game" list usually has every input used in the game mapped to a special input called "default"; in this case, mame looks at the mapping in the general list. If it's not "default", mame uses that instead of looking in the general list.

edit: replaced "less than" and "greater than" symbols.

Edited by uRebelScum (12/18/07 12:41 PM)
Apparently the Ent/Esc trick does not work anymore.  I had to map the desired controls in the cfg files.  Curiously, since those inputs matched what I already had in my ctrlr file, the resulting cfg file showed "default" for all the inputs.

Makes my head spin.

Oh, and I modified the controls.xml file for the controls to match my mapping in the ctrlr file so life is good.
"The Manuel"

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard not playing nice with ctrlr file
« Reply #25 on: September 28, 2011, 02:13:51 am »
That looks wrong to me... the curly braces and you don't have the mask/index/defvalue entries for a ctrlr file.

Try this

Code: [Select]
<port type="P1_POSITIONAL">
<newseq type="decrement">
DEFAULT
</newseq>
<newseq type="increment">
DEFAULT
</newseq>
</port>

PS You think this makes your head spin? Imagine what I had to go through to process the inputs in CPWizard!  :banghead:

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard's interactions with MAME ctrlr file
« Reply #26 on: September 28, 2011, 09:35:15 am »
The changes suggested in that post were for the individual game's cfg file, not the general ctrlr file, but you are right, the curly braces are not correct regardless.  

I just verified that the reason why remapping the cfg by hand to "DEFAULT" did not take for me the first time, was because I left out the "mask" values.  These seem to be key to identifying the inputs.  I got MAME to generate the entries for me by going to the Input / This Game menu and assigning the same inputs I already had in my ctrlr file.  For every input you enter that is already in the ctrlr file, MAME will set that input in the cfg file to "DEFAULT", instead of the key value.

It is a very wierd behavior and the bottom line is that, for games with hard-coded defaults, MAME users have two options:
1. Simply don't enter anything for that game in ctrlr file and enter the inputs directly through the Input / This Game menu, thus creating a cfg file for that game with your custom mappings
2. Put your desired mapping in the ctrlr file and then enter those mappings again in the Input / This Game menu, thus creating a cfg file for that game that shows "DEFAULT" in the mappings

The only reason I see to use #2 is to make sure you preserve your remember you desired mappings if the cfg file is accidentally deleted but it's more work for the same effect.

Again, CPW will handle both just fine (as long as controls.xml cooperates), so this is just for entertainment value.

« Last Edit: September 28, 2011, 09:47:29 am by TheManuel »
"The Manuel"

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard's interactions with MAME ctrlr file
« Reply #27 on: September 28, 2011, 10:09:31 am »
Well, here is an interesting one, CPW related for you:

I just verified that the reason umk3 joysticks showed up for me last night, is because I added an entry for that game to the controls.xml file. 

What's more interesting is:
1. that controls.xml entry did not contain any P2 mappings but CPW correctly showed both sticks
2. if I don't make an entry in the controls.xml file, but map the P1 and P2 joysticks in my ctrlr file, the sticks will still not show up in the CPW panel viewer, which is unexpected based on your comments yesterday

So, for some games, unless there is an entry in the controls.xml files, some of your inputs might not show up, even if defined in the ctrlr file.

Would this be a bug?
"The Manuel"

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard's interactions with MAME ctrlr file
« Reply #28 on: September 28, 2011, 10:23:52 am »
Post your ctrlr file and I'll take a look.

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard's interactions with MAME ctrlr file
« Reply #29 on: September 28, 2011, 10:46:04 am »
Here you go...
"The Manuel"

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard's interactions with MAME ctrlr file
« Reply #30 on: September 28, 2011, 11:39:50 am »
There is no entry for umk3 anymore. What game is not working for you?

EDIT: Nevermind I see you're using "midwunit.c" now.
« Last Edit: September 28, 2011, 11:47:49 am by headkaze »

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard's interactions with MAME ctrlr file
« Reply #31 on: September 28, 2011, 11:41:26 am »
Sorry, it's under the midwunit.c entry, since that is the driver for that game.
You can rename it to umk3 if you need to, but it works as is since v2.38.
"The Manuel"

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard's interactions with MAME ctrlr file
« Reply #32 on: September 28, 2011, 12:02:06 pm »
Okay this isn't a bug but you do have to do a bit of extra work on your layout for it to work with games that arn't in Controls.xml. Also you don't have to specify all the P1_JOYSTICK_ etc codes for it either.

1. Click Object->Add Label... to create a new label
2. Drag the label over your player 1 joystick
3. Right click on the label and select "Properties..."
4. For the "Code Type" select "Player Code" and for "Code Value" select PLAYER_1_JOYSTICK
5. Right click on your player 1 joystick graphic and select "Properties...".
6. Under "Label Link" select PLAYER_1_JOYSTICK

Do the same for the player 2 joystick and it should not fade the joysticks out.
« Last Edit: September 28, 2011, 12:23:03 pm by headkaze »

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard's interactions with MAME ctrlr file
« Reply #33 on: September 28, 2011, 02:07:52 pm »
I see and I will definitely update my layout in this way.
Thanks for the help.

So, if I understood correctly, if CPW does not find an entry in the controls.xml, it will, by design, generate sequential numbers for the button lables, based on MAME's definition of BUTTON_1, BUTTON_2, etc. but will only enable the PLAYER_x_JOYSTICK label and not generate directional labels (up, down, left, right)?

Works for me, now that I know how to do it.
"The Manuel"

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard's interactions with MAME ctrlr file
« Reply #34 on: September 30, 2011, 09:02:14 pm »
Hi Headkaze.

Here is another question for you on the same topic, for whenever you have the time.

I started going through the controls.xml file last night to add any missing games that I have in my main list and I ran into an issue after creating an entry for samsho2, a NeoGeo game.  The controls.xml file has one single entry for all neogeo games, showing the classic A B C D labels of the original controls.  Since neogeo acts like a parent set for all neogeo games, this entry takes care of all of them.  Similarly, the ctrlr file allows you to map all games using the "neogeo" parent set name. 

This is convenient and all is well and good, except when you try to add xml control info for individual games.  In the ctrlr file, you can override the controls of individual neogeo roms with specific entries.  In the controls.xml file, you can do this too.  However, if I make an override enty for a neogeo game in the controls.xml file but don't do one in the ctrlr file, CPW displays the correct labels, but reverts to the default global mapping specified in the ctrlr file (the one that applies to all games that MAME supports).  It is as though CPW looks at control.xml, finds the game-specific enty, then looks at the ctrlr file and does not find one there and instead of falling back to the neogeo mapping, it goes all the way back to global defaults.

If you tell me this is just the way it works, then I'll make a copy of the neogeo entry in the ctrlr file for each neogeo game that I want to add to the controls.xml file, but I wanted to check with you first, in case this is a bug or unexpected behavior that might be changed in a future release.

Best Regards.
"The Manuel"

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard's interactions with MAME ctrlr file
« Reply #35 on: October 05, 2011, 11:57:55 am »
Thanks for your recent donation Manuel it's much appreciated  :cheers:

I've been really busy with work lately so I'm sorry I haven't had the time to really properly think about your questions and give a decent reply.

Anyway I was going to have a look at automatically adding Left/Right/Up/Down joystick labels for games not in Controls.xml. I think it would be a nice feature to add.

Right now it's all about finding a bit of spare time to look into things. I'll have to look into the issue with NeoGeo. If you can provide the data I need to reproduce the problem and make it clear what results you are currently getting and what you should be getting it does make it easier for me fix.

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 09, 2025, 10:13:43 pm
  • On and off hobbyist
Re: CPWizard's interactions with MAME ctrlr file
« Reply #36 on: October 05, 2011, 12:57:47 pm »
Hi, headkaze.  I'm glad to see you back.

By all means take care of the important things first and this can all wait as long as necessary.  I just keep throwing things out at you so that I/we don't forget, but not expecting any quick replies.  The donation is not meant to accelerate that process either, but rather a token of appreciation for sharing this great tool with the rest of us. 

For the neogeo issue, I've attached the following:

MyOwn.cfg:
- ctrlr file with a neogeo entry, but no samsho2 specific entry

controls.xml:
- contains a samsho2 specific entry, you'll notice that CPW shows the correct samsho 2 labels but with a button layout that matches the global default entry, rather than the neogeo entry, which should be recognized as applying to samsho2, like MAME does

controlsNosamsho2.xml
- does not contain a samsho2 specific entry, you'll notice that CPW shows the correct generic neogeo labeling and button layout as specified in the ctrlr file

Let me know if you need anything else.

Best regards.
"The Manuel"