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: 720 Real/Joystick/Spinner Test  (Read 28034 times)

0 Members and 1 Guest are viewing this topic.

Derrick Renaud

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 299
  • Last login:March 30, 2018, 11:06:19 am
720 Real/Joystick/Spinner Test
« on: January 20, 2011, 11:50:35 pm »
I already mentioned I thought it would be neat to control 720 with just a spinner.  I have to report that it seems to work quite well.  Unfortunately adding another hacked input device is not going to be acceptable.  So I had to break down and add Real/Fake handling.

http://rapidshare.com/files/443684040/mame.zip

(edit) use the official MAME 141u1 for testing instead.

Please try it and let me know if the 3 types of input (Real; Joystick; Spinner) work as expected.  There is a new menu item when Real/Fake controls are found called "Controller Type."  There you can select to use 1 of the 3 types.  The player controls will then be updated in the "Input (This Game)" menu.

So for those of you with the Real control, hook it up and let me know how it works.  Let me know what interface you are using.  No mouse hacks please.

Those of you with a spinner, try it out and give me your comments.  Spinner automatically sends the alignment pulses.  You can try your spinner on the Real setting and see how bad it is without the fake Spinner handling.  Set the sensitivity using the standard formula.
real_full_turn_count / actual_spinner_used_count * 100
For a 1200 count spinner ->  144 / 1200 * 100 = 12%

The setting is not saved in the cfg file yet, but will be.

Also I need opinions on what controls to output in the XML file for front ends.  Just the real?  Real and Fake?  The selected control? Both but with "Fake" added to fake ports?  Something else?

For those of you interested in how it works:
PORT_REAL specifies a group name and a handler.  The group name groups all the ports with the same name together under the new "Controller Type" menu.
If Real is selected then the current port is used unmodified.

PORT_FAKE specifies a group name and a controller name.  The controller name will add itself to the "Controller Type" menu.  If selected in the menu, the PORT_REAL port will call the handler to process the selected fake port data and return it as real.

Code: [Select]
/* Center disc */
/* X1, X2 LETA inputs */
PORT_MODIFY("LETA0")
PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REAL("Rotation", fake_leta_r) PORT_NAME("Center")

/* Rotate disc */
/* Y1, Y2 LETA inputs */
/* The disc has 72 teeth which are read by the hardware at 2x */
/* Computer hardware reads at 4x, so we set the sensitivity to 50% */
PORT_MODIFY("LETA1")
PORT_BIT( 0xff, 0x00, IPT_DIAL_V ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_FULL_TURN_COUNT(144) PORT_REAL("Rotation", fake_leta_r) PORT_NAME("Rotate")

PORT_START("FAKE_JOY_X") /* not direct mapped */
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_FAKE("Rotation", "Joystick")

PORT_START("FAKE_JOY_Y") /* not direct mapped */
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_FAKE("Rotation", "Joystick")

/* Let's assume we are using a 1200 count spinner.  We scale to get a 144 count.
 * 144/1200 = 0.12 = 12% */
PORT_START("FAKE_SPINNER") /* not direct mapped */
PORT_BIT( 0xffff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(12) PORT_KEYDELTA(10) PORT_FAKE("Rotation", "Spinner")

Code: [Select]
static FAKE_INPUT( fake_leta_r )
{
if (!strcmp(current_controller, "Joystick"))
{
/* special thanks to MAME Analog+ for the mapping code */
static double last_angle;
static int rotations;

int analogx = input_port_read(field->port->machine, "FAKE_JOY_X") - 128;
int analogy = input_port_read(field->port->machine, "FAKE_JOY_Y") - 128;
double angle;

/* if the joystick is centered, leave the rest of this alone */
angle = last_angle;
if (analogx < -32 || analogx > 32 || analogy < -32 || analogy > 32)
angle = atan2((double)analogx, (double)analogy) * 360 / (2 * M_PI);

/* detect when we pass the 0 point in either direction */
if (last_angle < -90 && angle > 90)
rotations--;
else if (last_angle > 90 && angle < -90)
rotations++;
last_angle = angle;

/* LETA0 returns 0xff when the controller blocks one of two gaps */
if (!strcmp(tag, "LETA0"))
{
/* original controller had two gaps 10 degrees apart, each 2.5 degrees wide */
/* we fake it a little to make it possible to hit the zeroed state with a digital controller */
return (angle >= -5.0 && angle <= 5.0) ? 0xff : 0x00;
}

/* LETA1 returns dial value; 144 units = 1 full rotation */
else
{
/* take the rotations * 144 plus the current angle */
return (rotations * 144 + (int)(angle * 144.0 / 360.0)) & 0xff;
}
}
else if (!strcmp(current_controller, "Spinner"))
{
static UINT32 last_in;
static INT32  center_count;
UINT32 in = input_port_read(field->port->machine, "FAKE_SPINNER") & 0xffff;
INT32 diff;
UINT32 temp;

int flag = 0;

/* see if count rolled between 0xffff and 0x0000 */
if ((last_in > 0xc000) && (in < 0x03ff))
flag = 1;
if ((in > 0xc000) && (last_in < 0x03ff))
flag = -1;

if (flag == -1)
{
temp = 0xffff - in;
diff = last_in - temp - 1;
}
else if (flag == 0)
{
temp = in - last_in;
diff = temp;
}
else
{
temp = 0xffff - last_in;
diff = in + temp + 1;
}

last_in = in;

center_count += diff;
while (center_count < 0)
center_count += 144;
while (center_count >= 144)
center_count -= 144;

if (!strcmp(tag, "LETA0"))
{
/* for now just return 0xff at rotation 0 */
return (center_count == 0) ? 0xff : 0x00;
}
else
return in & 0xff;
}

return 0xff;
}
« Last Edit: January 25, 2011, 08:01:11 am by Derrick Renaud »

Derrick Renaud

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 299
  • Last login:March 30, 2018, 11:06:19 am
Re: 720 Real/Joystick/Spinner Test
« Reply #1 on: January 20, 2011, 11:56:55 pm »
I should mention that, No, this will not be used for adding shifters.   IPT_GEARSHIFT code is needed.  Not a bunch of fake handers.

This is for use in games like 720, and those fighting/punching weird games mentioned.

ahofle

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4544
  • Last login:August 30, 2023, 05:10:22 pm
    • Arcade Ambience Project
Re: 720 Real/Joystick/Spinner Test
« Reply #2 on: January 20, 2011, 11:58:11 pm »
 :notworthy:

I will check this out when I get back from travel.  
PS. Thanks for being a true developer and taking this on as a puzzle while avoiding the annoying human factors involved.

abaraba

  • ---Perm Ban---
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 138
  • Last login:July 30, 2011, 08:42:58 am
Re: 720 Real/Joystick/Spinner Test
« Reply #3 on: January 21, 2011, 06:26:07 am »
Quote from: Derrick Renaud
There is a new menu item when Real/Fake controls are found called "Controller Type."  There you can select to use 1 of the 3 types.

a.) Changing MAME core engine functionality to suit only one game, or very small and specific group of games, is no good.


b.) You have not submitted all the changes, not even complete "atarisy2.c", but more importantly you forgot to mention what other files you modified.


