Move msg_queue and nbio/http to runloop struct

This commit is contained in:
twinaphex 2015-03-07 13:01:41 +01:00
parent a74cb0574b
commit 795ef467ac
43 changed files with 182 additions and 175 deletions

View file

@ -283,7 +283,7 @@ static void apple_gfx_ctx_update_window_title(void *data)
if (got_text)
[[g_view window] setTitle:[NSString stringWithCString:text encoding:NSUTF8StringEncoding]];
if (g_settings.fps_show)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
msg_queue_push(g_runloop.msg_queue, buf_fps, 1, 1);
#endif
}

View file

@ -151,7 +151,7 @@ bool driver_camera_start(void)
if (g_settings.camera.allow)
return driver.camera->start(driver.camera_data);
msg_queue_push(g_extern.msg_queue,
msg_queue_push(g_runloop.msg_queue,
"Camera is explicitly disabled.\n", 1, 180);
}
return false;

View file

@ -232,7 +232,7 @@ void cheat_manager_free(cheat_manager_t *handle)
void cheat_manager_update(cheat_manager_t *handle, unsigned handle_idx)
{
msg_queue_clear(g_extern.msg_queue);
msg_queue_clear(g_runloop.msg_queue);
char msg[256];
snprintf(msg, sizeof(msg), "Cheat: #%u [%s]: %s",
@ -240,7 +240,7 @@ void cheat_manager_update(cheat_manager_t *handle, unsigned handle_idx)
(handle->cheats[handle_idx].desc) ?
(handle->cheats[handle_idx].desc) : (handle->cheats[handle_idx].code)
);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
RARCH_LOG("%s\n", msg);
}

View file

@ -230,10 +230,10 @@ static bool cmd_set_shader(const char *arg)
if (type == RARCH_SHADER_NONE)
return false;
msg_queue_clear(g_extern.msg_queue);
msg_queue_clear(g_runloop.msg_queue);
snprintf(msg, sizeof(msg), "Shader: \"%s\"", arg);
msg_queue_push(g_extern.msg_queue, msg, 1, 120);
msg_queue_push(g_runloop.msg_queue, msg, 1, 120);
RARCH_LOG("Applying shader \"%s\".\n", arg);
return driver.video->set_shader(driver.video_data, type, arg);

View file

@ -137,8 +137,8 @@ int database_info_write_rdl_iterate(database_info_rdl_handle_t *dbl)
snprintf(msg, sizeof(msg), "%zu/%zu: Scanning %s...\n",
dbl->list_ptr, dbl->list->size, name);
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
crc = crc32_calculate(ret_buf, ret);

View file

@ -268,7 +268,7 @@ bool driver_update_system_av_info(const struct retro_system_av_info *info)
if (driver.recording_data)
{
static const char *msg = "Restarting recording due to driver reinit.";
msg_queue_push(g_extern.msg_queue, msg, 2, 180);
msg_queue_push(g_runloop.msg_queue, msg, 2, 180);
RARCH_WARN("%s\n", msg);
rarch_main_command(RARCH_CMD_RECORD_DEINIT);
rarch_main_command(RARCH_CMD_RECORD_INIT);

View file

@ -674,10 +674,10 @@ bool rarch_environment_cb(unsigned cmd, void *data)
{
const struct retro_message *msg = (const struct retro_message*)data;
RARCH_LOG("Environ SET_MESSAGE: %s\n", msg->msg);
if (g_extern.msg_queue)
if (g_runloop.msg_queue)
{
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, msg->msg, 1, msg->frames);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, msg->msg, 1, msg->frames);
}
break;
}

View file

@ -432,6 +432,30 @@ struct runloop
bool is_paused;
bool is_menu;
bool is_slowmotion;
#ifdef HAVE_NETWORKING
struct
{
struct
{
struct http_connection_t *handle;
transfer_cb_t cb;
char elem1[PATH_MAX_LENGTH];
} connection;
msg_queue_t *msg_queue;
struct http_t *handle;
transfer_cb_t cb;
} http;
#endif
#ifdef HAVE_LIBRETRODB
struct
{
} db;
#endif
nbio_handle_t nbio;
msg_queue_t *msg_queue;
};
/* All run-time- / command line flag-related globals go here. */
@ -618,23 +642,6 @@ struct global
} menu;
#endif
msg_queue_t *msg_queue;
#ifdef HAVE_NETWORKING
struct
{
struct
{
struct http_connection_t *handle;
transfer_cb_t cb;
char elem1[PATH_MAX_LENGTH];
} connection;
msg_queue_t *msg_queue;
struct http_t *handle;
transfer_cb_t cb;
} http;
#endif
nbio_handle_t nbio;
bool exec;

View file

