mirror of
https://github.com/libretro/RetroArch
synced 2025-03-21 22:20:59 +00:00
Simplify input_push_analog_dpad
This commit is contained in:
parent
6cdb823bb4
commit
bbbcc97f57
@ -394,9 +394,6 @@ float py_state_get(py_state_t *handle, const char *id,
|
||||
if (dpad_mode == ANALOG_DPAD_NONE)
|
||||
continue;
|
||||
|
||||
input_push_analog_dpad_pre(general_binds);
|
||||
input_push_analog_dpad_pre(auto_binds);
|
||||
|
||||
input_push_analog_dpad(general_binds, dpad_mode);
|
||||
input_push_analog_dpad(auto_binds, dpad_mode);
|
||||
}
|
||||
|
@ -513,9 +513,6 @@ void state_tracker_update_input(uint16_t *input1, uint16_t *input2)
|
||||
if (dpad_mode == ANALOG_DPAD_NONE)
|
||||
continue;
|
||||
|
||||
input_push_analog_dpad_pre(general_binds);
|
||||
input_push_analog_dpad_pre(auto_binds);
|
||||
|
||||
input_push_analog_dpad(general_binds, dpad_mode);
|
||||
input_push_analog_dpad(auto_binds, dpad_mode);
|
||||
}
|
||||
@ -733,7 +730,6 @@ uint64_t input_menu_keys_pressed(void)
|
||||
{
|
||||
struct retro_keybind *auto_binds = settings->input.autoconf_binds[i];
|
||||
|
||||
input_push_analog_dpad_pre(auto_binds);
|
||||
input_push_analog_dpad(auto_binds, ANALOG_DPAD_LSTICK);
|
||||
}
|
||||
|
||||
|
@ -181,6 +181,19 @@ bool input_translate_coord_viewport(int mouse_x, int mouse_y,
|
||||
|
||||
#define inherit_joyaxis(binds) (((binds)[x_plus].joyaxis == (binds)[x_minus].joyaxis) || ( (binds)[y_plus].joyaxis == (binds)[y_minus].joyaxis))
|
||||
|
||||
/**
|
||||
* input_pop_analog_dpad:
|
||||
* @binds : Binds to modify.
|
||||
*
|
||||
* Restores binds temporarily overridden by input_push_analog_dpad().
|
||||
**/
|
||||
#define input_pop_analog_dpad(binds) \
|
||||
{ \
|
||||
unsigned j; \
|
||||
for (j = RETRO_DEVICE_ID_JOYPAD_UP; j <= RETRO_DEVICE_ID_JOYPAD_RIGHT; j++) \
|
||||
(binds)[j].joyaxis = (binds)[j].orig_joyaxis; \
|
||||
}
|
||||
|
||||
/**
|
||||
* input_push_analog_dpad:
|
||||
* @binds : Binds to modify.
|
||||
@ -205,6 +218,8 @@ bool input_translate_coord_viewport(int mouse_x, int mouse_y,
|
||||
x_minus = RARCH_ANALOG_LEFT_X_MINUS; \
|
||||
y_minus = RARCH_ANALOG_LEFT_Y_MINUS; \
|
||||
} \
|
||||
for (k = RETRO_DEVICE_ID_JOYPAD_UP; k <= RETRO_DEVICE_ID_JOYPAD_RIGHT; k++) \
|
||||
(binds)[k].orig_joyaxis = (binds)[k].joyaxis; \
|
||||
if (!inherit_joyaxis(binds)) \
|
||||
{ \
|
||||
unsigned j = x_plus + 3; \
|
||||
@ -214,26 +229,6 @@ bool input_translate_coord_viewport(int mouse_x, int mouse_y,
|
||||
} \
|
||||
}
|
||||
|
||||
#define input_push_analog_dpad_pre(binds) \
|
||||
{ \
|
||||
unsigned k; \
|
||||
for (k = RETRO_DEVICE_ID_JOYPAD_UP; k <= RETRO_DEVICE_ID_JOYPAD_RIGHT; k++) \
|
||||
(binds)[k].orig_joyaxis = (binds)[k].joyaxis; \
|
||||
}
|
||||
|
||||
/**
|
||||
* input_pop_analog_dpad:
|
||||
* @binds : Binds to modify.
|
||||
*
|
||||
* Restores binds temporarily overridden by input_push_analog_dpad().
|
||||
**/
|
||||
#define input_pop_analog_dpad(binds) \
|
||||
{ \
|
||||
unsigned j; \
|
||||
for (j = RETRO_DEVICE_ID_JOYPAD_UP; j <= RETRO_DEVICE_ID_JOYPAD_RIGHT; j++) \
|
||||
(binds)[j].joyaxis = (binds)[j].orig_joyaxis; \
|
||||
}
|
||||
|
||||
/**
|
||||
* input_poll:
|
||||
*
|
||||
|
@ -1247,9 +1247,6 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||
if (dpad_mode == ANALOG_DPAD_NONE)
|
||||
continue;
|
||||
|
||||
input_push_analog_dpad_pre(general_binds);
|
||||
input_push_analog_dpad_pre(auto_binds);
|
||||
|
||||
input_push_analog_dpad(general_binds, dpad_mode);
|
||||
input_push_analog_dpad(auto_binds, dpad_mode);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user