mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
Add HAVE_MENU ifdefs for menu code
This commit is contained in:
parent
80a6013e7b
commit
e3620278a8
2
deps/SPIRV-Cross
vendored
2
deps/SPIRV-Cross
vendored
@ -1 +1 @@
|
||||
Subproject commit cc207e32c8668bfe5a5cc514394e7df8f020ecf6
|
||||
Subproject commit b9600aa8d3d1ff4c412d316fcd56c0951addcc33
|
2
deps/glslang/glslang
vendored
2
deps/glslang/glslang
vendored
@ -1 +1 @@
|
||||
Subproject commit ec2e27adf86a911c5af6c676a539166b5674a09d
|
||||
Subproject commit 2eb0986f10392a4c2365869b17b59ad79226c440
|
@ -540,6 +540,7 @@ void state_tracker_update_input(uint16_t *input1, uint16_t *input2)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
static INLINE bool input_menu_keys_pressed_internal(unsigned i)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -610,134 +611,6 @@ static INLINE bool input_menu_keys_pressed_internal(unsigned i)
|
||||
return false;
|
||||
}
|
||||
|
||||
static INLINE bool input_keys_pressed_internal(unsigned i,
|
||||
const struct retro_keybind *binds)
|
||||
{
|
||||
if (((!input_driver_block_libretro_input && ((i < RARCH_FIRST_META_KEY)))
|
||||
|| !input_driver_block_hotkey))
|
||||
{
|
||||
if (current_input->input_state(current_input_data, &binds,
|
||||
0, RETRO_DEVICE_JOYPAD, 0, i))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (i >= RARCH_FIRST_META_KEY)
|
||||
{
|
||||
if (current_input->meta_key_pressed(current_input_data, i))
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
if (overlay_ptr && input_overlay_key_pressed(overlay_ptr, i))
|
||||
return true;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_COMMAND
|
||||
if (input_driver_command)
|
||||
{
|
||||
command_handle_t handle;
|
||||
|
||||
handle.handle = input_driver_command;
|
||||
handle.id = i;
|
||||
|
||||
if (command_get(&handle))
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETWORKGAMEPAD
|
||||
if (input_driver_remote)
|
||||
{
|
||||
if (input_remote_key_pressed(i, 0))
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* input_keys_pressed:
|
||||
*
|
||||
* Grab an input sample for this frame.
|
||||
*
|
||||
* TODO: In case RARCH_BIND_LIST_END starts exceeding 64,
|
||||
* and you need a bitmask of more than 64 entries, reimplement
|
||||
* it to use something like rarch_bits_t.
|
||||
*
|
||||
* Returns: Input sample containg a mask of all pressed keys.
|
||||
*/
|
||||
uint64_t input_keys_pressed(
|
||||
uint64_t old_input,
|
||||
uint64_t *last_input,
|
||||
uint64_t *trigger_input,
|
||||
bool runloop_paused)
|
||||
{
|
||||
unsigned i;
|
||||
uint64_t ret = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const struct retro_keybind *binds = settings->input.binds[0];
|
||||
const struct retro_keybind *binds_auto = &settings->input.autoconf_binds[0][RARCH_ENABLE_HOTKEY];
|
||||
const struct retro_keybind *normal = &binds[RARCH_ENABLE_HOTKEY];
|
||||
|
||||
const struct retro_keybind *focus_binds_auto = &settings->input.autoconf_binds[0][RARCH_GAME_FOCUS_TOGGLE];
|
||||
const struct retro_keybind *focus_normal = &binds[RARCH_GAME_FOCUS_TOGGLE];
|
||||
|
||||
input_driver_block_libretro_input = false;
|
||||
input_driver_block_hotkey = false;
|
||||
|
||||
/* Don't block the check to RARCH_ENABLE_HOTKEY
|
||||
* unless we're really supposed to. */
|
||||
if (current_input->keyboard_mapping_is_blocked &&
|
||||
current_input->keyboard_mapping_is_blocked(current_input_data))
|
||||
input_driver_block_hotkey = true;
|
||||
|
||||
if (check_input_driver_block_hotkey(normal, binds_auto))
|
||||
{
|
||||
if (current_input->input_state(current_input_data, &binds, 0,
|
||||
RETRO_DEVICE_JOYPAD, 0, RARCH_ENABLE_HOTKEY))
|
||||
input_driver_block_libretro_input = true;
|
||||
else
|
||||
input_driver_block_hotkey = true;
|
||||
}
|
||||
|
||||
/* Allows rarch_focus_toggle hotkey to still work even tough every hotkey is blocked */
|
||||
if (check_input_driver_block_hotkey(focus_normal, focus_binds_auto))
|
||||
{
|
||||
if (current_input->input_state(current_input_data, &binds, 0,
|
||||
RETRO_DEVICE_JOYPAD, 0, RARCH_GAME_FOCUS_TOGGLE))
|
||||
input_driver_block_hotkey = false;
|
||||
}
|
||||
|
||||
for (i = 0; i < RARCH_BIND_LIST_END; i++)
|
||||
{
|
||||
if (input_keys_pressed_internal(i, binds))
|
||||
ret |= (UINT64_C(1) << i);
|
||||
}
|
||||
|
||||
*trigger_input = ret & ~old_input;
|
||||
*last_input = ret;
|
||||
|
||||
if (input_driver_flushing_input)
|
||||
{
|
||||
input_driver_flushing_input = false;
|
||||
|
||||
if (ret)
|
||||
{
|
||||
ret = 0;
|
||||
|
||||
/* If core was paused before entering menu, evoke
|
||||
* pause toggle to wake it up. */
|
||||
if (runloop_paused)
|
||||
BIT64_SET(ret, RARCH_PAUSE_TOGGLE);
|
||||
input_driver_flushing_input = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* input_menu_keys_pressed:
|
||||
*
|
||||
@ -898,6 +771,135 @@ end:
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static INLINE bool input_keys_pressed_internal(unsigned i,
|
||||
const struct retro_keybind *binds)
|
||||
{
|
||||
if (((!input_driver_block_libretro_input && ((i < RARCH_FIRST_META_KEY)))
|
||||
|| !input_driver_block_hotkey))
|
||||
{
|
||||
if (current_input->input_state(current_input_data, &binds,
|
||||
0, RETRO_DEVICE_JOYPAD, 0, i))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (i >= RARCH_FIRST_META_KEY)
|
||||
{
|
||||
if (current_input->meta_key_pressed(current_input_data, i))
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
if (overlay_ptr && input_overlay_key_pressed(overlay_ptr, i))
|
||||
return true;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_COMMAND
|
||||
if (input_driver_command)
|
||||
{
|
||||
command_handle_t handle;
|
||||
|
||||
handle.handle = input_driver_command;
|
||||
handle.id = i;
|
||||
|
||||
if (command_get(&handle))
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETWORKGAMEPAD
|
||||
if (input_driver_remote)
|
||||
{
|
||||
if (input_remote_key_pressed(i, 0))
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* input_keys_pressed:
|
||||
*
|
||||
* Grab an input sample for this frame.
|
||||
*
|
||||
* TODO: In case RARCH_BIND_LIST_END starts exceeding 64,
|
||||
* and you need a bitmask of more than 64 entries, reimplement
|
||||
* it to use something like rarch_bits_t.
|
||||
*
|
||||
* Returns: Input sample containg a mask of all pressed keys.
|
||||
*/
|
||||
uint64_t input_keys_pressed(
|
||||
uint64_t old_input,
|
||||
uint64_t *last_input,
|
||||
uint64_t *trigger_input,
|
||||
bool runloop_paused)
|
||||
{
|
||||
unsigned i;
|
||||
uint64_t ret = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const struct retro_keybind *binds = settings->input.binds[0];
|
||||
const struct retro_keybind *binds_auto = &settings->input.autoconf_binds[0][RARCH_ENABLE_HOTKEY];
|
||||
const struct retro_keybind *normal = &binds[RARCH_ENABLE_HOTKEY];
|
||||
|
||||
const struct retro_keybind *focus_binds_auto = &settings->input.autoconf_binds[0][RARCH_GAME_FOCUS_TOGGLE];
|
||||
const struct retro_keybind *focus_normal = &binds[RARCH_GAME_FOCUS_TOGGLE];
|
||||
|
||||
input_driver_block_libretro_input = false;
|
||||
input_driver_block_hotkey = false;
|
||||
|
||||
/* Don't block the check to RARCH_ENABLE_HOTKEY
|
||||
* unless we're really supposed to. */
|
||||
if (current_input->keyboard_mapping_is_blocked &&
|
||||
current_input->keyboard_mapping_is_blocked(current_input_data))
|
||||
input_driver_block_hotkey = true;
|
||||
|
||||
if (check_input_driver_block_hotkey(normal, binds_auto))
|
||||
{
|
||||
if (current_input->input_state(current_input_data, &binds, 0,
|
||||
RETRO_DEVICE_JOYPAD, 0, RARCH_ENABLE_HOTKEY))
|
||||
input_driver_block_libretro_input = true;
|
||||
else
|
||||
input_driver_block_hotkey = true;
|
||||
}
|
||||
|
||||
/* Allows rarch_focus_toggle hotkey to still work even tough every hotkey is blocked */
|
||||
if (check_input_driver_block_hotkey(focus_normal, focus_binds_auto))
|
||||
{
|
||||
if (current_input->input_state(current_input_data, &binds, 0,
|
||||
RETRO_DEVICE_JOYPAD, 0, RARCH_GAME_FOCUS_TOGGLE))
|
||||
input_driver_block_hotkey = false;
|
||||
}
|
||||
|
||||
for (i = 0; i < RARCH_BIND_LIST_END; i++)
|
||||
{
|
||||
if (input_keys_pressed_internal(i, binds))
|
||||
ret |= (UINT64_C(1) << i);
|
||||
}
|
||||
|
||||
*trigger_input = ret & ~old_input;
|
||||
*last_input = ret;
|
||||
|
||||
if (input_driver_flushing_input)
|
||||
{
|
||||
input_driver_flushing_input = false;
|
||||
|
||||
if (ret)
|
||||
{
|
||||
ret = 0;
|
||||
|
||||
/* If core was paused before entering menu, evoke
|
||||
* pause toggle to wake it up. */
|
||||
if (runloop_paused)
|
||||
BIT64_SET(ret, RARCH_PAUSE_TOGGLE);
|
||||
input_driver_flushing_input = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void *input_driver_get_data(void)
|
||||
{
|
||||
|
@ -262,11 +262,13 @@ uint64_t input_keys_pressed(
|
||||
uint64_t *trigger_input,
|
||||
bool runloop_paused);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
uint64_t input_menu_keys_pressed(
|
||||
uint64_t old_input,
|
||||
uint64_t *last_input,
|
||||
uint64_t *trigger_input,
|
||||
bool runloop_paused);
|
||||
#endif
|
||||
|
||||
void *input_driver_get_data(void);
|
||||
|
||||
|
@ -1094,8 +1094,10 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||
settings_t *settings = config_get_ptr();
|
||||
uint64_t old_input = last_input;
|
||||
uint64_t current_input =
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) ?
|
||||
input_menu_keys_pressed(old_input, &last_input, &trigger_input, runloop_paused) :
|
||||
#endif
|
||||
input_keys_pressed (old_input, &last_input, &trigger_input, runloop_paused);
|
||||
|
||||
if (runloop_frame_time.callback)
|
||||
|
Loading…
x
Reference in New Issue
Block a user