From 65b4c2595e57835ee69e76b8f26b6d216d8a3bed Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 27 Jul 2019 02:21:24 +0200 Subject: [PATCH] Update set keyboard mapping code for input driver --- gfx/common/d3d_common.c | 9 ++-- gfx/common/d3d_common.h | 2 +- gfx/common/metal_common.h | 2 +- gfx/common/metal_common.m | 2 +- gfx/drivers/caca_gfx.c | 2 +- gfx/drivers/ctr_gfx.c | 2 +- gfx/drivers/d3d10.c | 5 +- gfx/drivers/d3d11.c | 4 +- gfx/drivers/d3d12.c | 4 +- gfx/drivers/d3d8.c | 4 +- gfx/drivers/d3d9.c | 4 +- gfx/drivers/dispmanx_gfx.c | 2 +- gfx/drivers/drm_gfx.c | 2 +- gfx/drivers/exynos_gfx.c | 2 +- gfx/drivers/gdi_gfx.c | 2 +- gfx/drivers/gl.c | 2 +- gfx/drivers/gl1.c | 2 +- gfx/drivers/gl_core.c | 2 +- gfx/drivers/gx2_gfx.c | 2 +- gfx/drivers/gx_gfx.c | 2 +- gfx/drivers/metal.m | 7 +-- gfx/drivers/nullgfx.c | 2 +- gfx/drivers/omap_gfx.c | 2 +- gfx/drivers/ps2_gfx.c | 2 +- gfx/drivers/psp1_gfx.c | 2 +- gfx/drivers/sdl2_gfx.c | 2 +- gfx/drivers/sdl_gfx.c | 3 +- gfx/drivers/sixel_gfx.c | 2 +- gfx/drivers/sunxi_gfx.c | 2 +- gfx/drivers/switch_gfx.c | 2 +- gfx/drivers/switch_nx_gfx.c | 2 +- gfx/drivers/vg.c | 2 +- gfx/drivers/vga_gfx.c | 2 +- gfx/drivers/vita2d_gfx.c | 2 +- gfx/drivers/vulkan.c | 2 +- gfx/drivers/xenon360_gfx.c | 3 +- gfx/drivers/xshm_gfx.c | 2 +- gfx/drivers/xvideo.c | 2 +- gfx/drivers_context/android_ctx.c | 2 +- gfx/drivers_context/cgl_ctx.c | 2 +- gfx/drivers_context/cocoa_gl_ctx.m | 2 +- gfx/drivers_context/drm_ctx.c | 2 +- gfx/drivers_context/emscriptenegl_ctx.c | 2 +- gfx/drivers_context/gdi_ctx.c | 2 +- gfx/drivers_context/gfx_null_ctx.c | 2 +- gfx/drivers_context/khr_display_ctx.c | 2 +- gfx/drivers_context/mali_fbdev_ctx.c | 2 +- gfx/drivers_context/opendingux_fbdev_ctx.c | 2 +- gfx/drivers_context/orbis_ctx.c | 6 +-- gfx/drivers_context/osmesa_ctx.c | 2 +- gfx/drivers_context/ps3_ctx.c | 2 +- gfx/drivers_context/qnx_ctx.c | 2 +- gfx/drivers_context/sdl_gl_ctx.c | 2 +- gfx/drivers_context/sixel_ctx.c | 2 +- gfx/drivers_context/switch_ctx.c | 6 +-- gfx/drivers_context/vc_egl_ctx.c | 2 +- gfx/drivers_context/vivante_fbdev_ctx.c | 2 +- gfx/drivers_context/wayland_ctx.c | 4 +- gfx/drivers_context/wgl_ctx.c | 2 +- gfx/drivers_context/x_ctx.c | 2 +- gfx/drivers_context/xegl_ctx.c | 2 +- gfx/video_thread_wrapper.c | 8 ++-- gfx/video_thread_wrapper.h | 2 +- input/drivers/android_input.c | 20 +------- input/drivers/cocoa_input.c | 19 +------- input/drivers/cocoa_input.h | 1 - input/drivers/ctr_input.c | 20 +------- input/drivers/dinput.c | 26 ++-------- input/drivers/dos_input.c | 3 +- input/drivers/gx_input.c | 20 +------- input/drivers/linuxraw_input.c | 20 +------- input/drivers/nullinput.c | 10 +--- input/drivers/ps2_input.c | 20 +------- input/drivers/ps3_input.c | 20 +------- input/drivers/ps4_input.c | 20 +------- input/drivers/psp_input.c | 20 +------- input/drivers/qnx_input.c | 22 +-------- input/drivers/rwebinput_input.c | 22 +-------- input/drivers/sdl_input.c | 20 +------- input/drivers/switch_input.c | 20 +------- input/drivers/udev_input.c | 22 +-------- input/drivers/uwp_input.c | 22 +-------- input/drivers/wayland_input.c | 19 +------- input/drivers/wiiu_input.c | 20 +------- input/drivers/winraw_input.c | 20 +------- input/drivers/x11_input.c | 22 +-------- input/drivers/xdk_xinput_input.c | 20 +------- input/drivers/xenon360_input.c | 3 +- input/input_driver.h | 7 +-- menu/widgets/menu_input_bind_dialog.c | 22 ++++++--- retroarch.c | 56 ++++++++-------------- retroarch.h | 6 +-- 92 files changed, 159 insertions(+), 550 deletions(-) diff --git a/gfx/common/d3d_common.c b/gfx/common/d3d_common.c index 7eb5d49066..9362cedd09 100644 --- a/gfx/common/d3d_common.c +++ b/gfx/common/d3d_common.c @@ -131,7 +131,8 @@ int32_t d3d_translate_filter(unsigned type) return (int32_t)D3D_TEXTURE_FILTER_POINT; } -void d3d_input_driver(const char* input_name, const char* joypad_name, const input_driver_t** input, void** input_data) +void d3d_input_driver(const char* input_name, const char* joypad_name, + input_driver_t** input, void** input_data) { #if defined(__WINRT__) /* Plain xinput is supported on UWP, but it @@ -139,18 +140,18 @@ void d3d_input_driver(const char* input_name, const char* joypad_name, const inp if (string_is_equal(input_name, "xinput")) { void *xinput = input_xinput.init(joypad_name); - *input = xinput ? (const input_driver_t*)&input_xinput : NULL; + *input = xinput ? (input_driver_t*)&input_xinput : NULL; *input_data = xinput; } else { void *uwp = input_uwp.init(joypad_name); - *input = uwp ? (const input_driver_t*)&input_uwp : NULL; + *input = uwp ? (input_driver_t*)&input_uwp : NULL; *input_data = uwp; } #elif defined(_XBOX) void *xinput = input_xinput.init(joypad_name); - *input = xinput ? (const input_driver_t*)&input_xinput : NULL; + *input = xinput ? (input_driver_t*)&input_xinput : NULL; *input_data = xinput; #else #if _WIN32_WINNT >= 0x0501 diff --git a/gfx/common/d3d_common.h b/gfx/common/d3d_common.h index 139f956914..ad8d83b879 100644 --- a/gfx/common/d3d_common.h +++ b/gfx/common/d3d_common.h @@ -105,7 +105,7 @@ void *d3d_matrix_rotation_z(void *_pout, float angle); int32_t d3d_translate_filter(unsigned type); void d3d_input_driver(const char* input_name, - const char* joypad_name, const input_driver_t** input, void** input_data); + const char* joypad_name, input_driver_t** input, void** input_data); RETRO_END_DECLS diff --git a/gfx/common/metal_common.h b/gfx/common/metal_common.h index d8f934946a..c325b2d51e 100644 --- a/gfx/common/metal_common.h +++ b/gfx/common/metal_common.h @@ -80,7 +80,7 @@ extern MTLPixelFormat SelectOptimalPixelFormat(MTLPixelFormat fmt); @property (nonatomic, readonly) Uniforms *viewportMVP; - (instancetype)initWithVideo:(const video_info_t *)video - input:(const input_driver_t **)input + input:(input_driver_t **)input inputData:(void **)inputData; - (void)setVideo:(const video_info_t *)video; diff --git a/gfx/common/metal_common.m b/gfx/common/metal_common.m index bba84441f0..9816215ec8 100644 --- a/gfx/common/metal_common.m +++ b/gfx/common/metal_common.m @@ -88,7 +88,7 @@ } - (instancetype)initWithVideo:(const video_info_t *)video - input:(const input_driver_t **)input + input:(input_driver_t **)input inputData:(void **)inputData { if (self = [super init]) diff --git a/gfx/drivers/caca_gfx.c b/gfx/drivers/caca_gfx.c index ef827760e6..de2939c76b 100644 --- a/gfx/drivers/caca_gfx.c +++ b/gfx/drivers/caca_gfx.c @@ -66,7 +66,7 @@ static void caca_gfx_create(void) } static void *caca_gfx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { caca_t *caca = (caca_t*)calloc(1, sizeof(*caca)); diff --git a/gfx/drivers/ctr_gfx.c b/gfx/drivers/ctr_gfx.c index 372c5256d1..af3e432e64 100644 --- a/gfx/drivers/ctr_gfx.c +++ b/gfx/drivers/ctr_gfx.c @@ -326,7 +326,7 @@ static void ctr_set_bottom_screen_enable(void* data, bool enabled) } static void* ctr_init(const video_info_t* video, - const input_driver_t** input, void** input_data) + input_driver_t** input, void** input_data) { float refresh_rate; u8 device_model = 0xFF; diff --git a/gfx/drivers/d3d10.c b/gfx/drivers/d3d10.c index 3c073f5558..6df2afa207 100644 --- a/gfx/drivers/d3d10.c +++ b/gfx/drivers/d3d10.c @@ -606,9 +606,8 @@ static void d3d10_gfx_free(void* data) free(d3d10); } - static void* -d3d10_gfx_init(const video_info_t* video, - const input_driver_t** input, void** input_data) +static void *d3d10_gfx_init(const video_info_t* video, + input_driver_t** input, void** input_data) { unsigned i; #ifdef HAVE_MONITOR diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index dea7880f35..e13b6f9183 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -621,8 +621,8 @@ static void d3d11_gfx_free(void* data) free(d3d11); } - static void* -d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** input_data) +static void *d3d11_gfx_init(const video_info_t* video, + input_driver_t** input, void** input_data) { unsigned i; #ifdef HAVE_MONITOR diff --git a/gfx/drivers/d3d12.c b/gfx/drivers/d3d12.c index d91e46db12..5596621683 100644 --- a/gfx/drivers/d3d12.c +++ b/gfx/drivers/d3d12.c @@ -892,8 +892,8 @@ static void d3d12_gfx_free(void* data) free(d3d12); } -static void* -d3d12_gfx_init(const video_info_t* video, const input_driver_t** input, void** input_data) +static void *d3d12_gfx_init(const video_info_t* video, + input_driver_t** input, void** input_data) { #ifdef HAVE_MONITOR MONITORINFOEX current_mon; diff --git a/gfx/drivers/d3d8.c b/gfx/drivers/d3d8.c index 3fa4e2d9c1..9284e1f482 100644 --- a/gfx/drivers/d3d8.c +++ b/gfx/drivers/d3d8.c @@ -1126,7 +1126,7 @@ static void d3d8_set_osd_msg(void *data, } static bool d3d8_init_internal(d3d8_video_t *d3d, - const video_info_t *info, const input_driver_t **input, + const video_info_t *info, input_driver_t **input, void **input_data) { #ifdef HAVE_MONITOR @@ -1237,7 +1237,7 @@ static void d3d8_show_mouse(void *data, bool state) } static void *d3d8_init(const video_info_t *info, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { d3d8_video_t *d3d = (d3d8_video_t*)calloc(1, sizeof(*d3d)); diff --git a/gfx/drivers/d3d9.c b/gfx/drivers/d3d9.c index 1728c90208..a345844f06 100644 --- a/gfx/drivers/d3d9.c +++ b/gfx/drivers/d3d9.c @@ -1148,7 +1148,7 @@ static void d3d9_set_osd_msg(void *data, } static bool d3d9_init_internal(d3d9_video_t *d3d, - const video_info_t *info, const input_driver_t **input, + const video_info_t *info, input_driver_t **input, void **input_data) { #ifdef HAVE_MONITOR @@ -1291,7 +1291,7 @@ static void d3d9_show_mouse(void *data, bool state) } static void *d3d9_init(const video_info_t *info, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { d3d9_video_t *d3d = (d3d9_video_t*)calloc(1, sizeof(*d3d)); diff --git a/gfx/drivers/dispmanx_gfx.c b/gfx/drivers/dispmanx_gfx.c index 1e6a3e1ac4..ba876537d1 100644 --- a/gfx/drivers/dispmanx_gfx.c +++ b/gfx/drivers/dispmanx_gfx.c @@ -383,7 +383,7 @@ static void dispmanx_blank_console (struct dispmanx_video *_dispvars) } static void *dispmanx_gfx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { struct dispmanx_video *_dispvars = calloc(1, sizeof(struct dispmanx_video)); diff --git a/gfx/drivers/drm_gfx.c b/gfx/drivers/drm_gfx.c index 4643e8c912..4bf3a8aeae 100644 --- a/gfx/drivers/drm_gfx.c +++ b/gfx/drivers/drm_gfx.c @@ -704,7 +704,7 @@ static bool init_drm(void) } static void *drm_gfx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { struct drm_video *_drmvars = (struct drm_video*) calloc(1, sizeof(struct drm_video)); diff --git a/gfx/drivers/exynos_gfx.c b/gfx/drivers/exynos_gfx.c index 9ee8025f65..d184d64fac 100644 --- a/gfx/drivers/exynos_gfx.c +++ b/gfx/drivers/exynos_gfx.c @@ -1164,7 +1164,7 @@ static int exynos_render_msg(struct exynos_video *vid, } static void *exynos_gfx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { struct exynos_video *vid; const unsigned fb_bpp = 4; /* Use XRGB8888 framebuffer. */ diff --git a/gfx/drivers/gdi_gfx.c b/gfx/drivers/gdi_gfx.c index 447a361d9c..7fe0814d7b 100644 --- a/gfx/drivers/gdi_gfx.c +++ b/gfx/drivers/gdi_gfx.c @@ -78,7 +78,7 @@ static void gdi_gfx_create(void) } static void *gdi_gfx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { unsigned full_x, full_y; gfx_ctx_input_t inp; diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 2fc9a6575c..f04a6e0331 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -3636,7 +3636,7 @@ static bool renderchain_gl2_init_first(void **renderchain_handle) } static void *gl2_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { enum gfx_wrap_type wrap_type; gfx_ctx_mode_t mode; diff --git a/gfx/drivers/gl1.c b/gfx/drivers/gl1.c index 745ab6e859..2a8f3121df 100644 --- a/gfx/drivers/gl1.c +++ b/gfx/drivers/gl1.c @@ -228,7 +228,7 @@ static unsigned get_pot(unsigned x) } static void *gl1_gfx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { unsigned full_x, full_y; gfx_ctx_input_t inp; diff --git a/gfx/drivers/gl_core.c b/gfx/drivers/gl_core.c index 577ad894ff..89920c6b01 100644 --- a/gfx/drivers/gl_core.c +++ b/gfx/drivers/gl_core.c @@ -933,7 +933,7 @@ static void gl_core_begin_debug(gl_core_t *gl) #endif static void *gl_core_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { gfx_ctx_mode_t mode; gfx_ctx_input_t inp; diff --git a/gfx/drivers/gx2_gfx.c b/gfx/drivers/gx2_gfx.c index 6901d01f31..e66be65c03 100644 --- a/gfx/drivers/gx2_gfx.c +++ b/gfx/drivers/gx2_gfx.c @@ -203,7 +203,7 @@ static void wiiu_gfx_set_aspect_ratio(void *data, unsigned aspect_ratio_idx) static uint32_t wiiu_gfx_get_flags(void *data); static void *wiiu_gfx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { settings_t *settings = config_get_ptr(); float refresh_rate = 60.0f / 1.001f; diff --git a/gfx/drivers/gx_gfx.c b/gfx/drivers/gx_gfx.c index e3fc17988c..b9890bc530 100644 --- a/gfx/drivers/gx_gfx.c +++ b/gfx/drivers/gx_gfx.c @@ -782,7 +782,7 @@ static void gx_efb_screenshot(void) #endif static void *gx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { settings_t *settings = config_get_ptr(); void *gxinput = NULL; diff --git a/gfx/drivers/metal.m b/gfx/drivers/metal.m index 2049e7d964..dc75c9ff1b 100644 --- a/gfx/drivers/metal.m +++ b/gfx/drivers/metal.m @@ -61,9 +61,10 @@ static uint32_t metal_get_flags(void *data); static bool metal_set_shader(void *data, enum rarch_shader_type type, const char *path); -static void *metal_init(const video_info_t *video, - const input_driver_t **input, - void **input_data) +static void *metal_init( + const video_info_t *video, + input_driver_t **input, + void **input_data) { [apple_platform setViewType:APPLE_VIEW_TYPE_METAL]; diff --git a/gfx/drivers/nullgfx.c b/gfx/drivers/nullgfx.c index 8a71bf6da7..c3dfd67a53 100644 --- a/gfx/drivers/nullgfx.c +++ b/gfx/drivers/nullgfx.c @@ -19,7 +19,7 @@ #include "../../verbosity.h" static void *null_gfx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { RARCH_ERR("Using the null video driver. RetroArch will not be visible."); diff --git a/gfx/drivers/omap_gfx.c b/gfx/drivers/omap_gfx.c index f3a0e47c2a..78b9d3074b 100644 --- a/gfx/drivers/omap_gfx.c +++ b/gfx/drivers/omap_gfx.c @@ -930,7 +930,7 @@ static void omap_render_msg(omap_video_t *vid, const char *msg) /* FIXME/TODO: Filters not supported. */ static void *omap_gfx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { settings_t *settings = config_get_ptr(); omap_video_t *vid = (omap_video_t*)calloc(1, sizeof(omap_video_t)); diff --git a/gfx/drivers/ps2_gfx.c b/gfx/drivers/ps2_gfx.c index 212d5304f1..b6606e5e03 100644 --- a/gfx/drivers/ps2_gfx.c +++ b/gfx/drivers/ps2_gfx.c @@ -222,7 +222,7 @@ static void ps2_texture_upload(GSGLOBAL *gsGlobal, GSTEXTURE *Texture, bool send } static void *ps2_gfx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { void *ps2input = NULL; *input_data = NULL; diff --git a/gfx/drivers/psp1_gfx.c b/gfx/drivers/psp1_gfx.c index d3a639338a..d5bd04edc2 100644 --- a/gfx/drivers/psp1_gfx.c +++ b/gfx/drivers/psp1_gfx.c @@ -259,7 +259,7 @@ static void psp_on_vblank(u32 sub, psp1_video_t *psp) } static void *psp_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { /* TODO : add ASSERT() checks or use main RAM if * VRAM is too low for desired video->input_scale. */ diff --git a/gfx/drivers/sdl2_gfx.c b/gfx/drivers/sdl2_gfx.c index 9c2faca801..3112bf2be1 100644 --- a/gfx/drivers/sdl2_gfx.c +++ b/gfx/drivers/sdl2_gfx.c @@ -375,7 +375,7 @@ static void sdl_refresh_input_size(sdl2_video_t *vid, bool menu, bool rgb32, } static void *sdl2_gfx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { int i; unsigned flags; diff --git a/gfx/drivers/sdl_gfx.c b/gfx/drivers/sdl_gfx.c index cd3d0c96f6..899bb76196 100644 --- a/gfx/drivers/sdl_gfx.c +++ b/gfx/drivers/sdl_gfx.c @@ -227,7 +227,8 @@ static void sdl_gfx_set_handles(void) #endif } -static void *sdl_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) +static void *sdl_gfx_init(const video_info_t *video, + input_driver_t **input, void **input_data) { unsigned full_x, full_y; const SDL_VideoInfo *video_info = NULL; diff --git a/gfx/drivers/sixel_gfx.c b/gfx/drivers/sixel_gfx.c index 8ba77d79d4..dd9a474aba 100644 --- a/gfx/drivers/sixel_gfx.c +++ b/gfx/drivers/sixel_gfx.c @@ -187,7 +187,7 @@ static void scroll_on_demand(int pixelheight) } static void *sixel_gfx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { gfx_ctx_input_t inp; void *ctx_data = NULL; diff --git a/gfx/drivers/sunxi_gfx.c b/gfx/drivers/sunxi_gfx.c index c8235f0a74..335362ff22 100644 --- a/gfx/drivers/sunxi_gfx.c +++ b/gfx/drivers/sunxi_gfx.c @@ -619,7 +619,7 @@ static void sunxi_vsync_thread_func(void *data) } static void *sunxi_gfx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { struct sunxi_video *_dispvars = (struct sunxi_video*) calloc(1, sizeof(struct sunxi_video)); diff --git a/gfx/drivers/switch_gfx.c b/gfx/drivers/switch_gfx.c index 77496a86bd..d28617b0a1 100644 --- a/gfx/drivers/switch_gfx.c +++ b/gfx/drivers/switch_gfx.c @@ -81,7 +81,7 @@ typedef struct } switch_video_t; static void *switch_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { unsigned x, y; switch_video_t *sw = (switch_video_t*)calloc(1, sizeof(*sw)); diff --git a/gfx/drivers/switch_nx_gfx.c b/gfx/drivers/switch_nx_gfx.c index b20544bf8f..9047fe4288 100644 --- a/gfx/drivers/switch_nx_gfx.c +++ b/gfx/drivers/switch_nx_gfx.c @@ -174,7 +174,7 @@ static void clear_screen(switch_video_t *sw) } static void *switch_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { void *switchinput = NULL; switch_video_t *sw = (switch_video_t *)calloc(1, sizeof(*sw)); diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index d320da897f..e4690d566a 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -94,7 +94,7 @@ static INLINE bool vg_query_extension(const char *ext) } static void *vg_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { gfx_ctx_mode_t mode; gfx_ctx_input_t inp; diff --git a/gfx/drivers/vga_gfx.c b/gfx/drivers/vga_gfx.c index 3c525d9c82..d4f969933c 100644 --- a/gfx/drivers/vga_gfx.c +++ b/gfx/drivers/vga_gfx.c @@ -110,7 +110,7 @@ static void vga_gfx_create(void) } static void *vga_gfx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { vga_t *vga = (vga_t*)calloc(1, sizeof(*vga)); diff --git a/gfx/drivers/vita2d_gfx.c b/gfx/drivers/vita2d_gfx.c index 30647bd8bf..6eaf2c6a7c 100644 --- a/gfx/drivers/vita2d_gfx.c +++ b/gfx/drivers/vita2d_gfx.c @@ -44,7 +44,7 @@ static void vita2d_gfx_set_viewport(void *data, unsigned viewport_width, unsigned viewport_height, bool force_full, bool allow_rotate); static void *vita2d_gfx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { vita_video_t *vita = (vita_video_t *)calloc(1, sizeof(vita_video_t)); unsigned temp_width = PSP_FB_WIDTH; diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 0576ee45ee..95001c3f21 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -1153,7 +1153,7 @@ static void vulkan_init_readback(vk_t *vk) } static void *vulkan_init(const video_info_t *video, - const input_driver_t **input, + input_driver_t **input, void **input_data) { gfx_ctx_mode_t mode; diff --git a/gfx/drivers/xenon360_gfx.c b/gfx/drivers/xenon360_gfx.c index 148ca24b18..05f75cfef9 100644 --- a/gfx/drivers/xenon360_gfx.c +++ b/gfx/drivers/xenon360_gfx.c @@ -103,7 +103,8 @@ static void xenon360_gfx_free(void *data) free(vid); } -static void *xenon360_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) +static void *xenon360_gfx_init(const video_info_t *video, + input_driver_t **input, void **input_data) { gl_t * gl = calloc(1, sizeof(gl_t)); if (!gl) diff --git a/gfx/drivers/xshm_gfx.c b/gfx/drivers/xshm_gfx.c index 0488c1b2e2..d06ea960fc 100644 --- a/gfx/drivers/xshm_gfx.c +++ b/gfx/drivers/xshm_gfx.c @@ -50,7 +50,7 @@ typedef struct xshm } xshm_t; static void *xshm_gfx_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { xshm_t* xshm = (xshm_t*)malloc(sizeof(xshm_t)); Window parent; diff --git a/gfx/drivers/xvideo.c b/gfx/drivers/xvideo.c index bb1d0b0d68..f0e7ab9fcf 100644 --- a/gfx/drivers/xvideo.c +++ b/gfx/drivers/xvideo.c @@ -420,7 +420,7 @@ static void xv_calc_out_rect(bool keep_aspect, } static void *xv_init(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { unsigned i; int ret; diff --git a/gfx/drivers_context/android_ctx.c b/gfx/drivers_context/android_ctx.c index 2febf814ec..b3523e0d94 100644 --- a/gfx/drivers_context/android_ctx.c +++ b/gfx/drivers_context/android_ctx.c @@ -363,7 +363,7 @@ 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) + input_driver_t **input, void **input_data) { void *androidinput = input_android.init(joypad_name); diff --git a/gfx/drivers_context/cgl_ctx.c b/gfx/drivers_context/cgl_ctx.c index 4c8d6fdd89..806713cc7e 100644 --- a/gfx/drivers_context/cgl_ctx.c +++ b/gfx/drivers_context/cgl_ctx.c @@ -136,7 +136,7 @@ static void gfx_ctx_cgl_destroy(void *data) static void gfx_ctx_cgl_input_driver(void *data, const char *name, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { (void)data; (void)input; diff --git a/gfx/drivers_context/cocoa_gl_ctx.m b/gfx/drivers_context/cocoa_gl_ctx.m index b63b507d61..40c2363f9d 100644 --- a/gfx/drivers_context/cocoa_gl_ctx.m +++ b/gfx/drivers_context/cocoa_gl_ctx.m @@ -456,7 +456,7 @@ static bool cocoagl_gfx_ctx_suppress_screensaver(void *data, bool enable) static void cocoagl_gfx_ctx_input_driver(void *data, const char *name, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { *input = NULL; *input_data = NULL; diff --git a/gfx/drivers_context/drm_ctx.c b/gfx/drivers_context/drm_ctx.c index 2f2230db2c..1dba5e5e6e 100644 --- a/gfx/drivers_context/drm_ctx.c +++ b/gfx/drivers_context/drm_ctx.c @@ -757,7 +757,7 @@ static void gfx_ctx_drm_destroy(void *data) static void gfx_ctx_drm_input_driver(void *data, const char *joypad_name, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { #ifdef HAVE_X11 settings_t *settings = config_get_ptr(); diff --git a/gfx/drivers_context/emscriptenegl_ctx.c b/gfx/drivers_context/emscriptenegl_ctx.c index 6ad0b6cc89..fd836fb661 100644 --- a/gfx/drivers_context/emscriptenegl_ctx.c +++ b/gfx/drivers_context/emscriptenegl_ctx.c @@ -283,7 +283,7 @@ 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) + input_driver_t **input, void **input_data) { void *rwebinput = input_rwebinput.init(name); diff --git a/gfx/drivers_context/gdi_ctx.c b/gfx/drivers_context/gdi_ctx.c index d68f298250..a7f18ec43f 100644 --- a/gfx/drivers_context/gdi_ctx.c +++ b/gfx/drivers_context/gdi_ctx.c @@ -250,7 +250,7 @@ error: static void gfx_ctx_gdi_input_driver(void *data, const char *joypad_name, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { #if _WIN32_WINNT >= 0x0501 settings_t *settings = config_get_ptr(); diff --git a/gfx/drivers_context/gfx_null_ctx.c b/gfx/drivers_context/gfx_null_ctx.c index c616e31f74..c367fe5366 100644 --- a/gfx/drivers_context/gfx_null_ctx.c +++ b/gfx/drivers_context/gfx_null_ctx.c @@ -66,7 +66,7 @@ static void gfx_ctx_null_destroy(void *data) static void gfx_ctx_null_input_driver(void *data, const char *name, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { (void)data; (void)input; diff --git a/gfx/drivers_context/khr_display_ctx.c b/gfx/drivers_context/khr_display_ctx.c index ad0ec0618c..47fc94cd45 100644 --- a/gfx/drivers_context/khr_display_ctx.c +++ b/gfx/drivers_context/khr_display_ctx.c @@ -157,7 +157,7 @@ error: static void gfx_ctx_khr_display_input_driver(void *data, const char *joypad_name, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { #ifdef HAVE_X11 settings_t *settings = config_get_ptr(); diff --git a/gfx/drivers_context/mali_fbdev_ctx.c b/gfx/drivers_context/mali_fbdev_ctx.c index ef1ccb32bc..a716abc8e5 100644 --- a/gfx/drivers_context/mali_fbdev_ctx.c +++ b/gfx/drivers_context/mali_fbdev_ctx.c @@ -213,7 +213,7 @@ error: static void gfx_ctx_mali_fbdev_input_driver(void *data, const char *name, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { *input = NULL; *input_data = NULL; diff --git a/gfx/drivers_context/opendingux_fbdev_ctx.c b/gfx/drivers_context/opendingux_fbdev_ctx.c index fbd7b4359c..6db8c4abf3 100644 --- a/gfx/drivers_context/opendingux_fbdev_ctx.c +++ b/gfx/drivers_context/opendingux_fbdev_ctx.c @@ -180,7 +180,7 @@ error: static void gfx_ctx_opendingux_input_driver(void *data, const char *name, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { *input = NULL; *input_data = NULL; diff --git a/gfx/drivers_context/orbis_ctx.c b/gfx/drivers_context/orbis_ctx.c index cce318a752..d9db9037b4 100644 --- a/gfx/drivers_context/orbis_ctx.c +++ b/gfx/drivers_context/orbis_ctx.c @@ -184,10 +184,10 @@ error: } static void orbis_ctx_input_driver(void *data, - const char *name, - const input_driver_t **input, void **input_data) + const char *name, + input_driver_t **input, void **input_data) { - *input = NULL; + *input = NULL; *input_data = NULL; } diff --git a/gfx/drivers_context/osmesa_ctx.c b/gfx/drivers_context/osmesa_ctx.c index aa22afc856..0c069f8f98 100644 --- a/gfx/drivers_context/osmesa_ctx.c +++ b/gfx/drivers_context/osmesa_ctx.c @@ -353,7 +353,7 @@ static void osmesa_ctx_swap_buffers(void *data, void *data2) static void osmesa_ctx_input_driver(void *data, const char *name, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { *input = NULL; *input_data = NULL; diff --git a/gfx/drivers_context/ps3_ctx.c b/gfx/drivers_context/ps3_ctx.c index 6b5bdd7070..e0c8e4c8db 100644 --- a/gfx/drivers_context/ps3_ctx.c +++ b/gfx/drivers_context/ps3_ctx.c @@ -315,7 +315,7 @@ 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) + input_driver_t **input, void **input_data) { void *ps3input = input_ps3.init(joypad_name); diff --git a/gfx/drivers_context/qnx_ctx.c b/gfx/drivers_context/qnx_ctx.c index 3e569da19c..f2ca532990 100644 --- a/gfx/drivers_context/qnx_ctx.c +++ b/gfx/drivers_context/qnx_ctx.c @@ -322,7 +322,7 @@ 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) + input_driver_t **input, void **input_data) { void *qnxinput = input_qnx.init(joypad_name); diff --git a/gfx/drivers_context/sdl_gl_ctx.c b/gfx/drivers_context/sdl_gl_ctx.c index c8fe1dfa92..65a4eac25e 100644 --- a/gfx/drivers_context/sdl_gl_ctx.c +++ b/gfx/drivers_context/sdl_gl_ctx.c @@ -379,7 +379,7 @@ static void sdl_ctx_swap_buffers(void *data, void *data2) static void sdl_ctx_input_driver(void *data, const char *name, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { *input = NULL; *input_data = NULL; diff --git a/gfx/drivers_context/sixel_ctx.c b/gfx/drivers_context/sixel_ctx.c index 4a73a45190..2fb19b6885 100644 --- a/gfx/drivers_context/sixel_ctx.c +++ b/gfx/drivers_context/sixel_ctx.c @@ -108,7 +108,7 @@ static bool gfx_ctx_sixel_set_video_mode(void *data, static void gfx_ctx_sixel_input_driver(void *data, const char *joypad_name, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { (void)data; diff --git a/gfx/drivers_context/switch_ctx.c b/gfx/drivers_context/switch_ctx.c index 51c02757b5..c89e3c62b6 100644 --- a/gfx/drivers_context/switch_ctx.c +++ b/gfx/drivers_context/switch_ctx.c @@ -194,10 +194,10 @@ error: } static void switch_ctx_input_driver(void *data, - const char *name, - const input_driver_t **input, void **input_data) + const char *name, + input_driver_t **input, void **input_data) { - *input = NULL; + *input = NULL; *input_data = NULL; } diff --git a/gfx/drivers_context/vc_egl_ctx.c b/gfx/drivers_context/vc_egl_ctx.c index f88c711085..5f25e88ca9 100644 --- a/gfx/drivers_context/vc_egl_ctx.c +++ b/gfx/drivers_context/vc_egl_ctx.c @@ -488,7 +488,7 @@ 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) + input_driver_t **input, void **input_data) { *input = NULL; *input_data = NULL; diff --git a/gfx/drivers_context/vivante_fbdev_ctx.c b/gfx/drivers_context/vivante_fbdev_ctx.c index a140c2d40d..16994efbb4 100644 --- a/gfx/drivers_context/vivante_fbdev_ctx.c +++ b/gfx/drivers_context/vivante_fbdev_ctx.c @@ -187,7 +187,7 @@ error: static void gfx_ctx_vivante_input_driver(void *data, const char *name, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { *input = NULL; *input_data = NULL; diff --git a/gfx/drivers_context/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index 04fa809ac2..1a5be4f114 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -1769,14 +1769,14 @@ bool input_wl_init(void *data, const char *joypad_name); static void gfx_ctx_wl_input_driver(void *data, const char *joypad_name, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; /* Input is heavily tied to the window stuff * on Wayland, so just implement the input driver here. */ if (!input_wl_init(&wl->input, joypad_name)) { - *input = NULL; + *input = NULL; *input_data = NULL; } else diff --git a/gfx/drivers_context/wgl_ctx.c b/gfx/drivers_context/wgl_ctx.c index aec0cde116..35d41adf2c 100644 --- a/gfx/drivers_context/wgl_ctx.c +++ b/gfx/drivers_context/wgl_ctx.c @@ -689,7 +689,7 @@ error: static void gfx_ctx_wgl_input_driver(void *data, const char *joypad_name, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { settings_t *settings = config_get_ptr(); diff --git a/gfx/drivers_context/x_ctx.c b/gfx/drivers_context/x_ctx.c index 176dc5e7ce..4916f651e0 100644 --- a/gfx/drivers_context/x_ctx.c +++ b/gfx/drivers_context/x_ctx.c @@ -994,7 +994,7 @@ error: static void gfx_ctx_x_input_driver(void *data, const char *joypad_name, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { void *x_input = NULL; #ifdef HAVE_UDEV diff --git a/gfx/drivers_context/xegl_ctx.c b/gfx/drivers_context/xegl_ctx.c index 6996d9e47a..0ccb5f31c2 100644 --- a/gfx/drivers_context/xegl_ctx.c +++ b/gfx/drivers_context/xegl_ctx.c @@ -456,7 +456,7 @@ error: static void gfx_ctx_xegl_input_driver(void *data, const char *joypad_name, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { void *xinput = input_x.init(joypad_name); diff --git a/gfx/video_thread_wrapper.c b/gfx/video_thread_wrapper.c index cebf332ac3..ecd895ff9f 100644 --- a/gfx/video_thread_wrapper.c +++ b/gfx/video_thread_wrapper.c @@ -161,7 +161,7 @@ struct thread_video const video_poke_interface_t *poke; void *driver_data; - const input_driver_t **input; + input_driver_t **input; void **input_data; struct @@ -220,7 +220,7 @@ struct thread_video }; static void *video_thread_init_never_call(const video_info_t *video, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { (void)video; (void)input; @@ -793,7 +793,7 @@ static void video_thread_set_nonblock_state(void *data, bool state) static bool video_thread_init(thread_video_t *thr, const video_info_t info, - const input_driver_t **input, void **input_data) + input_driver_t **input, void **input_data) { size_t max_size; thread_packet_t pkt = {CMD_INIT}; @@ -1362,7 +1362,7 @@ static void video_thread_set_callbacks( * Returns: true (1) if successful, otherwise false (0). **/ bool video_init_thread(const video_driver_t **out_driver, - void **out_data, const input_driver_t **input, void **input_data, + void **out_data, input_driver_t **input, void **input_data, const video_driver_t *drv, const video_info_t info) { thread_video_t *thr = (thread_video_t*)calloc(1, sizeof(*thr)); diff --git a/gfx/video_thread_wrapper.h b/gfx/video_thread_wrapper.h index 5a60e68e4a..63e812555d 100644 --- a/gfx/video_thread_wrapper.h +++ b/gfx/video_thread_wrapper.h @@ -53,7 +53,7 @@ typedef struct thread_video thread_video_t; **/ bool video_init_thread( const video_driver_t **out_driver, void **out_data, - const input_driver_t **input, void **input_data, + input_driver_t **input, void **input_data, const video_driver_t *driver, const video_info_t info); /** diff --git a/input/drivers/android_input.c b/input/drivers/android_input.c index be7ef1e17c..7b8fef8d57 100644 --- a/input/drivers/android_input.c +++ b/input/drivers/android_input.c @@ -149,7 +149,6 @@ typedef struct state_device typedef struct android_input { - bool blocked; const input_device_driver_t *joypad; state_device_t pad_states[MAX_USERS]; @@ -1692,22 +1691,6 @@ static const input_device_driver_t *android_input_get_joypad_driver(void *data) return android->joypad; } -static bool android_input_keyboard_mapping_is_blocked(void *data) -{ - android_input_t *android = (android_input_t*)data; - if (!android) - return false; - return android->blocked; -} - -static void android_input_keyboard_mapping_set_block(void *data, bool value) -{ - android_input_t *android = (android_input_t*)data; - if (!android) - return; - android->blocked = value; -} - static void android_input_grab_mouse(void *data, bool state) { (void)data; @@ -1816,6 +1799,5 @@ input_driver_t input_android = { android_input_set_rumble, android_input_get_joypad_driver, NULL, - android_input_keyboard_mapping_is_blocked, - android_input_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/cocoa_input.c b/input/drivers/cocoa_input.c index 6055da18c1..876ef8f3b0 100644 --- a/input/drivers/cocoa_input.c +++ b/input/drivers/cocoa_input.c @@ -463,22 +463,6 @@ static const input_device_driver_t *cocoa_input_get_joypad_driver(void *data) return NULL; } -static bool cocoa_input_keyboard_mapping_is_blocked(void *data) -{ - cocoa_input_data_t *apple = (cocoa_input_data_t*)data; - if (!apple) - return false; - return apple->blocked; -} - -static void cocoa_input_keyboard_mapping_set_block(void *data, bool value) -{ - cocoa_input_data_t *apple = (cocoa_input_data_t*)data; - if (!apple) - return; - apple->blocked = value; -} - input_driver_t input_cocoa = { cocoa_input_init, cocoa_input_poll, @@ -493,6 +477,5 @@ input_driver_t input_cocoa = { cocoa_input_set_rumble, cocoa_input_get_joypad_driver, cocoa_input_get_sec_joypad_driver, - cocoa_input_keyboard_mapping_is_blocked, - cocoa_input_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/cocoa_input.h b/input/drivers/cocoa_input.h index bbbf42778c..ab65fc369d 100644 --- a/input/drivers/cocoa_input.h +++ b/input/drivers/cocoa_input.h @@ -34,7 +34,6 @@ typedef struct typedef struct { - bool blocked; cocoa_touch_data_t touches[MAX_TOUCHES]; uint32_t touch_count; diff --git a/input/drivers/ctr_input.c b/input/drivers/ctr_input.c index 29e5aa938f..04f77c5adb 100644 --- a/input/drivers/ctr_input.c +++ b/input/drivers/ctr_input.c @@ -32,7 +32,6 @@ typedef struct ctr_input { - bool blocked; const input_device_driver_t *joypad; } ctr_input_t; @@ -162,22 +161,6 @@ static bool ctr_input_set_rumble(void *data, unsigned port, return false; } -static bool ctr_input_keyboard_mapping_is_blocked(void *data) -{ - ctr_input_t *ctr = (ctr_input_t*)data; - if (!ctr) - return false; - return ctr->blocked; -} - -static void ctr_input_keyboard_mapping_set_block(void *data, bool value) -{ - ctr_input_t *ctr = (ctr_input_t*)data; - if (!ctr) - return; - ctr->blocked = value; -} - input_driver_t input_ctr = { ctr_input_init, ctr_input_poll, @@ -192,6 +175,5 @@ input_driver_t input_ctr = { ctr_input_set_rumble, ctr_input_get_joypad_driver, NULL, - ctr_input_keyboard_mapping_is_blocked, - ctr_input_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/dinput.c b/input/drivers/dinput.c index 77e81ab60b..4d0f2c1ce0 100644 --- a/input/drivers/dinput.c +++ b/input/drivers/dinput.c @@ -73,7 +73,6 @@ struct pointer_status struct dinput_input { char *joypad_driver_name; - bool blocked; LPDIRECTINPUTDEVICE8 keyboard; LPDIRECTINPUTDEVICE8 mouse; const input_device_driver_t *joypad; @@ -572,7 +571,7 @@ static int16_t dinput_input_state(void *data, if (binds[port][i].key < RETROK_LAST) { if (di->state[rarch_keysym_lut[(enum retro_key)binds[port][i].key]] & 0x80) - if ((i == RARCH_GAME_FOCUS_TOGGLE) || !di->blocked) + if ((i == RARCH_GAME_FOCUS_TOGGLE) || !input_dinput.keyboard_mapping_blocked) { ret |= (1 << i); continue; @@ -618,7 +617,7 @@ static int16_t dinput_input_state(void *data, if (binds[port][id].key < RETROK_LAST) { if (di->state[rarch_keysym_lut[(enum retro_key)binds[port][id].key]] & 0x80) - if ((id == RARCH_GAME_FOCUS_TOGGLE) || !di->blocked) + if ((id == RARCH_GAME_FOCUS_TOGGLE) || !input_dinput.keyboard_mapping_blocked) return true; } if (binds[port][id].valid) @@ -730,7 +729,7 @@ static int16_t dinput_input_state(void *data, if (binds[port][new_id].key < RETROK_LAST) { if (di->state[rarch_keysym_lut[(enum retro_key)binds[port][new_id].key]] & 0x80) - if ((new_id == RARCH_GAME_FOCUS_TOGGLE) || !di->blocked) + if ((new_id == RARCH_GAME_FOCUS_TOGGLE) || !input_dinput.keyboard_mapping_blocked) return true; } if (binds[port][new_id].valid) @@ -1012,22 +1011,6 @@ static uint64_t dinput_get_capabilities(void *data) return caps; } -static bool dinput_keyboard_mapping_is_blocked(void *data) -{ - struct dinput_input *di = (struct dinput_input*)data; - if (!di) - return false; - return di->blocked; -} - -static void dinput_keyboard_mapping_set_block(void *data, bool value) -{ - struct dinput_input *di = (struct dinput_input*)data; - if (!di) - return; - di->blocked = value; -} - input_driver_t input_dinput = { dinput_init, dinput_poll, @@ -1043,6 +1026,5 @@ input_driver_t input_dinput = { dinput_set_rumble, dinput_get_joypad_driver, NULL, - dinput_keyboard_mapping_is_blocked, - dinput_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/dos_input.c b/input/drivers/dos_input.c index fd59df440b..3f27c74edc 100644 --- a/input/drivers/dos_input.c +++ b/input/drivers/dos_input.c @@ -215,6 +215,5 @@ input_driver_t input_dos = { dos_input_set_rumble, dos_input_get_joypad_driver, NULL, - NULL, - NULL + false }; diff --git a/input/drivers/gx_input.c b/input/drivers/gx_input.c index 6bdb167fd2..d93413a0bf 100644 --- a/input/drivers/gx_input.c +++ b/input/drivers/gx_input.c @@ -34,7 +34,6 @@ typedef struct gx_input { - bool blocked; const input_device_driver_t *joypad; } gx_input_t; @@ -166,22 +165,6 @@ static bool gx_input_set_rumble(void *data, unsigned port, return false; } -static bool gx_input_keyboard_mapping_is_blocked(void *data) -{ - gx_input_t *gx = (gx_input_t*)data; - if (!gx) - return false; - return gx->blocked; -} - -static void gx_input_keyboard_mapping_set_block(void *data, bool value) -{ - gx_input_t *gx = (gx_input_t*)data; - if (!gx) - return; - gx->blocked = value; -} - input_driver_t input_gx = { gx_input_init, gx_input_poll, @@ -197,6 +180,5 @@ input_driver_t input_gx = { gx_input_set_rumble, gx_input_get_joypad_driver, NULL, - gx_input_keyboard_mapping_is_blocked, - gx_input_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/linuxraw_input.c b/input/drivers/linuxraw_input.c index 7b4ca19612..c8389f0db5 100644 --- a/input/drivers/linuxraw_input.c +++ b/input/drivers/linuxraw_input.c @@ -37,7 +37,6 @@ typedef struct linuxraw_input { - bool blocked; const input_device_driver_t *joypad; bool state[0x80]; } linuxraw_input_t; @@ -259,22 +258,6 @@ static void linuxraw_grab_mouse(void *data, bool state) (void)state; } -static bool linuxraw_keyboard_mapping_is_blocked(void *data) -{ - linuxraw_input_t *linuxraw = (linuxraw_input_t*)data; - if (!linuxraw) - return false; - return linuxraw->blocked; -} - -static void linuxraw_keyboard_mapping_set_block(void *data, bool value) -{ - linuxraw_input_t *linuxraw = (linuxraw_input_t*)data; - if (!linuxraw) - return; - linuxraw->blocked = value; -} - input_driver_t input_linuxraw = { linuxraw_input_init, linuxraw_input_poll, @@ -289,6 +272,5 @@ input_driver_t input_linuxraw = { linuxraw_set_rumble, linuxraw_get_joypad_driver, NULL, - linuxraw_keyboard_mapping_is_blocked, - linuxraw_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/nullinput.c b/input/drivers/nullinput.c index 7de6d63867..22b1eb82f3 100644 --- a/input/drivers/nullinput.c +++ b/input/drivers/nullinput.c @@ -80,13 +80,6 @@ static bool nullinput_set_rumble(void *data, unsigned port, return false; } -static bool nullinput_keyboard_mapping_is_blocked(void *data) -{ - (void)data; - - return false; -} - input_driver_t input_null = { nullinput_input_init, nullinput_input_poll, @@ -101,6 +94,5 @@ input_driver_t input_null = { nullinput_set_rumble, NULL, NULL, - nullinput_keyboard_mapping_is_blocked, - NULL, + false, }; diff --git a/input/drivers/ps2_input.c b/input/drivers/ps2_input.c index 95022578fc..18f9164d35 100644 --- a/input/drivers/ps2_input.c +++ b/input/drivers/ps2_input.c @@ -30,7 +30,6 @@ typedef struct ps2_input { - bool blocked; const input_device_driver_t *joypad; } ps2_input_t; @@ -155,22 +154,6 @@ static bool ps2_input_set_rumble(void *data, unsigned port, return false; } -static bool ps2_input_keyboard_mapping_is_blocked(void *data) -{ - ps2_input_t *ps2 = (ps2_input_t*)data; - if (!ps2) - return false; - return ps2->blocked; -} - -static void ps2_input_keyboard_mapping_set_block(void *data, bool value) -{ - ps2_input_t *ps2 = (ps2_input_t*)data; - if (!ps2) - return; - ps2->blocked = value; -} - input_driver_t input_ps2 = { ps2_input_initialize, ps2_input_poll, @@ -185,6 +168,5 @@ input_driver_t input_ps2 = { ps2_input_set_rumble, ps2_input_get_joypad_driver, NULL, - ps2_input_keyboard_mapping_is_blocked, - ps2_input_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/ps3_input.c b/input/drivers/ps3_input.c index 82fe85e650..8a8846ec42 100644 --- a/input/drivers/ps3_input.c +++ b/input/drivers/ps3_input.c @@ -48,7 +48,6 @@ typedef struct typedef struct ps3_input { - bool blocked; #ifdef HAVE_MOUSE unsigned mice_connected; #endif @@ -278,22 +277,6 @@ static void ps3_input_grab_mouse(void *data, bool state) (void)state; } -static bool ps3_input_keyboard_mapping_is_blocked(void *data) -{ - ps3_input_t *ps3 = (ps3_input_t*)data; - if (!ps3) - return false; - return ps3->blocked; -} - -static void ps3_input_keyboard_mapping_set_block(void *data, bool value) -{ - ps3_input_t *ps3 = (ps3_input_t*)data; - if (!ps3) - return; - ps3->blocked = value; -} - input_driver_t input_ps3 = { ps3_input_init, ps3_input_poll, @@ -309,6 +292,5 @@ input_driver_t input_ps3 = { ps3_input_set_rumble, ps3_input_get_joypad_driver, NULL, - ps3_input_keyboard_mapping_is_blocked, - ps3_input_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/ps4_input.c b/input/drivers/ps4_input.c index 41038f3634..4d83efec24 100644 --- a/input/drivers/ps4_input.c +++ b/input/drivers/ps4_input.c @@ -34,7 +34,6 @@ typedef struct ps4_input { - bool blocked; const input_device_driver_t *joypad; } ps4_input_t; @@ -159,22 +158,6 @@ static bool ps4_input_set_rumble(void *data, unsigned port, return false; } -static bool ps4_input_keyboard_mapping_is_blocked(void *data) -{ - ps4_input_t *ps4 = (ps4_input_t*)data; - if (!ps4) - return false; - return ps4->blocked; -} - -static void ps4_input_keyboard_mapping_set_block(void *data, bool value) -{ - ps4_input_t *ps4 = (ps4_input_t*)data; - if (!ps4) - return; - ps4->blocked = value; -} - input_driver_t input_ps4 = { ps4_input_initialize, ps4_input_poll, @@ -189,6 +172,5 @@ input_driver_t input_ps4 = { ps4_input_set_rumble, ps4_input_get_joypad_driver, NULL, - ps4_input_keyboard_mapping_is_blocked, - ps4_input_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/psp_input.c b/input/drivers/psp_input.c index 00841e9597..db0000c46a 100644 --- a/input/drivers/psp_input.c +++ b/input/drivers/psp_input.c @@ -72,7 +72,6 @@ uint8_t modifier_lut[VITA_NUM_MODIFIERS][2] = typedef struct psp_input { - bool blocked; const input_device_driver_t *joypad; #ifdef VITA int keyboard_hid_handle; @@ -446,22 +445,6 @@ static bool psp_input_set_rumble(void *data, unsigned port, return false; } -static bool psp_input_keyboard_mapping_is_blocked(void *data) -{ - psp_input_t *psp = (psp_input_t*)data; - if (!psp) - return false; - return psp->blocked; -} - -static void psp_input_keyboard_mapping_set_block(void *data, bool value) -{ - psp_input_t *psp = (psp_input_t*)data; - if (!psp) - return; - psp->blocked = value; -} - input_driver_t input_psp = { psp_input_initialize, psp_input_poll, @@ -481,6 +464,5 @@ input_driver_t input_psp = { psp_input_set_rumble, psp_input_get_joypad_driver, NULL, - psp_input_keyboard_mapping_is_blocked, - psp_input_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/qnx_input.c b/input/drivers/qnx_input.c index 79861f4fb3..713136957e 100644 --- a/input/drivers/qnx_input.c +++ b/input/drivers/qnx_input.c @@ -77,7 +77,6 @@ struct input_pointer typedef struct qnx_input { - bool blocked; unsigned pads_connected; /* @@ -739,7 +738,7 @@ static bool qnx_is_pressed(qnx_input_t *qnx, return false; if (qnx_keyboard_pressed(qnx, key)) - if ((id == RARCH_GAME_FOCUS_TOGGLE) || !qnx->blocked) + if ((id == RARCH_GAME_FOCUS_TOGGLE) || !input_qnx.keyboard_mapping_blocked) return true; if (binds && binds[id].valid) @@ -858,22 +857,6 @@ static const input_device_driver_t *qnx_input_get_joypad_driver(void *data) return qnx->joypad; } -static bool qnx_input_keyboard_mapping_is_blocked(void *data) -{ - qnx_input_t *qnx = (qnx_input_t*)data; - if (!qnx) - return false; - return qnx->blocked; -} - -static void qnx_input_keyboard_mapping_set_block(void *data, bool value) -{ - qnx_input_t *qnx = (qnx_input_t*)data; - if (!qnx) - return; - qnx->blocked = value; -} - input_driver_t input_qnx = { qnx_input_init, qnx_input_poll, @@ -888,6 +871,5 @@ input_driver_t input_qnx = { NULL, qnx_input_get_joypad_driver, NULL, - qnx_input_keyboard_mapping_is_blocked, - qnx_input_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/rwebinput_input.c b/input/drivers/rwebinput_input.c index b2025e5a19..dcfebd2a24 100644 --- a/input/drivers/rwebinput_input.c +++ b/input/drivers/rwebinput_input.c @@ -75,7 +75,6 @@ typedef struct rwebinput_input bool keys[RETROK_LAST]; rwebinput_mouse_state_t mouse; const input_device_driver_t *joypad; - bool blocked; } rwebinput_input_t; /* KeyboardEvent.keyCode has been deprecated for a while and doesn't have @@ -480,7 +479,7 @@ static bool rwebinput_is_pressed(rwebinput_input_t *rwebinput, int key = bind->key; if ((key < RETROK_LAST) && rwebinput_key_pressed(rwebinput, key)) - if ((id == RARCH_GAME_FOCUS_TOGGLE) || !rwebinput->blocked) + if ((id == RARCH_GAME_FOCUS_TOGGLE) || !input_rwebinput.keyboard_mapping_blocked) return true; if (bind->valid) @@ -700,22 +699,6 @@ static uint64_t rwebinput_get_capabilities(void *data) return caps; } -static bool rwebinput_keyboard_mapping_is_blocked(void *data) -{ - rwebinput_input_t *rwebinput = (rwebinput_input_t*)data; - if (!rwebinput) - return false; - return rwebinput->blocked; -} - -static void rwebinput_keyboard_mapping_set_block(void *data, bool value) -{ - rwebinput_input_t *rwebinput = (rwebinput_input_t*)data; - if (!rwebinput) - return; - rwebinput->blocked = value; -} - input_driver_t input_rwebinput = { rwebinput_input_init, rwebinput_input_poll, @@ -730,6 +713,5 @@ input_driver_t input_rwebinput = { rwebinput_set_rumble, rwebinput_get_joypad_driver, NULL, - rwebinput_keyboard_mapping_is_blocked, - rwebinput_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/sdl_input.c b/input/drivers/sdl_input.c index 69d99c3947..7a074c24be 100644 --- a/input/drivers/sdl_input.c +++ b/input/drivers/sdl_input.c @@ -35,7 +35,6 @@ typedef struct sdl_input { - bool blocked; const input_device_driver_t *joypad; int mouse_x, mouse_y; @@ -421,22 +420,6 @@ static uint64_t sdl_get_capabilities(void *data) return caps; } -static bool sdl_keyboard_mapping_is_blocked(void *data) -{ - sdl_input_t *sdl = (sdl_input_t*)data; - if (!sdl) - return false; - return sdl->blocked; -} - -static void sdl_keyboard_mapping_set_block(void *data, bool value) -{ - sdl_input_t *sdl = (sdl_input_t*)data; - if (!sdl) - return; - sdl->blocked = value; -} - input_driver_t input_sdl = { sdl_input_init, sdl_input_poll, @@ -455,6 +438,5 @@ input_driver_t input_sdl = { sdl_set_rumble, sdl_get_joypad_driver, NULL, - sdl_keyboard_mapping_is_blocked, - sdl_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/switch_input.c b/input/drivers/switch_input.c index 67cff36ed9..da195fbcc7 100644 --- a/input/drivers/switch_input.c +++ b/input/drivers/switch_input.c @@ -88,7 +88,6 @@ typedef struct typedef struct switch_input { const input_device_driver_t *joypad; - bool blocked; #ifdef HAVE_LIBNX /* pointer */ @@ -901,22 +900,6 @@ static bool switch_input_set_rumble(void *data, unsigned port, #endif } -static bool switch_input_keyboard_mapping_is_blocked(void *data) -{ - switch_input_t *sw = (switch_input_t*) data; - if (!sw) - return false; - return sw->blocked; -} - -static void switch_input_keyboard_mapping_set_block(void *data, bool value) -{ - switch_input_t *sw = (switch_input_t*) data; - if (!sw) - return; - sw->blocked = value; -} - input_driver_t input_switch = { switch_input_init, switch_input_poll, @@ -931,6 +914,5 @@ input_driver_t input_switch = { switch_input_set_rumble, switch_input_get_joypad_driver, NULL, - switch_input_keyboard_mapping_is_blocked, - switch_input_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/udev_input.c b/input/drivers/udev_input.c index bc799b54c7..c4b977542c 100644 --- a/input/drivers/udev_input.c +++ b/input/drivers/udev_input.c @@ -129,7 +129,6 @@ typedef void (*device_handle_cb)(void *data, struct udev_input { - bool blocked; struct udev *udev; struct udev_monitor *monitor; @@ -938,7 +937,7 @@ static bool udev_is_pressed(udev_input_t *udev, const struct retro_keybind *bind = &binds[id]; if ( (bind->key < RETROK_LAST) && udev_keyboard_pressed(udev, bind->key) ) - if ((id == RARCH_GAME_FOCUS_TOGGLE) || !udev->blocked) + if ((id == RARCH_GAME_FOCUS_TOGGLE) || !input_udev.keyboard_mapping_blocked) return true; if (binds && binds[id].valid) @@ -1345,22 +1344,6 @@ static const input_device_driver_t *udev_input_get_joypad_driver(void *data) return udev->joypad; } -static bool udev_input_keyboard_mapping_is_blocked(void *data) -{ - udev_input_t *udev = (udev_input_t*)data; - if (!udev) - return false; - return udev->blocked; -} - -static void udev_input_keyboard_mapping_set_block(void *data, bool value) -{ - udev_input_t *udev = (udev_input_t*)data; - if (!udev) - return; - udev->blocked = value; -} - input_driver_t input_udev = { udev_input_init, udev_input_poll, @@ -1379,6 +1362,5 @@ input_driver_t input_udev = { udev_input_set_rumble, udev_input_get_joypad_driver, NULL, - udev_input_keyboard_mapping_is_blocked, - udev_input_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/uwp_input.c b/input/drivers/uwp_input.c index 0fe6d4505a..3b75d62c85 100644 --- a/input/drivers/uwp_input.c +++ b/input/drivers/uwp_input.c @@ -31,7 +31,6 @@ typedef struct uwp_input { - bool blocked; const input_device_driver_t *joypad; } uwp_input_t; @@ -107,22 +106,6 @@ static void uwp_input_grab_mouse(void *data, bool state) (void)state; } -static bool uwp_keyboard_mapping_is_blocked(void *data) -{ - uwp_input_t *uwp = (uwp_input_t*)data; - if (!uwp) - return false; - return uwp->blocked; -} - -static void uwp_keyboard_mapping_set_block(void *data, bool value) -{ - uwp_input_t *uwp = (uwp_input_t*)data; - if (!uwp) - return; - uwp->blocked = value; -} - static bool uwp_pressed_joypad(uwp_input_t *uwp, rarch_joypad_info_t joypad_info, const struct retro_keybind *binds, @@ -132,7 +115,7 @@ static bool uwp_pressed_joypad(uwp_input_t *uwp, /* First, process the keyboard bindings */ if ((bind->key < RETROK_LAST) && uwp_keyboard_pressed(bind->key)) - if ((id == RARCH_GAME_FOCUS_TOGGLE) || !uwp->blocked) + if ((id == RARCH_GAME_FOCUS_TOGGLE) || !input_uwp.keyboard_mapping_blocked) return true; /* Then, process the joypad bindings */ @@ -252,6 +235,5 @@ input_driver_t input_uwp = { uwp_input_set_rumble, uwp_input_get_joypad_driver, NULL, - uwp_keyboard_mapping_is_blocked, - uwp_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/wayland_input.c b/input/drivers/wayland_input.c index e0374ff898..c3fa6969c2 100644 --- a/input/drivers/wayland_input.c +++ b/input/drivers/wayland_input.c @@ -438,22 +438,6 @@ static const input_device_driver_t *input_wl_get_joypad_driver(void *data) return wl->joypad; } -static bool input_wl_keyboard_mapping_is_blocked(void *data) -{ - input_ctx_wayland_data_t *wl = (input_ctx_wayland_data_t*)data; - if (!wl) - return false; - return wl->blocked; -} - -static void input_wl_keyboard_mapping_set_block(void *data, bool value) -{ - input_ctx_wayland_data_t *wl = (input_ctx_wayland_data_t*)data; - if (!wl) - return; - wl->blocked = value; -} - input_driver_t input_wayland = { NULL, input_wl_poll, @@ -468,6 +452,5 @@ input_driver_t input_wayland = { input_wl_set_rumble, input_wl_get_joypad_driver, NULL, - input_wl_keyboard_mapping_is_blocked, - input_wl_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/wiiu_input.c b/input/drivers/wiiu_input.c index dfe9c18703..4290bbc247 100644 --- a/input/drivers/wiiu_input.c +++ b/input/drivers/wiiu_input.c @@ -40,7 +40,6 @@ static bool keyboardState[RETROK_LAST] = { 0 }; typedef struct wiiu_input { - bool blocked; const input_device_driver_t *joypad; } wiiu_input_t; @@ -259,22 +258,6 @@ static bool wiiu_input_set_rumble(void *data, unsigned port, return false; } -static bool wiiu_input_keyboard_mapping_is_blocked(void *data) -{ - wiiu_input_t *wiiu = (wiiu_input_t*)data; - if (!wiiu) - return false; - return wiiu->blocked; -} - -static void wiiu_input_keyboard_mapping_set_block(void *data, bool value) -{ - wiiu_input_t *wiiu = (wiiu_input_t*)data; - if (!wiiu) - return; - wiiu->blocked = value; -} - input_driver_t input_wiiu = { wiiu_input_init, wiiu_input_poll, @@ -289,6 +272,5 @@ input_driver_t input_wiiu = { wiiu_input_set_rumble, wiiu_input_get_joypad_driver, NULL, - wiiu_input_keyboard_mapping_is_blocked, - wiiu_input_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/winraw_input.c b/input/drivers/winraw_input.c index f20f0ae0fb..e9e7db902e 100644 --- a/input/drivers/winraw_input.c +++ b/input/drivers/winraw_input.c @@ -36,7 +36,6 @@ typedef struct typedef struct { - bool kbd_mapp_block; bool mouse_grab; winraw_keyboard_t keyboard; HWND window; @@ -401,7 +400,7 @@ static bool winraw_is_pressed(winraw_input_t *wr, const struct retro_keybind *bind = &binds[id]; if ((bind->key < RETROK_LAST) && winraw_keyboard_pressed(wr, bind->key)) - if ((id == RARCH_GAME_FOCUS_TOGGLE) || !wr->kbd_mapp_block) + if ((id == RARCH_GAME_FOCUS_TOGGLE) || !input_winraw.keyboard_mapping_blocked) return true; if (binds && binds[id].valid) { @@ -843,20 +842,6 @@ static const input_device_driver_t *winraw_get_joypad_driver(void *d) return wr->joypad; } -static bool winraw_keyboard_mapping_is_blocked(void *d) -{ - winraw_input_t *wr = (winraw_input_t*)d; - - return wr->kbd_mapp_block; -} - -static void winraw_keyboard_mapping_set_block(void *d, bool block) -{ - winraw_input_t *wr = (winraw_input_t*)d; - - wr->kbd_mapp_block = block; -} - input_driver_t input_winraw = { winraw_init, winraw_poll, @@ -871,6 +856,5 @@ input_driver_t input_winraw = { winraw_set_rumble, winraw_get_joypad_driver, NULL, - winraw_keyboard_mapping_is_blocked, - winraw_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/x11_input.c b/input/drivers/x11_input.c index 61ea5c0e35..eeced20362 100644 --- a/input/drivers/x11_input.c +++ b/input/drivers/x11_input.c @@ -34,7 +34,6 @@ typedef struct x11_input { - bool blocked; const input_device_driver_t *joypad; Display *display; @@ -132,7 +131,7 @@ static bool x_is_pressed(x11_input_t *x11, const struct retro_keybind *bind = &binds[id]; if ((bind->key < RETROK_LAST) && x_keyboard_pressed(x11, bind->key) ) - if ((id == RARCH_GAME_FOCUS_TOGGLE) || !x11->blocked) + if ((id == RARCH_GAME_FOCUS_TOGGLE) || !input_x.keyboard_mapping_blocked) return true; if (binds && binds[id].valid) @@ -533,22 +532,6 @@ static uint64_t x_input_get_capabilities(void *data) return caps; } -static bool x_keyboard_mapping_is_blocked(void *data) -{ - x11_input_t *x11 = (x11_input_t*)data; - if (!x11) - return false; - return x11->blocked; -} - -static void x_keyboard_mapping_set_block(void *data, bool value) -{ - x11_input_t *x11 = (x11_input_t*)data; - if (!x11) - return; - x11->blocked = value; -} - input_driver_t input_x = { x_input_init, x_input_poll, @@ -563,6 +546,5 @@ input_driver_t input_x = { x_set_rumble, x_get_joypad_driver, NULL, - x_keyboard_mapping_is_blocked, - x_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/xdk_xinput_input.c b/input/drivers/xdk_xinput_input.c index 76fc796fef..55982b82ba 100644 --- a/input/drivers/xdk_xinput_input.c +++ b/input/drivers/xdk_xinput_input.c @@ -37,7 +37,6 @@ typedef struct xdk_input { - bool blocked; const input_device_driver_t *joypad; } xdk_input_t; @@ -196,22 +195,6 @@ static void xdk_input_grab_mouse(void *data, bool state) (void)state; } -static bool xdk_keyboard_mapping_is_blocked(void *data) -{ - xdk_input_t *xdk = (xdk_input_t*)data; - if (!xdk) - return false; - return xdk->blocked; -} - -static void xdk_keyboard_mapping_set_block(void *data, bool value) -{ - xdk_input_t *xdk = (xdk_input_t*)data; - if (!xdk) - return; - xdk->blocked = value; -} - input_driver_t input_xinput = { xdk_input_init, xdk_input_poll, @@ -226,6 +209,5 @@ input_driver_t input_xinput = { xdk_input_set_rumble, xdk_input_get_joypad_driver, NULL, - xdk_keyboard_mapping_is_blocked, - xdk_keyboard_mapping_set_block, + false }; diff --git a/input/drivers/xenon360_input.c b/input/drivers/xenon360_input.c index 45f3c31e91..85297f8372 100644 --- a/input/drivers/xenon360_input.c +++ b/input/drivers/xenon360_input.c @@ -146,6 +146,5 @@ input_driver_t input_xenon360 = { NULL, xenon360_input_set_rumble, NULL, - NULL, - NULL, + false }; diff --git a/input/input_driver.h b/input/input_driver.h index 31d620c50f..334012c0f9 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -164,8 +164,7 @@ struct input_driver enum retro_rumble_effect effect, uint16_t state); const input_device_driver_t *(*get_joypad_driver)(void *data); const input_device_driver_t *(*get_sec_joypad_driver)(void *data); - bool (*keyboard_mapping_is_blocked)(void *data); - void (*keyboard_mapping_set_block)(void *data, bool value); + bool keyboard_mapping_blocked; }; struct rarch_joypad_driver @@ -228,8 +227,6 @@ const input_device_driver_t * input_driver_get_joypad_driver(void); const input_device_driver_t * input_driver_get_sec_joypad_driver(void); -void input_driver_keyboard_mapping_set_block(bool value); - /** * input_sensor_set_state: * @port : User number. @@ -249,7 +246,7 @@ void *input_driver_get_data(void); void input_get_state_for_port( void *data, unsigned port, input_bits_t *p_new_state); -const input_driver_t *input_get_ptr(void); +input_driver_t *input_get_ptr(void); void *input_get_data(void); diff --git a/menu/widgets/menu_input_bind_dialog.c b/menu/widgets/menu_input_bind_dialog.c index be3a3efb23..beb91f0dd6 100644 --- a/menu/widgets/menu_input_bind_dialog.c +++ b/menu/widgets/menu_input_bind_dialog.c @@ -221,7 +221,7 @@ static void menu_input_key_bind_poll_bind_state( { unsigned b; rarch_joypad_info_t joypad_info; - const input_driver_t *input_ptr = input_get_ptr(); + input_driver_t *input_ptr = input_get_ptr(); void *input_data = input_get_data(); const input_device_driver_t *joypad = input_driver_get_joypad_driver(); @@ -554,7 +554,10 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind) if (rarch_timer_has_expired(&menu_input_binds.timer_timeout)) { - input_driver_keyboard_mapping_set_block(false); + input_driver_t *input_drv = input_get_ptr(); + + if (input_drv) + input_drv->keyboard_mapping_blocked = false; /*skip to next bind*/ menu_input_binds.begin++; @@ -578,11 +581,13 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind) } { - bool complete = false; - struct menu_bind_state binds; - binds = menu_input_binds; + bool complete = false; + struct menu_bind_state binds = menu_input_binds; + input_driver_t *input_drv = input_get_ptr(); + + if (input_drv) + input_drv->keyboard_mapping_blocked = true; - input_driver_keyboard_mapping_set_block( true ); menu_input_key_bind_poll_bind_state( &binds, menu_bind_port, timed_out ); #ifdef ANDROID @@ -627,10 +632,13 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind) if ( complete ) { + input_driver_t *input_drv = input_get_ptr(); + /*update bind*/ *( binds.output ) = binds.buffer; - input_driver_keyboard_mapping_set_block( false ); + if (input_drv) + input_drv->keyboard_mapping_blocked = false; /* Avoid new binds triggering things right away. */ input_driver_set_flushing_input(); diff --git a/retroarch.c b/retroarch.c index 33f154bbef..900b44896f 100644 --- a/retroarch.c +++ b/retroarch.c @@ -499,7 +499,7 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = { }; -static const input_driver_t *input_drivers[] = { +static input_driver_t *input_drivers[] = { #ifdef ORBIS &input_ps4, #endif @@ -1623,7 +1623,7 @@ static command_t *input_driver_command = NULL; static input_remote_t *input_driver_remote = NULL; #endif static input_mapper_t *input_driver_mapper = NULL; -static const input_driver_t *current_input = NULL; +static input_driver_t *current_input = NULL; static void *current_input_data = NULL; static bool input_driver_block_hotkey = false; static bool input_driver_block_libretro_input = false; @@ -1750,7 +1750,7 @@ const ui_companion_driver_t *ui_companion_get_ptr(void) return ui_companion; } -const input_driver_t *input_get_ptr(void) +input_driver_t *input_get_ptr(void) { return current_input; } @@ -3975,7 +3975,7 @@ bool command_event(enum event_command cmd, void *data) case CMD_EVENT_REINIT: video_driver_reinit(); { - const input_driver_t *input_drv = current_input; + input_driver_t *input_drv = current_input; void *input_data = current_input_data; /* Poll input to avoid possibly stale data to corrupt things. */ if (input_drv && input_drv->poll) @@ -4798,7 +4798,7 @@ TODO: Add a setting for these tweaks */ input_driver_grab_mouse(); video_driver_hide_mouse(); input_driver_set_hotkey_block(); - input_driver_keyboard_mapping_set_block(1); + current_input->keyboard_mapping_blocked = true; if (mode != -1) runloop_msg_queue_push(msg_hash_to_str(MSG_GAME_FOCUS_ON), 1, 120, true, @@ -4809,7 +4809,7 @@ TODO: Add a setting for these tweaks */ input_driver_ungrab_mouse(); video_driver_show_mouse(); input_driver_unset_hotkey_block(); - input_driver_keyboard_mapping_set_block(0); + current_input->keyboard_mapping_blocked = false; if (mode != -1) runloop_msg_queue_push(msg_hash_to_str(MSG_GAME_FOCUS_OFF), 1, 120, true, @@ -10232,7 +10232,7 @@ static void input_poll_overlay(input_overlay_t *ol, float opacity, bool button_pressed = false; void *input_data = current_input_data; input_overlay_state_t *ol_state = &ol->overlay_state; - const input_driver_t *input_ptr = current_input; + input_driver_t *input_ptr = current_input; if (!ol_state) return; @@ -10560,7 +10560,7 @@ const void *input_driver_find_handle(int idx) **/ const char *input_driver_find_ident(int idx) { - const input_driver_t *drv = input_drivers[idx]; + input_driver_t *drv = input_drivers[idx]; if (!drv) return NULL; return drv->ident; @@ -10622,12 +10622,6 @@ uint64_t input_driver_get_capabilities(void) return current_input->get_capabilities(current_input_data); } -void input_driver_keyboard_mapping_set_block(bool value) -{ - if (current_input->keyboard_mapping_set_block) - current_input->keyboard_mapping_set_block(current_input_data, value); -} - /** * input_sensor_set_state: * @port : User number. @@ -12449,8 +12443,7 @@ static bool input_driver_find_driver(void) i = (int)drv.len; if (i >= 0) - current_input = (const input_driver_t*) - input_driver_find_handle(i); + current_input = (input_driver_t*)input_driver_find_handle(i); else { unsigned d; @@ -12461,8 +12454,7 @@ static bool input_driver_find_driver(void) RARCH_LOG_OUTPUT("\t%s\n", input_driver_find_ident(d)); RARCH_WARN("Going to default to first input driver...\n"); - current_input = (const input_driver_t*) - input_driver_find_handle(0); + current_input = (input_driver_t*)input_driver_find_handle(0); if (!current_input) { @@ -13191,8 +13183,7 @@ const char **input_keyboard_start_line(void *userdata, g_keyboard_line->userdata = userdata; /* While reading keyboard line input, we have to block all hotkeys. */ - if (current_input->keyboard_mapping_set_block) - current_input->keyboard_mapping_set_block(current_input_data, true); + current_input->keyboard_mapping_blocked = true; return (const char**)&g_keyboard_line->buffer; } @@ -13219,8 +13210,7 @@ void input_keyboard_event(bool down, unsigned code, g_keyboard_press_cb = NULL; g_keyboard_press_data = NULL; - if (current_input->keyboard_mapping_set_block) - current_input->keyboard_mapping_set_block(current_input_data, false); + current_input->keyboard_mapping_blocked = false; deferred_wait_keys = false; } else if (g_keyboard_press_cb) @@ -13252,8 +13242,7 @@ void input_keyboard_event(bool down, unsigned code, input_keyboard_ctl(RARCH_INPUT_KEYBOARD_CTL_LINE_FREE, NULL); /* Unblock all hotkeys. */ - if (current_input->keyboard_mapping_set_block) - current_input->keyboard_mapping_set_block(current_input_data, false); + current_input->keyboard_mapping_blocked = false; } else { @@ -13288,14 +13277,12 @@ bool input_keyboard_ctl(enum rarch_input_keyboard_ctl_state state, void *data) } /* While waiting for input, we have to block all hotkeys. */ - if (current_input->keyboard_mapping_set_block) - current_input->keyboard_mapping_set_block(current_input_data, true); + current_input->keyboard_mapping_blocked = true; break; case RARCH_INPUT_KEYBOARD_CTL_CANCEL_WAIT_KEYS: g_keyboard_press_cb = NULL; g_keyboard_press_data = NULL; - if (current_input->keyboard_mapping_set_block) - current_input->keyboard_mapping_set_block(current_input_data, false); + current_input->keyboard_mapping_blocked = false; break; case RARCH_INPUT_KEYBOARD_CTL_SET_LINEFEED_ENABLED: input_driver_keyboard_linefeed_enable = true; @@ -16606,9 +16593,9 @@ static void video_driver_init_filter(enum retro_pixel_format colfmt_int) video_driver_state_buffer = buf; } -static void video_driver_init_input(const input_driver_t *tmp) +static void video_driver_init_input(input_driver_t *tmp) { - const input_driver_t **input = ¤t_input; + input_driver_t **input = ¤t_input; if (*input) return; @@ -16711,6 +16698,7 @@ static void video_driver_free_internal(void) { if (current_input && current_input->free) current_input->free(current_input_data); + current_input->keyboard_mapping_blocked = false; current_input_data = NULL; } @@ -16796,7 +16784,7 @@ static bool video_driver_init_internal(bool *video_is_threaded) video_info_t video; unsigned max_dim, scale, width, height; video_viewport_t *custom_vp = NULL; - const input_driver_t *tmp = NULL; + input_driver_t *tmp = NULL; rarch_system_info_t *system = NULL; static uint16_t dummy_pixels[32] = {0}; settings_t *settings = configuration_settings; @@ -22825,11 +22813,9 @@ static enum runloop_state runloop_check_state( input_driver_block_libretro_input = false; input_driver_block_hotkey = false; - if ( current_input->keyboard_mapping_is_blocked - && current_input->keyboard_mapping_is_blocked(current_input_data)) + if (current_input->keyboard_mapping_blocked) input_driver_block_hotkey = true; - #ifdef HAVE_MENU if (menu_is_alive && !(settings->bools.menu_unified_controls && !menu_input_dialog_get_display_kb())) input_menu_keys_pressed(¤t_bits); @@ -24183,7 +24169,7 @@ static bool rarch_write_debug_info(void) { gfx_ctx_ident_t ident_info = {0}; - const input_driver_t *input_driver; + input_driver_t *input_driver; const input_device_driver_t *joypad_driver; const char *driver; #ifdef HAVE_MENU diff --git a/retroarch.h b/retroarch.h index cd0c053fac..d7e84ee857 100644 --- a/retroarch.h +++ b/retroarch.h @@ -1290,7 +1290,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 char *, const input_driver_t**, void**); + void (*input_driver)(void*, const char *, input_driver_t**, void**); /* Wraps whatever gl_proc_address() there is. * Does not take opaque, to avoid lots of ugly wrapper code. */ @@ -1373,7 +1373,7 @@ typedef struct gfx_ctx_image typedef struct gfx_ctx_input { - const input_driver_t **input; + input_driver_t **input; void **input_data; } gfx_ctx_input_t; @@ -1454,7 +1454,7 @@ typedef struct video_driver * to override the settings in case the video driver relies on * input driver for event handling. */ void *(*init)(const video_info_t *video, - const input_driver_t **input, + input_driver_t **input, void **input_data); /* Updates frame on the screen.