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: Controls.xml vs Asteroids vs CPWizard  (Read 2336 times)

0 Members and 1 Guest are viewing this topic.

Indyplumber

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 50
  • Last login:November 19, 2012, 09:46:03 pm
Controls.xml vs Asteroids vs CPWizard
« on: July 12, 2011, 02:43:46 pm »
Being happy to have CP Wizard figured out and working great I decided to setup custom configs for my Mame games.

I was using Romlister to create list of different control configs then using cfg magician to create them.

I noticed that asteroids did not appear in my list of button only games.  Weird? 

I checked Controls.xml to find that asteroids was listed as a Joy2way game.  This isn't correct and it messed up my CP Wizard display.

I configured Asteroids and Asteroids Deluxe to use a 5 button setup per my control panel.
This works fine but the way that Controls.xml is setup, CP Wizard displays my controls incorrectly.
I edited Controls.xml with the following for those two games and it seemed to fix it with one exception.  CPWiz shows the correct controls, but duplicates them with various buttons on the 2 player side of my CP.
I changed the Numplayers to 1 in Controls xml and that cleaned it up, but it causes CPWiz to blank out P2 Coin and P2 Start.    ???


Code: [Select]
<game romname="asteroid" gamename="Asteroids (rev 4)" numPlayers="1" alternating="1" mirrored="1" usesService="0" tilt="1" cocktail="0">
<miscDetails>
</miscDetails>
<player number="1" numButtons="5">
<controls>
<control name="Just Buttons">
<constant name="button"/>
</control>
</controls>
<labels>
<label name="P1_BUTTON3" value="FIRE"/>
<label name="P1_BUTTON4" value="THRUST"/>
<label name="P1_BUTTON5" value="HYPER SPACE"/>
<label name="P1_BUTTON1" value="Rotate Left"/>
<label name="P1_BUTTON2" value="Rotate Right"/>
</labels>
</player>
</game>
<game romname="astdelux" gamename="Asteroids Deluxe (rev 3)" numPlayers="1" alternating="1" mirrored="1" usesService="0" tilt="1" cocktail="0">
<miscDetails>
</miscDetails>
<player number="1" numButtons="5">
<controls>
<control name="Just Buttons">
<constant name="button"/>
</control>
</controls>
<labels>
<label name="P1_BUTTON3" value="FIRE"/>
<label name="P1_BUTTON4" value="THRUST"/>
<label name="P1_BUTTON5" value="HYPER SPACE"/>
<label name="P1_BUTTON1" value="Rotate Left"/>
<label name="P1_BUTTON2" value="Rotate Right"/>
</labels>
</player>
</game>

Indyplumber

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 50
  • Last login:November 19, 2012, 09:46:03 pm
Re: Controls.xml vs Asteroids vs CPWizard
« Reply #1 on: July 12, 2011, 03:24:02 pm »
Update:

I found a work around for this.

Step #1 is the changing of the Controls.xml stated above.

Step #2 is to make you asteroids and asteroids deluxe cfg files similar to this:

Code: [Select]
<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
    <system name="asteroid">
        <input>
            <port tag="IN0" type="P1_BUTTON5" mask="8" defvalue="0">
                <newseq type="standard">
                    KEYCODE_C
                </newseq>
            </port>
            <port tag="IN0" type="P1_BUTTON3" mask="16" defvalue="0">
                <newseq type="standard">
                    MOUSECODE_1_BUTTON2
                </newseq>
            </port>
            <port tag="IN1" type="P1_BUTTON4" mask="32" defvalue="0">
                <newseq type="standard">
                    KEYCODE_N
                </newseq>
            </port>
            <port tag="IN1" type="P1_BUTTON2" mask="64" defvalue="0">
                <newseq type="standard">
                    MOUSECODE_1_BUTTON1
                </newseq>
            </port>
            <port tag="IN1" type="P1_BUTTON1" mask="128" defvalue="0">
                <newseq type="standard">
                    KEYCODE_O
                </newseq>
            </port>
    <port tag="IN0" type="P2_BUTTON5" mask="8" defvalue="0">
                <newseq type="standard">
                    KEYCODE_C
                </newseq>
            </port>
            <port tag="IN0" type="P2_BUTTON3" mask="16" defvalue="0">
                <newseq type="standard">
                    MOUSECODE_1_BUTTON2
                </newseq>
            </port>
            <port tag="IN1" type="P2_BUTTON4" mask="32" defvalue="0">
                <newseq type="standard">
                    KEYCODE_N
                </newseq>
            </port>
            <port tag="IN1" type="P2_BUTTON2" mask="64" defvalue="0">
                <newseq type="standard">
                    MOUSECODE_1_BUTTON1
                </newseq>
            </port>
            <port tag="IN1" type="P2_BUTTON1" mask="128" defvalue="0">
                <newseq type="standard">
                    KEYCODE_O
                </newseq>
            </port>
        </input>
    </system>
