MAMEWorld >> Programming
Previous thread Previous  View all threads Index   Next thread Next   Flat Mode Flat  

LazyCat
MAME Fan
Reged: 04/26/12
Posts: 45
Send PM
Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits?
04/28/12 06:18 PM


> I have stated the reason it was done, but you are free to agree or disagree as you
> see fit.
>

You said the reason was to make it universal for any kind of future OS port, but 17 bits is not universal.

I did a quick search for DirectX specifications for analog joystick interface and instead found Linux and Xbox use -32767 to 32767, which was enough to convince me that was in fact the standard (universal), so if you want to conform to standards you should use that, but the real reason should be because that's sufficient while 17 bits are unnecessary and very non-optimal.

http://manpages.ubuntu.com/manpages/natty/man1/jscal.1.html

http://msdn.microsoft.com/en-us/library/windows/desktop/ee417001(v=vs.85).aspx



> Remember MAME has to convert from any possible OS input to any possible game input port.
>

I don't see "possible" when there is no input device that sends it, no OS that gets it, and no game in MAME that needs it. (17 bits)



> It has nothing to do with what Windows or any other OS uses.
>

I hear you, it's about what some future OS might use.

I never heard anyone thinking like before. The only thing I can think of that is similar to what you are talking about is when DOS games didn't use relative timing but relied on CPU speed so they don't work properly today, however all the other software does, and as long as you are not doing anything unwise like that your code will be future proof too, without any need for trying to predict the future.



> One of the other reasons is to be able to convert part of a signed OS axis to an
> unsigned MAME driver input port.
> eg: you may want to map 1/2 of your OS joystick axis to an unsigned 16 bit game
> driver port in MAME. so you need half of +/- 65535 on the OS part side to easily map
> to 0 to + 65535 for the MAME driver. To give an example, would be to use half an OS
> joystick axis as a gas pedal in the emulated game.
>
> In case you don't know, you can select any of full axis, - axis, + axis of the OS
> analog input to be used for MAME input.
>

Your example does not need 17 bits. And why scale the range to +/- 65535 if the resolution you get from the input device is maxed at -32767, 32767? Maybe Windows and DirectX are different after all?

Let me see... no, DirectX just the same, SDL too.

http://msdn.microsoft.com/en-us/library/windows/apps/hh780563.aspx

http://freegamedev.net/wiki/Input_Handling



> Personally I would have used 16bit +32767/-32768 because I do not know of any game
> with an analog port greater then that. Also 1 bit per relative (eg mouse) input. But
> the decission was made to be as universal as possible to cover any future unseen
> case.
>

Decision, as if there was some discussion about it?

Using four more bytes just to store two extra bits does not make it universal, nor it covers any future cases, because if any future interface decide to use 32 bits for precision it will use its full range: −2,147,483,648 to 2,147,483,647.



> Again it was not my decission, so do whatever you like. That is the joy of open
> source code.
>

I will change it in my build for sure, and you should change it in your too. Why would you trust some Aaron character more than your guts, and me, the Lazy Cat, anyway? Meow!



> FWIW, changing it to 16bit, will not change the driver speed or latency in any real
> sense.
>

Sounds like a bet, I accept!

Never used MAME profiler much and removed it from my build, but this looks like a perfect opportunity to see what's really worth. Can it measure input latency? You seem pretty certain there, what do you base your opinion on?



> As to my question of why you would want to modify all drivers, I say again why? That
> is a step backwards that would have to be maintained in 1000s of drivers.
>

I believe to have really simple and elegant design that would make adding drivers, that is converting from MAME, very easy, where one of the benefits of that new design is: *no more maintenance*. In this "UtopiaMAME" it will not be possible any more to screw up working drivers by fiddling with other drivers, adding new games or new features. I'd say that's a step forward.

Maintenance? What are your drivers made of, snowflakes?!







Entire thread
Subject Posted by Posted on
* Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? Bryan Ischo 03/23/12 12:08 AM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? LazyCat  04/26/12 01:41 PM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? Derrick Renaud  04/26/12 04:06 PM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? LazyCat  04/26/12 07:13 PM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? Derrick Renaud  04/26/12 11:55 PM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? LazyCat  04/27/12 06:02 AM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? Derrick Renaud  04/27/12 04:34 PM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? LazyCat  04/29/12 12:51 AM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? LazyCat  04/28/12 06:18 PM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? Bryan Ischo  05/08/12 06:24 AM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? LazyCat  05/08/12 03:34 PM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? B2K24  04/06/12 10:11 PM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? mogli  04/01/12 04:55 AM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? R. Belmont  04/06/12 04:29 PM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? LazyCat  04/26/12 03:21 PM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? krick  04/27/12 05:23 AM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? Derrick Renaud  04/24/12 08:06 PM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? Ramirez  04/24/12 11:22 PM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? Sune  04/08/12 07:07 PM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? R. Belmont  04/09/12 04:38 PM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? Sune  05/08/12 11:11 PM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? R. Belmont  05/10/12 12:21 AM
. * Re: Why are MAME INPUT_ABSOLUTE_{MIN/MAX} 17 bits? mesk  04/06/12 09:58 PM

Extra information Permissions
Moderator:  Pi 
0 registered and 6 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 4554