add F10 hotkey to send debug info, fix F3 hotkey for FPS toggle when inside menu

This commit is contained in:
Brad Parker 2019-03-09 16:03:17 -05:00
parent 99035dbb0a
commit 4bb81bbb1b
10 changed files with 105 additions and 15 deletions

View File

@ -223,6 +223,7 @@ static const struct cmd_map map[] = {
{ "MUTE", RARCH_MUTE },
{ "OSK", RARCH_OSK },
{ "FPS_TOGGLE", RARCH_FPS_TOGGLE },
{ "SEND_DEBUG_INFO", RARCH_SEND_DEBUG_INFO },
{ "NETPLAY_GAME_WATCH", RARCH_NETPLAY_GAME_WATCH },
{ "VOLUME_UP", RARCH_VOLUME_UP },
{ "VOLUME_DOWN", RARCH_VOLUME_DOWN },
@ -2110,6 +2111,9 @@ TODO: Add a setting for these tweaks */
RARCH_LOG("%s\n", msg);
}
break;
case CMD_EVENT_SEND_DEBUG_INFO:
rarch_send_debug_info();
break;
case CMD_EVENT_FPS_TOGGLE:
{
settings_t *settings = config_get_ptr();

View File

@ -85,6 +85,8 @@ enum event_command
CMD_EVENT_AUDIO_MUTE_TOGGLE,
/* Toggles FPS counter. */
CMD_EVENT_FPS_TOGGLE,
/* Gathers diagnostic info about the system and RetroArch configuration, then sends it to our servers. */
CMD_EVENT_SEND_DEBUG_INFO,
/* Initializes overlay. */
CMD_EVENT_OVERLAY_INIT,
/* Deinitializes overlay. */

View File

@ -88,6 +88,7 @@ static const struct retro_keybind retro_keybinds_1[] = {
{ true, RARCH_MUTE, MENU_ENUM_LABEL_VALUE_INPUT_META_MUTE, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_OSK, MENU_ENUM_LABEL_VALUE_INPUT_META_OSK, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_FPS_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_FPS_TOGGLE, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_SEND_DEBUG_INFO, MENU_ENUM_LABEL_VALUE_INPUT_META_SEND_DEBUG_INFO, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_NETPLAY_GAME_WATCH, MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_GAME_WATCH, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_ENABLE_HOTKEY, MENU_ENUM_LABEL_VALUE_INPUT_META_ENABLE_HOTKEY, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_VOLUME_UP, MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_UP, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE },
@ -167,6 +168,7 @@ static const struct retro_keybind retro_keybinds_1[] = {
{ true, RARCH_MUTE, MENU_ENUM_LABEL_VALUE_INPUT_META_MUTE, RETROK_F9, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_OSK, MENU_ENUM_LABEL_VALUE_INPUT_META_OSK, RETROK_F12, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_FPS_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_FPS_TOGGLE, RETROK_F3, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_SEND_DEBUG_INFO, MENU_ENUM_LABEL_VALUE_INPUT_META_SEND_DEBUG_INFO, RETROK_F10, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_NETPLAY_GAME_WATCH, MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_GAME_WATCH, RETROK_i, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_ENABLE_HOTKEY, MENU_ENUM_LABEL_VALUE_INPUT_META_ENABLE_HOTKEY, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_VOLUME_UP, MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_UP, RETROK_KP_PLUS, NO_BTN, NO_BTN, 0, AXIS_NONE },

View File

@ -98,6 +98,7 @@ enum
RARCH_MUTE,
RARCH_OSK,
RARCH_FPS_TOGGLE,
RARCH_SEND_DEBUG_INFO,
RARCH_NETPLAY_GAME_WATCH,
RARCH_ENABLE_HOTKEY,
RARCH_VOLUME_UP,

View File

@ -353,6 +353,7 @@ const struct input_bind_map input_config_bind_map[RARCH_BIND_LIST_END_NULL] = {
DECLARE_META_BIND(2, audio_mute, RARCH_MUTE, MENU_ENUM_LABEL_VALUE_INPUT_META_MUTE),
DECLARE_META_BIND(2, osk_toggle, RARCH_OSK, MENU_ENUM_LABEL_VALUE_INPUT_META_OSK),
DECLARE_META_BIND(2, fps_toggle, RARCH_FPS_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_FPS_TOGGLE),
DECLARE_META_BIND(2, send_debug_info, RARCH_SEND_DEBUG_INFO, MENU_ENUM_LABEL_VALUE_INPUT_META_SEND_DEBUG_INFO),
DECLARE_META_BIND(2, netplay_game_watch, RARCH_NETPLAY_GAME_WATCH, MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_GAME_WATCH),
DECLARE_META_BIND(2, enable_hotkey, RARCH_ENABLE_HOTKEY, MENU_ENUM_LABEL_VALUE_INPUT_META_ENABLE_HOTKEY),
DECLARE_META_BIND(2, volume_up, RARCH_VOLUME_UP, MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_UP),
@ -1019,10 +1020,12 @@ void input_menu_keys_pressed(void *data, input_bits_t *p_new_state)
if (!menu_input_dialog_get_display_kb())
{
unsigned ids[15][2];
unsigned ids[17][2];
const struct retro_keybind *quitkey = &input_config_binds[0][RARCH_QUIT_KEY];
const struct retro_keybind *fskey = &input_config_binds[0][RARCH_FULLSCREEN_TOGGLE_KEY];
const struct retro_keybind *companionkey = &input_config_binds[0][RARCH_UI_COMPANION_TOGGLE];
const struct retro_keybind *fpskey = &input_config_binds[0][RARCH_FPS_TOGGLE];
const struct retro_keybind *debugkey = &input_config_binds[0][RARCH_SEND_DEBUG_INFO];
ids[0][0] = RETROK_SPACE;
ids[0][1] = RETRO_DEVICE_ID_JOYPAD_START;
@ -1054,6 +1057,10 @@ void input_menu_keys_pressed(void *data, input_bits_t *p_new_state)
ids[13][1] = RETRO_DEVICE_ID_JOYPAD_Y;
ids[14][0] = companionkey->key;
ids[14][1] = RARCH_UI_COMPANION_TOGGLE;
ids[15][0] = fpskey->key;
ids[15][1] = RARCH_FPS_TOGGLE;
ids[16][0] = debugkey->key;
ids[16][1] = RARCH_SEND_DEBUG_INFO;
if (settings->bools.input_menu_swap_ok_cancel_buttons)
{
@ -1061,7 +1068,7 @@ void input_menu_keys_pressed(void *data, input_bits_t *p_new_state)
ids[12][1] = RETRO_DEVICE_ID_JOYPAD_B;
}
for (i = 0; i < 15; i++)
for (i = 0; i < 17; i++)
{
if (current_input->input_state(current_input_data,
joypad_info, binds, 0,

View File

@ -108,6 +108,10 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
snprintf(s, len,
"Toggles frames per second counter.");
break;
case RARCH_SEND_DEBUG_INFO:
snprintf(s, len,
"Sends diagnostic info about your device and RetroArch configuration to our servers for analysis.");
break;
case RARCH_NETPLAY_GAME_WATCH:
snprintf(s, len,
"Netplay toggle play/spectate mode.");

View File

@ -1273,6 +1273,10 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_META_FRAMEADVANCE,
"Frameadvance"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_META_SEND_DEBUG_INFO,
"Send Debug Info"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_META_FPS_TOGGLE,
"FPS toggle"
@ -8398,3 +8402,11 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_HELP_SEND_DEBUG_INFO,
"Sends diagnostic info about your device and RetroArch configuration to our servers for analysis."
)
MSG_HASH(
MSG_PRESS_TWO_MORE_TIMES_TO_SEND_DEBUG_INFO,
"Press two more times to submit diagnostic info to the RetroArch team."
)
MSG_HASH(
MSG_PRESS_ONE_MORE_TIME_TO_SEND_DEBUG_INFO,
"Press one more time to submit diagnostic info to the RetroArch team."
)

View File

@ -5109,7 +5109,7 @@ static int (funcname)(const char *path, const char *label, unsigned type, size_t
static int action_ok_help_send_debug_info(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx)
{
rarch_send_debug_info();
command_event(CMD_EVENT_SEND_DEBUG_INFO, NULL);
return 0;
}

View File

@ -717,6 +717,7 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_INPUT_META_MUTE,
MENU_ENUM_LABEL_VALUE_INPUT_META_OSK,
MENU_ENUM_LABEL_VALUE_INPUT_META_FPS_TOGGLE,
MENU_ENUM_LABEL_VALUE_INPUT_META_SEND_DEBUG_INFO,
MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_GAME_WATCH,
MENU_ENUM_LABEL_VALUE_INPUT_META_ENABLE_HOTKEY,
MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_UP,
@ -2301,6 +2302,8 @@ enum msg_hash_enums
MSG_FAILED_TO_SEND_DEBUG_INFO,
MSG_SENDING_DEBUG_INFO,
MSG_SENT_DEBUG_INFO,
MSG_PRESS_TWO_MORE_TIMES_TO_SEND_DEBUG_INFO,
MSG_PRESS_ONE_MORE_TIME_TO_SEND_DEBUG_INFO,
MSG_LAST
};

View File

@ -3763,6 +3763,73 @@ static enum runloop_state runloop_check_state(
old_pressed = pressed;
}
/* Check if we have pressed the "send debug info" button.
* Must press 3 times in a row to activate, but it will
* alert the user of this with each press of the hotkey. */
{
static uint32_t debug_seq = 0;
static bool old_pressed = false;
static bool old_any_pressed = false;
int any_i;
bool any_pressed = false;
bool pressed = BIT256_GET(current_input, RARCH_SEND_DEBUG_INFO);
for (any_i = 0; any_i < ARRAY_SIZE(current_input.data); any_i++)
{
if (current_input.data[any_i])
{
any_pressed = true;
break;
}
}
if (pressed && !old_pressed)
debug_seq |= pressed ? 1 : 0;
switch (debug_seq)
{
case 1: /* pressed hotkey one time */
runloop_msg_queue_push(
msg_hash_to_str(MSG_PRESS_TWO_MORE_TIMES_TO_SEND_DEBUG_INFO),
2, 180, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
break;
case 3: /* pressed hotkey two times */
runloop_msg_queue_push(
msg_hash_to_str(MSG_PRESS_ONE_MORE_TIME_TO_SEND_DEBUG_INFO),
2, 180, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
break;
case 7: /* pressed hotkey third and final time */
debug_seq = 0;
command_event(CMD_EVENT_SEND_DEBUG_INFO, NULL);
break;
}
if (any_pressed && !old_any_pressed)
{
debug_seq <<= 1;
if (debug_seq > 7)
debug_seq = 0;
}
old_pressed = pressed;
old_any_pressed = any_pressed;
}
/* Check if we have pressed the FPS toggle button */
{
static bool old_pressed = false;
bool pressed = BIT256_GET(
current_input, RARCH_FPS_TOGGLE);
if (pressed && !old_pressed)
command_event(CMD_EVENT_FPS_TOGGLE, NULL);
old_pressed = pressed;
}
if (menu_driver_is_alive())
{
if (!settings->bools.menu_throttle_framerate && !fastforward_ratio)
@ -3818,18 +3885,6 @@ static enum runloop_state runloop_check_state(
old_pressed = pressed;
}
/* Check if we have pressed the FPS toggle button */
{
static bool old_pressed = false;
bool pressed = BIT256_GET(
current_input, RARCH_FPS_TOGGLE);
if (pressed && !old_pressed)
command_event(CMD_EVENT_FPS_TOGGLE, NULL);
old_pressed = pressed;
}
/* Check if we have pressed the recording toggle button */
{
static bool old_pressed = false;