(input_driver.c) Style nits

This commit is contained in:
LibretroAdmin 2025-01-18 03:11:24 +01:00
parent aefadc04c7
commit 9bff7168e8

View File

@ -523,10 +523,8 @@ bool input_driver_set_sensor(
port, action, rate);
}
else if (input_driver_st.primary_joypad && input_driver_st.primary_joypad->set_sensor_state)
{
return input_driver_st.primary_joypad->set_sensor_state(NULL,
port, action, rate);
}
return false;
}
@ -545,10 +543,8 @@ float input_driver_get_sensor(
}
else if (sensors_enable && input_driver_st.primary_joypad &&
input_driver_st.primary_joypad->get_sensor_input)
{
return input_driver_st.primary_joypad->get_sensor_input(NULL,
port, id);
}
}
return 0.0f;
@ -647,10 +643,10 @@ static bool input_driver_button_combo_hold(
bool input_driver_pointer_is_offscreen(int16_t x, int16_t y)
{
const int edge_detect = 32700;
if ((x >= -edge_detect) &&
(y >= -edge_detect) &&
(x <= edge_detect) &&
(y <= edge_detect))
if ( (x >= -edge_detect)
&& (y >= -edge_detect)
&& (x <= edge_detect)
&& (y <= edge_detect))
return false;
return true;
}
@ -769,7 +765,7 @@ static int32_t input_state_wrap(
unsigned idx,
unsigned id)
{
int32_t ret = 0;
int32_t ret = 0;
if (!binds)
return 0;
@ -781,11 +777,9 @@ static int32_t input_state_wrap(
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
if (joypad)
ret |= joypad->state(
joypad_info, binds[_port], _port);
ret |= joypad->state(joypad_info, binds[_port], _port);
if (sec_joypad)
ret |= sec_joypad->state(
joypad_info, binds[_port], _port);
ret |= sec_joypad->state(joypad_info, binds[_port], _port);
}
else
{
@ -857,7 +851,7 @@ static int16_t input_joypad_axis(
const input_device_driver_t *drv,
unsigned port, uint32_t joyaxis, float normal_mag)
{
int16_t val = (joyaxis != AXIS_NONE) ? drv->axis(port, joyaxis) : 0;
int16_t val = (joyaxis != AXIS_NONE) ? drv->axis(port, joyaxis) : 0;
if (input_analog_deadzone)
{
@ -878,14 +872,11 @@ static int16_t input_joypad_axis(
if (input_analog_sensitivity != 1.0f)
{
float normalized = (1.0f / 0x7fff) * val;
int new_val = 0x7fff * normalized *
input_analog_sensitivity;
int new_val = 0x7fff * normalized * input_analog_sensitivity;
if (new_val > 0x7fff)
return 0x7fff;
else if (new_val < -0x7fff)
return -0x7fff;
return new_val;
}
@ -919,9 +910,9 @@ static int16_t input_joypad_analog_button(
unsigned ident,
const struct retro_keybind *bind)
{
int16_t res = 0;
float normal_mag = 0.0f;
uint32_t axis = (bind->joyaxis == AXIS_NONE)
int16_t res = 0;
float normal_mag = 0.0f;
uint32_t axis = (bind->joyaxis == AXIS_NONE)
? joypad_info->auto_binds[ident].joyaxis
: bind->joyaxis;
@ -998,8 +989,8 @@ static int16_t input_joypad_analog_axis(
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;
@ -1134,8 +1125,7 @@ void input_keyboard_line_append(
const char *word, size_t len)
{
size_t i;
char *newbuf = (char*)realloc(
keyboard_line->buffer,
char *newbuf = (char*)realloc(keyboard_line->buffer,
keyboard_line->size + len * 2);
if (!newbuf)
@ -1195,34 +1185,34 @@ const char **input_keyboard_start_line(
}
#ifdef HAVE_OVERLAY
static int16_t input_overlay_device_mouse_state(input_overlay_t *ol, unsigned id)
static int16_t input_overlay_device_mouse_state(
input_overlay_t *ol, unsigned id)
{
input_overlay_pointer_state_t *ptr_st = &ol->pointer_state;
int16_t res;
input_overlay_pointer_state_t *ptr_st = &ol->pointer_state;
switch(id)
{
case RETRO_DEVICE_ID_MOUSE_X:
ptr_st->device_mask |= (1 << RETRO_DEVICE_MOUSE);
res = ptr_st->mouse.scale_x
res = (ptr_st->mouse.scale_x)
* (ptr_st->screen_x - ptr_st->mouse.prev_screen_x);
ptr_st->mouse.prev_screen_x = ptr_st->screen_x;
return res;
case RETRO_DEVICE_ID_MOUSE_Y:
res = ptr_st->mouse.scale_y
res = (ptr_st->mouse.scale_y)
* (ptr_st->screen_y - ptr_st->mouse.prev_screen_y);
ptr_st->mouse.prev_screen_y = ptr_st->screen_y;
return res;
case RETRO_DEVICE_ID_MOUSE_LEFT:
return (ptr_st->mouse.click & 0x1) ||
(ptr_st->mouse.hold & 0x1);
return (ptr_st->mouse.click & 0x1)
|| (ptr_st->mouse.hold & 0x1);
case RETRO_DEVICE_ID_MOUSE_RIGHT:
return (ptr_st->mouse.click & 0x2) ||
(ptr_st->mouse.hold & 0x2);
return (ptr_st->mouse.click & 0x2)
|| (ptr_st->mouse.hold & 0x2);
case RETRO_DEVICE_ID_MOUSE_MIDDLE:
return (ptr_st->mouse.click & 0x4) ||
(ptr_st->mouse.hold & 0x4);
return (ptr_st->mouse.click & 0x4)
|| (ptr_st->mouse.hold & 0x4);
default:
break;
}
@ -1285,7 +1275,7 @@ static int16_t input_overlay_pointer_state(input_overlay_t *ol,
input_overlay_pointer_state_t *ptr_st,
unsigned idx, unsigned id)
{
ptr_st->device_mask |= (1 << RETRO_DEVICE_POINTER);
ptr_st->device_mask |= (1 << RETRO_DEVICE_POINTER);
switch (id)
{
@ -1504,8 +1494,9 @@ static int16_t input_state_device(
* > 'id' is not equal to remapped button index
* If these conditions are met, input here
* is ignored */
if ((menu_driver_alive || !input_remap_binds_enable) ||
(id == remap_button))
if ( (menu_driver_alive
|| !input_remap_binds_enable)
|| (id == remap_button))
res |= 1;
}
#endif
@ -5714,15 +5705,13 @@ static void input_keys_pressed(
if (!libretro_input_pressed)
{
bool keyboard_menu_pressed = false;
/* Ignore keyboard menu toggle button and check
* joypad menu toggle button for pressing
* it without 'enable_hotkey', because Guide button
* is not part of the usual buttons. */
i = RARCH_MENU_TOGGLE;
keyboard_menu_pressed = binds[port][i].valid
if (!(binds[port][i].valid
&& input_state_wrap(
input_st->current_driver,
input_st->current_data,
@ -5732,9 +5721,7 @@ static void input_keys_pressed(
binds,
(input_st->flags & INP_FLAG_KB_MAPPING_BLOCKED) ? true : false,
port, RETRO_DEVICE_KEYBOARD, 0,
input_config_binds[port][i].key);
if (!keyboard_menu_pressed)
input_config_binds[port][i].key)))
{
bool bit_pressed = binds[port][i].valid
&& input_state_wrap(
@ -5922,7 +5909,8 @@ static void input_keys_pressed(
/* Forward declaration */
void bsv_movie_free(bsv_movie_t*);
void bsv_movie_enqueue(input_driver_state_t *input_st, bsv_movie_t * state, enum bsv_flags flags)
void bsv_movie_enqueue(input_driver_state_t *input_st,
bsv_movie_t * state, enum bsv_flags flags)
{
if (input_st->bsv_movie_state_next_handle)
bsv_movie_free(input_st->bsv_movie_state_next_handle);
@ -5949,7 +5937,8 @@ void bsv_movie_frame_rewind(void)
{
input_driver_state_t *input_st = &input_driver_st;
bsv_movie_t *handle = input_st->bsv_movie_state_handle;
bool recording = (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_RECORDING) ? true : false;
bool recording = (input_st->bsv_movie_state.flags
& BSV_FLAG_MOVIE_RECORDING) ? true : false;
if (!handle)
return;
@ -5991,7 +5980,12 @@ void bsv_movie_frame_rewind(void)
{
/* We rewound past the beginning. */
if (!handle->playback)
if (handle->playback)
{
intfstream_seek(handle->file, (int)handle->min_file_pos, SEEK_SET);
bsv_movie_read_next_events(handle);
}
else
{
retro_ctx_serialize_info_t serial_info;
@ -6008,25 +6002,9 @@ void bsv_movie_frame_rewind(void)
intfstream_write(handle->file, handle->state, handle->state_size);
}
else
{
intfstream_seek(handle->file, (int)handle->min_file_pos, SEEK_SET);
bsv_movie_read_next_events(handle);
}
}
}
/* Zero out key events when playing back or recording */
static void bsv_movie_handle_clear_key_events(bsv_movie_t *movie)
{
movie->key_event_count = 0;
}
/* Zero out input events when playing back or recording */
static void bsv_movie_handle_clear_input_events(bsv_movie_t *movie)
{
movie->input_event_count = 0;
}
void bsv_movie_handle_push_key_event(bsv_movie_t *movie,
uint8_t down, uint16_t mod, uint32_t code, uint32_t character)
{
@ -6039,8 +6017,9 @@ void bsv_movie_handle_push_key_event(bsv_movie_t *movie,
movie->key_events[movie->key_event_count] = data;
movie->key_event_count++;
}
void bsv_movie_handle_push_input_event(bsv_movie_t *movie,
uint8_t port, uint8_t dev, uint8_t idx, uint16_t id, int16_t val)
uint8_t port, uint8_t dev, uint8_t idx, uint16_t id, int16_t val)
{
bsv_input_data_t data;
data.port = port;
@ -6052,8 +6031,9 @@ void bsv_movie_handle_push_input_event(bsv_movie_t *movie,
movie->input_events[movie->input_event_count] = data;
movie->input_event_count++;
}
bool bsv_movie_handle_read_input_event(bsv_movie_t *movie,
uint8_t port, uint8_t dev, uint8_t idx, uint16_t id, int16_t* val)
uint8_t port, uint8_t dev, uint8_t idx, uint16_t id, int16_t* val)
{
int i;
/* if movie is old, just read two bytes and hope for the best */
@ -6066,10 +6046,10 @@ bool bsv_movie_handle_read_input_event(bsv_movie_t *movie,
for (i = 0; i < movie->input_event_count; i++)
{
bsv_input_data_t evt = movie->input_events[i];
if (evt.port == port &&
evt.device == dev &&
evt.idx == idx &&
evt.id == id)
if ( (evt.port == port)
&& (evt.device == dev)
&& (evt.idx == idx)
&& (evt.id == id))
{
*val = swap_if_big16(evt.value);
return true;
@ -6080,12 +6060,12 @@ bool bsv_movie_handle_read_input_event(bsv_movie_t *movie,
void bsv_movie_finish_rewind(input_driver_state_t *input_st)
{
bsv_movie_t *handle = input_st->bsv_movie_state_handle;
bsv_movie_t *handle = input_st->bsv_movie_state_handle;
if (!handle)
return;
handle->frame_counter += 1;
handle->first_rewind = !handle->did_rewind;
handle->did_rewind = false;
handle->first_rewind = !handle->did_rewind;
handle->did_rewind = false;
}
void bsv_movie_read_next_events(bsv_movie_t *handle)
@ -6096,7 +6076,8 @@ void bsv_movie_read_next_events(bsv_movie_t *handle)
int i;
for (i = 0; i < handle->key_event_count; i++)
{
if (intfstream_read(handle->file, &(handle->key_events[i]), sizeof(bsv_key_data_t)) != sizeof(bsv_key_data_t))
if (intfstream_read(handle->file, &(handle->key_events[i]),
sizeof(bsv_key_data_t)) != sizeof(bsv_key_data_t))
{
/* Unnatural EOF */
RARCH_ERR("[Replay] Keyboard replay ran out of keyboard inputs too early\n");
@ -6120,7 +6101,8 @@ void bsv_movie_read_next_events(bsv_movie_t *handle)
handle->input_event_count = swap_if_big16(handle->input_event_count);
for (i = 0; i < handle->input_event_count; i++)
{
if (intfstream_read(handle->file, &(handle->input_events[i]), sizeof(bsv_input_data_t)) != sizeof(bsv_input_data_t))
if (intfstream_read(handle->file, &(handle->input_events[i]),
sizeof(bsv_input_data_t)) != sizeof(bsv_input_data_t))
{
/* Unnatural EOF */
RARCH_ERR("[Replay] Input replay ran out of inputs too early\n");
@ -6140,24 +6122,22 @@ void bsv_movie_read_next_events(bsv_movie_t *handle)
{
uint8_t next_frame_type=REPLAY_TOKEN_INVALID;
if (intfstream_read(handle->file, (uint8_t *)(&next_frame_type), sizeof(uint8_t)) != sizeof(uint8_t))
if (intfstream_read(handle->file, (uint8_t *)(&next_frame_type),
sizeof(uint8_t)) != sizeof(uint8_t))
{
/* Unnatural EOF */
RARCH_ERR("[Replay] Replay ran out of frames\n");
input_st->bsv_movie_state.flags |= BSV_FLAG_MOVIE_END;
return;
}
else if (next_frame_type == REPLAY_TOKEN_REGULAR_FRAME)
{
/* do nothing */
}
else if (next_frame_type == REPLAY_TOKEN_CHECKPOINT_FRAME)
{
uint64_t size;
uint8_t *st;
retro_ctx_serialize_info_t serial_info;
if (intfstream_read(handle->file, &(size), sizeof(uint64_t)) != sizeof(uint64_t))
if (intfstream_read(handle->file, &(size),
sizeof(uint64_t)) != sizeof(uint64_t))
{
RARCH_ERR("[Replay] Replay ran out of frames\n");
input_st->bsv_movie_state.flags |= BSV_FLAG_MOVIE_END;
@ -6213,16 +6193,22 @@ void bsv_movie_next_frame(input_driver_state_t *input_st)
/* write key events, frame is over */
intfstream_write(handle->file, &(handle->key_event_count), 1);
for (i = 0; i < handle->key_event_count; i++)
intfstream_write(handle->file, &(handle->key_events[i]), sizeof(bsv_key_data_t));
bsv_movie_handle_clear_key_events(handle);
intfstream_write(handle->file, &(handle->key_events[i]),
sizeof(bsv_key_data_t));
/* Zero out key events when playing back or recording */
handle->key_event_count = 0;
/* write input events, frame is over */
intfstream_write(handle->file, &evt_count, 2);
for (i = 0; i < handle->input_event_count; i++)
intfstream_write(handle->file, &(handle->input_events[i]), sizeof(bsv_input_data_t));
bsv_movie_handle_clear_input_events(handle);
intfstream_write(handle->file, &(handle->input_events[i]),
sizeof(bsv_input_data_t));
/* Zero out input events when playing back or recording */
handle->input_event_count = 0;
/* Maybe record checkpoint */
if (checkpoint_interval != 0 && handle->frame_counter > 0 && (handle->frame_counter % (checkpoint_interval*60) == 0))
if ( (checkpoint_interval != 0)
&& (handle->frame_counter > 0)
&& (handle->frame_counter % (checkpoint_interval*60) == 0))
{
retro_ctx_serialize_info_t serial_info;
uint8_t frame_tok = REPLAY_TOKEN_CHECKPOINT_FRAME;
@ -6279,7 +6265,8 @@ bool replay_get_serialized_data(void* buffer)
intfstream_rewind(handle->file);
read_amt = intfstream_read(handle->file, (void *)buf, file_end);
if (read_amt != file_end)
RARCH_ERR("[Replay] Failed to write correct number of replay bytes into state file: %d / %d\n", read_amt, file_end);
RARCH_ERR("[Replay] Failed to write correct number of replay bytes into state file: %d / %d\n",
read_amt, file_end);
}
return true;
}
@ -6321,16 +6308,16 @@ bool replay_set_serialized_data(void* buf)
}
else
{
int32_t loaded_len = swap_if_big32(((int32_t *)buffer)[0]);
/* TODO: should factor the next few lines away, magic numbers ahoy */
uint32_t *header = (uint32_t *)(buffer+sizeof(int32_t));
int64_t *identifier_spot = (int64_t *)(header+4);
int64_t identifier = swap_if_big64(*identifier_spot);
int64_t handle_idx = intfstream_tell(input_st->bsv_movie_state_handle->file);
bool is_compatible = identifier == input_st->bsv_movie_state_handle->identifier;
uint32_t *header = (uint32_t *)(buffer + sizeof(int32_t));
int64_t *ident_spot = (int64_t *)(header + 4);
int64_t ident = swap_if_big64(*ident_spot);
if (is_compatible)
if (ident == input_st->bsv_movie_state_handle->identifier) /* is compatible? */
{
int32_t loaded_len = swap_if_big32(((int32_t *)buffer)[0]);
int64_t handle_idx = intfstream_tell(
input_st->bsv_movie_state_handle->file);
/* If the state is part of this replay, go back to that state
and rewind/fast forward the replay.
@ -6400,9 +6387,9 @@ void input_driver_poll(void)
bool input_remap_binds_enable = settings->bools.input_remap_binds_enable;
uint8_t max_users = (uint8_t)settings->uints.input_max_users;
if ( joypad && joypad->poll)
if (joypad && joypad->poll)
joypad->poll();
if ( sec_joypad && sec_joypad->poll)
if (sec_joypad && sec_joypad->poll)
sec_joypad->poll();
if ( input_st->current_driver
&& input_st->current_driver->poll)
@ -6422,23 +6409,17 @@ void input_driver_poll(void)
* when mapping analog stick to dpad input. */
for (i = 0; i < max_users; i++)
{
joypad_info[i].axis_threshold = settings->floats.input_axis_threshold;
joypad_info[i].joy_idx = settings->uints.input_joypad_index[i];
joypad_info[i].auto_binds = input_autoconf_binds[joypad_info[i].joy_idx];
joypad_info[i].axis_threshold = settings->floats.input_axis_threshold;
joypad_info[i].joy_idx = settings->uints.input_joypad_index[i];
joypad_info[i].auto_binds = input_autoconf_binds[joypad_info[i].joy_idx];
input_st->turbo_btns.frame_enable[i] = (*input_st->libretro_input_binds[i])[RARCH_TURBO_ENABLE].valid ?
input_state_wrap(
input_st->current_driver,
input_st->current_data,
joypad,
sec_joypad,
&joypad_info[i],
input_st->turbo_btns.frame_enable[i] = (*input_st->libretro_input_binds[i])[RARCH_TURBO_ENABLE].valid ?
input_state_wrap(input_st->current_driver, input_st->current_data,
joypad, sec_joypad, &joypad_info[i],
(*input_st->libretro_input_binds),
(input_st->flags & INP_FLAG_KB_MAPPING_BLOCKED) ? true : false,
(unsigned)i,
RETRO_DEVICE_JOYPAD,
0,
RARCH_TURBO_ENABLE) : 0;
RETRO_DEVICE_JOYPAD, 0, RARCH_TURBO_ENABLE) : 0;
}
#ifdef HAVE_OVERLAY
@ -6579,11 +6560,8 @@ void input_driver_poll(void)
input_analog_dpad_mode,
input_analog_deadzone,
input_analog_sensitivity,
joypad,
&joypad_info[i],
k,
j,
(*input_st->libretro_input_binds[i]));
joypad, &joypad_info[i],
k, j, (*input_st->libretro_input_binds[i]));
if (val >= 0)
p_new_state->analogs[offset] = val;
@ -6619,21 +6597,15 @@ void input_driver_poll(void)
* 32767;
}
else
{
current_button_value =
BIT256_GET_PTR(p_new_state, j);
}
current_button_value = BIT256_GET_PTR(p_new_state, j);
#ifdef HAVE_OVERLAY
if (poll_overlay && i == 0)
{
input_overlay_state_t *ol_state =
overlay_pointer
? &overlay_pointer->overlay_state
: NULL;
input_overlay_state_t *ol_state = overlay_pointer
? &overlay_pointer->overlay_state : NULL;
if (ol_state)
current_button_value |=
BIT256_GET(ol_state->buttons, j);
current_button_value |= BIT256_GET(ol_state->buttons, j);
}
#endif
/* Press */
@ -6687,12 +6659,11 @@ void input_driver_poll(void)
if (poll_overlay && i == 0)
{
input_overlay_state_t *ol_state =
overlay_pointer
overlay_pointer
? &overlay_pointer->overlay_state
: NULL;
if (ol_state)
current_button_value |=
BIT256_GET(ol_state->buttons, j);
current_button_value |= BIT256_GET(ol_state->buttons, j);
}
#endif
remap_valid =
@ -6760,8 +6731,8 @@ void input_driver_poll(void)
if (remap_axis_bind < sizeof(handle->analog_value[i]))
{
int invert = 1;
if ( (k % 2 == 0 && remap_axis % 2 != 0) ||
(k % 2 != 0 && remap_axis % 2 == 0)
if ( (k % 2 == 0 && remap_axis % 2 != 0)
|| (k % 2 != 0 && remap_axis % 2 == 0)
)
invert = -1;
@ -6851,10 +6822,13 @@ void input_driver_poll(void)
rcheevos_pause_hardcore();
#endif
k = input_st->bsv_movie_state_handle->key_events[i];
input_keyboard_event(k.down, swap_if_big32(k.code), swap_if_big32(k.character), swap_if_big16(k.mod), RETRO_DEVICE_KEYBOARD);
input_keyboard_event(k.down, swap_if_big32(k.code),
swap_if_big32(k.character), swap_if_big16(k.mod),
RETRO_DEVICE_KEYBOARD);
}
/* Have to clear here so we don't double-apply key events */
bsv_movie_handle_clear_key_events(input_st->bsv_movie_state_handle);
/* Zero out key events when playing back or recording */
input_st->bsv_movie_state_handle->key_event_count = 0;
}
}
#endif
@ -6874,12 +6848,7 @@ int16_t input_driver_state_wrapper(unsigned port, unsigned device,
int16_t bsv_result = 0;
bsv_movie_t *movie = input_st->bsv_movie_state_handle;
if (bsv_movie_handle_read_input_event(
movie,
port,
device,
idx,
id,
&bsv_result))
movie, port, device, idx, id, &bsv_result))
{
#ifdef HAVE_CHEEVOS
rcheevos_pause_hardcore();
@ -6904,7 +6873,6 @@ int16_t input_driver_state_wrapper(unsigned port, unsigned device,
#ifdef HAVE_BSV_MOVIE
/* Save input to BSV record, if enabled */
if (BSV_MOVIE_IS_RECORDING())
{
bsv_movie_handle_push_input_event(
input_st->bsv_movie_state_handle,
port,
@ -6912,7 +6880,6 @@ int16_t input_driver_state_wrapper(unsigned port, unsigned device,
idx,
id,
result);
}
#endif
return result;
@ -7174,7 +7141,6 @@ void input_driver_collect_system_input(input_driver_state_t *input_st,
#ifdef HAVE_MENU
if (menu_is_alive)
{
int16_t ret;
uint8_t s;
uint8_t a;
@ -7187,7 +7153,7 @@ void input_driver_collect_system_input(input_driver_state_t *input_st,
for (a = RETRO_DEVICE_ID_ANALOG_X; a <= RETRO_DEVICE_ID_ANALOG_Y; a++)
{
ret = input_joypad_analog_axis(
int16_t ret = input_joypad_analog_axis(
ANALOG_DPAD_NONE,
settings->floats.input_analog_deadzone,
settings->floats.input_analog_sensitivity,
@ -7443,20 +7409,20 @@ static const char *accessibility_lut_name(char key)
void input_keyboard_event(bool down, unsigned code,
uint32_t character, uint16_t mod, unsigned device)
{
runloop_state_t *runloop_st = runloop_state_get_ptr();
runloop_state_t *runloop_st = runloop_state_get_ptr();
retro_keyboard_event_t
*key_event = &runloop_st->key_event;
*key_event = &runloop_st->key_event;
input_driver_state_t
*input_st = &input_driver_st;
*input_st = &input_driver_st;
#ifdef HAVE_ACCESSIBILITY
access_state_t *access_st = access_state_get_ptr();
settings_t *settings = config_get_ptr();
bool accessibility_enable = settings->bools.accessibility_enable;
access_state_t *access_st = access_state_get_ptr();
settings_t *settings = config_get_ptr();
bool accessibility_enable = settings->bools.accessibility_enable;
unsigned accessibility_narrator_speech_speed
= settings->uints.accessibility_narrator_speech_speed;
= settings->uints.accessibility_narrator_speech_speed;
#endif
#ifdef HAVE_MENU
struct menu_state *menu_st = menu_state_get_ptr();
struct menu_state *menu_st = menu_state_get_ptr();
/* If screensaver is active, then it should be
* disabled if:
@ -7479,20 +7445,20 @@ void input_keyboard_event(bool down, unsigned code,
{
if ( (down)
&& (code != RETROK_UNKNOWN)
&& (menu_input_dialog_get_display_kb() ||
!((code == RETROK_SPACE) || /* RETRO_DEVICE_ID_JOYPAD_START */
(code == RETROK_SLASH) || /* RETRO_DEVICE_ID_JOYPAD_X */
(code == RETROK_RSHIFT) || /* RETRO_DEVICE_ID_JOYPAD_SELECT */
(code == RETROK_RIGHT) || /* RETRO_DEVICE_ID_JOYPAD_RIGHT */
(code == RETROK_LEFT) || /* RETRO_DEVICE_ID_JOYPAD_LEFT */
(code == RETROK_DOWN) || /* RETRO_DEVICE_ID_JOYPAD_DOWN */
(code == RETROK_UP) || /* RETRO_DEVICE_ID_JOYPAD_UP */
(code == RETROK_PAGEUP) || /* RETRO_DEVICE_ID_JOYPAD_L */
(code == RETROK_PAGEDOWN) || /* RETRO_DEVICE_ID_JOYPAD_R */
(code == RETROK_BACKSPACE)|| /* RETRO_DEVICE_ID_JOYPAD_B */
(code == RETROK_RETURN) || /* RETRO_DEVICE_ID_JOYPAD_A */
(code == RETROK_DELETE) || /* RETRO_DEVICE_ID_JOYPAD_Y */
BIT512_GET(input_st->keyboard_mapping_bits, code))))
&& (menu_input_dialog_get_display_kb()
|| !((code == RETROK_SPACE) /* RETRO_DEVICE_ID_JOYPAD_START */
|| (code == RETROK_SLASH) /* RETRO_DEVICE_ID_JOYPAD_X */
|| (code == RETROK_RSHIFT) /* RETRO_DEVICE_ID_JOYPAD_SELECT */
|| (code == RETROK_RIGHT) /* RETRO_DEVICE_ID_JOYPAD_RIGHT */
|| (code == RETROK_LEFT) /* RETRO_DEVICE_ID_JOYPAD_LEFT */
|| (code == RETROK_DOWN) /* RETRO_DEVICE_ID_JOYPAD_DOWN */
|| (code == RETROK_UP) /* RETRO_DEVICE_ID_JOYPAD_UP */
|| (code == RETROK_PAGEUP) /* RETRO_DEVICE_ID_JOYPAD_L */
|| (code == RETROK_PAGEDOWN) /* RETRO_DEVICE_ID_JOYPAD_R */
|| (code == RETROK_BACKSPACE) /* RETRO_DEVICE_ID_JOYPAD_B */
|| (code == RETROK_RETURN) /* RETRO_DEVICE_ID_JOYPAD_A */
|| (code == RETROK_DELETE) /* RETRO_DEVICE_ID_JOYPAD_Y */
|| (BIT512_GET(input_st->keyboard_mapping_bits, code)))))
{
struct menu_state *menu_st = menu_state_get_ptr();
menu_st->flags &= ~MENU_ST_FLAG_SCREENSAVER_ACTIVE;
@ -7508,9 +7474,9 @@ void input_keyboard_event(bool down, unsigned code,
menu_st->input_last_time_us = menu_st->current_time_us;
#ifdef HAVE_ACCESSIBILITY
if (menu_input_dialog_get_display_kb()
&& down && is_accessibility_enabled(
accessibility_enable,
if ( menu_input_dialog_get_display_kb()
&& down
&& is_accessibility_enabled(accessibility_enable,
access_st->enabled))
{
if (code != 303 && code != 0)
@ -7524,10 +7490,8 @@ void input_keyboard_event(bool down, unsigned code,
say_char[1] = '\0';
if (character == 127 || character == 8)
accessibility_speak_priority(
accessibility_enable,
accessibility_narrator_speech_speed,
"backspace", 10);
accessibility_speak_priority(accessibility_enable,
accessibility_narrator_speech_speed, "backspace", 10);
else
{
const char *lut_name = accessibility_lut_name(c);
@ -7580,7 +7544,7 @@ void input_keyboard_event(bool down, unsigned code,
input_keyboard_line_free(input_st);
/* Unblock all hotkeys. */
input_st->flags &= ~INP_FLAG_KB_MAPPING_BLOCKED;
input_st->flags &= ~INP_FLAG_KB_MAPPING_BLOCKED;
}
else
{
@ -7601,9 +7565,9 @@ void input_keyboard_event(bool down, unsigned code,
&& BIT512_GET(input_st->keyboard_mapping_bits, code)
&& device != RETRO_DEVICE_POINTER)
{
unsigned j;
settings_t *settings = config_get_ptr();
unsigned max_users = settings->uints.input_max_users;
unsigned j;
bool hotkey_pressed = (input_st->input_hotkey_block_counter > 0);
bool block_key_event = false;
@ -7617,9 +7581,9 @@ void input_keyboard_event(bool down, unsigned code,
* and only when modifier is a keyboard key. */
if ( j == 0
&& !block_key_event
&& !( !hotkey_pressed
&& hotkey_code != RETROK_UNKNOWN
&& hotkey_code != code))
&& !( !hotkey_pressed
&& hotkey_code != RETROK_UNKNOWN
&& hotkey_code != code))
{
for (k = RARCH_FIRST_META_KEY; k < RARCH_BIND_LIST_END; k++)
{
@ -7631,7 +7595,8 @@ void input_keyboard_event(bool down, unsigned code,
}
}
/* RetroPad blocking needed only when emulated device type is active. */
/* RetroPad blocking needed only when emulated
* device type is active. */
if ( input_config_get_device(j)
&& !block_key_event)
{
@ -7661,9 +7626,9 @@ void input_keyboard_event(bool down, unsigned code,
#ifdef HAVE_BSV_MOVIE
/* Save input to BSV record, if recording */
if (BSV_MOVIE_IS_RECORDING())
{
bsv_movie_handle_push_key_event(input_st->bsv_movie_state_handle, down, mod, code, character);
}
bsv_movie_handle_push_key_event(
input_st->bsv_movie_state_handle, down, mod,
code, character);
#endif
}
(*key_event)(down, code, character, mod);