Retro.Core

g GObject.Object GObject.Object Retro.Core Retro.Core GObject.Object->Retro.Core

Subclasses:None

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
class new (filename)
  boot ()
  get_api_version ()
  get_can_access_state ()
  get_content_directory ()
  get_filename ()
  get_frames_per_second ()
  get_game_loaded ()
  get_is_initiated ()
  get_memory (memory_type)
  get_memory_size (memory_type)
  get_option (key)
  get_runahead ()
  get_save_directory ()
  get_state ()
  get_support_no_game ()
  get_system_directory ()
  has_option (key)
  iterate_controllers ()
  iterate_options ()
  reset ()
  run ()
  set_content_directory (content_directory)
  set_controller (port, controller)
  set_current_media (media_index)
  set_default_controller (controller_type, controller)
  set_keyboard (widget)
  set_medias (uris)
  set_memory (memory_type, bytes)
  set_runahead (runahead)
  set_save_directory (save_directory)
  set_state (bytes)
  set_system_directory (system_directory)

Virtual Methods

Inherited:GObject.Object (7)

Properties

Name Type Flags Short Description
api-version int r The API version
content-directory str r/w The content directory
filename str r The module filename
frames-per-second float r The FPS rate for the core’s video output
game-loaded bool r Whether a game has been loaded
is-initiated bool r Whether the core has been initiated
runahead int r/w The number of frame to run ahead of time
save-directory str r/w The save directory
support-no-game bool r Whether the core supports running with no game
system-directory str r/w The system directory

Signals

Inherited:GObject.Object (1)
Name Short Description
audio-output The ::audio-output signal is emitted each time a new audio frame is emitted by the core.
log The ::log signal is emitted each time the core emits a message to log.
message The ::message signal is emitted each time the core emits a message to display during a given amount of frames.
options-set The ::options-set signal is emitted when the core sets the options during boot.
shutdown The ::shutdown signal is emitted when the core shut down.
video-output The ::video-output signal is emitted each time a new video frame is emitted by the core.

Fields

Inherited:GObject.Object (1)

Class Details

class Retro.Core(**kwargs)
Bases:GObject.Object
Abstract:No
Structure:Retro.CoreClass
classmethod new(filename)
Parameters:filename (str) – the filename of a Libretro core
Returns:a new Retro.Core
Return type:Retro.Core

Creates a new Retro.Core.

boot()
Raises:GLib.Error

This initializes self, loads its available options and loads the medias. You need to boot self before using some of its methods.

get_api_version()
Returns:the API version
Return type:int

Gets the Libretro API version implement by the core.

get_can_access_state()
Returns:whether the state of self can be accessed
Return type:bool

Gets whether the state of self can be accessed.

get_content_directory()
Return type:str
get_filename()
Returns:the filename of the core
Return type:str

Gets the filename of the core.

get_frames_per_second()
Returns:the FPS rate for the core’s video output
Return type:float

Gets the FPS rate for the core’s video output.

get_game_loaded()
Returns:whether a game has been loaded
Return type:bool

Gets whether a game has been loaded.

get_is_initiated()
Returns:whether the core has been initiated
Return type:bool

Gets whether the core has been initiated.

get_memory(memory_type)
Parameters:memory_type (Retro.MemoryType) – the type of memory
Returns:a GLib.Bytes, or None
Return type:GLib.Bytes

Gets a memory region of self.

get_memory_size(memory_type)
Parameters:memory_type (Retro.MemoryType) – the type of memory
Returns:the size of a memory region
Return type:int

Gets the size of a memory region of self.

get_option(key)
Parameters:key (str) – the key of the option
Returns:the option
Return type:Retro.Option

Gets the option for the given key.

get_runahead()
Return type:int
get_save_directory()
Returns:the save directory of the core
Return type:str

Gets the save directory of the core.

The core will save some data here.

get_state()
Raises:GLib.Error
Returns:a GLib.Bytes, or None
Return type:GLib.Bytes

Gets the state of self.

get_support_no_game()
Returns:whether the core supports running with no game
Return type:bool

Gets whether the core supports running with no game.

get_system_directory()
Returns:the system directory of the core
Return type:str

Gets the system directory of the core.

The core will look here for additional data, such as firmware ROMs or configuration files.

has_option(key)
Parameters:key (str) – the key of the option
Returns:whether the core has an option for the given key
Return type:bool

Gets whether the core has an option for the given key.

iterate_controllers()
Returns:a new Retro.ControllerIterator
Return type:Retro.ControllerIterator

Creates a new Retro.ControllerIterator which can be used to iterate through the controllers plugged into self.

iterate_options()
Returns:a new Retro.OptionIterator
Return type:Retro.OptionIterator

Creates a new Retro.OptionIterator which can be used to iterate through the options of self.

reset()

Resets self.

run()

Iterate self for a frame.

