mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 00:40:09 +00:00
(runloop data) Properly namespace everything in runloop_data.c
This commit is contained in:
parent
03cda5b208
commit
0e85b11046
28
general.h
28
general.h
@ -430,6 +430,21 @@ typedef struct nbio_handle
|
|||||||
msg_queue_t *msg_queue;
|
msg_queue_t *msg_queue;
|
||||||
} nbio_handle_t;
|
} 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. */
|
/* All runloop-related globals go here. */
|
||||||
|
|
||||||
struct runloop
|
struct runloop
|
||||||
@ -443,18 +458,7 @@ struct runloop
|
|||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
struct
|
http_handle_t http;
|
||||||
{
|
|
||||||
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
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIBRETRODB
|
#ifdef HAVE_LIBRETRODB
|
||||||
|
@ -970,7 +970,7 @@ int rarch_main_iterate(void)
|
|||||||
rarch_main_iterate_overlay_state();
|
rarch_main_iterate_overlay_state();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
do_data_state_checks();
|
rarch_main_data_iterate();
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
if (g_runloop.is_menu)
|
if (g_runloop.is_menu)
|
||||||
|
@ -31,7 +31,7 @@ extern "C" {
|
|||||||
**/
|
**/
|
||||||
int rarch_main_iterate(void);
|
int rarch_main_iterate(void);
|
||||||
|
|
||||||
void do_data_state_checks(void);
|
void rarch_main_data_iterate(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -26,14 +26,14 @@ int cb_core_updater_list(void *data_, size_t len);
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rarch_main_iterate_http_transfer:
|
* rarch_main_data_http_iterate_transfer:
|
||||||
*
|
*
|
||||||
* Resumes HTTP transfer update.
|
* Resumes HTTP transfer update.
|
||||||
*
|
*
|
||||||
* Returns: 0 when finished, -1 when we should continue
|
* Returns: 0 when finished, -1 when we should continue
|
||||||
* with the transfer on the next frame.
|
* with the transfer on the next frame.
|
||||||
**/
|
**/
|
||||||
static int rarch_main_iterate_http_transfer(void)
|
static int rarch_main_data_http_iterate_transfer(void)
|
||||||
{
|
{
|
||||||
size_t pos = 0, tot = 0;
|
size_t pos = 0, tot = 0;
|
||||||
|
|
||||||
@ -50,14 +50,14 @@ static int rarch_main_iterate_http_transfer(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rarch_main_iterate_http_conn_transfer(void)
|
static int rarch_main_data_http_con_iterate_transfer(void)
|
||||||
{
|
{
|
||||||
if (!net_http_connection_iterate(g_runloop.data.http.connection.handle))
|
if (!net_http_connection_iterate(g_runloop.data.http.connection.handle))
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rarch_main_iterate_http_conn_parse(void)
|
static int rarch_main_data_http_conn_iterate_transfer_parse(void)
|
||||||
{
|
{
|
||||||
if (net_http_connection_done(g_runloop.data.http.connection.handle))
|
if (net_http_connection_done(g_runloop.data.http.connection.handle))
|
||||||
{
|
{
|
||||||
@ -72,7 +72,7 @@ static int rarch_main_iterate_http_conn_parse(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rarch_main_iterate_http_parse(void)
|
static int rarch_main_data_http_iterate_transfer_parse(void)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
char *data = (char*)net_http_data(g_runloop.data.http.handle, &len, false);
|
char *data = (char*)net_http_data(g_runloop.data.http.handle, &len, false);
|
||||||
@ -112,7 +112,7 @@ static int cb_http_conn_default(void *data_, size_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rarch_main_iterate_http_transfer:
|
* rarch_main_data_http_iterate_poll:
|
||||||
*
|
*
|
||||||
* Polls HTTP message queue to see if any new URLs
|
* Polls HTTP message queue to see if any new URLs
|
||||||
* are pending.
|
* are pending.
|
||||||
@ -124,7 +124,7 @@ static int cb_http_conn_default(void *data_, size_t len)
|
|||||||
* begin transferring on the next frame. Returns -1 if
|
* begin transferring on the next frame. Returns -1 if
|
||||||
* no HTTP URL has been pulled. Do nothing in that case.
|
* no HTTP URL has been pulled. Do nothing in that case.
|
||||||
**/
|
**/
|
||||||
static int rarch_main_iterate_http_poll(void)
|
static int rarch_main_data_http_iterate_poll(void)
|
||||||
{
|
{
|
||||||
char elem0[PATH_MAX_LENGTH];
|
char elem0[PATH_MAX_LENGTH];
|
||||||
struct string_list *str_list = NULL;
|
struct string_list *str_list = NULL;
|
||||||
@ -270,7 +270,7 @@ static int cb_nbio_image_menu_wallpaper(void *data, size_t len)
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
static int rarch_main_iterate_image_poll(nbio_handle_t *nbio)
|
static int rarch_main_data_image_iterate_poll(nbio_handle_t *nbio)
|
||||||
{
|
{
|
||||||
const char *path = NULL;
|
const char *path = NULL;
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ static int rarch_main_iterate_image_poll(nbio_handle_t *nbio)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rarch_main_iterate_image_transfer(nbio_handle_t *nbio)
|
static int rarch_main_data_image_iterate_transfer(nbio_handle_t *nbio)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ error:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rarch_main_iterate_image_processing_transfer(nbio_handle_t *nbio)
|
static int rarch_main_data_image_iterate_process_transfer(nbio_handle_t *nbio)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
int retval;
|
int retval;
|
||||||
@ -347,7 +347,7 @@ static int rarch_main_iterate_image_processing_transfer(nbio_handle_t *nbio)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rarch_main_iterate_image_parse_free(nbio_handle_t *nbio)
|
static int rarch_main_data_image_iterate_parse_free(nbio_handle_t *nbio)
|
||||||
{
|
{
|
||||||
if (!nbio)
|
if (!nbio)
|
||||||
return -1;
|
return -1;
|
||||||
@ -363,7 +363,7 @@ static int rarch_main_iterate_image_parse_free(nbio_handle_t *nbio)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rarch_main_iterate_image_process_parse(nbio_handle_t *nbio)
|
static int rarch_main_data_image_iterate_process_transfer_parse(nbio_handle_t *nbio)
|
||||||
{
|
{
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
if (nbio->image.handle && nbio->image.cb)
|
if (nbio->image.handle && nbio->image.cb)
|
||||||
@ -374,7 +374,7 @@ static int rarch_main_iterate_image_process_parse(nbio_handle_t *nbio)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rarch_main_iterate_image_parse(nbio_handle_t *nbio)
|
static int rarch_main_data_image_iterate_transfer_parse(nbio_handle_t *nbio)
|
||||||
{
|
{
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
if (nbio->image.handle && nbio->image.cb)
|
if (nbio->image.handle && nbio->image.cb)
|
||||||
@ -405,8 +405,7 @@ static int cb_nbio_default(void *data, size_t len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int rarch_main_data_nbio_iterate_poll(nbio_handle_t *nbio)
|
||||||
static int rarch_main_iterate_nbio_poll(nbio_handle_t *nbio)
|
|
||||||
{
|
{
|
||||||
struct nbio_t* handle;
|
struct nbio_t* handle;
|
||||||
char elem0[PATH_MAX_LENGTH], elem1[PATH_MAX_LENGTH];
|
char elem0[PATH_MAX_LENGTH], elem1[PATH_MAX_LENGTH];
|
||||||
@ -469,7 +468,7 @@ error:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rarch_main_iterate_nbio_transfer(nbio_handle_t *nbio)
|
static int rarch_main_data_nbio_iterate_transfer(nbio_handle_t *nbio)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -494,7 +493,7 @@ error:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rarch_main_iterate_nbio_parse_free(nbio_handle_t *nbio)
|
static int rarch_main_data_nbio_iterate_parse_free(nbio_handle_t *nbio)
|
||||||
{
|
{
|
||||||
if (!nbio)
|
if (!nbio)
|
||||||
return -1;
|
return -1;
|
||||||
@ -512,7 +511,7 @@ static int rarch_main_iterate_nbio_parse_free(nbio_handle_t *nbio)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rarch_main_iterate_nbio_parse(nbio_handle_t *nbio)
|
static int rarch_main_data_nbio_iterate_parse(nbio_handle_t *nbio)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
@ -534,7 +533,7 @@ static int rarch_main_iterate_nbio_parse(nbio_handle_t *nbio)
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
static void rarch_main_iterate_rdl(void)
|
static void rarch_main_data_rdl_iterate(void)
|
||||||
{
|
{
|
||||||
if (!driver.menu->rdl)
|
if (!driver.menu->rdl)
|
||||||
return;
|
return;
|
||||||
@ -562,7 +561,7 @@ static void rarch_main_iterate_rdl(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void do_data_nbio_state_checks(nbio_handle_t *nbio)
|
static void rarch_main_data_nbio_iterate(nbio_handle_t *nbio)
|
||||||
{
|
{
|
||||||
if (!nbio)
|
if (!nbio)
|
||||||
return;
|
return;
|
||||||
@ -571,56 +570,64 @@ void do_data_nbio_state_checks(nbio_handle_t *nbio)
|
|||||||
{
|
{
|
||||||
if (!nbio->is_blocking)
|
if (!nbio->is_blocking)
|
||||||
{
|
{
|
||||||
if (rarch_main_iterate_nbio_transfer(nbio) == -1)
|
if (rarch_main_data_nbio_iterate_transfer(nbio) == -1)
|
||||||
rarch_main_iterate_nbio_parse(nbio);
|
rarch_main_data_nbio_iterate_parse(nbio);
|
||||||
}
|
}
|
||||||
else if (nbio->is_finished)
|
else if (nbio->is_finished)
|
||||||
rarch_main_iterate_nbio_parse_free(nbio);
|
rarch_main_data_nbio_iterate_parse_free(nbio);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rarch_main_iterate_nbio_poll(nbio);
|
rarch_main_data_nbio_iterate_poll(nbio);
|
||||||
|
|
||||||
if (nbio->image.handle)
|
if (nbio->image.handle)
|
||||||
{
|
{
|
||||||
if (nbio->image.is_blocking_on_processing)
|
if (nbio->image.is_blocking_on_processing)
|
||||||
{
|
{
|
||||||
if (rarch_main_iterate_image_processing_transfer(nbio) == -1)
|
if (rarch_main_data_image_iterate_process_transfer(nbio) == -1)
|
||||||
rarch_main_iterate_image_process_parse(nbio);
|
rarch_main_data_image_iterate_process_transfer_parse(nbio);
|
||||||
}
|
}
|
||||||
else if (!nbio->image.is_blocking)
|
else if (!nbio->image.is_blocking)
|
||||||
{
|
{
|
||||||
if (rarch_main_iterate_image_transfer(nbio) == -1)
|
if (rarch_main_data_image_iterate_transfer(nbio) == -1)
|
||||||
rarch_main_iterate_image_parse(nbio);
|
rarch_main_data_image_iterate_transfer_parse(nbio);
|
||||||
}
|
}
|
||||||
else if (nbio->image.is_finished)
|
else if (nbio->image.is_finished)
|
||||||
rarch_main_iterate_image_parse_free(nbio);
|
rarch_main_data_image_iterate_parse_free(nbio);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rarch_main_iterate_image_poll(nbio);
|
rarch_main_data_image_iterate_poll(nbio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_data_state_checks(void)
|
static void rarch_main_data_http_iterate(http_handle_t *http)
|
||||||
{
|
{
|
||||||
do_data_nbio_state_checks(&g_runloop.data.nbio);
|
|
||||||
|
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
if (g_runloop.data.http.connection.handle)
|
if (http->connection.handle)
|
||||||
{
|
{
|
||||||
if (!rarch_main_iterate_http_conn_transfer())
|
if (!rarch_main_data_http_con_iterate_transfer())
|
||||||
rarch_main_iterate_http_conn_parse();
|
rarch_main_data_http_conn_iterate_transfer_parse();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_runloop.data.http.handle)
|
if (http->handle)
|
||||||
{
|
{
|
||||||
if (!rarch_main_iterate_http_transfer())
|
if (!rarch_main_data_http_iterate_transfer())
|
||||||
rarch_main_iterate_http_parse();
|
rarch_main_data_http_iterate_transfer_parse();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rarch_main_iterate_http_poll();
|
rarch_main_data_http_iterate_poll();
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rarch_main_data_db_iterate(void)
|
||||||
|
{
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
if (driver.menu && driver.menu->rdl)
|
if (driver.menu && driver.menu->rdl)
|
||||||
rarch_main_iterate_rdl();
|
rarch_main_data_rdl_iterate();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rarch_main_data_iterate(void)
|
||||||
|
{
|
||||||
|
rarch_main_data_nbio_iterate(&g_runloop.data.nbio);
|
||||||
|
rarch_main_data_http_iterate(&g_runloop.data.http);
|
||||||
|
rarch_main_data_db_iterate();
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user