Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frame limiter toggle #1688

Merged
merged 2 commits into from Aug 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/core/hle/D3D8/Direct3D9/Direct3D9.cpp
Expand Up @@ -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];
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
38 changes: 25 additions & 13 deletions src/gui/WndMain.cpp
Expand Up @@ -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:
{
Expand Down