From 7c8c352b7f3d464bf92e57bb1ecc2ed5d6613b60 Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Tue, 14 Apr 2026 18:43:52 +0500 Subject: [PATCH] change(EnsureAvailableMemory): rephrase warning message Signed-off-by: Octol1ttle (cherry picked from commit ae331cfc9af3b5eb5148167e0a2142057c255978) --- .../launch/EnsureAvailableMemory.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/launcher/minecraft/launch/EnsureAvailableMemory.cpp b/launcher/minecraft/launch/EnsureAvailableMemory.cpp index 6605f0ce8..cb7a04ab1 100644 --- a/launcher/minecraft/launch/EnsureAvailableMemory.cpp +++ b/launcher/minecraft/launch/EnsureAvailableMemory.cpp @@ -32,17 +32,22 @@ void EnsureAvailableMemory::executeTask() return; } - if (static_cast(required) * 0.9 > static_cast(available)) { + const uint64_t settingMin = m_instance->settings()->get("MinMemAlloc").toUInt(); + const uint64_t settingMax = m_instance->settings()->get("MaxMemAlloc").toUInt(); + const uint64_t max = std::max(settingMin, settingMax); + + if (static_cast(max) * 0.9 > static_cast(available)) { bool shouldAbort = false; if (m_instance->settings()->get("LowMemWarning").toBool()) { auto* dialog = CustomMessageBox::selectable( - nullptr, tr("Not enough RAM"), - tr("There is not enough RAM available to launch this instance with the current memory settings.\n\n" - "Required: %1 MiB\nAvailable: %2 MiB\n\n" - "Continue anyway? This may cause slowdowns in the game and your system.") - .arg(required) - .arg(available), + nullptr, tr("Low free memory"), + tr("There might not be enough free RAM to launch this instance with the current memory settings.\n\n" + "Maximum allocated: %1 MiB\nFree: %2 MiB (out of %3 MiB total)\n\n" + "Launch anyway? This may cause slowdowns in the game and your system.") + .arg(max) + .arg(available) + .arg(HardwareInfo::totalRamMiB()), QMessageBox::Icon::Warning, QMessageBox::StandardButton::Yes | QMessageBox::StandardButton::No, QMessageBox::StandardButton::No);