mirror of
https://github.com/libretro/RetroArch
synced 2025-03-27 05:37:40 +00:00
Grab settings pointer only once inside wrapper 'input_driver' function
This commit is contained in:
parent
e29fcd566a
commit
666534cc74
@ -38,7 +38,6 @@
|
||||
|
||||
#include "../../frontend/drivers/platform_linux.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../runloop.h"
|
||||
|
||||
static enum gfx_ctx_api android_api = GFX_CTX_NONE;
|
||||
@ -366,10 +365,10 @@ static bool android_gfx_ctx_set_video_mode(void *data,
|
||||
}
|
||||
|
||||
static void android_gfx_ctx_input_driver(void *data,
|
||||
const char *joypad_name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
void *androidinput = input_android.init(settings->input.joypad_driver);
|
||||
void *androidinput = input_android.init(joypad_name);
|
||||
|
||||
*input = androidinput ? &input_android : NULL;
|
||||
*input_data = androidinput;
|
||||
|
@ -154,7 +154,9 @@ static void gfx_ctx_cgl_destroy(void *data)
|
||||
free(cgl);
|
||||
}
|
||||
|
||||
static void gfx_ctx_cgl_input_driver(void *data, const input_driver_t **input, void **input_data)
|
||||
static void gfx_ctx_cgl_input_driver(void *data,
|
||||
const char *name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
(void)data;
|
||||
(void)input;
|
||||
|
@ -588,10 +588,11 @@ static bool cocoagl_gfx_ctx_set_resize(void *data, unsigned width, unsigned heig
|
||||
return false;
|
||||
}
|
||||
|
||||
static void cocoagl_gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data)
|
||||
static void cocoagl_gfx_ctx_input_driver(void *data,
|
||||
const char *name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
(void)data;
|
||||
*input = NULL;
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "../drivers/d3d.h"
|
||||
#include "../common/win32_common.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../runloop.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../ui/ui_companion_driver.h"
|
||||
@ -182,15 +181,15 @@ static void gfx_ctx_d3d_destroy(void *data)
|
||||
}
|
||||
|
||||
static void gfx_ctx_d3d_input_driver(void *data,
|
||||
const char *name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
#ifdef _XBOX
|
||||
void *xinput = input_xinput.init(settings->input.joypad_driver);
|
||||
void *xinput = input_xinput.init(joypad_name);
|
||||
*input = xinput ? (const input_driver_t*)&input_xinput : NULL;
|
||||
*input_data = xinput;
|
||||
#else
|
||||
dinput = input_dinput.init(settings->input.joypad_driver);
|
||||
dinput = input_dinput.init(joypad_name);
|
||||
*input = dinput ? &input_dinput : NULL;
|
||||
*input_data = dinput;
|
||||
#endif
|
||||
|
@ -746,10 +746,10 @@ static void gfx_ctx_drm_destroy(void *data)
|
||||
}
|
||||
|
||||
static void gfx_ctx_drm_input_driver(void *data,
|
||||
const char *name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
(void)data;
|
||||
*input = NULL;
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
}
|
||||
|
||||
|
@ -222,23 +222,22 @@ static bool gfx_ctx_emscripten_bind_api(void *data,
|
||||
|
||||
|
||||
static void gfx_ctx_emscripten_input_driver(void *data,
|
||||
const char *name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
(void)data;
|
||||
void *rwebinput = NULL;
|
||||
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
|
||||
#ifndef HAVE_SDL2
|
||||
{
|
||||
void *rwebinput = input_rwebinput.init();
|
||||
rwebinput = input_rwebinput.init();
|
||||
|
||||
if (!rwebinput)
|
||||
return;
|
||||
if (!rwebinput)
|
||||
return;
|
||||
|
||||
*input = &input_rwebinput;
|
||||
*input_data = rwebinput;
|
||||
}
|
||||
*input = &input_rwebinput;
|
||||
*input_data = rwebinput;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,9 @@ static void gfx_ctx_null_destroy(void *data)
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void gfx_ctx_null_input_driver(void *data, const input_driver_t **input, void **input_data)
|
||||
static void gfx_ctx_null_input_driver(void *data,
|
||||
const char *name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
(void)data;
|
||||
(void)input;
|
||||
|
@ -155,10 +155,10 @@ error:
|
||||
}
|
||||
|
||||
static void gfx_ctx_khr_display_input_driver(void *data,
|
||||
const char *name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
(void)data;
|
||||
*input = NULL;
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
}
|
||||
|
||||
|
@ -226,10 +226,10 @@ error:
|
||||
}
|
||||
|
||||
static void gfx_ctx_mali_fbdev_input_driver(void *data,
|
||||
const char *name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
(void)data;
|
||||
*input = NULL;
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
}
|
||||
|
||||
|
@ -199,10 +199,10 @@ error:
|
||||
}
|
||||
|
||||
static void gfx_ctx_opendingux_input_driver(void *data,
|
||||
const char *name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
(void)data;
|
||||
*input = NULL;
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
}
|
||||
|
||||
|
@ -372,9 +372,10 @@ static void osmesa_ctx_swap_buffers(void *data, video_frame_info_t video_info)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void osmesa_ctx_input_driver(void *data, const input_driver_t **input, void **input_data)
|
||||
static void osmesa_ctx_input_driver(void *data,
|
||||
const char *name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
(void)data;
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
}
|
||||
|
@ -339,10 +339,10 @@ static void gfx_ctx_ps3_destroy(void *data)
|
||||
}
|
||||
|
||||
static void gfx_ctx_ps3_input_driver(void *data,
|
||||
const char *joypad_name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
void *ps3input = input_ps3.init(settings->input.joypad_driver);
|
||||
void *ps3input = input_ps3.init(joypad_name);
|
||||
|
||||
*input = ps3input ? &input_ps3 : NULL;
|
||||
*input_data = ps3input;
|
||||
|
@ -346,10 +346,10 @@ static bool gfx_ctx_qnx_set_video_mode(void *data,
|
||||
|
||||
|
||||
static void gfx_ctx_qnx_input_driver(void *data,
|
||||
const char *joypad_name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
void *qnxinput = input_qnx.init(settings->input.joypad_driver);
|
||||
void *qnxinput = input_qnx.init(joypad_name);
|
||||
|
||||
*input = qnxinput ? &input_qnx : NULL;
|
||||
*input_data = qnxinput;
|
||||
|
@ -391,10 +391,11 @@ static void sdl_ctx_swap_buffers(void *data, video_frame_info_t video_info)
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void sdl_ctx_input_driver(void *data, const input_driver_t **input, void **input_data)
|
||||
static void sdl_ctx_input_driver(void *data,
|
||||
const char *name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
(void)data;
|
||||
*input = NULL;
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
}
|
||||
|
||||
|
@ -451,10 +451,10 @@ static void gfx_ctx_vc_destroy(void *data)
|
||||
}
|
||||
|
||||
static void gfx_ctx_vc_input_driver(void *data,
|
||||
const char *name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
(void)data;
|
||||
*input = NULL;
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
}
|
||||
|
||||
|
@ -204,10 +204,10 @@ error:
|
||||
}
|
||||
|
||||
static void gfx_ctx_vivante_input_driver(void *data,
|
||||
const char *name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
(void)data;
|
||||
*input = NULL;
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "../common/gl_common.h"
|
||||
#endif
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../frontend/frontend_driver.h"
|
||||
#include "../../runloop.h"
|
||||
#include "../../input/input_keyboard.h"
|
||||
@ -1365,13 +1364,18 @@ static void input_wl_free(void *data)
|
||||
wl->joypad->destroy();
|
||||
}
|
||||
|
||||
static bool input_wl_init(void *data)
|
||||
static bool input_wl_init(void *data, const char *joypad_name)
|
||||
{
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
wl->joypad = input_joypad_init_driver(settings->input.joypad_driver, wl);
|
||||
|
||||
if (!wl)
|
||||
return false;
|
||||
|
||||
wl->joypad = input_joypad_init_driver(joypad_name, wl);
|
||||
|
||||
if (!wl->joypad)
|
||||
return false;
|
||||
|
||||
input_keymaps_init_keyboard_lut(rarch_key_map_linux);
|
||||
return true;
|
||||
}
|
||||
@ -1455,10 +1459,11 @@ static const input_driver_t input_wayland = {
|
||||
};
|
||||
|
||||
static void gfx_ctx_wl_input_driver(void *data,
|
||||
const char *joypad_name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
/* Input is heavily tied to the window stuff on Wayland, so just implement the input driver here. */
|
||||
if (!input_wl_init(data))
|
||||
if (!input_wl_init(data, joypad_name))
|
||||
{
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
|
@ -559,10 +559,10 @@ error:
|
||||
|
||||
|
||||
static void gfx_ctx_wgl_input_driver(void *data,
|
||||
const char *joypad_name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
dinput_wgl = input_dinput.init(settings ? settings->input.joypad_driver : NULL);
|
||||
dinput_wgl = input_dinput.init(joypad_name);
|
||||
|
||||
*input = dinput_wgl ? &input_dinput : NULL;
|
||||
*input_data = dinput_wgl;
|
||||
|
@ -36,8 +36,6 @@
|
||||
|
||||
#endif
|
||||
|
||||
#include "../../configuration.h"
|
||||
|
||||
#include "../../frontend/frontend_driver.h"
|
||||
#include "../common/gl_common.h"
|
||||
#include "../common/x11_common.h"
|
||||
@ -877,12 +875,10 @@ error:
|
||||
}
|
||||
|
||||
static void gfx_ctx_x_input_driver(void *data,
|
||||
const char *joypad_name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
void *xinput = input_x.init(settings->input.joypad_driver);
|
||||
|
||||
(void)data;
|
||||
void *xinput = input_x.init(joypad_name);
|
||||
|
||||
*input = xinput ? &input_x : NULL;
|
||||
*input_data = xinput;
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../frontend/frontend_driver.h"
|
||||
|
||||
#include "../common/egl_common.h"
|
||||
@ -424,12 +423,10 @@ error:
|
||||
|
||||
|
||||
static void gfx_ctx_xegl_input_driver(void *data,
|
||||
const input_driver_t **input, void **input_data)
|
||||
const char *joypad_name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
void *xinput = input_x.init(settings->input.joypad_driver);
|
||||
|
||||
(void)data;
|
||||
void *xinput = input_x.init(joypad_name);
|
||||
|
||||
*input = xinput ? &input_x : NULL;
|
||||
*input_data = xinput;
|
||||
|
@ -412,10 +412,14 @@ bool video_context_driver_get_metrics(gfx_ctx_metrics_t *metrics)
|
||||
|
||||
bool video_context_driver_input_driver(gfx_ctx_input_t *inp)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *joypad_name = settings ? settings->input.joypad_driver : NULL;
|
||||
|
||||
if (!current_video_context || !current_video_context->input_driver)
|
||||
return false;
|
||||
current_video_context->input_driver(
|
||||
video_context_data, inp->input, inp->input_data);
|
||||
video_context_data, joypad_name,
|
||||
inp->input, inp->input_data);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ typedef struct gfx_ctx_driver
|
||||
|
||||
/* Most video backends will want to use a certain input driver.
|
||||
* Checks for it here. */
|
||||
void (*input_driver)(void*, const input_driver_t**, void**);
|
||||
void (*input_driver)(void*, const char *, const input_driver_t**, void**);
|
||||
|
||||
/* Wraps whatever gl_proc_address() there is.
|
||||
* Does not take opaque, to avoid lots of ugly wrapper code. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user