c.) As other similar menu options this should then also be accompanied with a new command line switch, and as anything 'unnecessary' this is also no good.


d.) You have only TWO types of devices there, not three. Arcade spinner can be mapped to "720 spinner" with no problems. No need for "real" and "fake" when we already have "mouse" and "analog", where analog stick maps to analog axes and both 'arcade spinner' and '720 spinner' map to mouse axes.


Code: [Select]
PORT_MODIFY("LETA0")
PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
PORT_REAL("Rotation", fake_leta_r) PORT_NAME("Center")

PORT_MODIFY("LETA1")
PORT_BIT( 0xff, 0x00, IPT_DIAL_V ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
PORT_FULL_TURN_COUNT(144) PORT_REAL("Rotation", fake_leta_r) PORT_NAME("Rotate")

Addition of "PORT_REAL", "PORT_FAKE", "PORT_FULL_TURN_COUNT(144)" is unnecessary and involves changes to core MAME engine, like modification of "inptport.c", and who knows what else.

It's nice to see you too named calibration port as "IPT_DIAL_V", but Mouse_Y and Mouse_X data seem to be swapped around in "REAL_FUNCTION", which is one of those things you did not show us.


Code: [Select]
PORT_START("FAKE_JOY_X") /* not direct mapped */
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10)
PORT_FAKE("Rotation", "Joystick")

PORT_START("FAKE_JOY_Y") /* not direct mapped */
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10)
PORT_REVERSE PORT_FAKE("Rotation", "Joystick")

Now that I know there is such thing as "PORT_START" I can add a 3rd variant to the list of my beautiful solutions, which generally is to any PC game developer just a very common and standard way to handle different input devices.


