Merge pull request #118 from Tatsuya79/pce

Core options sublabels.
This commit is contained in:
hizzlekizzle 2019-07-17 14:44:29 -05:00 committed by GitHub
commit 8fea4c0fb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1411 additions and 254 deletions

View File

@ -593,7 +593,6 @@ else ifeq ($(STATIC_LINKING), 1)
else
$(LD) $(LINKOUT)$@ $^ $(LDFLAGS) $(LIBS)
endif
@echo "** BUILD SUCCESSFUL! GG NO RE **"
%.o: %.cpp
$(CXX) -c $(OBJOUT)$@ $< $(CPPFLAGS) $(CXXFLAGS)

View File

@ -128,7 +128,8 @@ extern "C" {
/* LIGHTGUN device is similar to Guncon-2 for PlayStation 2.
* It reports X/Y coordinates in screen space (similar to the pointer)
* in the range [-0x8000, 0x7fff] in both axes, with zero being center.
* in the range [-0x8000, 0x7fff] in both axes, with zero being center and
* -0x8000 being out of bounds.
* As well as reporting on/off screen state. It features a trigger,
* start/select buttons, auxiliary action buttons and a
* directional pad. A forced off-screen shot can be requested for
@ -139,7 +140,8 @@ extern "C" {
/* The ANALOG device is an extension to JOYPAD (RetroPad).
* Similar to DualShock2 it adds two analog sticks and all buttons can
* be analog. This is treated as a separate device type as it returns
* axis values in the full analog range of [-0x8000, 0x7fff].
* axis values in the full analog range of [-0x7fff, 0x7fff],
* although some devices may return -0x8000.
* Positive X axis is right. Positive Y axis is down.
* Buttons are returned in the range [0, 0x7fff].
* Only use ANALOG type when polling for analog values.
@ -200,6 +202,8 @@ extern "C" {
#define RETRO_DEVICE_ID_JOYPAD_L3 14
#define RETRO_DEVICE_ID_JOYPAD_R3 15
#define RETRO_DEVICE_ID_JOYPAD_MASK 256
/* Index / Id values for ANALOG device. */
#define RETRO_DEVICE_INDEX_ANALOG_LEFT 0
#define RETRO_DEVICE_INDEX_ANALOG_RIGHT 1
@ -246,6 +250,7 @@ extern "C" {
#define RETRO_DEVICE_ID_POINTER_X 0
#define RETRO_DEVICE_ID_POINTER_Y 1
#define RETRO_DEVICE_ID_POINTER_PRESSED 2
#define RETRO_DEVICE_ID_POINTER_COUNT 3
/* Returned from retro_get_region(). */
#define RETRO_REGION_NTSC 0
@ -271,6 +276,8 @@ enum retro_language
RETRO_LANGUAGE_POLISH = 14,
RETRO_LANGUAGE_VIETNAMESE = 15,
RETRO_LANGUAGE_ARABIC = 16,
RETRO_LANGUAGE_GREEK = 17,
RETRO_LANGUAGE_TURKISH = 18,
RETRO_LANGUAGE_LAST,
/* Ensure sizeof(enum) == sizeof(int) */
@ -450,6 +457,7 @@ enum retro_key
RETROK_POWER = 320,
RETROK_EURO = 321,
RETROK_UNDO = 322,
RETROK_OEM_102 = 323,
RETROK_LAST,
@ -481,11 +489,13 @@ enum retro_mod
/* Environment commands. */
#define RETRO_ENVIRONMENT_SET_ROTATION 1 /* const unsigned * --
* Sets screen rotation of graphics.
* Is only implemented if rotation can be accelerated by hardware.
* Valid values are 0, 1, 2, 3, which rotates screen by 0, 90, 180,
* 270 degrees counter-clockwise respectively.
*/
#define RETRO_ENVIRONMENT_GET_OVERSCAN 2 /* bool * --
* NOTE: As of 2019 this callback is considered deprecated in favor of
* using core options to manage overscan in a more nuanced, core-specific way.
*
* Boolean value whether or not the implementation should use overscan,
* or crop away overscan.
*/
@ -604,7 +614,7 @@ enum retro_mod
* Afterward 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.
*
*
* 'data' points to an array of retro_variable structs
* terminated by a { NULL, NULL } element.
* retro_variable::key should be namespaced to not collide
@ -657,6 +667,15 @@ enum retro_mod
/* Environment 20 was an obsolete version of SET_AUDIO_CALLBACK.
* It was not used by any known core at the time,
* and was removed from the API. */
#define RETRO_ENVIRONMENT_SET_FRAME_TIME_CALLBACK 21
/* const struct retro_frame_time_callback * --
* Lets the core know how much time has passed since last
* invocation of retro_run().
* The frontend can tamper with the timing to fake fast-forward,
* slow-motion, frame stepping, etc.
* In this case the delta time will use the reference value
* in frame_time_callback..
*/
#define RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK 22
/* const struct retro_audio_callback * --
* Sets an interface which is used to notify a libretro core about audio
@ -683,15 +702,6 @@ enum retro_mod
* A libretro core using SET_AUDIO_CALLBACK should also make use of
* SET_FRAME_TIME_CALLBACK.
*/
#define RETRO_ENVIRONMENT_SET_FRAME_TIME_CALLBACK 21
/* const struct retro_frame_time_callback * --
* Lets the core know how much time has passed since last
* invocation of retro_run().
* The frontend can tamper with the timing to fake fast-forward,
* slow-motion, frame stepping, etc.
* In this case the delta time will use the reference value
* in frame_time_callback..
*/
#define RETRO_ENVIRONMENT_GET_RUMBLE_INTERFACE 23
/* struct retro_rumble_interface * --
* Gets an interface which is used by a libretro core to set
@ -871,12 +881,12 @@ enum retro_mod
* types already defined in the libretro API.
*
* The core must pass an array of const struct retro_controller_info which
* is terminated with a blanked out struct. Each element of the
* is terminated with a blanked out struct. Each element of the
* retro_controller_info struct corresponds to the ascending port index
* that is passed to retro_set_controller_port_device() when that function
* is called to indicate to the core that the frontend has changed the
* active device subclass. SEE ALSO: retro_set_controller_port_device()
*
*
* The ascending input port indexes provided by the core in the struct
* are generally presented by frontends as ascending User # or Player #,
* such as Player 1, Player 2, Player 3, etc. Which device subclasses are
@ -888,7 +898,7 @@ enum retro_mod
* User or Player, beginning with the generic Libretro device that the
* subclasses are derived from. The second inner element of each entry is the
* total number of subclasses that are listed in the retro_controller_description.
*
*
* NOTE: Even if special device types are set in the libretro core,
* libretro should only poll input based on the base input device types.
*/
@ -968,7 +978,37 @@ enum retro_mod
* A frontend must make sure that the pointer obtained from this function is
* writeable (and readable).
*/
#define RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE (41 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* const struct retro_hw_render_interface ** --
* Returns an API specific rendering interface for accessing API specific data.
* Not all HW rendering APIs support or need this.
* The contents of the returned pointer is specific to the rendering API
* being used. See the various headers like libretro_vulkan.h, etc.
*
* GET_HW_RENDER_INTERFACE cannot be called before context_reset has been called.
* Similarly, after context_destroyed callback returns,
* the contents of the HW_RENDER_INTERFACE are invalidated.
*/
#define RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS (42 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* const bool * --
* If true, the libretro implementation supports achievements
* either via memory descriptors set with RETRO_ENVIRONMENT_SET_MEMORY_MAPS
* or via retro_get_memory_data/retro_get_memory_size.
*
* This must be called before the first call to retro_run.
*/
#define RETRO_ENVIRONMENT_SET_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE (43 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* const struct retro_hw_render_context_negotiation_interface * --
* Sets an interface which lets the libretro core negotiate with frontend how a context is created.
* The semantics of this interface depends on which API is used in SET_HW_RENDER earlier.
* This interface will be used when the frontend is trying to create a HW rendering context,
* so it will be used after SET_HW_RENDER, but before the context_reset callback.
*/
#define RETRO_ENVIRONMENT_SET_SERIALIZATION_QUIRKS 44
/* uint64_t * --
* Sets quirk flags associated with serialization. The frontend will zero any flags it doesn't
* recognize or support. Should be set in either retro_init or retro_load_game, but not both.
*/
#define RETRO_ENVIRONMENT_SET_HW_SHARED_CONTEXT (44 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* N/A (null) * --
* The frontend will try to use a 'shared' hardware context (mostly applicable
@ -980,160 +1020,19 @@ enum retro_mod
* This will do nothing on its own until SET_HW_RENDER env callbacks are
* being used.
*/
#define RETRO_ENVIRONMENT_GET_VFS_INTERFACE (45 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* struct retro_vfs_interface_info * --
* Gets access to the VFS interface.
* VFS presence needs to be queried prior to load_game or any
* get_system/save/other_directory being called to let front end know
* core supports VFS before it starts handing out paths.
* It is recomended to do so in retro_set_environment */
/* VFS functionality */
/* File paths:
* File paths passed as parameters when using this api shall be well formed unix-style,
* using "/" (unquoted forward slash) as directory separator regardless of the platform's native separator.
* Paths shall also include at least one forward slash ("game.bin" is an invalid path, use "./game.bin" instead).
* Other than the directory separator, cores shall not make assumptions about path format:
* "C:/path/game.bin", "http://example.com/game.bin", "#game/game.bin", "./game.bin" (without quotes) are all valid paths.
* Cores may replace the basename or remove path components from the end, and/or add new components;
* however, cores shall not append "./", "../" or multiple consecutive forward slashes ("//") to paths they request to front end.
* The frontend is encouraged to make such paths work as well as it can, but is allowed to give up if the core alters paths too much.
* Frontends are encouraged, but not required, to support native file system paths (modulo replacing the directory separator, if applicable).
* Cores are allowed to try using them, but must remain functional if the front rejects such requests.
* Cores are encouraged to use the libretro-common filestream functions for file I/O,
* as they seamlessly integrate with VFS, deal with directory separator replacement as appropriate
* and provide platform-specific fallbacks in cases where front ends do not support VFS. */
/* Opaque file handle
* Introduced in VFS API v1 */
struct retro_vfs_file_handle;
/* File open flags
* Introduced in VFS API v1 */
#define RETRO_VFS_FILE_ACCESS_READ (1 << 0) /* Read only mode */
#define RETRO_VFS_FILE_ACCESS_WRITE (1 << 1) /* Write only mode, discard contents and overwrites existing file unless RETRO_VFS_FILE_ACCESS_UPDATE is also specified */
#define RETRO_VFS_FILE_ACCESS_READ_WRITE (RETRO_VFS_FILE_ACCESS_READ | RETRO_VFS_FILE_ACCESS_WRITE) /* Read-write mode, discard contents and overwrites existing file unless RETRO_VFS_FILE_ACCESS_UPDATE is also specified*/
#define RETRO_VFS_FILE_ACCESS_UPDATE_EXISTING (1 << 2) /* Prevents discarding content of existing files opened for writing */
/* These are only hints. The frontend may choose to ignore them. Other than RAM/CPU/etc use,
and how they react to unlikely external interference (for example someone else writing to that file,
or the file's server going down), behavior will not change. */
#define RETRO_VFS_FILE_ACCESS_HINT_NONE (0)
/* Indicate that the file will be accessed many times. The frontend should aggressively cache everything. */
#define RETRO_VFS_FILE_ACCESS_HINT_FREQUENT_ACCESS (1 << 0)
/* Seek positions */
#define RETRO_VFS_SEEK_POSITION_START 0
#define RETRO_VFS_SEEK_POSITION_CURRENT 1
#define RETRO_VFS_SEEK_POSITION_END 2
/* Get path from opaque handle. Returns the exact same path passed to file_open when getting the handle
* Introduced in VFS API v1 */
typedef const char *(RETRO_CALLCONV *retro_vfs_get_path_t)(struct retro_vfs_file_handle *stream);
/* Open a file for reading or writing. If path points to a directory, this will
* fail. Returns the opaque file handle, or NULL for error.
* Introduced in VFS API v1 */
typedef struct retro_vfs_file_handle *(RETRO_CALLCONV *retro_vfs_open_t)(const char *path, unsigned mode, unsigned hints);
/* Close the file and release its resources. Must be called if open_file returns non-NULL. Returns 0 on succes, -1 on failure.
* Whether the call succeeds ot not, the handle passed as parameter becomes invalid and should no longer be used.
* Introduced in VFS API v1 */
typedef int (RETRO_CALLCONV *retro_vfs_close_t)(struct retro_vfs_file_handle *stream);
/* Return the size of the file in bytes, or -1 for error.
* Introduced in VFS API v1 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_size_t)(struct retro_vfs_file_handle *stream);
/* Get the current read / write position for the file. Returns - 1 for error.
* Introduced in VFS API v1 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_tell_t)(struct retro_vfs_file_handle *stream);
/* Set the current read/write position for the file. Returns the new position, -1 for error.
* Introduced in VFS API v1 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_seek_t)(struct retro_vfs_file_handle *stream, int64_t offset, int seek_position);
/* Read data from a file. Returns the number of bytes read, or -1 for error.
* Introduced in VFS API v1 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_read_t)(struct retro_vfs_file_handle *stream, void *s, uint64_t len);
/* Write data to a file. Returns the number of bytes written, or -1 for error.
* Introduced in VFS API v1 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_write_t)(struct retro_vfs_file_handle *stream, const void *s, uint64_t len);
/* Flush pending writes to file, if using buffered IO. Returns 0 on sucess, or -1 on failure.
* Introduced in VFS API v1 */
typedef int (RETRO_CALLCONV *retro_vfs_flush_t)(struct retro_vfs_file_handle *stream);
/* Delete the specified file. Returns 0 on success, -1 on failure
* Introduced in VFS API v1 */
typedef int (RETRO_CALLCONV *retro_vfs_remove_t)(const char *path);
/* Rename the specified file. Returns 0 on success, -1 on failure
* Introduced in VFS API v1 */
typedef int (RETRO_CALLCONV *retro_vfs_rename_t)(const char *old_path, const char *new_path);
struct retro_vfs_interface
{
retro_vfs_get_path_t get_path;
retro_vfs_open_t open;
retro_vfs_close_t close;
retro_vfs_size_t size;
retro_vfs_tell_t tell;
retro_vfs_seek_t seek;
retro_vfs_read_t read;
retro_vfs_write_t write;
retro_vfs_flush_t flush;
retro_vfs_remove_t remove;
retro_vfs_rename_t rename;
};
struct retro_vfs_interface_info
{
/* Set by core: should this be higher than the version the front end supports,
* front end will return false in the RETRO_ENVIRONMENT_GET_VFS_INTERFACE call
* Introduced in VFS API v1 */
uint32_t required_interface_version;
/* Frontend writes interface pointer here. The frontend also sets the actual
* version, must be at least required_interface_version.
* Introduced in VFS API v1 */
struct retro_vfs_interface *iface;
};
enum retro_hw_render_interface_type
{
RETRO_HW_RENDER_INTERFACE_VULKAN = 0,
RETRO_HW_RENDER_INTERFACE_D3D9 = 1,
RETRO_HW_RENDER_INTERFACE_D3D10 = 2,
RETRO_HW_RENDER_INTERFACE_D3D11 = 3,
RETRO_HW_RENDER_INTERFACE_D3D12 = 4,
RETRO_HW_RENDER_INTERFACE_DUMMY = INT_MAX
};
/* Base struct. All retro_hw_render_interface_* types
* contain at least these fields. */
struct retro_hw_render_interface
{
enum retro_hw_render_interface_type interface_type;
unsigned interface_version;
};
* It is recomended to do so in retro_set_environment
*/
#define RETRO_ENVIRONMENT_GET_LED_INTERFACE (46 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* struct retro_led_interface * --
* Gets an interface which is used by a libretro core to set
* state of LEDs.
*/
typedef void (RETRO_CALLCONV *retro_set_led_state_t)(int led, int state);
struct retro_led_interface
{
retro_set_led_state_t set_led_state;
};
#define RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE (47 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* int * --
* Tells the core if the frontend wants audio or video.
@ -1175,12 +1074,377 @@ struct retro_led_interface
* never need an accurate audio state in the future.
* * State will never be saved when using Hard Disable Audio.
*/
#define RETRO_ENVIRONMENT_GET_MIDI_INTERFACE (48 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* struct retro_midi_interface ** --
* Returns a MIDI interface that can be used for raw data I/O.
*/
#define RETRO_ENVIRONMENT_GET_FASTFORWARDING (49 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* bool * --
* Boolean value that indicates whether or not the frontend is in
* fastforwarding mode.
*/
#define RETRO_ENVIRONMENT_GET_TARGET_REFRESH_RATE (50 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* float * --
* 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
* refresh rate/framerate.
*/
#define RETRO_ENVIRONMENT_GET_INPUT_BITMASKS (51 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* 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
* grab all button states instead of multiple times.
*
* If it returns true, you can pass RETRO_DEVICE_ID_JOYPAD_MASK as 'id'
* to retro_input_state_t (make sure 'device' is set to RETRO_DEVICE_JOYPAD).
* It will return a bitmask of all the digital buttons.
*/
#define RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION 52
/* unsigned * --
* Unsigned value is the API version number of the core options
* interface supported by the frontend. If callback return false,
* API version is assumed to be 0.
*
* In legacy code, core options are set by passing an array of
* retro_variable structs to RETRO_ENVIRONMENT_SET_VARIABLES.
* 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
* 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.
*/
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS 53
/* const struct retro_core_option_definition ** --
* 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_ENHANCED_CORE_OPTIONS
* 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).
* 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.
*
* 'data' points to an array of retro_core_option_definition structs
* terminated by a { NULL, NULL, NULL, {{0}}, NULL } element.
* retro_core_option_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'.
* retro_core_option_definition::desc should contain a human readable
* description of the key.
* retro_core_option_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_definition::values is an array of retro_core_option_value
* structs terminated by a { NULL, NULL } element.
* > retro_core_option_definition::values[index].value is an expected option
* value.
* > retro_core_option_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_definition::default_value is the default core option
* setting. It must match one of the expected option values in the
* retro_core_option_definition::values array. If it does not, or the
* 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,
* 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",
* "Speed hack coprocessor X",
* "Provides increased performance at the expense of reduced accuracy",
* {
* { "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_INTL 54
/* const struct retro_core_options_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_ENHANCED_CORE_OPTIONS
* 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).
* 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.
*
* This is fundamentally the same as RETRO_ENVIRONMENT_SET_CORE_OPTIONS,
* with the addition of localisation support. The description of the
* RETRO_ENVIRONMENT_SET_CORE_OPTIONS callback should be consulted
* for further details.
*
* 'data' points to a retro_core_options_intl struct.
*
* retro_core_options_intl::us is a pointer to an array of
* retro_core_option_definition structs defining the US English
* core options implementation. It must point to a valid array.
*
* retro_core_options_intl::local is a pointer to an array of
* retro_core_option_definition structs defining core options for
* the current frontend language. It may be NULL (in which case
* retro_core_options_intl::us is used by the frontend). Any items
* missing from this array will be read from retro_core_options_intl::us
* instead.
*
* NOTE: Default core option values are always taken from the
* retro_core_options_intl::us array. Any default values in
* retro_core_options_intl::local array will be ignored.
*/
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY 55
/* struct retro_core_option_display * --
*
* Allows an implementation to signal the environment to show
* or hide a variable when displaying core options. This is
* considered a *suggestion*. The frontend is free to ignore
* this callback, and its implementation not considered mandatory.
*
* 'data' points to a retro_core_option_display struct
*
* retro_core_option_display::key is a variable identifier
* which has already been set by SET_VARIABLES/SET_CORE_OPTIONS.
*
* retro_core_option_display::visible is a boolean, specifying
* whether variable should be displayed
*
* Note that all core option variables will be set visible by
* default when calling SET_VARIABLES/SET_CORE_OPTIONS.
*/
/* VFS functionality */
/* File paths:
* File paths passed as parameters when using this API shall be well formed UNIX-style,
* using "/" (unquoted forward slash) as directory separator regardless of the platform's native separator.
* Paths shall also include at least one forward slash ("game.bin" is an invalid path, use "./game.bin" instead).
* Other than the directory separator, cores shall not make assumptions about path format:
* "C:/path/game.bin", "http://example.com/game.bin", "#game/game.bin", "./game.bin" (without quotes) are all valid paths.
* Cores may replace the basename or remove path components from the end, and/or add new components;
* however, cores shall not append "./", "../" or multiple consecutive forward slashes ("//") to paths they request to front end.
* The frontend is encouraged to make such paths work as well as it can, but is allowed to give up if the core alters paths too much.
* Frontends are encouraged, but not required, to support native file system paths (modulo replacing the directory separator, if applicable).
* Cores are allowed to try using them, but must remain functional if the front rejects such requests.
* Cores are encouraged to use the libretro-common filestream functions for file I/O,
* as they seamlessly integrate with VFS, deal with directory separator replacement as appropriate
* and provide platform-specific fallbacks in cases where front ends do not support VFS. */
/* Opaque file handle
* Introduced in VFS API v1 */
struct retro_vfs_file_handle;
/* Opaque directory handle
* Introduced in VFS API v3 */
struct retro_vfs_dir_handle;
/* File open flags
* Introduced in VFS API v1 */
#define RETRO_VFS_FILE_ACCESS_READ (1 << 0) /* Read only mode */
#define RETRO_VFS_FILE_ACCESS_WRITE (1 << 1) /* Write only mode, discard contents and overwrites existing file unless RETRO_VFS_FILE_ACCESS_UPDATE is also specified */
#define RETRO_VFS_FILE_ACCESS_READ_WRITE (RETRO_VFS_FILE_ACCESS_READ | RETRO_VFS_FILE_ACCESS_WRITE) /* Read-write mode, discard contents and overwrites existing file unless RETRO_VFS_FILE_ACCESS_UPDATE is also specified*/
#define RETRO_VFS_FILE_ACCESS_UPDATE_EXISTING (1 << 2) /* Prevents discarding content of existing files opened for writing */
/* These are only hints. The frontend may choose to ignore them. Other than RAM/CPU/etc use,
and how they react to unlikely external interference (for example someone else writing to that file,
or the file's server going down), behavior will not change. */
#define RETRO_VFS_FILE_ACCESS_HINT_NONE (0)
/* Indicate that the file will be accessed many times. The frontend should aggressively cache everything. */
#define RETRO_VFS_FILE_ACCESS_HINT_FREQUENT_ACCESS (1 << 0)
/* Seek positions */
#define RETRO_VFS_SEEK_POSITION_START 0
#define RETRO_VFS_SEEK_POSITION_CURRENT 1
#define RETRO_VFS_SEEK_POSITION_END 2
/* stat() result flags
* Introduced in VFS API v3 */
#define RETRO_VFS_STAT_IS_VALID (1 << 0)
#define RETRO_VFS_STAT_IS_DIRECTORY (1 << 1)
#define RETRO_VFS_STAT_IS_CHARACTER_SPECIAL (1 << 2)
/* Get path from opaque handle. Returns the exact same path passed to file_open when getting the handle
* Introduced in VFS API v1 */
typedef const char *(RETRO_CALLCONV *retro_vfs_get_path_t)(struct retro_vfs_file_handle *stream);
/* Open a file for reading or writing. If path points to a directory, this will
* fail. Returns the opaque file handle, or NULL for error.
* Introduced in VFS API v1 */
typedef struct retro_vfs_file_handle *(RETRO_CALLCONV *retro_vfs_open_t)(const char *path, unsigned mode, unsigned hints);
/* Close the file and release its resources. Must be called if open_file returns non-NULL. Returns 0 on success, -1 on failure.
* Whether the call succeeds ot not, the handle passed as parameter becomes invalid and should no longer be used.
* Introduced in VFS API v1 */
typedef int (RETRO_CALLCONV *retro_vfs_close_t)(struct retro_vfs_file_handle *stream);
/* Return the size of the file in bytes, or -1 for error.
* Introduced in VFS API v1 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_size_t)(struct retro_vfs_file_handle *stream);
/* Truncate file to specified size. Returns 0 on success or -1 on error
* Introduced in VFS API v2 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_truncate_t)(struct retro_vfs_file_handle *stream, int64_t length);
/* Get the current read / write position for the file. Returns -1 for error.
* Introduced in VFS API v1 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_tell_t)(struct retro_vfs_file_handle *stream);
/* Set the current read/write position for the file. Returns the new position, -1 for error.
* Introduced in VFS API v1 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_seek_t)(struct retro_vfs_file_handle *stream, int64_t offset, int seek_position);
/* Read data from a file. Returns the number of bytes read, or -1 for error.
* Introduced in VFS API v1 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_read_t)(struct retro_vfs_file_handle *stream, void *s, uint64_t len);
/* Write data to a file. Returns the number of bytes written, or -1 for error.
* Introduced in VFS API v1 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_write_t)(struct retro_vfs_file_handle *stream, const void *s, uint64_t len);
/* Flush pending writes to file, if using buffered IO. Returns 0 on sucess, or -1 on failure.
* Introduced in VFS API v1 */
typedef int (RETRO_CALLCONV *retro_vfs_flush_t)(struct retro_vfs_file_handle *stream);
/* Delete the specified file. Returns 0 on success, -1 on failure
* Introduced in VFS API v1 */
typedef int (RETRO_CALLCONV *retro_vfs_remove_t)(const char *path);
/* Rename the specified file. Returns 0 on success, -1 on failure
* Introduced in VFS API v1 */
typedef int (RETRO_CALLCONV *retro_vfs_rename_t)(const char *old_path, const char *new_path);
/* Stat the specified file. Retruns a bitmask of RETRO_VFS_STAT_* flags, none are set if path was not valid.
* Additionally stores file size in given variable, unless NULL is given.
* Introduced in VFS API v3 */
typedef int (RETRO_CALLCONV *retro_vfs_stat_t)(const char *path, int32_t *size);
/* Create the specified directory. Returns 0 on success, -1 on unknown failure, -2 if already exists.
* Introduced in VFS API v3 */
typedef int (RETRO_CALLCONV *retro_vfs_mkdir_t)(const char *dir);
/* Open the specified directory for listing. Returns the opaque dir handle, or NULL for error.
* Support for the include_hidden argument may vary depending on the platform.
* Introduced in VFS API v3 */
typedef struct retro_vfs_dir_handle *(RETRO_CALLCONV *retro_vfs_opendir_t)(const char *dir, bool include_hidden);
/* Read the directory entry at the current position, and move the read pointer to the next position.
* Returns true on success, false if already on the last entry.
* Introduced in VFS API v3 */
typedef bool (RETRO_CALLCONV *retro_vfs_readdir_t)(struct retro_vfs_dir_handle *dirstream);
/* Get the name of the last entry read. Returns a string on success, or NULL for error.
* The returned string pointer is valid until the next call to readdir or closedir.
* Introduced in VFS API v3 */
typedef const char *(RETRO_CALLCONV *retro_vfs_dirent_get_name_t)(struct retro_vfs_dir_handle *dirstream);
/* Check if the last entry read was a directory. Returns true if it was, false otherwise (or on error).
* Introduced in VFS API v3 */
typedef bool (RETRO_CALLCONV *retro_vfs_dirent_is_dir_t)(struct retro_vfs_dir_handle *dirstream);
/* Close the directory and release its resources. Must be called if opendir returns non-NULL. Returns 0 on success, -1 on failure.
* Whether the call succeeds ot not, the handle passed as parameter becomes invalid and should no longer be used.
* Introduced in VFS API v3 */
typedef int (RETRO_CALLCONV *retro_vfs_closedir_t)(struct retro_vfs_dir_handle *dirstream);
struct retro_vfs_interface
{
/* VFS API v1 */
retro_vfs_get_path_t get_path;
retro_vfs_open_t open;
retro_vfs_close_t close;
retro_vfs_size_t size;
retro_vfs_tell_t tell;
retro_vfs_seek_t seek;
retro_vfs_read_t read;
retro_vfs_write_t write;
retro_vfs_flush_t flush;
retro_vfs_remove_t remove;
retro_vfs_rename_t rename;
/* VFS API v2 */
retro_vfs_truncate_t truncate;
/* VFS API v3 */
retro_vfs_stat_t stat;
retro_vfs_mkdir_t mkdir;
retro_vfs_opendir_t opendir;
retro_vfs_readdir_t readdir;
retro_vfs_dirent_get_name_t dirent_get_name;
retro_vfs_dirent_is_dir_t dirent_is_dir;
retro_vfs_closedir_t closedir;
};
struct retro_vfs_interface_info
{
/* Set by core: should this be higher than the version the front end supports,
* front end will return false in the RETRO_ENVIRONMENT_GET_VFS_INTERFACE call
* Introduced in VFS API v1 */
uint32_t required_interface_version;
/* Frontend writes interface pointer here. The frontend also sets the actual
* version, must be at least required_interface_version.
* Introduced in VFS API v1 */
struct retro_vfs_interface *iface;
};
enum retro_hw_render_interface_type
{
RETRO_HW_RENDER_INTERFACE_VULKAN = 0,
RETRO_HW_RENDER_INTERFACE_D3D9 = 1,
RETRO_HW_RENDER_INTERFACE_D3D10 = 2,
RETRO_HW_RENDER_INTERFACE_D3D11 = 3,
RETRO_HW_RENDER_INTERFACE_D3D12 = 4,
RETRO_HW_RENDER_INTERFACE_GSKIT_PS2 = 5,
RETRO_HW_RENDER_INTERFACE_DUMMY = INT_MAX
};
/* Base struct. All retro_hw_render_interface_* types
* contain at least these fields. */
struct retro_hw_render_interface
{
enum retro_hw_render_interface_type interface_type;
unsigned interface_version;
};
typedef void (RETRO_CALLCONV *retro_set_led_state_t)(int led, int state);
struct retro_led_interface
{
retro_set_led_state_t set_led_state;
};
/* Retrieves the current state of the MIDI input.
* Returns true if it's enabled, false otherwise. */
typedef bool (RETRO_CALLCONV *retro_midi_input_enabled_t)(void);
@ -1211,27 +1475,6 @@ struct retro_midi_interface
retro_midi_flush_t flush;
};
#define RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE (41 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* const struct retro_hw_render_interface ** --
* Returns an API specific rendering interface for accessing API specific data.
* Not all HW rendering APIs support or need this.
* The contents of the returned pointer is specific to the rendering API
* being used. See the various headers like libretro_vulkan.h, etc.
*
* GET_HW_RENDER_INTERFACE cannot be called before context_reset has been called.
* Similarly, after context_destroyed callback returns,
* the contents of the HW_RENDER_INTERFACE are invalidated.
*/
#define RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS (42 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* const bool * --
* If true, the libretro implementation supports achievements
* either via memory descriptors set with RETRO_ENVIRONMENT_SET_MEMORY_MAPS
* or via retro_get_memory_data/retro_get_memory_size.
*
* This must be called before the first call to retro_run.
*/
enum retro_hw_render_context_negotiation_interface_type
{
RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN = 0,
@ -1245,13 +1488,6 @@ struct retro_hw_render_context_negotiation_interface
enum retro_hw_render_context_negotiation_interface_type interface_type;
unsigned interface_version;
};
#define RETRO_ENVIRONMENT_SET_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE (43 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* const struct retro_hw_render_context_negotiation_interface * --
* Sets an interface which lets the libretro core negotiate with frontend how a context is created.
* The semantics of this interface depends on which API is used in SET_HW_RENDER earlier.
* This interface will be used when the frontend is trying to create a HW rendering context,
* so it will be used after SET_HW_RENDER, but before the context_reset callback.
*/
/* Serialized state is incomplete in some way. Set if serialization is
* usable in typical end-user cases but should not be relied upon to
@ -1277,20 +1513,17 @@ struct retro_hw_render_context_negotiation_interface
* dependence */
#define RETRO_SERIALIZATION_QUIRK_PLATFORM_DEPENDENT (1 << 6)
#define RETRO_ENVIRONMENT_SET_SERIALIZATION_QUIRKS 44
/* uint64_t * --
* Sets quirk flags associated with serialization. The frontend will zero any flags it doesn't
* recognize or support. Should be set in either retro_init or retro_load_game, but not both.
*/
#define RETRO_MEMDESC_CONST (1 << 0) /* The frontend will never change this memory area once retro_load_game has returned. */
#define RETRO_MEMDESC_BIGENDIAN (1 << 1) /* The memory area contains big endian data. Default is little endian. */
#define RETRO_MEMDESC_ALIGN_2 (1 << 16) /* All memory access in this area is aligned to their own size, or 2, whichever is smaller. */
#define RETRO_MEMDESC_ALIGN_4 (2 << 16)
#define RETRO_MEMDESC_ALIGN_8 (3 << 16)
#define RETRO_MEMDESC_MINSIZE_2 (1 << 24) /* All memory in this region is accessed at least 2 bytes at the time. */
#define RETRO_MEMDESC_MINSIZE_4 (2 << 24)
#define RETRO_MEMDESC_MINSIZE_8 (3 << 24)
#define RETRO_MEMDESC_CONST (1 << 0) /* The frontend will never change this memory area once retro_load_game has returned. */
#define RETRO_MEMDESC_BIGENDIAN (1 << 1) /* The memory area contains big endian data. Default is little endian. */
#define RETRO_MEMDESC_SYSTEM_RAM (1 << 2) /* The memory area is system RAM. This is main RAM of the gaming system. */
#define RETRO_MEMDESC_SAVE_RAM (1 << 3) /* The memory area is save RAM. This RAM is usually found on a game cartridge, backed up by a battery. */
#define RETRO_MEMDESC_VIDEO_RAM (1 << 4) /* The memory area is video RAM (VRAM) */
#define RETRO_MEMDESC_ALIGN_2 (1 << 16) /* All memory access in this area is aligned to their own size, or 2, whichever is smaller. */
#define RETRO_MEMDESC_ALIGN_4 (2 << 16)
#define RETRO_MEMDESC_ALIGN_8 (3 << 16)
#define RETRO_MEMDESC_MINSIZE_2 (1 << 24) /* All memory in this region is accessed at least 2 bytes at the time. */
#define RETRO_MEMDESC_MINSIZE_4 (2 << 24)
#define RETRO_MEMDESC_MINSIZE_8 (3 << 24)
struct retro_memory_descriptor
{
uint64_t flags;
@ -2190,17 +2423,26 @@ struct retro_system_info
* Typically used for a GUI to filter
* out extensions. */
/* If true, retro_load_game() is guaranteed to provide a valid pathname
* in retro_game_info::path.
* ::data and ::size are both invalid.
/* Libretro cores that need to have direct access to their content
* files, including cores which use the path of the content files to
* determine the paths of other files, should set need_fullpath to true.
*
* If false, ::data and ::size are guaranteed to be valid, but ::path
* might not be valid.
* Cores should strive for setting need_fullpath to false,
* as it allows the frontend to perform patching, etc.
*
* This is typically set to true for libretro implementations that must
* load from file.
* Implementations should strive for setting this to false, as it allows
* the frontend to perform patching, etc. */
* If need_fullpath is true and retro_load_game() is called:
* - retro_game_info::path is guaranteed to have a valid path
* - 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
*
* See also:
* - RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY
* - RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY
*/
bool need_fullpath;
/* If true, the frontend is not allowed to extract any archives before
@ -2251,6 +2493,64 @@ struct retro_variable
const char *value;
};
struct retro_core_option_display
{
/* Variable to configure in RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY */
const char *key;
/* Specifies whether variable should be displayed
* when presenting core options to the user */
bool visible;
};
/* 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) */
#define RETRO_NUM_CORE_OPTION_VALUES_MAX 128
struct retro_core_option_value
{
/* Expected option value */
const char *value;
/* Human-readable value label. If NULL, value itself
* will be displayed by the frontend */
const char *label;
};
struct retro_core_option_definition
{
/* Variable to query in RETRO_ENVIRONMENT_GET_VARIABLE. */
const char *key;
/* Human-readable core option description (used as menu label) */
const char *desc;
/* Human-readable core option information (used as menu sublabel) */
const char *info;
/* 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_intl
{
/* Pointer to an array of retro_core_option_definition structs
* - US English implementation
* - Must point to a valid array */
struct retro_core_option_definition *us;
/* Pointer to an array of retro_core_option_definition structs
* - Implementation for current frontend language
* - May be NULL */
struct retro_core_option_definition *local;
};
struct retro_game_info
{
const char *path; /* Path to game, UTF-8 encoded.
@ -2423,7 +2723,7 @@ RETRO_API bool retro_unserialize(const void *data, size_t size);
RETRO_API void retro_cheat_reset(void);
RETRO_API void retro_cheat_set(unsigned index, bool enabled, const char *code);
/* Loads a game.
/* Loads a game.
* Return true to indicate successful loading and false to indicate load failure.
*/
RETRO_API bool retro_load_game(const struct retro_game_info *game);

View File

@ -5,6 +5,7 @@
#include <string/stdstring.h>
#include <encodings/crc32.h>
#include <libretro.h>
#include "libretro_core_options.h"
#include <math.h>
#include "mednafen/mednafen.h"
@ -39,6 +40,7 @@
#define FB_HEIGHT 270
static bool old_cdimagecache = false;
static bool show_advanced_input_settings = true;
extern MDFNGI EmulatedPCE;
MDFNGI *MDFNGameInfo = &EmulatedPCE;
@ -754,6 +756,50 @@ static void check_variables(bool loaded)
up_down_allowed = (strcmp(var.value, "enabled") == 0);
}
var.key = "pce_show_advanced_input_settings";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
bool show_advanced_input_settings_prev = show_advanced_input_settings;
show_advanced_input_settings = true;
if (strcmp(var.value, "disabled") == 0)
show_advanced_input_settings = false;
if (show_advanced_input_settings != show_advanced_input_settings_prev)
{
size_t i;
struct retro_core_option_display option_display;
char av_keys[17][32] = {
"pce_multitap",
"pce_mouse_sensitivity",
"pce_disable_softreset",
"pce_up_down_allowed",
"pce_Turbo_Delay",
"pce_Turbo_Toggling",
"pce_turbo_toggle_hotkey",
"pce_p0_turbo_I_enable",
"pce_p0_turbo_II_enable",
"pce_p1_turbo_I_enable",
"pce_p1_turbo_II_enable",
"pce_p2_turbo_I_enable",
"pce_p2_turbo_II_enable",
"pce_p3_turbo_I_enable",
"pce_p3_turbo_II_enable",
"pce_p4_turbo_I_enable",
"pce_p4_turbo_II_enable",
};
option_display.visible = show_advanced_input_settings;
for (i = 0; i < 17; i++)
{
option_display.key = av_keys[i];
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
}
}
}
if (loaded)
SettingsChanged();
}
@ -1211,45 +1257,6 @@ void retro_set_environment(retro_environment_t cb)
struct retro_vfs_interface_info vfs_iface_info;
environ_cb = cb;
static const struct retro_variable vars[] = {
{ "pce_cdimagecache", "CD Image Cache (Restart); disabled|enabled" },
{ "pce_cdbios", "CD Bios (Restart); System Card 3|Games Express|System Card 1|System Card 2|System Card 2 US|System Card 3 US" },
{ "pce_arcadecard", "Arcade Card (Restart); enabled|disabled"},
{ "pce_nospritelimit", "No Sprite Limit; disabled|enabled" },
{ "pce_ocmultiplier", "CPU Overclock Multiplier; 1|2|3|4|5|6|7|8|9|10|20|30|40|50" },
{ "pce_aspect_ratio", "Aspect Ratio; auto|6:5|4:3|uncorrected" },
{ "pce_scaling", "Resolution Scaling; auto|lores|hires" },
{ "pce_h_overscan", "Show Horizontal Overscan; auto|disabled|enabled" },
{ "pce_hires_blend", "Hires Blending Strength; disabled|1|2|3|4|5|6|7|8" },
{ "pce_initial_scanline", "Initial Scanline; 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|0|1|2" },
{ "pce_last_scanline", "Last Scanline; 242|208|209|210|211|212|213|214|215|216|217|218|219|220|221|222|223|224|225|226|227|228|229|230|231|232|233|234|235|236|237|238|239|240|241" },
{ "pce_psgrevision", "PSG Audio Chip (Restart); HuC6280A|auto|HuC6280" },
{ "pce_cddavolume", "(CD) CDDA Volume %; 100|110|120|130|140|150|160|170|180|190|200|0|10|20|30|40|50|60|70|80|90" },
{ "pce_adpcmvolume", "(CD) ADPCM Volume %; 100|110|120|130|140|150|160|170|180|190|200|0|10|20|30|40|50|60|70|80|90" },
{ "pce_cdpsgvolume", "(CD) CD PSG Volume %; 100|110|120|130|140|150|160|170|180|190|200|0|10|20|30|40|50|60|70|80|90" },
{ "pce_cdspeed", "(CD) CD Speed; 1|2|4|8" },
{ "pce_adpcmextraprec", "(CD) ADPCM precision; 10-bit|12-bit" },
{ "pce_resamp_quality", "Owl Resampler Quality; 3|4|5|6|0|1|2" },
{ "pce_multitap", "Multitap 5-port Controller; enabled|disabled" },
{ "pce_Turbo_Delay", "Turbo Delay; Fast|Medium|Slow" },
{ "pce_Turbo_Toggling", "Turbo Hotkey; disabled|toggle|always" },
{ "pce_turbo_toggle_hotkey", "Alternate Turbo Hotkey; disabled|enabled" },
{ "pce_p0_turbo_I_enable", "P1 Turbo I; disabled|enabled" },
{ "pce_p0_turbo_II_enable", "P1 Turbo II; disabled|enabled" },
{ "pce_p1_turbo_I_enable", "P2 Turbo I; disabled|enabled" },
{ "pce_p1_turbo_II_enable", "P2 Turbo II; disabled|enabled" },
{ "pce_p2_turbo_I_enable", "P3 Turbo I; disabled|enabled" },
{ "pce_p2_turbo_II_enable", "P3 Turbo II; disabled|enabled" },
{ "pce_p3_turbo_I_enable", "P4 Turbo I; disabled|enabled" },
{ "pce_p3_turbo_II_enable", "P4 Turbo II; disabled|enabled" },
{ "pce_p4_turbo_I_enable", "P5 Turbo I; disabled|enabled" },
{ "pce_p4_turbo_II_enable", "P5 Turbo II; disabled|enabled" },
{ "pce_mouse_sensitivity", "Mouse Sensitivity; 1.25|1.50|1.75|2.00|2.25|2.50|2.75|3.00|3.25|3.50|3.75|4.00|4.25|4.50|4.75|5.00|0.125|0.250|0.375|0.500|0.625|0.750|0.875|1.000|1.125" },
{ "pce_disable_softreset", "Disable Soft Reset (RUN+SELECT); disabled|enabled" },
{ "pce_up_down_allowed", "Allow UP+DOWN/LEFT+RIGHT; disabled|enabled" },
{ NULL, NULL },
};
static const struct retro_controller_description pads[] = {
{ "PCE Joypad", RETRO_DEVICE_JOYPAD },
{ "PCE Mouse", RETRO_DEVICE_MOUSE },
@ -1264,7 +1271,7 @@ void retro_set_environment(retro_environment_t cb)
{ 0 },
};
cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)vars);
libretro_set_core_options(environ_cb);
environ_cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports);
vfs_iface_info.required_interface_version = 1;

