summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author smf- <smf-@users.noreply.github.com>2008-04-13 15:42:20 +0000
committer smf- <smf-@users.noreply.github.com>2008-04-13 15:42:20 +0000
commit02b2ba8a6dbd45715532d44d867908227f02af09 (patch)
treea622a29a2435ff262349d1e5a2dce4f047e35224
parent4725e2fa8ec46b0c708b2fa0d89c5fffbb992e6c (diff)
fixed cross-hair update when the game is not polling the coordinates
-rw-r--r--src/emu/inptport.c62
1 files changed, 38 insertions, 24 deletions
diff --git a/src/emu/inptport.c b/src/emu/inptport.c
index 90985d5ff9d..ab8d4d035a4 100644
--- a/src/emu/inptport.c
+++ b/src/emu/inptport.c
@@ -156,7 +156,6 @@ struct _analog_port_info
UINT8 single_scale; /* scale joystick differently if default is between min/max */
UINT8 interpolate; /* should we do linear interpolation for mid-frame reads? */
UINT8 lastdigital; /* was the last modification caused by a digital form? */
- UINT32 crosshair_pos; /* position of fake crosshair */
};
@@ -3210,6 +3209,41 @@ static void update_analog_port(int portnum)
/*************************************
*
+ * Apply analogue port settings
+ *
+ *************************************/
+
+INT32 apply_analogue_settings(INT32 current, analog_port_info *info)
+{
+ INT32 value;
+ input_port_entry *portentry = info->portentry;
+
+ /* apply the min/max and then the sensitivity */
+ current = apply_analog_min_max(info, current);
+ current = APPLY_SENSITIVITY(current, portentry->analog.sensitivity);
+
+ /* apply reversal if needed */
+ if (portentry->analog.reverse)
+ current = info->reverse_val - current;
+ else if (info->single_scale)
+ /* it's a pedal or the default value is equal to min/max */
+ /* so we need to adjust the center to the minimum */
+ current -= INPUT_ABSOLUTE_MIN;
+
+ /* map differently for positive and negative values */
+ if (current >= 0)
+ value = APPLY_SCALE(current, info->scalepos);
+ else
+ value = APPLY_SCALE(current, info->scaleneg);
+ value += portentry->default_value;
+
+ return value;
+}
+
+
+
+/*************************************
+ *
* Analog port interpolation
*
*************************************/
@@ -3240,27 +3274,7 @@ profiler_mark(PROFILER_INPUT);
else
current = info->accum;
- /* apply the min/max and then the sensitivity */
- current = apply_analog_min_max(info, current);
- current = APPLY_SENSITIVITY(current, portentry->analog.sensitivity);
-
- /* apply reversal if needed */
- if (portentry->analog.reverse)
- current = info->reverse_val - current;
- else if (info->single_scale)
- /* it's a pedal or the default value is equal to min/max */
- /* so we need to adjust the center to the minimum */
- current -= INPUT_ABSOLUTE_MIN;
-
- /* map differently for positive and negative values */
- if (current >= 0)
- value = APPLY_SCALE(current, info->scalepos);
- else
- value = APPLY_SCALE(current, info->scaleneg);
- value += portentry->default_value;
-
- /* store crosshair position before any remapping */
- info->crosshair_pos = (INT32)value & (portentry->mask >> info->shift);
+ value = apply_analogue_settings(current, info);
/* remap the value if needed */
if (portentry->analog.remap_table)
@@ -3361,9 +3375,9 @@ UINT32 get_crosshair_pos(int port_num, UINT8 player, UINT8 axis)
for (info = portinfo->analoginfo; info; info = info->next)
{
portentry = info->portentry;
- if (portentry->player == player && portentry->analog.crossaxis == axis)
+ if (portentry->player == player && portentry->analog.crossaxis == axis && input_port_condition(portentry))
{
- result = info->crosshair_pos;
+ result = apply_analogue_settings(info->accum, info) & (portentry->mask >> info->shift);
break;
}
}