Code: [Select]
PORT_START("FAKE_SPINNER") /* not direct mapped */
PORT_BIT( 0xffff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(12) PORT_KEYDELTA(10)
PORT_FAKE("Rotation", "Spinner")

You do not need this, 'arcade spinner' maps to '720 spinner' very well. If you are doing it just to set different sensitivity then you shouldn't as various types of 'arcade spinners' would require different settings anyway, and their full rotation does not need to equal 720's full rotation, so the sensitivity of arcade spinners in this case is more a matter of personal preference, plus it can always be adjusted from the menu. Gameplay with an arcade spinner is much like gameplay with a mouse where you rotate the character by moving the mouse left-right, calibration at "360 degrees" in not necessary or better to say it's inapplicable.


Code: [Select]
static FAKE_INPUT( fake_leta_r )

You show us "FAKE_INPUT", but not "REAL_INPUT" function, nor where is the branching instruction to decide which one of them to execute. Without you submitting complete, and all the files you have modified no one will able to compile your changes, try to improve, learn from it, play with it, or anything.


Code: [Select]
if (!strcmp(current_controller, "Joystick"))

Finally we know what was the mysterious variable in infamous "Step 2", it's a bloody STRING?! Are you mad, comparing strings in a core function that you execute at least once per frame? So, you were not happy with all the unnecessary bloat introduced for this simple thing, now you also have to make it run slower, sheesh!


Code: [Select]
int analogx = input_port_read(field->port->machine, "FAKE_JOY_X") - 128;
int analogy = input_port_read(field->port->machine, "FAKE_JOY_Y") - 128;

Should be "- 127", not "- 128". I suggest you try to monitor what kind of data is incoming to those variables. Something seem wrong there as it gets clamped to min and max when stick retains in constant position, only when actually being moved, I suppose when there is a difference between immediate data packets - deltaX and deltaY, only then we can read actual position of the stick, which might have to do with why anal_hack rotation is not smooth but flickers and jitters.


Code: [Select]
else if (!strcmp(current_controller, "Spinner"))

It makes me puke just to look at the word - "strcmp". Anyway, "else" will do here, you do not need that second comparison until you decide to add keyboard hack too. But, the thing is, you do not need that whole part at all, the real input function can handle 'arcade spinner' as it is, without any hacks, changes or additions - it's still just a "mouse input" in either case.
« Last Edit: January 21, 2011, 06:33:47 am by abaraba »
---Perm Ban, again---

Derrick Renaud

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 299
  • Last login:March 30, 2018, 11:06:19 am
Re: 720 Real/Joystick/Spinner Test
« Reply #4 on: January 21, 2011, 08:22:26 am »
 :troll:

Ignoring troll post that yet again does not contain any truth or understanding.

(Edit) Well accept for the fact that I did not post the rest of the code.  There is no need for something I just posted as a pre-compiled test program.  Code will be submitted when the 2 issues I mentioned are complete.  CFG and XML handling.  Which there is no need to do until the program completes the testing phase.
« Last Edit: January 21, 2011, 09:18:19 am by Derrick Renaud »

Cakemeister

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1002
  • Last login:Yesterday at 08:55:13 pm
  • I'm a llama!
Re: 720 Real/Joystick/Spinner Test
« Reply #5 on: January 21, 2011, 08:28:44 am »
It makes me puke just to look at the word - "strcmp". 

What's up with that? Are you, in fact, a troll?
Old, but not obsolete.

ErikRuud

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1709
  • Last login:March 05, 2021, 10:20:27 am
  • I'll build a cab for only 99.99.99!!!
    • Erik's humble video game page
Re: 720 Real/Joystick/Spinner Test
« Reply #6 on: January 21, 2011, 10:16:39 am »
I already mentioned I thought it would be neat to control 720 with just a spinner.  I have to report that it seems to work quite well.  Unfortunately adding another hacked input device is not going to be acceptable.  So I had to break down and add Real/Fake handling.


That is great!  Except you spoiled the fun of figuring it out on my own.  :lol

I'll test it out over the weekend with a spinner, an analog stick, and a spinner modified to have two encoders like a real controller and see how it works.
Real Life.  Still a poor substitute for video games!       
American Laser Games Wrapper
O2em Rom Utility

Paul Olson

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1235
  • Last login:Yesterday at 07:58:14 pm
    • Paul's Arcade
Re: 720 Real/Joystick/Spinner Test
« Reply #7 on: January 21, 2011, 10:37:41 am »
I will test it with the real controller once it arrives. I can test with a spinner as well, but it probably won't be until later in the weekend. I am upgrading the cab PC to Windows 7 64 tonight, and it will take some time to get everything set up again.

Derrick Renaud

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 299
  • Last login:March 30, 2018, 11:06:19 am
Re: 720 Real/Joystick/Spinner Test
« Reply #8 on: January 21, 2011, 10:43:47 am »
That is great!  Except you spoiled the fun of figuring it out on my own.  :lol

And here I thought the fact that no non troll posted any interest in trying to code it meant that no one was trying.  ;D   ;)

I'll test it out over the weekend with a spinner, an analog stick, and a spinner modified to have two encoders like a real controller and see how it works.

Great, for the spinner also try it under the "Real" selection.  You will notice how it does not work when you kick to move.  The player goes in random direction.  This is why the "Spinner" selection is added to automatically send the calibration pulse.  This means you can also use the mouse under the "Spinner" selection, but it is not as easy as a spinner.

As far as using a "spinner modified to have two encoders like a real controller", this will only work if they have the same tooth count/ratio/positions as the 2 real discs.  The Rotation disc has 72 teeth, and the Center disc has 2 only at the top.  Trying anything else will not result in a meaningfull test.  Sorry, but thanks.

saint

  • turned to the Dark Side
  • Supreme Chancellor
  • Trade Count: (+6)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 6144
  • Last login:May 04, 2024, 09:08:32 am
  • I only work in cyberspace...
    • Build Your Own Arcade Controls
Re: 720 Real/Joystick/Spinner Test
« Reply #9 on: January 21, 2011, 10:57:35 am »
abara - I told you to mellow your tone. You didn't. 3 day ban in effect. You seem genuinely interested, I'd love to see you contribute, but I won't have your attitude here. Try again when you come back.

