mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
[GX] input changes work now
This commit is contained in:
parent
d7cacaa9ed
commit
2f46fa4fe9
@ -1973,7 +1973,7 @@ void menu_populate_entries(void *data, unsigned menu_type)
|
|||||||
if (rgui->current_pad == 0)
|
if (rgui->current_pad == 0)
|
||||||
file_list_push(rgui->selection_buf, "RGUI Menu Toggle", RGUI_SETTINGS_BIND_MENU_TOGGLE, 0);
|
file_list_push(rgui->selection_buf, "RGUI Menu Toggle", RGUI_SETTINGS_BIND_MENU_TOGGLE, 0);
|
||||||
|
|
||||||
last = (driver.input && driver.input->set_keybinds) ? RGUI_SETTINGS_BIND_R3 : RGUI_SETTINGS_BIND_LAST;
|
last = (driver.input && driver.input->set_keybinds && !driver.input->get_joypad_driver) ? RGUI_SETTINGS_BIND_R3 : RGUI_SETTINGS_BIND_LAST;
|
||||||
for (i = RGUI_SETTINGS_BIND_BEGIN; i <= last; i++)
|
for (i = RGUI_SETTINGS_BIND_BEGIN; i <= last; i++)
|
||||||
file_list_push(rgui->selection_buf, input_config_bind_map[i - RGUI_SETTINGS_BIND_BEGIN].desc, i, 0);
|
file_list_push(rgui->selection_buf, input_config_bind_map[i - RGUI_SETTINGS_BIND_BEGIN].desc, i, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -97,6 +97,8 @@ const struct platform_bind platform_keys[] = {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern const rarch_joypad_driver_t gx_joypad;
|
||||||
|
|
||||||
static bool g_menu;
|
static bool g_menu;
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
@ -147,9 +149,9 @@ static int16_t gx_input_state(void *data, const struct retro_keybind **binds,
|
|||||||
if (binds[port][id].joykey >= GX_MENU_FIRST && binds[port][id].joykey <= GX_MENU_LAST)
|
if (binds[port][id].joykey >= GX_MENU_FIRST && binds[port][id].joykey <= GX_MENU_LAST)
|
||||||
return gx_menu_input_state(binds[port][id].joykey, gx->pad_state[port]) ? 1 : 0;
|
return gx_menu_input_state(binds[port][id].joykey, gx->pad_state[port]) ? 1 : 0;
|
||||||
else
|
else
|
||||||
return (1ULL << (binds[port][id].joykey) & gx->pad_state[port]) ? 1 : 0;
|
return input_joypad_pressed(&gx_joypad, port, binds[port], id);;
|
||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
return gx->analog_state[port][index][id];
|
return input_joypad_analog(&gx_joypad, port, index, id, binds[port]);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -507,6 +509,11 @@ static void gx_input_poll(void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
for (int j = 0; j < 2; j++)
|
||||||
|
if (gx->analog_state[port][i][j] == -0x8000)
|
||||||
|
gx->analog_state[port][i][j] = -0x7fff;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,8 +551,6 @@ static uint64_t gx_input_get_capabilities(void *data)
|
|||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const rarch_joypad_driver_t gx_joypad;
|
|
||||||
|
|
||||||
static const rarch_joypad_driver_t *gx_input_get_joypad_driver(void *data)
|
static const rarch_joypad_driver_t *gx_input_get_joypad_driver(void *data)
|
||||||
{
|
{
|
||||||
return &gx_joypad;
|
return &gx_joypad;
|
||||||
@ -576,13 +581,17 @@ static bool gx_joypad_init(void)
|
|||||||
static bool gx_joypad_button(unsigned port_num, uint16_t joykey)
|
static bool gx_joypad_button(unsigned port_num, uint16_t joykey)
|
||||||
{
|
{
|
||||||
gx_input_t *gx = (gx_input_t*)driver.input_data;
|
gx_input_t *gx = (gx_input_t*)driver.input_data;
|
||||||
|
|
||||||
|
if (port_num >= MAX_PADS)
|
||||||
|
return false;
|
||||||
|
|
||||||
return gx->pad_state[port_num] & (1ULL << joykey);
|
return gx->pad_state[port_num] & (1ULL << joykey);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int16_t gx_joypad_axis(unsigned port_num, uint32_t joyaxis)
|
static int16_t gx_joypad_axis(unsigned port_num, uint32_t joyaxis)
|
||||||
{
|
{
|
||||||
gx_input_t *gx = (gx_input_t*)driver.input_data;
|
gx_input_t *gx = (gx_input_t*)driver.input_data;
|
||||||
if (joyaxis == AXIS_NONE)
|
if (joyaxis == AXIS_NONE || port_num >= MAX_PADS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int val = 0;
|
int val = 0;
|
||||||
@ -591,12 +600,12 @@ static int16_t gx_joypad_axis(unsigned port_num, uint32_t joyaxis)
|
|||||||
bool is_neg = false;
|
bool is_neg = false;
|
||||||
bool is_pos = false;
|
bool is_pos = false;
|
||||||
|
|
||||||
if (AXIS_NEG_GET(joyaxis) <= 5)
|
if (AXIS_NEG_GET(joyaxis) < 4)
|
||||||
{
|
{
|
||||||
axis = AXIS_NEG_GET(joyaxis);
|
axis = AXIS_NEG_GET(joyaxis);
|
||||||
is_neg = true;
|
is_neg = true;
|
||||||
}
|
}
|
||||||
else if (AXIS_POS_GET(joyaxis) <= 5)
|
else if (AXIS_POS_GET(joyaxis) < 4)
|
||||||
{
|
{
|
||||||
axis = AXIS_POS_GET(joyaxis);
|
axis = AXIS_POS_GET(joyaxis);
|
||||||
is_pos = true;
|
is_pos = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user