libretro.api.disk¶
Types and callbacks for using the emulated system’s disk drives, if any.
Module Attributes
Open or close the emulated console's virtual disk tray. |
|
Return whether the emulated disk tray is currently open. |
|
Return the index of the currently inserted disk image. |
|
Insert the disk image at the given index into the emulated drive. |
|
Return the number of disk images available to the core. |
|
Replace the disk image at the given index with a new one. |
|
Add a new empty slot to the core's internal disk image list. |
|
Set the disk image to insert before content is loaded. |
|
Retrieve the filesystem path of a disk image. |
|
Retrieve a friendly display label for a disk image. |
Classes
Corresponds to |
|
Corresponds to |
- class retro_disk_control_callback[source]¶
Bases:
StructureCorresponds to
retro_disk_control_callbackinlibretro.h.A set of callbacks for basic disk image management.
>>> from libretro.api import retro_disk_control_callback >>> cb = retro_disk_control_callback() >>> cb.set_eject_state is None True
- set_eject_state¶
Opens or closes the virtual disk tray.
- get_eject_state¶
Returns the current eject state of the disk tray.
- get_image_index¶
Returns the index of the currently inserted disk image.
- __init__(*args, **kwargs)¶
- classmethod __new__(*args, **kwargs)¶
- set_image_index¶
Selects a disk image by index.
- get_num_images¶
Returns the total number of available disk images.
- replace_image_index¶
Replaces the disk image at the given index.
- add_image_index¶
Adds a new empty disk image slot.
- __deepcopy__(_)[source]¶
Return a copy of this object. Intended for use with
copy.deepcopy().>>> import copy >>> from libretro.api import retro_disk_control_callback >>> cb = retro_disk_control_callback() >>> copy.deepcopy(cb).set_eject_state is None True
- class retro_disk_control_ext_callback[source]¶
Bases:
retro_disk_control_callbackCorresponds to
retro_disk_control_ext_callbackinlibretro.h.Extends
retro_disk_control_callbackwith additional functions for initial image selection, image paths, and labels.>>> from libretro.api import retro_disk_control_ext_callback >>> cb = retro_disk_control_ext_callback() >>> cb.set_initial_image is None True
- __init__(*args, **kwargs)¶
- classmethod __new__(*args, **kwargs)¶
- add_image_index¶
Adds a new empty disk image slot.
- get_eject_state¶
Returns the current eject state of the disk tray.
- get_image_index¶
Returns the index of the currently inserted disk image.
- get_num_images¶
Returns the total number of available disk images.
- replace_image_index¶
Replaces the disk image at the given index.
- set_eject_state¶
Opens or closes the virtual disk tray.
- set_image_index¶
Selects a disk image by index.
- set_initial_image¶
Sets the initial disk image to insert at startup. Optional.
- get_image_path¶
Retrieves the filesystem path of a disk image. Optional.
- get_image_label¶
Retrieves the display label of a disk image. Optional.
- __deepcopy__(_)[source]¶
Return a copy of this object. Intended for use with
copy.deepcopy().>>> import copy >>> from libretro.api import retro_disk_control_ext_callback >>> cb = retro_disk_control_ext_callback() >>> copy.deepcopy(cb).set_initial_image is None True
- retro_set_eject_state_t¶
Open or close the emulated console’s virtual disk tray.
Registered by the core and called by the frontend to swap the disk image currently inserted in the emulated drive. The frontend may only change the disk image index while the tray is open.
- Parameters:
- Returns:
Trueif the tray’s state was changed (or was already in that state),Falseif the core could not change it.
Corresponds to
retro_set_eject_state_tinlibretro.h.
- retro_get_eject_state_t¶
Return whether the emulated disk tray is currently open.
Registered by the core and called by the frontend.
Corresponds to
retro_get_eject_state_tinlibretro.h.
- retro_get_image_index_t¶
Return the index of the currently inserted disk image.
Registered by the core and called by the frontend.
- Returns:
The index of the inserted disk image (starting at 0), or a value greater than or equal to the result of
retro_get_num_images_tif no disk is inserted.
Corresponds to
retro_get_image_index_tinlibretro.h.
- retro_set_image_index_t¶
Insert the disk image at the given index into the emulated drive.
Registered by the core and called by the frontend. May only be called while the tray is open.
- Parameters:
index – Index of the disk image to insert, starting at 0. A value greater than or equal to the result of
retro_get_num_images_trepresents removing the disk without inserting another.- Returns:
Trueif the disk image was successfully set,Falseif the tray is closed or another error occurred.
Corresponds to
retro_set_image_index_tinlibretro.h.
- retro_get_num_images_t¶
Return the number of disk images available to the core.
Registered by the core and called by the frontend.
- Returns:
The number of available disk images.
Corresponds to
retro_get_num_images_tinlibretro.h.
- retro_replace_image_index_t¶
Replace the disk image at the given index with a new one.
Registered by the core and called by the frontend while the tray is open. Passing
Noneforinforemoves the image atindexfrom the playlist.- Parameters:
index – Index of the disk image to replace.
info – Pointer to a
retro_game_infodescribing the new disk image, orNoneto remove the image atindexfrom the playlist.
- Returns:
Trueif the disk image was successfully replaced or removed,Falseif the tray is closed or another error occurred.
Corresponds to
retro_replace_image_index_tinlibretro.h.
- retro_add_image_index_t¶
Add a new empty slot to the core’s internal disk image list.
Registered by the core and called by the frontend. The new slot must be populated with
retro_replace_image_index_tbefore it can be used.Corresponds to
retro_add_image_index_tinlibretro.h.
- retro_set_initial_image_t¶
Set the disk image to insert before content is loaded.
Registered by the core and called by the frontend immediately before
Core.load_game(), so that the correct disk image from a multi-disk playlist is inserted into the emulated drive.- Parameters:
index – Index of the disk image to insert at startup.
path – Filesystem path of the disk image to insert, used by the core to validate that
indexrefers to the expected image.
- Returns:
Trueif the initial image was set,Falseif the arguments are invalid or the core does not support this function.
Corresponds to
retro_set_initial_image_tinlibretro.h.
- retro_get_image_path_t¶
Retrieve the filesystem path of a disk image.
Registered by the core and called by the frontend.
- Parameters:
index – Index of the disk image whose path will be returned.
path – Buffer that receives the path, written as a
bytesstring (UTF-8 encoded if applicable).len – Size of the
pathbuffer in bytes.
- Returns:
Trueif a path was successfully written intopath,Falseotherwise.
Corresponds to
retro_get_image_path_tinlibretro.h.
- retro_get_image_label_t¶
Retrieve a friendly display label for a disk image.
Registered by the core and called by the frontend to obtain a human-readable label that helps the player choose which disk image to insert.
- Parameters:
index – Index of the disk image whose label will be returned.
path – Buffer that receives the label, written as a
bytesstring.len – Size of the
pathbuffer in bytes.
- Returns:
Trueif a label was successfully written intopath,Falseotherwise.
Corresponds to
retro_get_image_label_tinlibretro.h.