本文整理汇总了C++中runloop_ctl函数的典型用法代码示例。如果您正苦于以下问题:C++ runloop_ctl函数的具体用法?C++ runloop_ctl怎么用?C++ runloop_ctl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了runloop_ctl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_pause
/**
* check_pause:
* @pressed : was libretro pause key pressed?
* @frameadvance_pressed : was frameadvance key pressed?
*
* Check if libretro pause key was pressed. If so, pause or
* unpause the libretro core.
*
* Returns: true if libretro pause key was toggled, otherwise false.
**/
static bool check_pause(settings_t *settings,
bool focus, bool pause_pressed,
bool frameadvance_pressed)
{
static bool old_focus = true;
enum event_command cmd = EVENT_CMD_NONE;
bool old_is_paused = runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL);
/* FRAMEADVANCE will set us into pause mode. */
pause_pressed |= !old_is_paused && frameadvance_pressed;
if (focus && pause_pressed)
cmd = EVENT_CMD_PAUSE_TOGGLE;
else if (focus && !old_focus)
cmd = EVENT_CMD_UNPAUSE;
else if (!focus && old_focus)
cmd = EVENT_CMD_PAUSE;
old_focus = focus;
if (cmd != EVENT_CMD_NONE)
event_command(cmd);
if (runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL) == old_is_paused)
return false;
return true;
}
示例2: menu_content_find_first_core
/**
* menu_content_find_first_core:
* @core_info : Core info list handle.
* @dir : Directory. Gets joined with @path.
* @path : Path. Gets joined with @dir.
* @menu_label : Label identifier of menu setting.
* @s : Deferred core path. Will be filled in
* by function.
* @len : Size of @s.
*
* Gets deferred core.
*
* Returns: false if there are multiple deferred cores and a
* selection needs to be made from a list, otherwise
* returns true and fills in @s with path to core.
**/
static bool menu_content_find_first_core(void *data)
{
char new_core_path[PATH_MAX_LENGTH];
const core_info_t *info = NULL;
size_t supported = 0;
menu_content_ctx_defer_info_t *def_info =
(menu_content_ctx_defer_info_t *)data;
core_info_list_t *core_info =
(core_info_list_t*)def_info->data;
uint32_t menu_label_hash =
menu_hash_calculate(def_info->menu_label);
if ( !string_is_empty(def_info->dir)
&& !string_is_empty(def_info->path))
fill_pathname_join(def_info->s,
def_info->dir, def_info->path, def_info->len);
#ifdef HAVE_COMPRESSION
if (path_is_compressed_file(def_info->dir))
{
/* In case of a compressed archive, we have to join with a hash */
/* We are going to write at the position of dir: */
retro_assert(strlen(def_info->dir) < strlen(def_info->s));
def_info->s[strlen(def_info->dir)] = '#';
}
#endif
if (core_info)
core_info_list_get_supported_cores(core_info,
def_info->s, &info,
&supported);
/* We started the menu with 'Load Content', we are
* going to use the current core to load this. */
if (menu_label_hash == MENU_LABEL_LOAD_CONTENT)
{
core_info_ctl(CORE_INFO_CTL_CURRENT_CORE_GET, (void*)&info);
if (info)
{
RARCH_LOG("Use the current core (%s) to load this content...\n",
info->path);
supported = 1;
}
}
/* There are multiple deferred cores and a
* selection needs to be made from a list, return 0. */
if (supported != 1)
return false;
if (info)
strlcpy(new_core_path, info->path, sizeof(new_core_path));
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, def_info->s);
if (path_file_exists(new_core_path))
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, new_core_path);
return true;
}
示例3: event_update_system_info
static bool event_update_system_info(struct retro_system_info *_info,
bool *load_no_content)
{
core_info_list_t *core_info_list = NULL;
core_info_t *core_info = NULL;
settings_t *settings = config_get_ptr();
#if defined(HAVE_DYNAMIC)
if (!(*settings->libretro))
return false;
libretro_get_system_info(settings->libretro, _info,
load_no_content);
#endif
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_GET, &core_info);
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &core_info_list);
if (!core_info_list)
return false;
if (!core_info_list_get_info(core_info_list,
core_info, settings->libretro))
return false;
return true;
}
示例4: runloop_iterate_time_to_exit
/* Time to exit out of the main loop?
* Reasons for exiting:
* a) Shutdown environment callback was invoked.
* b) Quit key was pressed.
* c) Frame count exceeds or equals maximum amount of frames to run.
* d) Video driver no longer alive.
* e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better)
*/
static INLINE int runloop_iterate_time_to_exit(bool quit_key_pressed)
{
settings_t *settings = NULL;
bool time_to_exit = runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL);
time_to_exit = time_to_exit || quit_key_pressed;
time_to_exit = time_to_exit || !video_driver_is_alive();
time_to_exit = time_to_exit || bsv_movie_ctl(BSV_MOVIE_CTL_END_EOF, NULL);
time_to_exit = time_to_exit || runloop_is_frame_count_end();
time_to_exit = time_to_exit || runloop_ctl(RUNLOOP_CTL_IS_EXEC, NULL);
if (!time_to_exit)
return 1;
if (runloop_ctl(RUNLOOP_CTL_IS_EXEC, NULL))
runloop_ctl(RUNLOOP_CTL_UNSET_EXEC, NULL);
if (!runloop_ctl(RUNLOOP_CTL_IS_CORE_SHUTDOWN, NULL))
return -1;
/* Quits out of RetroArch main loop. */
settings = config_get_ptr();
if (settings->load_dummy_on_core_shutdown)
return runloop_iterate_time_to_exit_load_dummy();
return -1;
}
示例5: menu_driver_toggle
static void menu_driver_toggle(bool latch)
{
retro_keyboard_event_t *key_event = NULL;
retro_keyboard_event_t *frontend_key_event = NULL;
settings_t *settings = config_get_ptr();
menu_driver_ctl(RARCH_MENU_CTL_TOGGLE, &latch);
if (latch)
menu_driver_ctl(RARCH_MENU_CTL_SET_ALIVE, NULL);
else
menu_driver_ctl(RARCH_MENU_CTL_UNSET_ALIVE, NULL);
runloop_ctl(RUNLOOP_CTL_FRONTEND_KEY_EVENT_GET, &frontend_key_event);
runloop_ctl(RUNLOOP_CTL_KEY_EVENT_GET, &key_event);
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
{
bool refresh = false;
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
/* Menu should always run with vsync on. */
command_event(CMD_EVENT_VIDEO_SET_BLOCKING_STATE, NULL);
/* Stop all rumbling before entering the menu. */
command_event(CMD_EVENT_RUMBLE_STOP, NULL);
if (settings->menu.pause_libretro)
command_event(CMD_EVENT_AUDIO_STOP, NULL);
/* Override keyboard callback to redirect to menu instead.
* We'll use this later for something ... */
if (key_event && frontend_key_event)
{
*frontend_key_event = *key_event;
*key_event = menu_input_key_event;
runloop_ctl(RUNLOOP_CTL_SET_FRAME_TIME_LAST, NULL);
}
}
else
{
if (!runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL);
if (settings && settings->menu.pause_libretro)
command_event(CMD_EVENT_AUDIO_START, NULL);
/* Prevent stray input from going to libretro core */
input_driver_set_flushing_input();
/* Restore libretro keyboard callback. */
if (key_event && frontend_key_event)
*key_event = *frontend_key_event;
}
}
示例6: runloop_ctl
const char *runloop_msg_queue_pull(void)
{
const char *ret = NULL;
runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_LOCK, NULL);
runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_PULL, &ret);
runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_UNLOCK, NULL);
return ret;
}
示例7: runloop_iterate_time_to_exit_load_dummy
/* Loads dummy core instead of exiting RetroArch completely.
* Aborts core shutdown if invoked. */
static int runloop_iterate_time_to_exit_load_dummy(void)
{
if (!runloop_ctl(RUNLOOP_CTL_PREPARE_DUMMY, NULL))
return -1;
runloop_ctl(RUNLOOP_CTL_UNSET_SHUTDOWN, NULL);
runloop_ctl(RUNLOOP_CTL_UNSET_CORE_SHUTDOWN, NULL);
return 1;
}
示例8: menu_driver_toggle
static void menu_driver_toggle(bool latch)
{
const menu_ctx_driver_t *menu_driver = menu_ctx_driver_get_ptr();
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
rarch_system_info_t *system = rarch_system_info_get_ptr();
if (menu_driver->toggle)
menu_driver->toggle(latch);
if (latch)
menu_driver_ctl(RARCH_MENU_CTL_SET_ALIVE, NULL);
else
menu_driver_ctl(RARCH_MENU_CTL_UNSET_ALIVE, NULL);
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
{
menu_entries_set_refresh(false);
/* Menu should always run with vsync on. */
event_command(EVENT_CMD_VIDEO_SET_BLOCKING_STATE);
/* Stop all rumbling before entering the menu. */
event_command(EVENT_CMD_RUMBLE_STOP);
if (settings->menu.pause_libretro)
event_command(EVENT_CMD_AUDIO_STOP);
/* Override keyboard callback to redirect to menu instead.
* We'll use this later for something ...
* FIXME: This should probably be moved to menu_common somehow. */
if (global)
{
global->frontend_key_event = system->key_event;
system->key_event = menu_input_key_event;
runloop_ctl(RUNLOOP_CTL_SET_FRAME_TIME_LAST, NULL);
}
}
else
{
if (!runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
driver_set_nonblock_state();
if (settings && settings->menu.pause_libretro)
event_command(EVENT_CMD_AUDIO_START);
/* Prevent stray input from going to libretro core */
input_driver_ctl(RARCH_INPUT_CTL_SET_FLUSHING_INPUT, NULL);
/* Restore libretro keyboard callback. */
if (global)
system->key_event = global->frontend_key_event;
}
}
示例9: xui_frame
static void xui_frame(void *data)
{
XUIMessage msg;
XUIMessageRender msgRender;
D3DXMATRIX matOrigView;
LPDIRECT3DDEVICE d3dr;
const char *message = NULL;
D3DVIEWPORT vp_full = {0};
d3d_video_t *d3d = (d3d_video_t*)video_driver_get_ptr(false);
if (!d3d)
return;
d3dr = (LPDIRECT3DDEVICE)d3d->dev;
if (!d3dr)
return;
menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);
app.RunFrame();
XuiTimersRun();
XuiRenderBegin( app.GetDC(), D3DCOLOR_ARGB( 255, 0, 0, 0 ) );
XuiRenderGetViewTransform( app.GetDC(), &matOrigView );
XuiMessageRender( &msg, &msgRender,
app.GetDC(), 0xffffffff, XUI_BLEND_NORMAL );
XuiSendMessage( app.GetRootObj(), &msg );
XuiRenderSetViewTransform( app.GetDC(), &matOrigView );
runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_PULL, &message);
if (message)
xui_render_message(message);
else
{
runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_PULL, &message);
if (message)
xui_render_message(message);
}
XuiRenderEnd( app.GetDC() );
menu_display_ctl(MENU_DISPLAY_CTL_UNSET_VIEWPORT, NULL);
}
示例10: runloop_iterate_time_to_exit_load_dummy
/* Loads dummy core instead of exiting RetroArch completely.
* Aborts core shutdown if invoked. */
static int runloop_iterate_time_to_exit_load_dummy(void)
{
content_ctx_info_t content_info = {0};
if (!task_push_content_load_default(
NULL, NULL,
&content_info,
CORE_TYPE_DUMMY,
CONTENT_MODE_LOAD_NOTHING_WITH_DUMMY_CORE,
NULL, NULL))
return -1;
runloop_ctl(RUNLOOP_CTL_UNSET_SHUTDOWN, NULL);
runloop_ctl(RUNLOOP_CTL_UNSET_CORE_SHUTDOWN, NULL);
return 1;
}
示例11: history_playlist_push
static void history_playlist_push(content_playlist_t *playlist,
const char *path, const char *core_path,
struct retro_system_info *info)
{
char tmp[PATH_MAX_LENGTH];
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if (!playlist || rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL) || !info)
return;
/* Path can be relative here.
* Ensure we're pushing absolute path. */
strlcpy(tmp, path, sizeof(tmp));
if (*tmp)
path_resolve_realpath(tmp, sizeof(tmp));
if (system->no_content || *tmp)
content_playlist_push(playlist,
*tmp ? tmp : NULL,
NULL,
core_path,
info->library_name,
NULL,
NULL);
}
示例12: menu_content_environment_get
static void menu_content_environment_get(int *argc, char *argv[],
void *args, void *params_data)
{
struct rarch_main_wrap *wrap_args = (struct rarch_main_wrap*)params_data;
char *fullpath = NULL;
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
if (!wrap_args)
return;
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
wrap_args->no_content = menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL);
if (!global->has_set.verbosity)
wrap_args->verbose = *retro_main_verbosity();
wrap_args->config_path = *global->path.config ? global->path.config : NULL;
wrap_args->sram_path = *global->dir.savefile ? global->dir.savefile : NULL;
wrap_args->state_path = *global->dir.savestate ? global->dir.savestate : NULL;
wrap_args->content_path = *fullpath ? fullpath : NULL;
if (!global->has_set.libretro)
wrap_args->libretro_path = *settings->libretro ? settings->libretro : NULL;
wrap_args->touched = true;
}
示例13: menu_content_push_to_history_playlist
static void menu_content_push_to_history_playlist(void)
{
struct retro_system_info *system = NULL;
settings_t *settings = config_get_ptr();
char *fullpath = NULL;
if (!settings->history_list_enable)
return;
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
if (*fullpath)
{
char tmp[PATH_MAX_LENGTH];
char str[PATH_MAX_LENGTH];
fill_pathname_base(tmp, fullpath, sizeof(tmp));
snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp);
menu_display_msg_queue_push(str, 1, 1, false);
}
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
&system);
content_playlist_push(g_defaults.history,
fullpath,
NULL,
settings->libretro,
system->library_name,
NULL,
NULL);
content_playlist_write_file(g_defaults.history);
}
示例14: menu_content_load
bool menu_content_load(void)
{
bool msg_force = true;
char *fullpath = NULL;
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
/* redraw menu frame */
menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force);
menu_driver_ctl(RARCH_MENU_CTL_RENDER, NULL);
if (!(main_load_content(0, NULL, NULL, menu_content_environment_get)))
{
char name[PATH_MAX_LENGTH];
char msg[PATH_MAX_LENGTH];
fill_pathname_base(name, fullpath, sizeof(name));
snprintf(msg, sizeof(msg), "Failed to load %s.\n", name);
menu_display_msg_queue_push(msg, 1, 90, false);
return false;
}
menu_driver_ctl(RARCH_MENU_CTL_SHADER_MANAGER_INIT, NULL);
event_cmd_ctl(EVENT_CMD_HISTORY_INIT, NULL);
if (*fullpath || menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL))
menu_content_push_to_history_playlist();
event_cmd_ctl(EVENT_CMD_VIDEO_SET_ASPECT_RATIO, NULL);
event_cmd_ctl(EVENT_CMD_RESUME, NULL);
return true;
}
示例15: menu_push_to_history_playlist
static void menu_push_to_history_playlist(void)
{
settings_t *settings = config_get_ptr();
char *fullpath = NULL;
if (!settings->history_list_enable)
return;
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
if (*fullpath)
{
char tmp[PATH_MAX_LENGTH];
char str[PATH_MAX_LENGTH];
fill_pathname_base(tmp, fullpath, sizeof(tmp));
snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp);
menu_display_msg_queue_push(str, 1, 1, false);
}
content_playlist_push(g_defaults.history,
fullpath,
NULL,
settings->libretro,
g_system_menu.library_name,
NULL,
NULL);
}