Files
RetroArch/tasks/task_content.h

177 lines
6.0 KiB
C

/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2017 - Higor Euripedes
* Copyright (C) 2011-2017 - 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 TASKS_HANDLER_CONTENT_H
#define TASKS_HANDLER_CONTENT_H
#include <stdint.h>
#include <boolean.h>
#include <retro_common_api.h>
#include <retro_miscellaneous.h>
#include <queues/task_queue.h>
#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif
#include "../content.h"
#include "../retroarch_types.h"
RETRO_BEGIN_DECLS
enum content_mode_load
{
CONTENT_MODE_LOAD_NONE = 0,
CONTENT_MODE_LOAD_CONTENT_WITH_CURRENT_CORE_FROM_MENU,
CONTENT_MODE_LOAD_CONTENT_WITH_FFMPEG_CORE_FROM_MENU,
CONTENT_MODE_LOAD_CONTENT_WITH_IMAGEVIEWER_CORE_FROM_MENU
};
bool task_push_load_content_with_current_core_from_companion_ui(
const char *fullpath,
content_ctx_info_t *content_info,
enum rarch_core_type type,
retro_task_callback_t cb,
void *user_data);
bool task_push_load_content_from_cli(
const char *core_path,
const char *fullpath,
content_ctx_info_t *content_info,
enum rarch_core_type type,
retro_task_callback_t cb,
void *user_data);
bool task_push_load_new_core(
const char *core_path,
const char *fullpath,
content_ctx_info_t *content_info,
enum rarch_core_type type,
retro_task_callback_t cb,
void *user_data);
bool task_push_start_builtin_core(content_ctx_info_t *content_info,
enum rarch_core_type type,
retro_task_callback_t cb,
void *user_data);
bool task_push_start_current_core(content_ctx_info_t *content_info);
bool task_push_start_dummy_core(content_ctx_info_t *content_info);
/* True for the task of a content load stage that runs the core's own
* load or unload, or the driver rebuild - work no slicing can shorten
* (the slow-handler watchdog does not count it). The close's wait
* for a state task is not one: it only polls. */
bool task_content_is_load_stage(const retro_task_t *task);
/* Tells the caller waiting on content_state_t's load_notify, once the
* content load in progress, or else the next one, is through: task_data
* is the content's path, NULL if there is none. */
void task_content_load_notify_finish(const char *error);
/* Whether a content load is in progress. */
bool task_content_load_pending(void);
#ifdef HAVE_CORE_LOAD_CHECK
/* After a refused probe of core_path from a user's action with no load
* after it: parks a core load for when its check passes or the user
* answers the Security Warning */
bool task_content_park_core_load(const char *core_path);
/* As task_content_park_core_load(), and the answered load starts a core
* that runs without content */
bool task_content_park_core_start(const char *core_path);
/* The companion UI's Load Core: opens core_path, then parks it if the
* check refused it, else starts it if it runs without content */
void task_content_load_core_start(const char *core_path);
/* After a refused probe of core_path from a user's action that can't
* park it: says it wasn't loaded and how to trust it. False when the
* check didn't refuse it. */
bool task_content_core_refused_notify(const char *core_path);
/* Marks the staged load in flight: if the check refuses its core,
* refused() takes it, with the core's path, before the dummy core
* starts in its place, and the load is not parked */
void task_content_load_no_park(bool (*refused)(const char *core_path));
/* A load's core init failed, before its dummy core starts: hands a
* marked load's refused core to its refused() */
void task_content_load_refused(const char *core_path);
/* A startup load refused, or waiting for the first run's seed: runs
* again from the dummy core, as a menu load, or with no menu as a
* staged load that quits RetroArch if it fails */
bool task_content_park_startup(const char *core_path,
const char *content_path);
#endif
#ifdef HAVE_MENU
void task_content_firmware_download(void);
#endif
/* Every task_push_load_* entry point below (the CLI one excepted, which
* is startup itself and loads in one go) starts the load as a chain of
* main-thread tasks of the frontend's queue and returns; the load is
* done when runloop_is_content_switching() reads false again. */
bool task_push_load_content_with_new_core_from_companion_ui(
const char *core_path,
const char *fullpath,
const char *label,
const char *db_name,
const char *crc32,
content_ctx_info_t *content_info,
retro_task_callback_t cb,
void *user_data);
#ifdef HAVE_MENU
bool task_push_load_content_with_new_core_from_menu(
const char *core_path,
const char *fullpath,
content_ctx_info_t *content_info,
enum rarch_core_type type,
retro_task_callback_t cb,
void *user_data);
bool task_push_load_content_from_playlist_from_menu(
const char *core_path,
const char *fullpath,
const char *label,
content_ctx_info_t *content_info,
retro_task_callback_t cb,
void *user_data);
bool task_push_load_contentless_core_from_menu(
const char *core_path);
#endif
bool task_push_load_content_with_core(
const char *fullpath,
content_ctx_info_t *content_info,
enum rarch_core_type type,
retro_task_callback_t cb,
void *user_data);
bool task_push_load_subsystem_with_core(
const char *fullpath,
const char *label,
content_ctx_info_t *content_info,
enum rarch_core_type type,
retro_task_callback_t cb,
void *user_data);
RETRO_END_DECLS
#endif