Skip to content
Permalink
Browse files

Merge pull request #1688 from NZJenkins/framerate_key

Frame limiter toggle
  • Loading branch information...
LukeUsher committed Aug 3, 2019
2 parents cd3f309 + a38138d commit 688238c40bc678ebe2d90d63e5cf09397c3cb33b
Showing with 32 additions and 14 deletions.
  1. +7 −1 src/core/hle/D3D8/Direct3D9/Direct3D9.cpp
  2. +25 −13 src/gui/WndMain.cpp
@@ -169,6 +169,7 @@ static DWORD g_VertexShaderSlots[136];
DWORD g_XboxBaseVertexIndex = 0;
DWORD g_DefaultPresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
DWORD g_PresentationIntervalOverride = 0;
bool g_UnlockFramerateHack = false; // ignore the xbox presentation interval

// Active D3D Vertex Streams (and strides)
XTL::X_D3DVertexBuffer*g_D3DStreams[16];
@@ -1656,6 +1657,11 @@ static LRESULT WINAPI EmuMsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
std::cout << _logThreadPrefix << g_EnumModules2String[to_underlying(CXBXR_MODULE::CXBXR)] << "Enable log is " << g_bPrintfOn << std::endl;
ipc_send_gui_update(IPC_UPDATE_GUI::LOG_ENABLED, static_cast<UINT>(g_bPrintfOn));
}
else if (wParam == VK_F9)
{
// Toggle frame-limiting
g_UnlockFramerateHack = !g_UnlockFramerateHack;
}
else if(wParam == VK_F11)
{
if(g_iWireframe++ == 2)
@@ -4853,7 +4859,7 @@ DWORD WINAPI XTL::EMUPATCH(D3DDevice_Swap)

// Check if we need to enable our frame-limiter
DWORD presentationInverval = g_PresentationIntervalOverride > 0 ? g_PresentationIntervalOverride : g_DefaultPresentationInterval;
if (presentationInverval != D3DPRESENT_INTERVAL_IMMEDIATE) {
if ((presentationInverval != D3DPRESENT_INTERVAL_IMMEDIATE) && !g_UnlockFramerateHack) {
// If the last frame completed faster than the Xbox target swap rate, wait for it

auto targetRefreshRate = 60.0f; // TODO: Read from Xbox Display Mode
@@ -470,47 +470,59 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
{
case VK_F5:
{
// Try to open the most recent Xbe if none is opened yet :
if (m_Xbe == nullptr)
OpenMRU(0);
// Start emulation normally
if (!m_bIsStarted) {
// Try to open the most recent Xbe if none is opened yet :
if (m_Xbe == nullptr)
OpenMRU(0);

if (m_Xbe != nullptr)
if (!m_bIsStarted)
if (m_Xbe != nullptr)
StartEmulation(hwnd);

break;
}
// fall through
}
break;

case VK_F6:
{
if(m_bIsStarted)
StopEmulation();
// Stop emulation
if (m_bIsStarted)
{
StopEmulation();
break;
}
// fall through
}
break;

case VK_F7:
{
// Try to open the dashboard xbe if none is opened yet :
// Open the dashboard xbe
if (!m_bIsStarted)
{
if (m_Xbe != nullptr) { CloseXbe(); }

OpenDashboard();
break;
}
// fall through
}
break;

case VK_F9:
{
// Try to open the most recent Xbe if none is opened yet :
// Start emulation with the debugger
if (!m_bIsStarted) {
// Try to open the most recent Xbe if none is opened yet
if (m_Xbe == nullptr)
OpenMRU(0);

if (m_Xbe != nullptr)
StartEmulation(hwnd, debuggerOn);

break;
}
// fall through
}
break;

default:
{

0 comments on commit 688238c

Please sign in to comment.
You can’t perform that action at this time.