RetroArch/tasks/tasks.h

104 lines
2.8 KiB
C
Raw Normal View History

2015-05-05 17:36:58 +02: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/>.
*/
#ifndef COMMON_TASKS_H
#define COMMON_TASKS_H
#include <stdint.h>
#include <boolean.h>
2015-07-08 22:14:31 +02:00
#include <queues/message_queue.h>
2015-05-05 17:36:58 +02:00
#include "../runloop_data.h"
2015-09-16 22:39:47 +02:00
#define MAX_TOKEN_LEN 255
2015-05-05 17:36:58 +02:00
#ifdef __cplusplus
extern "C" {
#endif
2015-11-22 20:15:42 -03:00
typedef struct rarch_task rarch_task_t;
typedef void (*rarch_task_callback_t)(void *task_data, void *user_data, const char *error);
typedef void (*rarch_task_handler_t)(rarch_task_t *task);
struct rarch_task {
rarch_task_handler_t handler;
rarch_task_callback_t callback; /* always called from the main loop */
/* set by the handler */
bool finished;
/* created by the handler, destroyed by the user */
void *task_data;
/* owned by the user */
void *user_data;
/* created and destroyed by the code related to the handler */
void *state;
/* created by task handler; destroyed by main loop (after calling the callback) */
char *error;
/* don't touch this. */
rarch_task_t *next;
};
/* MAIN THREAD ONLY */
void rarch_task_init(void);
void rarch_task_deinit(void);
void rarch_task_check(void);
/* MAIN AND TASK THREADS */
void rarch_task_push(rarch_task_t *task);
2015-05-05 17:36:58 +02:00
#ifdef HAVE_NETWORKING
2015-11-23 11:13:26 -03:00
typedef struct {
char *data;
size_t len;
} http_transfer_data_t;
2015-07-08 21:38:22 +02:00
2015-11-23 11:13:26 -03:00
bool rarch_task_push_http_transfer(const char *url, const char *type, rarch_task_callback_t cb, void *user_data);
2015-05-05 17:36:58 +02:00
#endif
bool rarch_task_push_image_load(const char *fullpath, const char *type, rarch_task_callback_t cb, void *user_data);
#ifdef HAVE_LIBRETRODB
bool rarch_task_push_dbscan(const char *fullpath, bool directory, rarch_task_callback_t cb);
#endif
#ifdef HAVE_OVERLAY
2015-11-23 14:15:19 -03:00
bool rarch_task_push_overlay_load_default(
rarch_task_callback_t cb, void *user_data);
#endif
2015-05-05 17:36:58 +02:00
2015-06-02 18:28:51 +02:00
void data_runloop_osd_msg(const char *s, size_t len);
2015-05-05 17:36:58 +02:00
2015-09-16 22:39:47 +02:00
int find_first_data_track(const char* cue_path,
int32_t* offset, char* track_path, size_t max_len);
int detect_system(const char* track_path, int32_t offset,
const char** system_name);
int detect_ps1_game(const char *track_path, char *game_id);
2015-09-27 00:12:17 +02:00
int detect_psp_game(const char *track_path, char *game_id);
2015-05-05 17:36:58 +02:00
#ifdef __cplusplus
}
#endif
#endif