diff --git a/Minecraft.Client/Common/App_Defines.h b/Minecraft.Client/Common/App_Defines.h index 8349be8c..ad72eb5b 100644 --- a/Minecraft.Client/Common/App_Defines.h +++ b/Minecraft.Client/Common/App_Defines.h @@ -105,8 +105,8 @@ enum EGameHostOptionWorldSize #define GAMESETTING_ANIMATEDCHARACTER 0x00008000 #define GAMESETTING_PS3EULAREAD 0x00010000 #define GAMESETTING_PSVITANETWORKMODEADHOC 0x00020000 -#define GAMESETTING_VSYNC 0x00040000 -#define GAMESETTING_EXCLUSIVEFULLSCREEN 0x00080000 +#define GAMESETTING_VSYNC 0x01000000 +#define GAMESETTING_EXCLUSIVEFULLSCREEN 0x02000000 // defines for languages diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index 7c948805..620130f8 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -2349,7 +2349,7 @@ void CMinecraftApp::SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucV break; case eGameSetting_VSync: - if(((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_VSYNC)>>18)!=(ucVal&0x01)) + if(((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_VSYNC)>>24)!=(ucVal&0x01)) { if(ucVal==1) { @@ -2365,7 +2365,7 @@ void CMinecraftApp::SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucV break; case eGameSetting_ExclusiveFullscreen: - if(((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_EXCLUSIVEFULLSCREEN)>>19)!=(ucVal&0x01)) + if(((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_EXCLUSIVEFULLSCREEN)>>25)!=(ucVal&0x01)) { if(ucVal==1) { @@ -2516,10 +2516,10 @@ unsigned char CMinecraftApp::GetGameSettings(int iPad,eGameSetting eVal) return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_PSVITANETWORKMODEADHOC)>>17; case eGameSetting_VSync: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_VSYNC)>>18; + return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_VSYNC)>>24; case eGameSetting_ExclusiveFullscreen: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_EXCLUSIVEFULLSCREEN)>>19; + return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_EXCLUSIVEFULLSCREEN)>>25; } return 0; diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 5abb1cae..2d5c0a09 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -569,15 +569,10 @@ public: HRESULT STDMETHODCALLTYPE GetDevice(REFIID riid, void** ppDevice) override { return m_pReal->GetDevice(riid, ppDevice); } // IDXGISwapChain - HRESULT STDMETHODCALLTYPE Present(UINT SyncInterval, UINT Flags) override - { - if (g_bVSync) - return m_pReal->Present(1, Flags); - // DXGI_PRESENT_ALLOW_TEARING is only valid in windowed mode - if (g_bTearingSupported) - Flags |= DXGI_PRESENT_ALLOW_TEARING; - return m_pReal->Present(0, Flags); - } + // NOTE: The 4J RenderManager library hardcodes SyncInterval=1 and does NOT + // dispatch Present through this proxy's vtable. VSync control is handled + // directly in the main loop (see the Present-the-frame block) instead. + HRESULT STDMETHODCALLTYPE Present(UINT SyncInterval, UINT Flags) override { return m_pReal->Present(SyncInterval, Flags); } HRESULT STDMETHODCALLTYPE GetBuffer(UINT Buffer, REFIID riid, void** ppSurface) override { return m_pReal->GetBuffer(Buffer, riid, ppSurface); } HRESULT STDMETHODCALLTYPE SetFullscreenState(BOOL Fullscreen, IDXGIOutput* pTarget) override { return m_pReal->SetFullscreenState(Fullscreen, pTarget); } HRESULT STDMETHODCALLTYPE GetFullscreenState(BOOL* pFullscreen, IDXGIOutput** ppTarget) override { return m_pReal->GetFullscreenState(pFullscreen, ppTarget); } @@ -1904,7 +1899,20 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, RenderManager.Set_matrixDirty(); #endif // Present the frame. - RenderManager.Present(); + // RenderManager.Present() hardcodes SyncInterval=1 internally. + // When VSync is off, bypass it and call the swap chain directly. + if (!g_bVSync && g_bTearingSupported && g_pSwapChain) + { + HRESULT hrPresent = g_pSwapChain->Present(0, DXGI_PRESENT_ALLOW_TEARING); + // If tearing Present fails (e.g. during fullscreen transition), + // fall back to the library's VSync'd Present for this frame. + if (FAILED(hrPresent)) + RenderManager.Present(); + } + else + { + RenderManager.Present(); + } ui.CheckMenuDisplayed(); @@ -1998,6 +2006,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_FULLSCREEN)) { ToggleFullscreen(); + app.SetGameSettings(ProfileManager.GetPrimaryPad(), eGameSetting_ExclusiveFullscreen, g_isFullscreen ? 1 : 0); } // Apply deferred exclusive fullscreen toggle diff --git a/README.md b/README.md index c08937d7..f741b471 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,15 @@ This project is based on source code of Minecraft Legacy Console Edition v1.6.05 ## Latest: +### Uncapped FPS (VSync Off) + +- FPS is no longer locked to the monitor's refresh rate when VSync is disabled. The precompiled 4J render library hardcodes `SyncInterval=1` in its Present call, which forced VBlank synchronization regardless of the VSync setting. The main loop now bypasses the library's Present and calls the DXGI swap chain directly with `SyncInterval=0` and `DXGI_PRESENT_ALLOW_TEARING` when VSync is off +- Pressing F11 to toggle fullscreen now correctly syncs the Fullscreen checkbox in the graphics settings menu + +### Graphics Settings Fixes + +- The graphics menu layout has been fixed: the render distance slider is now no longer occluded by the gamma slider. Also, resolved spacing erro for the checkbox options due to an incomplete removal of the Bedrock Fog toggle option (the setting has been reinstated). + ### Hardcore Hearts ![Hardcore Hearts](.github/hardcore-hearts.png) diff --git a/tools/DumpSwf.class b/tools/DumpSwf.class deleted file mode 100644 index 4125d7e6..00000000 Binary files a/tools/DumpSwf.class and /dev/null differ