mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-20 09:48:27 +00:00
Move input_data_own to input_driver.c
This commit is contained in:
parent
ff13338ca9
commit
df9f0fc6d1
4
driver.c
4
driver.c
@ -363,7 +363,7 @@ void init_drivers(int flags)
|
||||
if (flags & DRIVER_AUDIO)
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_UNSET_OWN_DRIVER, NULL);
|
||||
if (flags & DRIVER_INPUT)
|
||||
driver->input_data_own = false;
|
||||
input_driver_ctl(RARCH_INPUT_CTL_UNSET_OWN_DRIVER, NULL);
|
||||
if (flags & DRIVER_CAMERA)
|
||||
driver->camera_data_own = false;
|
||||
if (flags & DRIVER_LOCATION)
|
||||
@ -465,7 +465,7 @@ void uninit_drivers(int flags)
|
||||
if (flags & DRIVERS_VIDEO_INPUT)
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_DEINIT, NULL);
|
||||
|
||||
if ((flags & DRIVER_INPUT) && !driver->input_data_own)
|
||||
if ((flags & DRIVER_INPUT) && !input_driver_ctl(RARCH_INPUT_CTL_OWNS_DRIVER, NULL))
|
||||
input_driver_ctl(RARCH_INPUT_CTL_DESTROY, NULL);
|
||||
}
|
||||
|
||||
|
1
driver.h
1
driver.h
@ -249,7 +249,6 @@ typedef struct driver
|
||||
*
|
||||
* Typically, if a driver intends to make use of this, it should
|
||||
* set this to true at the end of its 'init' function. */
|
||||
bool input_data_own;
|
||||
bool camera_data_own;
|
||||
bool location_data_own;
|
||||
#ifdef HAVE_MENU
|
||||
|
@ -528,7 +528,7 @@ static bool uninit_video_input(void)
|
||||
event_command(EVENT_CMD_OVERLAY_DEINIT);
|
||||
|
||||
if (
|
||||
!driver->input_data_own &&
|
||||
!input_driver_ctl(RARCH_INPUT_CTL_OWNS_DRIVER, NULL) &&
|
||||
!input_driver_data_ptr_is_same(video_data)
|
||||
)
|
||||
input_driver_ctl(RARCH_INPUT_CTL_DEINIT, NULL);
|
||||
|
@ -82,6 +82,7 @@ struct turbo_buttons
|
||||
unsigned count;
|
||||
};
|
||||
|
||||
static bool input_data_own;
|
||||
static const input_driver_t *main_input;
|
||||
static void *main_input_data;
|
||||
static bool flushing_input;
|
||||
@ -212,15 +213,13 @@ bool input_driver_grab_mouse(bool state)
|
||||
|
||||
void input_driver_set(const input_driver_t **input, void **input_data)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
if (input && input_data)
|
||||
{
|
||||
*input = main_input;
|
||||
*input_data = main_input_data;
|
||||
}
|
||||
|
||||
driver->input_data_own = true;
|
||||
input_data_own = true;
|
||||
}
|
||||
|
||||
void input_driver_keyboard_mapping_set_block(bool value)
|
||||
@ -747,6 +746,14 @@ bool input_driver_ctl(enum rarch_input_ctl_state state, void *data)
|
||||
break;
|
||||
case RARCH_INPUT_CTL_IS_NONBLOCK_STATE:
|
||||
return nonblock_state;
|
||||
case RARCH_INPUT_CTL_SET_OWN_DRIVER:
|
||||
input_data_own = true;
|
||||
break;
|
||||
case RARCH_INPUT_CTL_UNSET_OWN_DRIVER:
|
||||
input_data_own = false;
|
||||
break;
|
||||
case RARCH_INPUT_CTL_OWNS_DRIVER:
|
||||
return input_data_own;
|
||||
case RARCH_INPUT_CTL_NONE:
|
||||
default:
|
||||
break;
|
||||
|
@ -65,7 +65,10 @@ enum rarch_input_ctl_state
|
||||
RARCH_INPUT_CTL_IS_LIBRETRO_INPUT_BLOCKED,
|
||||
RARCH_INPUT_CTL_SET_NONBLOCK_STATE,
|
||||
RARCH_INPUT_CTL_UNSET_NONBLOCK_STATE,
|
||||
RARCH_INPUT_CTL_IS_NONBLOCK_STATE
|
||||
RARCH_INPUT_CTL_IS_NONBLOCK_STATE,
|
||||
RARCH_INPUT_CTL_SET_OWN_DRIVER,
|
||||
RARCH_INPUT_CTL_UNSET_OWN_DRIVER,
|
||||
RARCH_INPUT_CTL_OWNS_DRIVER
|
||||
};
|
||||
|
||||
struct retro_keybind
|
||||
|
Loading…
Reference in New Issue
Block a user