aboutsummaryrefslogtreecommitdiff
path: root/frontend/libretro.h
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/libretro.h')
-rwxr-xr-x[-rw-r--r--]frontend/libretro.h88
1 files changed, 76 insertions, 12 deletions
diff --git a/frontend/libretro.h b/frontend/libretro.h
index 0c39e6e..b02855a 100644..100755
--- a/frontend/libretro.h
+++ b/frontend/libretro.h
@@ -333,6 +333,8 @@ enum retro_mod
RETROKMOD_DUMMY = INT_MAX // Ensure sizeof(enum) == sizeof(int)
};
+// If set, this call is not part of the public libretro API yet. It can change or be removed at any time.
+#define RETRO_ENVIRONMENT_EXPERIMENTAL 0x10000
// Environment commands.
#define RETRO_ENVIRONMENT_SET_ROTATION 1 // const unsigned * --
@@ -348,18 +350,7 @@ enum retro_mod
// Boolean value whether or not frontend supports frame duping,
// passing NULL to video frame callback.
//
-#define RETRO_ENVIRONMENT_GET_VARIABLE 4 // struct retro_variable * --
- // Interface to aquire user-defined information from environment
- // that cannot feasibly be supported in a multi-system way.
- // Mostly used for obscure,
- // specific features that the user can tap into when neseccary.
- //
-#define RETRO_ENVIRONMENT_SET_VARIABLES 5 // const struct retro_variable * --
- // Allows an implementation to signal the environment
- // which variables it might want to check for later using GET_VARIABLE.
- // 'data' points to an array of retro_variable structs terminated by a { NULL, NULL } element.
- // retro_variable::value should contain a human readable description of the key.
- //
+// Environ 4, 5 are no longer supported (GET_VARIABLE / SET_VARIABLES), and reserved to avoid possible ABI clash.
#define RETRO_ENVIRONMENT_SET_MESSAGE 6 // const struct retro_message * --
// Sets a message to be displayed in implementation-specific manner for a certain amount of 'frames'.
// Should not be used for trivial messages, which should simply be logged to stderr.
@@ -421,7 +412,80 @@ enum retro_mod
// Sets an interface which frontend can use to eject and insert disk images.
// This is used for games which consist of multiple images and must be manually
// swapped out by the user (e.g. PSX).
+#define RETRO_ENVIRONMENT_SET_HW_RENDER (14 | RETRO_ENVIRONMENT_EXPERIMENTAL)
+ // struct retro_hw_render_callback * --
+ // NOTE: This call is currently very experimental, and should not be considered part of the public API.
+ // The interface could be changed or removed at any time.
+ // Sets an interface to let a libretro core render with hardware acceleration.
+ // Should be called in retro_load_game().
+ // If successful, libretro cores will be able to render to a frontend-provided framebuffer.
+ // The size of this framebuffer will be at least as large as max_width/max_height provided in get_av_info().
+ // If HW rendering is used, pass only RETRO_HW_FRAME_BUFFER_VALID or NULL to retro_video_refresh_t.
+#define RETRO_ENVIRONMENT_GET_VARIABLE 15
+ // struct retro_variable * --
+ // Interface to aquire user-defined information from environment
+ // that cannot feasibly be supported in a multi-system way.
+ // 'key' should be set to a key which has already been set by SET_VARIABLES.
+ // 'data' will be set to a value or NULL.
+ //
+#define RETRO_ENVIRONMENT_SET_VARIABLES 16
+ // const struct retro_variable * --
+ // Allows an implementation to signal the environment
+ // which variables it might want to check for later using GET_VARIABLE.
+ // This allows the frontend to present these variables to a user dynamically.
+ // This should be called as early as possible (ideally in retro_set_environment).
+ //
+ // 'data' points to an array of retro_variable structs terminated by a { NULL, NULL } element.
+ // retro_variable::key should be namespaced to not collide with other implementations' keys. E.g. A core called 'foo' should use keys named as 'foo_option'.
+ // retro_variable::value should contain a human readable description of the key as well as a '|' delimited list of expected values.
+ // The number of possible options should be very limited, i.e. it should be feasible to cycle through options without a keyboard.
+ // First entry should be treated as a default.
+ //
+ // Example entry:
+ // { "foo_option", "Speed hack coprocessor X; false|true" }
+ //
+ // Text before first ';' is description. This ';' must be followed by a space, and followed by a list of possible values split up with '|'.
+ // Only strings are operated on. The possible values will generally be displayed and stored as-is by the frontend.
+ //
+#define RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE 17
+ // bool * --
+ // Result is set to true if some variables are updated by
+ // frontend since last call to RETRO_ENVIRONMENT_GET_VARIABLE.
+ // Variables should be queried with GET_VARIABLE.
+
+// Pass this to retro_video_refresh_t if rendering to hardware.
+// Passing NULL to retro_video_refresh_t is still a frame dupe as normal.
+#define RETRO_HW_FRAME_BUFFER_VALID ((void*)-1)
+
+// Invalidates the current HW context.
+// 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 init resources.
+typedef void (*retro_hw_context_reset_t)(void);
+// Gets current framebuffer which is to be rendered to. Could change every frame potentially.
+typedef uintptr_t (*retro_hw_get_current_framebuffer_t)(void);
+
+// Get a symbol from HW context.
+typedef void (*retro_proc_address_t)(void);
+typedef retro_proc_address_t (*retro_hw_get_proc_address_t)(const char *sym);
+
+enum retro_hw_context_type
+{
+ RETRO_HW_CONTEXT_NONE = 0,
+ RETRO_HW_CONTEXT_OPENGL, // OpenGL 2.x. Latest version available before 3.x+.
+ RETRO_HW_CONTEXT_OPENGLES2, // GLES 2.0
+
+ RETRO_HW_CONTEXT_DUMMY = INT_MAX
+};
+struct retro_hw_render_callback
+{
+ enum retro_hw_context_type context_type; // Which API to use. Set by libretro core.
+ retro_hw_context_reset_t context_reset; // Set by libretro core.
+ retro_hw_get_current_framebuffer_t get_current_framebuffer; // Set by frontend.
+ retro_hw_get_proc_address_t get_proc_address; // Set by frontend.
+ bool depth; // Set if render buffers should have depth component attached.
+};
// 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.