mirror of
https://github.com/libretro/RetroArch
synced 2025-03-22 07:21:15 +00:00
Move code over to runloop.h
This commit is contained in:
parent
55f517fff0
commit
96ae2e9882
72
general.h
72
general.h
@ -33,12 +33,6 @@
|
|||||||
#include <retro_miscellaneous.h>
|
#include <retro_miscellaneous.h>
|
||||||
#include "gfx/video_viewport.h"
|
#include "gfx/video_viewport.h"
|
||||||
|
|
||||||
#include <file/nbio.h>
|
|
||||||
#ifndef IS_SALAMANDER
|
|
||||||
#include <formats/image.h>
|
|
||||||
#include <formats/rpng.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
@ -404,55 +398,7 @@ typedef struct rarch_resolution
|
|||||||
#define AUDIO_BUFFER_FREE_SAMPLES_COUNT (8 * 1024)
|
#define AUDIO_BUFFER_FREE_SAMPLES_COUNT (8 * 1024)
|
||||||
#define MEASURE_FRAME_TIME_SAMPLES_COUNT (2 * 1024)
|
#define MEASURE_FRAME_TIME_SAMPLES_COUNT (2 * 1024)
|
||||||
|
|
||||||
typedef int (*transfer_cb_t )(void *data, size_t len);
|
/* All libretro runloop-related globals go here. */
|
||||||
|
|
||||||
typedef struct nbio_image_handle
|
|
||||||
{
|
|
||||||
#ifndef IS_SALAMANDER
|
|
||||||
struct texture_image ti;
|
|
||||||
#endif
|
|
||||||
bool is_blocking;
|
|
||||||
bool is_blocking_on_processing;
|
|
||||||
bool is_finished;
|
|
||||||
bool is_finished_with_processing;
|
|
||||||
transfer_cb_t cb;
|
|
||||||
struct rpng_t *handle;
|
|
||||||
unsigned processing_pos_increment;
|
|
||||||
unsigned pos_increment;
|
|
||||||
uint64_t frame_count;
|
|
||||||
uint64_t processing_frame_count;
|
|
||||||
int processing_final_state;
|
|
||||||
msg_queue_t *msg_queue;
|
|
||||||
} nbio_image_handle_t;
|
|
||||||
|
|
||||||
typedef struct nbio_handle
|
|
||||||
{
|
|
||||||
nbio_image_handle_t image;
|
|
||||||
bool is_blocking;
|
|
||||||
bool is_finished;
|
|
||||||
transfer_cb_t cb;
|
|
||||||
struct nbio_t *handle;
|
|
||||||
unsigned pos_increment;
|
|
||||||
uint64_t frame_count;
|
|
||||||
msg_queue_t *msg_queue;
|
|
||||||
} nbio_handle_t;
|
|
||||||
|
|
||||||
#ifdef HAVE_NETWORKING
|
|
||||||
typedef struct http_handle
|
|
||||||
{
|
|
||||||
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_handle_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* All runloop-related globals go here. */
|
|
||||||
|
|
||||||
struct runloop
|
struct runloop
|
||||||
{
|
{
|
||||||
@ -462,22 +408,6 @@ struct runloop
|
|||||||
bool is_menu;
|
bool is_menu;
|
||||||
bool is_slowmotion;
|
bool is_slowmotion;
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
#ifdef HAVE_NETWORKING
|
|
||||||
http_handle_t http;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBRETRODB
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
} db;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
nbio_handle_t nbio;
|
|
||||||
|
|
||||||
} data;
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "menu_navigation.h"
|
#include "menu_navigation.h"
|
||||||
|
|
||||||
#include "../retroarch.h"
|
#include "../retroarch.h"
|
||||||
|
#include "../runloop.h"
|
||||||
|
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
#include "../net_http.h"
|
#include "../net_http.h"
|
||||||
@ -284,8 +285,8 @@ static int action_ok_core_updater_list(const char *path,
|
|||||||
fill_pathname_join(url_path, g_settings.network.buildbot_url,
|
fill_pathname_join(url_path, g_settings.network.buildbot_url,
|
||||||
".index", sizeof(url_path));
|
".index", sizeof(url_path));
|
||||||
|
|
||||||
msg_queue_clear(g_runloop.data.http.msg_queue);
|
msg_queue_clear(g_data_runloop.http.msg_queue);
|
||||||
msg_queue_push_string_list(g_runloop.data.http.msg_queue, url_path, "cb_core_updater_list", 0, 1);
|
msg_queue_push_string_list(g_data_runloop.http.msg_queue, url_path, "cb_core_updater_list", 0, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return menu_list_push_stack_refresh(
|
return menu_list_push_stack_refresh(
|
||||||
@ -423,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));
|
strlcpy(g_settings.menu.wallpaper, wallpaper_path, sizeof(g_settings.menu.wallpaper));
|
||||||
|
|
||||||
msg_queue_clear(g_runloop.data.nbio.image.msg_queue);
|
msg_queue_clear(g_data_runloop.nbio.image.msg_queue);
|
||||||
msg_queue_push_string_list(g_runloop.data.nbio.image.msg_queue, wallpaper_path, "cb_menu_wallpaper", 0, 1);
|
msg_queue_push_string_list(g_data_runloop.nbio.image.msg_queue, wallpaper_path, "cb_menu_wallpaper", 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_list_pop_stack_by_needle(menu->menu_list, setting->name);
|
menu_list_pop_stack_by_needle(menu->menu_list, setting->name);
|
||||||
@ -900,8 +901,8 @@ static int action_ok_core_updater_download(const char *path,
|
|||||||
msg_queue_clear(g_runloop.msg_queue);
|
msg_queue_clear(g_runloop.msg_queue);
|
||||||
msg_queue_push(g_runloop.msg_queue, msg, 1, 90);
|
msg_queue_push(g_runloop.msg_queue, msg, 1, 90);
|
||||||
|
|
||||||
msg_queue_clear(g_runloop.data.http.msg_queue);
|
msg_queue_clear(g_data_runloop.http.msg_queue);
|
||||||
msg_queue_push_string_list(g_runloop.data.http.msg_queue, core_path, "cb_core_updater_download", 0, 1);
|
msg_queue_push_string_list(g_data_runloop.http.msg_queue, core_path, "cb_core_updater_download", 0, 1);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
11
retroarch.c
11
retroarch.c
@ -29,6 +29,7 @@
|
|||||||
#include <file/dir_list.h>
|
#include <file/dir_list.h>
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
#include "retroarch.h"
|
#include "retroarch.h"
|
||||||
|
#include "runloop.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include <compat/strl.h>
|
#include <compat/strl.h>
|
||||||
#include "screenshot.h"
|
#include "screenshot.h"
|
||||||
@ -1626,6 +1627,7 @@ static void main_clear_state_extern(void)
|
|||||||
|
|
||||||
memset(&g_extern, 0, sizeof(g_extern));
|
memset(&g_extern, 0, sizeof(g_extern));
|
||||||
memset(&g_runloop, 0, sizeof(g_runloop));
|
memset(&g_runloop, 0, sizeof(g_runloop));
|
||||||
|
memset(&g_data_runloop, 0, sizeof(g_data_runloop));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2650,14 +2652,7 @@ bool rarch_main_command(unsigned cmd)
|
|||||||
rarch_main_command(RARCH_CMD_MSG_QUEUE_DEINIT);
|
rarch_main_command(RARCH_CMD_MSG_QUEUE_DEINIT);
|
||||||
if (!g_runloop.msg_queue)
|
if (!g_runloop.msg_queue)
|
||||||
rarch_assert(g_runloop.msg_queue = msg_queue_new(8));
|
rarch_assert(g_runloop.msg_queue = msg_queue_new(8));
|
||||||
#ifdef HAVE_NETWORKING
|
rarch_main_data_init_queues();
|
||||||
if (!g_runloop.data.http.msg_queue)
|
|
||||||
rarch_assert(g_runloop.data.http.msg_queue = msg_queue_new(8));
|
|
||||||
#endif
|
|
||||||
if (!g_runloop.data.nbio.msg_queue)
|
|
||||||
rarch_assert(g_runloop.data.nbio.msg_queue = msg_queue_new(8));
|
|
||||||
if (!g_runloop.data.nbio.image.msg_queue)
|
|
||||||
rarch_assert(g_runloop.data.nbio.image.msg_queue = msg_queue_new(8));
|
|
||||||
break;
|
break;
|
||||||
case RARCH_CMD_BSV_MOVIE_DEINIT:
|
case RARCH_CMD_BSV_MOVIE_DEINIT:
|
||||||
if (g_extern.bsv.movie)
|
if (g_extern.bsv.movie)
|
||||||
|
74
runloop.h
74
runloop.h
@ -17,10 +17,82 @@
|
|||||||
#ifndef __RETROARCH_RUNLOOP_H
|
#ifndef __RETROARCH_RUNLOOP_H
|
||||||
#define __RETROARCH_RUNLOOP_H
|
#define __RETROARCH_RUNLOOP_H
|
||||||
|
|
||||||
|
#include <file/nbio.h>
|
||||||
|
#include <formats/image.h>
|
||||||
|
#include <formats/rpng.h>
|
||||||
|
#include <queues/message_queue.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef int (*transfer_cb_t )(void *data, size_t len);
|
||||||
|
|
||||||
|
typedef struct nbio_image_handle
|
||||||
|
{
|
||||||
|
#ifndef IS_SALAMANDER
|
||||||
|
struct texture_image ti;
|
||||||
|
#endif
|
||||||
|
bool is_blocking;
|
||||||
|
bool is_blocking_on_processing;
|
||||||
|
bool is_finished;
|
||||||
|
bool is_finished_with_processing;
|
||||||
|
transfer_cb_t cb;
|
||||||
|
struct rpng_t *handle;
|
||||||
|
unsigned processing_pos_increment;
|
||||||
|
unsigned pos_increment;
|
||||||
|
uint64_t frame_count;
|
||||||
|
uint64_t processing_frame_count;
|
||||||
|
int processing_final_state;
|
||||||
|
msg_queue_t *msg_queue;
|
||||||
|
} nbio_image_handle_t;
|
||||||
|
|
||||||
|
typedef struct nbio_handle
|
||||||
|
{
|
||||||
|
nbio_image_handle_t image;
|
||||||
|
bool is_blocking;
|
||||||
|
bool is_finished;
|
||||||
|
transfer_cb_t cb;
|
||||||
|
struct nbio_t *handle;
|
||||||
|
unsigned pos_increment;
|
||||||
|
uint64_t frame_count;
|
||||||
|
msg_queue_t *msg_queue;
|
||||||
|
} nbio_handle_t;
|
||||||
|
|
||||||
|
#ifdef HAVE_NETWORKING
|
||||||
|
typedef struct http_handle
|
||||||
|
{
|
||||||
|
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_handle_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* All data runloop-related globals go here. */
|
||||||
|
|
||||||
|
struct data_runloop
|
||||||
|
{
|
||||||
|
#ifdef HAVE_NETWORKING
|
||||||
|
http_handle_t http;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBRETRODB
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
} db;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
nbio_handle_t nbio;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct data_runloop g_data_runloop;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rarch_main_iterate:
|
* rarch_main_iterate:
|
||||||
*
|
*
|
||||||
@ -33,6 +105,8 @@ int rarch_main_iterate(void);
|
|||||||
|
|
||||||
void rarch_main_data_iterate(void);
|
void rarch_main_data_iterate(void);
|
||||||
|
|
||||||
|
void rarch_main_data_init_queues(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,7 +13,10 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <retro_miscellaneous.h>
|
||||||
|
#include "runloop.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
#include "input/input_overlay.h"
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
#include "net_http.h"
|
#include "net_http.h"
|
||||||
|
|
||||||
@ -643,14 +646,26 @@ static void rarch_main_data_overlay_iterate(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void rarch_main_data_init_queues(void)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_NETWORKING
|
||||||
|
if (!g_data_runloop.http.msg_queue)
|
||||||
|
rarch_assert(g_data_runloop.http.msg_queue = msg_queue_new(8));
|
||||||
|
#endif
|
||||||
|
if (!g_data_runloop.nbio.msg_queue)
|
||||||
|
rarch_assert(g_data_runloop.nbio.msg_queue = msg_queue_new(8));
|
||||||
|
if (!g_data_runloop.nbio.image.msg_queue)
|
||||||
|
rarch_assert(g_data_runloop.nbio.image.msg_queue = msg_queue_new(8));
|
||||||
|
}
|
||||||
|
|
||||||
void rarch_main_data_iterate(void)
|
void rarch_main_data_iterate(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_OVERLAY
|
#ifdef HAVE_OVERLAY
|
||||||
rarch_main_data_overlay_iterate();
|
rarch_main_data_overlay_iterate();
|
||||||
#endif
|
#endif
|
||||||
rarch_main_data_nbio_iterate(&g_runloop.data.nbio);
|
rarch_main_data_nbio_iterate(&g_data_runloop.nbio);
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
rarch_main_data_http_iterate(&g_runloop.data.http);
|
rarch_main_data_http_iterate(&g_data_runloop.http);
|
||||||
#endif
|
#endif
|
||||||
rarch_main_data_db_iterate();
|
rarch_main_data_db_iterate();
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "gfx/video_viewport.h"
|
#include "gfx/video_viewport.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
#include "runloop.h"
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -36,6 +37,7 @@
|
|||||||
struct settings g_settings;
|
struct settings g_settings;
|
||||||
struct global g_extern;
|
struct global g_extern;
|
||||||
struct runloop g_runloop;
|
struct runloop g_runloop;
|
||||||
|
struct data_runloop g_data_runloop;
|
||||||
struct defaults g_defaults;
|
struct defaults g_defaults;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user