Move defines to retro_miscellaneous.h
This commit is contained in:
parent
31cc6a8dd7
commit
6c09661a64
|
@ -64,7 +64,7 @@ static void hidpad_nesusb_get_buttons(void *data, retro_bits_t* state)
|
|||
struct hidpad_nesusb_data *device = (struct hidpad_nesusb_data*)data;
|
||||
if (device)
|
||||
{
|
||||
RARCH_INPUT_STATE_COPY16_PTR(state, device->buttons);
|
||||
BITS_COPY16_PTR(state, device->buttons);
|
||||
}
|
||||
else
|
||||
BIT128_CLEAR_ALL_PTR(state);
|
||||
|
|
|
@ -64,7 +64,7 @@ static void hidpad_ps2adapter_get_buttons(void *data, retro_bits_t *state)
|
|||
struct hidpad_ps2adapter_data *device = (struct hidpad_ps2adapter_data*)data;
|
||||
if (device)
|
||||
{
|
||||
RARCH_INPUT_STATE_COPY16_PTR(state, device->buttons);
|
||||
BITS_COPY16_PTR(state, device->buttons);
|
||||
}
|
||||
else
|
||||
BIT128_CLEAR_ALL_PTR(state);
|
||||
|
|
|
@ -111,7 +111,7 @@ static void hidpad_ps3_get_buttons(void *data, retro_bits_t *state)
|
|||
if ( device )
|
||||
{
|
||||
/*copy first 16 bits - standard RetroPad controls*/
|
||||
RARCH_INPUT_STATE_COPY16_PTR(state, device->buttons);
|
||||
BITS_COPY16_PTR(state, device->buttons);
|
||||
|
||||
/*PS button?*/
|
||||
if (device->buttons & 0x10000)
|
||||
|
|
|
@ -64,7 +64,7 @@ static void hidpad_psxadapter_get_buttons(void *data, retro_bits_t *state)
|
|||
struct hidpad_psxadapter_data *device = (struct hidpad_psxadapter_data*)data;
|
||||
if (device)
|
||||
{
|
||||
RARCH_INPUT_STATE_COPY16_PTR(state, device->buttons);
|
||||
BITS_COPY16_PTR(state, device->buttons);
|
||||
}
|
||||
else
|
||||
BIT128_CLEAR_ALL_PTR(state);
|
||||
|
|
|
@ -65,7 +65,7 @@ static void hidpad_snesusb_get_buttons(void *data, retro_bits_t *state)
|
|||
struct hidpad_snesusb_data *device = (struct hidpad_snesusb_data*)data;
|
||||
if (device)
|
||||
{
|
||||
RARCH_INPUT_STATE_COPY16_PTR(state, device->buttons);
|
||||
BITS_COPY16_PTR(state, device->buttons);
|
||||
}
|
||||
else
|
||||
BIT128_CLEAR_ALL_PTR(state);
|
||||
|
|
|
@ -677,9 +677,9 @@ static void hidpad_wii_get_buttons(void *data, retro_bits_t *state)
|
|||
struct connect_wii_wiimote_t* device = (struct connect_wii_wiimote_t*)data;
|
||||
if ( device )
|
||||
{
|
||||
uint32_t b;
|
||||
b = device->btns | (device->exp.cc.classic.btns << 16); /*broken? this doesn't match retropad!!*/
|
||||
RARCH_INPUT_STATE_COPY32_PTR(state, b);
|
||||
/* TODO/FIXME - Broken? this doesn't match retropad! */
|
||||
uint32_t b = device->btns | (device->exp.cc.classic.btns << 16);
|
||||
BITS_COPY32_PTR(state, b);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ static void hidpad_wiiugca_get_buttons(void *data, retro_bits_t *state)
|
|||
struct hidpad_wiiugca_data *device = (struct hidpad_wiiugca_data*)data;
|
||||
if (device)
|
||||
{
|
||||
RARCH_INPUT_STATE_COPY16_PTR(state, device->buttons);
|
||||
BITS_COPY16_PTR(state, device->buttons);
|
||||
}
|
||||
else
|
||||
BIT128_CLEAR_ALL_PTR(state);
|
||||
|
|
|
@ -74,7 +74,7 @@ static void ctr_joypad_get_buttons(unsigned port_num, retro_bits_t *state)
|
|||
{
|
||||
if ( port_num < MAX_PADS )
|
||||
{
|
||||
RARCH_INPUT_STATE_COPY16_PTR( state, pad_state );
|
||||
BITS_COPY16_PTR( state, pad_state );
|
||||
}
|
||||
else
|
||||
BIT128_CLEAR_ALL_PTR(state);
|
||||
|
|
|
@ -166,7 +166,7 @@ static void gx_joypad_get_buttons(unsigned port, retro_bits_t *state)
|
|||
{
|
||||
if (port < MAX_PADS)
|
||||
{
|
||||
RARCH_INPUT_STATE_COPY16_PTR( state, pad_state[port] );
|
||||
BITS_COPY16_PTR( state, pad_state[port] );
|
||||
}
|
||||
else
|
||||
BIT128_CLEAR_ALL_PTR(state);
|
||||
|
|
|
@ -331,7 +331,7 @@ static void linuxraw_joypad_get_buttons(unsigned port, retro_bits_t *state)
|
|||
const struct linuxraw_joypad *pad = (const struct linuxraw_joypad*)&linuxraw_pads[port];
|
||||
if (pad)
|
||||
{
|
||||
RARCH_INPUT_STATE_COPY16_PTR(state, pad->buttons);
|
||||
BITS_COPY16_PTR(state, pad->buttons);
|
||||
}
|
||||
else
|
||||
BIT128_CLEAR_ALL_PTR(state);
|
||||
|
|
|
@ -223,7 +223,7 @@ static bool apple_gamecontroller_joypad_button(unsigned port, uint16_t joykey)
|
|||
|
||||
static void apple_gamecontroller_joypad_get_buttons(unsigned port, retro_bits_t *state)
|
||||
{
|
||||
RARCH_INPUT_STATE_COPY16_PTR(state, mfi_buttons[port]);
|
||||
BITS_COPY16_PTR(state, mfi_buttons[port]);
|
||||
}
|
||||
|
||||
static int16_t apple_gamecontroller_joypad_axis(unsigned port, uint32_t joyaxis)
|
||||
|
|
|
@ -345,7 +345,7 @@ static void parport_joypad_get_buttons(unsigned port, retro_bits_t *state)
|
|||
const struct parport_joypad *pad = (const struct parport_joypad*)&parport_pads[port];
|
||||
if (pad)
|
||||
{
|
||||
RARCH_INPUT_STATE_COPY16_PTR(state, pad->buttons);
|
||||
BITS_COPY16_PTR(state, pad->buttons);
|
||||
}
|
||||
else
|
||||
BIT128_CLEAR_ALL_PTR(state);
|
||||
|
|
|
@ -72,7 +72,7 @@ static void ps3_joypad_get_buttons(unsigned port_num, retro_bits_t *state)
|
|||
{
|
||||
if (port_num < MAX_PADS)
|
||||
{
|
||||
RARCH_INPUT_STATE_COPY16_PTR( state, pad_state[port_num] );
|
||||
BITS_COPY16_PTR( state, pad_state[port_num] );
|
||||
}
|
||||
else
|
||||
BIT128_CLEAR_ALL_PTR(state);
|
||||
|
|
|
@ -128,7 +128,7 @@ static void psp_joypad_get_buttons(unsigned port_num, retro_bits_t *state)
|
|||
{
|
||||
if (port_num < PSP_MAX_PADS)
|
||||
{
|
||||
RARCH_INPUT_STATE_COPY16_PTR( state, pad_state[port_num] );
|
||||
BITS_COPY16_PTR( state, pad_state[port_num] );
|
||||
}
|
||||
else
|
||||
BIT128_CLEAR_ALL_PTR(state);
|
||||
|
|
|
@ -609,7 +609,7 @@ static void udev_joypad_get_buttons(unsigned port, retro_bits_t *state)
|
|||
const struct udev_joypad *pad = (const struct udev_joypad*)&udev_pads[port];
|
||||
if (pad)
|
||||
{
|
||||
RARCH_INPUT_STATE_COPY16_PTR( state, pad->buttons );
|
||||
BITS_COPY16_PTR( state, pad->buttons );
|
||||
}
|
||||
else
|
||||
BIT128_CLEAR_ALL_PTR(state);
|
||||
|
|
|
@ -139,7 +139,7 @@ static void wiiu_joypad_get_buttons(unsigned port_num, retro_bits_t *state)
|
|||
{
|
||||
if (port_num < MAX_PADS)
|
||||
{
|
||||
RARCH_INPUT_STATE_COPY16_PTR( state, pad_state[port_num] );
|
||||
BITS_COPY16_PTR( state, pad_state[port_num] );
|
||||
}
|
||||
else
|
||||
BIT128_CLAR_ALL_PTR(state);
|
||||
|
|
|
@ -80,7 +80,7 @@ static void xdk_joypad_get_buttons(unsigned port_num, retro_bits_t *state)
|
|||
{
|
||||
if (port_num < MAX_PADS)
|
||||
{
|
||||
RARCH_INPUT_STATE_COPY16_PTR( state, pad_state[port_num] );
|
||||
BITS_COPY16_PTR( state, pad_state[port_num] );
|
||||
}
|
||||
else
|
||||
BIT128_CLEAR_ALL_PTR(state);
|
||||
|
|
|
@ -158,33 +158,6 @@ enum analog_dpad_mode
|
|||
#define GET_HAT_DIR(x) (x & HAT_MASK)
|
||||
#define GET_HAT(x) (x & (~HAT_MASK))
|
||||
|
||||
#define RARCH_INPUT_STATE_ANY_SET(a) ( ((a).data[0])||((a).data[1])||((a).data[2])||((a).data[3])|| \
|
||||
((a).data[4])||((a).data[5])||((a).data[6])||((a).data[7]) )
|
||||
#define RARCH_INPUT_STATE_ANY_SET_PTR(a) ( ((a)->data[0])||((a)->data[1])||((a)->data[2])||((a)->data[3])|| \
|
||||
((a)->data[4])||((a)->data[5])||((a)->data[6])||((a)->data[7]) )
|
||||
#define RARCH_INPUT_STATE_CLEAR_BITS(a,b) \
|
||||
((a).data[0])&=(~((b).data[0])); \
|
||||
((a).data[1])&=(~((b).data[1])); \
|
||||
((a).data[2])&=(~((b).data[2])); \
|
||||
((a).data[3])&=(~((b).data[3])); \
|
||||
((a).data[4])&=(~((b).data[4])); \
|
||||
((a).data[5])&=(~((b).data[5])); \
|
||||
((a).data[6])&=(~((b).data[6])); \
|
||||
((a).data[7])&=(~((b).data[7]));
|
||||
|
||||
#define RARCH_INPUT_STATE_COPY16_PTR(a,bits) \
|
||||
{ \
|
||||
BIT128_CLEAR_ALL_PTR(a); \
|
||||
((a)->data[0] = (bits) & 0xffff); \
|
||||
}
|
||||
|
||||
#define RARCH_INPUT_STATE_COPY32_PTR(a,bits) \
|
||||
{ \
|
||||
BIT128_CLEAR_ALL_PTR(a); \
|
||||
((a)->data[0] = (bits)); \
|
||||
}
|
||||
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
|
|
@ -58,6 +58,33 @@
|
|||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
#define BITS_ANY_SET(a) ( ((a).data[0])||((a).data[1])||((a).data[2])||((a).data[3])|| \
|
||||
((a).data[4])||((a).data[5])||((a).data[6])||((a).data[7]) )
|
||||
#define BITS_ANY_SET_PTR(a) ( ((a)->data[0])||((a)->data[1])||((a)->data[2])||((a)->data[3])|| \
|
||||
((a)->data[4])||((a)->data[5])||((a)->data[6])||((a)->data[7]) )
|
||||
#define BITS_CLEAR_BITS(a,b) \
|
||||
((a).data[0])&=(~((b).data[0])); \
|
||||
((a).data[1])&=(~((b).data[1])); \
|
||||
((a).data[2])&=(~((b).data[2])); \
|
||||
((a).data[3])&=(~((b).data[3])); \
|
||||
((a).data[4])&=(~((b).data[4])); \
|
||||
((a).data[5])&=(~((b).data[5])); \
|
||||
((a).data[6])&=(~((b).data[6])); \
|
||||
((a).data[7])&=(~((b).data[7]));
|
||||
|
||||
#define BITS_COPY16_PTR(a,bits) \
|
||||
{ \
|
||||
BIT128_CLEAR_ALL_PTR(a); \
|
||||
((a)->data[0] = (bits) & 0xffff); \
|
||||
}
|
||||
|
||||
#define BITS_COPY32_PTR(a,bits) \
|
||||
{ \
|
||||
BIT128_CLEAR_ALL_PTR(a); \
|
||||
((a)->data[0] = (bits)); \
|
||||
}
|
||||
|
||||
|
||||
#define BIT_SET(a, bit) ((a)[(bit) >> 3] |= (1 << ((bit) & 7)))
|
||||
#define BIT_CLEAR(a, bit) ((a)[(bit) >> 3] &= ~(1 << ((bit) & 7)))
|
||||
#define BIT_GET(a, bit) (((a).data[(bit) >> 3] >> ((bit) & 7)) & 1)
|
||||
|
|
|
@ -165,7 +165,7 @@ unsigned menu_event(retro_bits_t* p_input, retro_bits_t* p_trigger_input)
|
|||
|
||||
ok_old = ok_current;
|
||||
|
||||
if (RARCH_INPUT_STATE_ANY_SET_PTR(p_input))
|
||||
if (BITS_ANY_SET_PTR(p_input))
|
||||
{
|
||||
if (!first_held)
|
||||
{
|
||||
|
|
10
retroarch.c
10
retroarch.c
|
@ -2397,7 +2397,7 @@ static enum runloop_state runloop_check_state(
|
|||
if (input_driver_flushing_input)
|
||||
{
|
||||
input_driver_flushing_input = false;
|
||||
if (RARCH_INPUT_STATE_ANY_SET(current_input))
|
||||
if (BITS_ANY_SET(current_input))
|
||||
{
|
||||
BIT128_CLEAR_ALL(current_input);
|
||||
if (runloop_paused)
|
||||
|
@ -2537,12 +2537,10 @@ static enum runloop_state runloop_check_state(
|
|||
retro_ctx.poll_cb();
|
||||
|
||||
{
|
||||
retro_bits_t trigger_input;
|
||||
enum menu_action action;
|
||||
bool focused;
|
||||
|
||||
trigger_input = current_input;
|
||||
RARCH_INPUT_STATE_CLEAR_BITS(trigger_input, old_input);
|
||||
bool focused = false;
|
||||
retro_bits_t trigger_input = current_input;
|
||||
BITS_CLEAR_BITS(trigger_input, old_input);
|
||||
|
||||
action = (enum menu_action)menu_event(¤t_input, &trigger_input);
|
||||
focused = pause_nonactive ? is_focused : true;
|
||||
|
|
Loading…
Reference in New Issue