mirror of
https://github.com/FunKey-Project/picodrive-irixxxx.git
synced 2026-09-16 20:32:09 +02:00
Add enhanced core options
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
@@ -599,8 +609,11 @@ enum retro_mod
|
||||
* GET_VARIABLE.
|
||||
* This allows the frontend to present these variables to
|
||||
* a user dynamically.
|
||||
* This should be called as early as possible (ideally in
|
||||
* retro_set_environment).
|
||||
* This should be called the first time as early as
|
||||
* possible (ideally in retro_set_environment).
|
||||
* 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.
|
||||
@@ -654,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
|
||||
@@ -680,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
|
||||
@@ -775,17 +788,18 @@ enum retro_mod
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY 31
|
||||
/* const char ** --
|
||||
* Returns the "save" directory of the frontend.
|
||||
* This directory can be used to store SRAM, memory cards,
|
||||
* high scores, etc, if the libretro core
|
||||
* Returns the "save" directory of the frontend, unless there is no
|
||||
* save directory available. The save directory should be used to
|
||||
* store SRAM, memory cards, high scores, etc, if the libretro core
|
||||
* cannot use the regular memory interface (retro_get_memory_data()).
|
||||
*
|
||||
* NOTE: libretro cores used to check GET_SYSTEM_DIRECTORY for
|
||||
* similar things before.
|
||||
* They should still check GET_SYSTEM_DIRECTORY if they want to
|
||||
* be backwards compatible.
|
||||
* The path here can be NULL. It should only be non-NULL if the
|
||||
* frontend user has set a specific save path.
|
||||
* If the frontend cannot designate a save directory, it will return
|
||||
* NULL to indicate that the core should attempt to operate without a
|
||||
* save directory set.
|
||||
*
|
||||
* NOTE: early libretro cores used the system directory for save
|
||||
* files. Cores that need to be backwards-compatible can still check
|
||||
* GET_SYSTEM_DIRECTORY.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO 32
|
||||
/* const struct retro_system_av_info * --
|
||||
@@ -853,26 +867,39 @@ enum retro_mod
|
||||
#define RETRO_ENVIRONMENT_SET_CONTROLLER_INFO 35
|
||||
/* const struct retro_controller_info * --
|
||||
* This environment call lets a libretro core tell the frontend
|
||||
* which controller types are recognized in calls to
|
||||
* which controller subclasses are recognized in calls to
|
||||
* retro_set_controller_port_device().
|
||||
*
|
||||
* Some emulators such as Super Nintendo
|
||||
* support multiple lightgun types which must be specifically
|
||||
* selected from.
|
||||
* It is therefore sometimes necessary for a frontend to be able
|
||||
* to tell the core about a special kind of input device which is
|
||||
* not covered by the libretro input API.
|
||||
* Some emulators such as Super Nintendo support multiple lightgun
|
||||
* types which must be specifically selected from. It is therefore
|
||||
* sometimes necessary for a frontend to be able to tell the core
|
||||
* about a special kind of input device which is not specifcally
|
||||
* provided by the Libretro API.
|
||||
*
|
||||
* In order for a frontend to understand the workings of an input device,
|
||||
* it must be a specialized type
|
||||
* of the generic device types already defined in the libretro API.
|
||||
* In order for a frontend to understand the workings of those devices,
|
||||
* they must be defined as a specialized subclass of the generic device
|
||||
* types already defined in the libretro API.
|
||||
*
|
||||
* Which devices are supported can vary per input port.
|
||||
* The core must pass an array of const struct retro_controller_info which
|
||||
* is terminated with a blanked out struct. Each element of the struct
|
||||
* corresponds to an ascending port index to
|
||||
* retro_set_controller_port_device().
|
||||
* Even if special device types are set in the libretro core,
|
||||
* 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
|
||||
* supported can vary per input port.
|
||||
*
|
||||
* The first inner element of each entry in the retro_controller_info array
|
||||
* is a retro_controller_description struct that specifies the names and
|
||||
* codes of all device subclasses that are available for the corresponding
|
||||
* 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.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_MEMORY_MAPS (36 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
@@ -951,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
|
||||
@@ -963,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.
|
||||
@@ -1158,28 +1074,407 @@ 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_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_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_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_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);
|
||||
|
||||
/* Retrieves the current state of the MIDI output.
|
||||
* Returns true if it's enabled, false otherwise */
|
||||
typedef bool (RETRO_CALLCONV *retro_midi_output_enabled_t)(void);
|
||||
|
||||
/* Reads next byte from the input stream.
|
||||
* Returns true if byte is read, false otherwise. */
|
||||
typedef bool (RETRO_CALLCONV *retro_midi_read_t)(uint8_t *byte);
|
||||
|
||||
/* Writes byte to the output stream.
|
||||
* 'delta_time' is in microseconds and represent time elapsed since previous write.
|
||||
* Returns true if byte is written, false otherwise. */
|
||||
typedef bool (RETRO_CALLCONV *retro_midi_write_t)(uint8_t byte, uint32_t delta_time);
|
||||
|
||||
/* Flushes previously written data.
|
||||
* Returns true if successful, false otherwise. */
|
||||
typedef bool (RETRO_CALLCONV *retro_midi_flush_t)(void);
|
||||
|
||||
struct retro_midi_interface
|
||||
{
|
||||
retro_midi_input_enabled_t input_enabled;
|
||||
retro_midi_output_enabled_t output_enabled;
|
||||
retro_midi_read_t read;
|
||||
retro_midi_write_t write;
|
||||
retro_midi_flush_t flush;
|
||||
};
|
||||
|
||||
enum retro_hw_render_context_negotiation_interface_type
|
||||
{
|
||||
RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN = 0,
|
||||
@@ -1193,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
|
||||
@@ -1225,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;
|
||||
@@ -2138,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
|
||||
@@ -2199,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.
|
||||
@@ -2333,7 +2685,13 @@ RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info);
|
||||
* will only poll input based on that particular device type. It is only a
|
||||
* hint to the libretro core when a core cannot automatically detect the
|
||||
* appropriate input device type on its own. It is also relevant when a
|
||||
* core can change its behavior depending on device type. */
|
||||
* core can change its behavior depending on device type.
|
||||
*
|
||||
* As part of the core's implementation of retro_set_controller_port_device,
|
||||
* the core should call RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS to notify the
|
||||
* frontend if the descriptions for any controls have changed as a
|
||||
* result of changing the device type.
|
||||
*/
|
||||
RETRO_API void retro_set_controller_port_device(unsigned port, unsigned device);
|
||||
|
||||
/* Resets the current game. */
|
||||
@@ -2365,7 +2723,9 @@ 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);
|
||||
|
||||
/* Loads a "special" kind of game. Should not be used,
|
||||
@@ -2375,7 +2735,7 @@ RETRO_API bool retro_load_game_special(
|
||||
const struct retro_game_info *info, size_t num_info
|
||||
);
|
||||
|
||||
/* Unloads a currently loaded game. */
|
||||
/* Unloads the currently loaded game. Called before retro_deinit(void). */
|
||||
RETRO_API void retro_unload_game(void);
|
||||
|
||||
/* Gets region of game. */
|
||||
|
||||
@@ -65,6 +65,8 @@ int _newlib_vm_size_user = 1 << TARGET_SIZE_2;
|
||||
|
||||
#endif
|
||||
|
||||
#include "libretro_core_options.h"
|
||||
|
||||
#include <pico/pico_int.h>
|
||||
#include <pico/state.h>
|
||||
#include <pico/patch.h>
|
||||
@@ -588,34 +590,15 @@ void retro_set_environment(retro_environment_t cb)
|
||||
struct retro_vfs_interface_info vfs_iface_info;
|
||||
#endif
|
||||
|
||||
static const struct retro_variable vars[] = {
|
||||
{ "picodrive_input1", "Input device 1; 3 button pad|6 button pad|None" },
|
||||
{ "picodrive_input2", "Input device 2; 3 button pad|6 button pad|None" },
|
||||
{ "picodrive_sprlim", "No sprite limit; disabled|enabled" },
|
||||
{ "picodrive_ramcart", "MegaCD RAM cart; disabled|enabled" },
|
||||
{ "picodrive_region", "Region; Auto|Japan NTSC|Japan PAL|US|Europe" },
|
||||
{ "picodrive_aspect", "Core-provided aspect ratio; PAR|4/3|CRT" },
|
||||
{ "picodrive_overscan", "Show Overscan; disabled|enabled" },
|
||||
{ "picodrive_overclk68k", "68k overclock; disabled|+25%|+50%|+75%|+100%|+200%|+400%" },
|
||||
#ifdef DRC_SH2
|
||||
{ "picodrive_drc", "Dynamic recompilers; enabled|disabled" },
|
||||
#endif
|
||||
{ "picodrive_audio_filter", "Audio filter; disabled|low-pass" },
|
||||
{ "picodrive_lowpass_range", "Low-pass filter %; 60|65|70|75|80|85|90|95|5|10|15|20|25|30|35|40|45|50|55"},
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
environ_cb = cb;
|
||||
|
||||
cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void *)vars);
|
||||
libretro_set_core_options(environ_cb);
|
||||
|
||||
#ifdef USE_LIBRETRO_VFS
|
||||
vfs_iface_info.required_interface_version = 1;
|
||||
vfs_iface_info.iface = NULL;
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VFS_INTERFACE, &vfs_iface_info))
|
||||
{
|
||||
filestream_vfs_init(&vfs_iface_info);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -825,8 +808,9 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code)
|
||||
char codeCopy[256];
|
||||
char *buff;
|
||||
|
||||
if (code=='\0') return;
|
||||
strcpy(codeCopy,code);
|
||||
if (*code == '\0')
|
||||
return;
|
||||
strcpy(codeCopy, code);
|
||||
buff = strtok(codeCopy,"+");
|
||||
|
||||
while (buff != NULL)
|
||||
|
||||
519
platform/libretro/libretro_core_options.h
Normal file
519
platform/libretro/libretro_core_options.h
Normal file
@@ -0,0 +1,519 @@
|
||||
#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[] = {
|
||||
{
|
||||
"picodrive_input1",
|
||||
"Input device 1",
|
||||
"Choose which kind of controller is plugged in slot 1.",
|
||||
{
|
||||
{ "3 button pad", NULL },
|
||||
{ "6 button pad", NULL },
|
||||
{ "None", NULL },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
"3 button pad"
|
||||
},
|
||||
{
|
||||
"picodrive_input2",
|
||||
"Input device 2",
|
||||
"Choose which kind of controller is plugged in slot 2.",
|
||||
{
|
||||
{ "3 button pad", NULL },
|
||||
{ "6 button pad", NULL },
|
||||
{ "None", NULL },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
"3 button pad"
|
||||
},
|
||||
{
|
||||
"picodrive_sprlim",
|
||||
"No sprite limit",
|
||||
"Enable this to remove the sprite limit.",
|
||||
{
|
||||
{ "disabled", NULL },
|
||||
{ "enabled", NULL },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
"disabled"
|
||||
},
|
||||
{
|
||||
"picodrive_ramcart",
|
||||
"MegaCD RAM cart",
|
||||
"Emulate a MegaCD RAM cart, used for save game data.",
|
||||
{
|
||||
{ "disabled", NULL },
|
||||
{ "enabled", NULL },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
"disabled"
|
||||
},
|
||||
{
|
||||
"picodrive_region",
|
||||
"Region",
|
||||
"Force a specific region.",
|
||||
{
|
||||
{ "Auto", NULL },
|
||||
{ "Japan NTSC", NULL },
|
||||
{ "Japan PAL", NULL },
|
||||
{ "US", NULL },
|
||||
{ "Europe", NULL },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
"Auto"
|
||||
},
|
||||
{
|
||||
"picodrive_aspect",
|
||||
"Core-provided aspect ratio",
|
||||
"Choose the core-provided aspect ratio. RetroArch's aspect ratio must be set to Core provided in the Video settings.",
|
||||
{
|
||||
{ "PAR", NULL },
|
||||
{ "4/3", NULL },
|
||||
{ "CRT", NULL },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
"PAR"
|
||||
},
|
||||
{
|
||||
"picodrive_overscan",
|
||||
"Show Overscan",
|
||||
"Crop out the potentially random glitchy video output that would have been hidden by the bezel around the edge of a standard-definition television screen.",
|
||||
{
|
||||
{ "disabled", NULL },
|
||||
{ "enabled", NULL },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
"disabled"
|
||||
},
|
||||
{
|
||||
"picodrive_overclk68k",
|
||||
"68K Overclock",
|
||||
"Overclock the emulated 68K chip.",
|
||||
{
|
||||
{ "disabled", NULL },
|
||||
{ "+25%", NULL },
|
||||
{ "+50%", NULL },
|
||||
{ "+75%", NULL },
|
||||
{ "+100%", NULL },
|
||||
{ "+200%", NULL },
|
||||
{ "+400%", NULL },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
"disabled"
|
||||
},
|
||||
#ifdef DRC_SH2
|
||||
{
|
||||
"picodrive_drc",
|
||||
"Dynamic recompilers",
|
||||
"Enable dynamic recompilers which help to improve performance. Less accurate than interpreter CPU cores, but much faster.",
|
||||
{
|
||||
{ "enabled", NULL },
|
||||
{ "disabled", NULL },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
"enabled"
|
||||
},
|
||||
#endif
|
||||
{
|
||||
"picodrive_audio_filter",
|
||||
"Audio filter",
|
||||
"Enable a low pass audio filter to better simulate the characteristic sound of a Model 1 Genesis. This option is ignored when running Master System and PICO titles. Only the Genesis and its add-on hardware (Sega CD, 32X) employed a physical low pass filter.",
|
||||
{
|
||||
{ "disabled", NULL },
|
||||
{ "low-pass", NULL },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
"disabled"
|
||||
},
|
||||
{
|
||||
"picodrive_lowpass_range",
|
||||
"Low-pass filter %",
|
||||
"Specify the cut-off frequency of the audio low pass filter. A higher value increases the perceived 'strength' of the filter, since a wider range of the high frequency spectrum is attenuated.",
|
||||
{
|
||||
{ "5", NULL },
|
||||
{ "10", NULL },
|
||||
{ "15", NULL },
|
||||
{ "20", NULL },
|
||||
{ "25", NULL },
|
||||
{ "30", NULL },
|
||||
{ "35", NULL },
|
||||
{ "40", NULL },
|
||||
{ "45", NULL },
|
||||
{ "50", NULL },
|
||||
{ "55", NULL },
|
||||
{ "60", NULL },
|
||||
{ "65", NULL },
|
||||
{ "70", NULL },
|
||||
{ "75", NULL },
|
||||
{ "80", NULL },
|
||||
{ "85", NULL },
|
||||
{ "90", NULL },
|
||||
{ "95", NULL },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
"60"
|
||||
},
|
||||
{ NULL, NULL, NULL, {{0}}, NULL },
|
||||
};
|
||||
|
||||
/* RETRO_LANGUAGE_JAPANESE */
|
||||
|
||||
/* RETRO_LANGUAGE_FRENCH */
|
||||
|
||||
struct retro_core_option_definition option_defs_fr[] = {
|
||||
{
|
||||
"pokemini_video_scale",
|
||||
"Échelle vidéo (redémarrer)",
|
||||
"Définir le facteur d'échelle vidéo interne. L'augmentation du facteur d'échelle améliore l'apparence du filtre LCD interne «Matrice de Points».",
|
||||
{
|
||||
{ NULL, NULL }, /* Scale factors do not require translation */
|
||||
},
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"pokemini_lcdfilter",
|
||||
"Filtre LCD",
|
||||
"Sélectionnez le filtre d'écran interne. «Matrice de Points» produit un effet LCD qui imite le matériel réel. Les filtres LCD sont désactivés lorsque «Échelle vidéo» est défini sur «1x».",
|
||||
{
|
||||
{ "dotmatrix", "Matrice de Points" },
|
||||
{ "scanline", "Lignes de Balayage" },
|
||||
{ "none", "Aucun" },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"pokemini_lcdmode",
|
||||
"Mode LCD",
|
||||
"Spécifiez les caractéristiques de reproduction 'couleur' en niveaux de gris de l'affichage à cristaux liquides émulé. «Analogique» imite le matériel réel. «2 Nuances» supprime les images fantômes, mais provoque un scintillement dans la plupart des jeux.",
|
||||
{
|
||||
{ "analog", "Analogique" },
|
||||
{ "3shades", "3 Nuances" },
|
||||
{ "2shades", "2 Nuances" },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"pokemini_lcdcontrast",
|
||||
"Contraste LCD",
|
||||
"Réglez le niveau de contraste de l'écran à cristaux liquides émulé.",
|
||||
{
|
||||
{ NULL, NULL }, /* Numbers do not require translation */
|
||||
},
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"pokemini_lcdbright",
|
||||
"Luminosité de l'écran LCD",
|
||||
"Définissez le décalage de luminosité de l'affichage à cristaux liquides émulé.",
|
||||
{
|
||||
{ NULL, NULL }, /* Numbers do not require translation */
|
||||
},
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"pokemini_palette",
|
||||
"Palette",
|
||||
"Spécifiez la palette utilisée pour 'coloriser' l'affichage à cristaux liquides émulé. «Défaut» imite le matériel réel.",
|
||||
{
|
||||
{ "Default", "Défaut" },
|
||||
{ "Old", "Vieux" },
|
||||
{ "Monochrome", "Noir et Blanc" },
|
||||
{ "Green", "Vert" },
|
||||
{ "Green Vector", "Vert Inversé" },
|
||||
{ "Red", "Rouge" },
|
||||
{ "Red Vector", "Rouge Inversé" },
|
||||
{ "Blue LCD", "LCD Bleu" },
|
||||
{ "LEDBacklight", "Rétro-éclairage LED" },
|
||||
{ "Girl Power", "Pouvoir des Filles" },
|
||||
{ "Blue", "Bleu" },
|
||||
{ "Blue Vector", "Bleu Inversé" },
|
||||
{ "Sepia", "Sépia" },
|
||||
{ "Monochrome Vector", "Noir et Blanc Inversé" },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"pokemini_piezofilter",
|
||||
"Filtre Piézo",
|
||||
"Utilisez un filtre audio pour simuler les caractéristiques du haut-parleur piézoélectrique du Pokemon Mini.",
|
||||
{
|
||||
{ NULL, NULL }, /* enabled/disabled strings do not require translation */
|
||||
},
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"pokemini_rumblelvl",
|
||||
"Niveau de Rumble (écran + contrôleur)",
|
||||
"Spécifiez l'ampleur de l'effet de retour de force, à la fois virtuel et physique.",
|
||||
{
|
||||
{ NULL, NULL }, /* Numbers do not require translation */
|
||||
},
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"pokemini_controller_rumble",
|
||||
"Contrôleur Rumble",
|
||||
"Activer l'effet de retour de force physique via le roulement du contrôleur.",
|
||||
{
|
||||
{ NULL, NULL }, /* enabled/disabled strings do not require translation */
|
||||
},
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"pokemini_screen_shake",
|
||||
"Secousse de l'écran",
|
||||
"Activez l'effet de retour de force virtuel en 'secouant' l'écran.",
|
||||
{
|
||||
{ NULL, NULL }, /* enabled/disabled strings do not require translation */
|
||||
},
|
||||
NULL
|
||||
},
|
||||
{ NULL, NULL, NULL, {{0}}, NULL },
|
||||
};
|
||||
|
||||
/* 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 num_options = 0;
|
||||
struct retro_variable *variables = NULL;
|
||||
char **values_buf = NULL;
|
||||
|
||||
/* Determine number of options */
|
||||
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;
|
||||
|
||||
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[i].key = key;
|
||||
variables[i].value = values_buf[i];
|
||||
}
|
||||
|
||||
/* 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
|
||||
Reference in New Issue
Block a user