mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-26 03:24:36 +00:00
(runloop_data.c) Create rarch_main_data_msg_queue_push
This commit is contained in:
parent
d6072b5044
commit
27367a733b
@ -56,9 +56,6 @@ msg_queue_t *msg_queue_new(size_t size);
|
||||
void msg_queue_push(msg_queue_t *queue, const char *msg,
|
||||
unsigned prio, unsigned duration);
|
||||
|
||||
void msg_queue_push_string_list(msg_queue_t *queue, const char *msg,
|
||||
const char *msg2, unsigned prio, unsigned duration);
|
||||
|
||||
/**
|
||||
* msg_queue_pull:
|
||||
* @queue : pointer to queue object
|
||||
|
@ -134,18 +134,6 @@ void msg_queue_push(msg_queue_t *queue, const char *msg,
|
||||
}
|
||||
}
|
||||
|
||||
void msg_queue_push_string_list(msg_queue_t *queue, const char *msg,
|
||||
const char *msg2, unsigned prio, unsigned duration)
|
||||
{
|
||||
char new_msg[8192];
|
||||
|
||||
strlcpy(new_msg, msg, sizeof(new_msg));
|
||||
strlcat(new_msg, "|", sizeof(new_msg));
|
||||
strlcat(new_msg, msg2, sizeof(new_msg));
|
||||
|
||||
msg_queue_push(queue, new_msg, prio, duration);
|
||||
}
|
||||
|
||||
/**
|
||||
* msg_queue_clear:
|
||||
* @queue : pointer to queue object
|
||||
|
@ -285,8 +285,8 @@ static int action_ok_core_updater_list(const char *path,
|
||||
fill_pathname_join(url_path, g_settings.network.buildbot_url,
|
||||
".index", sizeof(url_path));
|
||||
|
||||
msg_queue_clear(g_data_runloop.http.msg_queue);
|
||||
msg_queue_push_string_list(g_data_runloop.http.msg_queue, url_path, "cb_core_updater_list", 0, 1);
|
||||
rarch_main_data_msg_queue_push(DATA_TYPE_HTTP, url_path, "cb_core_updater_list", 0, 1,
|
||||
true);
|
||||
#endif
|
||||
|
||||
return menu_list_push_stack_refresh(
|
||||
@ -424,8 +424,8 @@ static int action_ok_menu_wallpaper_load(const char *path,
|
||||
{
|
||||
strlcpy(g_settings.menu.wallpaper, wallpaper_path, sizeof(g_settings.menu.wallpaper));
|
||||
|
||||
msg_queue_clear(g_data_runloop.nbio.image.msg_queue);
|
||||
msg_queue_push_string_list(g_data_runloop.nbio.image.msg_queue, wallpaper_path, "cb_menu_wallpaper", 0, 1);
|
||||
rarch_main_data_msg_queue_push(DATA_TYPE_IMAGE, wallpaper_path, "cb_menu_wallpaper", 0, 1,
|
||||
true);
|
||||
}
|
||||
|
||||
menu_list_pop_stack_by_needle(menu->menu_list, setting->name);
|
||||
@ -900,8 +900,8 @@ static int action_ok_core_updater_download(const char *path,
|
||||
|
||||
rarch_main_msg_queue_push(msg, 1, 90, true);
|
||||
|
||||
msg_queue_clear(g_data_runloop.http.msg_queue);
|
||||
msg_queue_push_string_list(g_data_runloop.http.msg_queue, core_path, "cb_core_updater_download", 0, 1);
|
||||
rarch_main_data_msg_queue_push(DATA_TYPE_HTTP, core_path,
|
||||
"cb_core_updater_download", 0, 1, true);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
12
runloop.h
12
runloop.h
@ -37,6 +37,14 @@ extern "C" {
|
||||
|
||||
typedef int (*transfer_cb_t )(void *data, size_t len);
|
||||
|
||||
enum runloop_data_type
|
||||
{
|
||||
DATA_TYPE_NONE = 0,
|
||||
DATA_TYPE_FILE,
|
||||
DATA_TYPE_IMAGE,
|
||||
DATA_TYPE_HTTP,
|
||||
};
|
||||
|
||||
typedef struct nbio_image_handle
|
||||
{
|
||||
#ifndef IS_SALAMANDER
|
||||
@ -185,6 +193,10 @@ void rarch_main_msg_queue_free(void);
|
||||
|
||||
void rarch_main_msg_queue_init(void);
|
||||
|
||||
void rarch_main_data_msg_queue_push(unsigned type,
|
||||
const char *msg, const char *msg2,
|
||||
unsigned prio, unsigned duration, bool flush);
|
||||
|
||||
void rarch_main_data_iterate(void);
|
||||
|
||||
void rarch_main_data_init_queues(void);
|
||||
|
@ -662,6 +662,40 @@ void rarch_main_data_init_queues(void)
|
||||
rarch_assert(g_data_runloop.nbio.image.msg_queue = msg_queue_new(8));
|
||||
}
|
||||
|
||||
void rarch_main_data_msg_queue_push(unsigned type,
|
||||
const char *msg, const char *msg2,
|
||||
unsigned prio, unsigned duration, bool flush)
|
||||
{
|
||||
char new_msg[PATH_MAX_LENGTH];
|
||||
msg_queue_t *queue = NULL;
|
||||
|
||||
strlcpy(new_msg, msg, sizeof(new_msg));
|
||||
strlcat(new_msg, "|", sizeof(new_msg));
|
||||
strlcat(new_msg, msg2, sizeof(new_msg));
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case DATA_TYPE_NONE:
|
||||
break;
|
||||
case DATA_TYPE_FILE:
|
||||
queue = g_data_runloop.nbio.msg_queue;
|
||||
break;
|
||||
case DATA_TYPE_IMAGE:
|
||||
queue = g_data_runloop.nbio.image.msg_queue;
|
||||
break;
|
||||
case DATA_TYPE_HTTP:
|
||||
queue = g_data_runloop.http.msg_queue;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!queue)
|
||||
return;
|
||||
|
||||
if (flush)
|
||||
msg_queue_clear(queue);
|
||||
msg_queue_push(queue, new_msg, prio, duration);
|
||||
}
|
||||
|
||||
void rarch_main_data_iterate(void)
|
||||
{
|
||||
#ifdef HAVE_OVERLAY
|
||||
|
Loading…
x
Reference in New Issue
Block a user