Macros

  • #define RETRO_DEVICE_SUBCLASS(base, id) (((id + 1) << RETRO_DEVICE_TYPE_SHIFT) | base)

Structs

Enums

Constants

Functions

  • Must return RETRO_API_VERSION. Used to validate ABI compatibility when the API is revised.
  • Gets region of memory.
  • Gets region of game.
  • Gets information about system audio/video timings and geometry. Can be called only after retro_load_game() has successfully completed. NOTE: The implementation of this function might not initialize every variable if needed. E.g. geom.aspect_ratio might not be initialized if core doesn’t desire a particular aspect ratio.
  • Gets statically known system info. Pointers provided in *info must be statically allocated. Can be called at any time, even before retro_init().
  • Library global initialization/deinitialization.
  • Loads a game. Return true to indicate successful loading and false to indicate load failure.
  • Loads a “special” kind of game. Should not be used, except in extreme cases.
  • Resets the current game.
  • Runs the game for one video frame. During retro_run(), input_poll callback must be called at least once.
  • Serializes internal state. If failed, or size is lower than retro_serialize_size(), it should return false, true otherwise.
  • Returns the amount of data the implementation requires to serialize internal state (save states). Between calls to retro_load_game() and retro_unload_game(), the returned size is never allowed to be larger than a previous returned value, to ensure that the frontend can allocate a save state buffer once.
  • Sets device to be used for player ‘port’. By default, RETRO_DEVICE_JOYPAD is assumed to be plugged into all available ports. Setting a particular device type is not a guarantee that libretro cores will only poll input based on that particular device type. It is only a hint to the libretro core when a core cannot automatically detect the appropriate input device type on its own. It is also relevant when a core can change its behavior depending on device type.
  • Sets callbacks. retro_set_environment() is guaranteed to be called before retro_init().
  • Unloads the currently loaded game. Called before retro_deinit(void).

