Thanks Robin - it was much easier to configure on my home system.
The game that I wanted this for was Pirates. It is supposed to be a joystick game, but the code is a pretty obvious rip of CABAL (the bootleg of CABAL is joystick-based) so I wanted it to play like a trackball game. It works much better that way, but it makes it a bit too easy.
The code I used allows me to work with my home desktop computer. The arrow keys or my joystick control panel can also be used. Or for a quick one player game, I can use the PC mouse (Mouse 1) or for a more serious game my PC USB trackball (Mouse 2) or for a serious 2-player game, Player 1 on the first PC trackball and Player 2 on the second PC trackball (Mouse 3).
Also, I swapped buttons 2 and 3 b/c MAME has 2 as "duck and roll" and 3 as "Grenade" and I thought that was backwards, at least compared to CABAL.
Here's the .cfg file:
<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
<system name="pirates">
<input>
<port type="P1_JOYSTICK_UP" mask="1" index="1" defvalue="1">
<newseq type="standard">
KEYCODE_UP OR MOUSECODE_1_Y_NEG OR MOUSECODE_2_Y_NEG
</newseq>
</port>
<port type="P1_JOYSTICK_DOWN" mask="2" index="2" defvalue="2">
<newseq type="standard">
KEYCODE_DOWN OR MOUSECODE_1_Y_POS OR MOUSECODE_2_Y_POS
</newseq>
</port>
<port type="P1_JOYSTICK_LEFT" mask="4" index="3" defvalue="4">
<newseq type="standard">
KEYCODE_LEFT OR MOUSECODE_1_X_NEG OR MOUSECODE_2_X_NEG
</newseq>
</port>
<port type="P1_JOYSTICK_RIGHT" mask="8" index="4" defvalue="8">
<newseq type="standard">
KEYCODE_RIGHT OR MOUSECODE_1_X_POS OR MOUSECODE_2_X_POS
</newseq>
</port>
<port type="P1_BUTTON1" mask="16" index="5" defvalue="16">
<newseq type="standard">
KEYCODE_LCONTROL OR MOUSECODE_1_BUTTON1
</newseq>
</port>
<port type="P1_BUTTON2" mask="32" index="6" defvalue="32">
<newseq type="standard">
KEYCODE_SPACE OR MOUSECODE_1_BUTTON3
</newseq>
</port>
<port type="P1_BUTTON3" mask="64" index="7" defvalue="64">
<newseq type="standard">
KEYCODE_LALT OR MOUSECODE_1_BUTTON2
</newseq>
</port>
<port type="P2_JOYSTICK_UP" mask="256" index="9" defvalue="256">
<newseq type="standard">
KEYCODE_R OR MOUSECODE_3_Y_NEG
</newseq>
</port>
<port type="P2_JOYSTICK_DOWN" mask="512" index="10" defvalue="512">
<newseq type="standard">
KEYCODE_F OR MOUSECODE_3_Y_POS
</newseq>
</port>
<port type="P2_JOYSTICK_LEFT" mask="1024" index="11" defvalue="1024">
<newseq type="standard">
KEYCODE_D OR MOUSECODE_3_X_NEG
</newseq>
</port>
<port type="P2_JOYSTICK_RIGHT" mask="2048" index="12" defvalue="2048">
<newseq type="standard">
KEYCODE_G OR MOUSECODE_3_X_POS
</newseq>
</port>
<port type="P2_BUTTON2" mask="8192" index="14" defvalue="8192">
<newseq type="standard">
KEYCODE_Q
</newseq>
</port>
<port type="P2_BUTTON3" mask="16384" index="15" defvalue="16384">
<newseq type="standard">
KEYCODE_S
</newseq>
</port>
</input>
</system>
</mameconfig>
Your example has 15 words per input: the max is 16, and to add a button, you need "OR" & the button. If the number words goes above 16, mame drops the old settings and just goes with the new. And 15+2 = 17 > 16, so that's why you lose the mouse inputs.
Wow - I never would have realized that!!!
Did you try it in the order in my reply (key first then mouse)?
Not on the work computer. I did try that on the home computer, although on the home computer - I basically ended up spinning ANY mouse to get the directionals assigned to something other than default (so they showed up in the pirates.cfg file) and then hand-editing the file to what I wanted (once I could see how the format was structured).
Does it make a difference? (I ask because I usually only get between half to one dozen words when remapping a mouse axis to a digital input, so either order usually works for me.)
I'm not sure if it would have made a difference or not. Now that you explained the problem, I think I might have ended up with only the button input if I moved the mouse first, and only the mouse gobbledy-gook if I input the button first.
Although I think you hit it correctly with your initial reply:
You have to spin it fast and far enough within the second or so you have to remap. (But not too fast so you get back spin. ) Very much like remapping any mouse axis to a normal analog axis (which seems to work easier on some systems than others).
At first, I was not spinning it fast enough to register, so nothing was added.
Spin it too FAR and you get MOUSECODE_1_X_POS MOUSECODE_1_X_POS MOUSECODE_1_X_POS ...
Spin it too fast or not quite in a straight line, and you get all the NEG inputs, NOT codes, and Y-Axis stuff.
With practice on the home computer, I actually got it to register correctly "MOUSECODE_3_Y_NEG" only ONCE, and I suspect experience explains why you only got about 6 words and I was getting 15.
Since we're looking at curiosity things, do you have any idea what the various
mask="16384" index="15" defvalue="16384"
etc. values mean?