mirror of
https://github.com/libretro/RetroArch
synced 2025-03-31 19:21:06 +00:00
(Runloop data) Start rearranging code
This commit is contained in:
parent
56da783f11
commit
54550912f5
110
runloop_data.c
110
runloop_data.c
@ -22,91 +22,6 @@
|
|||||||
#include <rthreads/rthreads.h>
|
#include <rthreads/rthreads.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef int (*transfer_cb_t )(void *data, size_t len);
|
|
||||||
|
|
||||||
#ifdef HAVE_NETWORKING
|
|
||||||
#include <net/net_http.h>
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
HTTP_STATUS_POLL = 0,
|
|
||||||
HTTP_STATUS_CONNECTION_TRANSFER,
|
|
||||||
HTTP_STATUS_CONNECTION_TRANSFER_PARSE,
|
|
||||||
HTTP_STATUS_TRANSFER,
|
|
||||||
HTTP_STATUS_TRANSFER_PARSE,
|
|
||||||
HTTP_STATUS_TRANSFER_PARSE_FREE,
|
|
||||||
} http_status_enum;
|
|
||||||
|
|
||||||
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;
|
|
||||||
unsigned status;
|
|
||||||
} http_handle_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct nbio_image_handle
|
|
||||||
{
|
|
||||||
struct texture_image ti;
|
|
||||||
bool is_blocking;
|
|
||||||
bool is_blocking_on_processing;
|
|
||||||
bool is_finished;
|
|
||||||
transfer_cb_t cb;
|
|
||||||
#ifdef HAVE_RPNG
|
|
||||||
struct rpng_t *handle;
|
|
||||||
#endif
|
|
||||||
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;
|
|
||||||
unsigned status;
|
|
||||||
} nbio_image_handle_t;
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
NBIO_IMAGE_STATUS_POLL = 0,
|
|
||||||
NBIO_IMAGE_STATUS_TRANSFER,
|
|
||||||
NBIO_IMAGE_STATUS_TRANSFER_PARSE,
|
|
||||||
NBIO_IMAGE_STATUS_PROCESS_TRANSFER,
|
|
||||||
NBIO_IMAGE_STATUS_PROCESS_TRANSFER_PARSE,
|
|
||||||
NBIO_IMAGE_STATUS_TRANSFER_PARSE_FREE,
|
|
||||||
} nbio_image_status_enum;
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
NBIO_STATUS_POLL = 0,
|
|
||||||
NBIO_STATUS_TRANSFER,
|
|
||||||
NBIO_STATUS_TRANSFER_PARSE,
|
|
||||||
NBIO_STATUS_TRANSFER_PARSE_FREE,
|
|
||||||
} nbio_status_enum;
|
|
||||||
|
|
||||||
typedef struct nbio_handle
|
|
||||||
{
|
|
||||||
nbio_image_handle_t image;
|
|
||||||
bool is_finished;
|
|
||||||
transfer_cb_t cb;
|
|
||||||
struct nbio_t *handle;
|
|
||||||
unsigned pos_increment;
|
|
||||||
uint64_t frame_count;
|
|
||||||
msg_queue_t *msg_queue;
|
|
||||||
unsigned status;
|
|
||||||
} nbio_handle_t;
|
|
||||||
|
|
||||||
typedef struct db_handle
|
|
||||||
{
|
|
||||||
msg_queue_t *msg_queue;
|
|
||||||
unsigned status;
|
|
||||||
} db_handle_t;
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
THREAD_CODE_INIT = 0,
|
THREAD_CODE_INIT = 0,
|
||||||
@ -114,31 +29,6 @@ enum
|
|||||||
THREAD_CODE_ALIVE,
|
THREAD_CODE_ALIVE,
|
||||||
} thread_code_enum;
|
} thread_code_enum;
|
||||||
|
|
||||||
typedef struct data_runloop
|
|
||||||
{
|
|
||||||
#ifdef HAVE_NETWORKING
|
|
||||||
http_handle_t http;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBRETRODB
|
|
||||||
db_handle_t db;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
nbio_handle_t nbio;
|
|
||||||
bool inited;
|
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
|
||||||
bool thread_inited;
|
|
||||||
unsigned thread_code;
|
|
||||||
bool alive;
|
|
||||||
|
|
||||||
slock_t *lock;
|
|
||||||
slock_t *cond_lock;
|
|
||||||
slock_t *overlay_lock;
|
|
||||||
scond_t *cond;
|
|
||||||
sthread_t *thread;
|
|
||||||
#endif
|
|
||||||
} data_runloop_t;
|
|
||||||
|
|
||||||
static char data_runloop_msg[PATH_MAX_LENGTH];
|
static char data_runloop_msg[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
|
112
runloop_data.h
112
runloop_data.h
@ -20,11 +20,16 @@
|
|||||||
#include <formats/image.h>
|
#include <formats/image.h>
|
||||||
#include <formats/rpng.h>
|
#include <formats/rpng.h>
|
||||||
#include <queues/message_queue.h>
|
#include <queues/message_queue.h>
|
||||||
|
#ifdef HAVE_NETWORKING
|
||||||
|
#include <net/net_http.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef int (*transfer_cb_t )(void *data, size_t len);
|
||||||
|
|
||||||
enum runloop_data_type
|
enum runloop_data_type
|
||||||
{
|
{
|
||||||
DATA_TYPE_NONE = 0,
|
DATA_TYPE_NONE = 0,
|
||||||
@ -36,6 +41,113 @@ enum runloop_data_type
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef HAVE_NETWORKING
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
HTTP_STATUS_POLL = 0,
|
||||||
|
HTTP_STATUS_CONNECTION_TRANSFER,
|
||||||
|
HTTP_STATUS_CONNECTION_TRANSFER_PARSE,
|
||||||
|
HTTP_STATUS_TRANSFER,
|
||||||
|
HTTP_STATUS_TRANSFER_PARSE,
|
||||||
|
HTTP_STATUS_TRANSFER_PARSE_FREE,
|
||||||
|
} http_status_enum;
|
||||||
|
|
||||||
|
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;
|
||||||
|
unsigned status;
|
||||||
|
} http_handle_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct nbio_image_handle
|
||||||
|
{
|
||||||
|
struct texture_image ti;
|
||||||
|
bool is_blocking;
|
||||||
|
bool is_blocking_on_processing;
|
||||||
|
bool is_finished;
|
||||||
|
transfer_cb_t cb;
|
||||||
|
#ifdef HAVE_RPNG
|
||||||
|
struct rpng_t *handle;
|
||||||
|
#endif
|
||||||
|
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;
|
||||||
|
unsigned status;
|
||||||
|
} nbio_image_handle_t;
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
NBIO_IMAGE_STATUS_POLL = 0,
|
||||||
|
NBIO_IMAGE_STATUS_TRANSFER,
|
||||||
|
NBIO_IMAGE_STATUS_TRANSFER_PARSE,
|
||||||
|
NBIO_IMAGE_STATUS_PROCESS_TRANSFER,
|
||||||
|
NBIO_IMAGE_STATUS_PROCESS_TRANSFER_PARSE,
|
||||||
|
NBIO_IMAGE_STATUS_TRANSFER_PARSE_FREE,
|
||||||
|
} nbio_image_status_enum;
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
NBIO_STATUS_POLL = 0,
|
||||||
|
NBIO_STATUS_TRANSFER,
|
||||||
|
NBIO_STATUS_TRANSFER_PARSE,
|
||||||
|
NBIO_STATUS_TRANSFER_PARSE_FREE,
|
||||||
|
} nbio_status_enum;
|
||||||
|
|
||||||
|
typedef struct nbio_handle
|
||||||
|
{
|
||||||
|
nbio_image_handle_t image;
|
||||||
|
bool is_finished;
|
||||||
|
transfer_cb_t cb;
|
||||||
|
struct nbio_t *handle;
|
||||||
|
unsigned pos_increment;
|
||||||
|
uint64_t frame_count;
|
||||||
|
msg_queue_t *msg_queue;
|
||||||
|
unsigned status;
|
||||||
|
} nbio_handle_t;
|
||||||
|
|
||||||
|
typedef struct db_handle
|
||||||
|
{
|
||||||
|
msg_queue_t *msg_queue;
|
||||||
|
unsigned status;
|
||||||
|
} db_handle_t;
|
||||||
|
|
||||||
|
typedef struct data_runloop
|
||||||
|
{
|
||||||
|
#ifdef HAVE_NETWORKING
|
||||||
|
http_handle_t http;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBRETRODB
|
||||||
|
db_handle_t db;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
nbio_handle_t nbio;
|
||||||
|
bool inited;
|
||||||
|
|
||||||
|
#ifdef HAVE_THREADS
|
||||||
|
bool thread_inited;
|
||||||
|
unsigned thread_code;
|
||||||
|
bool alive;
|
||||||
|
|
||||||
|
slock_t *lock;
|
||||||
|
slock_t *cond_lock;
|
||||||
|
slock_t *overlay_lock;
|
||||||
|
scond_t *cond;
|
||||||
|
sthread_t *thread;
|
||||||
|
#endif
|
||||||
|
} data_runloop_t;
|
||||||
|
|
||||||
void rarch_main_data_msg_queue_push(unsigned type,
|
void rarch_main_data_msg_queue_push(unsigned type,
|
||||||
const char *msg, const char *msg2,
|
const char *msg, const char *msg2,
|
||||||
unsigned prio, unsigned duration, bool flush);
|
unsigned prio, unsigned duration, bool flush);
|
||||||
|
0
tasks/task_database.c
Normal file
0
tasks/task_database.c
Normal file
0
tasks/task_file_transfer.c
Normal file
0
tasks/task_file_transfer.c
Normal file
0
tasks/task_http.c
Normal file
0
tasks/task_http.c
Normal file
Loading…
x
Reference in New Issue
Block a user