mirror of
https://github.com/libretro/RetroArch
synced 2025-03-24 13:43:32 +00:00
Create RUNLOOP_CTL_KEY_EVENT_GET
This commit is contained in:
parent
3a05525ad0
commit
e7749c5d42
10
dynamic.c
10
dynamic.c
@ -846,12 +846,18 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||||||
|
|
||||||
case RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK:
|
case RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK:
|
||||||
{
|
{
|
||||||
|
retro_keyboard_event_t *key_event = NULL;
|
||||||
const struct retro_keyboard_callback *info =
|
const struct retro_keyboard_callback *info =
|
||||||
(const struct retro_keyboard_callback*)data;
|
(const struct retro_keyboard_callback*)data;
|
||||||
|
|
||||||
|
runloop_ctl(RUNLOOP_CTL_KEY_EVENT_GET, &key_event);
|
||||||
|
|
||||||
|
if (!key_event)
|
||||||
|
return false;
|
||||||
|
|
||||||
RARCH_LOG("Environ SET_KEYBOARD_CALLBACK.\n");
|
RARCH_LOG("Environ SET_KEYBOARD_CALLBACK.\n");
|
||||||
system->key_event = info->callback;
|
*key_event = info->callback;
|
||||||
global->frontend_key_event = system->key_event;
|
global->frontend_key_event = *key_event;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,11 +282,10 @@ void input_keyboard_event(bool down, unsigned code,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rarch_system_info_t *system = NULL;
|
retro_keyboard_event_t *key_event = NULL;
|
||||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
runloop_ctl(RUNLOOP_CTL_KEY_EVENT_GET, &key_event);
|
||||||
|
|
||||||
if (system && system->key_event)
|
if (key_event && *key_event)
|
||||||
system->key_event(down, code, character, mod);
|
(*key_event)(down, code, character, mod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,10 +295,16 @@ static void menu_driver_toggle(bool latch)
|
|||||||
* FIXME: This should probably be moved to menu_common somehow. */
|
* FIXME: This should probably be moved to menu_common somehow. */
|
||||||
if (global)
|
if (global)
|
||||||
{
|
{
|
||||||
global->frontend_key_event = system->key_event;
|
retro_keyboard_event_t *key_event = NULL;
|
||||||
system->key_event = menu_input_key_event;
|
runloop_ctl(RUNLOOP_CTL_KEY_EVENT_GET, &key_event);
|
||||||
|
|
||||||
runloop_ctl(RUNLOOP_CTL_SET_FRAME_TIME_LAST, NULL);
|
if (key_event)
|
||||||
|
{
|
||||||
|
global->frontend_key_event = *key_event;
|
||||||
|
*key_event = menu_input_key_event;
|
||||||
|
|
||||||
|
runloop_ctl(RUNLOOP_CTL_SET_FRAME_TIME_LAST, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -314,7 +320,14 @@ static void menu_driver_toggle(bool latch)
|
|||||||
|
|
||||||
/* Restore libretro keyboard callback. */
|
/* Restore libretro keyboard callback. */
|
||||||
if (global)
|
if (global)
|
||||||
system->key_event = global->frontend_key_event;
|
{
|
||||||
|
retro_keyboard_event_t *key_event = NULL;
|
||||||
|
|
||||||
|
runloop_ctl(RUNLOOP_CTL_KEY_EVENT_GET, &key_event);
|
||||||
|
|
||||||
|
if (key_event)
|
||||||
|
*key_event = global->frontend_key_event;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
40
runloop.c
40
runloop.c
@ -465,23 +465,24 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
|||||||
{
|
{
|
||||||
static char runloop_fullpath[PATH_MAX_LENGTH];
|
static char runloop_fullpath[PATH_MAX_LENGTH];
|
||||||
static rarch_system_info_t runloop_system;
|
static rarch_system_info_t runloop_system;
|
||||||
static unsigned runloop_max_frames = false;
|
static retro_keyboard_event_t runloop_key_event = NULL;
|
||||||
static bool runloop_frame_time_last = false;
|
static unsigned runloop_max_frames = false;
|
||||||
static bool runloop_set_frame_limit = false;
|
static bool runloop_frame_time_last = false;
|
||||||
static bool runloop_paused = false;
|
static bool runloop_set_frame_limit = false;
|
||||||
static bool runloop_idle = false;
|
static bool runloop_paused = false;
|
||||||
static bool runloop_exec = false;
|
static bool runloop_idle = false;
|
||||||
static bool runloop_slowmotion = false;
|
static bool runloop_exec = false;
|
||||||
static bool runloop_shutdown_initiated = false;
|
static bool runloop_slowmotion = false;
|
||||||
static bool runloop_core_shutdown_initiated = false;
|
static bool runloop_shutdown_initiated = false;
|
||||||
static bool runloop_perfcnt_enable = false;
|
static bool runloop_core_shutdown_initiated = false;
|
||||||
static bool runloop_overrides_active = false;
|
static bool runloop_perfcnt_enable = false;
|
||||||
|
static bool runloop_overrides_active = false;
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
static slock_t *runloop_msg_queue_lock = NULL;
|
static slock_t *runloop_msg_queue_lock = NULL;
|
||||||
#endif
|
#endif
|
||||||
static core_info_t *core_info_current = NULL;
|
static core_info_t *core_info_current = NULL;
|
||||||
static core_info_list_t *core_info_curr_list= NULL;
|
static core_info_list_t *core_info_curr_list = NULL;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
@ -582,6 +583,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
|||||||
free(runloop_system.ports);
|
free(runloop_system.ports);
|
||||||
runloop_system.ports = NULL;
|
runloop_system.ports = NULL;
|
||||||
|
|
||||||
|
runloop_key_event = NULL;
|
||||||
memset(&runloop_system, 0, sizeof(rarch_system_info_t));
|
memset(&runloop_system, 0, sizeof(rarch_system_info_t));
|
||||||
break;
|
break;
|
||||||
case RUNLOOP_CTL_IS_FRAME_COUNT_END:
|
case RUNLOOP_CTL_IS_FRAME_COUNT_END:
|
||||||
@ -1109,6 +1111,14 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
|||||||
|
|
||||||
runloop_system.core_options = NULL;
|
runloop_system.core_options = NULL;
|
||||||
return true;
|
return true;
|
||||||
|
case RUNLOOP_CTL_KEY_EVENT_GET:
|
||||||
|
{
|
||||||
|
retro_keyboard_event_t **key_event = (retro_keyboard_event_t**)data;
|
||||||
|
if (!key_event)
|
||||||
|
return false;
|
||||||
|
*key_event = &runloop_key_event;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case RUNLOOP_CTL_NONE:
|
case RUNLOOP_CTL_NONE:
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -75,6 +75,7 @@ enum runloop_ctl_state
|
|||||||
RUNLOOP_CTL_CURRENT_CORE_FREE,
|
RUNLOOP_CTL_CURRENT_CORE_FREE,
|
||||||
RUNLOOP_CTL_CURRENT_CORE_INIT,
|
RUNLOOP_CTL_CURRENT_CORE_INIT,
|
||||||
RUNLOOP_CTL_CURRENT_CORE_GET,
|
RUNLOOP_CTL_CURRENT_CORE_GET,
|
||||||
|
RUNLOOP_CTL_KEY_EVENT_GET,
|
||||||
RUNLOOP_CTL_DATA_DEINIT,
|
RUNLOOP_CTL_DATA_DEINIT,
|
||||||
/* Checks for state changes in this frame. */
|
/* Checks for state changes in this frame. */
|
||||||
RUNLOOP_CTL_CHECK_STATE,
|
RUNLOOP_CTL_CHECK_STATE,
|
||||||
|
2
system.h
2
system.h
@ -46,8 +46,6 @@ typedef struct rarch_system_info
|
|||||||
const char *input_desc_btn[MAX_USERS][RARCH_FIRST_META_KEY];
|
const char *input_desc_btn[MAX_USERS][RARCH_FIRST_META_KEY];
|
||||||
char valid_extensions[PATH_MAX_LENGTH];
|
char valid_extensions[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
retro_keyboard_event_t key_event;
|
|
||||||
|
|
||||||
struct retro_disk_control_callback disk_control;
|
struct retro_disk_control_callback disk_control;
|
||||||
struct retro_camera_callback camera_callback;
|
struct retro_camera_callback camera_callback;
|
||||||
struct retro_location_callback location_callback;
|
struct retro_location_callback location_callback;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user