Arcadeshop.de developed hardware?

Coin-operated games and arcades.
User avatar
cools
Armed Police Buttrider
Posts: 13617
Joined: August 17th, 2008, 4:49 pm
Location: Wales, United Kingdom
eBay: hordarian
Initials: CLS

Re: Arcadeshop.de developed hardware?

Post by cools »

I can understand the use of this for original (or unmodifiable) hardware, but not for a MAME cab - I wouldn't be surprised to see proper 4 way joystick restrictions make it in to the software.
Image
User avatar
Sobriquet
Please Continue...
Posts: 177
Joined: April 20th, 2009, 11:42 pm
Location: Dublin (Formally Essex, UK)
eBay: kaff_white

Re: Arcadeshop.de developed hardware?

Post by Sobriquet »

Just to confirm, MAME does have its logic intact, although it's not quite the way I remember it:

Relevant bits from inptport.c:

Code: Select all

				/* lock out opposing directions (left + right or up + down) */
				if ((joystick->current & (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT)) == (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT))
					joystick->current &= ~(JOYDIR_UP_BIT | JOYDIR_DOWN_BIT);
				if ((joystick->current & (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT)) == (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT))
					joystick->current &= ~(JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT);

				/* only update 4-way case if joystick has moved */
				if (joystick->current != joystick->previous)
				{
					joystick->current4way = joystick->current;

					/*
                        If joystick is pointing at a diagonal, acknowledge that the player moved
                        the joystick by favoring a direction change.  This minimizes frustration
                        when using a keyboard for input, and maximizes responsiveness.

                        For example, if you are holding "left" then switch to "up" (where both left
                        and up are briefly pressed at the same time), we'll transition immediately
                        to "up."

                        Zero any switches that didn't change from the previous to current state.
                     */
					if ((joystick->current4way & (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT)) &&
						(joystick->current4way & (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT)))
					{
						joystick->current4way ^= joystick->current4way & joystick->previous;
					}

					/*
                        If we are still pointing at a diagonal, we are in an indeterminant state.

                        This could happen if the player moved the joystick from the idle position directly
                        to a diagonal, or from one diagonal directly to an extreme diagonal.

                        The chances of this happening with a keyboard are slim, but we still need to
                        constrain this case.

                        For now, just resolve randomly.
                     */
					if ((joystick->current4way & (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT)) &&
						(joystick->current4way & (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT)))
					{
						if (mame_rand(machine) & 1)
							joystick->current4way &= ~(JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT);
						else
							joystick->current4way &= ~(JOYDIR_UP_BIT | JOYDIR_DOWN_BIT);
					}
				}
User avatar
Sobriquet
Please Continue...
Posts: 177
Joined: April 20th, 2009, 11:42 pm
Location: Dublin (Formally Essex, UK)
eBay: kaff_white

Re: Arcadeshop.de developed hardware?

Post by Sobriquet »

One final thing (so as not to further hijack the thread). IF you want to see this in action, do the following:

Code: Select all

mame.exe -debug dkong
Then, go to Debug->"New Memory Window" from the debug window, and enter the following address: "7c00".
Hit F5 to start the game running and move the focus to the game window with the mouse.

Now, if you push Down, you'll see that the game sees an '8'. Up and it will see an '4'. Left is '2' and Right is '1'. This is after MAME has processed the inputs and directly what the game sees.
With an 8-way joystick, if you pushed diagonals you'd see the sum of these inputs. e.g. UpLeft is '6'. As the game is flagged as needing a 4-Way joystick pushing UpLeft will take either Up or Left depending on which happened slightly later. If you're really lucky, and your keyboard can indicate both keys changed state in the same frame, then it will randomly pick either Up or Left.
Now try pressing Left + Right, MAME blocks this and returns 0. Try pushing Up + Left + Right - the Left and Right will always cancel leaving the Up.

For 2-way only 2 of the directions will be mapped to the game, but MAME still blocks Left+Right or Up+Down.
bencao74
Please Continue...
Posts: 5
Joined: February 8th, 2010, 11:33 am
Location:

Re: Arcadeshop.de developed hardware?

Post by bencao74 »

Spectre wrote: Have updated my sig, hope you approve :mrgreen:
I do ;) take a look at my sig.

@Sobriquet

great post. Thanks for this tipp. The algorithm proposed seems powerfull enough to cover this "stucking" problem. I`m wondering why people have still problems with their 8 way stick setups...
User avatar
Spectre
By Spectre
Posts: 1694
Joined: January 22nd, 2009, 5:42 pm
Location: Suffolk, UK
eBay: spectre-uk
Initials: JIM

Re: Arcadeshop.de developed hardware?

Post by Spectre »

lmao, nice work ;)

It's "sticking". They stick to the walls, I am sticking to the wall, I was stuck on the wall. :awe:
User avatar
oojj
Please Continue...
Posts: 4
Joined: February 14th, 2010, 5:58 am
Location: Germany
Initials: KGB

Re: Arcadeshop.de developed hardware?

Post by oojj »

Hi there, it's Jan from arcadeshop (also known as oj in other message boards but here I had to register with 4 characters). As I can see it seems to exist a lot of scepticism amongst you. Thats why I want to offer 1 free sample for a review. If anyone is interested in testing and reviewing the E-Limitator, please drope a line here (no PM please). Please allow me to ask for 2 requirements: 1. You should be registered to Arcadeotaku at least for 1 year 2. You should have written at least 100 articles.

Some additional notes: The E-Limitator is not (only) intended for use with a PC and MAME. It's especially designed for use with a normal game PCB in an universal cab. Hence we didn't produce a combination of keyboard encoder AND the limiter (which would cost only 1 or 2 bugs more). Regarding the "engrish" sound of its name :shock: , it was created from 3 words: electronic, limiter and eliminate. To let it sound cool, it ends with the suffix "or" ;)
User avatar
oojj
Please Continue...
Posts: 4
Joined: February 14th, 2010, 5:58 am
Location: Germany
Initials: KGB

Re: Arcadeshop.de developed hardware?

Post by oojj »

oojj wrote:Thats why I want to offer 1 free sample for a review. If anyone is interested in testing and reviewing the E-Limitator, please drope a line here (no PM please). Please allow me to ask for 2 requirements: 1. You should be registered to Arcadeotaku at least for 1 year 2. You should have written at least 100 articles.
:shh: It's still topical ;)