mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
Cleanups
This commit is contained in:
parent
837ae65523
commit
5bac2b0204
23
retroarch.c
23
retroarch.c
@ -1748,16 +1748,18 @@ 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 (!secondary_core_ensure_exists(settings))
|
||||
|
||||
if (!runloop_st->secondary_lib_handle)
|
||||
{
|
||||
runloop_secondary_core_destroy();
|
||||
runloop_st->flags &=
|
||||
~RUNLOOP_FLAG_RUNAHEAD_SECONDARY_CORE_AVAILABLE;
|
||||
return false;
|
||||
if (!secondary_core_ensure_exists(settings))
|
||||
{
|
||||
runloop_secondary_core_destroy();
|
||||
runloop_st->flags &=
|
||||
~RUNLOOP_FLAG_RUNAHEAD_SECONDARY_CORE_AVAILABLE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
#endif
|
||||
case CMD_EVENT_LOAD_STATE:
|
||||
{
|
||||
@ -3355,9 +3357,8 @@ bool command_event(enum event_command cmd, void *data)
|
||||
return false;
|
||||
if (!discord_enable)
|
||||
return false;
|
||||
if (discord_st->ready)
|
||||
return true;
|
||||
discord_init(discord_app_id, p_rarch->launch_arguments);
|
||||
if (!discord_st->ready)
|
||||
discord_init(discord_app_id, p_rarch->launch_arguments);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
@ -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];
|
||||
|
137
runloop.h
137
runloop.h
@ -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,63 +90,6 @@ enum poll_type_override_t
|
||||
POLL_TYPE_OVERRIDE_LATE
|
||||
};
|
||||
|
||||
|
||||
typedef struct runloop_ctx_msg_info
|
||||
{
|
||||
const char *msg;
|
||||
unsigned prio;
|
||||
unsigned duration;
|
||||
bool flush;
|
||||
} runloop_ctx_msg_info_t;
|
||||
|
||||
/* Contains the current retro_fastforwarding_override
|
||||
* parameters along with any pending updates triggered
|
||||
* by RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE */
|
||||
typedef struct fastmotion_overrides
|
||||
{
|
||||
struct retro_fastforwarding_override current;
|
||||
struct retro_fastforwarding_override next;
|
||||
bool pending;
|
||||
} fastmotion_overrides_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned priority;
|
||||
float duration;
|
||||
char str[128];
|
||||
bool set;
|
||||
} runloop_core_status_msg_t;
|
||||
|
||||
/* Contains all callbacks associated with
|
||||
* core options.
|
||||
* > At present there is only a single
|
||||
* callback, 'update_display' - but we
|
||||
* may wish to add more in the future
|
||||
* (e.g. for directly informing a core of
|
||||
* core option value changes, or getting/
|
||||
* setting extended/non-standard option
|
||||
* value data types) */
|
||||
typedef struct core_options_callbacks
|
||||
{
|
||||
retro_core_options_update_display_callback_t update_display;
|
||||
} core_options_callbacks_t;
|
||||
|
||||
#ifdef HAVE_RUNAHEAD
|
||||
typedef bool(*runahead_load_state_function)(const void*, size_t);
|
||||
|
||||
typedef void *(*constructor_t)(void);
|
||||
typedef void (*destructor_t )(void*);
|
||||
|
||||
typedef struct my_list_t
|
||||
{
|
||||
void **data;
|
||||
constructor_t constructor;
|
||||
destructor_t destructor;
|
||||
int capacity;
|
||||
int size;
|
||||
} my_list;
|
||||
#endif
|
||||
|
||||
enum runloop_flags
|
||||
{
|
||||
RUNLOOP_FLAG_MAX_FRAMES_SCREENSHOT = (1 << 0),
|
||||
@ -167,6 +126,54 @@ enum runloop_flags
|
||||
RUNLOOP_FLAG_IS_INITED = (1 << 31)
|
||||
};
|
||||
|
||||
/* Contains the current retro_fastforwarding_override
|
||||
* parameters along with any pending updates triggered
|
||||
* by RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE */
|
||||
typedef struct fastmotion_overrides
|
||||
{
|
||||
struct retro_fastforwarding_override current;
|
||||
struct retro_fastforwarding_override next;
|
||||
bool pending;
|
||||
} fastmotion_overrides_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned priority;
|
||||
float duration;
|
||||
char str[128];
|
||||
bool set;
|
||||
} runloop_core_status_msg_t;
|
||||
|
||||
/* Contains all callbacks associated with
|
||||
* core options.
|
||||
* > At present there is only a single
|
||||
* callback, 'update_display' - but we
|
||||
* may wish to add more in the future
|
||||
* (e.g. for directly informing a core of
|
||||
* core option value changes, or getting/
|
||||
* setting extended/non-standard option
|
||||
* value data types) */
|
||||
typedef struct core_options_callbacks
|
||||
{
|
||||
retro_core_options_update_display_callback_t update_display;
|
||||
} core_options_callbacks_t;
|
||||
|
||||
#ifdef HAVE_RUNAHEAD
|
||||
typedef bool (*runahead_load_state_function)(const void*, size_t);
|
||||
|
||||
typedef void *(*constructor_t)(void);
|
||||
typedef void (*destructor_t )(void*);
|
||||
|
||||
typedef struct my_list_t
|
||||
{
|
||||
void **data;
|
||||
constructor_t constructor;
|
||||
destructor_t destructor;
|
||||
int capacity;
|
||||
int size;
|
||||
} my_list;
|
||||
#endif
|
||||
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user