mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 09:39:56 +00:00
Update libretro camera API.
Need initialized/deinitialized callbacks to properly handle driver reinit.
This commit is contained in:
parent
5c89e9106a
commit
271939875a
11
driver.c
11
driver.c
@ -590,7 +590,7 @@ void global_init_drivers(void)
|
||||
find_input_driver();
|
||||
init_video_input();
|
||||
|
||||
for(i = 0; i < MAX_PLAYERS; i++)
|
||||
for (i = 0; i < MAX_PLAYERS; i++)
|
||||
if (driver.input->set_keybinds)
|
||||
driver.input->set_keybinds(driver.input_data, g_settings.input.device[i], i, 0,
|
||||
(1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS));
|
||||
@ -613,6 +613,8 @@ void global_uninit_drivers(void)
|
||||
#ifdef HAVE_CAMERA
|
||||
if (driver.camera && driver.camera_data)
|
||||
{
|
||||
if (g_extern.system.camera_callback.deinitialized)
|
||||
g_extern.system.camera_callback.deinitialized();
|
||||
driver.camera->free(driver.camera_data);
|
||||
driver.camera_data = NULL;
|
||||
}
|
||||
@ -647,6 +649,9 @@ void init_camera(void)
|
||||
RARCH_ERR("Failed to initialize camera driver. Will continue without camera.\n");
|
||||
g_extern.camera_active = false;
|
||||
}
|
||||
|
||||
if (g_extern.system.camera_callback.initialized)
|
||||
g_extern.system.camera_callback.initialized();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -714,7 +719,11 @@ void init_drivers(void)
|
||||
void uninit_camera(void)
|
||||
{
|
||||
if (driver.camera_data && driver.camera)
|
||||
{
|
||||
if (g_extern.system.camera_callback.deinitialized)
|
||||
g_extern.system.camera_callback.deinitialized();
|
||||
driver.camera->free(driver.camera_data);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
11
libretro.h
11
libretro.h
@ -586,6 +586,9 @@ enum retro_camera_buffer
|
||||
typedef bool (*retro_camera_start_t)(void);
|
||||
// Stops the camera driver. Can only be called in retro_run().
|
||||
typedef void (*retro_camera_stop_t)(void);
|
||||
// Callback which signals when the camera driver is initialized and/or deinitialized.
|
||||
// retro_camera_start_t can be called in initialized callback.
|
||||
typedef void (*retro_camera_lifetime_status_t)(void);
|
||||
// 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.
|
||||
@ -614,6 +617,14 @@ struct retro_camera_callback
|
||||
|
||||
retro_camera_frame_raw_framebuffer_t frame_raw_framebuffer; // Set by libretro core if raw framebuffer callbacks will be used.
|
||||
retro_camera_frame_opengl_texture_t frame_opengl_texture; // Set by libretro core if OpenGL texture callbacks will be used.
|
||||
|
||||
// Set by libretro core. Called after camera driver is initialized and ready to be started.
|
||||
// Can be NULL, in which this callback is not called.
|
||||
retro_camera_lifetime_status_t initialized;
|
||||
|
||||
// Set by libretro core. Called right before camera driver is deinitialized.
|
||||
// Can be NULL, in which this callback is not called.
|
||||
retro_camera_lifetime_status_t deinitialized;
|
||||
};
|
||||
|
||||
enum retro_rumble_effect
|
||||
|
Loading…
x
Reference in New Issue
Block a user