From ac34911f32249b2dcdb69212fb17d08616c8d48f Mon Sep 17 00:00:00 2001 From: SirMangler Date: Fri, 31 Jan 2020 20:45:08 +0000 Subject: [PATCH] Added Toggle Freelook Hotkey --- Source/Core/Core/HotkeyManager.cpp | 5 +++-- Source/Core/Core/HotkeyManager.h | 1 + Source/Core/DolphinQt/HotkeyScheduler.cpp | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/HotkeyManager.cpp b/Source/Core/Core/HotkeyManager.cpp index 6a39e98566..f7c6004178 100644 --- a/Source/Core/Core/HotkeyManager.cpp +++ b/Source/Core/Core/HotkeyManager.cpp @@ -22,7 +22,7 @@ #include "InputCommon/GCPadStatus.h" // clang-format off -constexpr std::array s_hotkey_labels{{ +constexpr std::array s_hotkey_labels{{ _trans("Open"), _trans("Change Disc"), _trans("Eject Disc"), @@ -124,6 +124,7 @@ constexpr std::array s_hotkey_labels{{ _trans("Freelook Zoom In"), _trans("Freelook Zoom Out"), _trans("Freelook Reset"), + _trans("Freelook Toggle"), _trans("Toggle 3D Side-by-Side"), _trans("Toggle 3D Top-Bottom"), @@ -290,7 +291,7 @@ constexpr std::array s_groups_info = { {_trans("Controller Profile"), HK_NEXT_WIIMOTE_PROFILE_1, HK_PREV_GAME_WIIMOTE_PROFILE_4}, {_trans("Graphics Toggles"), HK_TOGGLE_CROP, HK_TOGGLE_TEXTURES}, {_trans("Internal Resolution"), HK_INCREASE_IR, HK_DECREASE_IR}, - {_trans("Freelook"), HK_FREELOOK_DECREASE_SPEED, HK_FREELOOK_RESET}, + {_trans("Freelook"), HK_FREELOOK_DECREASE_SPEED, HK_FREELOOK_TOGGLE}, // i18n: Stereoscopic 3D {_trans("3D"), HK_TOGGLE_STEREO_SBS, HK_TOGGLE_STEREO_ANAGLYPH}, // i18n: Stereoscopic 3D diff --git a/Source/Core/Core/HotkeyManager.h b/Source/Core/Core/HotkeyManager.h index 3115d33e2b..c52bb778db 100644 --- a/Source/Core/Core/HotkeyManager.h +++ b/Source/Core/Core/HotkeyManager.h @@ -110,6 +110,7 @@ enum Hotkey HK_FREELOOK_ZOOM_IN, HK_FREELOOK_ZOOM_OUT, HK_FREELOOK_RESET, + HK_FREELOOK_TOGGLE, HK_TOGGLE_STEREO_SBS, HK_TOGGLE_STEREO_TAB, diff --git a/Source/Core/DolphinQt/HotkeyScheduler.cpp b/Source/Core/DolphinQt/HotkeyScheduler.cpp index cb67fba6ea..1099bf8a25 100644 --- a/Source/Core/DolphinQt/HotkeyScheduler.cpp +++ b/Source/Core/DolphinQt/HotkeyScheduler.cpp @@ -524,6 +524,13 @@ void HotkeyScheduler::Run() // Freelook static float fl_speed = 1.0; + if (IsHotkey(HK_FREELOOK_TOGGLE)) + { + const bool new_value = !Config::Get(Config::GFX_FREE_LOOK); + Config::SetCurrent(Config::GFX_FREE_LOOK, new_value); + OSD::AddMessage(StringFromFormat("Freelook: %s", new_value ? "Enabled" : "Disabled")); + } + if (IsHotkey(HK_FREELOOK_DECREASE_SPEED, true)) fl_speed /= 1.1f;