mirror of
https://github.com/libretro/RetroArch
synced 2025-04-15 23:42:30 +00:00
Dont' try to access driver->video_context_data directly
This commit is contained in:
parent
41b46975f9
commit
1f87c6d9e2
@ -135,8 +135,8 @@ static void ctx_glx_destroy_resources(gfx_ctx_glx_data_t *glx)
|
||||
|
||||
static void gfx_ctx_glx_destroy(void *data)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)driver->video_context_data;
|
||||
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)
|
||||
gfx_ctx_data_get_ptr();
|
||||
|
||||
if (!glx)
|
||||
return;
|
||||
@ -144,16 +144,13 @@ static void gfx_ctx_glx_destroy(void *data)
|
||||
(void)data;
|
||||
|
||||
ctx_glx_destroy_resources(glx);
|
||||
|
||||
if (driver->video_context_data)
|
||||
free(driver->video_context_data);
|
||||
driver->video_context_data = NULL;
|
||||
gfx_ctx_free_data();
|
||||
}
|
||||
|
||||
static void gfx_ctx_glx_swap_interval(void *data, unsigned interval)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)driver->video_context_data;
|
||||
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)
|
||||
gfx_ctx_data_get_ptr();
|
||||
|
||||
glx->g_interval = interval;
|
||||
|
||||
@ -178,9 +175,8 @@ static void gfx_ctx_glx_swap_interval(void *data, unsigned interval)
|
||||
|
||||
static void gfx_ctx_glx_swap_buffers(void *data)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)driver->video_context_data;
|
||||
(void)data;
|
||||
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)
|
||||
gfx_ctx_data_get_ptr();
|
||||
|
||||
if (glx->g_is_double)
|
||||
glXSwapBuffers(g_x11_dpy, glx->g_glx_win);
|
||||
@ -289,8 +285,9 @@ static bool gfx_ctx_glx_set_video_mode(void *data,
|
||||
XSetWindowAttributes swa = {0};
|
||||
int (*old_handler)(Display*, XErrorEvent*) = NULL;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)driver->video_context_data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)
|
||||
gfx_ctx_data_get_ptr();
|
||||
|
||||
x11_install_sighandlers();
|
||||
|
||||
@ -578,8 +575,8 @@ static void gfx_ctx_glx_show_mouse(void *data, bool state)
|
||||
|
||||
static void gfx_ctx_glx_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)driver->video_context_data;
|
||||
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)
|
||||
gfx_ctx_data_get_ptr();
|
||||
|
||||
if (!glx)
|
||||
return;
|
||||
|
@ -207,8 +207,8 @@ static void gfx_ctx_ps3_update_window_title(void *data)
|
||||
static void gfx_ctx_ps3_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*)driver->video_context_data;
|
||||
gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*)
|
||||
gfx_ctx_data_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
||||
@ -327,8 +327,8 @@ static void gfx_ctx_ps3_destroy_resources(gfx_ctx_ps3_data_t *ps3)
|
||||
|
||||
static void gfx_ctx_ps3_destroy(void *data)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*)driver->video_context_data;
|
||||
gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*)
|
||||
gfx_ctx_data_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
||||
@ -337,9 +337,7 @@ static void gfx_ctx_ps3_destroy(void *data)
|
||||
|
||||
gfx_ctx_ps3_destroy_resources(ps3);
|
||||
|
||||
if (driver->video_context_data)
|
||||
free(driver->video_context_data);
|
||||
driver->video_context_data = NULL;
|
||||
gfx_ctx_free_data();
|
||||
}
|
||||
|
||||
static void gfx_ctx_ps3_input_driver(void *data,
|
||||
|
@ -111,8 +111,7 @@ error:
|
||||
|
||||
static void sdl_ctx_destroy(void *data)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)driver->video_context_data;
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)gfx_ctx_data_get_ptr();
|
||||
|
||||
if (!sdl)
|
||||
return;
|
||||
@ -120,10 +119,7 @@ static void sdl_ctx_destroy(void *data)
|
||||
(void)data;
|
||||
|
||||
sdl_ctx_destroy_resources(sdl);
|
||||
|
||||
if (driver->video_context_data)
|
||||
free(driver->video_context_data);
|
||||
driver->video_context_data = NULL;
|
||||
gfx_ctx_free_data();
|
||||
}
|
||||
|
||||
static bool sdl_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major,
|
||||
@ -172,7 +168,7 @@ static bool sdl_ctx_set_video_mode(void *data, unsigned width, unsigned height,
|
||||
unsigned fsflag = 0;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)driver->video_context_data;
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)gfx_ctx_data_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
||||
@ -242,7 +238,7 @@ static void sdl_ctx_get_video_size(void *data,
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)driver->video_context_data;
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)gfx_ctx_data_get_ptr();
|
||||
|
||||
if (!sdl)
|
||||
return;
|
||||
@ -279,9 +275,8 @@ static void sdl_ctx_update_window_title(void *data)
|
||||
{
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)driver->video_context_data;
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)gfx_ctx_data_get_ptr();
|
||||
|
||||
if (!sdl)
|
||||
return;
|
||||
@ -303,8 +298,7 @@ static void sdl_ctx_check_window(void *data, bool *quit, bool *resize,unsigned *
|
||||
unsigned *height, unsigned frame_count)
|
||||
{
|
||||
SDL_Event event;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)driver->video_context_data;
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)gfx_ctx_data_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
||||
@ -367,8 +361,7 @@ static bool sdl_ctx_has_focus(void *data)
|
||||
unsigned flags;
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)driver->video_context_data;
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)gfx_ctx_data_get_ptr();
|
||||
flags = (SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS);
|
||||
return (SDL_GetWindowFlags(sdl->g_win) & flags) == flags;
|
||||
#else
|
||||
@ -395,8 +388,7 @@ static bool sdl_ctx_has_windowed(void *data)
|
||||
static void sdl_ctx_swap_buffers(void *data)
|
||||
{
|
||||
#ifdef HAVE_SDL2
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)driver->video_context_data;
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)gfx_ctx_data_get_ptr();
|
||||
SDL_GL_SwapWindow(sdl->g_win);
|
||||
#else
|
||||
SDL_GL_SwapBuffers();
|
||||
|
@ -65,9 +65,8 @@ static void shell_surface_handle_configure(void *data,
|
||||
struct wl_shell_surface *shell_surface,
|
||||
uint32_t edges, int32_t width, int32_t height)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)
|
||||
driver->video_context_data;
|
||||
gfx_ctx_data_get_ptr();
|
||||
|
||||
(void)data;
|
||||
(void)shell_surface;
|
||||
@ -97,9 +96,8 @@ static const struct wl_shell_surface_listener shell_surface_listener = {
|
||||
static void registry_handle_global(void *data, struct wl_registry *reg,
|
||||
uint32_t id, const char *interface, uint32_t version)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)
|
||||
driver->video_context_data;
|
||||
gfx_ctx_data_get_ptr();
|
||||
|
||||
(void)data;
|
||||
(void)version;
|
||||
@ -169,9 +167,8 @@ static void gfx_ctx_wl_destroy_resources(gfx_ctx_wayland_data_t *wl)
|
||||
static void flush_wayland_fd(void)
|
||||
{
|
||||
struct pollfd fd = {0};
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)
|
||||
driver->video_context_data;
|
||||
gfx_ctx_data_get_ptr();
|
||||
|
||||
wl_display_dispatch_pending(wl->g_dpy);
|
||||
wl_display_flush(wl->g_dpy);
|
||||
@ -221,9 +218,8 @@ static void gfx_ctx_wl_check_window(void *data, bool *quit,
|
||||
|
||||
static void gfx_ctx_wl_set_resize(void *data, unsigned width, unsigned height)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)
|
||||
driver->video_context_data;
|
||||
gfx_ctx_data_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
||||
@ -234,10 +230,9 @@ static void gfx_ctx_wl_update_window_title(void *data)
|
||||
{
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)
|
||||
driver->video_context_data;
|
||||
gfx_ctx_data_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
||||
@ -252,9 +247,8 @@ static void gfx_ctx_wl_update_window_title(void *data)
|
||||
static void gfx_ctx_wl_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)
|
||||
driver->video_context_data;
|
||||
gfx_ctx_data_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
||||
@ -384,9 +378,7 @@ error:
|
||||
if (wl)
|
||||
free(wl);
|
||||
|
||||
if (driver->video_context_data)
|
||||
free(driver->video_context_data);
|
||||
driver->video_context_data = NULL;
|
||||
gfx_ctx_free_data();
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -455,9 +447,8 @@ static EGLint *egl_fill_attribs(EGLint *attr)
|
||||
|
||||
static void gfx_ctx_wl_destroy(void *data)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)
|
||||
driver->video_context_data;
|
||||
gfx_ctx_data_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
||||
@ -466,9 +457,7 @@ static void gfx_ctx_wl_destroy(void *data)
|
||||
|
||||
gfx_ctx_wl_destroy_resources(wl);
|
||||
|
||||
if (driver->video_context_data)
|
||||
free(driver->video_context_data);
|
||||
driver->video_context_data = NULL;
|
||||
gfx_ctx_free_data();
|
||||
}
|
||||
|
||||
static bool gfx_ctx_wl_set_video_mode(void *data,
|
||||
@ -476,10 +465,9 @@ static bool gfx_ctx_wl_set_video_mode(void *data,
|
||||
bool fullscreen)
|
||||
{
|
||||
EGLint egl_attribs[16];
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)
|
||||
driver->video_context_data;
|
||||
EGLint *attr = NULL;
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)
|
||||
gfx_ctx_data_get_ptr();
|
||||
|
||||
egl_install_sighandlers();
|
||||
|
||||
@ -696,9 +684,8 @@ static const struct wl_pointer_listener pointer_listener = {
|
||||
static void seat_handle_capabilities(void *data,
|
||||
struct wl_seat *seat, unsigned caps)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)
|
||||
driver->video_context_data;
|
||||
gfx_ctx_data_get_ptr();
|
||||
|
||||
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !wl->g_wl_keyboard)
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
|
||||
};
|
||||
|
||||
|
||||
const void *gfx_ctx_data_get_ptr(void)
|
||||
void *gfx_ctx_data_get_ptr(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
|
@ -254,7 +254,7 @@ void gfx_ctx_input_driver(void *data,
|
||||
|
||||
retro_proc_address_t gfx_ctx_get_proc_address(const char *sym);
|
||||
|
||||
const void *gfx_ctx_data_get_ptr(void);
|
||||
void *gfx_ctx_data_get_ptr(void);
|
||||
|
||||
void gfx_ctx_free_data(void);
|
||||
|
||||
|
@ -800,7 +800,7 @@ bool video_driver_set_video_mode(unsigned width,
|
||||
return true;
|
||||
}
|
||||
|
||||
return gfx_ctx_set_video_mode(driver->video_context_data, width, height, fullscreen);
|
||||
return gfx_ctx_set_video_mode(gfx_ctx_data_get_ptr(), width, height, fullscreen);
|
||||
}
|
||||
|
||||
bool video_driver_get_video_output_size(unsigned *width, unsigned *height)
|
||||
@ -1467,14 +1467,14 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
|
||||
poke->get_video_output_next(video_data);
|
||||
return true;
|
||||
}
|
||||
return gfx_ctx_get_video_output_next(driver->video_context_data);
|
||||
return gfx_ctx_get_video_output_next(gfx_ctx_data_get_ptr());
|
||||
case RARCH_DISPLAY_CTL_GET_PREV_VIDEO_OUT:
|
||||
if (poke && poke->get_video_output_prev)
|
||||
{
|
||||
poke->get_video_output_prev(video_data);
|
||||
return true;
|
||||
}
|
||||
return gfx_ctx_get_video_output_next(driver->video_context_data);
|
||||
return gfx_ctx_get_video_output_next(gfx_ctx_data_get_ptr());
|
||||
case RARCH_DISPLAY_CTL_INIT:
|
||||
return init_video();
|
||||
case RARCH_DISPLAY_CTL_DEINIT:
|
||||
|
Loading…
x
Reference in New Issue
Block a user