Check command interface in rarch_input_poll.

This commit is contained in:
Themaister 2014-03-17 11:34:25 +01:00
parent 66fc195ae8
commit bad7f9af82
5 changed files with 19 additions and 23 deletions

View File

@ -322,7 +322,7 @@ bool rarch_cmd_get(rarch_cmd_t *handle, unsigned id)
}
#ifdef HAVE_NETWORK_CMD
static void network_cmd_pre_frame(rarch_cmd_t *handle)
static void network_cmd_poll(rarch_cmd_t *handle)
{
if (handle->net_fd < 0)
return;
@ -453,7 +453,7 @@ static size_t read_stdin(char *buf, size_t size)
}
#endif
static void stdin_cmd_pre_frame(rarch_cmd_t *handle)
static void stdin_cmd_poll(rarch_cmd_t *handle)
{
if (!handle->stdin_enable)
return;
@ -489,16 +489,16 @@ static void stdin_cmd_pre_frame(rarch_cmd_t *handle)
}
#endif
void rarch_cmd_pre_frame(rarch_cmd_t *handle)
void rarch_cmd_poll(rarch_cmd_t *handle)
{
memset(handle->state, 0, sizeof(handle->state));
#ifdef HAVE_NETWORK_CMD
network_cmd_pre_frame(handle);
network_cmd_poll(handle);
#endif
#ifdef HAVE_STDIN_CMD
stdin_cmd_pre_frame(handle);
stdin_cmd_poll(handle);
#endif
}

View File

@ -32,7 +32,7 @@ typedef struct rarch_cmd rarch_cmd_t;
rarch_cmd_t *rarch_cmd_new(bool stdin_enable, bool network_enable, uint16_t port);
void rarch_cmd_free(rarch_cmd_t *handle);
void rarch_cmd_pre_frame(rarch_cmd_t *handle);
void rarch_cmd_poll(rarch_cmd_t *handle);
void rarch_cmd_set(rarch_cmd_t *handle, unsigned id);
bool rarch_cmd_get(rarch_cmd_t *handle, unsigned id);

View File

@ -217,7 +217,7 @@ int main_entry_iterate(signature(), args_type() args)
if (driver.audio_data)
audio_stop_func();
rgui->need_refresh= true;
rgui->need_refresh = true;
rgui->old_input_state |= 1ULL << RARCH_MENU_TOGGLE;
g_extern.lifecycle_state &= ~(1ULL << MODE_MENU_PREINIT);
@ -242,6 +242,10 @@ int main_entry_iterate(signature(), args_type() args)
}
g_extern.lifecycle_state |= (1ULL << MODE_CLEAR_INPUT);
// If QUIT state came from command interface, we'll only see it once due to MODE_CLEAR_INPUT.
if (input_key_pressed_func(RARCH_QUIT_KEY) || !video_alive_func())
return 1;
}
}
#endif

View File

@ -1412,8 +1412,8 @@ bool menu_iterate(void *video_data)
rgui->old_input_state |= 1ULL << RARCH_MENU_TOGGLE;
}
rarch_check_block_hotkey();
rarch_input_poll();
rarch_check_block_hotkey();
#ifdef HAVE_OVERLAY
rarch_check_overlay();
#endif
@ -1425,7 +1425,7 @@ bool menu_iterate(void *video_data)
if (input_key_pressed_func(RARCH_QUIT_KEY) || !video_alive_func())
{
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
goto deinit;
return false;
}
input_state = menu_input();
@ -1522,12 +1522,9 @@ bool menu_iterate(void *video_data)
}
if (ret || input_entry_ret)
goto deinit;
return false;
return true;
deinit:
return false;
}
#endif

View File

@ -598,6 +598,11 @@ void rarch_input_poll(void)
if (driver.overlay) // Poll overlay state
input_poll_overlay();
#endif
#ifdef HAVE_COMMAND
if (driver.command)
rarch_cmd_poll(driver.command);
#endif
}
#ifndef RARCH_CONSOLE
@ -3176,11 +3181,6 @@ bool rarch_main_iterate(void)
return false;
}
#ifdef HAVE_COMMAND
if (driver.command)
rarch_cmd_pre_frame(driver.command);
#endif
// Checks for stuff like fullscreen, save states, etc.
do_state_checks();
@ -3364,11 +3364,6 @@ int rarch_main_init_wrap(const struct rarch_main_wrap *args)
bool rarch_main_idle_iterate(void)
{
#ifdef HAVE_COMMAND
if (driver.command)
rarch_cmd_pre_frame(driver.command);
#endif
if (input_key_pressed_func(RARCH_QUIT_KEY) || !video_alive_func())
return false;