mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
(input_driver.c) Style nits
This commit is contained in:
parent
aefadc04c7
commit
9bff7168e8
@ -523,10 +523,8 @@ bool input_driver_set_sensor(
|
|||||||
port, action, rate);
|
port, action, rate);
|
||||||
}
|
}
|
||||||
else if (input_driver_st.primary_joypad && input_driver_st.primary_joypad->set_sensor_state)
|
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,
|
return input_driver_st.primary_joypad->set_sensor_state(NULL,
|
||||||
port, action, rate);
|
port, action, rate);
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -545,11 +543,9 @@ float input_driver_get_sensor(
|
|||||||
}
|
}
|
||||||
else if (sensors_enable && input_driver_st.primary_joypad &&
|
else if (sensors_enable && input_driver_st.primary_joypad &&
|
||||||
input_driver_st.primary_joypad->get_sensor_input)
|
input_driver_st.primary_joypad->get_sensor_input)
|
||||||
{
|
|
||||||
return input_driver_st.primary_joypad->get_sensor_input(NULL,
|
return input_driver_st.primary_joypad->get_sensor_input(NULL,
|
||||||
port, id);
|
port, id);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return 0.0f;
|
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)
|
bool input_driver_pointer_is_offscreen(int16_t x, int16_t y)
|
||||||
{
|
{
|
||||||
const int edge_detect = 32700;
|
const int edge_detect = 32700;
|
||||||
if ((x >= -edge_detect) &&
|
if ( (x >= -edge_detect)
|
||||||
(y >= -edge_detect) &&
|
&& (y >= -edge_detect)
|
||||||
(x <= edge_detect) &&
|
&& (x <= edge_detect)
|
||||||
(y <= edge_detect))
|
&& (y <= edge_detect))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -781,11 +777,9 @@ static int32_t input_state_wrap(
|
|||||||
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
|
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
|
||||||
{
|
{
|
||||||
if (joypad)
|
if (joypad)
|
||||||
ret |= joypad->state(
|
ret |= joypad->state(joypad_info, binds[_port], _port);
|
||||||
joypad_info, binds[_port], _port);
|
|
||||||
if (sec_joypad)
|
if (sec_joypad)
|
||||||
ret |= sec_joypad->state(
|
ret |= sec_joypad->state(joypad_info, binds[_port], _port);
|
||||||
joypad_info, binds[_port], _port);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -878,14 +872,11 @@ static int16_t input_joypad_axis(
|
|||||||
if (input_analog_sensitivity != 1.0f)
|
if (input_analog_sensitivity != 1.0f)
|
||||||
{
|
{
|
||||||
float normalized = (1.0f / 0x7fff) * val;
|
float normalized = (1.0f / 0x7fff) * val;
|
||||||
int new_val = 0x7fff * normalized *
|
int new_val = 0x7fff * normalized * input_analog_sensitivity;
|
||||||
input_analog_sensitivity;
|
|
||||||
|
|
||||||
if (new_val > 0x7fff)
|
if (new_val > 0x7fff)
|
||||||
return 0x7fff;
|
return 0x7fff;
|
||||||
else if (new_val < -0x7fff)
|
else if (new_val < -0x7fff)
|
||||||
return -0x7fff;
|
return -0x7fff;
|
||||||
|
|
||||||
return new_val;
|
return new_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1134,8 +1125,7 @@ void input_keyboard_line_append(
|
|||||||
const char *word, size_t len)
|
const char *word, size_t len)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
char *newbuf = (char*)realloc(
|
char *newbuf = (char*)realloc(keyboard_line->buffer,
|
||||||
keyboard_line->buffer,
|
|
||||||
keyboard_line->size + len * 2);
|
keyboard_line->size + len * 2);
|
||||||
|
|
||||||
if (!newbuf)
|
if (!newbuf)
|
||||||
@ -1195,34 +1185,34 @@ const char **input_keyboard_start_line(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OVERLAY
|
#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;
|
int16_t res;
|
||||||
|
input_overlay_pointer_state_t *ptr_st = &ol->pointer_state;
|
||||||
|
|
||||||
switch(id)
|
switch(id)
|
||||||
{
|
{
|
||||||
case RETRO_DEVICE_ID_MOUSE_X:
|
case RETRO_DEVICE_ID_MOUSE_X:
|
||||||
ptr_st->device_mask |= (1 << RETRO_DEVICE_MOUSE);
|
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->screen_x - ptr_st->mouse.prev_screen_x);
|
||||||
ptr_st->mouse.prev_screen_x = ptr_st->screen_x;
|
ptr_st->mouse.prev_screen_x = ptr_st->screen_x;
|
||||||
return res;
|
return res;
|
||||||
case RETRO_DEVICE_ID_MOUSE_Y:
|
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->screen_y - ptr_st->mouse.prev_screen_y);
|
||||||
ptr_st->mouse.prev_screen_y = ptr_st->screen_y;
|
ptr_st->mouse.prev_screen_y = ptr_st->screen_y;
|
||||||
return res;
|
return res;
|
||||||
case RETRO_DEVICE_ID_MOUSE_LEFT:
|
case RETRO_DEVICE_ID_MOUSE_LEFT:
|
||||||
return (ptr_st->mouse.click & 0x1) ||
|
return (ptr_st->mouse.click & 0x1)
|
||||||
(ptr_st->mouse.hold & 0x1);
|
|| (ptr_st->mouse.hold & 0x1);
|
||||||
case RETRO_DEVICE_ID_MOUSE_RIGHT:
|
case RETRO_DEVICE_ID_MOUSE_RIGHT:
|
||||||
return (ptr_st->mouse.click & 0x2) ||
|
return (ptr_st->mouse.click & 0x2)
|
||||||
(ptr_st->mouse.hold & 0x2);
|
|| (ptr_st->mouse.hold & 0x2);
|
||||||
case RETRO_DEVICE_ID_MOUSE_MIDDLE:
|
case RETRO_DEVICE_ID_MOUSE_MIDDLE:
|
||||||
return (ptr_st->mouse.click & 0x4) ||
|
return (ptr_st->mouse.click & 0x4)
|
||||||
(ptr_st->mouse.hold & 0x4);
|
|| (ptr_st->mouse.hold & 0x4);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1504,8 +1494,9 @@ static int16_t input_state_device(
|
|||||||
* > 'id' is not equal to remapped button index
|
* > 'id' is not equal to remapped button index
|
||||||
* If these conditions are met, input here
|
* If these conditions are met, input here
|
||||||
* is ignored */
|
* is ignored */
|
||||||
if ((menu_driver_alive || !input_remap_binds_enable) ||
|
if ( (menu_driver_alive
|
||||||
(id == remap_button))
|
|| !input_remap_binds_enable)
|
||||||
|
|| (id == remap_button))
|
||||||
res |= 1;
|
res |= 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -5714,15 +5705,13 @@ static void input_keys_pressed(
|
|||||||
|
|
||||||
if (!libretro_input_pressed)
|
if (!libretro_input_pressed)
|
||||||
{
|
{
|
||||||
bool keyboard_menu_pressed = false;
|
|
||||||
|
|
||||||
/* Ignore keyboard menu toggle button and check
|
/* Ignore keyboard menu toggle button and check
|
||||||
* joypad menu toggle button for pressing
|
* joypad menu toggle button for pressing
|
||||||
* it without 'enable_hotkey', because Guide button
|
* it without 'enable_hotkey', because Guide button
|
||||||
* is not part of the usual buttons. */
|
* is not part of the usual buttons. */
|
||||||
i = RARCH_MENU_TOGGLE;
|
i = RARCH_MENU_TOGGLE;
|
||||||
|
|
||||||
keyboard_menu_pressed = binds[port][i].valid
|
if (!(binds[port][i].valid
|
||||||
&& input_state_wrap(
|
&& input_state_wrap(
|
||||||
input_st->current_driver,
|
input_st->current_driver,
|
||||||
input_st->current_data,
|
input_st->current_data,
|
||||||
@ -5732,9 +5721,7 @@ static void input_keys_pressed(
|
|||||||
binds,
|
binds,
|
||||||
(input_st->flags & INP_FLAG_KB_MAPPING_BLOCKED) ? true : false,
|
(input_st->flags & INP_FLAG_KB_MAPPING_BLOCKED) ? true : false,
|
||||||
port, RETRO_DEVICE_KEYBOARD, 0,
|
port, RETRO_DEVICE_KEYBOARD, 0,
|
||||||
input_config_binds[port][i].key);
|
input_config_binds[port][i].key)))
|
||||||
|
|
||||||
if (!keyboard_menu_pressed)
|
|
||||||
{
|
{
|
||||||
bool bit_pressed = binds[port][i].valid
|
bool bit_pressed = binds[port][i].valid
|
||||||
&& input_state_wrap(
|
&& input_state_wrap(
|
||||||
@ -5922,7 +5909,8 @@ static void input_keys_pressed(
|
|||||||
/* Forward declaration */
|
/* Forward declaration */
|
||||||
void bsv_movie_free(bsv_movie_t*);
|
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)
|
if (input_st->bsv_movie_state_next_handle)
|
||||||
bsv_movie_free(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;
|
input_driver_state_t *input_st = &input_driver_st;
|
||||||
bsv_movie_t *handle = input_st->bsv_movie_state_handle;
|
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)
|
if (!handle)
|
||||||
return;
|
return;
|
||||||
@ -5991,7 +5980,12 @@ void bsv_movie_frame_rewind(void)
|
|||||||
{
|
{
|
||||||
/* We rewound past the beginning. */
|
/* 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;
|
retro_ctx_serialize_info_t serial_info;
|
||||||
|
|
||||||
@ -6008,24 +6002,8 @@ void bsv_movie_frame_rewind(void)
|
|||||||
|
|
||||||
intfstream_write(handle->file, handle->state, handle->state_size);
|
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,
|
void bsv_movie_handle_push_key_event(bsv_movie_t *movie,
|
||||||
uint8_t down, uint16_t mod, uint32_t code, uint32_t character)
|
uint8_t down, uint16_t mod, uint32_t code, uint32_t character)
|
||||||
@ -6039,6 +6017,7 @@ void bsv_movie_handle_push_key_event(bsv_movie_t *movie,
|
|||||||
movie->key_events[movie->key_event_count] = data;
|
movie->key_events[movie->key_event_count] = data;
|
||||||
movie->key_event_count++;
|
movie->key_event_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bsv_movie_handle_push_input_event(bsv_movie_t *movie,
|
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)
|
||||||
{
|
{
|
||||||
@ -6052,6 +6031,7 @@ void bsv_movie_handle_push_input_event(bsv_movie_t *movie,
|
|||||||
movie->input_events[movie->input_event_count] = data;
|
movie->input_events[movie->input_event_count] = data;
|
||||||
movie->input_event_count++;
|
movie->input_event_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bsv_movie_handle_read_input_event(bsv_movie_t *movie,
|
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)
|
||||||
{
|
{
|
||||||
@ -6066,10 +6046,10 @@ bool bsv_movie_handle_read_input_event(bsv_movie_t *movie,
|
|||||||
for (i = 0; i < movie->input_event_count; i++)
|
for (i = 0; i < movie->input_event_count; i++)
|
||||||
{
|
{
|
||||||
bsv_input_data_t evt = movie->input_events[i];
|
bsv_input_data_t evt = movie->input_events[i];
|
||||||
if (evt.port == port &&
|
if ( (evt.port == port)
|
||||||
evt.device == dev &&
|
&& (evt.device == dev)
|
||||||
evt.idx == idx &&
|
&& (evt.idx == idx)
|
||||||
evt.id == id)
|
&& (evt.id == id))
|
||||||
{
|
{
|
||||||
*val = swap_if_big16(evt.value);
|
*val = swap_if_big16(evt.value);
|
||||||
return true;
|
return true;
|
||||||
@ -6096,7 +6076,8 @@ void bsv_movie_read_next_events(bsv_movie_t *handle)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < handle->key_event_count; 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 */
|
/* Unnatural EOF */
|
||||||
RARCH_ERR("[Replay] Keyboard replay ran out of keyboard inputs too early\n");
|
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);
|
handle->input_event_count = swap_if_big16(handle->input_event_count);
|
||||||
for (i = 0; i < handle->input_event_count; i++)
|
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 */
|
/* Unnatural EOF */
|
||||||
RARCH_ERR("[Replay] Input replay ran out of inputs too early\n");
|
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;
|
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 */
|
/* Unnatural EOF */
|
||||||
RARCH_ERR("[Replay] Replay ran out of frames\n");
|
RARCH_ERR("[Replay] Replay ran out of frames\n");
|
||||||
input_st->bsv_movie_state.flags |= BSV_FLAG_MOVIE_END;
|
input_st->bsv_movie_state.flags |= BSV_FLAG_MOVIE_END;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (next_frame_type == REPLAY_TOKEN_REGULAR_FRAME)
|
|
||||||
{
|
|
||||||
/* do nothing */
|
|
||||||
}
|
|
||||||
else if (next_frame_type == REPLAY_TOKEN_CHECKPOINT_FRAME)
|
else if (next_frame_type == REPLAY_TOKEN_CHECKPOINT_FRAME)
|
||||||
{
|
{
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
uint8_t *st;
|
uint8_t *st;
|
||||||
retro_ctx_serialize_info_t serial_info;
|
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");
|
RARCH_ERR("[Replay] Replay ran out of frames\n");
|
||||||
input_st->bsv_movie_state.flags |= BSV_FLAG_MOVIE_END;
|
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 */
|
/* write key events, frame is over */
|
||||||
intfstream_write(handle->file, &(handle->key_event_count), 1);
|
intfstream_write(handle->file, &(handle->key_event_count), 1);
|
||||||
for (i = 0; i < handle->key_event_count; i++)
|
for (i = 0; i < handle->key_event_count; i++)
|
||||||
intfstream_write(handle->file, &(handle->key_events[i]), sizeof(bsv_key_data_t));
|
intfstream_write(handle->file, &(handle->key_events[i]),
|
||||||
bsv_movie_handle_clear_key_events(handle);
|
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 */
|
/* write input events, frame is over */
|
||||||
intfstream_write(handle->file, &evt_count, 2);
|
intfstream_write(handle->file, &evt_count, 2);
|
||||||
for (i = 0; i < handle->input_event_count; i++)
|
for (i = 0; i < handle->input_event_count; i++)
|
||||||
intfstream_write(handle->file, &(handle->input_events[i]), sizeof(bsv_input_data_t));
|
intfstream_write(handle->file, &(handle->input_events[i]),
|
||||||
bsv_movie_handle_clear_input_events(handle);
|
sizeof(bsv_input_data_t));
|
||||||
|
/* Zero out input events when playing back or recording */
|
||||||
|
handle->input_event_count = 0;
|
||||||
|
|
||||||
/* Maybe record checkpoint */
|
/* 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;
|
retro_ctx_serialize_info_t serial_info;
|
||||||
uint8_t frame_tok = REPLAY_TOKEN_CHECKPOINT_FRAME;
|
uint8_t frame_tok = REPLAY_TOKEN_CHECKPOINT_FRAME;
|
||||||
@ -6279,7 +6265,8 @@ bool replay_get_serialized_data(void* buffer)
|
|||||||
intfstream_rewind(handle->file);
|
intfstream_rewind(handle->file);
|
||||||
read_amt = intfstream_read(handle->file, (void *)buf, file_end);
|
read_amt = intfstream_read(handle->file, (void *)buf, file_end);
|
||||||
if (read_amt != 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;
|
return true;
|
||||||
}
|
}
|
||||||
@ -6321,16 +6308,16 @@ bool replay_set_serialized_data(void* buf)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int32_t loaded_len = swap_if_big32(((int32_t *)buffer)[0]);
|
|
||||||
/* TODO: should factor the next few lines away, magic numbers ahoy */
|
/* TODO: should factor the next few lines away, magic numbers ahoy */
|
||||||
uint32_t *header = (uint32_t *)(buffer + sizeof(int32_t));
|
uint32_t *header = (uint32_t *)(buffer + sizeof(int32_t));
|
||||||
int64_t *identifier_spot = (int64_t *)(header+4);
|
int64_t *ident_spot = (int64_t *)(header + 4);
|
||||||
int64_t identifier = swap_if_big64(*identifier_spot);
|
int64_t ident = swap_if_big64(*ident_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;
|
|
||||||
|
|
||||||
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
|
/* If the state is part of this replay, go back to that state
|
||||||
and rewind/fast forward the replay.
|
and rewind/fast forward the replay.
|
||||||
|
|
||||||
@ -6427,18 +6414,12 @@ void input_driver_poll(void)
|
|||||||
joypad_info[i].auto_binds = input_autoconf_binds[joypad_info[i].joy_idx];
|
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_st->turbo_btns.frame_enable[i] = (*input_st->libretro_input_binds[i])[RARCH_TURBO_ENABLE].valid ?
|
||||||
input_state_wrap(
|
input_state_wrap(input_st->current_driver, input_st->current_data,
|
||||||
input_st->current_driver,
|
joypad, sec_joypad, &joypad_info[i],
|
||||||
input_st->current_data,
|
|
||||||
joypad,
|
|
||||||
sec_joypad,
|
|
||||||
&joypad_info[i],
|
|
||||||
(*input_st->libretro_input_binds),
|
(*input_st->libretro_input_binds),
|
||||||
(input_st->flags & INP_FLAG_KB_MAPPING_BLOCKED) ? true : false,
|
(input_st->flags & INP_FLAG_KB_MAPPING_BLOCKED) ? true : false,
|
||||||
(unsigned)i,
|
(unsigned)i,
|
||||||
RETRO_DEVICE_JOYPAD,
|
RETRO_DEVICE_JOYPAD, 0, RARCH_TURBO_ENABLE) : 0;
|
||||||
0,
|
|
||||||
RARCH_TURBO_ENABLE) : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OVERLAY
|
#ifdef HAVE_OVERLAY
|
||||||
@ -6579,11 +6560,8 @@ void input_driver_poll(void)
|
|||||||
input_analog_dpad_mode,
|
input_analog_dpad_mode,
|
||||||
input_analog_deadzone,
|
input_analog_deadzone,
|
||||||
input_analog_sensitivity,
|
input_analog_sensitivity,
|
||||||
joypad,
|
joypad, &joypad_info[i],
|
||||||
&joypad_info[i],
|
k, j, (*input_st->libretro_input_binds[i]));
|
||||||
k,
|
|
||||||
j,
|
|
||||||
(*input_st->libretro_input_binds[i]));
|
|
||||||
|
|
||||||
if (val >= 0)
|
if (val >= 0)
|
||||||
p_new_state->analogs[offset] = val;
|
p_new_state->analogs[offset] = val;
|
||||||
@ -6619,21 +6597,15 @@ void input_driver_poll(void)
|
|||||||
* 32767;
|
* 32767;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
current_button_value = BIT256_GET_PTR(p_new_state, j);
|
||||||
current_button_value =
|
|
||||||
BIT256_GET_PTR(p_new_state, j);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_OVERLAY
|
#ifdef HAVE_OVERLAY
|
||||||
if (poll_overlay && i == 0)
|
if (poll_overlay && i == 0)
|
||||||
{
|
{
|
||||||
input_overlay_state_t *ol_state =
|
input_overlay_state_t *ol_state = overlay_pointer
|
||||||
overlay_pointer
|
? &overlay_pointer->overlay_state : NULL;
|
||||||
? &overlay_pointer->overlay_state
|
|
||||||
: NULL;
|
|
||||||
if (ol_state)
|
if (ol_state)
|
||||||
current_button_value |=
|
current_button_value |= BIT256_GET(ol_state->buttons, j);
|
||||||
BIT256_GET(ol_state->buttons, j);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Press */
|
/* Press */
|
||||||
@ -6691,8 +6663,7 @@ void input_driver_poll(void)
|
|||||||
? &overlay_pointer->overlay_state
|
? &overlay_pointer->overlay_state
|
||||||
: NULL;
|
: NULL;
|
||||||
if (ol_state)
|
if (ol_state)
|
||||||
current_button_value |=
|
current_button_value |= BIT256_GET(ol_state->buttons, j);
|
||||||
BIT256_GET(ol_state->buttons, j);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
remap_valid =
|
remap_valid =
|
||||||
@ -6760,8 +6731,8 @@ void input_driver_poll(void)
|
|||||||
if (remap_axis_bind < sizeof(handle->analog_value[i]))
|
if (remap_axis_bind < sizeof(handle->analog_value[i]))
|
||||||
{
|
{
|
||||||
int invert = 1;
|
int invert = 1;
|
||||||
if ( (k % 2 == 0 && remap_axis % 2 != 0) ||
|
if ( (k % 2 == 0 && remap_axis % 2 != 0)
|
||||||
(k % 2 != 0 && remap_axis % 2 == 0)
|
|| (k % 2 != 0 && remap_axis % 2 == 0)
|
||||||
)
|
)
|
||||||
invert = -1;
|
invert = -1;
|
||||||
|
|
||||||
@ -6851,10 +6822,13 @@ void input_driver_poll(void)
|
|||||||
rcheevos_pause_hardcore();
|
rcheevos_pause_hardcore();
|
||||||
#endif
|
#endif
|
||||||
k = input_st->bsv_movie_state_handle->key_events[i];
|
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 */
|
/* 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
|
#endif
|
||||||
@ -6874,12 +6848,7 @@ int16_t input_driver_state_wrapper(unsigned port, unsigned device,
|
|||||||
int16_t bsv_result = 0;
|
int16_t bsv_result = 0;
|
||||||
bsv_movie_t *movie = input_st->bsv_movie_state_handle;
|
bsv_movie_t *movie = input_st->bsv_movie_state_handle;
|
||||||
if (bsv_movie_handle_read_input_event(
|
if (bsv_movie_handle_read_input_event(
|
||||||
movie,
|
movie, port, device, idx, id, &bsv_result))
|
||||||
port,
|
|
||||||
device,
|
|
||||||
idx,
|
|
||||||
id,
|
|
||||||
&bsv_result))
|
|
||||||
{
|
{
|
||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
rcheevos_pause_hardcore();
|
rcheevos_pause_hardcore();
|
||||||
@ -6904,7 +6873,6 @@ int16_t input_driver_state_wrapper(unsigned port, unsigned device,
|
|||||||
#ifdef HAVE_BSV_MOVIE
|
#ifdef HAVE_BSV_MOVIE
|
||||||
/* Save input to BSV record, if enabled */
|
/* Save input to BSV record, if enabled */
|
||||||
if (BSV_MOVIE_IS_RECORDING())
|
if (BSV_MOVIE_IS_RECORDING())
|
||||||
{
|
|
||||||
bsv_movie_handle_push_input_event(
|
bsv_movie_handle_push_input_event(
|
||||||
input_st->bsv_movie_state_handle,
|
input_st->bsv_movie_state_handle,
|
||||||
port,
|
port,
|
||||||
@ -6912,7 +6880,6 @@ int16_t input_driver_state_wrapper(unsigned port, unsigned device,
|
|||||||
idx,
|
idx,
|
||||||
id,
|
id,
|
||||||
result);
|
result);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -7174,7 +7141,6 @@ void input_driver_collect_system_input(input_driver_state_t *input_st,
|
|||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
if (menu_is_alive)
|
if (menu_is_alive)
|
||||||
{
|
{
|
||||||
int16_t ret;
|
|
||||||
uint8_t s;
|
uint8_t s;
|
||||||
uint8_t a;
|
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++)
|
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,
|
ANALOG_DPAD_NONE,
|
||||||
settings->floats.input_analog_deadzone,
|
settings->floats.input_analog_deadzone,
|
||||||
settings->floats.input_analog_sensitivity,
|
settings->floats.input_analog_sensitivity,
|
||||||
@ -7479,20 +7445,20 @@ void input_keyboard_event(bool down, unsigned code,
|
|||||||
{
|
{
|
||||||
if ( (down)
|
if ( (down)
|
||||||
&& (code != RETROK_UNKNOWN)
|
&& (code != RETROK_UNKNOWN)
|
||||||
&& (menu_input_dialog_get_display_kb() ||
|
&& (menu_input_dialog_get_display_kb()
|
||||||
!((code == RETROK_SPACE) || /* RETRO_DEVICE_ID_JOYPAD_START */
|
|| !((code == RETROK_SPACE) /* RETRO_DEVICE_ID_JOYPAD_START */
|
||||||
(code == RETROK_SLASH) || /* RETRO_DEVICE_ID_JOYPAD_X */
|
|| (code == RETROK_SLASH) /* RETRO_DEVICE_ID_JOYPAD_X */
|
||||||
(code == RETROK_RSHIFT) || /* RETRO_DEVICE_ID_JOYPAD_SELECT */
|
|| (code == RETROK_RSHIFT) /* RETRO_DEVICE_ID_JOYPAD_SELECT */
|
||||||
(code == RETROK_RIGHT) || /* RETRO_DEVICE_ID_JOYPAD_RIGHT */
|
|| (code == RETROK_RIGHT) /* RETRO_DEVICE_ID_JOYPAD_RIGHT */
|
||||||
(code == RETROK_LEFT) || /* RETRO_DEVICE_ID_JOYPAD_LEFT */
|
|| (code == RETROK_LEFT) /* RETRO_DEVICE_ID_JOYPAD_LEFT */
|
||||||
(code == RETROK_DOWN) || /* RETRO_DEVICE_ID_JOYPAD_DOWN */
|
|| (code == RETROK_DOWN) /* RETRO_DEVICE_ID_JOYPAD_DOWN */
|
||||||
(code == RETROK_UP) || /* RETRO_DEVICE_ID_JOYPAD_UP */
|
|| (code == RETROK_UP) /* RETRO_DEVICE_ID_JOYPAD_UP */
|
||||||
(code == RETROK_PAGEUP) || /* RETRO_DEVICE_ID_JOYPAD_L */
|
|| (code == RETROK_PAGEUP) /* RETRO_DEVICE_ID_JOYPAD_L */
|
||||||
(code == RETROK_PAGEDOWN) || /* RETRO_DEVICE_ID_JOYPAD_R */
|
|| (code == RETROK_PAGEDOWN) /* RETRO_DEVICE_ID_JOYPAD_R */
|
||||||
(code == RETROK_BACKSPACE)|| /* RETRO_DEVICE_ID_JOYPAD_B */
|
|| (code == RETROK_BACKSPACE) /* RETRO_DEVICE_ID_JOYPAD_B */
|
||||||
(code == RETROK_RETURN) || /* RETRO_DEVICE_ID_JOYPAD_A */
|
|| (code == RETROK_RETURN) /* RETRO_DEVICE_ID_JOYPAD_A */
|
||||||
(code == RETROK_DELETE) || /* RETRO_DEVICE_ID_JOYPAD_Y */
|
|| (code == RETROK_DELETE) /* RETRO_DEVICE_ID_JOYPAD_Y */
|
||||||
BIT512_GET(input_st->keyboard_mapping_bits, code))))
|
|| (BIT512_GET(input_st->keyboard_mapping_bits, code)))))
|
||||||
{
|
{
|
||||||
struct menu_state *menu_st = menu_state_get_ptr();
|
struct menu_state *menu_st = menu_state_get_ptr();
|
||||||
menu_st->flags &= ~MENU_ST_FLAG_SCREENSAVER_ACTIVE;
|
menu_st->flags &= ~MENU_ST_FLAG_SCREENSAVER_ACTIVE;
|
||||||
@ -7509,8 +7475,8 @@ void input_keyboard_event(bool down, unsigned code,
|
|||||||
|
|
||||||
#ifdef HAVE_ACCESSIBILITY
|
#ifdef HAVE_ACCESSIBILITY
|
||||||
if ( menu_input_dialog_get_display_kb()
|
if ( menu_input_dialog_get_display_kb()
|
||||||
&& down && is_accessibility_enabled(
|
&& down
|
||||||
accessibility_enable,
|
&& is_accessibility_enabled(accessibility_enable,
|
||||||
access_st->enabled))
|
access_st->enabled))
|
||||||
{
|
{
|
||||||
if (code != 303 && code != 0)
|
if (code != 303 && code != 0)
|
||||||
@ -7524,10 +7490,8 @@ void input_keyboard_event(bool down, unsigned code,
|
|||||||
say_char[1] = '\0';
|
say_char[1] = '\0';
|
||||||
|
|
||||||
if (character == 127 || character == 8)
|
if (character == 127 || character == 8)
|
||||||
accessibility_speak_priority(
|
accessibility_speak_priority(accessibility_enable,
|
||||||
accessibility_enable,
|
accessibility_narrator_speech_speed, "backspace", 10);
|
||||||
accessibility_narrator_speech_speed,
|
|
||||||
"backspace", 10);
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char *lut_name = accessibility_lut_name(c);
|
const char *lut_name = accessibility_lut_name(c);
|
||||||
@ -7601,9 +7565,9 @@ void input_keyboard_event(bool down, unsigned code,
|
|||||||
&& BIT512_GET(input_st->keyboard_mapping_bits, code)
|
&& BIT512_GET(input_st->keyboard_mapping_bits, code)
|
||||||
&& device != RETRO_DEVICE_POINTER)
|
&& device != RETRO_DEVICE_POINTER)
|
||||||
{
|
{
|
||||||
|
unsigned j;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
unsigned max_users = settings->uints.input_max_users;
|
unsigned max_users = settings->uints.input_max_users;
|
||||||
unsigned j;
|
|
||||||
bool hotkey_pressed = (input_st->input_hotkey_block_counter > 0);
|
bool hotkey_pressed = (input_st->input_hotkey_block_counter > 0);
|
||||||
bool block_key_event = false;
|
bool block_key_event = false;
|
||||||
|
|
||||||
@ -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)
|
if ( input_config_get_device(j)
|
||||||
&& !block_key_event)
|
&& !block_key_event)
|
||||||
{
|
{
|
||||||
@ -7661,9 +7626,9 @@ void input_keyboard_event(bool down, unsigned code,
|
|||||||
#ifdef HAVE_BSV_MOVIE
|
#ifdef HAVE_BSV_MOVIE
|
||||||
/* Save input to BSV record, if recording */
|
/* Save input to BSV record, if recording */
|
||||||
if (BSV_MOVIE_IS_RECORDING())
|
if (BSV_MOVIE_IS_RECORDING())
|
||||||
{
|
bsv_movie_handle_push_key_event(
|
||||||
bsv_movie_handle_push_key_event(input_st->bsv_movie_state_handle, down, mod, code, character);
|
input_st->bsv_movie_state_handle, down, mod,
|
||||||
}
|
code, character);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
(*key_event)(down, code, character, mod);
|
(*key_event)(down, code, character, mod);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user