diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp index fa43baeb99..83bdc537ed 100644 --- a/Source/Core/AudioCommon/Mixer.cpp +++ b/Source/Core/AudioCommon/Mixer.cpp @@ -7,7 +7,7 @@ #include "Common/Atomic.h" #include "Common/CPUDetect.h" #include "Core/ConfigManager.h" -#include "Core/Host.h" +#include "Core/Core.h" #include "Core/HW/AudioInterface.h" #include "Core/HW/VideoInterface.h" @@ -124,7 +124,7 @@ void CMixer::PushSamples(const short *samples, unsigned int num_samples) if (*PowerPC::GetStatePtr() != PowerPC::CPU_RUNNING || soundStream->IsMuted()) break; // Shortcut key for Throttle Skipping - if (Host_GetKeyState('\t')) + if (Core::IsFramelimiterTempDisabled) break; SLEEP(1); soundStream->Update(); diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index 13f551f5ca..e5491fdae5 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -71,6 +71,7 @@ static const struct { "ToggleAspectRatio", 0, 0 /* wxMOD_NONE */ }, { "ToggleEFBCopies", 0, 0 /* wxMOD_NONE */ }, { "ToggleFog", 0, 0 /* wxMOD_NONE */ }, + { "ToggleThrottle", 9 /* '\t' */, 0 /* wxMOD_NONE */ }, { "IncreaseFrameLimit", 0, 0 /* wxMOD_NONE */ }, { "DecreaseFrameLimit", 0, 0 /* wxMOD_NONE */ }, { "LoadStateSlot1", 340 /* WXK_F1 */, 0 /* wxMOD_NONE */ }, diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index a4d4a6fdda..90b6f1f4d1 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -90,7 +90,7 @@ static bool g_requestRefreshInfo = false; static int g_pauseAndLockDepth = 0; SCoreStartupParameter g_CoreStartupParameter; -bool isTabPressed = false; +bool IsFramelimiterTempDisabled = false; std::string GetStateFileName() { return g_stateFileName; } void SetStateFileName(std::string val) { g_stateFileName = val; } diff --git a/Source/Core/Core/Core.h b/Source/Core/Core/Core.h index c841fac08e..44d558bd90 100644 --- a/Source/Core/Core/Core.h +++ b/Source/Core/Core/Core.h @@ -24,7 +24,7 @@ namespace Core // TODO: kill, use SConfig instead extern SCoreStartupParameter g_CoreStartupParameter; -extern bool isTabPressed; +extern bool IsFramelimiterTempDisabled; void Callback_VideoCopiedToXFB(bool video_update); diff --git a/Source/Core/Core/CoreParameter.h b/Source/Core/Core/CoreParameter.h index fc8386b5bb..46ec3976fe 100644 --- a/Source/Core/Core/CoreParameter.h +++ b/Source/Core/Core/CoreParameter.h @@ -38,6 +38,7 @@ enum Hotkey HK_TOGGLE_AR, HK_TOGGLE_EFBCOPIES, HK_TOGGLE_FOG, + HK_TOGGLE_THROTTLE, HK_INCREASE_FRAME_LIMIT, HK_DECREASE_FRAME_LIMIT, diff --git a/Source/Core/Core/HW/SystemTimers.cpp b/Source/Core/Core/HW/SystemTimers.cpp index 4e51ba8585..f584455d8a 100644 --- a/Source/Core/Core/HW/SystemTimers.cpp +++ b/Source/Core/Core/HW/SystemTimers.cpp @@ -62,9 +62,9 @@ IPC_HLE_PERIOD: For the Wiimote this is the call schedule: #include "Common/Timer.h" #include "Core/ConfigManager.h" +#include "Core/Core.h" #include "Core/CoreTiming.h" #include "Core/DSPEmulator.h" -#include "Core/Host.h" #include "Core/PatchEngine.h" #include "Core/HW/AudioInterface.h" #include "Core/HW/DSP.h" @@ -237,7 +237,8 @@ void ThrottleCallback(u64 last_time, int cyclesLate) u32 time = Common::Timer::GetTimeMs(); int diff = (u32)last_time - time; - bool frame_limiter = SConfig::GetInstance().m_Framelimit && SConfig::GetInstance().m_Framelimit != 2 && !Host_GetKeyState('\t'); + const SConfig& config = SConfig::GetInstance(); + bool frame_limiter = config.m_Framelimit && config.m_Framelimit != 2 && !Core::IsFramelimiterTempDisabled; u32 next_event = GetTicksPerSecond()/1000; if (SConfig::GetInstance().m_Framelimit > 2) { diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 87fb799616..191d5c0086 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -940,6 +940,10 @@ void CFrame::OnKeyDown(wxKeyEvent& event) OSDChoice = 4; g_Config.bDisableFog = !g_Config.bDisableFog; } + else if (IsHotkey(event, HK_TOGGLE_THROTTLE)) + { + Core::IsFramelimiterTempDisabled = true; + } else if (IsHotkey(event, HK_INCREASE_FRAME_LIMIT)) { if (++SConfig::GetInstance().m_Framelimit > 0x19) @@ -1040,7 +1044,18 @@ void CFrame::OnKeyDown(wxKeyEvent& event) void CFrame::OnKeyUp(wxKeyEvent& event) { - event.Skip(); + if(Core::GetState() != Core::CORE_UNINITIALIZED && + (RendererHasFocus() || TASInputHasFocus())) + { + if (IsHotkey(event, HK_TOGGLE_THROTTLE)) + { + Core::IsFramelimiterTempDisabled = false; + } + } + else + { + event.Skip(); + } } void CFrame::OnMouse(wxMouseEvent& event) diff --git a/Source/Core/DolphinWX/HotkeyDlg.cpp b/Source/Core/DolphinWX/HotkeyDlg.cpp index 87f7f2a3bc..d990ac1f21 100644 --- a/Source/Core/DolphinWX/HotkeyDlg.cpp +++ b/Source/Core/DolphinWX/HotkeyDlg.cpp @@ -233,6 +233,7 @@ void HotkeyConfigDialog::CreateHotkeyGUIControls(void) _("Toggle Aspect Ratio"), _("Toggle EFB Copies"), _("Toggle Fog"), + _("Toggle Frame limit"), _("Increase Frame limit"), _("Decrease Frame limit"), diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index c12fe9b419..7eb6835747 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -276,5 +276,5 @@ void VideoConfig::Save(const std::string& ini_file) bool VideoConfig::IsVSync() { - return Core::isTabPressed ? false : bVSync; + return Core::IsFramelimiterTempDisabled ? false : bVSync; }