2015-02-23 01:54:14 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
|
|
|
* Copyright (C) 2011-2015 - Daniel De Matteis
|
|
|
|
*
|
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2015-03-15 01:00:11 +00:00
|
|
|
#include <retro_miscellaneous.h>
|
2015-03-18 21:11:53 +00:00
|
|
|
#ifdef HAVE_THREADS
|
|
|
|
#include <rthreads/rthreads.h>
|
|
|
|
#endif
|
|
|
|
|
2015-07-08 20:14:31 +00:00
|
|
|
#include "general.h"
|
|
|
|
|
|
|
|
#include "runloop_data.h"
|
|
|
|
#include "tasks/tasks.h"
|
|
|
|
#include "input/input_overlay.h"
|
|
|
|
|
2015-05-16 15:27:16 +00:00
|
|
|
#ifdef HAVE_MENU
|
|
|
|
#include "menu/menu.h"
|
2015-06-16 01:03:20 +00:00
|
|
|
#include "menu/menu_entries.h"
|
2015-06-13 17:12:10 +00:00
|
|
|
#include "menu/menu_input.h"
|
2015-05-16 15:27:16 +00:00
|
|
|
#endif
|
|
|
|
|
2015-03-19 06:18:27 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
THREAD_CODE_INIT = 0,
|
2015-03-19 06:28:46 +00:00
|
|
|
THREAD_CODE_DEINIT,
|
2015-06-26 16:35:35 +00:00
|
|
|
THREAD_CODE_ALIVE
|
2015-03-19 06:18:27 +00:00
|
|
|
} thread_code_enum;
|
2015-03-18 04:50:37 +00:00
|
|
|
|
2015-07-08 22:01:55 +00:00
|
|
|
typedef struct data_runloop
|
|
|
|
{
|
|
|
|
bool inited;
|
|
|
|
|
|
|
|
#ifdef HAVE_THREADS
|
|
|
|
bool thread_inited;
|
|
|
|
unsigned thread_code;
|
|
|
|
bool alive;
|
|
|
|
|
|
|
|
slock_t *lock;
|
|
|
|
slock_t *cond_lock;
|
|
|
|
scond_t *cond;
|
|
|
|
sthread_t *thread;
|
|
|
|
#endif
|
|
|
|
} data_runloop_t;
|
2015-03-18 04:50:37 +00:00
|
|
|
|
2015-04-11 01:34:26 +00:00
|
|
|
static char data_runloop_msg[PATH_MAX_LENGTH];
|
|
|
|
|
2015-07-08 22:18:40 +00:00
|
|
|
static data_runloop_t *g_data_runloop;
|
2015-03-15 02:21:58 +00:00
|
|
|
|
2015-07-08 22:01:55 +00:00
|
|
|
static data_runloop_t *rarch_main_data_get_ptr(void)
|
2015-03-20 17:36:18 +00:00
|
|
|
{
|
2015-03-20 17:54:03 +00:00
|
|
|
return g_data_runloop;
|
2015-03-20 17:36:18 +00:00
|
|
|
}
|
|
|
|
|
2015-03-20 00:43:58 +00:00
|
|
|
#ifdef HAVE_THREADS
|
2015-03-18 22:39:33 +00:00
|
|
|
static void data_runloop_thread_deinit(data_runloop_t *runloop)
|
2015-03-18 04:35:05 +00:00
|
|
|
{
|
2015-03-18 22:13:00 +00:00
|
|
|
if (!runloop->thread_inited)
|
2015-03-18 21:11:53 +00:00
|
|
|
{
|
|
|
|
slock_lock(runloop->cond_lock);
|
2015-03-19 06:18:27 +00:00
|
|
|
runloop->alive = false;
|
2015-03-18 21:11:53 +00:00
|
|
|
scond_signal(runloop->cond);
|
2015-03-19 06:18:27 +00:00
|
|
|
slock_unlock(runloop->cond_lock);
|
2015-03-18 21:11:53 +00:00
|
|
|
sthread_join(runloop->thread);
|
|
|
|
|
|
|
|
slock_free(runloop->lock);
|
|
|
|
slock_free(runloop->cond_lock);
|
2015-07-08 20:42:45 +00:00
|
|
|
rarch_main_data_overlay_thread_uninit();
|
2015-03-18 21:11:53 +00:00
|
|
|
scond_free(runloop->cond);
|
|
|
|
}
|
2015-03-18 22:13:00 +00:00
|
|
|
}
|
2015-03-20 00:43:58 +00:00
|
|
|
#endif
|
2015-03-18 22:13:00 +00:00
|
|
|
|
2015-03-23 22:40:36 +00:00
|
|
|
void rarch_main_data_deinit(void)
|
2015-03-18 22:13:00 +00:00
|
|
|
{
|
2015-05-16 14:42:08 +00:00
|
|
|
data_runloop_t *runloop = rarch_main_data_get_ptr();
|
2015-03-18 22:13:00 +00:00
|
|
|
|
2015-04-11 07:33:20 +00:00
|
|
|
if (!runloop)
|
2015-03-18 22:13:00 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
#ifdef HAVE_THREADS
|
2015-04-11 07:33:20 +00:00
|
|
|
if (runloop->thread_inited)
|
2015-03-19 06:28:46 +00:00
|
|
|
{
|
2015-04-11 07:33:20 +00:00
|
|
|
data_runloop_thread_deinit(runloop);
|
2015-04-12 05:17:55 +00:00
|
|
|
|
|
|
|
runloop->thread_inited = false;
|
|
|
|
runloop->thread_code = THREAD_CODE_DEINIT;
|
2015-03-19 06:28:46 +00:00
|
|
|
}
|
2015-03-18 21:11:53 +00:00
|
|
|
#endif
|
|
|
|
|
2015-04-11 07:33:20 +00:00
|
|
|
runloop->inited = false;
|
2015-03-23 22:40:36 +00:00
|
|
|
}
|
|
|
|
|
2015-07-08 22:17:20 +00:00
|
|
|
static void rarch_main_data_free_internal(void)
|
2015-03-23 22:40:36 +00:00
|
|
|
{
|
2015-05-16 14:42:08 +00:00
|
|
|
data_runloop_t *runloop = rarch_main_data_get_ptr();
|
2015-03-20 17:54:03 +00:00
|
|
|
|
2015-07-08 22:17:20 +00:00
|
|
|
if (!runloop)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (runloop)
|
|
|
|
free(runloop);
|
|
|
|
runloop = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void rarch_main_data_free(void)
|
|
|
|
{
|
2015-07-08 18:04:16 +00:00
|
|
|
rarch_main_data_nbio_uninit();
|
2015-07-08 20:03:23 +00:00
|
|
|
#ifdef HAVE_NETWORKING
|
2015-07-08 19:38:22 +00:00
|
|
|
rarch_main_data_http_uninit();
|
2015-07-08 20:03:23 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LIBRETRODB
|
|
|
|
rarch_main_data_db_uninit();
|
|
|
|
#endif
|
2015-07-08 18:04:16 +00:00
|
|
|
|
2015-07-08 22:17:20 +00:00
|
|
|
rarch_main_data_free_internal();
|
2015-03-18 21:11:53 +00:00
|
|
|
}
|
|
|
|
|
2015-07-08 21:01:11 +00:00
|
|
|
static void data_runloop_iterate(bool is_thread)
|
2015-03-18 21:11:53 +00:00
|
|
|
{
|
2015-07-08 21:01:11 +00:00
|
|
|
rarch_main_data_nbio_iterate (is_thread);
|
2015-04-19 14:55:03 +00:00
|
|
|
#ifdef HAVE_RPNG
|
2015-07-08 21:01:11 +00:00
|
|
|
rarch_main_data_nbio_image_iterate (is_thread);
|
2015-04-19 14:55:03 +00:00
|
|
|
#endif
|
2015-04-10 22:11:49 +00:00
|
|
|
#ifdef HAVE_NETWORKING
|
2015-07-08 21:01:11 +00:00
|
|
|
rarch_main_data_http_iterate (is_thread);
|
2015-04-10 22:11:49 +00:00
|
|
|
#endif
|
2015-04-14 06:10:12 +00:00
|
|
|
#ifdef HAVE_LIBRETRODB
|
2015-07-08 21:01:11 +00:00
|
|
|
rarch_main_data_db_iterate (is_thread);
|
2015-04-11 01:13:52 +00:00
|
|
|
#endif
|
2015-03-18 21:11:53 +00:00
|
|
|
}
|
|
|
|
|
2015-05-02 22:48:23 +00:00
|
|
|
|
2015-07-08 22:01:55 +00:00
|
|
|
bool rarch_main_data_active(void)
|
2015-05-02 22:48:23 +00:00
|
|
|
{
|
|
|
|
bool active = false;
|
|
|
|
#ifdef HAVE_LIBRETRODB
|
2015-07-08 20:03:23 +00:00
|
|
|
if (rarch_main_data_db_is_active())
|
2015-07-08 19:13:04 +00:00
|
|
|
active = true;
|
2015-05-02 22:48:23 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_OVERLAY
|
2015-07-11 21:45:23 +00:00
|
|
|
if (input_overlay_data_is_active())
|
2015-07-08 19:13:04 +00:00
|
|
|
active = true;
|
2015-05-02 22:48:23 +00:00
|
|
|
#endif
|
2015-07-08 19:13:04 +00:00
|
|
|
if (rarch_main_data_nbio_image_get_handle())
|
|
|
|
active = true;
|
|
|
|
if (rarch_main_data_nbio_get_handle())
|
|
|
|
active = true;
|
2015-05-02 22:48:23 +00:00
|
|
|
#ifdef HAVE_NETWORKING
|
2015-07-08 19:35:24 +00:00
|
|
|
if (rarch_main_data_http_get_handle())
|
2015-07-08 19:13:04 +00:00
|
|
|
active = true;
|
2015-07-08 19:35:24 +00:00
|
|
|
if (rarch_main_data_http_conn_get_handle())
|
2015-07-08 19:13:04 +00:00
|
|
|
active = true;
|
2015-05-02 22:48:23 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return active;
|
|
|
|
}
|
|
|
|
|
2015-05-18 18:29:52 +00:00
|
|
|
#ifdef HAVE_THREADS
|
2015-03-18 21:11:53 +00:00
|
|
|
static void data_thread_loop(void *data)
|
|
|
|
{
|
|
|
|
data_runloop_t *runloop = (data_runloop_t*)data;
|
|
|
|
|
2015-03-18 22:39:33 +00:00
|
|
|
RARCH_LOG("[Data Thread]: Initializing data thread.\n");
|
|
|
|
|
|
|
|
slock_lock(runloop->lock);
|
|
|
|
while (!runloop->thread_inited)
|
|
|
|
scond_wait(runloop->cond, runloop->lock);
|
|
|
|
slock_unlock(runloop->lock);
|
|
|
|
|
|
|
|
RARCH_LOG("[Data Thread]: Starting data thread.\n");
|
|
|
|
|
2015-04-12 05:17:55 +00:00
|
|
|
while (runloop->alive)
|
2015-03-18 21:11:53 +00:00
|
|
|
{
|
|
|
|
slock_lock(runloop->lock);
|
2015-03-18 23:13:54 +00:00
|
|
|
|
2015-03-19 06:18:27 +00:00
|
|
|
if (!runloop->alive)
|
2015-03-18 23:13:54 +00:00
|
|
|
break;
|
|
|
|
|
2015-07-08 21:01:11 +00:00
|
|
|
data_runloop_iterate(true);
|
2015-03-18 23:13:54 +00:00
|
|
|
|
2015-07-08 22:01:55 +00:00
|
|
|
if (!rarch_main_data_active())
|
2015-05-02 22:48:23 +00:00
|
|
|
rarch_sleep(10);
|
2015-05-02 22:49:37 +00:00
|
|
|
|
|
|
|
slock_unlock(runloop->lock);
|
|
|
|
|
2015-03-18 21:11:53 +00:00
|
|
|
}
|
2015-03-18 23:13:54 +00:00
|
|
|
|
|
|
|
RARCH_LOG("[Data Thread]: Stopping data thread.\n");
|
2015-03-18 21:11:53 +00:00
|
|
|
}
|
2015-05-18 18:29:52 +00:00
|
|
|
#endif
|
2015-03-18 21:11:53 +00:00
|
|
|
|
2015-05-16 14:37:46 +00:00
|
|
|
#ifdef HAVE_THREADS
|
2015-03-18 22:13:00 +00:00
|
|
|
static void rarch_main_data_thread_init(void)
|
|
|
|
{
|
2015-05-16 14:42:08 +00:00
|
|
|
data_runloop_t *runloop = rarch_main_data_get_ptr();
|
2015-03-20 17:36:18 +00:00
|
|
|
|
2015-04-11 07:33:20 +00:00
|
|
|
if (!runloop)
|
2015-04-10 21:17:29 +00:00
|
|
|
return;
|
2015-03-18 22:13:00 +00:00
|
|
|
|
2015-04-11 07:33:20 +00:00
|
|
|
runloop->lock = slock_new();
|
|
|
|
runloop->cond_lock = slock_new();
|
|
|
|
runloop->cond = scond_new();
|
2015-03-18 23:13:54 +00:00
|
|
|
|
2015-07-08 20:42:45 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
|
|
|
rarch_main_data_overlay_thread_init();
|
|
|
|
#endif
|
|
|
|
|
2015-04-11 07:33:20 +00:00
|
|
|
runloop->thread = sthread_create(data_thread_loop, runloop);
|
2015-04-10 21:20:48 +00:00
|
|
|
|
2015-04-11 07:33:20 +00:00
|
|
|
if (!runloop->thread)
|
2015-04-10 21:20:48 +00:00
|
|
|
goto error;
|
2015-03-19 06:18:27 +00:00
|
|
|
|
2015-05-04 18:33:20 +00:00
|
|
|
slock_lock(runloop->lock);
|
2015-04-11 07:33:20 +00:00
|
|
|
runloop->thread_inited = true;
|
|
|
|
runloop->alive = true;
|
|
|
|
runloop->thread_code = THREAD_CODE_ALIVE;
|
2015-05-04 18:33:20 +00:00
|
|
|
slock_unlock(runloop->lock);
|
2015-04-10 21:20:48 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
error:
|
2015-07-08 20:42:45 +00:00
|
|
|
data_runloop_thread_deinit(runloop);
|
2015-03-18 22:13:00 +00:00
|
|
|
}
|
2015-03-20 00:50:14 +00:00
|
|
|
#endif
|
|
|
|
|
2015-03-18 21:11:53 +00:00
|
|
|
void rarch_main_data_iterate(void)
|
|
|
|
{
|
2015-05-16 14:42:08 +00:00
|
|
|
data_runloop_t *runloop = rarch_main_data_get_ptr();
|
2015-03-20 18:48:23 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
|
|
|
|
(void)settings;
|
2015-03-18 21:27:52 +00:00
|
|
|
#ifdef HAVE_THREADS
|
2015-03-20 18:48:23 +00:00
|
|
|
if (settings->menu.threaded_data_runloop_enable)
|
2015-03-18 22:13:00 +00:00
|
|
|
{
|
2015-04-11 07:33:20 +00:00
|
|
|
switch (runloop->thread_code)
|
2015-03-19 06:18:27 +00:00
|
|
|
{
|
|
|
|
case THREAD_CODE_INIT:
|
|
|
|
rarch_main_data_thread_init();
|
|
|
|
break;
|
2015-03-19 06:28:46 +00:00
|
|
|
case THREAD_CODE_DEINIT:
|
2015-04-10 20:30:56 +00:00
|
|
|
case THREAD_CODE_ALIVE:
|
2015-03-19 06:28:46 +00:00
|
|
|
break;
|
2015-03-19 06:18:27 +00:00
|
|
|
}
|
2015-03-18 22:13:00 +00:00
|
|
|
}
|
|
|
|
#endif
|
2015-03-18 20:26:36 +00:00
|
|
|
|
2015-04-10 20:16:07 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
2015-07-08 21:01:11 +00:00
|
|
|
rarch_main_data_overlay_image_upload_iterate(false);
|
2015-04-10 20:16:07 +00:00
|
|
|
#endif
|
2015-04-19 14:55:03 +00:00
|
|
|
#ifdef HAVE_RPNG
|
2015-07-08 21:01:11 +00:00
|
|
|
rarch_main_data_nbio_image_upload_iterate(false);
|
2015-04-19 14:55:03 +00:00
|
|
|
#endif
|
2015-07-11 23:36:03 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
|
|
|
rarch_main_data_overlay_iterate (false);
|
|
|
|
#endif
|
2015-04-10 20:30:56 +00:00
|
|
|
|
2015-07-09 00:31:46 +00:00
|
|
|
#ifdef HAVE_MENU
|
|
|
|
#ifdef HAVE_LIBRETRODB
|
|
|
|
if (rarch_main_data_db_pending_scan_finished())
|
|
|
|
menu_environment_cb(MENU_ENVIRON_RESET_HORIZONTAL_LIST, NULL);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2015-04-11 01:34:26 +00:00
|
|
|
if (data_runloop_msg[0] != '\0')
|
|
|
|
{
|
|
|
|
rarch_main_msg_queue_push(data_runloop_msg, 1, 10, true);
|
|
|
|
data_runloop_msg[0] = '\0';
|
|
|
|
}
|
|
|
|
|
2015-05-16 15:27:16 +00:00
|
|
|
#ifdef HAVE_MENU
|
2015-06-16 01:03:20 +00:00
|
|
|
menu_entries_refresh(MENU_ACTION_REFRESH);
|
2015-05-16 15:27:16 +00:00
|
|
|
#endif
|
|
|
|
|
2015-04-10 21:31:53 +00:00
|
|
|
#ifdef HAVE_THREADS
|
2015-04-11 07:33:20 +00:00
|
|
|
if (settings->menu.threaded_data_runloop_enable && runloop->alive)
|
2015-04-10 20:30:56 +00:00
|
|
|
return;
|
2015-04-10 21:31:53 +00:00
|
|
|
#endif
|
2015-04-10 20:41:37 +00:00
|
|
|
|
2015-07-08 21:01:11 +00:00
|
|
|
data_runloop_iterate(false);
|
2015-03-18 20:26:36 +00:00
|
|
|
}
|
|
|
|
|
2015-03-22 02:41:20 +00:00
|
|
|
static data_runloop_t *rarch_main_data_new(void)
|
2015-03-18 20:26:36 +00:00
|
|
|
{
|
2015-04-11 07:33:20 +00:00
|
|
|
data_runloop_t *runloop = (data_runloop_t*)calloc(1, sizeof(data_runloop_t));
|
2015-03-18 20:26:36 +00:00
|
|
|
|
2015-04-11 07:33:20 +00:00
|
|
|
if (!runloop)
|
2015-03-20 17:54:03 +00:00
|
|
|
return NULL;
|
2015-03-18 20:26:36 +00:00
|
|
|
|
2015-03-20 01:10:14 +00:00
|
|
|
#ifdef HAVE_THREADS
|
2015-04-11 07:33:20 +00:00
|
|
|
runloop->thread_inited = false;
|
|
|
|
runloop->alive = false;
|
2015-03-20 01:10:14 +00:00
|
|
|
#endif
|
2015-03-18 21:37:27 +00:00
|
|
|
|
2015-04-11 07:33:20 +00:00
|
|
|
runloop->inited = true;
|
2015-03-20 17:54:03 +00:00
|
|
|
|
2015-07-08 18:04:16 +00:00
|
|
|
|
2015-04-11 07:33:20 +00:00
|
|
|
return runloop;
|
2015-03-18 20:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void rarch_main_data_clear_state(void)
|
|
|
|
{
|
2015-03-23 22:40:36 +00:00
|
|
|
rarch_main_data_deinit();
|
2015-03-22 02:41:20 +00:00
|
|
|
rarch_main_data_free();
|
|
|
|
g_data_runloop = rarch_main_data_new();
|
2015-07-08 18:04:16 +00:00
|
|
|
|
|
|
|
if (!g_data_runloop)
|
|
|
|
return;
|
|
|
|
|
|
|
|
rarch_main_data_nbio_init();
|
2015-07-08 20:03:23 +00:00
|
|
|
#ifdef HAVE_NETWORKING
|
2015-07-08 19:35:24 +00:00
|
|
|
rarch_main_data_http_init();
|
2015-07-08 20:03:23 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LIBRETRODB
|
|
|
|
rarch_main_data_db_init();
|
|
|
|
#endif
|
2015-03-18 04:35:05 +00:00
|
|
|
}
|
|
|
|
|
2015-07-08 18:04:16 +00:00
|
|
|
|
2015-03-15 01:00:11 +00:00
|
|
|
void rarch_main_data_init_queues(void)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_NETWORKING
|
2015-07-08 19:18:34 +00:00
|
|
|
rarch_main_data_http_init_msg_queue();
|
2015-03-15 01:00:11 +00:00
|
|
|
#endif
|
2015-07-08 18:04:16 +00:00
|
|
|
rarch_main_data_nbio_init_msg_queue();
|
2015-04-11 07:17:27 +00:00
|
|
|
#ifdef HAVE_LIBRETRODB
|
2015-07-08 19:48:58 +00:00
|
|
|
rarch_main_data_db_init_msg_queue();
|
2015-04-11 07:17:27 +00:00
|
|
|
#endif
|
2015-03-15 01:00:11 +00:00
|
|
|
}
|
|
|
|
|
2015-07-08 18:04:16 +00:00
|
|
|
|
2015-03-15 05:41:04 +00:00
|
|
|
void rarch_main_data_msg_queue_push(unsigned type,
|
|
|
|
const char *msg, const char *msg2,
|
|
|
|
unsigned prio, unsigned duration, bool flush)
|
|
|
|
{
|
2015-06-12 15:00:37 +00:00
|
|
|
char new_msg[PATH_MAX_LENGTH] = {0};
|
|
|
|
msg_queue_t *queue = NULL;
|
2015-03-15 05:41:04 +00:00
|
|
|
|
|
|
|
switch(type)
|
|
|
|
{
|
|
|
|
case DATA_TYPE_NONE:
|
|
|
|
break;
|
|
|
|
case DATA_TYPE_FILE:
|
2015-07-08 18:04:16 +00:00
|
|
|
queue = rarch_main_data_nbio_get_msg_queue_ptr();
|
|
|
|
if (!queue)
|
|
|
|
return;
|
2015-04-10 23:17:26 +00:00
|
|
|
snprintf(new_msg, sizeof(new_msg), "%s|%s", msg, msg2);
|
2015-03-15 05:41:04 +00:00
|
|
|
break;
|
|
|
|
case DATA_TYPE_IMAGE:
|
2015-07-08 18:04:16 +00:00
|
|
|
queue = rarch_main_data_nbio_image_get_msg_queue_ptr();
|
|
|
|
if (!queue)
|
|
|
|
return;
|
2015-04-10 23:17:26 +00:00
|
|
|
snprintf(new_msg, sizeof(new_msg), "%s|%s", msg, msg2);
|
2015-03-15 05:41:04 +00:00
|
|
|
break;
|
2015-03-15 18:32:11 +00:00
|
|
|
#ifdef HAVE_NETWORKING
|
2015-03-15 05:41:04 +00:00
|
|
|
case DATA_TYPE_HTTP:
|
2015-07-08 19:18:34 +00:00
|
|
|
queue = rarch_main_data_http_get_msg_queue_ptr();
|
2015-04-10 23:17:26 +00:00
|
|
|
snprintf(new_msg, sizeof(new_msg), "%s|%s", msg, msg2);
|
2015-03-15 05:41:04 +00:00
|
|
|
break;
|
2015-03-15 18:32:11 +00:00
|
|
|
#endif
|
2015-03-15 06:07:59 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
|
|
|
case DATA_TYPE_OVERLAY:
|
2015-04-10 23:17:26 +00:00
|
|
|
snprintf(new_msg, sizeof(new_msg), "%s|%s", msg, msg2);
|
2015-03-15 06:07:59 +00:00
|
|
|
break;
|
2015-05-23 16:03:30 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LIBRETRODB
|
|
|
|
case DATA_TYPE_DB:
|
2015-07-08 19:48:58 +00:00
|
|
|
queue = rarch_main_data_db_get_msg_queue_ptr();
|
2015-05-23 16:03:30 +00:00
|
|
|
snprintf(new_msg, sizeof(new_msg), "%s|%s", msg, msg2);
|
|
|
|
break;
|
2015-03-15 06:07:59 +00:00
|
|
|
#endif
|
2015-03-15 05:41:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!queue)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (flush)
|
|
|
|
msg_queue_clear(queue);
|
|
|
|
msg_queue_push(queue, new_msg, prio, duration);
|
|
|
|
}
|
2015-05-05 15:36:58 +00:00
|
|
|
|
2015-06-02 16:28:51 +00:00
|
|
|
void data_runloop_osd_msg(const char *msg, size_t len)
|
2015-05-05 15:36:58 +00:00
|
|
|
{
|
2015-06-02 16:28:51 +00:00
|
|
|
strlcpy(data_runloop_msg, msg, len);
|
2015-05-05 15:36:58 +00:00
|
|
|
}
|