--- saint
--- John St.Clair
     Build Your Own Arcade Controls FAQ
     http://www.arcadecontrols.com/
     Project Arcade 2!
     http://www.projectarcade2.com/
     saint@arcadecontrols.com

Bootay

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 480
  • Last login:January 10, 2021, 04:29:01 pm
Re: 720 Real/Joystick/Spinner Test
« Reply #10 on: January 21, 2011, 11:16:18 am »
Wow...I am genuinely confused by Abara's attitude....he puts up a stink for weeks about MameDev not taking this matter seriously, then when a MameDev finally does he chastises him and tries to downplay the work that he didn't have to do in the first place? Talk about inconsiderate. My only guess would be that Abara was trying to get the code working first so that he could get a pat on the back and now feels that Derrick is stealing his thunder. Sorry Saint, I didn't mean to feed the troll, I just had to comment.

Derrick...I commend you on this. Especially since MameDev had no interest in this matter to begin with.

ErikRuud

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1709
  • Last login:March 05, 2021, 10:20:27 am
  • I'll build a cab for only 99.99.99!!!
    • Erik's humble video game page
Re: 720 Real/Joystick/Spinner Test
« Reply #11 on: January 21, 2011, 11:24:13 am »
That is great!  Except you spoiled the fun of figuring it out on my own.  :lol

And here I thought the fact that no non troll posted any interest in trying to code it meant that no one was trying.  ;D   ;)


I did post my interest in the "State of MAME" thread.
Quote from: ErikRuud
I am actually interested in it for the technical challenge even though I couldn't care less about 720. I already know how I am going to modify my spinner to incorporate the second encoder wheel.
It may be a week or so before I can begin to work on it seriously though.
I can understand how it got missed amongst the chaff.


I'll test it out over the weekend with a spinner, an analog stick, and a spinner modified to have two encoders like a real controller and see how it works.
Great, for the spinner also try it under the "Real" selection.  You will notice how it does not work when you kick to move.  The player goes in random direction.  This is why the "Spinner" selection is added to automatically send the calibration pulse.  This means you can also use the mouse under the "Spinner" selection, but it is not as easy as a spinner.
As far as using a "spinner modified to have two encoders like a real controller", this will only work if they have the same tooth count/ratio/positions as the 2 real discs.  The Rotation disc has 72 teeth, and the Center disc has 2 only at the top.  Trying anything else will not result in a meaningful test.  Sorry, but thanks.
My spinner is custom built.  I can easily swap out the encoder wheel and add the special second wheel at the bottom of the shaft.
Real Life.  Still a poor substitute for video games!       
American Laser Games Wrapper
O2em Rom Utility

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:May 13, 2024, 10:10:04 am
  • ...
Re: 720 Real/Joystick/Spinner Test
« Reply #12 on: January 21, 2011, 11:31:39 am »
My spinner is custom built.  I can easily swap out the encoder wheel and add the special second wheel at the bottom of the shaft.

Ram Controls sells repro wheels.  http://www.ram-controls.com/order-720.html

FYI, they've had trouble sourcing some parts for the whole controller, so be prepared for a star wars yolk type experience if you order the whole thing from the website without calling first.

EDIT: Just tried adding it to my cart and it shows up as a PRE-ORDER (and $50 cheaper).
« Last Edit: January 21, 2011, 11:36:33 am by BadMouth »

ErikRuud

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1709
  • Last login:March 05, 2021, 10:20:27 am
  • I'll build a cab for only 99.99.99!!!
    • Erik's humble video game page
Re: 720 Real/Joystick/Spinner Test
« Reply #13 on: January 21, 2011, 11:40:24 am »
I'll fabricate my own.  The originals are probably too large of a diameter.
Real Life.  Still a poor substitute for video games!       
American Laser Games Wrapper
O2em Rom Utility

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:May 13, 2024, 10:10:04 am
  • ...
Re: 720 Real/Joystick/Spinner Test
« Reply #14 on: January 21, 2011, 11:48:07 am »
Yeah, not cheap either.  While looking for an inkjet transparency template for one with 72 teeth, I came accross this:
http://www.thingiverse.com/thing:1527

I haven't used it and won't download it at work, so I'm not sure if it will do the job or not.

Paul Olson

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1235
  • Last login:Yesterday at 07:58:14 pm
    • Paul's Arcade
Re: 720 Real/Joystick/Spinner Test
« Reply #15 on: January 21, 2011, 12:06:14 pm »
Dave said he still needs to finish the upper housing before he can sell the whole stick. I just bought a controller from someone at KLOV, but it is misssing the pcb. I ordered the premium rebuild kit from Dave, so  hopefully I will get both of them soon to test.

Derrick Renaud

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 299
  • Last login:March 30, 2018, 11:06:19 am
Re: 720 Real/Joystick/Spinner Test
« Reply #16 on: January 21, 2011, 12:42:00 pm »
OK, now that it is safe to post again, I will try to answer some of abaraba's troll post by treating it as questions and not the statement of fact that he incorrectly believes they are.  Even though he will troll it again in 3 days, I thought others might benefit from the discussion of why I went with the solution I did.

