Simplify some input/video functions

This commit is contained in:
twinaphex 2016-10-24 03:05:55 +02:00
parent 294f54ebf0
commit 3702fde113
2 changed files with 11 additions and 16 deletions

View File

@ -1117,9 +1117,6 @@ static bool video_driver_cached_frame(void)
retro_ctx_frame_info_t info;
void *recording = recording_driver_get_data_ptr();
if (runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL))
return true; /* Maybe return false here for indication of idleness? */
/* Cannot allow recording when pushing duped frames. */
recording_driver_clear_data_ptr();
@ -1127,14 +1124,12 @@ static bool video_driver_cached_frame(void)
* freed the memory, but no known implementations do this.
* It would be really stupid at any rate ...
*/
info.data = NULL;
info.data = (frame_cache_data != RETRO_HW_FRAME_BUFFER_VALID)
? frame_cache_data : NULL;
info.width = frame_cache_width;
info.height = frame_cache_height;
info.pitch = frame_cache_pitch;
if (frame_cache_data != RETRO_HW_FRAME_BUFFER_VALID)
info.data = frame_cache_data;
core_frame(&info);
recording_driver_set_data_ptr(recording);
@ -1702,6 +1697,8 @@ bool video_driver_cached_frame_render(void)
{
if (!current_video)
return false;
if (runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL))
return true; /* Maybe return false here for indication of idleness? */
return video_driver_cached_frame();
}

View File

@ -506,21 +506,21 @@ int16_t input_state(unsigned port, unsigned device,
**/
static bool check_input_driver_block_hotkey(bool enable_hotkey)
{
bool use_hotkey_enable;
bool use_hotkey_enable = false;;
settings_t *settings = config_get_ptr();
const struct retro_keybind *bind =
&settings->input.binds[0][RARCH_ENABLE_HOTKEY];
const struct retro_keybind *autoconf_bind =
&settings->input.autoconf_binds[0][RARCH_ENABLE_HOTKEY];
bool kb_mapping_is_blocked =
input_driver_keyboard_mapping_is_blocked();
bool kb_mapping_is_blocked = current_input->keyboard_mapping_is_blocked(
current_input_data);
/* Don't block the check to RARCH_ENABLE_HOTKEY
* unless we're really supposed to. */
if (kb_mapping_is_blocked)
input_driver_set_hotkey_block();
input_driver_block_hotkey = true;
else
input_driver_unset_hotkey_block();
input_driver_block_hotkey = false;
/* If we haven't bound anything to this,
* always allow hotkeys. */
@ -533,9 +533,9 @@ static bool check_input_driver_block_hotkey(bool enable_hotkey)
|| (autoconf_bind->joyaxis != AXIS_NONE);
if (kb_mapping_is_blocked || (use_hotkey_enable && !enable_hotkey))
input_driver_set_hotkey_block();
input_driver_block_hotkey = true;
else
input_driver_unset_hotkey_block();
input_driver_block_hotkey = false;
/* If we hold ENABLE_HOTKEY button, block all libretro input to allow
* hotkeys to be bound to same keys as RetroPad. */
@ -732,8 +732,6 @@ bool input_driver_grab_stdin(void)
bool input_driver_keyboard_mapping_is_blocked(void)
{
if (!current_input->keyboard_mapping_is_blocked)
return false;
return current_input->keyboard_mapping_is_blocked(
current_input_data);
}