libretro.drivers.content.standard

The standard content driver that loads game files from disk or memory.

See also

libretro.api.content

Defines the game info structures and content loading types this driver handles.

Classes

StandardContentDriver

A ContentDriver that loads content from files on disk or from memory buffers.

class StandardContentDriver[source]

Bases: ContentDriver

A ContentDriver that loads content from files on disk or from memory buffers.

__init__(enable_extended_info=True)[source]
Parameters:

enable_extended_info (bool) – If True, the driver will provide extended content info to the core via RETRO_ENVIRONMENT_GET_GAME_INFO_EXT.

__del__()[source]

Clean up any persistent buffers that haven’t already been cleaned up.

property enable_extended_info

Whether to populate and expose retro_game_info_ext to the core via RETRO_ENVIRONMENT_GET_GAME_INFO_EXT.

property game_info_ext

The most recently loaded extended game info array, or None if extended info is disabled or no content has been loaded.

load(content)[source]

Load all content files.

Parameters:

content (TypeAliasType | SubsystemContent | None) –

May be one of the following:

  • None, which will result in no content being loaded.

  • A zipfile.Path object representing a file within a ZIP archive.

  • A str or a PathLike object representing a file path. The loaded content will not be part of a subsystem. If retro_system_info.need_fullpath is False and no override for this extension defines ContentAttributes.need_fullpath as True, the driver will load the content as a file. Otherwise, the path will be provided to the core without opening the file.

  • A bytes, bytearray, memoryview, or Buffer object that represents content data. The loaded content will be passed directly to the core without being set to a path.

  • A retro_game_info object, which will be passed to the core as-is.

  • A SubsystemContent object, which contains multiple content files that together form a subsystem.

Raises:
Return type:

Generator[tuple[retro_subsystem_info | None, Sequence[LoadedContentFile] | None]]

Returns:

A context manager that yields a tuple containing the subsystem info and a sequence of loaded content files. Non-persistent content files will be closed when the context manager exits.

Note

All files not marked as persistent will be closed when the context manager exits. The ones that are persistent will be closed when the driver is destroyed.

property system_info

The system info provided by the core.

See also

Core.get_system_info()

The method that cores use to provide this information.

property subsystem_info

Subsystem descriptors registered by the core, or None if none were registered.

property support_no_game

Whether the core supports being run without any content.

None if the core has not called RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME.

property overrides

Per-extension content-info overrides registered by the core.

classmethod __new__(*args, **kwargs)