From ef7d4658dc802c59f87b303a6e26efde31dfc3bb Mon Sep 17 00:00:00 2001 From: Byte Date: Wed, 8 Jul 2026 18:40:09 +0200 Subject: [PATCH] performance boost --- Minecraft.Client/Gui.cpp | 7 ------- Minecraft.Client/MemTexture.h | 6 +++++- Minecraft.Client/Windows64/Windows64_Minecraft.cpp | 7 +++++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Minecraft.Client/Gui.cpp b/Minecraft.Client/Gui.cpp index d27604bb..a2da8ea6 100644 --- a/Minecraft.Client/Gui.cpp +++ b/Minecraft.Client/Gui.cpp @@ -1085,13 +1085,6 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) vector lines; - // Only show version/branch for player 0 to avoid cluttering each splitscreen viewport - if (iPad == 0) - { - lines.push_back(ClientConstants::VERSION_STRING); - lines.push_back(ClientConstants::GetLCENString()); - } - if (minecraft->options->renderDebug && minecraft->player != nullptr && minecraft->level != nullptr) { lines.push_back(minecraft->fpsString); diff --git a/Minecraft.Client/MemTexture.h b/Minecraft.Client/MemTexture.h index d11d68b1..a1bc5d1b 100644 --- a/Minecraft.Client/MemTexture.h +++ b/Minecraft.Client/MemTexture.h @@ -10,7 +10,11 @@ public: int id; bool isLoaded; int ticksSinceLastUse; - static const int UNUSED_TICKS_TO_FREE = 20; + // @CDevJoud + // changing the lifetime of the texture from 20 ticks(1 sec) to 200 ticks (10 sec) + // as it helps the texture to have longer lifetime and reducing the usage of loadTexture for every second/frame + // note that we dont remove the code that removes the textures from `tick()` as it is required in memory limited environment such as older Consoles(PS3/XBOX360) + static const int UNUSED_TICKS_TO_FREE = 200; MemTexture(const wstring& _name, PBYTE pbData, DWORD dwBytes, MemTextureProcessor *processor); ~MemTexture(); diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index e56c8201..3701f90d 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -985,7 +985,9 @@ void CleanupDevice() static Minecraft* InitialiseMinecraftRuntime() { app.loadMediaArchive(); - RenderManager.Initialise(g_pd3dDevice, g_pSwapChain); + // @CDevJoud: No need to call this method as it gets called once in `InitDevice()` + // Calling it again and it results of 20MB of memory leak! + //RenderManager.Initialise(g_pd3dDevice, g_pSwapChain); app.loadStringTable(); ui.init(g_pd3dDevice, g_pImmediateContext, g_pRenderTargetView, g_pDepthStencilView, g_rScreenWidth, g_rScreenHeight); InputManager.Initialise(1, 3, MINECRAFT_ACTION_MAX, ACTION_MAX_MENU); @@ -1133,7 +1135,8 @@ void StartGame(Win64LaunchOptions launchOptions, int nCmdShow) Minecraft* pMinecraft = InitialiseMinecraftRuntime(); if (!pMinecraft) { CleanupDevice(); return; } g_bResizeReady = true; - + ShowWindow(g_hWnd, (nCmdShow != SW_HIDE) ? SW_SHOWMAXIMIZED : nCmdShow); + UpdateWindow(g_hWnd); MSG msg = {0}; while (WM_QUIT != msg.message && !app.m_bShutdown) {