(view as text)
diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp
index 966b355..00339b8 100644
--- a/Source/Core/AudioCommon/Mixer.cpp
+++ b/Source/Core/AudioCommon/Mixer.cpp
@@ -6,9 +6,9 @@
#include "Mixer.h"
#include "AudioCommon.h"
#include "CPUDetect.h"
-#include "../Core/Host.h"
#include "ConfigManager.h"
#include "HW/VideoInterface.h"
+#include "Core.h"
#include "../Core/HW/AudioInterface.h"
@@ -128,7 +128,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::isTabPressed)
break;
SLEEP(1);
soundStream->Update();
diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp
index 68c0099..1ce7aac 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/CoreParameter.h b/Source/Core/Core/CoreParameter.h
index ee3b11b..4f9f223 100644
--- a/Source/Core/Core/CoreParameter.h
+++ b/Source/Core/Core/CoreParameter.h
@@ -37,6 +37,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 fdce305..6663026 100644
--- a/Source/Core/Core/HW/SystemTimers.cpp
+++ b/Source/Core/Core/HW/SystemTimers.cpp
@@ -76,6 +76,7 @@ IPC_HLE_PERIOD: For the Wiimote this is the call schedule:
#include "VideoBackendBase.h"
#include "CommandProcessor.h"
#include "Host.h"
+#include "Core.h"
namespace SystemTimers
@@ -236,7 +237,7 @@ 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');
+ bool frame_limiter = SConfig::GetInstance().m_Framelimit && SConfig::GetInstance().m_Framelimit != 2 && !Core::isTabPressed;
u32 next_event = GetTicksPerSecond()/1000;
if (SConfig::GetInstance().m_Framelimit > 2)
{
diff --git a/Source/Core/Core/Host.h b/Source/Core/Core/Host.h
index 94d4b42..2987020 100644
--- a/Source/Core/Core/Host.h
+++ b/Source/Core/Core/Host.h
@@ -24,7 +24,6 @@
bool Host_RendererHasFocus();
void Host_ConnectWiimote(int wm_idx, bool connect);
-bool Host_GetKeyState(int keycode);
void Host_GetRenderWindowSize(int& x, int& y, int& width, int& height);
void Host_Message(int Id);
void Host_NotifyMapLoaded();
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp
index 2bb4afd..25e6721 100644
--- a/Source/Core/DolphinWX/Frame.cpp
+++ b/Source/Core/DolphinWX/Frame.cpp
@@ -912,6 +912,10 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
OSDChoice = 4;
g_Config.bDisableFog = !g_Config.bDisableFog;
}
+ else if (IsHotkey(event, HK_TOGGLE_THROTTLE))
+ {
+ Core::isTabPressed = true;
+ }
else if (IsHotkey(event, HK_INCREASE_FRAME_LIMIT))
{
if (++SConfig::GetInstance().m_Framelimit > 0x19)
@@ -1012,7 +1016,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::isTabPressed = false;
+ }
+ }
+ else
+ {
+ event.Skip();
+ }
}
void CFrame::OnMouse(wxMouseEvent& event)
diff --git a/Source/Core/DolphinWX/HotkeyDlg.cpp b/Source/Core/DolphinWX/HotkeyDlg.cpp
index 5fe375c..d8d19bb 100644
--- a/Source/Core/DolphinWX/HotkeyDlg.cpp
+++ b/Source/Core/DolphinWX/HotkeyDlg.cpp
@@ -211,6 +211,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/DolphinWX/Main.cpp b/Source/Core/DolphinWX/Main.cpp
index 6b416a4..92de046 100644
--- a/Source/Core/DolphinWX/Main.cpp
+++ b/Source/Core/DolphinWX/Main.cpp
@@ -597,25 +597,6 @@ void Host_UpdateBreakPointView()
}
}
-bool Host_GetKeyState(int keycode)
-{
-#ifdef _WIN32
- return (0 != GetAsyncKeyState(keycode));
-#elif defined __WXGTK__
- std::unique_lock<std::recursive_mutex> lk(main_frame->keystate_lock, std::try_to_lock);
- if (!lk.owns_lock())
- return false;
-
- bool key_pressed;
- if (!wxIsMainThread()) wxMutexGuiEnter();
- key_pressed = wxGetKeyState(wxKeyCode(keycode));
- if (!wxIsMainThread()) wxMutexGuiLeave();
- return key_pressed;
-#else
- return wxGetKeyState(wxKeyCode(keycode));
-#endif
-}
-
void Host_GetRenderWindowSize(int& x, int& y, int& width, int& height)
{
main_frame->GetRenderWindowSize(x, y, width, height);
diff --git a/Source/Core/DolphinWX/MainAndroid.cpp b/Source/Core/DolphinWX/MainAndroid.cpp
index d235a8a..599f4d6 100644
--- a/Source/Core/DolphinWX/MainAndroid.cpp
+++ b/Source/Core/DolphinWX/MainAndroid.cpp
@@ -85,11 +85,6 @@ void Host_UpdateMainFrame()
void Host_UpdateBreakPointView(){}
-bool Host_GetKeyState(int keycode)
-{
- return false;
-}
-
void Host_GetRenderWindowSize(int& x, int& y, int& width, int& height)
{
x = SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowXPos;
diff --git a/Source/Core/DolphinWX/MainNoGUI.cpp b/Source/Core/DolphinWX/MainNoGUI.cpp
index be794cc..0aa6b49 100644
--- a/Source/Core/DolphinWX/MainNoGUI.cpp
+++ b/Source/Core/DolphinWX/MainNoGUI.cpp
@@ -76,11 +76,6 @@ void Host_UpdateMainFrame()
void Host_UpdateBreakPointView(){}
-bool Host_GetKeyState(int keycode)
-{
- return false;
-}
-
void Host_GetRenderWindowSize(int& x, int& y, int& width, int& height)
{
x = SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowXPos;