diff --git a/runloop_data.c b/runloop_data.c index 0a287b52ac..659b8ed616 100644 --- a/runloop_data.c +++ b/runloop_data.c @@ -22,91 +22,6 @@ #include #endif -typedef int (*transfer_cb_t )(void *data, size_t len); - -#ifdef HAVE_NETWORKING -#include - -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 { THREAD_CODE_INIT = 0, @@ -114,31 +29,6 @@ enum THREAD_CODE_ALIVE, } 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]; diff --git a/runloop_data.h b/runloop_data.h index fcfcb7cbd9..fd33e68aa4 100644 --- a/runloop_data.h +++ b/runloop_data.h @@ -20,11 +20,16 @@ #include #include #include +#ifdef HAVE_NETWORKING +#include +#endif #ifdef __cplusplus extern "C" { #endif +typedef int (*transfer_cb_t )(void *data, size_t len); + enum runloop_data_type { DATA_TYPE_NONE = 0, @@ -36,6 +41,113 @@ enum runloop_data_type #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, const char *msg, const char *msg2, unsigned prio, unsigned duration, bool flush); diff --git a/tasks/task_database.c b/tasks/task_database.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tasks/task_file_transfer.c b/tasks/task_file_transfer.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tasks/task_http.c b/tasks/task_http.c new file mode 100644 index 0000000000..e69de29bb2