libretro.api.savestate

Types that define serialization quirks and savestate contexts.

Module Attributes

retro_savestate_context

Corresponds to retro_savestate_context in libretro.h.

Classes

SavestateContext

Denotes what a savestate returned by a Core will be used for.

SerializationQuirks

Flags describing quirks of a core's serialization (savestate) support.

class SerializationQuirks[source]

Bases: IntFlag

Flags describing quirks of a core’s serialization (savestate) support.

Corresponds to the RETRO_SERIALIZATION_QUIRK_* constants in libretro.h.

INCOMPLETE = 1

Set by the Core to indicate that serialized state is incomplete in some way.

The Core should set this bit if serialization is usable for the common case of saving and loading game state, but not for frame-sensitive frontend features such as netplay or rerecording.

MUST_INITIALIZE = 2

Set by the Core to indicate that it must perform some initialization before Core.serialize() returns non-None.

CORE_VARIABLE_SIZE = 4

Set by the Core to indicate that the return value of Core.serialize_size() may change within a single session.

FRONTEND_VARIABLE_SIZE = 8

Set by libretro.py to indicate that it supports cores that set CORE_VARIABLE_SIZE.

SINGLE_SESSION = 16

Set by the Core to indicate that savestates are only valid within a single session.

ENDIAN_DEPENDENT = 32

Set by the Core to indicate that savestates can’t be loaded on a platform with a different endianness than the one they were created on.

__new__(value)
other in self

Returns True if self has at least the same flags set as other.

iter(self)

Returns flags in definition order.

len(self)

Return the number of members (no aliases)

PLATFORM_DEPENDENT = 64

Set by the Core to indicate that its savestates can’t be loaded on a different platform than the one they were created on for reasons besides endianness, such as pointer size or structure packing differences.

classmethod self[name]

Return the member matching name.

__init__()
ALL = 127
class SavestateContext[source]

Bases: IntEnum

Denotes what a savestate returned by a Core will be used for.

Corresponds to the RETRO_SAVESTATE_CONTEXT_* constants in libretro.h.

__new__(value)
classmethod value in self

Return True if value is in cls.

value is in cls if: 1) value is a member of cls, or 2) value is the value of one of the cls’s members. 3) value is a pseudo-member (flags)

classmethod self[name]

Return the member matching name.

__init__()
classmethod iter(self)

Return members in definition order.

classmethod len(self)

Return the number of members (no aliases)

NORMAL = 0

Standard savestate written to disk.

RUNAHEAD_SAME_INSTANCE = 1

Denotes a savestate that is suitable for same-instance runahead. This means that you should only use the savestate within a single session and not send it to disk or across the network.

RUNAHEAD_SAME_BINARY = 2

Denotes a savestate that is suitable for second-instance runahead. This means that it shouldn’t contain pointers.

ROLLBACK_NETPLAY = 3

Denotes a savestate that is suitable for rollback netplay. Must not contain pointers, and integers must be in big-endian format.

retro_savestate_context

Corresponds to retro_savestate_context in libretro.h.