From 81d41a6a04bf933027b55171064462bf5972001d Mon Sep 17 00:00:00 2001 From: str1k3r <115313679+S1l3ntStr1ke87@users.noreply.github.com> Date: Tue, 11 Aug 2026 20:27:34 -0400 Subject: [PATCH] feat(Windows64): use screen size instead of window size, fix exit game, fix oprhaned saves on exit without saving --- Minecraft.Client/Common/UI/UIScene_MainMenu.cpp | 5 +---- Minecraft.Client/MinecraftServer.cpp | 3 +++ Minecraft.Client/Windows64/Windows64_App.cpp | 1 + Minecraft.Client/Windows64/Windows64_Minecraft.cpp | 10 +++++----- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp index 0603360a..19505e73 100644 --- a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp @@ -359,7 +359,7 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) m_eAction=eAction_RunUnlockOrDLC; signInReturnedFunc = &UIScene_MainMenu::UnlockFullGame_SignInReturned; break; -#if defined _XBOX +#if defined(_XBOX) || defined(_WINDOWS64) case eControl_Exit: if( ProfileManager.IsFullVersion() ) { @@ -370,9 +370,6 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) } else { -#ifdef _XBOX_ONE - ui.ShowPlayerDisplayname(true); -#endif ui.NavigateToScene(primaryPad,eUIScene_TrialExitUpsell); } break; diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index 026c3fa4..1a35b6fd 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -753,10 +753,13 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring if( s_bServerHalted || !g_NetworkManager.IsInSession() ) return false; + //str1k3r - if used on windows64 a orphaned save gets left behind if you exit without saving +#ifndef _WINDOWS64 if( levels[0]->isNew || levels[1]->isNew || levels[2]->isNew ) { levels[0]->saveToDisc(mcprogress, false); } +#endif if( s_bServerHalted || !g_NetworkManager.IsInSession() ) return false; diff --git a/Minecraft.Client/Windows64/Windows64_App.cpp b/Minecraft.Client/Windows64/Windows64_App.cpp index 3cc0d21a..ad8aa6e7 100644 --- a/Minecraft.Client/Windows64/Windows64_App.cpp +++ b/Minecraft.Client/Windows64/Windows64_App.cpp @@ -26,6 +26,7 @@ void CConsoleMinecraftApp::StoreLaunchData() } void CConsoleMinecraftApp::ExitGame() { + ExitProcess(0); } void CConsoleMinecraftApp::FatalLoadError() { diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index b62ada18..6d80256a 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -406,7 +406,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) return FALSE; } - ShowWindow(g_hWnd, nCmdShow); + ShowWindow(g_hWnd, (nCmdShow != SW_HIDE) ? SW_SHOWMAXIMIZED : nCmdShow); UpdateWindow(g_hWnd); return TRUE; @@ -467,10 +467,9 @@ HRESULT InitDevice() { HRESULT hr = S_OK; - RECT rc; - GetClientRect( g_hWnd, &rc ); - g_iScreenWidth = rc.right - rc.left; - g_iScreenHeight = rc.bottom - rc.top; + //str1k3r - use screen size instead of window size + g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN); + g_iScreenHeight = GetSystemMetrics(SM_CYSCREEN); //str1k3r - stop hardcoding size and just use the screens actual size UINT width = g_iScreenWidth; @@ -546,6 +545,7 @@ HRESULT InitDevice() hr = g_pd3dDevice->CreateTexture2D(&descDepth, NULL, &g_pDepthStencilBuffer); D3D11_DEPTH_STENCIL_VIEW_DESC descDSView; + ZeroMemory(&descDSView, sizeof(descDSView)); descDSView.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; descDSView.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; descDSView.Texture2D.MipSlice = 0;