Quote from: Derrick Renaud
There is a new menu item when Real/Fake controls are found called "Controller Type."  There you can select to use 1 of the 3 types.

a.) Changing MAME core engine functionality to suit only one game, or very small and specific group of games, is no good.


b.) You have not submitted all the changes, not even complete "atarisy2.c", but more importantly you forgot to mention what other files you modified.


c.) As other similar menu options this should then also be accompanied with a new command line switch, and as anything 'unnecessary' this is also no good.


d.) You have only TWO types of devices there, not three. Arcade spinner can be mapped to "720 spinner" with no problems. No need for "real" and "fake" when we already have "mouse" and "analog", where analog stick maps to analog axes and both 'arcade spinner' and '720 spinner' map to mouse axes.

a. without adding the new functionality there is no clean way to add multiple controls.  This will be used for other games and can even be used to add back in the fake Battlezone and Defender single joystick hacks, if MAMEdev agrees.  This allows all fake handling to be maintained under 1 routine.

c. as stated ad nauseum, no new command line switches.  They are not needed.  They can be easily controlled in the cfg file when I add that.

d. Try testing the code as I asked, you will see you can not use a mouse if only the real port existed.  No center disc data is sent.  The player will spin fine when standing still, but will go off in a random direction when kicked.  Hence the need for fake "Spinner" handling.  If the Real port code worked using only a mouse, then we would not even be discussing this and the current fake joystick would not be in the current MAME code.

Code: [Select]
PORT_MODIFY("LETA0")
PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
PORT_REAL("Rotation", fake_leta_r) PORT_NAME("Center")