set_content_directory(content_directory)
Parameters:content_directory (str) –
set_controller(port, controller)
Parameters:

Plugs controller into the specified port number of self.

set_current_media(media_index)
Parameters:media_index (int) – the media index
Raises:GLib.Error

Sets the current media index.

You can use this after booting the core.

set_default_controller(controller_type, controller)
Parameters:

Uses controller as the default controller for the given type. When a port has no controller plugged plugged into it, the core will use the default controllers instead.

set_keyboard(widget)
Parameters:widget (Gtk.Widget or None) – a Gtk.Widget, or None

Sets the widget whose key events will be forwarded to self.

set_medias(uris)
Parameters:uris ([str]) – the URIs

Sets the medias to load into the core.

You can use this before booting the core.

set_memory(memory_type, bytes)
Parameters:

Sets a memory region of self.

set_runahead(runahead)
Parameters:runahead (int) –
set_save_directory(save_directory)
Parameters:save_directory (str) – the save directory

Sets the save directory of the core.

The core will save some data here.

set_state(bytes)
Parameters:bytes (GLib.Bytes) – a GLib.Bytes
Raises:GLib.Error

Sets the state of the self.

set_system_directory(system_directory)
Parameters:system_directory (str) – the system directory

Sets the system directory of the core.

The core will look here for additional data, such as firmware ROMs or configuration files.

Signal Details

Retro.Core.signals.audio_output(core, data, sample_rate)
Signal Name:

audio-output

Flags:

RUN_LAST

Parameters:
  • core (Retro.Core) – The object which received the signal
  • data (bytes) – the audio frame data
  • sample_rate (float) – the sample rate to play the frame

The ::audio-output signal is emitted each time a new audio frame is emitted by the core.

Retro.Core.signals.log(core, log_domain, log_level, message)
Signal Name:

log

Flags:

RUN_LAST

Parameters:
  • core (Retro.Core) – The object which received the signal
  • log_domain (str) – the log domain
  • log_level (GLib.LogLevelFlags) – the log level
  • message (str) – the message

The ::log signal is emitted each time the core emits a message to log.

Retro.Core.signals.message(core, message, frames)
Signal Name:

message

Flags:

RUN_LAST

Parameters:
  • core (Retro.Core) – The object which received the signal
  • message (str) – the message
  • frames (int) – the number of frames the message should be displayed
Returns:

whether the request got fulfilled

Return type:

bool

The ::message signal is emitted each time the core emits a message to display during a given amount of frames.

Retro.Core.signals.options_set(core)
Signal Name:options-set
Flags:RUN_LAST
Parameters:core (Retro.Core) – The object which received the signal

The ::options-set signal is emitted when the core sets the options during boot.

Retro.Core.signals.shutdown(core)
Signal Name:shutdown
Flags:RUN_LAST
Parameters:core (Retro.Core) – The object which received the signal
Returns:whether the request got fulfilled
Return type:bool

The ::shutdown signal is emitted when the core shut down.

The core must be released or re-started in order to function anew.

Retro.Core.signals.video_output(core, pixdata)
Signal Name:

video-output

Flags:

RUN_LAST

Parameters:

The ::video-output signal is emitted each time a new video frame is emitted by the core.

pixdata will be invalid after the signal emission, copy it in some way if you want to keep it.

Property Details

Retro.Core.props.api_version
Name:api-version
Type:int
Default Value:0
Flags:READABLE

The Libretro API version implement by the core.

Retro.Core.props.content_directory
Name:content-directory
Type:str
Default Value:None
Flags:READABLE, WRITABLE

The content directory

Retro.Core.props.filename
Name:filename
Type:str
Default Value:None
Flags:READABLE

The filename of the core.

Retro.Core.props.frames_per_second
Name:frames-per-second
Type:float
Default Value:0.0
Flags:READABLE

The FPS rate for the core’s video output.

Retro.Core.props.game_loaded
Name:game-loaded
Type:bool
Default Value:False
Flags:READABLE

Whether a game has been loaded.

Retro.Core.props.is_initiated
Name:is-initiated
Type:bool
Default Value:False
Flags:READABLE

Whether the core has been initiated.

Retro.Core.props.runahead
Name:runahead
Type:int
Default Value:0
Flags:READABLE, WRITABLE

The number of frame to run ahead of time.

Retro.Core.props.save_directory
Name:save-directory
Type:str
Default Value:None
Flags:READABLE, WRITABLE

The save directory of the core.

The core will save some data here.

Retro.Core.props.support_no_game
Name:support-no-game
Type:bool
Default Value:False
Flags:READABLE

Whether the core supports running with no game.

Retro.Core.props.system_directory
Name:system-directory
Type:str
Default Value:None
Flags:READABLE, WRITABLE

The system directory of the core.

The core will look here for additional data, such as firmware ROMs or configuration files.