MAMEWorld >> Programming
View all threads Index   Flat Mode Flat  

baritonomarchetto
MAME Fan
Reged: 11/22/10
Posts: 18
Send PM
Re: First attempt to code MAME: introducing Joy_saturation in MAME 0.106
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







Entire thread
Subject Posted by Posted on
* First attempt to code MAME: introducing Joy_saturation in MAME 0.106 baritonomarchetto 06/16/11 05:27 PM
. * Re: First attempt to code MAME: introducing Joy_saturation in MAME 0.106 baritonomarchetto  06/17/11 11:04 PM
. * Re: First attempt to code MAME: introducing Joy_saturation in MAME 0.106 baritonomarchetto  06/19/11 12:27 PM
. * Re: First attempt to code MAME: introducing Joy_saturation in MAME 0.106 R. Belmont  06/20/11 05:32 PM
. * Re: First attempt to code MAME: introducing Joy_saturation in MAME 0.106 baritonomarchetto  06/20/11 07:20 PM

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