Cleanups
This commit is contained in:
parent
d4255b0e55
commit
02876aecae
|
@ -116,10 +116,10 @@ static void wiiu_input_poll(void *data)
|
|||
{
|
||||
wiiu_input_t *wiiu = (wiiu_input_t*)data;
|
||||
|
||||
if(!wiiu)
|
||||
if (!wiiu)
|
||||
return;
|
||||
|
||||
if(wiiu->joypad)
|
||||
if (wiiu->joypad)
|
||||
wiiu->joypad->poll();
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ static int16_t wiiu_input_state(void *data,
|
|||
{
|
||||
wiiu_input_t *wiiu = (wiiu_input_t*)data;
|
||||
|
||||
if(!wiiu || !(port < DEFAULT_MAX_PADS) || !binds || !binds[port])
|
||||
if (!wiiu || !(port < DEFAULT_MAX_PADS) || !binds || !binds[port])
|
||||
return 0;
|
||||
|
||||
switch (device)
|
||||
|
|
|
@ -57,7 +57,7 @@ static int channel_slot_map[] = { -1, -1, -1, -1 };
|
|||
|
||||
static int to_wiimote_channel(unsigned pad)
|
||||
{
|
||||
int i;
|
||||
unsigned i;
|
||||
|
||||
for(i = 0; i < WIIU_WIIMOTE_CHANNELS; i++)
|
||||
if(channel_slot_map[i] == pad)
|
||||
|
@ -99,10 +99,11 @@ static void kpad_destroy(void)
|
|||
|
||||
static bool kpad_button(unsigned pad, uint16_t button_bit)
|
||||
{
|
||||
int channel;
|
||||
if (!kpad_query_pad(pad))
|
||||
return false;
|
||||
|
||||
int channel = to_wiimote_channel(pad);
|
||||
channel = to_wiimote_channel(pad);
|
||||
if(channel < 0)
|
||||
return false;
|
||||
|
||||
|
@ -122,8 +123,9 @@ static void kpad_get_buttons(unsigned pad, input_bits_t *state)
|
|||
|
||||
static int16_t kpad_axis(unsigned pad, uint32_t axis)
|
||||
{
|
||||
int channel = to_wiimote_channel(pad);
|
||||
axis_data data;
|
||||
int channel = to_wiimote_channel(pad);
|
||||
|
||||
if (!kpad_query_pad(pad) || channel < 0 || axis == AXIS_NONE)
|
||||
return 0;
|
||||
|
||||
|
@ -222,7 +224,8 @@ static void kpad_poll(void)
|
|||
/* this is a hack to prevent spurious disconnects */
|
||||
/* TODO: use KPADSetConnectCallback and use callbacks to detect */
|
||||
/* pad disconnects properly. */
|
||||
if (result == 0) {
|
||||
if (result == 0)
|
||||
{
|
||||
poll_failures[channel]++;
|
||||
if(poll_failures[channel] > 5)
|
||||
kpad_deregister(channel);
|
||||
|
@ -253,8 +256,10 @@ static const char *kpad_name(unsigned pad)
|
|||
case WIIMOTE_TYPE_NONE:
|
||||
default:
|
||||
RARCH_LOG("[kpad]: Unknown pad type %d\n", wiimotes[pad].type);
|
||||
return "N/A";
|
||||
break;
|
||||
}
|
||||
|
||||
return "N/A";
|
||||
}
|
||||
|
||||
input_device_driver_t kpad_driver =
|
||||
|
|
|
@ -64,8 +64,11 @@ static int16_t wiiu_pad_get_axis_value(int32_t axis,
|
|||
return clamp_axis(value, is_negative);
|
||||
}
|
||||
|
||||
void wiiu_pad_set_axis_value(int16_t state[3][2], int16_t left_x, int16_t left_y,
|
||||
int16_t right_x, int16_t right_y, int16_t touch_x, int16_t touch_y)
|
||||
void wiiu_pad_set_axis_value(
|
||||
int16_t state[3][2],
|
||||
int16_t left_x, int16_t left_y,
|
||||
int16_t right_x, int16_t right_y,
|
||||
int16_t touch_x, int16_t touch_y)
|
||||
{
|
||||
state[RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_X] = left_x;
|
||||
state[RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_Y] = left_y;
|
||||
|
|
|
@ -131,7 +131,6 @@ static void update_touch_state(int16_t state[3][2], uint64_t *buttons, VPADStatu
|
|||
{
|
||||
VPADTouchData point = {0};
|
||||
struct video_viewport viewport = {0};
|
||||
|
||||
bool touch_clamped = false;
|
||||
|
||||
if (!vpad->tpNormal.touched || vpad->tpNormal.validity != VPAD_VALID)
|
||||
|
@ -232,7 +231,8 @@ static int16_t wpad_axis(unsigned pad, uint32_t axis)
|
|||
return pad_functions.get_axis_value(data.axis, analog_state, data.is_negative);
|
||||
}
|
||||
|
||||
static const char *wpad_name(unsigned pad) {
|
||||
static const char *wpad_name(unsigned pad)
|
||||
{
|
||||
return PAD_NAME_WIIU_GAMEPAD;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,15 +23,6 @@ extern pad_connection_listener_t wiiu_pad_connection_listener;
|
|||
|
||||
static bool ready = false;
|
||||
|
||||
static bool wiiu_joypad_init(void *data);
|
||||
static bool wiiu_joypad_query_pad(unsigned pad);
|
||||
static void wiiu_joypad_destroy(void);
|
||||
static bool wiiu_joypad_button(unsigned pad, uint16_t button);
|
||||
static void wiiu_joypad_get_buttons(unsigned pad, input_bits_t *state);
|
||||
static int16_t wiiu_joypad_axis(unsigned pad, uint32_t axis);
|
||||
static void wiiu_joypad_poll(void);
|
||||
static const char *wiiu_joypad_name(unsigned pad);
|
||||
|
||||
static bool wiiu_joypad_init(void* data)
|
||||
{
|
||||
set_connection_listener(&wiiu_pad_connection_listener);
|
||||
|
@ -71,7 +62,7 @@ static void wiiu_joypad_destroy(void)
|
|||
|
||||
static bool wiiu_joypad_button(unsigned pad, uint16_t key)
|
||||
{
|
||||
if(!wiiu_joypad_query_pad(pad))
|
||||
if (!wiiu_joypad_query_pad(pad))
|
||||
return false;
|
||||
|
||||
return pad_drivers[pad]->button(pad, key);
|
||||
|
@ -79,7 +70,7 @@ static bool wiiu_joypad_button(unsigned pad, uint16_t key)
|
|||
|
||||
static void wiiu_joypad_get_buttons(unsigned pad, input_bits_t *state)
|
||||
{
|
||||
if(!wiiu_joypad_query_pad(pad))
|
||||
if (!wiiu_joypad_query_pad(pad))
|
||||
return;
|
||||
|
||||
pad_drivers[pad]->get_buttons(pad, state);
|
||||
|
@ -87,7 +78,7 @@ static void wiiu_joypad_get_buttons(unsigned pad, input_bits_t *state)
|
|||
|
||||
static int16_t wiiu_joypad_axis(unsigned pad, uint32_t joyaxis)
|
||||
{
|
||||
if(!wiiu_joypad_query_pad(pad))
|
||||
if (!wiiu_joypad_query_pad(pad))
|
||||
return 0;
|
||||
|
||||
return pad_drivers[pad]->axis(pad, joyaxis);
|
||||
|
@ -104,7 +95,7 @@ static void wiiu_joypad_poll(void)
|
|||
|
||||
static const char* wiiu_joypad_name(unsigned pad)
|
||||
{
|
||||
if(!wiiu_joypad_query_pad(pad))
|
||||
if (!wiiu_joypad_query_pad(pad))
|
||||
return "N/A";
|
||||
|
||||
return pad_drivers[pad]->name(pad);
|
||||
|
@ -113,7 +104,7 @@ static const char* wiiu_joypad_name(unsigned pad)
|
|||
static void wiiu_joypad_connection_listener(unsigned pad,
|
||||
input_device_driver_t *driver)
|
||||
{
|
||||
if(pad < MAX_USERS)
|
||||
if (pad < MAX_USERS)
|
||||
pad_drivers[pad] = driver;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue