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

Pages: 1

baritonomarchetto
MAME Fan
Reged: 11/22/10
Posts: 18
Send PM


First attempt to code MAME: introducing Joy_saturation in MAME 0.106
#257590 - 06/16/11 05:27 PM


Hi all,

I am trying to start developing my own MAME version, based on MAME 0.106 (because it's fast and reliable), but i am completely new to MAME development.

Apart from playing with PORT_TOGGLE, PORT_NAME etc, i am really new to this and need some advice. Could someone help me figuring out how to include a funcion like Joystick_saturation (in MAME since 0.113 IIRC) on this version?

Thanks



baritonomarchetto
MAME Fan
Reged: 11/22/10
Posts: 18
Send PM


Re: First attempt to code MAME: introducing Joy_saturation in MAME 0.106 new [Re: baritonomarchetto]
#257708 - 06/17/11 11:04 PM


Ok, let me explain what i want to face: in driving games i noticed that often a very little angle of the steering wheel gives a big steering to the "car". My goal would be having a full steering for full 270° angle of the steering wheel.


Here is how the code for joy_saturation and joy_deadzone are looking in MAME 0.113 ("src\osd\windows\input.c")


Code:


// set deadzone
if (joy_deadzone > 0 && joy_deadzone <= 1)
{
esult = set_DI_Dword_Property(joystick_device[joystick_count], DIPROP_DEADZONE, 0, DIPH_DEVICE, 10000 * joy_deadzone);
if (result != DI_OK)
{
fprintf(stderr, "Can't set deadzone for Joystick %d - %s\n", joystick_count, joystick_name[joystick_count]);
goto cant_set_deadzone;
}
}

// set saturation
if (joy_saturation > joy_deadzone && joy_saturation < 1)
{
result = set_DI_Dword_Property(joystick_device[joystick_count], DIPROP_SATURATION, 0, DIPH_DEVICE, 10000 * joy_saturation);
if (result != DI_OK)
{
fprintf(stderr, "Can't set saturation for Joystick %d - %s\n", joystick_count, joystick_name[joystick_count]);
goto cant_set_saturation;
}
}




Here is how the part of the code for a2d_deadzone (the previous name for joy_deadzone) is in MAME0.106 (joy_saturation was not introduced since 0.113), directory "src\windows\input.c":


Code:


{
LONG val = ((LONG *)&joystick_state[joynum].lX)[joyindex];
LONG top = joystick_range[joynum][joyindex].lMax;
LONG bottom = joystick_range[joynum][joyindex].lMin;
LONG middle = (top + bottom) / 2;

// watch for movement greater "a2d_deadzone" along either axis
// FIXME in the two-axis joystick case, we need to find out
// the angle. Anything else is unprecise.
if (codetype == CODETYPE_AXIS_POS)
return (val > middle + ((top - middle) * a2d_deadzone));
else
return (val < middle - ((middle - bottom) * a2d_deadzone));
}





a2d_deadzone, joy_deadzone and joy_saturation are defined as float values in the headers.

Now, functions are very different from one release (0.106) and the other (0.113), but i am almost sure that all the needed funcions to code a joy_saturation for mame 0.106 are there... anyone can help me figuring out what those funcions are use for and how can i combine them to reach my goal?

Thanks



baritonomarchetto
MAME Fan
Reged: 11/22/10
Posts: 18
Send PM


Re: First attempt to code MAME: introducing Joy_saturation in MAME 0.106 new [Re: baritonomarchetto]
#257834 - 06/19/11 12:27 PM


hmmm, still no answers this should be more complex than it was supposed to be

Do someone can link me where MAME functions are explained?

thank you!



R. Belmont
Cuckoo for IGAvania
Reged: 09/21/03
Posts: 9716
Loc: ECV-197 The Orville
Send PM


Re: First attempt to code MAME: introducing Joy_saturation in MAME 0.106 new [Re: baritonomarchetto]
#257931 - 06/20/11 05:32 PM


> hmmm, still no answers this should be more complex than it was supposed to be
>
> Do someone can link me where MAME functions are explained?
>
> thank you!

The 0.106 functions are, as you noticed, completely different from even 0.113, and we are 2+ years of additional changes beyond even that. Unfortunately we're not really able to support old codebases, but if you can explain why you don't just use something newer perhaps it can be fixed?



baritonomarchetto
MAME Fan
Reged: 11/22/10
Posts: 18
Send PM


Re: First attempt to code MAME: introducing Joy_saturation in MAME 0.106 new [Re: R. Belmont]
#257940 - 06/20/11 07:20 PM


Thank you for your answer

Well, i am using MAME 0.106 because it's "light" enought to let the old PC my racing MAME cabinet is equipped with run smooth... it would not be a problem to intall a better performances PC, but being challenging having THIS PC working, it's more attractive to me (c'mon, i am sure you know what i mean )

Any further help would be much appreciated


Pages: 1

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

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