mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 08:30:16 +00:00
Start creating input_driver_ctl
This commit is contained in:
parent
3e8659cdb9
commit
14b2b8ada7
@ -433,7 +433,7 @@ static void init_video_input(const input_driver_t *tmp)
|
||||
if (!driver->input)
|
||||
goto error;
|
||||
|
||||
if (input_driver_init())
|
||||
if (input_driver_ctl(RARCH_INPUT_CTL_INIT, NULL))
|
||||
return;
|
||||
|
||||
error:
|
||||
@ -514,7 +514,7 @@ static bool uninit_video_input(void)
|
||||
!driver->input_data_own &&
|
||||
(driver->input_data != video_data)
|
||||
)
|
||||
input_driver_free();
|
||||
input_driver_ctl(RARCH_INPUT_CTL_DEINIT, NULL);
|
||||
|
||||
if (
|
||||
!driver->video_data_own &&
|
||||
|
@ -229,18 +229,6 @@ bool input_driver_grab_stdin(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool input_driver_init(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
if (driver && driver->input)
|
||||
driver->input_data = driver->input->init();
|
||||
|
||||
if (!driver->input_data)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void input_driver_set(const input_driver_t **input, void **input_data)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
@ -254,14 +242,6 @@ void input_driver_set(const input_driver_t **input, void **input_data)
|
||||
driver->input_data_own = true;
|
||||
}
|
||||
|
||||
void input_driver_free(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
if (driver && driver->input)
|
||||
driver->input->free(driver->input_data);
|
||||
}
|
||||
|
||||
void input_driver_destroy(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
@ -321,3 +301,30 @@ float input_sensor_get_input(unsigned port, unsigned id)
|
||||
port, id);
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
bool input_driver_ctl(enum rarch_input_ctl_state state, void *data)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case RARCH_INPUT_CTL_INIT:
|
||||
if (driver && driver->input)
|
||||
driver->input_data = driver->input->init();
|
||||
|
||||
if (!driver->input_data)
|
||||
return false;
|
||||
return true;
|
||||
case RARCH_INPUT_CTL_DEINIT:
|
||||
if (!driver || !driver->input)
|
||||
return false;
|
||||
driver->input->free(driver->input_data);
|
||||
return true;
|
||||
case RARCH_INPUT_CTL_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -46,6 +46,13 @@ enum input_device_type
|
||||
INPUT_DEVICE_TYPE_JOYPAD
|
||||
};
|
||||
|
||||
enum rarch_input_ctl_state
|
||||
{
|
||||
RARCH_INPUT_CTL_NONE = 0,
|
||||
RARCH_INPUT_CTL_INIT,
|
||||
RARCH_INPUT_CTL_DEINIT,
|
||||
};
|
||||
|
||||
struct retro_keybind
|
||||
{
|
||||
bool valid;
|
||||
@ -165,10 +172,6 @@ bool input_driver_grab_mouse(bool state);
|
||||
|
||||
bool input_driver_grab_stdin(void);
|
||||
|
||||
bool input_driver_init(void);
|
||||
|
||||
void input_driver_free(void);
|
||||
|
||||
void input_driver_destroy(void);
|
||||
|
||||
bool input_driver_keyboard_mapping_is_blocked(void);
|
||||
@ -193,6 +196,8 @@ bool input_sensor_set_state(unsigned port,
|
||||
|
||||
float input_sensor_get_input(unsigned port, unsigned id);
|
||||
|
||||
bool input_driver_ctl(enum rarch_input_ctl_state state, void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user