From 69291940f4b322fee29628a96f1045a0cfc170a4 Mon Sep 17 00:00:00 2001 From: aglab2 Date: Sat, 12 Mar 2022 19:56:52 +0800 Subject: [PATCH] Added GLideN64 configs, reenable glN64 --- .vscode/settings.json | 6 + Graphics/plugin.h | 3 +- Makefile | 2 +- Makefile.common | 2 +- libretro-common/include/libretro.h | 1164 +++++++++- libretro/libretro.c | 607 ++++-- libretro/libretro_core_options.h | 1907 +++++++++++++++++ mupen64plus-core/src/api/config.c | 1 + mupen64plus-core/src/plugin/plugin.c | 9 +- mupen64plus-video-gliden64/src/GBI.cpp | 2 +- .../src/Graphics/OpenGLContext/GLFunctions.h | 2 +- .../src/GraphicsDrawer.cpp | 2 +- mupen64plus-video-gliden64/src/RSP.cpp | 10 +- mupen64plus-video-gliden64/src/RSP.h | 2 +- mupen64plus-video-gliden64/src/gDP.cpp | 6 +- .../src/mupenplus/Config_mupenplus.cpp | 49 +- 16 files changed, 3590 insertions(+), 184 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 libretro/libretro_core_options.h diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..3319c4e98 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.associations": { + "gles2n64.h": "c", + "gsp_state.h": "c" + } +} \ No newline at end of file diff --git a/Graphics/plugin.h b/Graphics/plugin.h index e570e89c1..11ccd660d 100644 --- a/Graphics/plugin.h +++ b/Graphics/plugin.h @@ -11,7 +11,8 @@ enum gfx_plugin_type GFX_RICE, GFX_GLN64, GFX_ANGRYLION, - GFX_PARALLEL + GFX_PARALLEL, + GFX_GLIDEN64, }; enum rsp_plugin_type diff --git a/Makefile b/Makefile index 42f7c891a..bbfc34c96 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ HAVE_RSP_DUMP=0 HAVE_RDP_DUMP=0 HAVE_GLIDE64=1 HAVE_GLIDEN64=1 -HAVE_GLN64=0 +HAVE_GLN64=1 HAVE_RICE=1 HAVE_PARALLEL?=0 HAVE_PARALLEL_RSP?=0 diff --git a/Makefile.common b/Makefile.common index c0d656162..be9da5d98 100644 --- a/Makefile.common +++ b/Makefile.common @@ -24,7 +24,7 @@ else ifneq ($(platform), vita) HAVE_GLIDE64 = 1 HAVE_GLIDEN64 = 1 - HAVE_GLN64 = 0 + HAVE_GLN64 = 1 HAVE_RICE = 1 else HAVE_GLIDE64 = 0 diff --git a/libretro-common/include/libretro.h b/libretro-common/include/libretro.h index 960f7a6f0..2f1748370 100644 --- a/libretro-common/include/libretro.h +++ b/libretro-common/include/libretro.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2018 The RetroArch team +/* Copyright (C) 2010-2020 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this libretro API header (libretro.h). @@ -69,7 +69,7 @@ extern "C" { # endif # endif # else -# if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__CELLOS_LV2__) +# if defined(__GNUC__) && __GNUC__ >= 4 # define RETRO_API RETRO_CALLCONV __attribute__((__visibility__("default"))) # else # define RETRO_API RETRO_CALLCONV @@ -278,6 +278,11 @@ enum retro_language RETRO_LANGUAGE_ARABIC = 16, RETRO_LANGUAGE_GREEK = 17, RETRO_LANGUAGE_TURKISH = 18, + RETRO_LANGUAGE_SLOVAK = 19, + RETRO_LANGUAGE_PERSIAN = 20, + RETRO_LANGUAGE_HEBREW = 21, + RETRO_LANGUAGE_ASTURIAN = 22, + RETRO_LANGUAGE_FINNISH = 23, RETRO_LANGUAGE_LAST, /* Ensure sizeof(enum) == sizeof(int) */ @@ -708,6 +713,9 @@ enum retro_mod * state of rumble motors in controllers. * A strong and weak motor is supported, and they can be * controlled indepedently. + * Should be called from either retro_init() or retro_load_game(). + * Should not be called from retro_set_environment(). + * Returns false if rumble functionality is unavailable. */ #define RETRO_ENVIRONMENT_GET_INPUT_DEVICE_CAPABILITIES 24 /* uint64_t * -- @@ -1087,10 +1095,10 @@ enum retro_mod #define RETRO_ENVIRONMENT_GET_TARGET_REFRESH_RATE (50 | RETRO_ENVIRONMENT_EXPERIMENTAL) /* float * -- - * Float value that lets us know what target refresh rate + * Float value that lets us know what target refresh rate * is curently in use by the frontend. * - * The core can use the returned value to set an ideal + * The core can use the returned value to set an ideal * refresh rate/framerate. */ @@ -1098,7 +1106,7 @@ enum retro_mod /* bool * -- * Boolean value that indicates whether or not the frontend supports * input bitmasks being returned by retro_input_state_t. The advantage - * of this is that retro_input_state_t has to be only called once to + * of this is that retro_input_state_t has to be only called once to * grab all button states instead of multiple times. * * If it returns true, you can pass RETRO_DEVICE_ID_JOYPAD_MASK as 'id' @@ -1117,12 +1125,19 @@ enum retro_mod * This may be still be done regardless of the core options * interface version. * - * If version is 1 however, core options may instead be set by + * If version is >= 1 however, core options may instead be set by * passing an array of retro_core_option_definition structs to * RETRO_ENVIRONMENT_SET_CORE_OPTIONS, or a 2D array of * retro_core_option_definition structs to RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL. * This allows the core to additionally set option sublabel information * and/or provide localisation support. + * + * If version is >= 2, core options may instead be set by passing + * a retro_core_options_v2 struct to RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2, + * or an array of retro_core_options_v2 structs to + * RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL. This allows the core + * to additionally set optional core option category information + * for frontends with core option category support. */ #define RETRO_ENVIRONMENT_SET_CORE_OPTIONS 53 @@ -1132,8 +1147,8 @@ enum retro_mod * GET_VARIABLE. * This allows the frontend to present these variables to * a user dynamically. - * This should only be called if RETRO_ENVIRONMENT_GET_ENHANCED_CORE_OPTIONS - * returns an API version of 1. + * This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION + * returns an API version of >= 1. * This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES. * This should be called the first time as early as * possible (ideally in retro_set_environment). @@ -1164,13 +1179,11 @@ enum retro_mod * default value is NULL, the first entry in the * retro_core_option_definition::values array is treated as the default. * - * The number of possible options should be very limited, + * The number of possible option values should be very limited, * and must be less than RETRO_NUM_CORE_OPTION_VALUES_MAX. * i.e. it should be feasible to cycle through options * without a keyboard. * - * First entry should be treated as a default. - * * Example entry: * { * "foo_option", @@ -1196,9 +1209,10 @@ enum retro_mod * GET_VARIABLE. * This allows the frontend to present these variables to * a user dynamically. - * This should only be called if RETRO_ENVIRONMENT_GET_ENHANCED_CORE_OPTIONS - * returns an API version of 1. + * This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION + * returns an API version of >= 1. * This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES. + * This should be called instead of RETRO_ENVIRONMENT_SET_CORE_OPTIONS. * This should be called the first time as early as * possible (ideally in retro_set_environment). * Afterwards it may be called again for the core to communicate @@ -1257,7 +1271,488 @@ enum retro_mod * * 'data' points to an unsigned variable */ - + +#define RETRO_ENVIRONMENT_GET_DISK_CONTROL_INTERFACE_VERSION 57 + /* unsigned * -- + * Unsigned value is the API version number of the disk control + * interface supported by the frontend. If callback return false, + * API version is assumed to be 0. + * + * In legacy code, the disk control interface is defined by passing + * a struct of type retro_disk_control_callback to + * RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE. + * This may be still be done regardless of the disk control + * interface version. + * + * If version is >= 1 however, the disk control interface may + * instead be defined by passing a struct of type + * retro_disk_control_ext_callback to + * RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE. + * This allows the core to provide additional information about + * disk images to the frontend and/or enables extra + * disk control functionality by the frontend. + */ + +#define RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE 58 + /* const struct retro_disk_control_ext_callback * -- + * Sets an interface which frontend can use to eject and insert + * disk images, and also obtain information about individual + * disk image files registered by the core. + * This is used for games which consist of multiple images and + * must be manually swapped out by the user (e.g. PSX, floppy disk + * based systems). + */ + +#define RETRO_ENVIRONMENT_GET_MESSAGE_INTERFACE_VERSION 59 + /* unsigned * -- + * Unsigned value is the API version number of the message + * interface supported by the frontend. If callback returns + * false, API version is assumed to be 0. + * + * In legacy code, messages may be displayed in an + * implementation-specific manner by passing a struct + * of type retro_message to RETRO_ENVIRONMENT_SET_MESSAGE. + * This may be still be done regardless of the message + * interface version. + * + * If version is >= 1 however, messages may instead be + * displayed by passing a struct of type retro_message_ext + * to RETRO_ENVIRONMENT_SET_MESSAGE_EXT. This allows the + * core to specify message logging level, priority and + * destination (OSD, logging interface or both). + */ + +#define RETRO_ENVIRONMENT_SET_MESSAGE_EXT 60 + /* const struct retro_message_ext * -- + * Sets a message to be displayed in an implementation-specific + * manner for a certain amount of 'frames'. Additionally allows + * the core to specify message logging level, priority and + * destination (OSD, logging interface or both). + * Should not be used for trivial messages, which should simply be + * logged via RETRO_ENVIRONMENT_GET_LOG_INTERFACE (or as a + * fallback, stderr). + */ + +#define RETRO_ENVIRONMENT_GET_INPUT_MAX_USERS 61 + /* unsigned * -- + * Unsigned value is the number of active input devices + * provided by the frontend. This may change between + * frames, but will remain constant for the duration + * of each frame. + * If callback returns true, a core need not poll any + * input device with an index greater than or equal to + * the number of active devices. + * If callback returns false, the number of active input + * devices is unknown. In this case, all input devices + * should be considered active. + */ + +#define RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK 62 + /* const struct retro_audio_buffer_status_callback * -- + * Lets the core know the occupancy level of the frontend + * audio buffer. Can be used by a core to attempt frame + * skipping in order to avoid buffer under-runs. + * A core may pass NULL to disable buffer status reporting + * in the frontend. + */ + +#define RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY 63 + /* const unsigned * -- + * Sets minimum frontend audio latency in milliseconds. + * Resultant audio latency may be larger than set value, + * or smaller if a hardware limit is encountered. A frontend + * is expected to honour requests up to 512 ms. + * + * - If value is less than current frontend + * audio latency, callback has no effect + * - If value is zero, default frontend audio + * latency is set + * + * May be used by a core to increase audio latency and + * therefore decrease the probability of buffer under-runs + * (crackling) when performing 'intensive' operations. + * A core utilising RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK + * to implement audio-buffer-based frame skipping may achieve + * optimal results by setting the audio latency to a 'high' + * (typically 6x or 8x) integer multiple of the expected + * frame time. + * + * WARNING: This can only be called from within retro_run(). + * Calling this can require a full reinitialization of audio + * drivers in the frontend, so it is important to call it very + * sparingly, and usually only with the users explicit consent. + * An eventual driver reinitialize will happen so that audio + * callbacks happening after this call within the same retro_run() + * call will target the newly initialized driver. + */ + +#define RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE 64 + /* const struct retro_fastforwarding_override * -- + * Used by a libretro core to override the current + * fastforwarding mode of the frontend. + * If NULL is passed to this function, the frontend + * will return true if fastforwarding override + * functionality is supported (no change in + * fastforwarding state will occur in this case). + */ + +#define RETRO_ENVIRONMENT_SET_CONTENT_INFO_OVERRIDE 65 + /* const struct retro_system_content_info_override * -- + * Allows an implementation to override 'global' content + * info parameters reported by retro_get_system_info(). + * Overrides also affect subsystem content info parameters + * set via RETRO_ENVIRONMENT_SET_SUBSYSTEM_INFO. + * This function must be called inside retro_set_environment(). + * If callback returns false, content info overrides + * are unsupported by the frontend, and will be ignored. + * If callback returns true, extended game info may be + * retrieved by calling RETRO_ENVIRONMENT_GET_GAME_INFO_EXT + * in retro_load_game() or retro_load_game_special(). + * + * 'data' points to an array of retro_system_content_info_override + * structs terminated by a { NULL, false, false } element. + * If 'data' is NULL, no changes will be made to the frontend; + * a core may therefore pass NULL in order to test whether + * the RETRO_ENVIRONMENT_SET_CONTENT_INFO_OVERRIDE and + * RETRO_ENVIRONMENT_GET_GAME_INFO_EXT callbacks are supported + * by the frontend. + * + * For struct member descriptions, see the definition of + * struct retro_system_content_info_override. + * + * Example: + * + * - struct retro_system_info: + * { + * "My Core", // library_name + * "v1.0", // library_version + * "m3u|md|cue|iso|chd|sms|gg|sg", // valid_extensions + * true, // need_fullpath + * false // block_extract + * } + * + * - Array of struct retro_system_content_info_override: + * { + * { + * "md|sms|gg", // extensions + * false, // need_fullpath + * true // persistent_data + * }, + * { + * "sg", // extensions + * false, // need_fullpath + * false // persistent_data + * }, + * { NULL, false, false } + * } + * + * Result: + * - Files of type m3u, cue, iso, chd will not be + * loaded by the frontend. Frontend will pass a + * valid path to the core, and core will handle + * loading internally + * - Files of type md, sms, gg will be loaded by + * the frontend. A valid memory buffer will be + * passed to the core. This memory buffer will + * remain valid until retro_deinit() returns + * - Files of type sg will be loaded by the frontend. + * A valid memory buffer will be passed to the core. + * This memory buffer will remain valid until + * retro_load_game() (or retro_load_game_special()) + * returns + * + * NOTE: If an extension is listed multiple times in + * an array of retro_system_content_info_override + * structs, only the first instance will be registered + */ + +#define RETRO_ENVIRONMENT_GET_GAME_INFO_EXT 66 + /* const struct retro_game_info_ext ** -- + * Allows an implementation to fetch extended game + * information, providing additional content path + * and memory buffer status details. + * This function may only be called inside + * retro_load_game() or retro_load_game_special(). + * If callback returns false, extended game information + * is unsupported by the frontend. In this case, only + * regular retro_game_info will be available. + * RETRO_ENVIRONMENT_GET_GAME_INFO_EXT is guaranteed + * to return true if RETRO_ENVIRONMENT_SET_CONTENT_INFO_OVERRIDE + * returns true. + * + * 'data' points to an array of retro_game_info_ext structs. + * + * For struct member descriptions, see the definition of + * struct retro_game_info_ext. + * + * - If function is called inside retro_load_game(), + * the retro_game_info_ext array is guaranteed to + * have a size of 1 - i.e. the returned pointer may + * be used to access directly the members of the + * first retro_game_info_ext struct, for example: + * + * struct retro_game_info_ext *game_info_ext; + * if (environ_cb(RETRO_ENVIRONMENT_GET_GAME_INFO_EXT, &game_info_ext)) + * printf("Content Directory: %s\n", game_info_ext->dir); + * + * - If the function is called inside retro_load_game_special(), + * the retro_game_info_ext array is guaranteed to have a + * size equal to the num_info argument passed to + * retro_load_game_special() + */ + +#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2 67 + /* const struct retro_core_options_v2 * -- + * Allows an implementation to signal the environment + * which variables it might want to check for later using + * GET_VARIABLE. + * This allows the frontend to present these variables to + * a user dynamically. + * This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION + * returns an API version of >= 2. + * This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES. + * This should be called instead of RETRO_ENVIRONMENT_SET_CORE_OPTIONS. + * This should be called the first time as early as + * possible (ideally in retro_set_environment). + * Afterwards it may be called again for the core to communicate + * updated options to the frontend, but the number of core + * options must not change from the number in the initial call. + * If RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION returns an API + * version of >= 2, this callback is guaranteed to succeed + * (i.e. callback return value does not indicate success) + * If callback returns true, frontend has core option category + * support. + * If callback returns false, frontend does not have core option + * category support. + * + * 'data' points to a retro_core_options_v2 struct, containing + * of two pointers: + * - retro_core_options_v2::categories is an array of + * retro_core_option_v2_category structs terminated by a + * { NULL, NULL, NULL } element. If retro_core_options_v2::categories + * is NULL, all core options will have no category and will be shown + * at the top level of the frontend core option interface. If frontend + * does not have core option category support, categories array will + * be ignored. + * - retro_core_options_v2::definitions is an array of + * retro_core_option_v2_definition structs terminated by a + * { NULL, NULL, NULL, NULL, NULL, NULL, {{0}}, NULL } + * element. + * + * >> retro_core_option_v2_category notes: + * + * - retro_core_option_v2_category::key should contain string + * that uniquely identifies the core option category. Valid + * key characters are [a-z, A-Z, 0-9, _, -] + * Namespace collisions with other implementations' category + * keys are permitted. + * - retro_core_option_v2_category::desc should contain a human + * readable description of the category key. + * - retro_core_option_v2_category::info should contain any + * additional human readable information text that a typical + * user may need to understand the nature of the core option + * category. + * + * Example entry: + * { + * "advanced_settings", + * "Advanced", + * "Options affecting low-level emulation performance and accuracy." + * } + * + * >> retro_core_option_v2_definition notes: + * + * - retro_core_option_v2_definition::key should be namespaced to not + * collide with other implementations' keys. e.g. A core called + * 'foo' should use keys named as 'foo_option'. Valid key characters + * are [a-z, A-Z, 0-9, _, -]. + * - retro_core_option_v2_definition::desc should contain a human readable + * description of the key. Will be used when the frontend does not + * have core option category support. Examples: "Aspect Ratio" or + * "Video > Aspect Ratio". + * - retro_core_option_v2_definition::desc_categorized should contain a + * human readable description of the key, which will be used when + * frontend has core option category support. Example: "Aspect Ratio", + * where associated retro_core_option_v2_category::desc is "Video". + * If empty or NULL, the string specified by + * retro_core_option_v2_definition::desc will be used instead. + * retro_core_option_v2_definition::desc_categorized will be ignored + * if retro_core_option_v2_definition::category_key is empty or NULL. + * - retro_core_option_v2_definition::info should contain any additional + * human readable information text that a typical user may need to + * understand the functionality of the option. + * - retro_core_option_v2_definition::info_categorized should contain + * any additional human readable information text that a typical user + * may need to understand the functionality of the option, and will be + * used when frontend has core option category support. This is provided + * to accommodate the case where info text references an option by + * name/desc, and the desc/desc_categorized text for that option differ. + * If empty or NULL, the string specified by + * retro_core_option_v2_definition::info will be used instead. + * retro_core_option_v2_definition::info_categorized will be ignored + * if retro_core_option_v2_definition::category_key is empty or NULL. + * - retro_core_option_v2_definition::category_key should contain a + * category identifier (e.g. "video" or "audio") that will be + * assigned to the core option if frontend has core option category + * support. A categorized option will be shown in a subsection/ + * submenu of the frontend core option interface. If key is empty + * or NULL, or if key does not match one of the + * retro_core_option_v2_category::key values in the associated + * retro_core_option_v2_category array, option will have no category + * and will be shown at the top level of the frontend core option + * interface. + * - retro_core_option_v2_definition::values is an array of + * retro_core_option_value structs terminated by a { NULL, NULL } + * element. + * --> retro_core_option_v2_definition::values[index].value is an + * expected option value. + * --> retro_core_option_v2_definition::values[index].label is a + * human readable label used when displaying the value on screen. + * If NULL, the value itself is used. + * - retro_core_option_v2_definition::default_value is the default + * core option setting. It must match one of the expected option + * values in the retro_core_option_v2_definition::values array. If + * it does not, or the default value is NULL, the first entry in the + * retro_core_option_v2_definition::values array is treated as the + * default. + * + * The number of possible option values should be very limited, + * and must be less than RETRO_NUM_CORE_OPTION_VALUES_MAX. + * i.e. it should be feasible to cycle through options + * without a keyboard. + * + * Example entries: + * + * - Uncategorized: + * + * { + * "foo_option", + * "Speed hack coprocessor X", + * NULL, + * "Provides increased performance at the expense of reduced accuracy.", + * NULL, + * NULL, + * { + * { "false", NULL }, + * { "true", NULL }, + * { "unstable", "Turbo (Unstable)" }, + * { NULL, NULL }, + * }, + * "false" + * } + * + * - Categorized: + * + * { + * "foo_option", + * "Advanced > Speed hack coprocessor X", + * "Speed hack coprocessor X", + * "Setting 'Advanced > Speed hack coprocessor X' to 'true' or 'Turbo' provides increased performance at the expense of reduced accuracy", + * "Setting 'Speed hack coprocessor X' to 'true' or 'Turbo' provides increased performance at the expense of reduced accuracy", + * "advanced_settings", + * { + * { "false", NULL }, + * { "true", NULL }, + * { "unstable", "Turbo (Unstable)" }, + * { NULL, NULL }, + * }, + * "false" + * } + * + * Only strings are operated on. The possible values will + * generally be displayed and stored as-is by the frontend. + */ + +#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL 68 + /* const struct retro_core_options_v2_intl * -- + * Allows an implementation to signal the environment + * which variables it might want to check for later using + * GET_VARIABLE. + * This allows the frontend to present these variables to + * a user dynamically. + * This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION + * returns an API version of >= 2. + * This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES. + * This should be called instead of RETRO_ENVIRONMENT_SET_CORE_OPTIONS. + * This should be called instead of RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL. + * This should be called instead of RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2. + * This should be called the first time as early as + * possible (ideally in retro_set_environment). + * Afterwards it may be called again for the core to communicate + * updated options to the frontend, but the number of core + * options must not change from the number in the initial call. + * If RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION returns an API + * version of >= 2, this callback is guaranteed to succeed + * (i.e. callback return value does not indicate success) + * If callback returns true, frontend has core option category + * support. + * If callback returns false, frontend does not have core option + * category support. + * + * This is fundamentally the same as RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2, + * with the addition of localisation support. The description of the + * RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2 callback should be consulted + * for further details. + * + * 'data' points to a retro_core_options_v2_intl struct. + * + * - retro_core_options_v2_intl::us is a pointer to a + * retro_core_options_v2 struct defining the US English + * core options implementation. It must point to a valid struct. + * + * - retro_core_options_v2_intl::local is a pointer to a + * retro_core_options_v2 struct defining core options for + * the current frontend language. It may be NULL (in which case + * retro_core_options_v2_intl::us is used by the frontend). Any items + * missing from this struct will be read from + * retro_core_options_v2_intl::us instead. + * + * NOTE: Default core option values are always taken from the + * retro_core_options_v2_intl::us struct. Any default values in + * the retro_core_options_v2_intl::local struct will be ignored. + */ + +#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_UPDATE_DISPLAY_CALLBACK 69 + /* const struct retro_core_options_update_display_callback * -- + * Allows a frontend to signal that a core must update + * the visibility of any dynamically hidden core options, + * and enables the frontend to detect visibility changes. + * Used by the frontend to update the menu display status + * of core options without requiring a call of retro_run(). + * Must be called in retro_set_environment(). + */ + +#define RETRO_ENVIRONMENT_SET_VARIABLE 70 + /* const struct retro_variable * -- + * Allows an implementation to notify the frontend + * that a core option value has changed. + * + * retro_variable::key and retro_variable::value + * must match strings that have been set previously + * via one of the following: + * + * - RETRO_ENVIRONMENT_SET_VARIABLES + * - RETRO_ENVIRONMENT_SET_CORE_OPTIONS + * - RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL + * - RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2 + * - RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL + * + * After changing a core option value via this + * callback, RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE + * will return true. + * + * If data is NULL, no changes will be registered + * and the callback will return true; an + * implementation may therefore pass NULL in order + * to test whether the callback is supported. + */ + +#define RETRO_ENVIRONMENT_GET_THROTTLE_STATE (71 | RETRO_ENVIRONMENT_EXPERIMENTAL) + /* struct retro_throttle_state * -- + * Allows an implementation to get details on the actual rate + * the frontend is attempting to call retro_run(). + */ + /* VFS functionality */ /* File paths: @@ -1934,6 +2429,10 @@ enum retro_sensor_action { RETRO_SENSOR_ACCELEROMETER_ENABLE = 0, RETRO_SENSOR_ACCELEROMETER_DISABLE, + RETRO_SENSOR_GYROSCOPE_ENABLE, + RETRO_SENSOR_GYROSCOPE_DISABLE, + RETRO_SENSOR_ILLUMINANCE_ENABLE, + RETRO_SENSOR_ILLUMINANCE_DISABLE, RETRO_SENSOR_DUMMY = INT_MAX }; @@ -1942,6 +2441,10 @@ enum retro_sensor_action #define RETRO_SENSOR_ACCELEROMETER_X 0 #define RETRO_SENSOR_ACCELEROMETER_Y 1 #define RETRO_SENSOR_ACCELEROMETER_Z 2 +#define RETRO_SENSOR_GYROSCOPE_X 3 +#define RETRO_SENSOR_GYROSCOPE_Y 4 +#define RETRO_SENSOR_GYROSCOPE_Z 5 +#define RETRO_SENSOR_ILLUMINANCE 6 typedef bool (RETRO_CALLCONV *retro_set_sensor_state_t)(unsigned port, enum retro_sensor_action action, unsigned rate); @@ -2139,6 +2642,30 @@ struct retro_frame_time_callback retro_usec_t reference; }; +/* Notifies a libretro core of the current occupancy + * level of the frontend audio buffer. + * + * - active: 'true' if audio buffer is currently + * in use. Will be 'false' if audio is + * disabled in the frontend + * + * - occupancy: Given as a value in the range [0,100], + * corresponding to the occupancy percentage + * of the audio buffer + * + * - underrun_likely: 'true' if the frontend expects an + * audio buffer underrun during the + * next frame (indicates that a core + * should attempt frame skipping) + * + * It will be called right before retro_run() every frame. */ +typedef void (RETRO_CALLCONV *retro_audio_buffer_status_callback_t)( + bool active, unsigned occupancy, bool underrun_likely); +struct retro_audio_buffer_status_callback +{ + retro_audio_buffer_status_callback_t callback; +}; + /* Pass this to retro_video_refresh_t if rendering to hardware. * Passing NULL to retro_video_refresh_t is still a frame dupe as normal. * */ @@ -2299,7 +2826,8 @@ struct retro_keyboard_callback retro_keyboard_event_t callback; }; -/* Callbacks for RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE. +/* Callbacks for RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE & + * RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE. * Should be set for implementations which can swap out multiple disk * images in runtime. * @@ -2357,6 +2885,53 @@ typedef bool (RETRO_CALLCONV *retro_replace_image_index_t)(unsigned index, * with replace_image_index. */ typedef bool (RETRO_CALLCONV *retro_add_image_index_t)(void); +/* Sets initial image to insert in drive when calling + * core_load_game(). + * Since we cannot pass the initial index when loading + * content (this would require a major API change), this + * is set by the frontend *before* calling the core's + * retro_load_game()/retro_load_game_special() implementation. + * A core should therefore cache the index/path values and handle + * them inside retro_load_game()/retro_load_game_special(). + * - If 'index' is invalid (index >= get_num_images()), the + * core should ignore the set value and instead use 0 + * - 'path' is used purely for error checking - i.e. when + * content is loaded, the core should verify that the + * disk specified by 'index' has the specified file path. + * This is to guard against auto selecting the wrong image + * if (for example) the user should modify an existing M3U + * playlist. We have to let the core handle this because + * set_initial_image() must be called before loading content, + * i.e. the frontend cannot access image paths in advance + * and thus cannot perform the error check itself. + * If set path and content path do not match, the core should + * ignore the set 'index' value and instead use 0 + * Returns 'false' if index or 'path' are invalid, or core + * does not support this functionality + */ +typedef bool (RETRO_CALLCONV *retro_set_initial_image_t)(unsigned index, const char *path); + +/* Fetches the path of the specified disk image file. + * Returns 'false' if index is invalid (index >= get_num_images()) + * or path is otherwise unavailable. + */ +typedef bool (RETRO_CALLCONV *retro_get_image_path_t)(unsigned index, char *path, size_t len); + +/* Fetches a core-provided 'label' for the specified disk + * image file. In the simplest case this may be a file name + * (without extension), but for cores with more complex + * content requirements information may be provided to + * facilitate user disk swapping - for example, a core + * running floppy-disk-based content may uniquely label + * save disks, data disks, level disks, etc. with names + * corresponding to in-game disk change prompts (so the + * frontend can provide better user guidance than a 'dumb' + * disk index value). + * Returns 'false' if index is invalid (index >= get_num_images()) + * or label is otherwise unavailable. + */ +typedef bool (RETRO_CALLCONV *retro_get_image_label_t)(unsigned index, char *label, size_t len); + struct retro_disk_control_callback { retro_set_eject_state_t set_eject_state; @@ -2370,6 +2945,27 @@ struct retro_disk_control_callback retro_add_image_index_t add_image_index; }; +struct retro_disk_control_ext_callback +{ + retro_set_eject_state_t set_eject_state; + retro_get_eject_state_t get_eject_state; + + retro_get_image_index_t get_image_index; + retro_set_image_index_t set_image_index; + retro_get_num_images_t get_num_images; + + retro_replace_image_index_t replace_image_index; + retro_add_image_index_t add_image_index; + + /* NOTE: Frontend will only attempt to record/restore + * last used disk index if both set_initial_image() + * and get_image_path() are implemented */ + retro_set_initial_image_t set_initial_image; /* Optional - may be NULL */ + + retro_get_image_path_t get_image_path; /* Optional - may be NULL */ + retro_get_image_label_t get_image_label; /* Optional - may be NULL */ +}; + enum retro_pixel_format { /* 0RGB1555, native endian. @@ -2400,6 +2996,104 @@ struct retro_message unsigned frames; /* Duration in frames of message. */ }; +enum retro_message_target +{ + RETRO_MESSAGE_TARGET_ALL = 0, + RETRO_MESSAGE_TARGET_OSD, + RETRO_MESSAGE_TARGET_LOG +}; + +enum retro_message_type +{ + RETRO_MESSAGE_TYPE_NOTIFICATION = 0, + RETRO_MESSAGE_TYPE_NOTIFICATION_ALT, + RETRO_MESSAGE_TYPE_STATUS, + RETRO_MESSAGE_TYPE_PROGRESS +}; + +struct retro_message_ext +{ + /* Message string to be displayed/logged */ + const char *msg; + /* Duration (in ms) of message when targeting the OSD */ + unsigned duration; + /* Message priority when targeting the OSD + * > When multiple concurrent messages are sent to + * the frontend and the frontend does not have the + * capacity to display them all, messages with the + * *highest* priority value should be shown + * > There is no upper limit to a message priority + * value (within the bounds of the unsigned data type) + * > In the reference frontend (RetroArch), the same + * priority values are used for frontend-generated + * notifications, which are typically assigned values + * between 0 and 3 depending upon importance */ + unsigned priority; + /* Message logging level (info, warn, error, etc.) */ + enum retro_log_level level; + /* Message destination: OSD, logging interface or both */ + enum retro_message_target target; + /* Message 'type' when targeting the OSD + * > RETRO_MESSAGE_TYPE_NOTIFICATION: Specifies that a + * message should be handled in identical fashion to + * a standard frontend-generated notification + * > RETRO_MESSAGE_TYPE_NOTIFICATION_ALT: Specifies that + * message is a notification that requires user attention + * or action, but that it should be displayed in a manner + * that differs from standard frontend-generated notifications. + * This would typically correspond to messages that should be + * displayed immediately (independently from any internal + * frontend message queue), and/or which should be visually + * distinguishable from frontend-generated notifications. + * For example, a core may wish to inform the user of + * information related to a disk-change event. It is + * expected that the frontend itself may provide a + * notification in this case; if the core sends a + * message of type RETRO_MESSAGE_TYPE_NOTIFICATION, an + * uncomfortable 'double-notification' may occur. A message + * of RETRO_MESSAGE_TYPE_NOTIFICATION_ALT should therefore + * be presented such that visual conflict with regular + * notifications does not occur + * > RETRO_MESSAGE_TYPE_STATUS: Indicates that message + * is not a standard notification. This typically + * corresponds to 'status' indicators, such as a core's + * internal FPS, which are intended to be displayed + * either permanently while a core is running, or in + * a manner that does not suggest user attention or action + * is required. 'Status' type messages should therefore be + * displayed in a different on-screen location and in a manner + * easily distinguishable from both standard frontend-generated + * notifications and messages of type RETRO_MESSAGE_TYPE_NOTIFICATION_ALT + * > RETRO_MESSAGE_TYPE_PROGRESS: Indicates that message reports + * the progress of an internal core task. For example, in cases + * where a core itself handles the loading of content from a file, + * this may correspond to the percentage of the file that has been + * read. Alternatively, an audio/video playback core may use a + * message of type RETRO_MESSAGE_TYPE_PROGRESS to display the current + * playback position as a percentage of the runtime. 'Progress' type + * messages should therefore be displayed as a literal progress bar, + * where: + * - 'retro_message_ext.msg' is the progress bar title/label + * - 'retro_message_ext.progress' determines the length of + * the progress bar + * NOTE: Message type is a *hint*, and may be ignored + * by the frontend. If a frontend lacks support for + * displaying messages via alternate means than standard + * frontend-generated notifications, it will treat *all* + * messages as having the type RETRO_MESSAGE_TYPE_NOTIFICATION */ + enum retro_message_type type; + /* Task progress when targeting the OSD and message is + * of type RETRO_MESSAGE_TYPE_PROGRESS + * > -1: Unmetered/indeterminate + * > 0-100: Current progress percentage + * NOTE: Since message type is a hint, a frontend may ignore + * progress values. Where relevant, a core should therefore + * include progress percentage within the message string, + * such that the message intent remains clear when displayed + * as a standard frontend-generated notification */ + int8_t progress; +}; + /* Describes how the libretro implementation maps a libretro input bind * to its internal input system through a human readable string. * This string can be used to better let a user configure input. */ @@ -2420,7 +3114,7 @@ struct retro_input_descriptor struct retro_system_info { /* All pointers are owned by libretro implementation, and pointers must - * remain valid until retro_deinit() is called. */ + * remain valid until it is unloaded. */ const char *library_name; /* Descriptive name of library. Should not * contain any version numbers, etc. */ @@ -2462,6 +3156,213 @@ struct retro_system_info bool block_extract; }; +/* Defines overrides which modify frontend handling of + * specific content file types. + * An array of retro_system_content_info_override is + * passed to RETRO_ENVIRONMENT_SET_CONTENT_INFO_OVERRIDE + * NOTE: In the following descriptions, references to + * retro_load_game() may be replaced with + * retro_load_game_special() */ +struct retro_system_content_info_override +{ + /* A list of file extensions for which the override + * should apply, delimited by a 'pipe' character + * (e.g. "md|sms|gg") + * Permitted file extensions are limited to those + * included in retro_system_info::valid_extensions + * and/or retro_subsystem_rom_info::valid_extensions */ + const char *extensions; + + /* Overrides the need_fullpath value set in + * retro_system_info and/or retro_subsystem_rom_info. + * To reiterate: + * + * If need_fullpath is true and retro_load_game() is called: + * - retro_game_info::path is guaranteed to contain a valid + * path to an existent file + * - retro_game_info::data and retro_game_info::size are invalid + * + * If need_fullpath is false and retro_load_game() is called: + * - retro_game_info::path may be NULL + * - retro_game_info::data and retro_game_info::size are guaranteed + * to be valid + * + * In addition: + * + * If need_fullpath is true and retro_load_game() is called: + * - retro_game_info_ext::full_path is guaranteed to contain a valid + * path to an existent file + * - retro_game_info_ext::archive_path may be NULL + * - retro_game_info_ext::archive_file may be NULL + * - retro_game_info_ext::dir is guaranteed to contain a valid path + * to the directory in which the content file exists + * - retro_game_info_ext::name is guaranteed to contain the + * basename of the content file, without extension + * - retro_game_info_ext::ext is guaranteed to contain the + * extension of the content file in lower case format + * - retro_game_info_ext::data and retro_game_info_ext::size + * are invalid + * + * If need_fullpath is false and retro_load_game() is called: + * - If retro_game_info_ext::file_in_archive is false: + * - retro_game_info_ext::full_path is guaranteed to contain + * a valid path to an existent file + * - retro_game_info_ext::archive_path may be NULL + * - retro_game_info_ext::archive_file may be NULL + * - retro_game_info_ext::dir is guaranteed to contain a + * valid path to the directory in which the content file exists + * - retro_game_info_ext::name is guaranteed to contain the + * basename of the content file, without extension + * - retro_game_info_ext::ext is guaranteed to contain the + * extension of the content file in lower case format + * - If retro_game_info_ext::file_in_archive is true: + * - retro_game_info_ext::full_path may be NULL + * - retro_game_info_ext::archive_path is guaranteed to + * contain a valid path to an existent compressed file + * inside which the content file is located + * - retro_game_info_ext::archive_file is guaranteed to + * contain a valid path to an existent content file + * inside the compressed file referred to by + * retro_game_info_ext::archive_path + * e.g. for a compressed file '/path/to/foo.zip' + * containing 'bar.sfc' + * > retro_game_info_ext::archive_path will be '/path/to/foo.zip' + * > retro_game_info_ext::archive_file will be 'bar.sfc' + * - retro_game_info_ext::dir is guaranteed to contain a + * valid path to the directory in which the compressed file + * (containing the content file) exists + * - retro_game_info_ext::name is guaranteed to contain + * EITHER + * 1) the basename of the compressed file (containing + * the content file), without extension + * OR + * 2) the basename of the content file inside the + * compressed file, without extension + * In either case, a core should consider 'name' to + * be the canonical name/ID of the the content file + * - retro_game_info_ext::ext is guaranteed to contain the + * extension of the content file inside the compressed file, + * in lower case format + * - retro_game_info_ext::data and retro_game_info_ext::size are + * guaranteed to be valid */ + bool need_fullpath; + + /* If need_fullpath is false, specifies whether the content + * data buffer available in retro_load_game() is 'persistent' + * + * If persistent_data is false and retro_load_game() is called: + * - retro_game_info::data and retro_game_info::size + * are valid only until retro_load_game() returns + * - retro_game_info_ext::data and retro_game_info_ext::size + * are valid only until retro_load_game() returns + * + * If persistent_data is true and retro_load_game() is called: + * - retro_game_info::data and retro_game_info::size + * are valid until retro_deinit() returns + * - retro_game_info_ext::data and retro_game_info_ext::size + * are valid until retro_deinit() returns */ + bool persistent_data; +}; + +/* Similar to retro_game_info, but provides extended + * information about the source content file and + * game memory buffer status. + * And array of retro_game_info_ext is returned by + * RETRO_ENVIRONMENT_GET_GAME_INFO_EXT + * NOTE: In the following descriptions, references to + * retro_load_game() may be replaced with + * retro_load_game_special() */ +struct retro_game_info_ext +{ + /* - If file_in_archive is false, contains a valid + * path to an existent content file (UTF-8 encoded) + * - If file_in_archive is true, may be NULL */ + const char *full_path; + + /* - If file_in_archive is false, may be NULL + * - If file_in_archive is true, contains a valid path + * to an existent compressed file inside which the + * content file is located (UTF-8 encoded) */ + const char *archive_path; + + /* - If file_in_archive is false, may be NULL + * - If file_in_archive is true, contain a valid path + * to an existent content file inside the compressed + * file referred to by archive_path (UTF-8 encoded) + * e.g. for a compressed file '/path/to/foo.zip' + * containing 'bar.sfc' + * > archive_path will be '/path/to/foo.zip' + * > archive_file will be 'bar.sfc' */ + const char *archive_file; + + /* - If file_in_archive is false, contains a valid path + * to the directory in which the content file exists + * (UTF-8 encoded) + * - If file_in_archive is true, contains a valid path + * to the directory in which the compressed file + * (containing the content file) exists (UTF-8 encoded) */ + const char *dir; + + /* Contains the canonical name/ID of the content file + * (UTF-8 encoded). Intended for use when identifying + * 'complementary' content named after the loaded file - + * i.e. companion data of a different format (a CD image + * required by a ROM), texture packs, internally handled + * save files, etc. + * - If file_in_archive is false, contains the basename + * of the content file, without extension + * - If file_in_archive is true, then string is + * implementation specific. A frontend may choose to + * set a name value of: + * EITHER + * 1) the basename of the compressed file (containing + * the content file), without extension + * OR + * 2) the basename of the content file inside the + * compressed file, without extension + * RetroArch sets the 'name' value according to (1). + * A frontend that supports routine loading of + * content from archives containing multiple unrelated + * content files may set the 'name' value according + * to (2). */ + const char *name; + + /* - If file_in_archive is false, contains the extension + * of the content file in lower case format + * - If file_in_archive is true, contains the extension + * of the content file inside the compressed file, + * in lower case format */ + const char *ext; + + /* String of implementation specific meta-data. */ + const char *meta; + + /* Memory buffer of loaded game content. Will be NULL: + * IF + * - retro_system_info::need_fullpath is true and + * retro_system_content_info_override::need_fullpath + * is unset + * OR + * - retro_system_content_info_override::need_fullpath + * is true */ + const void *data; + + /* Size of game content memory buffer, in bytes */ + size_t size; + + /* True if loaded content file is inside a compressed + * archive */ + bool file_in_archive; + + /* - If data is NULL, value is unset/ignored + * - If data is non-NULL: + * - If persistent_data is false, data and size are + * valid only until retro_load_game() returns + * - If persistent_data is true, data and size are + * are valid until retro_deinit() returns */ + bool persistent_data; +}; + struct retro_game_geometry { unsigned base_width; /* Nominal video width of game. */ @@ -2514,8 +3415,20 @@ struct retro_core_option_display }; /* Maximum number of values permitted for a core option - * NOTE: This may be increased on a core-by-core basis - * if required (doing so has no effect on the frontend) */ + * > Note: We have to set a maximum value due the limitations + * of the C language - i.e. it is not possible to create an + * array of structs each containing a variable sized array, + * so the retro_core_option_definition values array must + * have a fixed size. The size limit of 128 is a balancing + * act - it needs to be large enough to support all 'sane' + * core options, but setting it too large may impact low memory + * platforms. In practise, if a core option has more than + * 128 values then the implementation is likely flawed. + * To quote the above API reference: + * "The number of possible options should be very limited + * i.e. it should be feasible to cycle through options + * without a keyboard." + */ #define RETRO_NUM_CORE_OPTION_VALUES_MAX 128 struct retro_core_option_value @@ -2561,6 +3474,143 @@ struct retro_core_options_intl struct retro_core_option_definition *local; }; +struct retro_core_option_v2_category +{ + /* Variable uniquely identifying the + * option category. Valid key characters + * are [a-z, A-Z, 0-9, _, -] */ + const char *key; + + /* Human-readable category description + * > Used as category menu label when + * frontend has core option category + * support */ + const char *desc; + + /* Human-readable category information + * > Used as category menu sublabel when + * frontend has core option category + * support + * > Optional (may be NULL or an empty + * string) */ + const char *info; +}; + +struct retro_core_option_v2_definition +{ + /* Variable to query in RETRO_ENVIRONMENT_GET_VARIABLE. + * Valid key characters are [a-z, A-Z, 0-9, _, -] */ + const char *key; + + /* Human-readable core option description + * > Used as menu label when frontend does + * not have core option category support + * e.g. "Video > Aspect Ratio" */ + const char *desc; + + /* Human-readable core option description + * > Used as menu label when frontend has + * core option category support + * e.g. "Aspect Ratio", where associated + * retro_core_option_v2_category::desc + * is "Video" + * > If empty or NULL, the string specified by + * desc will be used as the menu label + * > Will be ignored (and may be set to NULL) + * if category_key is empty or NULL */ + const char *desc_categorized; + + /* Human-readable core option information + * > Used as menu sublabel */ + const char *info; + + /* Human-readable core option information + * > Used as menu sublabel when frontend + * has core option category support + * (e.g. may be required when info text + * references an option by name/desc, + * and the desc/desc_categorized text + * for that option differ) + * > If empty or NULL, the string specified by + * info will be used as the menu sublabel + * > Will be ignored (and may be set to NULL) + * if category_key is empty or NULL */ + const char *info_categorized; + + /* Variable specifying category (e.g. "video", + * "audio") that will be assigned to the option + * if frontend has core option category support. + * > Categorized options will be displayed in a + * subsection/submenu of the frontend core + * option interface + * > Specified string must match one of the + * retro_core_option_v2_category::key values + * in the associated retro_core_option_v2_category + * array; If no match is not found, specified + * string will be considered as NULL + * > If specified string is empty or NULL, option will + * have no category and will be shown at the top + * level of the frontend core option interface */ + const char *category_key; + + /* Array of retro_core_option_value structs, terminated by NULL */ + struct retro_core_option_value values[RETRO_NUM_CORE_OPTION_VALUES_MAX]; + + /* Default core option value. Must match one of the values + * in the retro_core_option_value array, otherwise will be + * ignored */ + const char *default_value; +}; + +struct retro_core_options_v2 +{ + /* Array of retro_core_option_v2_category structs, + * terminated by NULL + * > If NULL, all entries in definitions array + * will have no category and will be shown at + * the top level of the frontend core option + * interface + * > Will be ignored if frontend does not have + * core option category support */ + struct retro_core_option_v2_category *categories; + + /* Array of retro_core_option_v2_definition structs, + * terminated by NULL */ + struct retro_core_option_v2_definition *definitions; +}; + +struct retro_core_options_v2_intl +{ + /* Pointer to a retro_core_options_v2 struct + * > US English implementation + * > Must point to a valid struct */ + struct retro_core_options_v2 *us; + + /* Pointer to a retro_core_options_v2 struct + * - Implementation for current frontend language + * - May be NULL */ + struct retro_core_options_v2 *local; +}; + +/* Used by the frontend to monitor changes in core option + * visibility. May be called each time any core option + * value is set via the frontend. + * - On each invocation, the core must update the visibility + * of any dynamically hidden options using the + * RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY environment + * callback. + * - On the first invocation, returns 'true' if the visibility + * of any core option has changed since the last call of + * retro_load_game() or retro_load_game_special(). + * - On each subsequent invocation, returns 'true' if the + * visibility of any core option has changed since the last + * time the function was called. */ +typedef bool (RETRO_CALLCONV *retro_core_options_update_display_callback_t)(void); +struct retro_core_options_update_display_callback +{ + retro_core_options_update_display_callback_t callback; +}; + struct retro_game_info { const char *path; /* Path to game, UTF-8 encoded. @@ -2607,6 +3657,84 @@ struct retro_framebuffer Set by frontend in GET_CURRENT_SOFTWARE_FRAMEBUFFER. */ }; +/* Used by a libretro core to override the current + * fastforwarding mode of the frontend */ +struct retro_fastforwarding_override +{ + /* Specifies the runtime speed multiplier that + * will be applied when 'fastforward' is true. + * For example, a value of 5.0 when running 60 FPS + * content will cap the fast-forward rate at 300 FPS. + * Note that the target multiplier may not be achieved + * if the host hardware has insufficient processing + * power. + * Setting a value of 0.0 (or greater than 0.0 but + * less than 1.0) will result in an uncapped + * fast-forward rate (limited only by hardware + * capacity). + * If the value is negative, it will be ignored + * (i.e. the frontend will use a runtime speed + * multiplier of its own choosing) */ + float ratio; + + /* If true, fastforwarding mode will be enabled. + * If false, fastforwarding mode will be disabled. */ + bool fastforward; + + /* If true, and if supported by the frontend, an + * on-screen notification will be displayed while + * 'fastforward' is true. + * If false, and if supported by the frontend, any + * on-screen fast-forward notifications will be + * suppressed */ + bool notification; + + /* If true, the core will have sole control over + * when fastforwarding mode is enabled/disabled; + * the frontend will not be able to change the + * state set by 'fastforward' until either + * 'inhibit_toggle' is set to false, or the core + * is unloaded */ + bool inhibit_toggle; +}; + +/* During normal operation. Rate will be equal to the core's internal FPS. */ +#define RETRO_THROTTLE_NONE 0 + +/* While paused or stepping single frames. Rate will be 0. */ +#define RETRO_THROTTLE_FRAME_STEPPING 1 + +/* During fast forwarding. + * Rate will be 0 if not specifically limited to a maximum speed. */ +#define RETRO_THROTTLE_FAST_FORWARD 2 + +/* During slow motion. Rate will be less than the core's internal FPS. */ +#define RETRO_THROTTLE_SLOW_MOTION 3 + +/* While rewinding recorded save states. Rate can vary depending on the rewind + * speed or be 0 if the frontend is not aiming for a specific rate. */ +#define RETRO_THROTTLE_REWINDING 4 + +/* While vsync is active in the video driver and the target refresh rate is + * lower than the core's internal FPS. Rate is the target refresh rate. */ +#define RETRO_THROTTLE_VSYNC 5 + +/* When the frontend does not throttle in any way. Rate will be 0. + * An example could be if no vsync or audio output is active. */ +#define RETRO_THROTTLE_UNBLOCKED 6 + +struct retro_throttle_state +{ + /* The current throttling mode. Should be one of the values above. */ + unsigned mode; + + /* How many times per second the frontend aims to call retro_run. + * Depending on the mode, it can be 0 if there is no known fixed rate. + * This won't be accurate if the total processing time of the core and + * the frontend is longer than what is available for one frame. */ + float rate; +}; + /* Callbacks */ /* Environment callback. Gives implementations a way of performing diff --git a/libretro/libretro.c b/libretro/libretro.c index f59e2e437..738dbfef8 100644 --- a/libretro/libretro.c +++ b/libretro/libretro.c @@ -24,6 +24,7 @@ #include "pi/pi_controller.h" #include "si/pif.h" #include "libretro_memory.h" +#include "libretro_core_options.h" /* Cxd4 RSP */ #include "../mupen64plus-rsp-cxd4/config.h" @@ -145,6 +146,46 @@ static bool initializing = true; extern int g_vi_refresh_rate; +static char rdp_plugin_last[32] = {0}; + +uint32_t CoreOptionCategoriesSupported = 0; +uint32_t CoreOptionUpdateDisplayCbSupported = 0; + +uint32_t bilinearMode = 0; +uint32_t EnableHWLighting = 0; +uint32_t CorrectTexrectCoords = 0; +uint32_t EnableInaccurateTextureCoordinates = 0; +uint32_t enableNativeResTexrects = 0; +uint32_t enableLegacyBlending = 0; +uint32_t EnableCopyColorToRDRAM = 0; +uint32_t EnableCopyDepthToRDRAM = 0; +uint32_t AspectRatio = 0; +uint32_t txFilterMode = 0; +uint32_t txEnhancementMode = 0; +uint32_t txHiresEnable = 0; +uint32_t txHiresFullAlphaChannel = 0; +uint32_t txFilterIgnoreBG = 0; +uint32_t EnableFXAA = 0; +uint32_t MultiSampling = 0; +uint32_t EnableFragmentDepthWrite = 0; +uint32_t EnableShadersStorage = 0; +uint32_t EnableTextureCache = 0; +uint32_t EnableFBEmulation = 0; +uint32_t EnableLODEmulation = 0; +uint32_t BackgroundMode = 0; // 0 is bgOnePiece +uint32_t EnableHiResAltCRC = 0; +uint32_t EnableTxCacheCompression = 0; +uint32_t EnableNativeResFactor = 0; +uint32_t EnableN64DepthCompare = 0; +uint32_t EnableCopyAuxToRDRAM = 0; +uint32_t GLideN64IniBehaviour = 0; + +uint32_t EnableOverscan = 0; +uint32_t OverscanTop = 0; +uint32_t OverscanLeft = 0; +uint32_t OverscanRight = 0; +uint32_t OverscanBottom = 0; + /* after the controller's CONTROL* member has been assigned we can update * them straight from here... */ extern struct @@ -238,11 +279,16 @@ static void core_settings_set_defaults(void) if (gfx_var.value && !strcmp(gfx_var.value, "auto")) core_settings_autoselect_gfx_plugin(); #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) -#if defined(HAVE_GLN64) || defined(HAVE_GLIDEN64) +#ifdef HAVE_GLN64 if (gfx_var.value && !strcmp(gfx_var.value, "gln64") && gl_inited) gfx_plugin = GFX_GLN64; #endif +#ifdef HAVE_GLIDEN64 + if (gfx_var.value && !strcmp(gfx_var.value, "gliden64") && gl_inited) + gfx_plugin = GFX_GLIDEN64; +#endif + #ifdef HAVE_RICE if (gfx_var.value && !strcmp(gfx_var.value, "rice") && gl_inited) gfx_plugin = GFX_RICE; @@ -332,142 +378,100 @@ static void core_settings_autoselect_rsp_plugin(void) #endif } +static bool set_variable_visibility(void) +{ + // For simplicity we create a prepared var per plugin, maybe create a macro for this? + struct retro_core_option_display option_display_gliden64; + struct retro_core_option_display option_display_angrylion; + struct retro_core_option_display option_display_parallel; + struct retro_core_option_display option_display_glide64; + + size_t i; + size_t num_options = 0; + char **values_buf = NULL; + struct retro_variable var; + const char *rdp_plugin_current = "__NULL__"; + bool rdp_plugin_found = false; + + // If option categories are supported but + // the option update display callback is not, + // then all options should be shown, + // i.e. do nothing + if (CoreOptionCategoriesSupported && !CoreOptionUpdateDisplayCbSupported) + return false; + + // Get current plugin + var.key = CORE_NAME "-gfxplugin"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + rdp_plugin_current = var.value; + rdp_plugin_found = true; + } + + // Check if plugin has changed since last + // call of this function + if (!strcmp(rdp_plugin_last, rdp_plugin_current)) + return false; + + strncpy(rdp_plugin_last, rdp_plugin_current, sizeof(rdp_plugin_last)); + + // Show/hide options depending on Plugins (Active isn't relevant!) + if (rdp_plugin_found) + { + option_display_gliden64.visible = !strcmp(rdp_plugin_current, "gliden64"); + option_display_angrylion.visible = !strcmp(rdp_plugin_current, "angrylion"); + option_display_parallel.visible = !strcmp(rdp_plugin_current, "parallel"); + option_display_glide64.visible = !strcmp(rdp_plugin_current, "glide64"); + } else { + option_display_gliden64.visible = option_display_angrylion.visible = option_display_parallel.visible = option_display_glide64.visible = true; + } + + // Determine number of options + for (;;) + { + if (!option_defs_us[num_options].key) + break; + num_options++; + } + + // Copy parameters from option_defs_us array + for (i = 0; i < num_options; i++) + { + const char *key = option_defs_us[i].key; + const char *hint = option_defs_us[i].info; + if (hint) + { + // Quick and dirty, its the only consistent naming + // Otherwise GlideN64 Setting keys will need to be broken again.. + if (!!strstr(hint, "(GLideN64)")) + { + option_display_gliden64.key = key; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display_gliden64); + } else if (!!strstr(hint, "(Angrylion)")) + { + option_display_angrylion.key = key; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display_angrylion); + } else if (!!strstr(key, "(ParaLLEl-RDP)")) // Maybe unify it later? + { + option_display_parallel.key = key; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display_glide64); + } else if (!!strstr(key, "(Glide64)")) // Maybe unify it later? + { + option_display_glide64.key = key; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display_parallel); + } + } + } + + return true; +} + static void setup_variables(void) { - struct retro_variable variables[] = { - { "parallel-n64-cpucore", -#ifdef DYNAREC -#if defined(IOS) - "CPU Core; cached_interpreter|pure_interpreter|dynamic_recompiler" }, -#else - "CPU Core; dynamic_recompiler|cached_interpreter|pure_interpreter" }, -#endif -#else - "CPU Core; cached_interpreter|pure_interpreter" }, -#endif - {"parallel-n64-audio-buffer-size", - "Audio Buffer Size (restart); 2048|1024"}, - {"parallel-n64-astick-deadzone", - "Analog Deadzone (percent); 15|20|25|30|0|5|10"}, - {"parallel-n64-astick-sensitivity", - "Analog Sensitivity (percent); 100|105|110|115|120|125|130|135|140|145|150|200|50|55|60|65|70|75|80|85|90|95"}, - {"parallel-n64-pak1", -#ifdef CLASSIC - "Player 1 Pak; memory|rumble|none"}, -#else - "Player 1 Pak; none|memory|rumble"}, -#endif - {"parallel-n64-pak2", - "Player 2 Pak; none|memory|rumble"}, - {"parallel-n64-pak3", - "Player 3 Pak; none|memory|rumble"}, - {"parallel-n64-pak4", - "Player 4 Pak; none|memory|rumble"}, - { "parallel-n64-disable_expmem", - "Enable Expansion Pak RAM; enabled|disabled" }, - { "parallel-n64-gfxplugin-accuracy", -#if defined(IOS) || defined(ANDROID) - "GFX Accuracy (restart); medium|high|veryhigh|low" }, -#else - "GFX Accuracy (restart); veryhigh|high|medium|low" }, -#endif -#ifdef HAVE_PARALLEL - { "parallel-n64-parallel-rdp-synchronous", - "ParaLLEl Synchronous RDP; enabled|disabled" }, - { "parallel-n64-parallel-rdp-overscan", - "(ParaLLEl-RDP) Crop pixel border pixels; 0|2|4|6|8|10|12|14|16|18|20|22|24|26|28|30|32|34|36|38|40|42|44|46|48|50|52|54|56|58|60|62|64" }, - { "parallel-n64-parallel-rdp-divot-filter", - "(ParaLLEl-RDP) VI divot filter; enabled|disabled" }, - { "parallel-n64-parallel-rdp-gamma-dither", - "(ParaLLEl-RDP) VI gamma dither; enabled|disabled" }, - { "parallel-n64-parallel-rdp-vi-aa", - "(ParaLLEl-RDP) VI AA; enabled|disabled" }, - { "parallel-n64-parallel-rdp-vi-bilinear", - "(ParaLLEl-RDP) VI bilinear; enabled|disabled" }, - { "parallel-n64-parallel-rdp-dither-filter", - "(ParaLLEl-RDP) VI dither filter; enabled|disabled" }, - { "parallel-n64-parallel-rdp-upscaling", - "(ParaLLEl-RDP) Upscaling factor (restart); 1x|2x|4x|8x" }, - { "parallel-n64-parallel-rdp-downscaling", - "(ParaLLEl-RDP) Downsampling; disable|1/2|1/4|1/8" }, - { "parallel-n64-parallel-rdp-native-texture-lod", - "(ParaLLEl-RDP) Use native texture LOD when upscaling; disabled|enabled" }, - { "parallel-n64-parallel-rdp-native-tex-rect", - "(ParaLLEl-RDP) Use native resolution for TEX_RECT; enabled|disabled" }, -#endif - { "parallel-n64-send_allist_to_hle_rsp", - "Send audio lists to HLE RSP; disabled|enabled" }, - { "parallel-n64-gfxplugin", - "GFX Plugin; auto" -#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) - "|glide64|gln64|rice" -#endif - "|angrylion" -#ifdef HAVE_PARALLEL - "|parallel" -#endif - }, - { "parallel-n64-rspplugin", - "RSP Plugin; auto" -#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) - "|hle" -#endif - "|cxd4" -#ifdef HAVE_PARALLEL_RSP - "|parallel" -#endif - }, -#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) || defined(HAVE_PARALLEL) - { "parallel-n64-screensize", -#ifdef CLASSIC - "Resolution (restart); 320x240|640x480|960x720|1280x960|1440x1080|1600x1200|1920x1440|2240x1680|2880x2160|5760x4320" }, -#else - "Resolution (restart); 640x480|960x720|1280x960|1440x1080|1600x1200|1920x1440|2240x1680|2880x2160|5760x4320|320x240" }, -#endif - { "parallel-n64-aspectratiohint", - "Aspect ratio hint (reinit); normal|widescreen" }, - { "parallel-n64-filtering", - "(Glide64) Texture Filtering; automatic|N64 3-point|bilinear|nearest" }, - { "parallel-n64-dithering", - "(Angrylion) Dithering; enabled|disabled" }, - { "parallel-n64-polyoffset-factor", - "(Glide64) Polygon Offset Factor; -3.0|-2.5|-2.0|-1.5|-1.0|-0.5|0.0|0.5|1.0|1.5|2.0|2.5|3.0|3.5|4.0|4.5|5.0|-3.5|-4.0|-4.5|-5.0" - }, - { "parallel-n64-polyoffset-units", - "(Glide64) Polygon Offset Units; -3.0|-2.5|-2.0|-1.5|-1.0|-0.5|0.0|0.5|1.0|1.5|2.0|2.5|3.0|3.5|4.0|4.5|5.0|-3.5|-4.0|-4.5|-5.0" - }, -#endif - { "parallel-n64-angrylion-vioverlay", - "(Angrylion) VI Overlay; Filtered|AA+Blur|AA+Dedither|AA only|Unfiltered|Depth|Coverage" - }, - { "parallel-n64-angrylion-sync", - "(Angrylion) Thread sync level; Low|Medium|High" - }, - { "parallel-n64-angrylion-multithread", - "(Angrylion) Multi-threading; all threads|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63" }, - { "parallel-n64-angrylion-overscan", - "(Angrylion) Hide overscan; disabled|enabled" }, - { "parallel-n64-virefresh", - "VI Refresh (Overclock); auto|1500|2200" }, - { "parallel-n64-bufferswap", - "Buffer Swap; disabled|enabled" - }, - { "parallel-n64-framerate", - "Framerate (restart); original|fullspeed" }, - - { "parallel-n64-alt-map", - "Independent C-button Controls; disabled|enabled" }, - -#if defined(HAVE_PARALLEL) || !defined(HAVE_OPENGL) || !defined(HAVE_OPENGLES) - { "parallel-n64-vcache-vbo", - "(Glide64) Vertex cache VBO (restart); disabled|enabled" }, -#endif - { "parallel-n64-boot-device", - "Boot Device; Default|64DD IPL" }, - { "parallel-n64-64dd-hardware", - "64DD Hardware; disabled|enabled" }, - { NULL, NULL }, - }; + bool categoriesSupported = false; + bool updateDisplayCbSupported = false; + struct retro_core_options_update_display_callback updateDisplayCb; static const struct retro_controller_description port[] = { { "Controller", RETRO_DEVICE_JOYPAD }, @@ -483,7 +487,17 @@ static void setup_variables(void) { 0, 0 } }; - environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables); + libretro_set_core_options(environ_cb, &categoriesSupported); + if (categoriesSupported) + CoreOptionCategoriesSupported = 1; + + updateDisplayCb.callback = set_variable_visibility; + updateDisplayCbSupported = environ_cb( + RETRO_ENVIRONMENT_SET_CORE_OPTIONS_UPDATE_DISPLAY_CALLBACK, + &updateDisplayCb); + if (updateDisplayCbSupported) + CoreOptionUpdateDisplayCbSupported = 1; + environ_cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports); environ_cb(RETRO_ENVIRONMENT_SET_SUBSYSTEM_INFO, (void*)subsystems); } @@ -723,9 +737,13 @@ void reinit_gfx_plugin(void) #endif break; case GFX_GLN64: - // TODO: wtf is this -#if defined(HAVE_GLN64) +#ifdef HAVE_GLN64 gles2n64_reset(); +#endif + case GFX_GLIDEN64: + // TODO: wtf is this??? +#ifdef HAVE_GLIDEN64 + /* TODO/FIXME */ #endif break; case GFX_RICE: @@ -759,6 +777,7 @@ void deinit_gfx_plugin(void) parallel_deinit(); #endif case GFX_GLN64: + case GFX_GLIDEN64: glsm_ctl(GLSM_CTL_STATE_CONTEXT_DESTROY, NULL); break; default: @@ -1047,6 +1066,9 @@ void retro_deinit(void) vulkan_inited = false; gl_inited = false; + + CoreOptionCategoriesSupported = 0; + CoreOptionUpdateDisplayCbSupported = 0; } @@ -1091,7 +1113,11 @@ static void gfx_set_filtering(void) #endif break; case GFX_GLN64: -#if defined(HAVE_GLN64) || defined(HAVE_GLIDEN64) +#ifdef HAVE_GLN64 + /* Stub */ +#endif + case GFX_GLIDEN64: +#ifdef HAVE_GLIDEN64 /* Stub */ #endif break; @@ -1129,7 +1155,11 @@ static void gfx_set_dithering(void) case GFX_PARALLEL: break; case GFX_GLN64: -#if defined(HAVE_GLN64) || defined(HAVE_GLIDEN64) +#ifdef HAVE_GLN64 + /* Stub */ +#endif + case GFX_GLIDEN64: +#ifdef HAVE_GLIDEN64 /* Stub */ #endif break; @@ -1281,11 +1311,16 @@ void update_variables(bool startup) if (var.value) { #if defined(HAVE_GLN64) || defined(HAVE_GLIDEN64) || defined(HAVE_RICE) || defined(HAVE_GLIDE64) || defined(HAVE_THR_AL) || defined(HAVE_PARALLEL) + // TODO: This logic seems wrong? if (!strcmp(var.value, "auto")) -#if defined(HAVE_GLN64) || defined(HAVE_GLIDEN64) +#ifdef HAVE_GLN64 if (!strcmp(var.value, "gln64")) gfx_plugin = GFX_GLN64; #endif +#ifdef HAVE_GLIDEN64 + if (!strcmp(var.value, "gliden64")) + gfx_plugin = GFX_GLIDEN64; +#endif #ifdef HAVE_RICE if (!strcmp(var.value, "rice")) gfx_plugin = GFX_RICE; @@ -1638,7 +1673,289 @@ void update_variables(bool startup) } } + var.key = CORE_NAME "-BilinearMode"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + bilinearMode = !strcmp(var.value, "3point") ? 0 : 1; + } + + var.key = CORE_NAME "-FXAA"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + EnableFXAA = atoi(var.value); + } + + var.key = CORE_NAME "-MultiSampling"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + MultiSampling = atoi(var.value); + } + + var.key = CORE_NAME "-EnableLODEmulation"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + EnableLODEmulation = !strcmp(var.value, "False") ? 0 : 1; + } + + var.key = CORE_NAME "-EnableFBEmulation"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + EnableFBEmulation = !strcmp(var.value, "False") ? 0 : 1; + } + + var.key = CORE_NAME "-EnableN64DepthCompare"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + if (!strcmp(var.value, "Compatible")) + EnableN64DepthCompare = 2; // dcCompatible + else if (!strcmp(var.value, "True")) + EnableN64DepthCompare = 1; // dcFast + else + EnableN64DepthCompare = 0; // dcDisable + } + + var.key = CORE_NAME "-EnableCopyColorToRDRAM"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + if (!strcmp(var.value, "TripleBuffer")) + EnableCopyColorToRDRAM = 3; + else if (!strcmp(var.value, "Async")) + EnableCopyColorToRDRAM = 2; + else if (!strcmp(var.value, "Sync")) + EnableCopyColorToRDRAM = 1; + else + EnableCopyColorToRDRAM = 0; + } + + var.key = CORE_NAME "-EnableCopyDepthToRDRAM"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + if (!strcmp(var.value, "Software")) + EnableCopyDepthToRDRAM = 2; + else if (!strcmp(var.value, "FromMem")) + EnableCopyDepthToRDRAM = 1; + else + EnableCopyDepthToRDRAM = 0; + } + + var.key = CORE_NAME "-EnableHWLighting"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + EnableHWLighting = !strcmp(var.value, "False") ? 0 : 1; + } + + var.key = CORE_NAME "-CorrectTexrectCoords"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + if (!strcmp(var.value, "Force")) + CorrectTexrectCoords = 2; + else if (!strcmp(var.value, "Auto")) + CorrectTexrectCoords = 1; + else + CorrectTexrectCoords = 0; + } + + var.key = CORE_NAME "-EnableInaccurateTextureCoordinates"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + EnableInaccurateTextureCoordinates = !strcmp(var.value, "False") ? 0 : 1; + } + + var.key = CORE_NAME "-BackgroundMode"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + BackgroundMode = !strcmp(var.value, "OnePiece") ? 0 : 1; + } + + var.key = CORE_NAME "-EnableNativeResTexrects"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + if(!strcmp(var.value, "False") || !strcmp(var.value, "Disabled")) + { + enableNativeResTexrects = 0; // NativeResTexrectsMode::ntDisable + } + else if(!strcmp(var.value, "Optimized")) + { + enableNativeResTexrects = 1; // NativeResTexrectsMode::ntOptimized + } + else if(!strcmp(var.value, "Unoptimized")) + { + enableNativeResTexrects = 1; // NativeResTexrectsMode::ntUnptimized (Note: upstream typo) + } + } + + var.key = CORE_NAME "-txFilterMode"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + if (!strcmp(var.value, "Smooth filtering 1")) + txFilterMode = 1; + else if (!strcmp(var.value, "Smooth filtering 2")) + txFilterMode = 2; + else if (!strcmp(var.value, "Smooth filtering 3")) + txFilterMode = 3; + else if (!strcmp(var.value, "Smooth filtering 4")) + txFilterMode = 4; + else if (!strcmp(var.value, "Sharp filtering 1")) + txFilterMode = 5; + else if (!strcmp(var.value, "Sharp filtering 2")) + txFilterMode = 6; + else + txFilterMode = 0; + } + + var.key = CORE_NAME "-txEnhancementMode"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + if (!strcmp(var.value, "As Is")) + txEnhancementMode = 1; + else if (!strcmp(var.value, "X2")) + txEnhancementMode = 2; + else if (!strcmp(var.value, "X2SAI")) + txEnhancementMode = 3; + else if (!strcmp(var.value, "HQ2X")) + txEnhancementMode = 4; + else if (!strcmp(var.value, "HQ2XS")) + txEnhancementMode = 5; + else if (!strcmp(var.value, "LQ2X")) + txEnhancementMode = 6; + else if (!strcmp(var.value, "LQ2XS")) + txEnhancementMode = 7; + else if (!strcmp(var.value, "HQ4X")) + txEnhancementMode = 8; + else if (!strcmp(var.value, "2xBRZ")) + txEnhancementMode = 9; + else if (!strcmp(var.value, "3xBRZ")) + txEnhancementMode = 10; + else if (!strcmp(var.value, "4xBRZ")) + txEnhancementMode = 11; + else if (!strcmp(var.value, "5xBRZ")) + txEnhancementMode = 12; + else if (!strcmp(var.value, "6xBRZ")) + txEnhancementMode = 13; + else + txEnhancementMode = 0; + } + + var.key = CORE_NAME "-txFilterIgnoreBG"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + // "Filter background textures; True|False" (true=filter, false=ignore) + txFilterIgnoreBG = !strcmp(var.value, "False") ? 1 : 0; + } + var.key = CORE_NAME "-txHiresEnable"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + txHiresEnable = !strcmp(var.value, "False") ? 0 : 1; + } + + var.key = CORE_NAME "-txCacheCompression"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + EnableTxCacheCompression = !strcmp(var.value, "False") ? 0 : 1; + } + + var.key = CORE_NAME "-txHiresFullAlphaChannel"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + txHiresFullAlphaChannel = !strcmp(var.value, "False") ? 0 : 1; + } + + var.key = CORE_NAME "-EnableLegacyBlending"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + enableLegacyBlending = !strcmp(var.value, "False") ? 0 : 1; + } + + var.key = CORE_NAME "-EnableFragmentDepthWrite"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + EnableFragmentDepthWrite = !strcmp(var.value, "False") ? 0 : 1; + } + + var.key = CORE_NAME "-EnableShadersStorage"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + EnableShadersStorage = !strcmp(var.value, "False") ? 0 : 1; + } + + var.key = CORE_NAME "-EnableTextureCache"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + EnableTextureCache = !strcmp(var.value, "False") ? 0 : 1; + } + + var.key = CORE_NAME "-EnableHiResAltCRC"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + EnableHiResAltCRC = !strcmp(var.value, "False") ? 0 : 1; + } + + var.key = CORE_NAME "-EnableCopyAuxToRDRAM"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + EnableCopyAuxToRDRAM = !strcmp(var.value, "False") ? 0 : 1; + } + + var.key = CORE_NAME "-GLideN64IniBehaviour"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + if (!strcmp(var.value, "late")) + GLideN64IniBehaviour = 0; + else if (!strcmp(var.value, "early")) + GLideN64IniBehaviour = 1; + else if (!strcmp(var.value, "disabled")) + GLideN64IniBehaviour = -1; + } + + var.key = "parallel-n64-aspectratiohint"; + var.value = NULL; + + bool stretch = environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value && 0 == strcmp(var.value, "widescreen"); + + var.key = CORE_NAME "-viewport-hack"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + if (!strcmp(var.value, "enabled")) { + AspectRatio = 3; // Aspect::aAdjust + } else { + AspectRatio = stretch ? 2 : 1; // Aspect::a169 / Aspect::a43 + } + } + + var.key = CORE_NAME "-EnableNativeResFactor"; + var.value = NULL; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + EnableNativeResFactor = atoi(var.value); + } } static void format_saved_memory(void) @@ -1684,6 +2001,7 @@ bool retro_load_game(const struct retro_game_info *game) { case GFX_GLIDE64: case GFX_GLN64: + case GFX_GLIDEN64: case GFX_RICE: gfx_plugin = GFX_PARALLEL; break; @@ -1871,6 +2189,11 @@ void retro_run (void) case GFX_GLN64: #ifdef HAVE_GLN64 /* Stub */ +#endif + break; + case GFX_GLIDEN64: +#ifdef HAVE_GLIDEN64 + /* Stub */ #endif break; case GFX_PARALLEL: @@ -1916,6 +2239,7 @@ void retro_run (void) { case GFX_GLIDE64: case GFX_GLN64: + case GFX_GLIDEN64: case GFX_RICE: #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) glsm_enter(); @@ -1952,6 +2276,7 @@ void retro_run (void) { case GFX_GLIDE64: case GFX_GLN64: + case GFX_GLIDEN64: case GFX_RICE: #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) glsm_exit(); diff --git a/libretro/libretro_core_options.h b/libretro/libretro_core_options.h new file mode 100644 index 000000000..e175c263f --- /dev/null +++ b/libretro/libretro_core_options.h @@ -0,0 +1,1907 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Mupen64plus-Next - libretro_core_options.h * + * Copyright (C) 2020 M4xw * + * * + * This program 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 Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program 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 this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef LIBRETRO_CORE_OPTIONS_H__ +#define LIBRETRO_CORE_OPTIONS_H__ + +#include +#include + +#include +#include + +#define CORE_NAME "parallel-n64" + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define HAVE_NO_LANGEXTRA +struct retro_core_option_v2_category option_cats_us[] = { + { + "input", + "Pak/Controller Options", + "Configure Core Pak/Controller Options." + }, +#ifdef HAVE_PARALLEL + { + "parallel", + "ParaLLEl", + "Configure ParaLLEl Options." + }, +#endif // HAVE_PARALLEL +#ifdef HAVE_THR_AL + { + "angrylion", + "Angrylion", + "Configure Angrylion Options." + }, +#endif // HAVE_THR_AL + { + "gliden64", + "GLideN64", + "Configure GLideN64 Options." + }, + { + "glide64", + "Glide64", + "Configure Glide64 Options." + }, + { NULL, NULL, NULL }, +}; + +struct retro_core_option_v2_definition option_defs_us[] = { + { + CORE_NAME "-cpucore", + "CPU Core", + NULL, + "Select CPU Core", + NULL, + NULL, + { + {"cached_interpreter", "Angrylion"}, + {"pure_interpreter", "ParaLLEl-RDP"}, +#ifdef DYNAREC + {"dynamic_recompiler", "Dynamic Recompiler"}, +#endif + { NULL, NULL }, + }, +#if defined(IOS) + "cached_interpreter" +#else +#ifdef DYNAREC + "dynamic_recompiler" +#else + "cached_interpreter" +#endif +#endif + }, + { + CORE_NAME "-audio-buffer-size", + "Audio Buffer Size", + NULL, + "Audio Buffer Size (restart)", + NULL, + NULL, + { + { "1024", NULL }, + { "2048", NULL }, + { NULL, NULL }, + }, + "2048" + }, + { + CORE_NAME "-astick-deadzone", + "Analog Deadzone", + NULL, + "Analog Deadzone (percent)", + NULL, + NULL, + { + { "0", NULL }, + { "5", NULL }, + { "10", NULL }, + { "15", NULL }, + { "20", NULL }, + { "25", NULL }, + { "30", NULL }, + { NULL, NULL }, + }, + "15" + }, + { + CORE_NAME "-astick-sensitivity", + "Analog Sensitivity", + NULL, + "Analog Sensitivity (percent)", + NULL, + NULL, + { + { "50", NULL }, + { "55", NULL }, + { "60", NULL }, + { "65", NULL }, + { "70", NULL }, + { "75", NULL }, + { "80", NULL }, + { "85", NULL }, + { "90", NULL }, + { "95", NULL }, + { "100", NULL }, + { "105", NULL }, + { "110", NULL }, + { "115", NULL }, + { "120", NULL }, + { "125", NULL }, + { "130", NULL }, + { "135", NULL }, + { "140", NULL }, + { "145", NULL }, + { "150", NULL }, + { "200", NULL }, + { NULL, NULL }, + }, + "100" + }, + { + CORE_NAME "-pak1", + "Player 1 Pak", + NULL, + "Player 1 Pak", + NULL, + NULL, + { + { "none", NULL }, + { "memory", NULL }, + { "rumble", NULL }, + { NULL, NULL }, + }, + "none" + }, + { + CORE_NAME "-pak2", + "Player 2 Pak", + NULL, + "Player 2 Pak", + NULL, + NULL, + { + { "none", NULL }, + { "memory", NULL }, + { "rumble", NULL }, + { NULL, NULL }, + }, + "none" + }, + { + CORE_NAME "-pak3", + "Player 3 Pak", + NULL, + "Player 3 Pak", + NULL, + NULL, + { + { "none", NULL }, + { "memory", NULL }, + { "rumble", NULL }, + { NULL, NULL }, + }, + "none" + }, + { + CORE_NAME "-pak4", + "Player 4 Pak", + NULL, + "Player 4 Pak", + NULL, + NULL, + { + { "none", NULL }, + { "memory", NULL }, + { "rumble", NULL }, + { NULL, NULL }, + }, + "none" + }, + { + CORE_NAME "-disable_expmem", + "Enable Expansion Pak RAM", + NULL, + "Enable Expansion Pak RAM", + NULL, + NULL, + { + { "enabled", NULL }, + { "disabled", NULL }, + { NULL, NULL }, + }, + "enabled" + }, + { + CORE_NAME "-gfxplugin-accuracy", + "GFX Accuracy", + NULL, + "GFX Accuracy, required restart", + NULL, + NULL, + { + { "low", NULL }, + { "medium", NULL }, + { "high", NULL }, + { "veryhigh", NULL }, + { NULL, NULL }, + }, +#if defined(IOS) || defined(ANDROID) + "medium" +#else + "veryhigh" +#endif + }, +#ifdef HAVE_PARALLEL + { + CORE_NAME "-parallel-rdp-synchronous", + "ParaLLEl Synchronous RDP", + NULL, + "ParaLLEl Synchronous RDP", + NULL, + NULL, + { + { "enabled", NULL }, + { "disabled", NULL }, + { NULL, NULL }, + }, + "enabled" + }, + { + CORE_NAME "-parallel-rdp-overscan", + "(ParaLLEl-RDP) Crop pixel border pixels", + NULL, + "Crop pixel border pixels", + NULL, + "parallel", + { + { "0", NULL }, + { "2", NULL }, + { "4", NULL }, + { "6", NULL }, + { "8", NULL }, + { "10", NULL }, + { "12", NULL }, + { "14", NULL }, + { "16", NULL }, + { "18", NULL }, + { "20", NULL }, + { "22", NULL }, + { "24", NULL }, + { "26", NULL }, + { "28", NULL }, + { "30", NULL }, + { "32", NULL }, + { "34", NULL }, + { "36", NULL }, + { "38", NULL }, + { "40", NULL }, + { "42", NULL }, + { "44", NULL }, + { "46", NULL }, + { "48", NULL }, + { "50", NULL }, + { "52", NULL }, + { "54", NULL }, + { "56", NULL }, + { "58", NULL }, + { "60", NULL }, + { "62", NULL }, + { "64", NULL }, + { NULL, NULL }, + }, + "0" + }, + { + CORE_NAME "-parallel-rdp-divot-filter", + "(ParaLLEl-RDP) VI divot filter", + NULL, + "VI divot filter", + NULL, + "parallel", + { + { "enabled", NULL }, + { "disabled", NULL }, + { NULL, NULL }, + }, + "enabled" + }, + { + CORE_NAME "-parallel-rdp-gamma-dither", + "(ParaLLEl-RDP) VI gamma dither", + NULL, + "VI gamma dither", + NULL, + "parallel", + { + { "enabled", NULL }, + { "disabled", NULL }, + { NULL, NULL }, + }, + "enabled" + }, + { + CORE_NAME "-parallel-rdp-vi-aa", + "(ParaLLEl-RDP) VI AA", + NULL, + "VI AntiAliasing", + NULL, + "parallel", + { + { "enabled", NULL }, + { "disabled", NULL }, + { NULL, NULL }, + }, + "enabled" + }, + { + CORE_NAME "-parallel-rdp-vi-bilinear", + "(ParaLLEl-RDP) VI bilinear", + NULL, + "VI bilinear filtering", + NULL, + "parallel", + { + { "enabled", NULL }, + { "disabled", NULL }, + { NULL, NULL }, + }, + "enabled" + }, + { + CORE_NAME "-parallel-rdp-dither-filter", + "(ParaLLEl-RDP) VI dither filter", + NULL, + "VI dither filter", + NULL, + "parallel", + { + { "enabled", NULL }, + { "disabled", NULL }, + { NULL, NULL }, + }, + "enabled" + }, + { + CORE_NAME "-parallel-rdp-upscaling", + "(ParaLLEl-RDP) Upscaling factor (restart)", + NULL, + "Upscaling factor (restart)", + NULL, + "parallel", + { + { "1x", NULL }, + { "2x", NULL }, + { "4x", NULL }, + { "8x", NULL }, + { NULL, NULL }, + }, + "1x" + }, + { + CORE_NAME "-parallel-rdp-downscaling", + "(ParaLLEl-RDP) Downsampling", + NULL, + "Downsampling", + NULL, + "parallel", + { + { "disable", NULL }, + { "1/2", NULL }, + { "1/4", NULL }, + { "1/8", NULL }, + { NULL, NULL }, + }, + "disable" + }, + { + CORE_NAME "-parallel-rdp-native-texture-lod", + "(ParaLLEl-RDP) Use native texture LOD when upscaling", + NULL, + "Use native texture LOD when upscaling", + NULL, + "parallel", + { + { "enabled", NULL }, + { "disabled", NULL }, + { NULL, NULL }, + }, + "disabled" + }, + { + CORE_NAME "-parallel-rdp-native-tex-rect", + "(ParaLLEl-RDP) Use native resolution for TEX_RECT", + NULL, + "Use native resolution for TEX_RECT", + NULL, + "parallel", + { + { "enabled", NULL }, + { "disabled", NULL }, + { NULL, NULL }, + }, + "enabled" + }, +#endif + + { + CORE_NAME "-send_allist_to_hle_rsp", + "Send audio lists to HLE RSP", + NULL, + "Send audio lists to HLE RSP", + NULL, + NULL, + { + { "enabled", NULL }, + { "disabled", NULL }, + { NULL, NULL }, + }, + "disabled" + }, + { + CORE_NAME "-gfxplugin", + "GFX Plugin", + NULL, + "Graphics plugin", + NULL, + NULL, + { +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) + { "gliden64", NULL }, + { "glide64", NULL }, + { "gln64", NULL }, + { "rice", NULL }, +#endif + { "angrylion", NULL }, +#ifdef HAVE_PARALLEL + { "parallel", NULL }, +#endif + { NULL, NULL }, + }, +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) + "gliden64" +#else + "angrylion" +#endif + }, + { + CORE_NAME "-rspplugin", + "RSP Plugin", + NULL, + "RSP Plugin", + NULL, + NULL, + { + { "auto", NULL }, +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) + { "hle", NULL }, +#endif + { "cxd4", NULL }, +#ifdef HAVE_PARALLEL_RSP + { "parallel", NULL }, +#endif + { NULL, NULL }, + }, + "auto" + }, +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) || defined(HAVE_PARALLEL) + { + CORE_NAME "-screensize", + "Resolution", + NULL, + "Resolution (restart)", + NULL, + NULL, + { + { "320x240", NULL }, + { "640x480", NULL }, + { "960x720", NULL }, + { "1280x960", NULL }, + { "1440x1080", NULL }, + { "1600x1200", NULL }, + { "1920x1440", NULL }, + { "2240x1680", NULL }, + { "2880x2160", NULL }, + { "5760x4320", NULL }, + { NULL, NULL }, + }, +#ifdef CLASSIC + "320x240" +#else + "640x480" +#endif + }, + { + CORE_NAME "-aspectratiohint", + "Aspect ratio hint", + NULL, + "Aspect ratio hint (reinit)", + NULL, + NULL, + { + { "normal", NULL }, + { "widescreen", NULL }, + { NULL, NULL }, + }, + "normal" + }, + { + CORE_NAME "-filtering", + "(Glide64) Texture Filtering", + NULL, + "Texture Filtering", + NULL, + "glide64", + { + { "automatic", NULL }, + { "N64 3-point", NULL }, + { "bilinear", NULL }, + { "nearest", NULL }, + { NULL, NULL }, + }, + "automatic" + }, + { + CORE_NAME "-dithering", + "(Angrylion) Dithering", + NULL, + "Dithering", + NULL, + "angrylion", + { + { "enabled", NULL }, + { "disabled", NULL }, + { NULL, NULL }, + }, + "enabled" + }, + { + CORE_NAME "-polyoffset-factor", + "(Glide64) Polygon Offset Factor", + NULL, + "Polygon Offset Factor", + NULL, + "glide64", + { + { "-5.0", NULL }, + { "-4.5", NULL }, + { "-4.0", NULL }, + { "-3.5", NULL }, + { "-3.0", NULL }, + { "-2.5", NULL }, + { "-2.0", NULL }, + { "-1.5", NULL }, + { "-1.0", NULL }, + { "-0.5", NULL }, + { "0.0", NULL }, + { "0.5", NULL }, + { "1.0", NULL }, + { "1.5", NULL }, + { "2.0", NULL }, + { "2.5", NULL }, + { "3.0", NULL }, + { "3.5", NULL }, + { "4.0", NULL }, + { "4.5", NULL }, + { "5.0", NULL }, + { NULL, NULL }, + }, + "-3.0" + }, + { + CORE_NAME "-polyoffset-units", + "(Glide64) Polygon Offset Units", + NULL, + "Polygon Offset Units", + NULL, + "glide64", + { + { "-5.0", NULL }, + { "-4.5", NULL }, + { "-4.0", NULL }, + { "-3.5", NULL }, + { "-3.0", NULL }, + { "-2.5", NULL }, + { "-2.0", NULL }, + { "-1.5", NULL }, + { "-1.0", NULL }, + { "-0.5", NULL }, + { "0.0", NULL }, + { "0.5", NULL }, + { "1.0", NULL }, + { "1.5", NULL }, + { "2.0", NULL }, + { "2.5", NULL }, + { "3.0", NULL }, + { "3.5", NULL }, + { "4.0", NULL }, + { "4.5", NULL }, + { "5.0", NULL }, + { NULL, NULL }, + }, + "-3.0" + }, +#endif + { + CORE_NAME "-angrylion-vioverlay", + "(Angrylion) VI Overlay", + NULL, + "VI Overlay", + NULL, + "angrylion", + { + { "Filtered", NULL }, + { "AA+Blur", NULL }, + { "AA+Dedither", NULL }, + { "AA only", NULL }, + { "Unfiltered", NULL }, + { "Depth", NULL }, + { "Coverage", NULL }, + { NULL, NULL }, + }, + "Filtered" + }, + { + CORE_NAME "-angrylion-sync", + "(Angrylion) Thread sync level", + NULL, + "Thread sync level", + NULL, + "angrylion", + { + { "Low", NULL }, + { "Medium", NULL }, + { "High", NULL }, + { NULL, NULL }, + }, + "Low" + }, + { + CORE_NAME "-angrylion-multithread", + "(Angrylion) Multi-threading", + NULL, + "Multi-threading", + NULL, + "angrylion", + { + { "all threads", NULL }, + { "1", NULL }, + { "2", NULL }, + { "3", NULL }, + { "4", NULL }, + { "5", NULL }, + { "6", NULL }, + { "7", NULL }, + { "8", NULL }, + { "9", NULL }, + { "10", NULL }, + { "11", NULL }, + { "12", NULL }, + { "13", NULL }, + { "14", NULL }, + { "15", NULL }, + { "16", NULL }, + { "17", NULL }, + { "18", NULL }, + { "19", NULL }, + { "20", NULL }, + { "21", NULL }, + { "22", NULL }, + { "23", NULL }, + { "24", NULL }, + { "25", NULL }, + { "26", NULL }, + { "27", NULL }, + { "28", NULL }, + { "29", NULL }, + { "30", NULL }, + { "31", NULL }, + { "32", NULL }, + { "33", NULL }, + { "34", NULL }, + { "35", NULL }, + { "36", NULL }, + { "37", NULL }, + { "38", NULL }, + { "39", NULL }, + { "40", NULL }, + { "41", NULL }, + { "42", NULL }, + { "43", NULL }, + { "44", NULL }, + { "45", NULL }, + { "46", NULL }, + { "47", NULL }, + { "48", NULL }, + { "49", NULL }, + { "50", NULL }, + { "51", NULL }, + { "52", NULL }, + { "53", NULL }, + { "54", NULL }, + { "55", NULL }, + { "56", NULL }, + { "57", NULL }, + { "58", NULL }, + { "59", NULL }, + { "60", NULL }, + { "61", NULL }, + { "62", NULL }, + { "63", NULL }, + { NULL, NULL }, + }, + "all threads" + }, + { + CORE_NAME "-angrylion-overscan", + "(Angrylion) Hide overscan", + NULL, + "Hide overscan", + NULL, + "angrylion", + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL }, + }, + "disabled" + }, + { + CORE_NAME "-virefresh", + "VI Refresh (Overclock)", + NULL, + "VI Refresh", + NULL, + NULL, + { + { "auto", NULL }, + { "1500", NULL }, + { "2200", NULL }, + { NULL, NULL }, + }, + "auto" + }, + { + CORE_NAME "-bufferswap", + "Buffer Swap", + NULL, + "Buffer Swap", + NULL, + NULL, + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL }, + }, + "disabled" + }, + { + CORE_NAME "-framerate", + "Framerate (restart)", + NULL, + "Framerate (restart)", + NULL, + NULL, + { + { "original", NULL }, + { "fullspeed", NULL }, + { NULL, NULL }, + }, + "original" + }, + { + CORE_NAME "-alt-map", + "Independent C-button Controls", + NULL, + "Independent C-button Controls", + NULL, + NULL, + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL }, + }, + "disabled" + }, +#if defined(HAVE_PARALLEL) || !defined(HAVE_OPENGL) || !defined(HAVE_OPENGLES) + { + CORE_NAME "-vcache-vbo", + "(Glide64) Vertex cache VBO", + NULL, + "Vertex cache VBO (restart)", + NULL, + "glide64", + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL }, + }, + "disabled" + }, +#endif + { + CORE_NAME "-boot-device", + "Boot Device", + NULL, + "Boot Device", + NULL, + NULL, + { + { "Default", NULL }, + { "64DD IPL", NULL }, + { NULL, NULL }, + }, + "Default" + }, + { + CORE_NAME "-64dd-hardware", + "64DD Hardware", + NULL, + "64DD Hardware", + NULL, + NULL, + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL }, + }, + "disabled" + }, + { + CORE_NAME "-gliden64-viewport-hack", + "Widescreen Hack", + NULL, + "(GLideN64) Hack that adjusts the viewport to allow unstretched 16:9", + "Hack that adjusts the viewport to allow unstretched 16:9", + "gliden64", + { + {"enabled", NULL }, + {"disabled", NULL}, + { NULL, NULL }, + }, + "disabled" + }, + { + CORE_NAME "-gliden64-EnableNativeResFactor", + "Native Resolution Factor", + NULL, + "(GLideN64) Render at N times the native resolution.", + "Render at N times the native resolution.", + "gliden64", + { + {"0", "Disabled"}, + {"1", "1x"}, + {"2", "2x"}, + {"3", "3x"}, + {"4", "4x"}, + {"5", "5x"}, + {"6", "6x"}, + {"7", "7x"}, + {"8", "8x"}, + { NULL, NULL }, + }, + "0" + }, + { + CORE_NAME "-gliden64-BilinearMode", + "Bilinear filtering mode", + NULL, + "(GLideN64) Select a Bilinear filtering method, 3point is the original system specific way.", + "Select a Bilinear filtering method, 3point is the original system specific way.", + "gliden64", + { + {"3point", NULL}, + {"standard", NULL}, + { NULL, NULL }, + }, + "standard" + }, +#ifndef HAVE_OPENGLES2 + { + CORE_NAME "-gliden64-MultiSampling", + "MSAA level", + NULL, + "(GLideN64) Anti-Aliasing level (0 = disabled).", + "Anti-Aliasing level (0 = disabled).", + "gliden64", + { + {"0", NULL}, + {"2", NULL}, + {"4", NULL}, + {"8", NULL}, + {"16", NULL}, + { NULL, NULL }, + }, + "0" + }, +#endif + { + CORE_NAME "-gliden64-FXAA", + "FXAA", + NULL, + "(GLideN64) Fast Approximate Anti-Aliasing shader, moderately blur textures (0 = disabled).", + "Fast Approximate Anti-Aliasing shader, moderately blur textures (0 = disabled).", + "gliden64", + { + {"0", NULL}, + {"1", NULL}, + { NULL, NULL }, + }, + "0" + }, + { + CORE_NAME "-gliden64-EnableLODEmulation", + "LOD Emulation", + NULL, + "(GLideN64) Calculate per-pixel Level Of Details to select texture mip levels and blend them with each other using LOD fraction.", + "Calculate per-pixel Level Of Details to select texture mip levels and blend them with each other using LOD fraction.", + "gliden64", + { + {"False", NULL}, + {"True", NULL}, + { NULL, NULL }, + }, + "True" + }, + { + CORE_NAME "-gliden64-EnableFBEmulation", + "Framebuffer Emulation", + NULL, + "(GLideN64) Frame/depth buffer emulation. Disabling it can shorten input lag for particular games, but also break some special effects.", + "Frame/depth buffer emulation. Disabling it can shorten input lag for particular games, but also break some special effects.", + "gliden64", + { + {"False", NULL}, + {"True", NULL}, + { NULL, NULL }, + }, +#ifndef VC + "True" +#else + "False" +#endif // VC + }, + { + CORE_NAME "-gliden64-EnableCopyAuxToRDRAM", + "Copy auxiliary buffers to RDRAM", + NULL, + "(GLideN64) Copy auxiliary buffers to RDRAM (fixes some Game artifacts like Paper Mario Intro).", + "Copy auxiliary buffers to RDRAM (fixes some Game artifacts like Paper Mario Intro).", + "gliden64", + { + {"False", NULL}, + {"True", NULL}, + { NULL, NULL }, + }, + "False", + }, + { + CORE_NAME "-gliden64-EnableCopyColorToRDRAM", + "Color buffer to RDRAM", + NULL, + "(GLideN64) Color buffer copy to RDRAM (Off will trade compatibility for Performance).", + "Color buffer copy to RDRAM (Off will trade compatibility for Performance).", + "gliden64", + { + {"Off", NULL}, + {"Sync", NULL}, +#ifndef HAVE_OPENGLES2 + {"Async", "DoubleBuffer"}, + {"TripleBuffer", "TripleBuffer"}, +#endif // HAVE_OPENGLES2 + { NULL, NULL }, + }, +#ifndef HAVE_OPENGLES2 + "Async" +#else + "Sync" +#endif // HAVE_OPENGLES2 + }, + { + CORE_NAME "-gliden64-EnableCopyDepthToRDRAM", + "Depth buffer to RDRAM", + NULL, + "(GLideN64) Depth buffer copy to RDRAM (Off will trade compatibility for Performance).", + "Depth buffer copy to RDRAM (Off will trade compatibility for Performance).", + "gliden64", + { + {"Off", NULL}, + {"Software", NULL}, + {"FromMem", NULL}, + { NULL, NULL }, + }, + "Software" + }, + { + CORE_NAME "-gliden64-BackgroundMode", + "Background Mode", + NULL, + "(GLideN64) Render backgrounds mode (HLE only). One piece (fast), Stripped (precise).", + "Render backgrounds mode (HLE only). One piece (fast), Stripped (precise).", + "gliden64", + { + {"Stripped", NULL}, + {"OnePiece", NULL}, + { NULL, NULL }, + }, + "OnePiece" + }, + { + CORE_NAME "-gliden64-EnableHWLighting", + "Hardware per-pixel lighting", + NULL, + "(GLideN64) Standard per-vertex lighting when disabled. Slightly different rendering.", + "Standard per-vertex lighting when disabled. Slightly different rendering.", + "gliden64", + { + {"False", NULL}, + {"True", NULL}, + { NULL, NULL }, + }, + "False" + }, + { + CORE_NAME "-gliden64-CorrectTexrectCoords", + "Continuous texrect coords", + NULL, + "(GLideN64) Make texrect coordinates continuous to avoid black lines between them.", + "Make texrect coordinates continuous to avoid black lines between them.", + "gliden64", + { + {"Off", NULL}, + {"Auto", NULL}, + {"Force", NULL}, + { NULL, NULL }, + }, + "Off" + }, + { + CORE_NAME "-gliden64-EnableInaccurateTextureCoordinates", + "Enable inaccurate texture coordinates", + NULL, + "(GLideN64) Enables inaccurate texture coordinate calculations. This can improve performance and texture pack compatibity at the cost of accuracy.", + "Enables inaccurate texture coordinate calculations. This can improve performance and texture pack compatibity at the cost of accuracy.", + "gliden64", + { + {"False", NULL}, + {"True", NULL}, + { NULL, NULL }, + }, + "False" + }, + { + CORE_NAME "-gliden64-EnableNativeResTexrects", + "Native res. 2D texrects", + NULL, + "(GLideN64) Render 2D texrects in native resolution to fix misalignment between parts of 2D image (example: Mario Kart driver selection portraits).", + "Render 2D texrects in native resolution to fix misalignment between parts of 2D image (example: Mario Kart driver selection portraits).", + "gliden64", + { + {"Disabled", NULL}, + {"Unoptimized", NULL}, + {"Optimized", NULL}, + { NULL, NULL }, + }, + "Disabled" + }, + { + CORE_NAME "-gliden64-EnableLegacyBlending", + "Less accurate blending mode", + NULL, + "(GLideN64) Do not use shaders to emulate N64 blending modes. Works faster on slow GPU. Can cause glitches.", + "Do not use shaders to emulate N64 blending modes. Works faster on slow GPU. Can cause glitches.", + "gliden64", + { + {"False", NULL}, + {"True", NULL}, + { NULL, NULL }, + }, +#ifdef HAVE_OPENGLES + "True" +#else + "False" +#endif + }, + { + CORE_NAME "-gliden64-EnableFragmentDepthWrite", + "GPU shader depth write", + NULL, + "(GLideN64) Enable writing of fragment depth. Some mobile GPUs do not support it, thus it's optional. Leave enabled.", + "Enable writing of fragment depth. Some mobile GPUs do not support it, thus it's optional. Leave enabled.", + "gliden64", + { + {"False", NULL}, + {"True", NULL}, + { NULL, NULL }, + }, +#ifdef HAVE_OPENGLES + "False" +#else + "True" +#endif + }, +#if !defined(VC) && !defined(HAVE_OPENGLES) + { + CORE_NAME "-gliden64-EnableN64DepthCompare", + "N64 Depth Compare", + NULL, + "(GLideN64) Enable N64 depth compare instead of OpenGL standard one. Experimental, Fast mode will have more glitches.", + "Enable N64 depth compare instead of OpenGL standard one. Experimental, Fast mode will have more glitches.", + "gliden64", + { + {"False", "Off"}, + {"True", "Fast"}, + {"Compatible", NULL}, + }, + "False" + }, + { + CORE_NAME "-gliden64-EnableShadersStorage", + "Cache GPU Shaders", + NULL, + "(GLideN64) Use persistent storage for compiled shaders.", + "Use persistent storage for compiled shaders.", + "gliden64", + { + {"False", NULL}, + {"True", NULL}, + { NULL, NULL }, + }, + "True" + }, +#endif + { + CORE_NAME "-gliden64-EnableTextureCache", + "Cache Textures", + NULL, + "(GLideN64) Save texture cache to hard disk.", + "Save texture cache to hard disk.", + "gliden64", + { + {"False", NULL}, + {"True", NULL}, + { NULL, NULL }, + }, + "True" + }, + { + CORE_NAME "-gliden64-EnableOverscan", + "Overscan", + NULL, + "(GLideN64) Crop black borders from the overscan region around the screen.", + "Crop black borders from the overscan region around the screen.", + "gliden64", + { + {"Disabled", NULL}, + {"Enabled", NULL}, + { NULL, NULL }, + }, + "Enabled" + }, + { + CORE_NAME "-gliden64-OverscanTop", + "Overscan Offset (Top)", + NULL, + "(GLideN64) Overscan Top Offset.", + "Overscan Top Offset.", + "gliden64", + { + {"0", NULL}, + {"1", NULL}, + {"2", NULL}, + {"3", NULL}, + {"4", NULL}, + {"5", NULL}, + {"6", NULL}, + {"7", NULL}, + {"8", NULL}, + {"9", NULL}, + {"10", NULL}, + {"11", NULL}, + {"12", NULL}, + {"13", NULL}, + {"14", NULL}, + {"15", NULL}, + {"16", NULL}, + {"17", NULL}, + {"18", NULL}, + {"19", NULL}, + {"20", NULL}, + {"21", NULL}, + {"22", NULL}, + {"23", NULL}, + {"24", NULL}, + {"25", NULL}, + {"26", NULL}, + {"27", NULL}, + {"28", NULL}, + {"29", NULL}, + {"30", NULL}, + {"31", NULL}, + {"32", NULL}, + {"33", NULL}, + {"34", NULL}, + {"35", NULL}, + {"36", NULL}, + {"37", NULL}, + {"38", NULL}, + {"39", NULL}, + {"40", NULL}, + {"41", NULL}, + {"42", NULL}, + {"43", NULL}, + {"44", NULL}, + {"45", NULL}, + {"46", NULL}, + {"47", NULL}, + {"48", NULL}, + {"49", NULL}, + {"50", NULL}, + { NULL, NULL }, + }, + "0" + }, + { + CORE_NAME "-gliden64-OverscanLeft", + "Overscan Offset (Left)", + NULL, + "(GLideN64) Overscan Left Offset.", + "Overscan Left Offset.", + "gliden64", + { + {"0", NULL}, + {"1", NULL}, + {"2", NULL}, + {"3", NULL}, + {"4", NULL}, + {"5", NULL}, + {"6", NULL}, + {"7", NULL}, + {"8", NULL}, + {"9", NULL}, + {"10", NULL}, + {"11", NULL}, + {"12", NULL}, + {"13", NULL}, + {"14", NULL}, + {"15", NULL}, + {"16", NULL}, + {"17", NULL}, + {"18", NULL}, + {"19", NULL}, + {"20", NULL}, + {"21", NULL}, + {"22", NULL}, + {"23", NULL}, + {"24", NULL}, + {"25", NULL}, + {"26", NULL}, + {"27", NULL}, + {"28", NULL}, + {"29", NULL}, + {"30", NULL}, + {"31", NULL}, + {"32", NULL}, + {"33", NULL}, + {"34", NULL}, + {"35", NULL}, + {"36", NULL}, + {"37", NULL}, + {"38", NULL}, + {"39", NULL}, + {"40", NULL}, + {"41", NULL}, + {"42", NULL}, + {"43", NULL}, + {"44", NULL}, + {"45", NULL}, + {"46", NULL}, + {"47", NULL}, + {"48", NULL}, + {"49", NULL}, + {"50", NULL}, + { NULL, NULL }, + }, + "0" + }, + { + CORE_NAME "-gliden64-OverscanRight", + "Overscan Offset (Right)", + NULL, + "(GLideN64) Overscan Right Offset.", + "Overscan Right Offset.", + "gliden64", + { + {"0", NULL}, + {"1", NULL}, + {"2", NULL}, + {"3", NULL}, + {"4", NULL}, + {"5", NULL}, + {"6", NULL}, + {"7", NULL}, + {"8", NULL}, + {"9", NULL}, + {"10", NULL}, + {"11", NULL}, + {"12", NULL}, + {"13", NULL}, + {"14", NULL}, + {"15", NULL}, + {"16", NULL}, + {"17", NULL}, + {"18", NULL}, + {"19", NULL}, + {"20", NULL}, + {"21", NULL}, + {"22", NULL}, + {"23", NULL}, + {"24", NULL}, + {"25", NULL}, + {"26", NULL}, + {"27", NULL}, + {"28", NULL}, + {"29", NULL}, + {"30", NULL}, + {"31", NULL}, + {"32", NULL}, + {"33", NULL}, + {"34", NULL}, + {"35", NULL}, + {"36", NULL}, + {"37", NULL}, + {"38", NULL}, + {"39", NULL}, + {"40", NULL}, + {"41", NULL}, + {"42", NULL}, + {"43", NULL}, + {"44", NULL}, + {"45", NULL}, + {"46", NULL}, + {"47", NULL}, + {"48", NULL}, + {"49", NULL}, + {"50", NULL}, + { NULL, NULL }, + }, + "0" + }, + { + CORE_NAME "-gliden64-OverscanBottom", + "Overscan Offset (Bottom)", + NULL, + "(GLideN64) Overscan Bottom Offset.", + "Overscan Bottom Offset.", + "gliden64", + { + {"0", NULL}, + {"1", NULL}, + {"2", NULL}, + {"3", NULL}, + {"4", NULL}, + {"5", NULL}, + {"6", NULL}, + {"7", NULL}, + {"8", NULL}, + {"9", NULL}, + {"10", NULL}, + {"11", NULL}, + {"12", NULL}, + {"13", NULL}, + {"14", NULL}, + {"15", NULL}, + {"16", NULL}, + {"17", NULL}, + {"18", NULL}, + {"19", NULL}, + {"20", NULL}, + {"21", NULL}, + {"22", NULL}, + {"23", NULL}, + {"24", NULL}, + {"25", NULL}, + {"26", NULL}, + {"27", NULL}, + {"28", NULL}, + {"29", NULL}, + {"30", NULL}, + {"31", NULL}, + {"32", NULL}, + {"33", NULL}, + {"34", NULL}, + {"35", NULL}, + {"36", NULL}, + {"37", NULL}, + {"38", NULL}, + {"39", NULL}, + {"40", NULL}, + {"41", NULL}, + {"42", NULL}, + {"43", NULL}, + {"44", NULL}, + {"45", NULL}, + {"46", NULL}, + {"47", NULL}, + {"48", NULL}, + {"49", NULL}, + {"50", NULL}, + { NULL, NULL }, + }, + "0" + }, + { + CORE_NAME "-gliden64-txFilterMode", + "Texture filter", + NULL, + "(GLideN64) Select Texture Filtering mode.", + "Select Texture Filtering mode.", + "gliden64", + { + {"None", NULL}, + {"Smooth filtering 1", NULL}, + {"Smooth filtering 2", NULL}, + {"Smooth filtering 3", NULL}, + {"Smooth filtering 4", NULL}, + {"Sharp filtering 1", NULL}, + {"Sharp filtering 2", NULL}, + { NULL, NULL }, + }, + "None" + }, + { + CORE_NAME "-gliden64-txEnhancementMode", + "Texture Enhancement", + NULL, + "(GLideN64) Various Texture Filters ('As-Is' will just cache).", + "Various Texture Filters ('As-Is' will just cache).", + "gliden64", + { + {"None", NULL}, + {"As Is", NULL}, + {"X2", NULL}, + {"X2SAI", NULL}, + {"HQ2X", NULL}, + {"HQ2XS", NULL}, + {"LQ2X", NULL}, + {"LQ2XS", NULL}, + {"HQ4X", NULL}, + {"2xBRZ", NULL}, + {"3xBRZ", NULL}, + {"4xBRZ", NULL}, + {"5xBRZ", NULL}, + {"6xBRZ", NULL}, + { NULL, NULL }, + }, + "None" + }, + { + CORE_NAME "-gliden64-txFilterIgnoreBG", + "Don't filter background textures", + NULL, + "(GLideN64) Ignore filtering for Background Textures.", + "Ignore filtering for Background Textures.", + "gliden64", + { + {"False", NULL}, + {"True", NULL}, + { NULL, NULL }, + }, + "True" + }, + { + CORE_NAME "-gliden64-txHiresEnable", + "Use High-Res textures", + NULL, + "(GLideN64) Enable High-Res Texture packs if available.", + "Enable High-Res Texture packs if available.", + "gliden64", + { + {"False", NULL}, + {"True", NULL}, + { NULL, NULL }, + }, + "False" + }, + { + CORE_NAME "-gliden64-txCacheCompression", + "Use High-Res Texture Cache Compression", + NULL, + "(GLideN64) Compress created texture caches.", + "Compress created texture caches.", + "gliden64", + { + {"False", NULL}, + {"True", NULL}, + { NULL, NULL }, + }, + "True" + }, + { + CORE_NAME "-gliden64-txHiresFullAlphaChannel", + "Use High-Res Full Alpha Channel", + NULL, + "(GLideN64) This should be enabled unless it's a old RICE Texture pack.", + "This should be enabled unless it's a old RICE Texture pack.", + "gliden64", + { + {"False", NULL}, + {"True", NULL}, + { NULL, NULL }, + }, + "False" + }, + { + CORE_NAME "-gliden64-EnableHiResAltCRC", + "Use alternative method for High-Res Checksums", + NULL, + "(GLideN64) Use an alternative method for High-Res paletted textures CRC calculations.", + "Use an alternative method for High-Res paletted textures CRC calculations.", + "gliden64", + { + {"False", NULL}, + {"True", NULL}, + { NULL, NULL }, + }, + "False" + }, + { + CORE_NAME "-gliden64-IniBehaviour", + "INI Behaviour", + NULL, + "(GLideN64) Specifies INI Settings behaviour. This should really only contain essential options. Changing this can and will break ROM's, if the correct options aren't set manually. Some options may only be set via INI (fbInfoDisabled).", + "Specifies INI Settings behaviour. This should really only contain essential options. Changing this can and will break ROM's, if the correct options aren't set manually. Some options may only be set via INI (fbInfoDisabled).", + "gliden64", + { + {"late", "Prioritize INI over Core Options"}, + {"early", "Prioritize Core Options over INI"}, + {"disabled", "Disable INI"}, + { NULL, NULL }, + }, + "late" + }, + { + CORE_NAME "-gliden64-LegacySm64ToolsHacks", + "Patch SM64 Hacks made with SM64 Editor", + NULL, + "(GLideN64) Make plugin behave like Jabo in certain case to fix compatibility with legacy SM64 hacks. It adds undocumented behavior that may interfere with real N64 games (unlikely).", + "Make plugin behave like Jabo in certain case to fix compatibility with legacy SM64 hacks. It adds undocumented behavior that may interfere with real N64 games (unlikely).", + "gliden64", + { + {"enabled", NULL}, + {"disabled", NULL}, + { NULL, NULL }, + }, + "enabled" + }, + { NULL, NULL, NULL, NULL, NULL, NULL, {{0}}, NULL }, +}; + +struct retro_core_options_v2 options_us = { + option_cats_us, + option_defs_us +}; + +struct retro_core_options_v2 *option_defs_intl[RETRO_LANGUAGE_LAST] = { + &options_us, /* RETRO_LANGUAGE_ENGLISH */ + NULL, /* RETRO_LANGUAGE_JAPANESE */ + NULL, /* RETRO_LANGUAGE_FRENCH */ + NULL, /* RETRO_LANGUAGE_SPANISH */ + NULL, /* RETRO_LANGUAGE_GERMAN */ + NULL, /* RETRO_LANGUAGE_ITALIAN */ + NULL, /* RETRO_LANGUAGE_DUTCH */ + NULL, /* RETRO_LANGUAGE_PORTUGUESE_BRAZIL */ + NULL, /* RETRO_LANGUAGE_PORTUGUESE_PORTUGAL */ + NULL, /* RETRO_LANGUAGE_RUSSIAN */ + NULL, /* RETRO_LANGUAGE_KOREAN */ + NULL, /* RETRO_LANGUAGE_CHINESE_TRADITIONAL */ + NULL, /* RETRO_LANGUAGE_CHINESE_SIMPLIFIED */ + NULL, /* RETRO_LANGUAGE_ESPERANTO */ + NULL, /* RETRO_LANGUAGE_POLISH */ + NULL, /* RETRO_LANGUAGE_VIETNAMESE */ + NULL, /* RETRO_LANGUAGE_ARABIC */ + NULL, /* RETRO_LANGUAGE_GREEK */ + NULL, /* RETRO_LANGUAGE_TURKISH */ + NULL, /* RETRO_LANGUAGE_SLOVAK */ + NULL, /* RETRO_LANGUAGE_PERSIAN */ + NULL, /* RETRO_LANGUAGE_HEBREW */ + NULL, /* RETRO_LANGUAGE_ASTURIAN */ + NULL, /* RETRO_LANGUAGE_FINNISH */ +}; + + +static INLINE void libretro_set_core_options(retro_environment_t environ_cb, + bool *categories_supported) +{ + unsigned version = 0; +#ifndef HAVE_NO_LANGEXTRA + unsigned language = 0; +#endif + + if (!environ_cb || !categories_supported) + return; + + *categories_supported = false; + + if (!environ_cb(RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION, &version)) + version = 0; + + if (version >= 2) + { +#ifndef HAVE_NO_LANGEXTRA + struct retro_core_options_v2_intl core_options_intl; + + core_options_intl.us = &options_us; + core_options_intl.local = NULL; + + if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) && + (language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH)) + core_options_intl.local = options_intl[language]; + + *categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL, + &core_options_intl); +#else + *categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2, + &options_us); +#endif + } + else + { + size_t i, j; + size_t option_index = 0; + size_t num_options = 0; + struct retro_core_option_definition + *option_v1_defs_us = NULL; +#ifndef HAVE_NO_LANGEXTRA + size_t num_options_intl = 0; + struct retro_core_option_v2_definition + *option_defs_intl = NULL; + struct retro_core_option_definition + *option_v1_defs_intl = NULL; + struct retro_core_options_intl + core_options_v1_intl; +#endif + struct retro_variable *variables = NULL; + char **values_buf = NULL; + + /* Determine total number of options */ + while (true) + { + if (option_defs_us[num_options].key) + num_options++; + else + break; + } + + if (version >= 1) + { + /* Allocate US array */ + option_v1_defs_us = (struct retro_core_option_definition *) + calloc(num_options + 1, sizeof(struct retro_core_option_definition)); + + /* Copy parameters from option_defs_us array */ + for (i = 0; i < num_options; i++) + { + struct retro_core_option_v2_definition *option_def_us = &option_defs_us[i]; + struct retro_core_option_value *option_values = option_def_us->values; + struct retro_core_option_definition *option_v1_def_us = &option_v1_defs_us[i]; + struct retro_core_option_value *option_v1_values = option_v1_def_us->values; + + option_v1_def_us->key = option_def_us->key; + option_v1_def_us->desc = option_def_us->desc; + option_v1_def_us->info = option_def_us->info; + option_v1_def_us->default_value = option_def_us->default_value; + + /* Values must be copied individually... */ + while (option_values->value) + { + option_v1_values->value = option_values->value; + option_v1_values->label = option_values->label; + + option_values++; + option_v1_values++; + } + } + +#ifndef HAVE_NO_LANGEXTRA + if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) && + (language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH) && + options_intl[language]) + option_defs_intl = options_intl[language]->definitions; + + if (option_defs_intl) + { + /* Determine number of intl options */ + while (true) + { + if (option_defs_intl[num_options_intl].key) + num_options_intl++; + else + break; + } + + /* Allocate intl array */ + option_v1_defs_intl = (struct retro_core_option_definition *) + calloc(num_options_intl + 1, sizeof(struct retro_core_option_definition)); + + /* Copy parameters from option_defs_intl array */ + for (i = 0; i < num_options_intl; i++) + { + struct retro_core_option_v2_definition *option_def_intl = &option_defs_intl[i]; + struct retro_core_option_value *option_values = option_def_intl->values; + struct retro_core_option_definition *option_v1_def_intl = &option_v1_defs_intl[i]; + struct retro_core_option_value *option_v1_values = option_v1_def_intl->values; + + option_v1_def_intl->key = option_def_intl->key; + option_v1_def_intl->desc = option_def_intl->desc; + option_v1_def_intl->info = option_def_intl->info; + option_v1_def_intl->default_value = option_def_intl->default_value; + + /* Values must be copied individually... */ + while (option_values->value) + { + option_v1_values->value = option_values->value; + option_v1_values->label = option_values->label; + + option_values++; + option_v1_values++; + } + } + } + + core_options_v1_intl.us = option_v1_defs_us; + core_options_v1_intl.local = option_v1_defs_intl; + + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL, &core_options_v1_intl); +#else + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS, option_v1_defs_us); +#endif + } + else + { + /* Allocate arrays */ + variables = (struct retro_variable *)calloc(num_options + 1, + sizeof(struct retro_variable)); + values_buf = (char **)calloc(num_options, sizeof(char *)); + + if (!variables || !values_buf) + goto error; + + /* Copy parameters from option_defs_us array */ + for (i = 0; i < num_options; i++) + { + const char *key = option_defs_us[i].key; + const char *desc = option_defs_us[i].desc; + const char *default_value = option_defs_us[i].default_value; + struct retro_core_option_value *values = option_defs_us[i].values; + size_t buf_len = 3; + size_t default_index = 0; + + values_buf[i] = NULL; + + if (desc) + { + size_t num_values = 0; + + /* Determine number of values */ + while (true) + { + if (values[num_values].value) + { + /* Check if this is the default value */ + if (default_value) + if (strcmp(values[num_values].value, default_value) == 0) + default_index = num_values; + + buf_len += strlen(values[num_values].value); + num_values++; + } + else + break; + } + + /* Build values string */ + if (num_values > 0) + { + buf_len += num_values - 1; + buf_len += strlen(desc); + + values_buf[i] = (char *)calloc(buf_len, sizeof(char)); + if (!values_buf[i]) + goto error; + + strcpy(values_buf[i], desc); + strcat(values_buf[i], "; "); + + /* Default value goes first */ + strcat(values_buf[i], values[default_index].value); + + /* Add remaining values */ + for (j = 0; j < num_values; j++) + { + if (j != default_index) + { + strcat(values_buf[i], "|"); + strcat(values_buf[i], values[j].value); + } + } + } + } + + variables[option_index].key = key; + variables[option_index].value = values_buf[i]; + option_index++; + } + + /* Set variables */ + environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables); + } + +error: + /* Clean up */ + + if (option_v1_defs_us) + { + free(option_v1_defs_us); + option_v1_defs_us = NULL; + } + +#ifndef HAVE_NO_LANGEXTRA + if (option_v1_defs_intl) + { + free(option_v1_defs_intl); + option_v1_defs_intl = NULL; + } +#endif + + if (values_buf) + { + for (i = 0; i < num_options; i++) + { + if (values_buf[i]) + { + free(values_buf[i]); + values_buf[i] = NULL; + } + } + + free(values_buf); + values_buf = NULL; + } + + if (variables) + { + free(variables); + variables = NULL; + } + } +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mupen64plus-core/src/api/config.c b/mupen64plus-core/src/api/config.c index 972ddf28d..ec1f545f0 100644 --- a/mupen64plus-core/src/api/config.c +++ b/mupen64plus-core/src/api/config.c @@ -47,6 +47,7 @@ #define GFX_GLN64 2 #define GFX_ANGRYLION 3 #define GFX_PARALLEL 4 +#define GFX_GLIDEN64 5 /* local types */ #define MUPEN64PLUS_CFG_NAME "mupen64plus.cfg" diff --git a/mupen64plus-core/src/plugin/plugin.c b/mupen64plus-core/src/plugin/plugin.c index 37020fc3c..109fe0441 100644 --- a/mupen64plus-core/src/plugin/plugin.c +++ b/mupen64plus-core/src/plugin/plugin.c @@ -285,12 +285,17 @@ void plugin_connect_all(enum gfx_plugin_type gfx_plugin, enum rsp_plugin_type rs #endif break; case GFX_RICE: -#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) +#ifdef HAVE_RICE gfx = gfx_rice; break; #endif case GFX_GLN64: -#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) +#ifdef HAVE_GLN64 + gfx = gfx_gln64; + break; +#endif + case GFX_GLIDEN64: +#ifdef HAVE_GLIDEN64 gfx = gfx_gliden64; break; #endif diff --git a/mupen64plus-video-gliden64/src/GBI.cpp b/mupen64plus-video-gliden64/src/GBI.cpp index 37766c570..4e124b369 100644 --- a/mupen64plus-video-gliden64/src/GBI.cpp +++ b/mupen64plus-video-gliden64/src/GBI.cpp @@ -39,7 +39,7 @@ #include "Graphics/Context.h" #include "Graphics/Parameters.h" -u32 last_good_ucode = (u32) -1; +static u32 last_good_ucode = (u32) -1; struct SpecialMicrocodeInfo { diff --git a/mupen64plus-video-gliden64/src/Graphics/OpenGLContext/GLFunctions.h b/mupen64plus-video-gliden64/src/Graphics/OpenGLContext/GLFunctions.h index dc9562dc0..8da146d32 100644 --- a/mupen64plus-video-gliden64/src/Graphics/OpenGLContext/GLFunctions.h +++ b/mupen64plus-video-gliden64/src/Graphics/OpenGLContext/GLFunctions.h @@ -60,7 +60,7 @@ typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GL typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -#define GL_ERROR_DEBUG +// #define GL_ERROR_DEBUG #ifdef GL_ERROR_DEBUG #define CHECKED_GL_FUNCTION(proc_name, ...) checked([&]() { proc_name(__VA_ARGS__);}, #proc_name) #define CHECKED_GL_FUNCTION_WITH_RETURN(proc_name, ReturnType, ...) checkedWithReturn([&]() { return proc_name(__VA_ARGS__);}, #proc_name) diff --git a/mupen64plus-video-gliden64/src/GraphicsDrawer.cpp b/mupen64plus-video-gliden64/src/GraphicsDrawer.cpp index 500e06bd8..b1ed62a01 100644 --- a/mupen64plus-video-gliden64/src/GraphicsDrawer.cpp +++ b/mupen64plus-video-gliden64/src/GraphicsDrawer.cpp @@ -1139,7 +1139,7 @@ bool texturedRectPaletteMod(const GraphicsDrawer::TexturedRectParams & _params) // Special processing of textured rect. // Return true if actuial rendering is not necessary -bool(*texturedRectSpecial)(const GraphicsDrawer::TexturedRectParams & _params) = nullptr; +static bool(*texturedRectSpecial)(const GraphicsDrawer::TexturedRectParams & _params) = nullptr; void GraphicsDrawer::drawTexturedRect(const TexturedRectParams & _params) { diff --git a/mupen64plus-video-gliden64/src/RSP.cpp b/mupen64plus-video-gliden64/src/RSP.cpp index 368b436d1..23dbf5867 100644 --- a/mupen64plus-video-gliden64/src/RSP.cpp +++ b/mupen64plus-video-gliden64/src/RSP.cpp @@ -229,19 +229,19 @@ void RSP_SetDefaultState() gDP.otherMode.bi_lerp0 = gDP.otherMode.bi_lerp1 = 1; } -u32 DepthClearColor = 0xfffcfffc; +u32 gliden64DepthClearColor = 0xfffcfffc; static void setDepthClearColor() { if (strstr(RSP.romname, (const char *)"Elmo's") != nullptr) - DepthClearColor = 0xFFFFFFFF; + gliden64DepthClearColor = 0xFFFFFFFF; else if (strstr(RSP.romname, (const char *)"Taz Express") != nullptr) - DepthClearColor = 0xFFBCFFBC; + gliden64DepthClearColor = 0xFFBCFFBC; else if (strstr(RSP.romname, (const char *)"NFL QBC 2000") != nullptr || strstr(RSP.romname, (const char *)"NFL Quarterback Club") != nullptr || strstr(RSP.romname, (const char *)"Jeremy McGrath Super") != nullptr) - DepthClearColor = 0xFFFDFFFC; + gliden64DepthClearColor = 0xFFFDFFFC; else - DepthClearColor = 0xFFFCFFFC; + gliden64DepthClearColor = 0xFFFCFFFC; } void RSP_Init() diff --git a/mupen64plus-video-gliden64/src/RSP.h b/mupen64plus-video-gliden64/src/RSP.h index cbac33154..905ce7964 100644 --- a/mupen64plus-video-gliden64/src/RSP.h +++ b/mupen64plus-video-gliden64/src/RSP.h @@ -19,7 +19,7 @@ typedef struct extern RSPInfo RSP; -extern u32 DepthClearColor; +extern u32 gliden64DepthClearColor; extern u32 rectDepthBufferCopyFrame; #define RSP_SegmentToPhysical( segaddr ) ((gSP.segment[(segaddr >> 24) & 0x0F] + (segaddr & RDRAMSize)) & RDRAMSize) diff --git a/mupen64plus-video-gliden64/src/gDP.cpp b/mupen64plus-video-gliden64/src/gDP.cpp index 003d9b175..edf456e94 100644 --- a/mupen64plus-video-gliden64/src/gDP.cpp +++ b/mupen64plus-video-gliden64/src/gDP.cpp @@ -30,7 +30,7 @@ gDPInfo gDP; bool isCurrentColorImageDepthImage() { return (gDP.colorImage.address == gDP.depthImageAddress) || - (gDP.fillColor.color == DepthClearColor && gDP.otherMode.cycleType == G_CYC_FILL); + (gDP.fillColor.color == gliden64DepthClearColor && gDP.otherMode.cycleType == G_CYC_FILL); } bool isDepthCompareEnabled() @@ -813,7 +813,7 @@ void gDPFillRectangle( s32 ulx, s32 uly, s32 lrx, s32 lry ) if (gDP.depthImageAddress == gDP.colorImage.address) { // Game may use depth texture as auxilary color texture. Example: Mario Tennis // If color is not depth clear color, that is most likely the case - if (gDP.fillColor.color == DepthClearColor) { + if (gDP.fillColor.color == gliden64DepthClearColor) { depthBuffer = dbFound; if (config.generalEmulation.enableFragmentDepthWrite == 0) { drawer.clearDepthBuffer(); @@ -821,7 +821,7 @@ void gDPFillRectangle( s32 ulx, s32 uly, s32 lrx, s32 lry ) } else depthBufferList().setCleared(true); } - } else if (gDP.fillColor.color == DepthClearColor && gDP.otherMode.cycleType == G_CYC_FILL) { + } else if (gDP.fillColor.color == gliden64DepthClearColor && gDP.otherMode.cycleType == G_CYC_FILL) { depthBuffer = dbFound; depthBufferList().saveBuffer(gDP.colorImage.address); if (config.generalEmulation.enableFragmentDepthWrite == 0 || diff --git a/mupen64plus-video-gliden64/src/mupenplus/Config_mupenplus.cpp b/mupen64plus-video-gliden64/src/mupenplus/Config_mupenplus.cpp index dcfac64dc..f29d959ae 100644 --- a/mupen64plus-video-gliden64/src/mupenplus/Config_mupenplus.cpp +++ b/mupen64plus-video-gliden64/src/mupenplus/Config_mupenplus.cpp @@ -19,6 +19,44 @@ extern "C" { Config config; +extern "C" uint32_t CoreOptionCategoriesSupported; +extern "C" uint32_t CoreOptionUpdateDisplayCbSupported; + +extern "C" uint32_t bilinearMode; +extern "C" uint32_t EnableHWLighting; +extern "C" uint32_t CorrectTexrectCoords; +extern "C" uint32_t EnableInaccurateTextureCoordinates; +extern "C" uint32_t enableNativeResTexrects; +extern "C" uint32_t enableLegacyBlending; +extern "C" uint32_t EnableCopyColorToRDRAM; +extern "C" uint32_t EnableCopyDepthToRDRAM; +extern "C" uint32_t AspectRatio; +extern "C" uint32_t txFilterMode; +extern "C" uint32_t txEnhancementMode; +extern "C" uint32_t txHiresEnable; +extern "C" uint32_t txHiresFullAlphaChannel; +extern "C" uint32_t txFilterIgnoreBG; +extern "C" uint32_t EnableFXAA; +extern "C" uint32_t MultiSampling; +extern "C" uint32_t EnableFragmentDepthWrite; +extern "C" uint32_t EnableShadersStorage; +extern "C" uint32_t EnableTextureCache; +extern "C" uint32_t EnableFBEmulation; +extern "C" uint32_t EnableLODEmulation; +extern "C" uint32_t BackgroundMode; // 0 is bgOnePiece +extern "C" uint32_t EnableHiResAltCRC; +extern "C" uint32_t EnableTxCacheCompression; +extern "C" uint32_t EnableNativeResFactor; +extern "C" uint32_t EnableN64DepthCompare; +extern "C" uint32_t EnableCopyAuxToRDRAM; +extern "C" uint32_t GLideN64IniBehaviour; + +extern "C" uint32_t EnableOverscan; +extern "C" uint32_t OverscanTop; +extern "C" uint32_t OverscanLeft; +extern "C" uint32_t OverscanRight; +extern "C" uint32_t OverscanBottom; + std::string replaceChars(std::string myString) { for (size_t pos = myString.find(' '); pos != std::string::npos; pos = myString.find(' ', pos)) @@ -90,7 +128,7 @@ void LoadCustomSettings(bool internal) // I know this is a bit counter productive // Maybe needs a "Auto" mode in the future, since it soon has a "fast" mode too. // Currently its often not supported anyway or causes crippling issues otherwise - // if(EnableN64DepthCompare) + if(EnableN64DepthCompare) { // Set to config val, ignoring the actual pre-set, see above. config.frameBufferEmulation.N64DepthCompare = atoi(l.value); @@ -129,13 +167,12 @@ extern "C" void Config_LoadConfig() config.resetToDefaults(); // Early - // if(GLideN64IniBehaviour == 1) + if(GLideN64IniBehaviour == 1) { LoadCustomSettings(true); LoadCustomSettings(false); } - /* config.frameBufferEmulation.aspect = AspectRatio; config.frameBufferEmulation.enable = EnableFBEmulation; config.frameBufferEmulation.N64DepthCompare = EnableN64DepthCompare; @@ -192,17 +229,13 @@ extern "C" void Config_LoadConfig() config.graphics2D.bgMode = BackgroundMode; - config.textureFilter.txEnhancedTextureFileStorage = EnableEnhancedTextureStorage; config.textureFilter.txHresAltCRC = EnableHiResAltCRC; - config.textureFilter.txHiresTextureFileStorage = EnableEnhancedHighResStorage; - config.textureFilter.txHiresVramLimit = MaxHiResTxVramLimit; config.frameBufferEmulation.nativeResFactor = EnableNativeResFactor; config.generalEmulation.hacks = hacks; - */ // Late - // if(GLideN64IniBehaviour == 0) + if(GLideN64IniBehaviour == 0) { LoadCustomSettings(true); LoadCustomSettings(false);