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: need help mapping joysticks label  (Read 3347 times)

0 Members and 1 Guest are viewing this topic.

shiloh

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 45
  • Last login:May 10, 2016, 02:58:07 pm
CPWizard: need help mapping joysticks label
« on: December 28, 2008, 12:52:57 pm »
Hi all,

My panel has two U360 for player 1 and 2. I cant get CPWizard to show up anything for the joysticks labels.

In my layout I have used the joyticks codes for the joystick direction labels ("JOYCODE_1_UP" etc...).

My mame version is .128. I dont use a ctrlr file. This is a portion of my player 1 mapping in my "default.cfg" in the mame "cfg" folder:

            <port type="P1_JOYSTICK_UP">
                <newseq type="standard">
                    JOYCODE_1_YAXIS_UP_SWITCH
                </newseq>
            </port>
            <port type="P1_JOYSTICK_DOWN">
                <newseq type="standard">
                    JOYCODE_1_YAXIS_DOWN_SWITCH
                </newseq>
            </port>
            <port type="P1_JOYSTICK_LEFT">
                <newseq type="standard">
                    JOYCODE_1_XAXIS_LEFT_SWITCH
                </newseq>
            </port>
            <port type="P1_JOYSTICK_RIGHT">
                <newseq type="standard">
                    JOYCODE_1_XAXIS_RIGHT_SWITCH
                </newseq>
            </port>


I read in another post here that these input codes must be mapped in the CPWizard "std.ini" file if they dont already match. They werent matching so I went ahead and changed the mapping in the "data\std.ini" files as follow (added a third joycode at the end of the two already present):

P1_JOYSTICK_UP                "KEYCODE_UP|JOYCODE_1_Y_UP_SWITCH|JOYCODE_1_YAXIS_UP_SWITCH"
P1_JOYSTICK_DOWN              "KEYCODE_DOWN|JOYCODE_1_Y_DOWN_SWITCH|JOYCODE_1_YAXIS_DOWN_SWITCH"
P1_JOYSTICK_LEFT              "KEYCODE_LEFT|JOYCODE_1_X_LEFT_SWITCH|JOYCODE_1_XAXIS_LEFT_SWITCH"
P1_JOYSTICK_RIGHT             "KEYCODE_RIGHT|JOYCODE_1_X_RIGHT_SWITCH|JOYCODE_1_XAXIS_RIGHT_SWITCH"

I still cannot get the joysticks label to show anything and I am out of idea of things to check for. I couldnt find other post on this other than the one I mentionned which said to verify the code mapping in the std.ini.

what else I need to verify/check?

thanks all

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard: need help mapping joysticks label
« Reply #1 on: December 29, 2008, 12:56:38 am »
Can you post your layout xml file and your default.cfg? I'll see if I can figure out whats going wrong.

Ginsu Victim

  • Yeah, owning a MAME cab only leads to owning real ones. MAME just isn't good enough. It's a gateway drug.
  • Trade Count: (+10)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10092
  • Last login:June 28, 2025, 10:45:55 pm
  • Comanche, OK -- USA
Re: CPWizard: need help mapping joysticks label
« Reply #2 on: December 29, 2008, 01:33:18 am »
I had similar problems (using U360s also). It, along with loss of focus issues, caused me to stop using CPwizard.

shiloh

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 45
  • Last login:May 10, 2016, 02:58:07 pm
Re: CPWizard: need help mapping joysticks label
« Reply #3 on: December 29, 2008, 09:08:35 am »
Can you post your layout xml file and your default.cfg? I'll see if I can figure out whats going wrong.

Files are attached.

Thanks very much for looking into this headkaze!

« Last Edit: December 29, 2008, 09:15:35 am by shiloh »

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard: need help mapping joysticks label
« Reply #4 on: January 01, 2009, 08:17:29 am »
Ginsu Victim: I'm pretty sure the focus issue with CPWizard has been fixed. I noticed this problem with U360's and it has something to do with DirectInput. Please give it another try and let me know if your still having problems. I've spent a tonne of time making sure CPW will gain focus properly from Mame.

shiloh: I'll get back to you as soon as I can :)

TheShanMan

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1912
  • Last login:October 22, 2024, 11:51:12 am
    • My Arcade (updated 1/30/13)
Re: CPWizard: need help mapping joysticks label
« Reply #5 on: January 01, 2009, 01:02:17 pm »
Ginsu, you could also try using the bezel approach. There are pros and cons to both approaches, but overall I like the bezels more. But I might even try using both, where CPW would activate on a key other than pause to allow me to view the CPW menu.
My Collection: Mame cab, 38 dedicated vids, pin, skeeball, coin op air hockey table, Ice Cold Beer, Megatouch, 2 token machines, and payphone (VAPS, pics at Arcade Crusade)

Add Ambience to your mame cab setup

Ginsu Victim

  • Yeah, owning a MAME cab only leads to owning real ones. MAME just isn't good enough. It's a gateway drug.
  • Trade Count: (+10)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10092
  • Last login:June 28, 2025, 10:45:55 pm
  • Comanche, OK -- USA
