Style nits

This commit is contained in:
twinaphex 2019-07-16 14:34:37 +02:00
parent de8baf7bec
commit bf80376d27
4 changed files with 82 additions and 70 deletions

View File

@ -341,38 +341,38 @@ static unsigned menu_ticker_type = TICKER_TYPE_BOUNCE;
static float menu_ticker_speed = 1.0f;
#if defined(HAVE_THREADS)
static bool menu_savestate_resume = true;
static bool menu_savestate_resume = true;
#else
static bool menu_savestate_resume = false;
static bool menu_savestate_resume = false;
#endif
static bool content_show_settings = true;
static bool content_show_favorites = true;
static bool content_show_settings = true;
static bool content_show_favorites = true;
#ifdef HAVE_IMAGEVIEWER
static bool content_show_images = true;
static bool content_show_images = true;
#endif
static bool content_show_music = true;
static bool content_show_music = true;
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
static bool content_show_video = true;
static bool content_show_video = true;
#endif
#ifdef HAVE_NETWORKING
static bool content_show_netplay = true;
static bool content_show_netplay = true;
#endif
static bool content_show_history = true;
static bool content_show_history = true;
#ifdef HAVE_LIBRETRODB
static bool content_show_add = true;
static bool content_show_add = true;
#endif
static bool content_show_playlists = true;
static bool content_show_playlists = true;
#ifdef HAVE_XMB
static unsigned xmb_scale_factor = 100;
static unsigned xmb_alpha_factor = 75;
static unsigned menu_font_color_red = 255;
static unsigned xmb_scale_factor = 100;
static unsigned xmb_alpha_factor = 75;
static unsigned menu_font_color_red = 255;
static unsigned menu_font_color_green = 255;
static unsigned menu_font_color_blue = 255;
static unsigned xmb_menu_layout = 0;
static unsigned xmb_icon_theme = XMB_ICON_THEME_MONOCHROME;
static unsigned xmb_theme = XMB_THEME_ELECTRIC_BLUE;
static unsigned menu_font_color_blue = 255;
static unsigned xmb_menu_layout = 0;
static unsigned xmb_icon_theme = XMB_ICON_THEME_MONOCHROME;
static unsigned xmb_theme = XMB_THEME_ELECTRIC_BLUE;
#if defined(HAVE_LAKKA) || defined(__arm__) || defined(__PPC64__) || defined(__ppc64__) || defined(__powerpc64__) || defined(__powerpc__) || defined(__ppc__) || defined(__POWERPC__)
#define DEFAULT_XMB_SHADOWS_ENABLE false
@ -796,15 +796,15 @@ static const unsigned libretro_log_level = 1;
/* Axis threshold (between 0.0 and 1.0)
* How far an axis must be tilted to result in a button press. */
static const float axis_threshold = 0.5f;
static const float axis_threshold = 0.5f;
static const float analog_deadzone = 0.0f;
static const float analog_deadzone = 0.0f;
static const float analog_sensitivity = 1.0f;
static const float analog_sensitivity = 1.0f;
/* Describes speed of which turbo-enabled buttons toggle. */
static const unsigned turbo_period = 6;
static const unsigned turbo_duty_cycle = 3;
static const unsigned turbo_period = 6;
static const unsigned turbo_duty_cycle = 3;
/* Enable input auto-detection. Will attempt to autoconfigure
* gamepads, plug-and-play style. */

View File

