Indent nits

This commit is contained in:
twinaphex 2017-11-27 03:53:46 +01:00
parent d93b9ebf4d
commit cdf1d9a417

View File

@ -480,9 +480,9 @@ const input_device_driver_t *input_driver_get_joypad_driver(void)
const input_device_driver_t *input_driver_get_sec_joypad_driver(void)
{
if (!current_input || !current_input->get_sec_joypad_driver)
return NULL;
return current_input->get_sec_joypad_driver(current_input_data);
if (!current_input || !current_input->get_sec_joypad_driver)
return NULL;
return current_input->get_sec_joypad_driver(current_input_data);
}
uint64_t input_driver_get_capabilities(void)
@ -499,7 +499,7 @@ void input_driver_set(const input_driver_t **input, void **input_data)
*input = current_input;
*input_data = current_input_data;
}
input_driver_set_own_driver();
}
@ -548,7 +548,7 @@ void input_poll(void)
size_t i;
settings_t *settings = config_get_ptr();
uint8_t max_users = (uint8_t)input_driver_max_users;
current_input->poll(current_input_data);
input_driver_turbo_btns.count++;
@ -804,8 +804,8 @@ void input_menu_keys_pressed(void *data, retro_bits_t* p_new_state)
const struct retro_keybind *binds_auto = NULL;
uint8_t max_users = (uint8_t)input_driver_max_users;
uint8_t port_max =
settings->bools.input_all_users_control_menu
? max_users : 1;
settings->bools.input_all_users_control_menu
? max_users : 1;
RARCH_INPUT_STATE_CLEAR_PTR( p_new_state );
@ -882,7 +882,7 @@ void input_menu_keys_pressed(void *data, retro_bits_t* p_new_state)
? input_config_binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
joyaxis = (input_config_binds[port][i].joyaxis != AXIS_NONE)
? input_config_binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
if (sec)
{
if ((uint16_t)joykey == NO_BTN || !sec->button(joypad_info.joy_idx, (uint16_t)joykey))
@ -1038,7 +1038,7 @@ void input_keys_pressed(void *data, retro_bits_t* p_new_state)
joypad_info.joy_idx = settings->uints.input_joypad_map[0];
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
joypad_info.axis_threshold = input_driver_axis_threshold;
input_driver_block_libretro_input = false;
input_driver_block_hotkey = false;
@ -1052,9 +1052,9 @@ void input_keys_pressed(void *data, retro_bits_t* p_new_state)
&& current_input->input_state(
current_input_data, joypad_info, &binds, 0,
RETRO_DEVICE_JOYPAD, 0, RARCH_ENABLE_HOTKEY))
input_driver_block_libretro_input = true;
else
input_driver_block_hotkey = true;
input_driver_block_libretro_input = true;
else
input_driver_block_hotkey = true;
}
game_focus_toggle_valid = binds[RARCH_GAME_FOCUS_TOGGLE].valid;
@ -1073,7 +1073,7 @@ void input_keys_pressed(void *data, retro_bits_t* p_new_state)
{
if (
((!input_driver_block_libretro_input && ((i < RARCH_FIRST_META_KEY)))
|| !input_driver_block_hotkey) &&
|| !input_driver_block_hotkey) &&
binds[i].valid && current_input->input_state(current_input_data,
joypad_info, &binds,
0, RETRO_DEVICE_JOYPAD, 0, i)
@ -1085,7 +1085,7 @@ void input_keys_pressed(void *data, retro_bits_t* p_new_state)
if ((i >= RARCH_FIRST_META_KEY) &&
current_input->meta_key_pressed(current_input_data, i)
)
)
{
RARCH_INPUT_STATE_BIT_SET_PTR(p_new_state, i);
continue;
@ -1317,7 +1317,7 @@ bool input_driver_init_command(void)
}
input_driver_command = command_new();
if (command_network_new(
input_driver_command,
stdin_cmd_enable && !grab_stdin,
@ -1582,7 +1582,7 @@ bool input_joypad_set_rumble(const input_device_driver_t *drv,
if (!input_config_get_bind_idx(port, &joy_idx))
return false;
if (!drv || !drv->set_rumble)
return false;
@ -1613,99 +1613,99 @@ int16_t input_joypad_analog(const input_device_driver_t *drv,
unsigned port, unsigned idx, unsigned ident,
const struct retro_keybind *binds)
{
int16_t res;
int16_t res;
if ( idx == RETRO_DEVICE_INDEX_ANALOG_BUTTON )
{
/* A RETRO_DEVICE_JOYPAD button? */
if ( ident < RARCH_FIRST_CUSTOM_BIND )
{
uint32_t axis = 0;
const struct retro_keybind *bind = NULL;
if ( idx == RETRO_DEVICE_INDEX_ANALOG_BUTTON )
{
/* A RETRO_DEVICE_JOYPAD button? */
if ( ident < RARCH_FIRST_CUSTOM_BIND )
{
uint32_t axis = 0;
const struct retro_keybind *bind = NULL;
bind = &binds[ ident ];
if (!bind->valid)
return 0;
bind = &binds[ ident ];
if (!bind->valid)
return 0;
axis = bind->joyaxis;
if ( axis == AXIS_NONE )
axis = joypad_info.auto_binds[ ident ].joyaxis;
axis = bind->joyaxis;
if ( axis == AXIS_NONE )
axis = joypad_info.auto_binds[ ident ].joyaxis;
/* Analog button. */
res = abs( drv->axis( joypad_info.joy_idx, axis ) );
/* Analog button. */
res = abs( drv->axis( joypad_info.joy_idx, axis ) );
/* If the result is zero, it's got a digital button attached to it */
if ( res == 0 )
{
uint64_t key = bind->joykey;
/* If the result is zero, it's got a digital button attached to it */
if ( res == 0 )
{
uint64_t key = bind->joykey;
if ( key == NO_BTN )
key = joypad_info.auto_binds[ ident ].joykey;
if ( key == NO_BTN )
key = joypad_info.auto_binds[ ident ].joykey;
if ( drv->button(joypad_info.joy_idx, (uint16_t)key))
res = 0x7fff;
}
}
else
{
/* not a suitable button */
res = 0;
}
}
else
{
/* Analog sticks. Either RETRO_DEVICE_INDEX_ANALOG_LEFT
* or RETRO_DEVICE_INDEX_ANALOG_RIGHT */
if ( drv->button(joypad_info.joy_idx, (uint16_t)key))
res = 0x7fff;
}
}
else
{
/* not a suitable button */
res = 0;
}
}
else
{
/* Analog sticks. Either RETRO_DEVICE_INDEX_ANALOG_LEFT
* or RETRO_DEVICE_INDEX_ANALOG_RIGHT */
uint32_t axis_minus, axis_plus;
int16_t pressed_minus, pressed_plus;
unsigned ident_minus = 0;
unsigned ident_plus = 0;
const struct retro_keybind *bind_minus = NULL;
const struct retro_keybind *bind_plus = NULL;
uint32_t axis_minus, axis_plus;
int16_t pressed_minus, pressed_plus;
unsigned ident_minus = 0;
unsigned ident_plus = 0;
const struct retro_keybind *bind_minus = NULL;
const struct retro_keybind *bind_plus = NULL;
input_conv_analog_id_to_bind_id(idx, ident, &ident_minus, &ident_plus);
input_conv_analog_id_to_bind_id(idx, ident, &ident_minus, &ident_plus);
bind_minus = &binds[ident_minus];
bind_plus = &binds[ident_plus];
bind_minus = &binds[ident_minus];
bind_plus = &binds[ident_plus];
if (!bind_minus->valid || !bind_plus->valid)
return 0;
if (!bind_minus->valid || !bind_plus->valid)
return 0;
axis_minus = bind_minus->joyaxis;
axis_plus = bind_plus->joyaxis;
axis_minus = bind_minus->joyaxis;
axis_plus = bind_plus->joyaxis;
if (axis_minus == AXIS_NONE)
axis_minus = joypad_info.auto_binds[ident_minus].joyaxis;
if (axis_plus == AXIS_NONE)
axis_plus = joypad_info.auto_binds[ident_plus].joyaxis;
if (axis_minus == AXIS_NONE)
axis_minus = joypad_info.auto_binds[ident_minus].joyaxis;
if (axis_plus == AXIS_NONE)
axis_plus = joypad_info.auto_binds[ident_plus].joyaxis;
pressed_minus = abs(drv->axis(joypad_info.joy_idx, axis_minus));
pressed_plus = abs(drv->axis(joypad_info.joy_idx, axis_plus));
res = pressed_plus - pressed_minus;
pressed_minus = abs(drv->axis(joypad_info.joy_idx, axis_minus));
pressed_plus = abs(drv->axis(joypad_info.joy_idx, axis_plus));
res = pressed_plus - pressed_minus;
if (res == 0)
{
int16_t digital_left = 0;
int16_t digital_right = 0;
uint64_t key_minus = bind_minus->joykey;
uint64_t key_plus = bind_plus->joykey;
if (res == 0)
{
int16_t digital_left = 0;
int16_t digital_right = 0;
uint64_t key_minus = bind_minus->joykey;
uint64_t key_plus = bind_plus->joykey;
if (key_minus == NO_BTN)
key_minus = joypad_info.auto_binds[ident_minus].joykey;
if (key_plus == NO_BTN)
key_plus = joypad_info.auto_binds[ident_plus].joykey;
if (key_minus == NO_BTN)
key_minus = joypad_info.auto_binds[ident_minus].joykey;
if (key_plus == NO_BTN)
key_plus = joypad_info.auto_binds[ident_plus].joykey;
if (drv->button(joypad_info.joy_idx, (uint16_t)key_minus))
digital_left = -0x7fff;
if (drv->button(joypad_info.joy_idx, (uint16_t)key_plus))
digital_right = 0x7fff;
if (drv->button(joypad_info.joy_idx, (uint16_t)key_minus))
digital_left = -0x7fff;
if (drv->button(joypad_info.joy_idx, (uint16_t)key_plus))
digital_right = 0x7fff;
return digital_right + digital_left;
}
}
return digital_right + digital_left;
}
}
return res;
return res;
}
/**
@ -1770,24 +1770,24 @@ bool input_joypad_hat_raw(const input_device_driver_t *drv,
**/
bool input_mouse_button_raw(unsigned port, unsigned id)
{
int16_t res;
rarch_joypad_info_t joypad_info;
settings_t *settings = config_get_ptr();
int16_t res;
rarch_joypad_info_t joypad_info;
settings_t *settings = config_get_ptr();
/*ignore axes*/
if ( id == RETRO_DEVICE_ID_MOUSE_X || id == RETRO_DEVICE_ID_MOUSE_Y )
return false;
/*ignore axes*/
if ( id == RETRO_DEVICE_ID_MOUSE_X || id == RETRO_DEVICE_ID_MOUSE_Y )
return false;
joypad_info.axis_threshold = input_driver_axis_threshold;
joypad_info.joy_idx = settings->uints.input_joypad_map[port];
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
joypad_info.axis_threshold = input_driver_axis_threshold;
joypad_info.joy_idx = settings->uints.input_joypad_map[port];
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
res = current_input->input_state(current_input_data,
joypad_info, libretro_input_binds, port, RETRO_DEVICE_MOUSE, 0, id);
res = current_input->input_state(current_input_data,
joypad_info, libretro_input_binds, port, RETRO_DEVICE_MOUSE, 0, id);
if (res)
return true;
return false;
if (res)
return true;
return false;
}
/**
@ -2024,8 +2024,8 @@ bool input_keyboard_line_append(const char *word)
unsigned i = 0;
unsigned len = (unsigned)strlen(word);
char *newbuf = (char*)
realloc(g_keyboard_line->buffer,
g_keyboard_line->size + len*2);
realloc(g_keyboard_line->buffer,
g_keyboard_line->size + len*2);
if (!newbuf)
return false;
@ -2459,26 +2459,26 @@ void input_config_parse_joy_axis(void *data, const char *prefix,
void input_config_parse_mouse_button(void *data, const char *prefix,
const char *btn, struct retro_keybind *bind)
{
int val;
char str[256];
char tmp[64];
char key[64];
config_file_t *conf = (config_file_t*)data;
int val;
char str[256];
char tmp[64];
char key[64];
config_file_t *conf = (config_file_t*)data;
str[0] = tmp[0] = key[0] = '\0';
str[0] = tmp[0] = key[0] = '\0';
fill_pathname_join_delim(str, prefix, btn,
'_', sizeof(str));
fill_pathname_join_delim(key, str,
"mbtn", '_', sizeof(key));
fill_pathname_join_delim(str, prefix, btn,
'_', sizeof(str));
fill_pathname_join_delim(key, str,
"mbtn", '_', sizeof(key));
if ( bind && config_get_array(conf, key, tmp, sizeof(tmp)) )
{
bind->mbutton = NO_BTN;
if ( bind && config_get_array(conf, key, tmp, sizeof(tmp)) )
{
bind->mbutton = NO_BTN;
if ( tmp[0]=='w' )
{
switch ( tmp[1] )
if ( tmp[0]=='w' )
{
switch ( tmp[1] )
{
case 'u':
bind->mbutton = RETRO_DEVICE_ID_MOUSE_WHEELUP;
@ -2498,30 +2498,30 @@ void input_config_parse_mouse_button(void *data, const char *prefix,
}
break;
}
}
else
{
val = atoi(tmp);
switch ( val )
}
else
{
val = atoi(tmp);
switch ( val )
{
case 1:
case 1:
bind->mbutton = RETRO_DEVICE_ID_MOUSE_LEFT;
break;
case 2:
case 2:
bind->mbutton = RETRO_DEVICE_ID_MOUSE_RIGHT;
break;
case 3:
case 3:
bind->mbutton = RETRO_DEVICE_ID_MOUSE_MIDDLE;
break;
case 4:
case 4:
bind->mbutton = RETRO_DEVICE_ID_MOUSE_BUTTON_4;
break;
case 5:
case 5:
bind->mbutton = RETRO_DEVICE_ID_MOUSE_BUTTON_5;
break;
}
}
}
}
}
}
}
static void input_config_get_bind_string_joykey(
@ -2604,7 +2604,7 @@ static void input_config_get_bind_string_joyaxis(char *buf, const char *prefix,
void input_config_get_bind_string(char *buf, const struct retro_keybind *bind,
const struct retro_keybind *auto_bind, size_t size)
{
int delim = 0;
int delim = 0;
#ifndef RARCH_CONSOLE
char key[64];
char keybuf[64];
@ -2623,7 +2623,7 @@ void input_config_get_bind_string(char *buf, const struct retro_keybind *bind,
input_config_get_bind_string_joyaxis(buf, "Auto: ", auto_bind, size);
if (*buf)
delim = 1;
delim = 1;
#ifndef RARCH_CONSOLE
input_keymaps_translate_rk_to_str(bind->key, key, sizeof(key));
@ -2640,10 +2640,10 @@ void input_config_get_bind_string(char *buf, const struct retro_keybind *bind,
}
#endif
if ( bind->mbutton != NO_BTN )
{
int tag = 0;
switch ( bind->mbutton )
if ( bind->mbutton != NO_BTN )
{
int tag = 0;
switch ( bind->mbutton )
{
case RETRO_DEVICE_ID_MOUSE_LEFT:
tag = MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_LEFT;
@ -2674,17 +2674,17 @@ void input_config_get_bind_string(char *buf, const struct retro_keybind *bind,
break;
} /* switch ( bind->mbutton ) */
if (tag != 0)
{
if (delim)
strlcat(buf, ", ", size);
strlcat(buf, msg_hash_to_str((enum msg_hash_enums)tag), size );
}
}
if (tag != 0)
{
if (delim)
strlcat(buf, ", ", size);
strlcat(buf, msg_hash_to_str((enum msg_hash_enums)tag), size );
}
}
/*completely empty?*/
if ( *buf == '\0' )
strlcat(buf, "---", size);
strlcat(buf, "---", size);
}
const char *input_config_get_device_name(unsigned port)
@ -2782,7 +2782,7 @@ void input_config_reset(void)
for (i = 1; i < MAX_USERS; i++)
memcpy(input_config_binds[i], retro_keybinds_rest,
sizeof(retro_keybinds_rest));
for (i = 0; i < MAX_USERS; i++)
{
input_config_vid[i] = 0;