Type Definitions

  • Adds a new valid index (get_num_images()) to the internal disk list. This will increment subsequent return values from get_num_images() by 1. This image index cannot be used until a disk image has been set with replace_image_index.
  • Notifies a libretro core of the current occupancy level of the frontend audio buffer.
  • Notifies libretro that audio data should be written.
  • Renders multiple audio frames in one go.
  • Renders a single audio frame. Should only be used if implementation generates a single sample at a time. Format is signed 16-bit native endian.
  • True: Audio driver in frontend is active, and callback is expected to be called regularily. False: Audio driver in frontend is paused or inactive. Audio callback will not be called until set_state has been called with true. Initial state is false (inactive).
  • A callback for when OpenGL textures are used.
  • A callback for raw framebuffer data. buffer points to an XRGB8888 buffer. Width, height and pitch are similar to retro_video_refresh_t. First pixel is top-left origin.
  • Callback which signals when the camera driver is initialized and/or deinitialized. retro_camera_start_t can be called in initialized callback.
  • Starts the camera driver. Can only be called in retro_run().
  • Stops the camera driver. Can only be called in retro_run().
  • Used by the frontend to monitor changes in core option visibility. May be called each time any core option value is set via the frontend.
  • Environment callback. Gives implementations a way of performing uncommon tasks. Extensible.
  • Returns a bit-mask of detected CPU features (RETRO_SIMD_*).
  • Gets current eject state. The initial state is ‘not ejected’.
  • Gets current disk index. First disk is index 0. If return value is >= get_num_images(), no disk is currently inserted.
  • Fetches a core-provided ‘label’ for the specified disk image file. In the simplest case this may be a file name (without extension), but for cores with more complex content requirements information may be provided to facilitate user disk swapping - for example, a core running floppy-disk-based content may uniquely label save disks, data disks, level disks, etc. with names corresponding to in-game disk change prompts (so the frontend can provide better user guidance than a ‘dumb’ disk index value). Returns ‘false’ if index is invalid (index >= get_num_images()) or label is otherwise unavailable.
  • Fetches the path of the specified disk image file. Returns ‘false’ if index is invalid (index >= get_num_images()) or path is otherwise unavailable.
  • Gets total number of images which are available to use.
  • libretro API extension functions: (None here so far).
  • Invalidates the current HW context. Any GL state is lost, and must not be deinitialized explicitly. If explicit deinitialization is desired by the libretro core, it should implement context_destroy callback. If called, all GPU resources must be reinitialized. Usually called when frontend reinits video driver. Also called first time video driver is initialized, allowing libretro core to initialize resources.
  • Gets current framebuffer which is to be rendered to. Could change every frame potentially.
  • Get a symbol from HW context.
  • Polls input.
  • Queries for input for player ‘port’. device will be masked with RETRO_DEVICE_MASK.
  • Callback type passed in RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK. Called by the frontend in response to keyboard events. down is set if the key is being pressed, or false if it is being released. keycode is the RETROK value of the char. character is the text character of the pressed key. (UTF-32). key_modifiers is a set of RETROKMOD values or’ed together.
  • Get the position of the current location. Will set parameters to 0 if no new location update has happened since the last time.
  • Callback which signals when the location driver is initialized and/or deinitialized. retro_location_start_t can be called in initialized callback.
  • Sets the interval of time and/or distance at which to update/poll location-based data.
  • Start location services. The device will start listening for changes to the current location at regular intervals (which are defined with retro_location_set_interval_t).
  • Stop location services. The device will stop listening for changes to the current location.
  • Logging function. Takes log level argument as well.
  • Flushes previously written data. Returns true if successful, false otherwise.
  • Retrieves the current state of the MIDI input. Returns true if it’s enabled, false otherwise.
  • Retrieves the current state of the MIDI output. Returns true if it’s enabled, false otherwise
  • Reads next byte from the input stream. Returns true if byte is read, false otherwise.
  • Writes byte to the output stream. ‘delta_time’ is in microseconds and represent time elapsed since previous write. Returns true if byte is written, false otherwise.
  • A simple counter. Usually nanoseconds, but can also be CPU cycles. Can be used directly if desired (when creating a more sophisticated performance counter system).
  • Returns current time in microseconds. Tries to use the most accurate timer available.
  • Asks frontend to log and/or display the state of performance counters. Performance counters can always be poked into manually as well.
  • Register a performance counter. ident field must be set with a discrete value and other values in retro_perf_counter must be 0. Registering can be called multiple times. To avoid calling to frontend redundantly, you can check registered field first.
  • Starts a registered counter.
  • Stops a registered counter.
  • Replaces the disk image associated with index. Arguments to pass in info have same requirements as retro_load_game(). Virtual disk tray must be ejected when calling this.
  • If ejected is true, “ejects” the virtual disk tray. When ejected, the disk image index can be set.
  • Sets image index. Can only be called when disk is ejected. The implementation supports setting “no disk” by using an index >= get_num_images().
  • Sets initial image to insert in drive when calling core_load_game(). Since we cannot pass the initial index when loading content (this would require a major API change), this is set by the frontend before calling the core’s retro_load_game()/retro_load_game_special() implementation. A core should therefore cache the index/path values and handle them inside retro_load_game()/retro_load_game_special().
  • Sets rumble state for joypad plugged in port ‘port’. Rumble effects are controlled independently, and setting e.g. strong rumble does not override weak rumble. Strength has a range of [0, 0xffff].
  • Notifies a libretro core of time spent since last invocation of retro_run() in microseconds.
  • Close the file and release its resources. Must be called if open_file returns non-NULL. Returns 0 on success, -1 on failure. Whether the call succeeds ot not, the handle passed as parameter becomes invalid and should no longer be used. Introduced in VFS API v1
  • Close the directory and release its resources. Must be called if opendir returns non-NULL. Returns 0 on success, -1 on failure. Whether the call succeeds ot not, the handle passed as parameter becomes invalid and should no longer be used. Introduced in VFS API v3
  • Get the name of the last entry read. Returns a string on success, or NULL for error. The returned string pointer is valid until the next call to readdir or closedir. Introduced in VFS API v3
  • Check if the last entry read was a directory. Returns true if it was, false otherwise (or on error). Introduced in VFS API v3
  • Flush pending writes to file, if using buffered IO. Returns 0 on sucess, or -1 on failure. Introduced in VFS API v1
  • Get path from opaque handle. Returns the exact same path passed to file_open when getting the handle Introduced in VFS API v1
  • Create the specified directory. Returns 0 on success, -1 on unknown failure, -2 if already exists. Introduced in VFS API v3
  • Open a file for reading or writing. If path points to a directory, this will fail. Returns the opaque file handle, or NULL for error. Introduced in VFS API v1
  • Open the specified directory for listing. Returns the opaque dir handle, or NULL for error. Support for the include_hidden argument may vary depending on the platform. Introduced in VFS API v3
  • Read data from a file. Returns the number of bytes read, or -1 for error. Introduced in VFS API v1
  • Read the directory entry at the current position, and move the read pointer to the next position. Returns true on success, false if already on the last entry. Introduced in VFS API v3
  • Delete the specified file. Returns 0 on success, -1 on failure Introduced in VFS API v1
  • Rename the specified file. Returns 0 on success, -1 on failure Introduced in VFS API v1
  • Set the current read/write position for the file. Returns the new position, -1 for error. Introduced in VFS API v1
  • Return the size of the file in bytes, or -1 for error. Introduced in VFS API v1
  • Stat the specified file. Retruns a bitmask of RETRO_VFS_STAT_* flags, none are set if path was not valid. Additionally stores file size in given variable, unless NULL is given. Introduced in VFS API v3
  • Get the current read / write position for the file. Returns -1 for error. Introduced in VFS API v1
  • Truncate file to specified size. Returns 0 on success or -1 on error Introduced in VFS API v2
  • Write data to a file. Returns the number of bytes written, or -1 for error. Introduced in VFS API v1
  • Render a frame. Pixel format is 15-bit 0RGB1555 native endian unless changed (see RETRO_ENVIRONMENT_SET_PIXEL_FORMAT).