From a771b7da3d9f45ff9e4fd5a5d004309866b35c7f Mon Sep 17 00:00:00 2001 From: DrPerkyLegit <116128211+DrPerkyLegit@users.noreply.github.com> Date: Wed, 4 Nov 2026 21:09:20 -0500 Subject: [PATCH] fix resizing window not changing game viewport --- Minecraft.Client/Minecraft.cpp | 5 ++++- Minecraft.Client/Minecraft.h | 3 +-- Minecraft.Client/Windows64/4JLibs | 2 +- Minecraft.Client/Windows64/Windows64_Minecraft.cpp | 10 ++++++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index dcd50a0a..a2a84fe7 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -2308,8 +2308,11 @@ void Minecraft::resize(int width, int height) { if (width <= 0) width = 1; if (height <= 0) height = 1; - this->width = width; + + this->width = RenderManager.IsWidescreen() ? width : (width * 3) / 4; this->height = height; + this->width_phys = width; + this->height_phys = height; if (screen != nullptr) { diff --git a/Minecraft.Client/Minecraft.h b/Minecraft.Client/Minecraft.h index b4db857f..784fdbab 100644 --- a/Minecraft.Client/Minecraft.h +++ b/Minecraft.Client/Minecraft.h @@ -247,8 +247,6 @@ public: void pauseGame(); // void toggleFullScreen(); // 4J - removed -private: - void resize(int width, int height); public: // 4J - Moved to per player @@ -256,6 +254,7 @@ public: // 4J - Moved to per player //int64_t lastTickTime; + void resize(int width, int height); private: // 4J- per player? diff --git a/Minecraft.Client/Windows64/4JLibs b/Minecraft.Client/Windows64/4JLibs index a549f6a5..82eeded1 160000 --- a/Minecraft.Client/Windows64/4JLibs +++ b/Minecraft.Client/Windows64/4JLibs @@ -1 +1 @@ -Subproject commit a549f6a5b3f8fee379280154ccd4f446f74adbd6 +Subproject commit 82eeded18e2afb51771098cefbb45209a5a2f5ec diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 4c8497b4..37c5de6e 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -1290,6 +1290,11 @@ static bool ResizeD3D(int newW, int newH) g_rScreenWidth = bbW; g_rScreenHeight = bbH; + Minecraft* pMinecraft = Minecraft::GetInstance(); + if (pMinecraft != nullptr) + pMinecraft->resize(bbW, bbH); + RenderManager.SetBackBufferSize(bbW, bbH); + success = true; postReset: @@ -1340,6 +1345,11 @@ postReset: g_rScreenWidth = recW; g_rScreenHeight = recH; ui.updateScreenSize(recW, recH); + + Minecraft* pMinecraft = Minecraft::GetInstance(); + if (pMinecraft != nullptr) + pMinecraft->resize(recW, recH); + RenderManager.SetBackBufferSize(recW, recH); } app.DebugPrintf("[RESIZE] FAILED but recovered views at %dx%d\n", g_rScreenWidth, g_rScreenHeight);