Add a hotkey for disabling the framelimit.

Atm this is hardcoded to '\t'.
This commit is contained in:
degasus 2014-02-16 23:13:01 +01:00
parent a40ea4e26a
commit 8483811b39
9 changed files with 27 additions and 8 deletions

View File

@ -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();

View File

@ -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 */ },

View File

@ -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; }

View File

@ -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);

View File

@ -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,

View File

@ -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)
{

View File

@ -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)
@ -1039,9 +1043,20 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
}
void CFrame::OnKeyUp(wxKeyEvent& event)
{
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)
{

View File

@ -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"),

View File

@ -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;
}