PORT_MODIFY("LETA1")
PORT_BIT( 0xff, 0x00, IPT_DIAL_V ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
PORT_FULL_TURN_COUNT(144) PORT_REAL("Rotation", fake_leta_r) PORT_NAME("Rotate")

Addition of "PORT_REAL", "PORT_FAKE", "PORT_FULL_TURN_COUNT(144)" is unnecessary and involves changes to core MAME engine, like modification of "inptport.c", and who knows what else.

It's nice to see you too named calibration port as "IPT_DIAL_V", but Mouse_Y and Mouse_X data seem to be swapped around in "REAL_FUNCTION", which is one of those things you did not show us.

PORT_FULL_TURN_COUNT has been around for a few years.  It is to document how many counts in a full turn of a real control.  No affect on speed.

PORT_REAL and PORT_FAKE are needed to group different PORTs together to allow for their selection and disconnection of unused ports from being processed by the port update mechanism.  Otherwise if you tried to make the current fake joystick and the real port exist at the same time without my new code, both would be updated, conflicting with each other (unless you set the unused controls to NONE) and slowing down the port read by updating unused ports.

You conveniently removed the comments from the code that showed the Center disc connected to X and Rotate disc connected to Y.  That is why they are named that way, to more accurately reflect how the hardware works.

Another benefit is that the memory map can now call the LETA ports directly instead of calling the fake handler.

Code: [Select]
AM_RANGE(0x1810, 0x1810) AM_MIRROR(0x278c) AM_READ_PORT("LETA0")
AM_RANGE(0x1811, 0x1811) AM_MIRROR(0x278c) AM_READ_PORT("LETA1")
AM_RANGE(0x1812, 0x1812) AM_MIRROR(0x278c) AM_READ_PORT("LETA2")
AM_RANGE(0x1813, 0x1813) AM_MIRROR(0x278c) AM_READ_PORT("LETA3")

instead of the old code:
Code: [Select]
AM_RANGE(0x1810, 0x1813) AM_MIRROR(0x278c) AM_READ(leta_r)


Code: [Select]
PORT_START("FAKE_SPINNER") /* not direct mapped */
PORT_BIT( 0xffff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(12) PORT_KEYDELTA(10)
PORT_FAKE("Rotation", "Spinner")

You do not need this, 'arcade spinner' maps to '720 spinner' very well. If you are doing it just to set different sensitivity then you shouldn't as various types of 'arcade spinners' would require different settings anyway, and their full rotation does not need to equal 720's full rotation, so the sensitivity of arcade spinners in this case is more a matter of personal preference, plus it can always be adjusted from the menu. Gameplay with an arcade spinner is much like gameplay with a mouse where you rotate the character by moving the mouse left-right, calibration at "360 degrees" in not necessary or better to say it's inapplicable.

As I previously stated, this is false.  While the player will spin when standing still, when you press kick the player does not go in the direction he is facing.  That is why fake spinner code is needed to send the alignment pulse.

Code: [Select]
static FAKE_INPUT( fake_leta_r )

You show us "FAKE_INPUT", but not "REAL_INPUT" function, nor where is the branching instruction to decide which one of them to execute. Without you submitting complete, and all the files you have modified no one will able to compile your changes, try to improve, learn from it, play with it, or anything.

Sorry, there was no need.  Code will be submitted when fully tested.  There is no REAL_INPUT function.  When "Real" is selected, the ports tagged as PORT_REAL are connected.  When a fake controller is selected, the Real port is disconnected and the data is generated through the fake handler using the selected ports specified as PORT_FAKE.

Code: [Select]
else if (!strcmp(current_controller, "Spinner"))

It makes me puke just to look at the word - "strcmp". Anyway, "else" will do here, you do not need that second comparison until you decide to add keyboard hack too. But, the thing is, you do not need that whole part at all, the real input function can handle 'arcade spinner' as it is, without any hacks, changes or additions - it's still just a "mouse input" in either case.

An "else" is needed in case someone incorrectly trys to add a PORT_FAKE without adding it to the handler or incorrectly names a PORT_FAKE.  Otherwise it will incorrectly use the "Spinner" code.  Which reminds me, I have to add an errorlog to report any controller names received that are not handled.

strcmp is not slow in this case.  It bails out at the first difference.  "J"oystick and "S"pinner will bail at the first letter.  Any fear of a slowdown is also more then compensated for by the fact that unused ports are being disconnected.
« Last Edit: January 21, 2011, 12:48:41 pm by Derrick Renaud »

Paul Olson

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1235
  • Last login:Yesterday at 07:58:14 pm
    • Paul's Arcade
Re: 720 Real/Joystick/Spinner Test
« Reply #17 on: January 21, 2011, 12:58:11 pm »
Thanks for working on this Derrick! And also thanks for taking the time to explain the choices you made.

Derrick Renaud

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 299
  • Last login:March 30, 2018, 11:06:19 am

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:May 13, 2024, 10:10:04 am
  • ...
Re: 720 Real/Joystick/Spinner Test
« Reply #19 on: January 21, 2011, 05:00:36 pm »
 :laugh2:  Sorry, but I can't help but laugh.

Tell people on mameworld to just google the username and they'll get the idea.
The guy is infamous for annoying the ---steaming pile of meadow muffin--- out of message boards.
http://www.gamedev.net/topic/545989-incoming-hilarity-abaraba-is-back-and-this-time-hes-fixated-on-p2p-networking/

EDIT:OMG just looked at the page 2 results.  It goes on and on...ufo forums, astronomy forums...banned in all and his posts deleted in most of them.
(sorry, we now return you to your original topic)

EDIT:  This one is classic: http://developer.nvidia.com/forums/index.php?showtopic=2286&start=0&p=6307&#entry6307
« Last Edit: January 22, 2011, 10:02:02 am by BadMouth »

newmanfamilyvlogs

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1694
  • Last login:June 15, 2022, 05:20:38 pm
    • forum.arcadecontrols.com/index.php/topic,103584.msg1096585.html#msg1096585
    • Newman Family Vlogs
Re: 720 Real/Joystick/Spinner Test
« Reply #20 on: January 21, 2011, 08:52:51 pm »
Im pretty sure I've found his home phone and address if anyone wants to send him a "thinking of you" card :P

twisty

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 7
  • Last login:May 06, 2011, 10:15:04 pm
    • MAMEWorld
Re: 720 Real/Joystick/Spinner Test
« Reply #21 on: January 21, 2011, 10:47:22 pm »

Tell people on mameworld to just google the username and they'll get the idea.
The guy is infamous for annoying the ---steaming pile of meadow muffin--- out of message boards.

Believe me, I'm quite aware!  :cheers:

saint

  • turned to the Dark Side
  • Supreme Chancellor
  • Trade Count: (+6)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 6144
  • Last login:May 04, 2024, 09:08:32 am
  • I only work in cyberspace...
    • Build Your Own Arcade Controls
Re: 720 Real/Joystick/Spinner Test
« Reply #22 on: January 22, 2011, 12:05:07 am »
Heh. Apparently, tag you're it Twisty.
--- John St.Clair
     Build Your Own Arcade Controls FAQ
     http://www.arcadecontrols.com/
     Project Arcade 2!
     http://www.projectarcade2.com/
     saint@arcadecontrols.com

SavannahLion

  • Wiki Contributor
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5986
  • Last login:December 19, 2015, 02:28:15 am
Re: 720 Real/Joystick/Spinner Test
« Reply #23 on: January 22, 2011, 01:24:23 am »
EDIT:  This one is classic: http://developer.nvidia.com/forums/index.php?showtopic=2286&start=0&p=6307&#entry6307

Might as well sick him on the limitations of the human eye vs frame rate speed for all the good it would do.

Derrick Renaud

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 299
  • Last login:March 30, 2018, 11:06:19 am
Re: 720 Real/Joystick/Spinner Test
« Reply #24 on: January 22, 2011, 11:07:43 pm »
Turns out there is a PORT_CONFNAME setting that does something similar to my PORT_REAL/PORT_FAKE idea.

So here is the code I submitted based on that.

It lets you select between Real/Joystick/Spinner.  Real should work fine with the real control if you use a good interface and not some old cheap mouse hack.  Joystick is the current MAME code from Analog+.  Spinner allows the use of just a mouse/spinner and the code anally reproduces the Center wheel alignment data.  Some say the alignment data is not needed and demand I not reproduce it.  Yet they also say they want accuracy.  Well accuracy is anally reproducing the alignment data.

Paul Olson

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1235
  • Last login:Yesterday at 07:58:14 pm
    • Paul's Arcade
Re: 720 Real/Joystick/Spinner Test
« Reply #25 on: January 23, 2011, 12:18:54 am »
I will try to get this tested soon Derrick. My 720 controller and the rebuild kit both came in today, so I am hoping to get it working tonight or tomorrow.

ErikRuud

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1709
  • Last login:March 05, 2021, 10:20:27 am
  • I'll build a cab for only 99.99.99!!!
    • Erik's humble video game page
Re: 720 Real/Joystick/Spinner Test
« Reply #26 on: January 23, 2011, 06:40:12 pm »
Real life got in the way this weekend so I didn't get my spinner rebuilt to test this.
Real Life.  Still a poor substitute for video games!       
American Laser Games Wrapper
O2em Rom Utility

ark_ader

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5645
  • Last login:March 02, 2019, 07:35:34 pm
  • I glow in the dark.
Re: 720 Real/Joystick/Spinner Test
« Reply #27 on: January 23, 2011, 08:14:43 pm »
Shouldn't this thread belong in software?
If I had only one wish, it would be for three more wishes.

Xiaou2

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4098
  • Last login:May 12, 2024, 06:16:00 am
  • NOM NOM NOM
Re: 720 Real/Joystick/Spinner Test
« Reply #28 on: January 24, 2011, 03:54:32 am »

 Out of all the controllers Ive acquired over the yrs, 720 was not one of them, partly due to it not being functional in Mame.

 I wish to thank Derrick for his efforts in getting this, and possibly others like it, finally added.   :applaud:    :cheers:

 Hopefully this change will also inspire Dave from Ramcontrols to put more energy into reproduction of his 720 controller.

 Till then, I gota get a spinner hooked up and give it a go  :)

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:May 13, 2024, 10:10:04 am
  • ...
Re: 720 Real/Joystick/Spinner Test
« Reply #29 on: January 24, 2011, 02:43:22 pm »

MAME 0.141u1 What's New.....

Quote
720 - added Driver Configuration option to allow the controls to be
set to Real 720 Controller Input; fake joystick; or fake spinner. It
defaults to fake spinner for mouse/spinner use. [Derrick Renaud]

Wow, that was quick! ;D

« Last Edit: January 24, 2011, 02:45:01 pm by BadMouth »

Paul Olson

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1235
  • Last login:Yesterday at 07:58:14 pm
    • Paul's Arcade
Re: 720 Real/Joystick/Spinner Test
« Reply #30 on: January 24, 2011, 03:47:48 pm »

MAME 0.141u1 What's New.....

Quote
720 - added Driver Configuration option to allow the controls to be
set to Real 720 Controller Input; fake joystick; or fake spinner. It
defaults to fake spinner for mouse/spinner use. [Derrick Renaud]

Wow, that was quick! ;D



Very nice! Derrick, is it already tested with the controller? I rebuilt the controller yesterday, but didn't have a chance to hook it up yet. I will try to get it hooked up tonight. That thing is too deep for my panel, so I am going to have to make a riser for it.

Derrick Renaud

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 299
  • Last login:March 30, 2018, 11:06:19 am
Re: 720 Real/Joystick/Spinner Test
« Reply #31 on: January 24, 2011, 04:24:00 pm »
Very nice! Derrick, is it already tested with the controller? I rebuilt the controller yesterday, but didn't have a chance to hook it up yet. I will try to get it hooked up tonight. That thing is too deep for my panel, so I am going to have to make a riser for it.

It has not been tested with a real controller yet but should work fine with the default sensitivity of 50% to compensate for the fact that the game hardware read at 2x and new interfaces read at 4x.  Please let me know if you do test it.

The fake spinner code accurately creates the center count based on the rotate count so that it behaves just like the real thing.  From that I can tell that the real control should work just fine.  It is also easier for most users to just use spinner instead of real.  Real requires you to disable the Center axis (mouse-Y) when using a mouse so you don't send incorrectly aligned center counts.

Some troll is going to start ranting that I should not have done this, but I wanted to document how the control works, and now anyone using the debugger on the 720 game can get real synced data from 1 control.  It also passes the service mode test.

yotsuya

  • Trade Count: (+21)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19956
  • Last login:Yesterday at 02:29:28 pm
  • 2014 UCA Winner, 2014, 2015, 2016 ZapCon Winner
    • forum.arcadecontrols.com/index.php/topic,137636.msg1420628.html
Re: 720 Real/Joystick/Spinner Test
« Reply #32 on: January 24, 2011, 11:10:09 pm »
Derrick-

Just played 720 with my spinner. Kudos to you!
***Build what you dig, bro. Build what you dig.***

Derrick Renaud

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 299
  • Last login:March 30, 2018, 11:06:19 am
Re: 720 Real/Joystick/Spinner Test
« Reply #33 on: January 24, 2011, 11:47:59 pm »
Glad you found it usefull.

For my next trick:
http://forum.arcadecontrols.com/index.php?topic=108813.0

Xiaou2

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4098
  • Last login:May 12, 2024, 06:16:00 am
  • NOM NOM NOM
Re: 720 Real/Joystick/Spinner Test
« Reply #34 on: January 25, 2011, 12:24:21 am »
Quote
For my next trick:
http://forum.arcadecontrols.com/index.php?topic=108813.0

Blasphemous.  :P
(the added number of controls add difficulty, which adds to the experience and feeling of accomplishment when you do well)

 How about simulating / emulating the Track n Field version that used a Trackball?
That looked like it could be an interesting way to control the game.  :)   Not sure if anyone has gotten hold of the converter or not... and or if its needed.

 From what it looked like, there was some sort of small pcb that changed the values to digital pulses.

