This commit is contained in:
libretroadmin 2023-01-05 23:34:46 +01:00
parent 837ae65523
commit 5bac2b0204
3 changed files with 101 additions and 122 deletions

View File

@ -1748,8 +1748,9 @@ bool command_event(enum event_command cmd, void *data)
if ( !(runloop_st->flags & RUNLOOP_FLAG_CORE_RUNNING)
|| !(runloop_st->flags & RUNLOOP_FLAG_RUNAHEAD_SECONDARY_CORE_AVAILABLE))
return false;
if (runloop_st->secondary_lib_handle)
return true;
if (!runloop_st->secondary_lib_handle)
{
if (!secondary_core_ensure_exists(settings))
{
runloop_secondary_core_destroy();
@ -1757,7 +1758,8 @@ bool command_event(enum event_command cmd, void *data)
~RUNLOOP_FLAG_RUNAHEAD_SECONDARY_CORE_AVAILABLE;
return false;
}
return true;
}
break;
#endif
case CMD_EVENT_LOAD_STATE:
{
@ -3355,8 +3357,7 @@ bool command_event(enum event_command cmd, void *data)
return false;
if (!discord_enable)
return false;
if (discord_st->ready)
return true;
if (!discord_st->ready)
discord_init(discord_app_id, p_rarch->launch_arguments);
}
#endif

View File

