Add disk control interface API extension #10019
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a relatively small and simple API extension required to address the remaining limitations/shortcomings of the disk control interface.
At present, the disk control interface is defined by passing a
retro_disk_control_callback
struct toRETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE
. This PR adds two new environment callbacks:RETRO_ENVIRONMENT_GET_DISK_CONTROL_INTERFACE_VERSION
: Returns the disk control interface API version. With this PR, the version number is1
. In legacy code, the version number is0
RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE
: If the disk control interface version is >= 1, the interface may alternatively be defined by passing aretro_disk_control_ext_callback
struct toRETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE
. This provides the following additional (and optional) functions:set_initial_image(unsigned index, const char *path)
: Note that this is not currently wired up inside RetroArch - but when it is, it will allow the frontend to select a particular disk image when loading content. This means that we will be able to automatically choose the last selected disk when running content via an M3U playlist (I will work on this next week)get_image_path(unsigned index, char *path, size_t len)
: allows the frontend to fetch the actual file path of the specified diskget_image_label(unsigned index, char *label, size_t len)
: Allows the frontend to fetch a core-generated 'label' to associate with each disk when displaying theCurrent Disk Index
drop-down listThe
get_image_label
functionality is fully enabled, and I have implemented it in the P-UAE core as a test case. This addresses a particularly annoying issue when running 'complex' content, which may consist of multiple disks with specific identifiers. For example: a game may prompt the user for adata
disk, or alevel
disk or somesuch; yet what is the user meant to do when all RetroArch provides is the following:With this API extension, a core can instead produce this:
or this:
and so on.