851
libretro_core_options.h Normal file
View File

@ -0,0 +1,851 @@
#ifndef LIBRETRO_CORE_OPTIONS_H__
#define LIBRETRO_CORE_OPTIONS_H__
#include <stdlib.h>
#include <string.h>
#include <libretro.h>
#include <retro_inline.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
********************************
* Core Option Definitions
********************************
*/
/* RETRO_LANGUAGE_ENGLISH */
/* Default language:
* - All other languages must include the same keys and values
* - Will be used as a fallback in the event that frontend language
* is not available
* - Will be used as a fallback for any missing entries in
* frontend language definition */
struct retro_core_option_definition option_defs_us[] = {
{
"pce_cdimagecache",
"CD Image Cache (Restart)",
"Keep the CD image in memory.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_cdbios",
"CD Bios (Restart)",
"Most games can run on 'System Card 3'. 'Games Express' is needed for several unlicensed games.",
{
{ "Games Express", NULL },
{ "System Card 1", NULL },
{ "System Card 2", NULL },
{ "System Card 3", NULL },
{ "System Card 2 US", NULL },
{ "System Card 3 US", NULL },
{ NULL, NULL},
},
"System Card 3"
},
{
"pce_arcadecard",
"Arcade Card (Restart)",
"Leave this option enabled to allow enhanced modes of ACD-enhanced SCD games.",
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"pce_nospritelimit",
"No Sprite Limit",
"Remove 16-sprites-per-scanline hardware limit. WARNING: May cause graphics glitching on some games (such as Bloody Wolf).",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_ocmultiplier",
"CPU Overclock Multiplier",
"Higher values can reduce slowdowns in games. WARNING: Can cause glitches and crashes.",
{
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ "20", NULL },
{ "30", NULL },
{ "40", NULL },
{ "50", NULL },
{ NULL, NULL},
},
"1"
},
{
"pce_aspect_ratio",
"Aspect Ratio",
"Choose the preferred content aspect ratio. This will only apply when RetroArch's aspect ratio is set to 'Core provided' in the Video settings.",
{
{ "auto", NULL },
{ "6:5", NULL },
{ "4:3", NULL },
{ "uncorrected", NULL },
{ NULL, NULL},
},
"auto"
},
{
"pce_scaling",
"Resolution Scaling",
"'auto' will authorize resolution to switch. 'lores' can crush pixels. 'hires' will stay on the maximum width.",
{
{ "auto", NULL },
{ "lores", NULL },
{ "hires", NULL },
{ NULL, NULL},
},
"auto"
},
{
"pce_hires_blend",
"Hires Blending Strength",
"Blend pixels together when in hires mode. Higher values will blur the picture more.",
{
{ "disabled", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_h_overscan",
"Show Horizontal Overscan",
"Show or crop horizontal overscan. 'auto' will try to adapt to games, cropping empty areas.",
{
{ "auto", NULL },
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"auto"
},
{
"pce_initial_scanline",
"Initial Scanline",
"First rendered scanline. Higher values will crop the top of the screen.",
{
{ "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 },
{ NULL, NULL},
},
"3"
},
{
"pce_last_scanline",
"Last Scanline",
"Last rendered scanline. Lower values will crop the bottom of the screen.",
{
{ "208", NULL },
{ "209", NULL },
{ "210", NULL },
{ "211", NULL },
{ "212", NULL },
{ "213", NULL },
{ "214", NULL },
{ "215", NULL },
{ "216", NULL },
{ "217", NULL },
{ "218", NULL },
{ "219", NULL },
{ "220", NULL },
{ "221", NULL },
{ "222", NULL },
{ "223", NULL },
{ "224", NULL },
{ "225", NULL },
{ "226", NULL },
{ "227", NULL },
{ "228", NULL },
{ "229", NULL },
{ "230", NULL },
{ "231", NULL },
{ "232", NULL },
{ "233", NULL },
{ "234", NULL },
{ "235", NULL },
{ "236", NULL },
{ "237", NULL },
{ "238", NULL },
{ "239", NULL },
{ "240", NULL },
{ "241", NULL },
{ "242", NULL },
{ NULL, NULL},
},
"242"
},
{
"pce_psgrevision",
"PSG Audio Chip (Restart)",
"HuC6280 as found in the original PC Engine. HuC6280A as found in the SuperGrafx and CoreGrafx I.",
{
{ "auto", NULL },
{ "HuC6280", NULL },
{ "HuC6280A", NULL },
{ NULL, NULL},
},
"HuC6280A"
},
{
"pce_cddavolume",
"(CD) CDDA Volume %",
"CD game only. Setting this volume control too high may cause sample clipping.",
{
{ "0", NULL },
{ "10", NULL },
{ "20", NULL },
{ "30", NULL },
{ "40", NULL },
{ "50", NULL },
{ "60", NULL },
{ "70", NULL },
{ "80", NULL },
{ "90", NULL },
{ "100", NULL },
{ "110", NULL },
{ "120", NULL },
{ "130", NULL },
{ "140", NULL },
{ "150", NULL },
{ "160", NULL },
{ "170", NULL },
{ "180", NULL },
{ "190", NULL },
{ "200", NULL },
{ NULL, NULL},
},
"100"
},
{
"pce_adpcmvolume",
"(CD) ADPCM Volume %",
"CD game only. Setting this volume control too high may cause sample clipping.",
{
{ "0", NULL },
{ "10", NULL },
{ "20", NULL },
{ "30", NULL },
{ "40", NULL },
{ "50", NULL },
{ "60", NULL },
{ "70", NULL },
{ "80", NULL },
{ "90", NULL },
{ "100", NULL },
{ "110", NULL },
{ "120", NULL },
{ "130", NULL },
{ "140", NULL },
{ "150", NULL },
{ "160", NULL },
{ "170", NULL },
{ "180", NULL },
{ "190", NULL },
{ "200", NULL },
{ NULL, NULL},
},
"100"
},
{
"pce_cdpsgvolume",
"(CD) CD PSG Volume %",
"CD game only. Setting this volume control too high may cause sample clipping.",
{
{ "0", NULL },
{ "10", NULL },
{ "20", NULL },
{ "30", NULL },
{ "40", NULL },
{ "50", NULL },
{ "60", NULL },
{ "70", NULL },
{ "80", NULL },
{ "90", NULL },
{ "100", NULL },
{ "110", NULL },
{ "120", NULL },
{ "130", NULL },
{ "140", NULL },
{ "150", NULL },
{ "160", NULL },
{ "170", NULL },
{ "180", NULL },
{ "190", NULL },
{ "200", NULL },
{ NULL, NULL},
},
"100"
},
{
"pce_cdspeed",
"(CD) CD Speed",
"Faster loading times but can cause issues with a couple of games.",
{
{ "1", NULL },
{ "2", NULL },
{ "4", NULL },
{ "8", NULL },
{ NULL, NULL},
},
"1"
},
{
"pce_adpcmextraprec",
"(CD) ADPCM precision",
"Full precision of 12-bits for the MSM5205 ADPCM predictor can reduce whining noise during ADPCM playback.",
{
{ "10-bit", NULL },
{ "12-bit", NULL },
{ NULL, NULL},
},
"10-bit"
},
{
"pce_resamp_quality",
"Owl Resampler Quality",
"Higher values give better signal noise ratio and preservation of higher frequencies, but increased computation, a bit of latency and clipping if the volume is set too high.",
{
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ NULL, NULL},
},
"3"
},
{
"pce_show_advanced_input_settings",
"Show Advanced Input/Turbo Settings",
"Show Multitap, Mouse, Turbo Buttons and advanced parameters. NOTE: You need to go back in game and re-enter the menu to refresh the list.",
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_mouse_sensitivity",
"Mouse Sensitivity",
"Higher values will make the mouse cursor move faster.",
{
{ "0.125", NULL },
{ "0.250", NULL },
{ "0.375", NULL },
{ "0.500", NULL },
{ "0.625", NULL },
{ "0.750", NULL },
{ "0.875", NULL },
{ "1.000", NULL },
{ "1.125", NULL },
{ "1.25", NULL },
{ "1.50", NULL },
{ "1.75", NULL },
{ "2.00", NULL },
{ "2.25", NULL },
{ "2.50", NULL },
{ "2.75", NULL },
{ "3.00", NULL },
{ "3.25", NULL },
{ "3.50", NULL },
{ "3.75", NULL },
{ "4.00", NULL },
{ "4.25", NULL },
{ "4.50", NULL },
{ "4.75", NULL },
{ "5.00", NULL },
{ NULL, NULL},
},
"1.25"
},
{
"pce_multitap",
"Multitap 5-port Controller",
"Enable multitap (TurboTap) emulation.",
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"pce_disable_softreset",
"Disable Soft Reset (RUN+SELECT)",
"If set, when RUN+SEL are pressed simultaneously, disable both buttons temporarily.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_up_down_allowed",
"Allow UP+DOWN/LEFT+RIGHT",
"Enabling this will allow pressing / quickly alternating / holding both left and right (or up and down) directions at the same time. This may cause movement-based glitches.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_Turbo_Delay",
"Turbo Delay",
NULL,
{
{ "Fast", NULL },
{ "Medium", NULL },
{ "Slow", NULL },
{ NULL, NULL},
},
"Fast"
},
{
"pce_Turbo_Toggling",
"Turbo Hotkey",
NULL,
{
{ "disabled", NULL },
{ "toggle", NULL },
{ "always", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_turbo_toggle_hotkey",
"Alternate Turbo Hotkey",
NULL,
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_p0_turbo_I_enable",
"P1 Turbo I",
NULL,
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_p0_turbo_II_enable",
"P1 Turbo II",
NULL,
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_p1_turbo_I_enable",
"P2 Turbo I",
NULL,
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_p1_turbo_II_enable",
"P2 Turbo II",
NULL,
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_p2_turbo_I_enable",
"P3 Turbo I",
NULL,
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_p2_turbo_II_enable",
"P3 Turbo II",
NULL,
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_p3_turbo_I_enable",
"P4 Turbo I",
NULL,
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_p3_turbo_II_enable",
"P4 Turbo II",
NULL,
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_p4_turbo_I_enable",
"P5 Turbo I",
NULL,
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"pce_p4_turbo_II_enable",
"P5 Turbo II",
NULL,
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{ NULL, NULL, NULL, {{0}}, NULL },
};
/* RETRO_LANGUAGE_JAPANESE */
/* RETRO_LANGUAGE_FRENCH */
/* RETRO_LANGUAGE_SPANISH */
/* RETRO_LANGUAGE_GERMAN */
/* RETRO_LANGUAGE_ITALIAN */
/* RETRO_LANGUAGE_DUTCH */
/* RETRO_LANGUAGE_PORTUGUESE_BRAZIL */
/* RETRO_LANGUAGE_PORTUGUESE_PORTUGAL */
/* RETRO_LANGUAGE_RUSSIAN */
/* RETRO_LANGUAGE_KOREAN */
/* RETRO_LANGUAGE_CHINESE_TRADITIONAL */
/* RETRO_LANGUAGE_CHINESE_SIMPLIFIED */
/* RETRO_LANGUAGE_ESPERANTO */
/* RETRO_LANGUAGE_POLISH */
/* RETRO_LANGUAGE_VIETNAMESE */
/* RETRO_LANGUAGE_ARABIC */
/* RETRO_LANGUAGE_GREEK */
/* RETRO_LANGUAGE_TURKISH */
/*
********************************
* Language Mapping
********************************
*/
struct retro_core_option_definition *option_defs_intl[RETRO_LANGUAGE_LAST] = {
option_defs_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 */
};
/*
********************************
* Functions
********************************
*/
/* Handles configuration/setting of core options.
* Should only be called inside retro_set_environment().
* > We place the function body in the header to avoid the
* necessity of adding more .c files (i.e. want this to
* be as painless as possible for core devs)
*/
static INLINE void libretro_set_core_options(retro_environment_t environ_cb)
{
unsigned version = 0;
if (!environ_cb)
return;
if (environ_cb(RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION, &version) && (version == 1))
{
struct retro_core_options_intl core_options_intl;
unsigned language = 0;
core_options_intl.us = option_defs_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 = option_defs_intl[language];
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL, &core_options_intl);
}
else
{
size_t i;
size_t option_index = 0;
size_t num_options = 0;
struct retro_variable *variables = NULL;
char **values_buf = NULL;
/* Determine number of options
* > Note: We are going to skip a number of irrelevant
* core options when building the retro_variable array,
* but we'll allocate space for all of them. The difference
* in resource usage is negligible, and this allows us to
* keep the code 'cleaner' */
while (true)
{
if (option_defs_us[num_options].key)
num_options++;
else
break;
}
/* 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;
/* Skip options that are irrelevant when using the
* old style core options interface */
if (strcmp(key, "pce_show_advanced_input_settings") == 0)
continue;
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 > 1)
{
size_t j;
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 (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