Re: CPWizard: need help mapping joysticks label
« Reply #6 on: January 01, 2009, 04:31:11 pm »
Maybe I'll give it another shot. I'm about to put a newer PC in my cab, so I'll be tinkering anyway. Might be a good time to try again. (Using Mamewah as the frontend, btw.)

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard: need help mapping joysticks label
« Reply #7 on: January 03, 2009, 04:08:50 am »
Files are attached.

Thanks very much for looking into this headkaze!

Looks like another bungle on my behalf. I don't use joysticks or mice on my cab so I need people to report issues like this so I can fix them. I also get very confused by the Mame devs who keep changing the input codes which is why I placed them into text files in Data\InputCodes.

You were close you just needed to edit JoyCodes.txt and add in those codes as well and then change your layout to match the same codes. I've uploaded a new version of CPWizard which I've updated std.ini and JoyCodes.txt as well as MouseCodes.txt. That should fix your problem AFAIK. I can't really believe noone reported this one earlier or maybe they did and I was too stupid to realise it.

If anyone else has any more problems with codes or thinks I have something wrong in the InputCodes folder please let me know so I can do an update.

shiloh

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 45
  • Last login:May 10, 2016, 02:58:07 pm
Re: CPWizard: need help mapping joysticks label
« Reply #8 on: January 03, 2009, 10:38:16 am »
Files are attached.

Thanks very much for looking into this headkaze!

Looks like another bungle on my behalf. I don't use joysticks or mice on my cab so I need people to report issues like this so I can fix them. I also get very confused by the Mame devs who keep changing the input codes which is why I placed them into text files in Data\InputCodes.

You were close you just needed to edit JoyCodes.txt and add in those codes as well and then change your layout to match the same codes. I've uploaded a new version of CPWizard which I've updated std.ini and JoyCodes.txt as well as MouseCodes.txt. That should fix your problem AFAIK. I can't really believe noone reported this one earlier or maybe they did and I was too stupid to realise it.

If anyone else has any more problems with codes or thinks I have something wrong in the InputCodes folder please let me know so I can do an update.

Thanks Headkaze!

I noticed that the trackball and spinner codes werent showing anything too, but I was trying to fix the joysticks first.

I'll download the latest and test everything. I'll report back if there is still codes issues

thanks again

shiloh

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 45
  • Last login:May 10, 2016, 02:58:07 pm
Re: CPWizard: need help mapping joysticks label
« Reply #9 on: January 03, 2009, 11:35:02 am »
Hello headkaze

I tried the latest version (2.04) this morning. It fixes the joystick issues I had! Nice!

However, I think there is some more changes needed for the mouse codes to work fine. I cant get the labels to work for my trackball or spinner.

On my cabinet the trackball is mouse #4 and the spinner is mouse #5 so their inputs are configured as follow in mame "default.cfg":


Code: [Select]
            <port type="P1_TRACKBALL_X">
                <newseq type="standard">
                    MOUSECODE_4_XAXIS
                </newseq>
                <newseq type="decrement">
                    NONE
                </newseq>
                <newseq type="increment">
                    NONE
                </newseq>
            </port>
            <port type="P1_TRACKBALL_Y">
                <newseq type="standard">
                    MOUSECODE_4_YAXIS
                </newseq>
                <newseq type="decrement">
                    NONE
                </newseq>
                <newseq type="increment">
                    NONE
                </newseq>
            </port>

Code: [Select]
            <port type="P1_DIAL">
                <newseq type="standard">
                    MOUSECODE_5_XAXIS
                </newseq>
                <newseq type="decrement">
                    NONE
                </newseq>
                <newseq type="increment">
                    NONE
                </newseq>
            </port>

In your Mousecodes.txt, there is no codes for the analog mouse axis (ie. MOUSECODE_4_XAXIS), only the codes for digital emulation of analog devices are there (MOUSECODE_4_XAXIS_NEG_SWITCH & MOUSECODE_4_XAXIS_POS_SWITCH).

I tried to add the analog input  into the mousecodes (MOUSECODE_4_YAXIS &  MOUSECODE_4_XAXIS) files and map it to the player #1 trackball as follow in the std.ini :

Code: [Select]
P1_TRACKBALL_X                "MOUSECODE_1_LEFT|JOYCODE_1_LEFT|KEYCODE_LEFT|JOYCODE_1_LEFT_LEFT_SWITCH|MOUSECODE_4_XAXIS"
but it didnt work.

Something I am wondering for analog mouse (trackball and spinner) is how we will be able to define label for "up", "down", "left", etc... because mame has just an analog input code per axis? If you understand what I mean.

There is no issue when emulating an analog trackball with a digital device beause for this mame has two input codes, one to increase the axis value and one to decrease the axis values (ie, right and left on an X axis).





headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard: need help mapping joysticks label
« Reply #10 on: January 03, 2009, 10:28:50 pm »
shiloh: I think it will be a bit tricky to get analog codes working as you noticed they only have one code per axis. I did have a play last night and got the trackball labels showing but I had trouble with the spinner then I realised there was another issue I had to deal with when it comes to mouse codes. If you don't use MOUSE_1 for player 1 and MOUSE_2 for player 2 which are the defaults then it will not map things correctly.

To be honest with you I think I need to re-write large parts of the mapping code to accomodate some of this. Bare with me and I'll have a look when I get some spare time soon.

shiloh

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 45
  • Last login:May 10, 2016, 02:58:07 pm
Re: CPWizard: need help mapping joysticks label
« Reply #11 on: January 04, 2009, 09:29:14 am »
No worries Headkaze, I'll use a specific layout for trackball ans spinner games (a duplicate of my main layout) with some static labels. It should be fine like that.

arzoo

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2093
  • Last login:January 26, 2025, 08:51:53 am
  • Robots WILL kill you.
    • LEDBlinky
Re: CPWizard: need help mapping joysticks label
« Reply #12 on: January 26, 2009, 10:56:56 pm »
Looks like another bungle on my behalf. I don't use joysticks or mice on my cab so I need people to report issues like this so I can fix them. I also get very confused by the Mame devs who keep changing the input codes which is why I placed them into text files in Data\InputCodes.

Hey headkaze - I ran into pretty much the same problem with LEDBlinky (missing mame default input codes for analog sticks). Back with older versions of mame, I could use the inptport.c file from the mame source to identify all the default input codes, but now it's all parameterized. Do you have any idea how to identify the default input codes or generate the std.ini file (is that even a mame file or something J5 created)?

Thanks,
arzoo
Robots will kill you.



Arcade Addiction

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard: need help mapping joysticks label
« Reply #13 on: January 27, 2009, 10:37:31 am »
Hey headkaze - I ran into pretty much the same problem with LEDBlinky (missing mame default input codes for analog sticks). Back with older versions of mame, I could use the inptport.c file from the mame source to identify all the default input codes, but now it's all parameterized. Do you have any idea how to identify the default input codes or generate the std.ini file (is that even a mame file or something J5 created)?

I implemented Analog input support to CPW and PlugInLCD today. I'll give you a quick rundown on what I did. I wrote a little app called inp2std.exe that will convert inpttype.h to a file similar to J5's old std.ini. I have changed the name to MameDefault.txt.

To interpret analog controls I simply split them into two digital inputs. I have a file called AnalogToDigital.txt that contains the info on how to split the analog input codes.

Code: [Select]
JOYCODE_{0}_XAXIS                JOYCODE_{0}_XAXIS_LEFT_SWITCH|JOYCODE_{0}_XAXIS_RIGHT_SWITCH
JOYCODE_{0}_YAXIS                     JOYCODE_{0}_YAXIS_UP_SWITCH|JOYCODE_{0}_YAXIS_DOWN_SWITCH
MOUSECODE_{0}_XAXIS                 MOUSECODE_{0}_XAXIS_NEG_SWITCH|MOUSECODE_{0}_XAXIS_POS_SWITCH
MOUSECODE_{0}_YAXIS                 MOUSECODE_{0}_YAXIS_NEG_SWITCH|MOUSECODE_{0}_YAXIS_POS_SWITCH

For example lets take a look at one of shiloh's mappings in his default.cfg

Code: [Select]
<port type="P1_TRACKBALL_X">
<newseq type="standard">
MOUSECODE_4_XAXIS
</newseq>
</port>

When you read in MOUSECODE_4_XAXIS you split it into two digital input codes. To do that you need to remap two inputs.

Code: [Select]
P1_TRACKBALL_X = MOUSECODE_4_XAXIS_NEG_SWITCH
P1_TRACKBALL_X_EXT = MOUSECODE_4_XAXIS_POS_SWITCH

Simple as that and your existing code should be able to remap those as if it they were two digital input codes so it shouldn't be too much work to add support for them. I'll attach my util and InputCode text files for you to have a look.

shiloh: I used your default.cfg and marcade.xml layout to test this. You will have to change the input codes to be analog in your layout but both the dialer and trackball analog inputs were mapped correctly in my tests. Let me know how you go.
« Last Edit: January 27, 2009, 11:00:41 am by headkaze »

arzoo

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2093
  • Last login:January 26, 2025, 08:51:53 am
  • Robots WILL kill you.
    • LEDBlinky
Re: CPWizard: need help mapping joysticks label
« Reply #14 on: January 27, 2009, 10:51:07 am »
Headkaze - As always, you have the answer and an app or dll to go with it! For LEDBlinky, the whole analog control thing is really overkill - very few users have joysticks (analog or other) that light up. And beyond that, it's still a single control (one LED), so there's really no reason for me to distinguish up/down/left/right. But it is possible that someone could add LEDs around the base of a programmable stick and want them to light up correctly (I considered this for my cp). Or someone could have labels with LEDs (2way, 4way, 8way, etc.). So I'm trying to keep LEDBlinky as flexible as possible - what a pain! Anyway, thanks again.
Robots will kill you.



Arcade Addiction