From b4137915e80c4e5a3fcf4c94eff74ac59cd2b45f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 23 Nov 2021 16:58:36 +0100 Subject: [PATCH] Move code to proper locations --- audio/audio_driver.c | 12 ++++ gfx/video_driver.c | 6 ++ input/input_driver.c | 24 ++++++++ retroarch.c | 131 +++++++++++++------------------------------ 4 files changed, 82 insertions(+), 91 deletions(-) diff --git a/audio/audio_driver.c b/audio/audio_driver.c index 17b720b742..9cd1514811 100644 --- a/audio/audio_driver.c +++ b/audio/audio_driver.c @@ -177,6 +177,18 @@ audio_driver_state_t *audio_state_get_ptr(void) return &audio_driver_st; } +/** + * 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) +{ + return char_list_new_special(STRING_LIST_AUDIO_DRIVERS, NULL); +} + #ifdef HAVE_TRANSLATE /* TODO/FIXME - Doesn't currently work. Fix this. */ bool audio_driver_is_ai_service_speech_running(void) diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 80f436f226..8595a041ec 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -402,6 +402,12 @@ video_driver_state_t *video_state_get_ptr(void) { return &video_driver_st; } + +void crt_switch_driver_refresh(void) +{ + video_driver_reinit(DRIVERS_CMD_ALL); +} + #ifdef HAVE_THREADS void *video_thread_get_ptr(video_driver_state_t *video_st) diff --git a/input/input_driver.c b/input/input_driver.c index 24076875c6..1665930fc6 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -358,6 +358,30 @@ input_driver_state_t *input_state_get_ptr(void) return &input_driver_st; } +/** + * config_get_input_driver_options: + * + * Get an enumerated list of all input driver names, separated by '|'. + * + * Returns: string listing of all input driver names, separated by '|'. + **/ +const char* config_get_input_driver_options(void) +{ + return char_list_new_special(STRING_LIST_INPUT_DRIVERS, NULL); +} + +/** + * config_get_joypad_driver_options: + * + * Get an enumerated list of all joypad driver names, separated by '|'. + * + * Returns: string listing of all joypad driver names, separated by '|'. + **/ +const char* config_get_joypad_driver_options(void) +{ + return char_list_new_special(STRING_LIST_INPUT_JOYPAD_DRIVERS, NULL); +} + /** * Finds first suitable joypad driver and initializes. Used as a fallback by * input_joypad_init_driver when no matching driver is found. diff --git a/retroarch.c b/retroarch.c index bcfe526c0f..e5de15c822 100644 --- a/retroarch.c +++ b/retroarch.c @@ -233,6 +233,14 @@ #define BSV_MOVIE_ARG #endif +#define _PSUPP_BUF(buf, var, name, desc) \ + strlcat(buf, " ", sizeof(buf)); \ + strlcat(buf, name, sizeof(buf)); \ + strlcat(buf, ":\n\t\t", sizeof(buf)); \ + strlcat(buf, desc, sizeof(buf)); \ + strlcat(buf, ": ", sizeof(buf)); \ + strlcat(buf, var ? "yes\n" : "no\n", sizeof(buf)) + /* Griffin hack */ #ifdef HAVE_QT #ifndef HAVE_MAIN @@ -240,6 +248,38 @@ #endif #endif +/* Descriptive names for options without short variant. + * + * Please keep the name in sync with the option name. + * Order does not matter. */ +enum +{ + RA_OPT_MENU = 256, /* must be outside the range of a char */ + RA_OPT_STATELESS, + RA_OPT_CHECK_FRAMES, + RA_OPT_PORT, + RA_OPT_SPECTATE, + RA_OPT_NICK, + RA_OPT_COMMAND, + RA_OPT_APPENDCONFIG, + RA_OPT_BPS, + RA_OPT_IPS, + RA_OPT_NO_PATCH, + RA_OPT_RECORDCONFIG, + RA_OPT_SUBSYSTEM, + RA_OPT_SIZE, + RA_OPT_FEATURES, + RA_OPT_VERSION, + RA_OPT_EOF_EXIT, + RA_OPT_LOG_FILE, + RA_OPT_MAX_FRAMES, + RA_OPT_MAX_FRAMES_SCREENSHOT, + RA_OPT_MAX_FRAMES_SCREENSHOT_PATH, + RA_OPT_SET_SHADER, + RA_OPT_ACCESSIBILITY, + RA_OPT_LOAD_MENU_ON_ERROR +}; + /* DRIVERS */ #ifdef HAVE_BLUETOOTH extern const bluetooth_driver_t *bluetooth_drivers[]; @@ -3970,64 +4010,6 @@ void libretro_free_system_info(struct retro_system_info *info) memset(info, 0, sizeof(*info)); } -/* INPUT */ - -/** - * config_get_input_driver_options: - * - * Get an enumerated list of all input driver names, separated by '|'. - * - * Returns: string listing of all input driver names, separated by '|'. - **/ -const char* config_get_input_driver_options(void) -{ - return char_list_new_special(STRING_LIST_INPUT_DRIVERS, NULL); -} - -/* MENU INPUT */ - -/** - * config_get_joypad_driver_options: - * - * Get an enumerated list of all joypad driver names, separated by '|'. - * - * Returns: string listing of all joypad driver names, separated by '|'. - **/ -const char* config_get_joypad_driver_options(void) -{ - return char_list_new_special(STRING_LIST_INPUT_JOYPAD_DRIVERS, NULL); -} - -/* 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) -{ - return char_list_new_special(STRING_LIST_AUDIO_DRIVERS, NULL); -} - -/* VIDEO */ - -void crt_switch_driver_refresh(void) -{ - /*video_context_driver_reset();*/ - video_driver_reinit(DRIVERS_CMD_ALL); -} - -#define _PSUPP_BUF(buf, var, name, desc) \ - strlcat(buf, " ", sizeof(buf)); \ - strlcat(buf, name, sizeof(buf)); \ - strlcat(buf, ":\n\t\t", sizeof(buf)); \ - strlcat(buf, desc, sizeof(buf)); \ - strlcat(buf, ": ", sizeof(buf)); \ - strlcat(buf, var ? "yes\n" : "no\n", sizeof(buf)) - static void retroarch_print_features(void) { char buf[2048]; @@ -4277,39 +4259,6 @@ static void retroarch_print_help(const char *arg0) } } -/* Descriptive names for options without short variant. - * - * Please keep the name in sync with the option name. - * Order does not matter. */ -enum -{ - RA_OPT_MENU = 256, /* must be outside the range of a char */ - RA_OPT_STATELESS, - RA_OPT_CHECK_FRAMES, - RA_OPT_PORT, - RA_OPT_SPECTATE, - RA_OPT_NICK, - RA_OPT_COMMAND, - RA_OPT_APPENDCONFIG, - RA_OPT_BPS, - RA_OPT_IPS, - RA_OPT_NO_PATCH, - RA_OPT_RECORDCONFIG, - RA_OPT_SUBSYSTEM, - RA_OPT_SIZE, - RA_OPT_FEATURES, - RA_OPT_VERSION, - RA_OPT_EOF_EXIT, - RA_OPT_LOG_FILE, - RA_OPT_MAX_FRAMES, - RA_OPT_MAX_FRAMES_SCREENSHOT, - RA_OPT_MAX_FRAMES_SCREENSHOT_PATH, - RA_OPT_SET_SHADER, - RA_OPT_ACCESSIBILITY, - RA_OPT_LOAD_MENU_ON_ERROR -}; - - /** * retroarch_parse_input_and_config: * @argc : Count of (commandline) arguments.