libretro.drivers.environment.default¶
Default EnvironmentDriver mapping that ships with libretro.py.
See also
EnvironmentDriverThe protocol this implementation satisfies.
Classes
|
- class DefaultEnvironmentDriver[source]¶
Bases:
DictEnvironmentDriverEnvironmentDriverthat registers handlers for the standard environment calls.Subclasses implement the underscore-prefixed handler methods (
_set_rotation,_get_overscan, etc.) for each call they support.- __init__()[source]¶
Store
envcallsas the registered handler mapping.- Parameters:
envcalls – Mapping from
EnvironmentCallto a callback that handles it.
- key in self¶
- iter(self)¶
- Return type:
- len(self)¶
- classmethod __new__(*args, **kwargs)¶
- abstractmethod audio_sample(left, right)¶
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:
- abstractmethod audio_sample_batch(data, frames)¶
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.
- 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.¶
- abstractmethod input_poll()¶
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:
- abstractmethod input_state(port, device, index, id)¶
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.
- 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¶
- abstractmethod video_refresh(data, width, height, pitch)¶
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: