mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-23 18:49:37 -10:00
-L and launcher loads the check refuses fall back to the dummy core and menu whatever --load-menu-on-error says, and run again as a menu load after Load Once or Always Trust; with no menu they fail as before, saying how to approve the core. A re-run of a core that starts without content, refused again because the core changed since the user was asked, asks again. On a first run, a core the pending seed covers waits for the seed instead of a guess. A load the check held back no longer also says "Failed to open libretro core": the seed's wait, the Security Warning, the refusal with no menu or a lobby join's own message says why. A core the check passed that the loader can't open keeps the message. A startup load that can only fail once the frame loop runs, such as a seed wait with no menu, quits and RetroArch exits non-zero, as for one that fails before. On macOS, where AppKit and the run loop observer end a quit with exit(0), such a quit exits with 1. A netplay lobby join whose core's probe is cached opens nothing at its core push, so the load that opens the core is the one refused: the join's own, or an unload's still in flight. The join marks that load. Its refusal is said and netplay left off, as for a refused push, before the dummy core's init probes the core for the menu, and the load isn't parked, even when the mark lands after its preload stage.
319 lines
12 KiB
C
319 lines
12 KiB
C
/* RetroArch - A frontend for libretro.
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
|
* Copyright (C) 2011-2021 - Daniel De Matteis
|
|
* Copyright (C) 2016-2019 - Brad Parker
|
|
*
|
|
* 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 __RETROARCH_H
|
|
#define __RETROARCH_H
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <sys/types.h>
|
|
#include <stdlib.h>
|
|
|
|
#include <boolean.h>
|
|
#include <retro_inline.h>
|
|
#include <retro_common_api.h>
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include "config.h"
|
|
#endif
|
|
|
|
#include <lists/string_list.h>
|
|
#include <queues/task_queue.h>
|
|
#include <queues/message_queue.h>
|
|
#include "gfx/video_driver.h"
|
|
|
|
#include "core.h"
|
|
|
|
#include "driver.h"
|
|
#include "runloop.h"
|
|
#include "retroarch_types.h"
|
|
|
|
#define RETRO_ENVIRONMENT_RETROARCH_START_BLOCK 0x800000
|
|
|
|
#define RETRO_ENVIRONMENT_SET_SAVE_STATE_IN_BACKGROUND (2 | RETRO_ENVIRONMENT_RETROARCH_START_BLOCK)
|
|
/* bool * --
|
|
* Boolean value that tells the front end to save states in the
|
|
* background or not.
|
|
*/
|
|
|
|
#define RETRO_ENVIRONMENT_GET_CLEAR_ALL_THREAD_WAITS_CB (3 | RETRO_ENVIRONMENT_RETROARCH_START_BLOCK)
|
|
/* retro_environment_t * --
|
|
* Provides the callback to the frontend method which will cancel
|
|
* all currently waiting threads. Used when coordination is needed
|
|
* between the core and the frontend to gracefully stop all threads.
|
|
*/
|
|
|
|
#define RETRO_ENVIRONMENT_POLL_TYPE_OVERRIDE (4 | RETRO_ENVIRONMENT_RETROARCH_START_BLOCK)
|
|
/* unsigned * --
|
|
* Tells the frontend to override the poll type behavior.
|
|
* Allows the frontend to influence the polling behavior of the
|
|
* frontend.
|
|
*
|
|
* Will be unset when retro_unload_game is called.
|
|
*
|
|
* 0 - Don't Care, no changes, frontend still determines polling type behavior.
|
|
* 1 - Early
|
|
* 2 - Normal
|
|
* 3 - Late
|
|
*/
|
|
|
|
#define RETRO_ENVIRONMENT_SET_SAVE_STATE_DISABLE_UNDO (5 | RETRO_ENVIRONMENT_RETROARCH_START_BLOCK)
|
|
/* bool * --
|
|
* If true, disables the save state save/load undo feature to conserve memory.
|
|
*/
|
|
|
|
#define DRIVERS_CMD_ALL \
|
|
( DRIVER_AUDIO_MASK \
|
|
| DRIVER_MICROPHONE_MASK \
|
|
| DRIVER_VIDEO_MASK \
|
|
| DRIVER_INPUT_MASK \
|
|
| DRIVER_CAMERA_MASK \
|
|
| DRIVER_LOCATION_MASK \
|
|
| DRIVER_MENU_MASK \
|
|
| DRIVER_BLUETOOTH_MASK \
|
|
| DRIVER_WIFI_MASK \
|
|
| DRIVER_LED_MASK \
|
|
| DRIVER_MIDI_MASK )
|
|
|
|
|
|
RETRO_BEGIN_DECLS
|
|
|
|
enum rarch_state_flags
|
|
{
|
|
RARCH_FLAGS_HAS_SET_USERNAME = (1 << 0),
|
|
RARCH_FLAGS_HAS_SET_VERBOSITY = (1 << 1),
|
|
RARCH_FLAGS_HAS_SET_LIBRETRO = (1 << 2),
|
|
RARCH_FLAGS_HAS_SET_LIBRETRO_DIRECTORY = (1 << 3),
|
|
RARCH_FLAGS_HAS_SET_SAVE_PATH = (1 << 4),
|
|
RARCH_FLAGS_HAS_SET_STATE_PATH = (1 << 5),
|
|
RARCH_FLAGS_HAS_SET_UPS_PREF = (1 << 6),
|
|
RARCH_FLAGS_HAS_SET_BPS_PREF = (1 << 7),
|
|
RARCH_FLAGS_HAS_SET_IPS_PREF = (1 << 8),
|
|
RARCH_FLAGS_HAS_SET_LOG_TO_FILE = (1 << 9),
|
|
RARCH_FLAGS_UPS_PREF = (1 << 10),
|
|
RARCH_FLAGS_BPS_PREF = (1 << 11),
|
|
RARCH_FLAGS_IPS_PREF = (1 << 12),
|
|
RARCH_FLAGS_BLOCK_CONFIG_READ = (1 << 13),
|
|
RARCH_FLAGS_CLI_DATABASE_SCAN = (1 << 14),
|
|
RARCH_FLAGS_HAS_SET_XDELTA_PREF = (1 << 15),
|
|
RARCH_FLAGS_XDELTA_PREF = (1 << 16),
|
|
RARCH_FLAGS_HAS_SET_OVERLAY_PRESET = (1 << 17),
|
|
/* An unload asked for a cloud sync, which waits for the content's
|
|
* deinit to finish. */
|
|
RARCH_FLAGS_CLOUD_SYNC_ON_DEINIT = (1 << 18),
|
|
/* Initialisation failed; the menu goes to the dummy core rather
|
|
* than back to content on exit. */
|
|
RARCH_FLAGS_ERR_ON_INIT = (1 << 19),
|
|
RARCH_FLAGS_LAUNCHED_FROM_CLI = (1 << 20),
|
|
RARCH_FLAGS_CLI_LOAD_MENU_ON_ERR = (1 << 21),
|
|
/* Set on entry to retroarch_main_init (right after its setjmp
|
|
* is established) and cleared on every exit. retroarch_fail
|
|
* checks this flag before longjmp'ing - the jmp_buf is only
|
|
* valid while retroarch_main_init is on the stack; calling
|
|
* retroarch_fail from any other context (e.g. a reinit-time
|
|
* drivers_init invoked via command_event_reinit) with the flag
|
|
* clear means the longjmp would land in stale stack memory. */
|
|
RARCH_FLAGS_INIT_IN_PROGRESS = (1 << 22),
|
|
/* Content from the command line waited for the startup cloud sync
|
|
* before loading; rarch_main() does not push another. */
|
|
RARCH_FLAGS_CLOUD_SYNC_AT_INIT = (1 << 23),
|
|
/* See retroarch_user_dirs_hold(). */
|
|
RARCH_FLAGS_USER_DIRS_HELD = (1 << 24),
|
|
/* See retroarch_main_quit_failure(). */
|
|
RARCH_FLAGS_QUIT_FAILURE = (1 << 25)
|
|
};
|
|
|
|
bool retroarch_ctl(enum rarch_ctl_state state, void *data);
|
|
|
|
size_t retroarch_get_capabilities(enum rarch_capabilities type,
|
|
char *s, size_t len);
|
|
|
|
void retroarch_override_setting_set(enum rarch_override_setting enum_idx, void *data);
|
|
|
|
void retroarch_override_setting_unset(enum rarch_override_setting enum_idx, void *data);
|
|
|
|
bool retroarch_override_setting_is_set(enum rarch_override_setting enum_idx, void *data);
|
|
|
|
const char* video_shader_get_current_shader_preset(void);
|
|
|
|
/* The platform is taking the application away and may not give it
|
|
* back: SRAM, core options and the main config are written now. */
|
|
void retroarch_save_for_suspend(void);
|
|
|
|
/* Cancels and drains the task queue (bounded) so in-flight tasks
|
|
* retire while the subsystems their callbacks reach are alive.
|
|
* main_exit() runs it first; exposed for the exit-drain harness. */
|
|
void retroarch_drain_tasks_for_exit(void);
|
|
|
|
/**
|
|
* retroarch_main_init:
|
|
* @argc : Count of (commandline) arguments.
|
|
* @argv : (Commandline) arguments.
|
|
*
|
|
* Initializes the program.
|
|
*
|
|
* @return true on success, otherwise false if there was an error.
|
|
**/
|
|
bool retroarch_main_init(int argc, char *argv[]);
|
|
|
|
/**
|
|
* retroarch_main_init_core:
|
|
* retroarch_main_init_drivers:
|
|
*
|
|
* retroarch_main_init() in two phases, for the staged content load:
|
|
* the first parses the configuration and brings the core up (dlopen,
|
|
* retro_init, the content read, retro_load_game), the second finds
|
|
* and initializes the drivers and finishes the session. The staged
|
|
* load runs the first behind the drivers of the previous session
|
|
* (find_drivers false); the second phase (staged) then frees those,
|
|
* carrying the new core's hardware-render request around the
|
|
* teardown, and finds the drivers with the previous session's no
|
|
* longer in the way. Startup runs both back to back with the find
|
|
* in the first phase, ahead of the core, as it always has.
|
|
*
|
|
* Both phases report a failure that retroarch_fail() raised; the
|
|
* verbosity the first phase parsed is handed to the second.
|
|
**/
|
|
bool retroarch_main_init_core(int argc, char *argv[],
|
|
bool find_drivers, bool *verbosity_enabled);
|
|
bool retroarch_main_init_drivers(bool staged,
|
|
bool verbosity_enabled);
|
|
|
|
bool retroarch_main_quit(void);
|
|
|
|
/* A quit from inside the frame loop: returns to the loop while an auto
|
|
* save-state is still being written, and runloop_iterate() finishes it
|
|
* through retroarch_main_quit_poll(), which is true once it has. */
|
|
bool retroarch_main_quit_staged(void);
|
|
bool retroarch_main_quit_poll(void);
|
|
/* A startup load that fails once the frame loop runs: quits, and
|
|
* rarch_main() returns 1 as it does for one that fails before */
|
|
void retroarch_main_quit_failure(void);
|
|
|
|
content_state_t *content_state_get_ptr(void);
|
|
|
|
unsigned content_get_subsystem_rom_id(void);
|
|
|
|
int content_get_subsystem(void);
|
|
|
|
void retroarch_menu_running(void);
|
|
|
|
void retroarch_menu_running_finished(bool quit);
|
|
|
|
enum retro_language retroarch_get_language_from_iso(const char *lang);
|
|
|
|
void retroarch_favorites_init(void);
|
|
|
|
void retroarch_favorites_deinit(void);
|
|
|
|
/* Hand the network clients the current settings. */
|
|
#ifdef HAVE_SMBCLIENT
|
|
void retroarch_smb_init(void);
|
|
#endif
|
|
#ifdef HAVE_NFSCLIENT
|
|
void retroarch_nfs_init(void);
|
|
#endif
|
|
|
|
/* Audio */
|
|
|
|
/**
|
|
* config_get_audio_driver_options:
|
|
*
|
|
* Get an enumerated list of all audio driver names, separated by '|'.
|
|
*
|
|
* Returns: string listing of all audio driver names, separated by '|'.
|
|
**/
|
|
const char* config_get_audio_driver_options(void);
|
|
|
|
#ifdef HAVE_MICROPHONE
|
|
/**
|
|
* config_get_microphone_driver_options:
|
|
*
|
|
* Get an enumerated list of all microphone driver names, separated by '|'.
|
|
*
|
|
* Returns: string listing of all microphone driver names, separated by '|'.
|
|
**/
|
|
const char* config_get_microphone_driver_options(void);
|
|
#endif
|
|
|
|
/* Camera */
|
|
|
|
/*
|
|
Returns rotation requested by the core regardless of if it has been
|
|
applied with the final video rotation
|
|
*/
|
|
unsigned int retroarch_get_core_requested_rotation(void);
|
|
|
|
/*
|
|
Returns final rotation including both user chosen video rotation
|
|
and core requested rotation if allowed by video_allow_rotate
|
|
*/
|
|
unsigned int retroarch_get_rotation(void);
|
|
|
|
void retroarch_init_task_queue(void);
|
|
|
|
/* Applies the task-queue settings to the running queue. */
|
|
void retroarch_task_queue_configure(void);
|
|
|
|
/* Schedules the main thread ahead of ordinary threads, or puts it back;
|
|
* called on the main thread. */
|
|
void retroarch_main_thread_priority(bool raise);
|
|
|
|
/**
|
|
* retroarch_main_deinit_begin:
|
|
* retroarch_main_deinit_pending:
|
|
* retroarch_main_deinit_finish:
|
|
*
|
|
* RARCH_CTL_MAIN_DEINIT in two halves around the wait for a save or
|
|
* load state task still inside the core. RARCH_CTL_MAIN_DEINIT waits
|
|
* between them; the staged content load returns to the frame loop
|
|
* between them and asks pending() each frame, then finishes. begin
|
|
* returns false when there is no session to close.
|
|
**/
|
|
bool retroarch_main_deinit_begin(void);
|
|
bool retroarch_main_deinit_pending(void);
|
|
void retroarch_main_deinit_finish(void);
|
|
|
|
/* Creates folder and core options stub file for subsequent runs */
|
|
bool core_options_create_override(bool game_specific);
|
|
bool core_options_remove_override(bool game_specific);
|
|
void core_options_reset(const char *label);
|
|
void core_options_flush(void);
|
|
|
|
/**
|
|
* retroarch_fail:
|
|
* @error_code : Error code.
|
|
* @error : Error message to show.
|
|
*
|
|
* Sanely kills the program.
|
|
**/
|
|
void retroarch_fail(int error_code, const char *error);
|
|
|
|
bool should_quit_on_close(void);
|
|
|
|
uint32_t retroarch_get_flags(void);
|
|
|
|
/* For a platform that asks the user for access to the folder the
|
|
* user directories live in: until the release, the main thread
|
|
* leaves them alone and the playlists they hold load afterwards. */
|
|
void retroarch_user_dirs_hold(void);
|
|
void retroarch_user_dirs_release(void);
|
|
|
|
RETRO_END_DECLS
|
|
|
|
#endif
|