@ -44,9 +44,8 @@ static bool is_analog_enabled(struct padButtonStatus buttons)
{
bool enabled = false;
if (buttons.ljoy_h || buttons.ljoy_v || buttons.rjoy_h || buttons.rjoy_v) {
if (buttons.ljoy_h || buttons.ljoy_v || buttons.rjoy_h || buttons.rjoy_v)
enabled = true;
}
return enabled;
}
@ -73,12 +72,12 @@ static bool ps2_joypad_init(void *data)
port,
0,
0);
if (!auto_configure) {
if (!auto_configure)
input_config_set_device_name(port, ps2_joypad_name(port));
}
/* Port 0 -> Connector 1, Port 1 -> Connector 2 */
if((ret = padPortOpen(port, PS2_PAD_SLOT, padBuf[port])) == 0) {
if((ret = padPortOpen(port, PS2_PAD_SLOT, padBuf[port])) == 0)
{
printf("padOpenPort failed: %d\n", ret);
init = false;
break;
@ -151,11 +150,14 @@ static void ps2_joypad_poll(void)
unsigned player;
struct padButtonStatus buttons;
for (player = 0; player < PS2_MAX_PADS; player++) {
for (player = 0; player < PS2_MAX_PADS; player++)
{
int state = padGetState(player, PS2_PAD_SLOT);
if (state == PAD_STATE_STABLE) {
if (state == PAD_STATE_STABLE)
{
int ret = padRead(player, PS2_PAD_SLOT, &buttons); /* port, slot, buttons */
if (ret != 0) {
if (ret != 0)
{
int32_t state_tmp = 0xffff ^ buttons.btns;
pad_state[player] = 0;
@ -177,7 +179,8 @@ static void ps2_joypad_poll(void)
pad_state[player] |= (state_tmp & PAD_L3) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_L3) : 0;
/* Analog */
if (is_analog_enabled(buttons)) {
if (is_analog_enabled(buttons))
{
analog_state[player][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_X] = convert_u8_to_s16(buttons.ljoy_h);
analog_state[player][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_Y] = convert_u8_to_s16(buttons.ljoy_v);;
analog_state[player][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_X] = convert_u8_to_s16(buttons.rjoy_h);;
@ -204,9 +207,8 @@ static bool ps2_joypad_rumble(unsigned pad,
static void ps2_joypad_destroy(void)
{
unsigned port;
for (port = 0; port < PS2_MAX_PADS; port++) {
for (port = 0; port < PS2_MAX_PADS; port++)
padPortClose(port, PS2_PAD_SLOT);
}
}
input_device_driver_t ps2_joypad = {

View File

@ -96,7 +96,8 @@ static bool ps4_joypad_init(void *data)
{
int index = 0;
while(index < num_players){
while (index < num_players)
{
ds_joypad_states[index].userId = userId;
index++;
}
@ -105,22 +106,23 @@ static bool ps4_joypad_init(void *data)
{
ds_joypad_states[num_players].handle = scePadOpen(userId, 0, 0, NULL);
RARCH_LOG("USER %x HANDLE %x\n", userId, ds_joypad_states[num_players].handle);
if (ds_joypad_states[num_players].handle > 0){
if (ds_joypad_states[num_players].handle > 0)
{
ds_joypad_states[num_players].connected = true;
ds_joypad_states[num_players].userId = userId;
RARCH_LOG("NEW PAD: num_players %x \n", num_players);
bool auto_configure = input_autoconfigure_connect( ps4_joypad_name(num_players),
NULL,
ps4_joypad.ident,
num_players,
0,
0);
if (!auto_configure) {
bool auto_configure = input_autoconfigure_connect(
ps4_joypad_name(num_players),
NULL,
ps4_joypad.ident,
num_players,
0,
0);
if (!auto_configure)
input_config_set_device_name(num_players, ps4_joypad_name(num_players));
}
num_players++;
}
}
}
}
@ -164,8 +166,8 @@ static void ps4_joypad_poll(void)
unsigned j, k;
unsigned i = player;
unsigned p = player;
int ret = scePadReadState(ds_joypad_states[player].handle,&buttons);
int ret = scePadReadState(ds_joypad_states[player].handle,&buttons);
if (ret == 0)
{
int32_t state_tmp = buttons.buttons;

View File

@ -49,14 +49,15 @@ static const char *switch_joypad_name(unsigned pad)
static void switch_joypad_autodetect_add(unsigned autoconf_pad)
{
if(!input_autoconfigure_connect(
if (!input_autoconfigure_connect(
switch_joypad_name(autoconf_pad), /* name */
NULL, /* display name */
switch_joypad.ident, /* driver */
autoconf_pad, /* idx */
0, /* vid */
0)) /* pid */
input_config_set_device_name(autoconf_pad, switch_joypad_name(autoconf_pad));
input_config_set_device_name(autoconf_pad,
switch_joypad_name(autoconf_pad));
}
static bool switch_joypad_init(void *data)
@ -65,7 +66,8 @@ static bool switch_joypad_init(void *data)
unsigned i;
hidScanInput();
// Switch like stop behavior with muted band channels and frequencies set to default.
/* Switch like stop behavior with muted band channels
* and frequencies set to default. */
vibration_stop.amp_low = 0.0f;
vibration_stop.freq_low = 160.0f;
vibration_stop.amp_high = 0.0f;
@ -90,7 +92,7 @@ static bool switch_joypad_init(void *data)
static bool switch_joypad_button(unsigned port_num, uint16_t key)
{
if(port_num >= MAX_PADS)
if (port_num >= MAX_PADS)
return false;
#if 0
@ -102,7 +104,7 @@ static bool switch_joypad_button(unsigned port_num, uint16_t key)
static void switch_joypad_get_buttons(unsigned port_num, input_bits_t *state)
{
if(port_num < MAX_PADS)
if (port_num < MAX_PADS)
{
BITS_COPY16_PTR(state, pad_state[port_num]);
}
@ -114,22 +116,22 @@ static void switch_joypad_get_buttons(unsigned port_num, input_bits_t *state)
static int16_t switch_joypad_axis(unsigned port_num, uint32_t joyaxis)
{
int val = 0;
int axis = -1;
int val = 0;
int axis = -1;
bool is_neg = false;
bool is_pos = false;
if(joyaxis == AXIS_NONE || port_num >= MAX_PADS)
{
/* TODO/FIXME - implement */
}
#if 0
/* TODO/FIXME - implement */
if (joyaxis == AXIS_NONE || port_num >= MAX_PADS) { }
#endif
if(AXIS_NEG_GET(joyaxis) < 4)
if (AXIS_NEG_GET(joyaxis) < 4)
{
axis = AXIS_NEG_GET(joyaxis);
is_neg = true;
}
else if(AXIS_POS_GET(joyaxis) < 4)
else if (AXIS_POS_GET(joyaxis) < 4)
{
axis = AXIS_POS_GET(joyaxis);
is_pos = true;
@ -151,9 +153,9 @@ static int16_t switch_joypad_axis(unsigned port_num, uint32_t joyaxis)
break;
}
if(is_neg && val > 0)
if (is_neg && val > 0)
val = 0;
else if(is_pos && val < 0)
else if (is_pos && val < 0)
val = 0;
return val;
@ -170,8 +172,10 @@ static void switch_joypad_destroy(void)
unsigned i;
for (i = 0; i < MAX_PADS; i++)
{
memcpy(&vibration_values[i][0], &vibration_stop, sizeof(HidVibrationValue));
memcpy(&vibration_values[i][1], &vibration_stop, sizeof(HidVibrationValue));
memcpy(&vibration_values[i][0],
&vibration_stop, sizeof(HidVibrationValue));
memcpy(&vibration_values[i][1],
&vibration_stop, sizeof(HidVibrationValue));
hidSendVibrationValues(vibration_handles[i], vibration_values[i], 2);
}
hidSendVibrationValues(vibration_handleheld, vibration_values[0], 2);
@ -181,7 +185,7 @@ static void switch_joypad_destroy(void)
}
#ifdef HAVE_LIBNX
int lastMode = 0; // 0 = handheld, 1 = whatever
int lastMode = 0; /* 0 = handheld, 1 = whatever */
static void switch_joypad_poll(void)
{
settings_t *settings = config_get_ptr();
@ -192,9 +196,11 @@ static void switch_joypad_poll(void)
{
if (lastMode != 1)
{
int i = 0;
for(i = 0; i < MAX_USERS; i += 2){
if(settings->uints.input_split_joycon[i]) // CONTROLLER_PLAYER_X, X == i++
unsigned i = 0;
for(i = 0; i < MAX_USERS; i += 2)
{
/* CONTROLLER_PLAYER_X, X == i++ */
if (settings->uints.input_split_joycon[i])
{
hidSetNpadJoyAssignmentModeSingleByDefault(i);
hidSetNpadJoyAssignmentModeSingleByDefault(i + 1);
@ -209,8 +215,10 @@ static void switch_joypad_poll(void)
if (lastMode != 0)
{
int i = 0;
for(i = 0; i < MAX_USERS; i += 2){
if(settings->uints.input_split_joycon[i]) // CONTROLLER_PLAYER_X, X == i++
for(i = 0; i < MAX_USERS; i += 2)
{
/* CONTROLLER_PLAYER_X, X == i++ */
if (settings->uints.input_split_joycon[i])
{
hidSetNpadJoyAssignmentModeDual(i);
hidSetNpadJoyAssignmentModeDual(i + 1);
@ -281,7 +289,7 @@ bool switch_joypad_set_rumble(unsigned pad,
return false;
amp = (float)strength / 65535.0f;
amp *= 0.5f; // Max strength is too strong
amp *= 0.5f; /* Max strength is too strong */
if (type == RETRO_RUMBLE_STRONG)
{
vibration_values[pad][0].amp_low = amp;