@ -145,6 +145,21 @@ enum runloop_action
RUNLOOP_ACTION_AUTOSAVE
};
enum rarch_main_wrap_flags
{
RARCH_MAIN_WRAP_FLAG_VERBOSE = (1 << 0),
RARCH_MAIN_WRAP_FLAG_NO_CONTENT = (1 << 1),
RARCH_MAIN_WRAP_FLAG_TOUCHED = (1 << 2)
};
enum content_state_flags
{
CONTENT_ST_FLAG_IS_INITED = (1 << 0),
CONTENT_ST_FLAG_CORE_DOES_NOT_NEED_CONTENT = (1 << 1),
CONTENT_ST_FLAG_PENDING_SUBSYSTEM_INIT = (1 << 2),
CONTENT_ST_FLAG_PENDING_ROM_CRC = (1 << 3)
};
typedef struct rarch_memory_descriptor
{
struct retro_memory_descriptor core; /* uint64_t alignment */
@ -193,16 +208,6 @@ typedef struct retro_ctx_cheat_info
bool enabled;
} retro_ctx_cheat_info_t;
typedef struct retro_ctx_api_info
{
unsigned version;
} retro_ctx_api_info_t;
typedef struct retro_ctx_region_info
{
unsigned region;
} retro_ctx_region_info_t;
typedef struct retro_ctx_controller_info
{
unsigned port;
@ -235,11 +240,6 @@ typedef struct retro_ctx_size_info
size_t size;
} retro_ctx_size_info_t;
typedef struct retro_ctx_environ_info
{
retro_environment_t env;
} retro_ctx_environ_info_t;
typedef struct retro_callbacks
{
retro_video_refresh_t frame_cb;
@ -249,13 +249,6 @@ typedef struct retro_callbacks
retro_input_poll_t poll_cb;
} retro_callbacks_t;
enum rarch_main_wrap_flags
{
RARCH_MAIN_WRAP_FLAG_VERBOSE = (1 << 0),
RARCH_MAIN_WRAP_FLAG_NO_CONTENT = (1 << 1),
RARCH_MAIN_WRAP_FLAG_TOUCHED = (1 << 2)
};
struct rarch_main_wrap
{
char **argv;
@ -268,12 +261,6 @@ struct rarch_main_wrap
uint8_t flags;
};
typedef struct rarch_resolution
{
unsigned idx;
unsigned id;
} rarch_resolution_t;
/* All run-time- / command line flag-related globals go here. */
typedef struct global
@ -291,8 +278,16 @@ typedef struct global
{
uint32_t *list;
unsigned count;
rarch_resolution_t current;
rarch_resolution_t initial;
struct
{
unsigned idx;
unsigned id;
} current;
struct
{
unsigned idx;
unsigned id;
} initial;
bool check;
} resolutions;
unsigned gamma_correction;
@ -344,14 +339,6 @@ typedef struct content_file_list
size_t size;
} content_file_list_t;
enum content_state_flags
{
CONTENT_ST_FLAG_IS_INITED = (1 << 0),
CONTENT_ST_FLAG_CORE_DOES_NOT_NEED_CONTENT = (1 << 1),
CONTENT_ST_FLAG_PENDING_SUBSYSTEM_INIT = (1 << 2),
CONTENT_ST_FLAG_PENDING_ROM_CRC = (1 << 3)
};
typedef struct content_state
{
char *pending_subsystem_roms[RARCH_MAX_SUBSYSTEM_ROMS];

109
runloop.h
View File

@ -57,6 +57,22 @@
#define RUNLOOP_MSG_QUEUE_UNLOCK(runloop_st) (void)(runloop_st)
#endif
#ifdef HAVE_BSV_MOVIE
#define BSV_MOVIE_IS_EOF() || (((input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_END) && (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_EOF_EXIT)))
#else
#define BSV_MOVIE_IS_EOF()
#endif
/* Time to exit out of the main loop?
* Reasons for exiting:
* a) Shutdown environment callback was invoked.
* b) Quit key was pressed.
* c) Frame count exceeds or equals maximum amount of frames to run.
* d) Video driver no longer alive.
* e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better)
*/
#define RUNLOOP_TIME_TO_EXIT(quit_key_pressed) ((runloop_state.flags & RUNLOOP_FLAG_SHUTDOWN_INITIATED) || quit_key_pressed || !is_alive BSV_MOVIE_IS_EOF() || ((runloop_state.max_frames != 0) && (frame_count >= runloop_state.max_frames)) || runloop_exec)
enum runloop_state_enum
{
RUNLOOP_STATE_ITERATE = 0,
@ -74,14 +90,41 @@ enum poll_type_override_t
POLL_TYPE_OVERRIDE_LATE
};
typedef struct runloop_ctx_msg_info
enum runloop_flags
{
const char *msg;
unsigned prio;
unsigned duration;
bool flush;
} runloop_ctx_msg_info_t;
RUNLOOP_FLAG_MAX_FRAMES_SCREENSHOT = (1 << 0),
RUNLOOP_FLAG_HAS_SET_CORE = (1 << 1),
RUNLOOP_FLAG_CORE_SET_SHARED_CONTEXT = (1 << 2),
RUNLOOP_FLAG_IGNORE_ENVIRONMENT_CB = (1 << 3),
RUNLOOP_FLAG_IS_SRAM_LOAD_DISABLED = (1 << 4),
RUNLOOP_FLAG_IS_SRAM_SAVE_DISABLED = (1 << 5),
RUNLOOP_FLAG_USE_SRAM = (1 << 6),
RUNLOOP_FLAG_PATCH_BLOCKED = (1 << 7),
RUNLOOP_FLAG_REQUEST_SPECIAL_SAVESTATE = (1 << 8),
RUNLOOP_FLAG_OVERRIDES_ACTIVE = (1 << 9),
RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE = (1 << 10),
RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE = (1 << 11),
RUNLOOP_FLAG_REMAPS_CORE_ACTIVE = (1 << 12),
RUNLOOP_FLAG_REMAPS_GAME_ACTIVE = (1 << 13),
RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE = (1 << 14),
RUNLOOP_FLAG_SHUTDOWN_INITIATED = (1 << 15),
RUNLOOP_FLAG_CORE_SHUTDOWN_INITIATED = (1 << 16),
RUNLOOP_FLAG_CORE_RUNNING = (1 << 17),
RUNLOOP_FLAG_AUTOSAVE = (1 << 18),
RUNLOOP_FLAG_HAS_VARIABLE_UPDATE = (1 << 19),
RUNLOOP_FLAG_INPUT_IS_DIRTY = (1 << 20),
RUNLOOP_FLAG_RUNAHEAD_SAVE_STATE_SIZE_KNOWN = (1 << 21),
RUNLOOP_FLAG_RUNAHEAD_AVAILABLE = (1 << 22),
RUNLOOP_FLAG_RUNAHEAD_SECONDARY_CORE_AVAILABLE = (1 << 23),
RUNLOOP_FLAG_RUNAHEAD_FORCE_INPUT_DIRTY = (1 << 24),
RUNLOOP_FLAG_SLOWMOTION = (1 << 25),
RUNLOOP_FLAG_FASTMOTION = (1 << 26),
RUNLOOP_FLAG_PAUSED = (1 << 27),
RUNLOOP_FLAG_IDLE = (1 << 28),
RUNLOOP_FLAG_FOCUSED = (1 << 29),
RUNLOOP_FLAG_FORCE_NONBLOCK = (1 << 30),
RUNLOOP_FLAG_IS_INITED = (1 << 31)
};
/* Contains the current retro_fastforwarding_override
* parameters along with any pending updates triggered
@ -131,42 +174,6 @@ typedef struct my_list_t
} my_list;
#endif
enum runloop_flags
{
RUNLOOP_FLAG_MAX_FRAMES_SCREENSHOT = (1 << 0),
RUNLOOP_FLAG_HAS_SET_CORE = (1 << 1),
RUNLOOP_FLAG_CORE_SET_SHARED_CONTEXT = (1 << 2),
RUNLOOP_FLAG_IGNORE_ENVIRONMENT_CB = (1 << 3),
RUNLOOP_FLAG_IS_SRAM_LOAD_DISABLED = (1 << 4),
RUNLOOP_FLAG_IS_SRAM_SAVE_DISABLED = (1 << 5),
RUNLOOP_FLAG_USE_SRAM = (1 << 6),
RUNLOOP_FLAG_PATCH_BLOCKED = (1 << 7),
RUNLOOP_FLAG_REQUEST_SPECIAL_SAVESTATE = (1 << 8),
RUNLOOP_FLAG_OVERRIDES_ACTIVE = (1 << 9),
RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE = (1 << 10),
RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE = (1 << 11),
RUNLOOP_FLAG_REMAPS_CORE_ACTIVE = (1 << 12),
RUNLOOP_FLAG_REMAPS_GAME_ACTIVE = (1 << 13),
RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE = (1 << 14),
RUNLOOP_FLAG_SHUTDOWN_INITIATED = (1 << 15),
RUNLOOP_FLAG_CORE_SHUTDOWN_INITIATED = (1 << 16),
RUNLOOP_FLAG_CORE_RUNNING = (1 << 17),
RUNLOOP_FLAG_AUTOSAVE = (1 << 18),
RUNLOOP_FLAG_HAS_VARIABLE_UPDATE = (1 << 19),
RUNLOOP_FLAG_INPUT_IS_DIRTY = (1 << 20),
RUNLOOP_FLAG_RUNAHEAD_SAVE_STATE_SIZE_KNOWN = (1 << 21),
RUNLOOP_FLAG_RUNAHEAD_AVAILABLE = (1 << 22),
RUNLOOP_FLAG_RUNAHEAD_SECONDARY_CORE_AVAILABLE = (1 << 23),
RUNLOOP_FLAG_RUNAHEAD_FORCE_INPUT_DIRTY = (1 << 24),
RUNLOOP_FLAG_SLOWMOTION = (1 << 25),
RUNLOOP_FLAG_FASTMOTION = (1 << 26),
RUNLOOP_FLAG_PAUSED = (1 << 27),
RUNLOOP_FLAG_IDLE = (1 << 28),
RUNLOOP_FLAG_FOCUSED = (1 << 29),
RUNLOOP_FLAG_FORCE_NONBLOCK = (1 << 30),
RUNLOOP_FLAG_IS_INITED = (1 << 31)
};
struct runloop
{
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
@ -305,22 +312,6 @@ struct runloop
typedef struct runloop runloop_state_t;
#ifdef HAVE_BSV_MOVIE
#define BSV_MOVIE_IS_EOF() || (((input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_END) && (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_EOF_EXIT)))
#else
#define BSV_MOVIE_IS_EOF()
#endif
/* Time to exit out of the main loop?
* Reasons for exiting:
* a) Shutdown environment callback was invoked.
* b) Quit key was pressed.
* c) Frame count exceeds or equals maximum amount of frames to run.
* d) Video driver no longer alive.
* e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better)
*/
#define RUNLOOP_TIME_TO_EXIT(quit_key_pressed) ((runloop_state.flags & RUNLOOP_FLAG_SHUTDOWN_INITIATED) || quit_key_pressed || !is_alive BSV_MOVIE_IS_EOF() || ((runloop_state.max_frames != 0) && (frame_count >= runloop_state.max_frames)) || runloop_exec)
RETRO_BEGIN_DECLS
void runloop_path_fill_names(void);