Derrick Renaud

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 299
  • Last login:March 30, 2018, 11:06:19 am
Re: 720 Real/Joystick/Spinner Test
« Reply #35 on: January 25, 2011, 07:59:44 am »
Quote
For my next trick:
http://forum.arcadecontrols.com/index.php?topic=108813.0

Blasphemous.  :P
(the added number of controls add difficulty, which adds to the experience and feeling of accomplishment when you do well)

Playing with a gamepad can be quite hard with the real controls.  This helps out.

How about simulating / emulating the Track n Field version that used a Trackball?
That looked like it could be an interesting way to control the game.  :)   Not sure if anyone has gotten hold of the converter or not... and or if its needed.

 From what it looked like, there was some sort of small pcb that changed the values to digital pulses.

You requesting non real controls? Blasphemous.  ;)

The only way I can see that working is the harder you spin, the faster the buttons are pressed.  That would be kind of pointless because you would always get a good score.

Ikari style games using Robotron controls would be a better candidates.  I would need to know the memory locations that control rotation but I am too lazy/no interest to find them myself.

Xiaou2

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4098
  • Last login:May 12, 2024, 06:16:00 am
  • NOM NOM NOM
Re: 720 Real/Joystick/Spinner Test
« Reply #36 on: January 25, 2011, 08:34:07 am »
Quote
you requesting non real controls? Blasphemous.

 heh.  No, actually.  There was a real Arcade version that used a trackball that was used