</mameconfig>

Mame will create them when you put your custom controls in, however they will only show P1_BUTTON1, ETC.  You need to duplicate them and then change the second set of P1_BUTTON1 TO P2_BUTTON1 ETC.

You will then save the cfg files and then change them to read only status.  Otherwise Mame will change them back.  Now CP Wizard correctly shows a 5 button layout for Asteroids and labeled correctly.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19428
  • Last login:Yesterday at 01:14:11 am
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Controls.xml vs Asteroids vs CPWizard
« Reply #2 on: July 12, 2011, 03:54:43 pm »
[rant]
UGH!!!!

I don't mean to get angry, but this is exactly why, controls.dat never gets updated.  You don't make your own personal tweak, you submit the changes!!!

Step #1.  Go to controls.arcadecontrols.com

Step #2.  If you don't have a login, make one. 

Step #3.  Click on Contribute, then Update a Game.

Step #4, Modify the existing submission and submit it. 

Step #5, The next time the dat is updated the new entry will be there!
[/rant]

Ok griping aside..... 

The asteroids entry was one of the very first we ever did.  Back in the day mame had it hacked to use a 2-way joystick.  Now it doesn't.  So no it isn't incorrect, it's just incorrect NOW.  ;)

I will fix this one myself later, but for future reference controls.dat is a user dependant project.  The reason it hasn't had any significant updates in ages is because nobody's bothered to do any user-submissons. 

Also your gripes regarding cp wizard are a bug and you need to let HK know about it.  Notice the "alternating=1" flag in game section of the entry?  That is there to tell viewers that although it's a two player game, there is only one set of controls.  Headkaze artifically injects start and coin info (the dat doesn't bother with those buttons) so the correct amount of them showing has to do with something on his end as well.  It should be easily fixed.   

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Controls.xml vs Asteroids vs CPWizard
« Reply #3 on: July 12, 2011, 04:11:33 pm »
Also your gripes regarding cp wizard are a bug and you need to let HK know about it.  Notice the "alternating=1" flag in game section of the entry?  That is there to tell viewers that although it's a two player game, there is only one set of controls.  Headkaze artifically injects start and coin info (the dat doesn't bother with those buttons) so the correct amount of them showing has to do with something on his end as well.  It should be easily fixed.     

Not a bug actually, this was by design. Originally I was taking alternating into account but someone told me that even when the game is alternating you can use the second joystick, so I left them hilighted. Is this incorrect? If so it's only one line of code to change it back.

The start and coin info is artificially added, as you say, and is based on Numplayers. If it is 1 it will only highlight the start and coin buttons for player 1, if it is 2 it will highlight them for player 1 and 2, and so on.

Indyplumber

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 50
  • Last login:November 19, 2012, 09:46:03 pm
Re: Controls.xml vs Asteroids vs CPWizard
« Reply #4 on: July 12, 2011, 04:36:18 pm »

I don't mean to get angry, but this is exactly why, controls.dat never gets updated.  You don't make your own personal tweak, you submit the changes!!!

  

Sorry to get you in a wad.  I'm still learning this stuff!  And I'm not saying it's a bug with CPWizard.  It clearly isn't.  It is misinformation in the Control.xml file.

Just supply me the link like you did and tell me that's the route to go. :)  But take a chill pill dude.  We all had to learn how to do this sometime.   :cheers:

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19428
  • Last login:Yesterday at 01:14:11 am
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Controls.xml vs Asteroids vs CPWizard
« Reply #5 on: July 12, 2011, 08:36:27 pm »

Not a bug actually, this was by design. Originally I was taking alternating into account but someone told me that even when the game is alternating you can use the second joystick, so I left them hilighted. Is this incorrect? If so it's only one line of code to change it back.


Well this is right AND wrong.  Some games allow that, but they aren't supposed to.  ;)  It's that way because of the cocktail option in mame.  Even though player 2's inputs are usually shared, even on a real cocktail, mame adds a second joystick.  Sometimes due to bugs you can use the second joystick, but you aren't supposed to be able to unless the cocktail dipswitch is turned on.  It only happens on games with a real cocktail dipswitch and like I said, it's not supposed to happen then unless the dip is set.  ;)   

I think this was changed because of the ability to "fake" cocktail mode on any game now, but I'm not sure.   

**UPDATE** I just confirmed that this is still not the case, even in the latest version of mame.  Alternating play turns off player 2's controls unless the cocktail dip is on. 

Anyway, because we want to show only the minimum required controls, I read the alternating flag and disable second player's labels accordingly.  I think j5 has a cocktail option that ignores the flag, which makes the most sense because either you are going to have a cocktail cabinet or not and how you want things displayed is going to depend on that. 

Regardless, I don't know all of cpwizard's functions, but I doubt you are able to rotate the text on only half of the layout so a cocktail mode isn't going to be particularly useful anyway.