@ -1432,7 +1432,7 @@ static bool exynos_gfx_frame(void *data, const void *frame, unsigned width,
char buffer[128], buffer_fps[128];
video_monitor_get_fps(buffer, sizeof(buffer),
g_settings.fps_show ? buffer_fps : NULL, sizeof(buffer_fps));
msg_queue_push(g_extern.msg_queue, buffer_fps, 1, 1);
msg_queue_push(g_runloop.msg_queue, buffer_fps, 1, 1);
}
/* If at this point the dimension parameters are still zero, setup some *

View file

@ -277,7 +277,7 @@ static void android_gfx_ctx_update_window_title(void *data)
video_monitor_get_fps(buf, sizeof(buf),
g_settings.fps_show ? buf_fps : NULL, sizeof(buf_fps));
if (g_settings.fps_show)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
msg_queue_push(g_runloop.msg_queue, buf_fps, 1, 1);
}
static bool android_gfx_ctx_set_video_mode(void *data,

View file

@ -362,7 +362,7 @@ static void gfx_ctx_qnx_update_window_title(void *data)
video_monitor_get_fps(buf, sizeof(buf),
g_settings.fps_show ? buf_fps : NULL, sizeof(buf_fps));
if (g_settings.fps_show)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
msg_queue_push(g_runloop.msg_queue, buf_fps, 1, 1);
}
static bool gfx_ctx_qnx_set_video_mode(void *data,

View file

@ -145,7 +145,7 @@ static void gfx_ctx_d3d_update_title(void *data)
stat.dwAvailPhys/(1024.0f*1024.0f), stat.dwTotalPhys/(1024.0f*1024.0f));
strlcat(buffer_fps, mem, sizeof(buffer_fps));
#endif
msg_queue_push(g_extern.msg_queue, buffer_fps, 1, 1);
msg_queue_push(g_runloop.msg_queue, buffer_fps, 1, 1);
}
#ifndef _XBOX

View file

@ -274,7 +274,7 @@ static void gfx_ctx_drm_egl_update_window_title(void *data)
video_monitor_get_fps(buf, sizeof(buf),
g_settings.fps_show ? buf_fps : NULL, sizeof(buf_fps));
if (g_settings.fps_show)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
msg_queue_push(g_runloop.msg_queue, buf_fps, 1, 1);
}
static void gfx_ctx_drm_egl_get_video_size(void *data, unsigned *width, unsigned *height)

View file

@ -96,7 +96,7 @@ static void gfx_ctx_emscripten_update_window_title(void *data)
video_monitor_get_fps(buf, sizeof(buf),
g_settings.fps_show ? buf_fps : NULL, sizeof(buf_fps));
if (g_settings.fps_show)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
msg_queue_push(g_runloop.msg_queue, buf_fps, 1, 1);
}
static void gfx_ctx_emscripten_get_video_size(void *data,

View file

@ -201,7 +201,7 @@ static void gfx_ctx_glx_update_window_title(void *data)
g_settings.fps_show ? buf_fps : NULL, sizeof(buf_fps)))
XStoreName(glx->g_dpy, glx->g_win, buf);
if (g_settings.fps_show)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
msg_queue_push(g_runloop.msg_queue, buf_fps, 1, 1);
}
static void gfx_ctx_glx_get_video_size(void *data,

View file

@ -208,7 +208,7 @@ static void gfx_ctx_mali_fbdev_update_window_title(void *data)
video_monitor_get_fps(buf, sizeof(buf),
g_settings.fps_show ? buf_fps : NULL, sizeof(buf_fps));
if (g_settings.fps_show)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
msg_queue_push(g_runloop.msg_queue, buf_fps, 1, 1);
}
static bool gfx_ctx_mali_fbdev_set_video_mode(void *data,

View file

@ -224,7 +224,7 @@ static void gfx_ctx_ps3_update_window_title(void *data)
video_monitor_get_fps(buf, sizeof(buf),
g_settings.fps_show ? buf_fps : NULL, sizeof(buf_fps));
if (g_settings.fps_show)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
msg_queue_push(g_runloop.msg_queue, buf_fps, 1, 1);
}
static void gfx_ctx_ps3_get_video_size(void *data,

View file

@ -291,7 +291,7 @@ static void sdl_ctx_update_window_title(void *data)
#endif
}
if (g_settings.fps_show)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
msg_queue_push(g_runloop.msg_queue, buf_fps, 1, 1);
}
static void sdl_ctx_check_window(void *data, bool *quit, bool *resize,unsigned *width,

View file

@ -128,7 +128,7 @@ static void gfx_ctx_vc_update_window_title(void *data)
video_monitor_get_fps(buf, sizeof(buf),
g_settings.fps_show ? buf_fps : NULL, sizeof(buf_fps));
if (g_settings.fps_show)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
msg_queue_push(g_runloop.msg_queue, buf_fps, 1, 1);
}
static void gfx_ctx_vc_get_video_size(void *data,

View file

@ -197,7 +197,7 @@ static void gfx_ctx_vivante_update_window_title(void *data)
video_monitor_get_fps(buf, sizeof(buf),
g_settings.fps_show ? buf_fps : NULL, sizeof(buf_fps));
if (g_settings.fps_show)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
msg_queue_push(g_runloop.msg_queue, buf_fps, 1, 1);
}
static bool gfx_ctx_vivante_set_video_mode(void *data,

View file

@ -342,7 +342,7 @@ static void gfx_ctx_wl_update_window_title(void *data)
wl_shell_surface_set_title(wl->g_shell_surf, buf);
if (g_settings.fps_show)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
msg_queue_push(g_runloop.msg_queue, buf_fps, 1, 1);
}
static void gfx_ctx_wl_get_video_size(void *data,

View file

@ -354,7 +354,7 @@ static void gfx_ctx_wgl_update_window_title(void *data)
g_settings.fps_show ? buf_fps : NULL, sizeof(buf_fps)))
SetWindowText(g_hwnd, buf);
if (g_settings.fps_show)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
msg_queue_push(g_runloop.msg_queue, buf_fps, 1, 1);
}
static void gfx_ctx_wgl_get_video_size(void *data, unsigned *width, unsigned *height)

View file

@ -219,7 +219,7 @@ static void gfx_ctx_xegl_update_window_title(void *data)
g_settings.fps_show ? buf_fps : NULL, sizeof(buf_fps)))
XStoreName(g_dpy, g_win, buf);
if (g_settings.fps_show)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
msg_queue_push(g_runloop.msg_queue, buf_fps, 1, 1);
}
static void gfx_ctx_xegl_get_video_size(void *data,

View file

@ -59,7 +59,7 @@ void video_monitor_set_refresh_rate(float hz)
{
char msg[PATH_MAX_LENGTH];
snprintf(msg, sizeof(msg), "Setting refresh rate to: %.3f Hz.", hz);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
RARCH_LOG("%s\n", msg);
g_settings.video.refresh_rate = hz;

View file

@ -127,7 +127,7 @@ static void remove_device(void* context, IOReturn result, void* sender)
snprintf(msg, sizeof(msg), "Joypad #%u (%s) disconnected.",
connection->slot, "N/A");
msg_queue_push(g_extern.msg_queue, msg, 0, 60);
msg_queue_push(g_runloop.msg_queue, msg, 0, 60);
RARCH_LOG("[apple_input]: %s\n", msg);
apple->buttons[connection->slot] = 0;

View file

@ -97,7 +97,7 @@ static bool linuxraw_joypad_init_pad(const char *path, struct linuxraw_joypad *p
{
char msg[512];
snprintf(msg, sizeof(msg), "Joypad #%u (%s) connected.", (unsigned)(pad - linuxraw_pads), pad->ident);
msg_queue_push(g_extern.msg_queue, msg, 0, 60);
msg_queue_push(g_runloop.msg_queue, msg, 0, 60);
}
#endif
}
@ -153,7 +153,7 @@ static void handle_plugged_pad(void)
{
char msg[512];
snprintf(msg, sizeof(msg), "Joypad #%u (%s) disconnected.", idx, linuxraw_pads[idx].ident);
msg_queue_push(g_extern.msg_queue, msg, 0, 60);
msg_queue_push(g_runloop.msg_queue, msg, 0, 60);
}
#endif

View file

@ -457,7 +457,7 @@ static void check_device(struct udev_device *dev, const char *path, bool hotplug
{
char msg[512];
snprintf(msg, sizeof(msg), "Joypad #%u (%s) connected.", pad, path);
msg_queue_push(g_extern.msg_queue, msg, 0, 60);
msg_queue_push(g_runloop.msg_queue, msg, 0, 60);
RARCH_LOG("[udev]: %s\n", msg);
}
#else
@ -482,7 +482,7 @@ static void udev_joypad_remove_device(const char *path)
#ifndef IS_JOYCONFIG
char msg[512];
snprintf(msg, sizeof(msg), "Joypad #%u (%s) disconnected.", i, udev_pads[i].ident);
msg_queue_push(g_extern.msg_queue, msg, 0, 60);
msg_queue_push(g_runloop.msg_queue, msg, 0, 60);
RARCH_LOG("[udev]: %s\n", msg);
#endif
free_pad(i, true);

View file

@ -91,7 +91,7 @@ found:
idx, name);
if (!block_osd_spam)
msg_queue_push(g_extern.msg_queue, msg, 0, 60);
msg_queue_push(g_runloop.msg_queue, msg, 0, 60);
RARCH_LOG("%s\n", msg);
return true;

View file

@ -136,7 +136,7 @@ static void video_frame(const void *data, unsigned width,
)
recording_dump_frame(data, width, height, pitch);
msg = msg_queue_pull(g_extern.msg_queue);
msg = msg_queue_pull(g_runloop.msg_queue);
driver.current_msg = msg;
if (video_frame_filter(data, width, height, pitch,

View file

@ -147,7 +147,8 @@ bool driver_location_start(void)
if (g_settings.location.allow)
return driver.location->start(driver.location_data);
msg_queue_push(g_extern.msg_queue, "Location is explicitly disabled.\n", 1, 180);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, "Location is explicitly disabled.\n", 1, 180);
}
return false;
}

View file

@ -444,7 +444,7 @@ static void rgui_render(void)
if (menu->msg_force)
{
message_queue = msg_queue_pull(g_extern.msg_queue);
message_queue = msg_queue_pull(g_runloop.msg_queue);
menu->msg_force = false;
}
else

View file

@ -461,7 +461,7 @@ static void rmenu_xui_frame(void)
xui_render_message(message);
else
{
const char *message = msg_queue_pull(g_extern.msg_queue);
const char *message = msg_queue_pull(g_runloop.msg_queue);
if (message)
xui_render_message(message);
}

View file

@ -105,7 +105,7 @@ static void push_to_history_playlist(void)
fill_pathname_base(tmp, g_extern.fullpath, sizeof(tmp));
snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp);
msg_queue_push(g_extern.msg_queue, str, 1, 1);
msg_queue_push(g_runloop.msg_queue, str, 1, 1);
}
content_playlist_push(g_defaults.history,
@ -143,7 +143,7 @@ bool menu_load_content(void)
fill_pathname_base(name, g_extern.fullpath, sizeof(name));
snprintf(msg, sizeof(msg), "Failed to load %s.\n", name);
msg_queue_push(g_extern.msg_queue, msg, 1, 90);
msg_queue_push(g_runloop.msg_queue, msg, 1, 90);
if (driver.menu)
driver.menu->msg_force = true;

View file

@ -115,8 +115,8 @@ int cb_core_updater_download(void *data_, size_t len)
snprintf(msg, sizeof(msg), "Download complete: %s.",
core_updater_path);
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, msg, 1, 90);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, msg, 1, 90);
#ifdef HAVE_ZLIB
file_ext = path_get_extension(output_path);

View file

@ -286,8 +286,8 @@ static int action_ok_core_updater_list(const char *path,
strlcat(url_path, "|cb_core_updater_list", sizeof(url_path));
msg_queue_clear(g_extern.http.msg_queue);
msg_queue_push(g_extern.http.msg_queue, url_path, 0, 1);
msg_queue_clear(g_runloop.http.msg_queue);
msg_queue_push(g_runloop.http.msg_queue, url_path, 0, 1);
#endif
return menu_list_push_stack_refresh(
@ -426,8 +426,8 @@ static int action_ok_menu_wallpaper_load(const char *path,
strlcpy(g_settings.menu.wallpaper, wallpaper_path, sizeof(g_settings.menu.wallpaper));
strlcat(wallpaper_path, "|cb_menu_wallpaper", sizeof(wallpaper_path));
msg_queue_clear(g_extern.nbio.image.msg_queue);
msg_queue_push(g_extern.nbio.image.msg_queue, wallpaper_path, 0, 1);
msg_queue_clear(g_runloop.nbio.image.msg_queue);
msg_queue_push(g_runloop.nbio.image.msg_queue, wallpaper_path, 0, 1);
}
menu_list_pop_stack_by_needle(menu->menu_list, setting->name);
@ -899,13 +899,13 @@ static int action_ok_core_updater_download(const char *path,
strlcpy(core_updater_path, path, sizeof(core_updater_path));
snprintf(msg, sizeof(msg), "Starting download: %s.", path);
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, msg, 1, 90);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, msg, 1, 90);
strlcat(core_path, "|cb_core_updater_download", sizeof(core_path));
msg_queue_clear(g_extern.http.msg_queue);
msg_queue_push(g_extern.http.msg_queue, core_path, 0, 1);
msg_queue_clear(g_runloop.http.msg_queue);
msg_queue_push(g_runloop.http.msg_queue, core_path, 0, 1);
#endif
return 0;
}

View file

@ -122,8 +122,8 @@ struct netplay
static void warn_hangup(void)
{
RARCH_WARN("Netplay has disconnected. Will continue without connection ...\n");
if (g_extern.msg_queue)
msg_queue_push(g_extern.msg_queue, "Netplay has disconnected. Will continue without connection.", 0, 480);
if (g_runloop.msg_queue)
msg_queue_push(g_runloop.msg_queue, "Netplay has disconnected. Will continue without connection.", 0, 480);
}
/**
@ -279,7 +279,7 @@ static bool netplay_get_cmd(netplay_t *netplay)
netplay->flip_frame = flip_frame;
RARCH_LOG("Netplay users are flipped.\n");
msg_queue_push(g_extern.msg_queue, "Netplay users are flipped.", 1, 180);
msg_queue_push(g_runloop.msg_queue, "Netplay users are flipped.", 1, 180);
return netplay_cmd_ack(netplay);
@ -606,7 +606,7 @@ static void log_connection(const struct sockaddr_storage *their_addr,
char msg[512];
snprintf(msg, sizeof(msg), "Got connection from: \"%s (%s)\" (#%u)",
nick, str, slot);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
RARCH_LOG("%s\n", msg);
}
}
@ -912,7 +912,7 @@ static bool send_info(netplay_t *netplay)
snprintf(msg, sizeof(msg), "Connected to: \"%s\"", netplay->other_nick);
RARCH_LOG("%s\n", msg);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
return true;
}
@ -1062,7 +1062,7 @@ static bool get_info_spectate(netplay_t *netplay)
}
snprintf(msg, sizeof(msg), "Connected to \"%s\"", netplay->other_nick);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
RARCH_LOG("%s\n", msg);
@ -1265,7 +1265,7 @@ void netplay_flip_users(netplay_t *netplay)
&& netplay_get_response(netplay))
{
RARCH_LOG("Netplay users are flipped.\n");
msg_queue_push(g_extern.msg_queue, "Netplay users are flipped.", 1, 180);
msg_queue_push(g_runloop.msg_queue, "Netplay users are flipped.", 1, 180);
/* Queue up a flip well enough in the future. */
netplay->flip ^= true;
@ -1281,7 +1281,7 @@ void netplay_flip_users(netplay_t *netplay)
error:
RARCH_WARN("%s\n", msg);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
}
/**
@ -1367,8 +1367,8 @@ static int16_t netplay_get_spectate_input(netplay_t *netplay, bool port,
return swap_if_big16(inp);
RARCH_ERR("Connection with host was cut.\n");
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue,
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue,
"Connection with host was cut.", 1, 180);
pretro_set_input_state(netplay->cbs.state_cb);
@ -1586,7 +1586,7 @@ static void netplay_post_frame_spectate(netplay_t *netplay)
RARCH_LOG("Client (#%u) disconnected ...\n", i);
snprintf(msg, sizeof(msg), "Client (#%u) disconnected.", i);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
socket_close(netplay->spectate_fds[i]);
netplay->spectate_fds[i] = -1;

View file

@ -122,8 +122,8 @@ void recording_dump_frame(const void *data, unsigned width,
{
static const char msg[] = "Recording terminated due to resize.";
RARCH_WARN("%s\n", msg);
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
rarch_main_command(RARCH_CMD_RECORD_DEINIT);
return;

View file

@ -939,7 +939,7 @@ static void init_movie(void)
}
g_extern.bsv.movie_playback = true;
msg_queue_push(g_extern.msg_queue, "Starting movie playback.", 2, 180);
msg_queue_push(g_runloop.msg_queue, "Starting movie playback.", 2, 180);
RARCH_LOG("Starting movie playback.\n");
g_settings.rewind_granularity = 1;
}
@ -949,17 +949,17 @@ static void init_movie(void)
snprintf(msg, sizeof(msg), "Starting movie record to \"%s\".",
g_extern.bsv.movie_start_path);
msg_queue_clear(g_extern.msg_queue);
msg_queue_clear(g_runloop.msg_queue);
if (!(g_extern.bsv.movie = bsv_movie_init(g_extern.bsv.movie_start_path,
RARCH_MOVIE_RECORD)))
{
msg_queue_push(g_extern.msg_queue, "Failed to start movie record.", 1, 180);
msg_queue_push(g_runloop.msg_queue, "Failed to start movie record.", 1, 180);
RARCH_ERR("Failed to start movie record.\n");
return;
}
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
RARCH_LOG("Starting movie record to \"%s\".\n",
g_extern.bsv.movie_start_path);
g_settings.rewind_granularity = 1;
@ -1014,8 +1014,8 @@ static bool init_netplay(void)
g_extern.netplay_is_client = false;
RARCH_WARN(RETRO_LOG_INIT_NETPLAY_FAILED);
if (g_extern.msg_queue)
msg_queue_push(g_extern.msg_queue,
if (g_runloop.msg_queue)
msg_queue_push(g_runloop.msg_queue,
RETRO_MSG_INIT_NETPLAY_FAILED,
0, 180);
return false;
@ -1268,7 +1268,7 @@ static void load_auto_state(void)
snprintf(msg, sizeof(msg), "Auto-loading savestate from \"%s\" %s.",
savestate_name_auto, ret ? "succeeded" : "failed");
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
RARCH_LOG("%s\n", msg);
}
@ -1367,8 +1367,8 @@ static void main_state(unsigned cmd)
else
strlcpy(msg, "Core does not support save states.", sizeof(msg));
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, msg, 2, 180);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, msg, 2, 180);
RARCH_LOG("%s\n", msg);
}
@ -1398,8 +1398,8 @@ void rarch_disk_control_append_image(const char *path)
snprintf(msg, sizeof(msg), "Appended disk: %s", path);
RARCH_LOG("%s\n", msg);
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, msg, 0, 180);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, msg, 0, 180);
rarch_main_command(RARCH_CMD_AUTOSAVE_DEINIT);
@ -1460,8 +1460,8 @@ void rarch_disk_control_set_eject(bool new_state, bool print_log)
/* Only noise in menu. */
if (print_log)
{
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
}
}
}
@ -1511,8 +1511,8 @@ void rarch_disk_control_set_index(unsigned idx)
RARCH_ERR("%s\n", msg);
else
RARCH_LOG("%s\n", msg);
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
}
}
@ -2058,8 +2058,8 @@ static bool save_core_config(void)
else
{
const char *message = "Config directory not set. Cannot save new config.";
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, message, 1, 180);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, message, 1, 180);
RARCH_ERR("%s\n", message);
return false;
}
@ -2121,8 +2121,8 @@ static bool save_core_config(void)
RARCH_ERR("%s\n", msg);
}
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
return ret;
}
@ -2208,8 +2208,8 @@ bool rarch_main_command(unsigned cmd)
break;
case RARCH_CMD_RESET:
RARCH_LOG(RETRO_LOG_RESETTING_CONTENT);
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, "Reset.", 1, 120);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, "Reset.", 1, 120);
pretro_reset();
/* bSNES since v073r01 resets controllers to JOYPAD
@ -2337,8 +2337,8 @@ bool rarch_main_command(unsigned cmd)
return false;
}
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
RARCH_LOG("%s\n", msg);
}
break;
@ -2602,22 +2602,22 @@ bool rarch_main_command(unsigned cmd)
rarch_main_command(RARCH_CMD_AUTOSAVE_INIT);
break;
case RARCH_CMD_MSG_QUEUE_DEINIT:
if (g_extern.msg_queue)
msg_queue_free(g_extern.msg_queue);
g_extern.msg_queue = NULL;
if (g_runloop.msg_queue)
msg_queue_free(g_runloop.msg_queue);
g_runloop.msg_queue = NULL;
break;
case RARCH_CMD_MSG_QUEUE_INIT:
rarch_main_command(RARCH_CMD_MSG_QUEUE_DEINIT);
if (!g_extern.msg_queue)
rarch_assert(g_extern.msg_queue = msg_queue_new(8));
if (!g_runloop.msg_queue)
rarch_assert(g_runloop.msg_queue = msg_queue_new(8));
#ifdef HAVE_NETWORKING
if (!g_extern.http.msg_queue)
rarch_assert(g_extern.http.msg_queue = msg_queue_new(8));
if (!g_runloop.http.msg_queue)
rarch_assert(g_runloop.http.msg_queue = msg_queue_new(8));
#endif
if (!g_extern.nbio.msg_queue)
rarch_assert(g_extern.nbio.msg_queue = msg_queue_new(8));
if (!g_extern.nbio.image.msg_queue)
rarch_assert(g_extern.nbio.image.msg_queue = msg_queue_new(8));
if (!g_runloop.nbio.msg_queue)
rarch_assert(g_runloop.nbio.msg_queue = msg_queue_new(8));
if (!g_runloop.nbio.image.msg_queue)
rarch_assert(g_runloop.nbio.image.msg_queue = msg_queue_new(8));
break;
case RARCH_CMD_BSV_MOVIE_DEINIT:
if (g_extern.bsv.movie)
@ -2719,8 +2719,8 @@ bool rarch_main_command(unsigned cmd)
}
else
{
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, "Core does not support Disk Options.", 1, 120);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, "Core does not support Disk Options.", 1, 120);
}
break;
case RARCH_CMD_DISK_NEXT:
@ -2740,8 +2740,8 @@ bool rarch_main_command(unsigned cmd)
}
else
{
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, "Core does not support Disk Options.", 1, 120);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, "Core does not support Disk Options.", 1, 120);
}
break;
case RARCH_CMD_DISK_PREV:
@ -2761,8 +2761,8 @@ bool rarch_main_command(unsigned cmd)
}
else
{
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, "Core does not support Disk Options.", 1, 120);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, "Core does not support Disk Options.", 1, 120);
}
break;
case RARCH_CMD_RUMBLE_STOP:

View file

@ -59,8 +59,8 @@ static void set_volume(float gain)
g_settings.audio.volume = min(g_settings.audio.volume, 12.0f);
snprintf(msg, sizeof(msg), "Volume: %.1f dB", g_settings.audio.volume);
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
RARCH_LOG("%s\n", msg);
g_extern.audio_data.volume_gain = db_to_gain(g_settings.audio.volume);
@ -174,15 +174,13 @@ static void check_stateslots(bool pressed_increase, bool pressed_decrease)
else
return;
if (g_extern.msg_queue)
msg_queue_clear(g_extern.msg_queue);
msg_queue_clear(g_runloop.msg_queue);
snprintf(msg, sizeof(msg), "State slot: %d",
g_settings.state_slot);
if (g_extern.msg_queue)
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
if (g_runloop.msg_queue)
msg_queue_push(g_runloop.msg_queue, msg, 1, 180);
RARCH_LOG("%s\n", msg);
}
@ -239,13 +237,13 @@ static void check_rewind(bool pressed)
{
const void *buf = NULL;
msg_queue_clear(g_extern.msg_queue);
msg_queue_clear(g_runloop.msg_queue);
if (state_manager_pop(g_extern.rewind.state, &buf))
{
g_extern.rewind.frame_is_reverse = true;
setup_rewind_audio();
msg_queue_push(g_extern.msg_queue, RETRO_MSG_REWINDING, 0,
msg_queue_push(g_runloop.msg_queue, RETRO_MSG_REWINDING, 0,
g_runloop.is_paused ? 1 : 30);
pretro_unserialize(buf, g_extern.rewind.size);
@ -253,7 +251,7 @@ static void check_rewind(bool pressed)
bsv_movie_frame_rewind(g_extern.bsv.movie);
}
else
msg_queue_push(g_extern.msg_queue,
msg_queue_push(g_runloop.msg_queue,
RETRO_MSG_REWIND_REACHED_END, 0, 30);
}
else
@ -296,8 +294,8 @@ static void check_slowmotion(bool pressed)
if (g_settings.video.black_frame_insertion)
rarch_render_cached_frame();
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, g_extern.rewind.frame_is_reverse ?
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, g_extern.rewind.frame_is_reverse ?
"Slow motion rewind." : "Slow motion.", 0, 30);
}
@ -329,8 +327,8 @@ static bool check_movie_init(void)
if (!g_extern.bsv.movie)
ret = false;
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, g_extern.bsv.movie ?
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, g_extern.bsv.movie ?
msg : "Failed to start movie record.", 1, 180);
if (g_extern.bsv.movie)
@ -353,8 +351,8 @@ static bool check_movie_record(void)
if (!g_extern.bsv.movie)
return false;
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue,
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue,
RETRO_MSG_MOVIE_RECORD_STOPPING, 2, 180);
RARCH_LOG(RETRO_LOG_MOVIE_RECORD_STOPPING);
@ -375,7 +373,7 @@ static bool check_movie_playback(void)
if (!g_extern.bsv.movie_end)
return false;
msg_queue_push(g_extern.msg_queue,
msg_queue_push(g_runloop.msg_queue,
RETRO_MSG_MOVIE_PLAYBACK_ENDED, 1, 180);
RARCH_LOG(RETRO_LOG_MOVIE_PLAYBACK_ENDED);
@ -441,11 +439,11 @@ static void check_shader_dir(bool pressed_next, bool pressed_prev)
else
return;
msg_queue_clear(g_extern.msg_queue);
msg_queue_clear(g_runloop.msg_queue);
snprintf(msg, sizeof(msg), "Shader #%u: \"%s\".",
(unsigned)g_extern.shader_dir.ptr, shader);
msg_queue_push(g_extern.msg_queue, msg, 1, 120);
msg_queue_push(g_runloop.msg_queue, msg, 1, 120);
RARCH_LOG("Applying shader \"%s\".\n", shader);
if (!video_driver_set_shader(type, shader))

View file

@ -37,7 +37,7 @@ static int rarch_main_iterate_http_transfer(void)
{
size_t pos = 0, tot = 0;
if (!net_http_update(g_extern.http.handle, &pos, &tot))
if (!net_http_update(g_runloop.http.handle, &pos, &tot))
{
#ifdef _WIN32
RARCH_LOG("%.9I64u / %.9I64u \r", (unsigned long long)pos, (unsigned long long)tot);
@ -52,22 +52,22 @@ static int rarch_main_iterate_http_transfer(void)
static int rarch_main_iterate_http_conn_transfer(void)
{
if (!net_http_connection_iterate(g_extern.http.connection.handle))
if (!net_http_connection_iterate(g_runloop.http.connection.handle))
return -1;
return 0;
}
static int rarch_main_iterate_http_conn_parse(void)
{
if (net_http_connection_done(g_extern.http.connection.handle))
if (net_http_connection_done(g_runloop.http.connection.handle))
{
if (g_extern.http.connection.handle && g_extern.http.connection.cb)
g_extern.http.connection.cb(g_extern.http.connection.handle, 0);
if (g_runloop.http.connection.handle && g_runloop.http.connection.cb)
g_runloop.http.connection.cb(g_runloop.http.connection.handle, 0);
}
net_http_connection_free(g_extern.http.connection.handle);
net_http_connection_free(g_runloop.http.connection.handle);
g_extern.http.connection.handle = NULL;
g_runloop.http.connection.handle = NULL;
return 0;
}
@ -75,37 +75,37 @@ static int rarch_main_iterate_http_conn_parse(void)
static int rarch_main_iterate_http_parse(void)
{
size_t len;
char *data = (char*)net_http_data(g_extern.http.handle, &len, false);
char *data = (char*)net_http_data(g_runloop.http.handle, &len, false);
if (data && g_extern.http.cb)
g_extern.http.cb(data, len);
if (data && g_runloop.http.cb)
g_runloop.http.cb(data, len);
net_http_delete(g_extern.http.handle);
net_http_delete(g_runloop.http.handle);
g_extern.http.handle = NULL;
msg_queue_clear(g_extern.http.msg_queue);
g_runloop.http.handle = NULL;
msg_queue_clear(g_runloop.http.msg_queue);
return 0;
}
static int cb_http_conn_default(void *data_, size_t len)
{
g_extern.http.handle = net_http_new(g_extern.http.connection.handle);
g_runloop.http.handle = net_http_new(g_runloop.http.connection.handle);
if (!g_extern.http.handle)
if (!g_runloop.http.handle)
{
RARCH_ERR("Could not create new HTTP session handle.\n");
return -1;
}
g_extern.http.cb = NULL;
g_runloop.http.cb = NULL;
if (g_extern.http.connection.elem1[0] != '\0')
if (g_runloop.http.connection.elem1[0] != '\0')
{
if (!strcmp(g_extern.http.connection.elem1, "cb_core_updater_download"))
g_extern.http.cb = &cb_core_updater_download;
if (!strcmp(g_extern.http.connection.elem1, "cb_core_updater_list"))
g_extern.http.cb = &cb_core_updater_list;
if (!strcmp(g_runloop.http.connection.elem1, "cb_core_updater_download"))
g_runloop.http.cb = &cb_core_updater_download;
if (!strcmp(g_runloop.http.connection.elem1, "cb_core_updater_list"))
g_runloop.http.cb = &cb_core_updater_list;
}
return 0;
@ -128,13 +128,13 @@ static int rarch_main_iterate_http_poll(void)
{
char elem0[PATH_MAX_LENGTH];
struct string_list *str_list = NULL;
const char *url = msg_queue_pull(g_extern.http.msg_queue);
const char *url = msg_queue_pull(g_runloop.http.msg_queue);
if (!url)
return -1;
/* Can only deal with one HTTP transfer at a time for now */
if (g_extern.http.handle)
if (g_runloop.http.handle)
return -1;
str_list = string_split(url, "|");
@ -145,17 +145,17 @@ static int rarch_main_iterate_http_poll(void)
if (str_list->size > 0)
strlcpy(elem0, str_list->elems[0].data, sizeof(elem0));
g_extern.http.connection.handle = net_http_connection_new(elem0);
g_runloop.http.connection.handle = net_http_connection_new(elem0);
if (!g_extern.http.connection.handle)
if (!g_runloop.http.connection.handle)
return -1;
g_extern.http.connection.cb = &cb_http_conn_default;
g_runloop.http.connection.cb = &cb_http_conn_default;
if (str_list->size > 1)
strlcpy(g_extern.http.connection.elem1,
strlcpy(g_runloop.http.connection.elem1,
str_list->elems[1].data,
sizeof(g_extern.http.connection.elem1));
sizeof(g_runloop.http.connection.elem1));
string_list_free(str_list);
@ -485,8 +485,8 @@ static void rarch_main_iterate_rdl(void)
#ifdef HAVE_LIBRETRODB
if (!driver.menu->rdl->iterating)
{
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, "Scanning of directory finished.\n", 1, 180);
msg_queue_clear(g_runloop.msg_queue);
msg_queue_push(g_runloop.msg_queue, "Scanning of directory finished.\n", 1, 180);
database_info_write_rdl_free(driver.menu->rdl);
driver.menu->rdl = NULL;
@ -533,16 +533,16 @@ void do_data_nbio_state_checks(nbio_handle_t *nbio)
void do_data_state_checks(void)
{
do_data_nbio_state_checks(&g_extern.nbio);
do_data_nbio_state_checks(&g_runloop.nbio);
#ifdef HAVE_NETWORKING
if (g_extern.http.connection.handle)
if (g_runloop.http.connection.handle)
{
if (!rarch_main_iterate_http_conn_transfer())
rarch_main_iterate_http_conn_parse();
}
if (g_extern.http.handle)
if (g_runloop.http.handle)
{
if (!rarch_main_iterate_http_transfer())
rarch_main_iterate_http_parse();

View file

@ -258,7 +258,7 @@ bool take_screenshot(void)
driver.video->viewport_info;
/* Clear out message queue to avoid OSD fonts to appear on screenshot. */
msg_queue_clear(g_extern.msg_queue);
msg_queue_clear(g_runloop.msg_queue);
if (viewport_read)
{
@ -292,7 +292,7 @@ bool take_screenshot(void)
msg = RETRO_MSG_TAKE_SCREENSHOT_FAILED;
}
msg_queue_push(g_extern.msg_queue, msg, 1, g_runloop.is_paused ? 1 : 180);
msg_queue_push(g_runloop.msg_queue, msg, 1, g_runloop.is_paused ? 1 : 180);
if (g_runloop.is_paused)
rarch_render_cached_frame();

View file

@ -33,6 +33,7 @@
* with special #ifdefs.
*/
struct settings g_settings;
struct runloop g_runloop;
struct global g_extern;
driver_t driver;

View file

@ -44,7 +44,7 @@ bool screenshot_dump(const char *folder, const void *frame,
if(ret == S_OK)
{
RARCH_LOG("Screenshot saved: %s.\n", filename);
msg_queue_push(g_extern.msg_queue, "Screenshot saved.", 1, 30);
msg_queue_push(g_runloop.msg_queue, "Screenshot saved.", 1, 30);
return true;
}