on-location.

 Spinning the trackball fast requires a lot of effort, so is very similar to the button mashing.
Im guessing however, that the Mfg. had too many complaints of people smashing their hands into the cabinet side or something like that.

Quote
Ikari style games using Robotron controls would be a better candidates.

 I dont know how you think you are going to move one way, face another, and then press any buttons rapidly in the process.  (unless you have 3 hands)

 Sure, you could lock down the facing so that its always firing which way they face... but it would destroy the gameplay, the same way it never works well to play robotron with one stick.

 Which is why the Rotary sticks were created in the first place, and are the best choice for playing the game.

Derrick Renaud

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 299
  • Last login:March 30, 2018, 11:06:19 am
Re: 720 Real/Joystick/Spinner Test
« Reply #37 on: January 25, 2011, 08:44:08 am »
Quote
Ikari style games using Robotron controls would be a better candidates.

 I dont know how you think you are going to move one way, face another, and then press any buttons rapidly in the process.  (unless you have 3 hands)

 Sure, you could lock down the facing so that its always firing which way they face... but it would destroy the gameplay, the same way it never works well to play robotron with one stick.

 Which is why the Rotary sticks were created in the first place, and are the best choice for playing the game.

 I guess I was thinking that the right joystick would autofire in the direction of the right joystick so you could hold it down.  Forgot about the second button.  Maybe add a fire/grenade toggle.  Press it and you then lob a grenade (no autofire) with each right press.  Maybe even add a lob a grenade in the player direction button.  Starts to get complicated though.
 
 It was just something I get lots of requests for.
 
 How about:
 Joust with Kinect control of arm flapping.   ;D

spoot

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 688
  • Last login:June 15, 2015, 10:36:18 am
  • Destroyer of electronics
Re: 720 Real/Joystick/Spinner Test
« Reply #38 on: January 25, 2011, 10:02:59 am »
How about:
 Joust with Kinect control of arm flapping.   ;D

Damn it!  Milk meet monitor........monitor meet milk.   :lol

Bootay

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 480
  • Last login:January 10, 2021, 04:29:01 pm
Re: 720 Real/Joystick/Spinner Test
« Reply #39 on: January 25, 2011, 10:04:15 am »
Quote
you requesting non real controls? Blasphemous.

 heh.  No, actually.  There was a real Arcade version that used a trackball that was used
on-location.

 Spinning the trackball fast requires a lot of effort, so is very similar to the button mashing.
Im guessing however, that the Mfg. had too many complaints of people smashing their hands into the cabinet side or something like that.


He's right about that. They had a Track & Field with trackball at the mall by my house for a long time when I was a teen. And yes, it was easy to slam your hand into the cabinet sides if you got into it too much. heh