libretro.drivers.environment.composite¶
Default EnvironmentDriver that composes per-feature drivers into a single dispatcher.
See also
EnvironmentDriverThe protocol this implementation satisfies.
Classes
|
- class CompositeEnvironmentDriver[source]¶
Bases:
DefaultEnvironmentDriver,GenericEnvironmentDriverthat composes individual feature drivers into one dispatcher.Each constructor argument supplies the driver responsible for one libretro subsystem (audio, input, video, etc.);
Noneindicates the subsystem is not provided and the corresponding environment calls will returnfalse.- __init__(audio, input, video, content=None, overscan=None, message=None, options=None, path=None, rumble=None, sensor=None, camera=None, log=None, perf=None, location=None, user=None, vfs=None, led=None, av_enable=None, midi=None, timing=None, preferred_hw=None, driver_switch_enable=None, savestate_context=None, jit_capable=None, mic=None, device_power=None)[source]¶
Store
envcallsas the registered handler mapping.- Parameters:
envcalls – Mapping from
EnvironmentCallto a callback that handles it.
- property audio¶
Return the
AudioDriversupplied at construction time.
- property input¶
Return the
InputDriversupplied at construction time.
- property video¶
Return the
VideoDriversupplied at construction time.
- property content¶
Return the
ContentDriversupplied at construction time, orNoneif absent.
- property sensor¶
Return the
SensorDriversupplied at construction time, orNoneif absent.
- property camera¶
Return the
CameraDriversupplied at construction time, orNoneif absent.
- property user¶
Return the
UserDriversupplied at construction time, orNoneif absent.
- property path¶
Return the
PathDriversupplied at construction time, orNoneif absent.
- property timing¶
Return the
TimingDriversupplied at construction time, orNoneif absent.
- property rumble¶
Return the
RumbleDriversupplied at construction time, orNoneif absent.
- video_refresh(data, width, height, pitch)[source]¶
Receive one frame of video output from the core.
- Parameters:
data (
c_void_ptr) – Pointer to the frame buffer in the core’s current pixel format, orNoneif the core asked the frontend to duplicate the previous frame.width (
int) – Width of the frame in pixels.height (
int) – Height of the frame in pixels.pitch (
int) – Number of bytes per scanline indata.
See also
retro_video_refresh_tThe C function pointer type whose signature this method implements.
- Return type:
- audio_sample(left, right)[source]¶
Receive a single stereo audio sample from the core.
- Parameters:
See also
retro_audio_sample_tThe C function pointer type whose signature this method implements.
- Return type:
- audio_sample_batch(data, frames)[source]¶
Receive a batch of interleaved stereo audio frames from the core.
- Parameters:
data (
LP_c_short) – Pointer to interleaved signed 16-bit stereo samples.frames (
int) – Number of stereo frames available indata.
- Return type:
- Returns:
The number of frames consumed.
See also
retro_audio_sample_batch_tThe C function pointer type whose signature this method implements.
- input_poll()[source]¶
Poll input devices for new input state.
Called by the core once per frame before any
input_state()queries.See also
retro_input_poll_tThe C function pointer type whose signature this method implements.
- Return type:
- input_state(port, device, index, id)[source]¶
Return the current input state for a given device control.
- Parameters:
- Return type:
- Returns:
The control’s current state, encoded per libretro’s input conventions.
See also
retro_input_state_tThe C function pointer type whose signature this method implements.
- property rotation¶
Return the screen
Rotationcurrently set on the underlyingVideoDriver.See also
EnvironmentCall.SET_ROTATIONThe environment call that updates this value.
- property overscan¶
Return whether the frontend wants overscan to be visible, or
Noneif unset.See also
EnvironmentCall.GET_OVERSCANThe environment call that queries this value.
- property can_dupe¶
Return whether the underlying
VideoDriversupports frame duping.See also
EnvironmentCall.GET_CAN_DUPEThe environment call that queries this value.
- property message¶
Return the
MessageDriversupplied at construction time, orNoneif absent.
- property is_shutdown¶
Return
Trueif the core has requested a shutdown via the environment call.See also
EnvironmentCall.SHUTDOWNThe environment call that flips this flag.
- property performance_level¶
Return the performance level the core has reported, or
Noneif unset.See also
EnvironmentCall.SET_PERFORMANCE_LEVELThe environment call that sets this value.
- property pixel_format¶
Return the
PixelFormatcurrently set on the underlyingVideoDriver.See also
EnvironmentCall.SET_PIXEL_FORMATThe environment call that updates this value.
- property input_descriptors¶
Return the input descriptors registered by the core, or
Noneif none were set.See also
EnvironmentCall.SET_INPUT_DESCRIPTORSThe environment call that registers these descriptors.
- property keyboard_callback¶
Return the keyboard callback registered by the core, or
Noneif none was set.See also
EnvironmentCall.SET_KEYBOARD_CALLBACKThe environment call that registers this callback.
- property options¶
Return the
OptionDriversupplied at construction time, orNoneif absent.
- property support_no_game¶
Return whether the core can run without content, or
Noneif no content driver is set.See also
EnvironmentCall.SET_SUPPORT_NO_GAMEThe environment call that sets this value.
- property perf¶
Return the
PerfDriversupplied at construction time, orNoneif absent.
- property location¶
Return the
LocationDriversupplied at construction time, orNoneif absent.
- property proc_address_callback¶
Return the
retro_get_proc_address_interfaceregistered by the core, if any.See also
EnvironmentCall.SET_PROC_ADDRESS_CALLBACKThe environment call that registers this interface.
- get_proc_address(sym, funtype=None)[source]¶
- Overloads:
self, sym (str | bytes), funtype (type[T]) → T | None
self, sym (str | bytes), funtype (None) → retro_proc_address_t | None
self, sym (Literal[b’’, ‘’]), funtype (type[_CFunctionType] | None) → None
self, sym (str | bytes), funtype (type[TypedFunctionPointer[R, P]]) → TypedFunctionPointer[R, P] | None
Look up a function pointer the core exposed via its proc-address interface.
- Parameters:
sym – The name of the symbol to look up; an empty name returns
None.funtype – An optional
ctypesfunction type to cast the returned pointer to; if omitted, a genericretro_proc_address_tis returned.
- Returns:
The requested function pointer cast to
funtype, orNoneif the core has not registered a proc-address interface, the symbol is empty, or the lookup failed.
- property subsystems¶
Return the subsystem info the core registered, or
Noneif no content driver is set.See also
EnvironmentCall.SET_SUBSYSTEM_INFOThe environment call that registers this information.
- property controller_info¶
Return the controller descriptions the core registered, or
Noneif none were set.See also
EnvironmentCall.SET_CONTROLLER_INFOThe environment call that registers this information.
- property memory_maps¶
Return the memory map the core registered, or
Noneif none was set.See also
EnvironmentCall.SET_MEMORY_MAPSThe environment call that registers this information.
- property geometry¶
Return the current frame geometry from the underlying
VideoDriver.See also
EnvironmentCall.SET_GEOMETRYThe environment call that updates this value.
- property support_achievements¶
Return whether the core supports achievements, or
Noneif it has not declared.See also
EnvironmentCall.SET_SUPPORT_ACHIEVEMENTSThe environment call that sets this value.
- property serialization_quirks¶
Return the
SerializationQuirksthe core declared, orNoneif unset.See also
EnvironmentCall.SET_SERIALIZATION_QUIRKSThe environment call that sets these flags.
Return whether the underlying
VideoDriveris configured for a shared HW context.See also
EnvironmentCall.SET_HW_SHARED_CONTEXTThe environment call that enables shared-context mode.
- property vfs¶
Return the
FileSystemDriversupplied at construction time, orNoneif absent.
- property av_enable¶
Return the
AvEnableFlagsthe frontend exposes to the core, orNoneif unset.See also
EnvironmentCall.GET_AUDIO_VIDEO_ENABLEThe environment call that queries this value.
- property midi¶
Return the
MidiDriversupplied at construction time, orNoneif absent.
- property input_bitmasks¶
Return whether the underlying
InputDriversupports input bitmasks.See also
EnvironmentCall.GET_INPUT_BITMASKSThe environment call that queries this value.
- property core_options_version¶
Return the core-options API version supported by the option driver, or
Noneif absent.See also
EnvironmentCall.GET_CORE_OPTIONS_VERSIONThe environment call that queries this value.
- property preferred_hw_render¶
Return the preferred
HardwareContextexposed to the core, orNoneif unset.See also
EnvironmentCall.GET_PREFERRED_HW_RENDERThe environment call that queries this value.
- property savestate_context¶
Return the
SavestateContextthe frontend exposes to the core, orNoneif unset.See also
EnvironmentCall.GET_SAVESTATE_CONTEXTThe environment call that queries this value.
- key in self¶
- iter(self)¶
- Return type:
- len(self)¶
- classmethod __new__(*args, **kwargs)¶
- environment(cmd, data)¶
Dispatch an environment call from the core.
Implementations route
cmdto the appropriate_<env_call_name>helper (e.g._get_variableforRETRO_ENVIRONMENT_GET_VARIABLE) and returnTrueif the call was handled successfully.- Parameters:
- Return type:
- Returns:
Trueif the call was handled,Falseif the command is unsupported or failed.
See also
retro_environment_tThe C function pointer type whose signature this method implements.
- get(k[, d]) D[k] if k in D, else d. d defaults to None.¶
- items() a set-like object providing a view on D's items¶
- keys() a set-like object providing a view on D's keys¶
- static return_on_raise(default)¶
Ctypes doesn’t propagate exceptions out of callbacks, so this is necessary to detect an error in a driver instead of just swallowing it with a warning.
- values() an object providing a view on D's values¶
- property jit_capable¶
Return whether the frontend permits JIT compilation, or
Noneif unset.See also
EnvironmentCall.GET_JIT_CAPABLEThe environment call that queries this value.
- property mic¶
Return the
MicrophoneDriversupplied at construction time, orNoneif absent.
- property power¶
Return the
PowerDriversupplied at construction time, orNoneif absent.