mirror of
https://github.com/neoStudiosLCE/neoLegacy.git
synced 2026-07-09 09:47:03 +00:00
feat: uncapped FPS when VSync off, fix graphics settings bitmask collision
Bypass the 4J RenderManager's hardcoded SyncInterval=1 by calling the DXGI swap chain directly with Present(0, ALLOW_TEARING) when VSync is disabled. Falls back to the library's Present on failure. Relocate VSync/Fullscreen setting flags from bits 18-19 to bits 24-25 to eliminate overlap with the render distance byte (bits 16-23). Sync the Fullscreen game setting when F11 is pressed so the graphics menu checkbox stays accurate. Remove tracked DumpSwf.class (already covered by tools/*.class gitignore).
This commit is contained in:
parent
9f08612f25
commit
383c710833
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||

|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in a new issue