From b12d0ffb29dfb257a81a92455e1e46c2c6a53cd8 Mon Sep 17 00:00:00 2001 From: ACoolioDude Date: Sat, 1 Aug 2026 23:15:15 +0200 Subject: [PATCH 1/4] Fix RAM type on Linux - Hello there! If you know me, i am Stefan2008 (aka. ACoolioDude) and i decided to fix RAM type on Linux by telling engine to execute pkexec and fixed code (not using AI at all!) and fixed byte thing because it caused to simply give different bytes and not giving actual system RAM value, so hope this gets merged! --- .../backend/system/framerate/SystemInfo.hx | 14 +++++++----- source/funkin/backend/utils/MemoryUtil.hx | 22 ++++++++++++++----- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/source/funkin/backend/system/framerate/SystemInfo.hx b/source/funkin/backend/system/framerate/SystemInfo.hx index 4562b338a1..b3d0c83d15 100644 --- a/source/funkin/backend/system/framerate/SystemInfo.hx +++ b/source/funkin/backend/system/framerate/SystemInfo.hx @@ -108,7 +108,7 @@ class SystemInfo extends FramerateCategory { gpuName = Std.string(flixel.FlxG.stage.context3D.gl.getParameter(flixel.FlxG.stage.context3D.gl.RENDERER)).split("/")[0].trim(); #if !flash var size = FlxG.bitmap.maxTextureSize; - gpuMaxSize = size+"x"+size; + gpuMaxSize = size+"x"+size;//if (gpuMaxSize != "Unknown") StringMacro.addLine(buf, '\nMax Bitmap Size: ',gpuMaxSize); #end if(openfl.display3D.Context3D.__glMemoryTotalAvailable != -1) { @@ -124,7 +124,9 @@ class SystemInfo extends FramerateCategory { } #if cpp - totalMem = Std.string(MemoryUtil.getTotalMem() / 1024) + " GB"; + var rawMem:Float = MemoryUtil.getTotalMem(); + var rawGBMem:Float = flixel.math.FlxMath.roundDecimal(rawMem / 1024, 2); + totalMem = Std.string(rawGBMem) + " GB"; #else Logs.error('Unable to grab RAM Amount'); #end @@ -140,10 +142,10 @@ class SystemInfo extends FramerateCategory { static function formatSysInfo() { var buf = new StringBuf(); if (osInfo != "Unknown") { - StringMacro.addLine(buf, 'System: ${osInfo}'); + StringMacro.addLine(buf, 'System: ${osInfo} '); } if (cpuName != "Unknown") { - StringMacro.addLine(buf, '\nCPU: ${cpuName} ${openfl.system.Capabilities.cpuArchitecture} ${openfl.system.Capabilities.supports64BitProcesses ? "64-Bit" : "32-Bit"}'); + StringMacro.addLine(buf, '\nCPU: ${cpuName} ${openfl.system.Capabilities.cpuArchitecture}-${openfl.system.Capabilities.supports64BitProcesses ? "64-Bit" : "32-Bit"}'); } if (gpuName != cpuName || vRAM != "Unknown") { var gpuNameKnown = gpuName != "Unknown" && gpuName != cpuName; @@ -159,9 +161,9 @@ class SystemInfo extends FramerateCategory { StringMacro.addLine(buf, 'VRAM: ${vRAM}'); } } - //if (gpuMaxSize != "Unknown") StringMacro.addLine(buf, '\nMax Bitmap Size: ',gpuMaxSize); + if (totalMem != "Unknown" && memType != "Unknown") { - StringMacro.addLine(buf, '\nTotal MEM: ${totalMem} ${memType}'); + StringMacro.addLine(buf, '\nTotal RAM: ${totalMem} ${memType}'); } __formattedSysText = buf.toString(); } diff --git a/source/funkin/backend/utils/MemoryUtil.hx b/source/funkin/backend/utils/MemoryUtil.hx index 2de56184c1..b18a642f37 100644 --- a/source/funkin/backend/utils/MemoryUtil.hx +++ b/source/funkin/backend/utils/MemoryUtil.hx @@ -175,15 +175,25 @@ final class MemoryUtil { reg.match(process.stdout.readAll().toString()); if (process.exitCode() == 0) return reg.matched(1); #elseif linux - /*var process = new HiddenProcess("sudo", ["dmidecode", "--type", "17"]); + var process = new HiddenProcess("pkexec", ["dmidecode", "--type", "17"]); if (process.exitCode() != 0) return "Unknown"; + var lines = process.stdout.readAll().toString().split("\n"); for (line in lines) { - if (line.startsWith("Type:")) { - return line.substring("Type:".length).trim(); - } - }*/ - // TODO: sort of unsafe? also requires users to use `sudo` + + var trimmed = StringTools.trim(line); + + if (trimmed.startsWith("Type:")) + { + var ramType = StringTools.trim(trimmed.substring("Type:".length)); + + if (ramType != "" && ramType != "Unknown" && ramType != "None") { + return ramType; + } + } + } + // TODO: sort of unsafe? also requires users to use `sudo` (or pkexec because pkexec will attempting to drop PolicyPolkit popup if you have any polkit manager installed and running on autostart) + // You can have polkit-gnome, polkit-xfce, polkit-kde, polkit-lxde, polkit-lxqt, polkit-hyprland (it must needs to have at least one i mentioned here!!) // when launching the engine through the CLI, REIMPLEMENT LATER. #end return "Unknown"; From 374fe271a530a22523f2dc8fe979fa7d2bb3bb30 Mon Sep 17 00:00:00 2001 From: ACoolioDude Date: Tue, 4 Aug 2026 23:06:45 +0200 Subject: [PATCH 2/4] Remove root method and use rootless method using inxi - Using pkexec gives root access to game which can cause security issues which people don't really want that! --- .../backend/system/framerate/SystemInfo.hx | 2 +- source/funkin/backend/utils/MemoryUtil.hx | 29 +++++++------------ 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/source/funkin/backend/system/framerate/SystemInfo.hx b/source/funkin/backend/system/framerate/SystemInfo.hx index b3d0c83d15..4aafb2b933 100644 --- a/source/funkin/backend/system/framerate/SystemInfo.hx +++ b/source/funkin/backend/system/framerate/SystemInfo.hx @@ -163,7 +163,7 @@ class SystemInfo extends FramerateCategory { } if (totalMem != "Unknown" && memType != "Unknown") { - StringMacro.addLine(buf, '\nTotal RAM: ${totalMem} ${memType}'); + StringMacro.addLine(buf, '\nTotal MEM: ${totalMem} ${memType}'); } __formattedSysText = buf.toString(); } diff --git a/source/funkin/backend/utils/MemoryUtil.hx b/source/funkin/backend/utils/MemoryUtil.hx index b18a642f37..7578361c84 100644 --- a/source/funkin/backend/utils/MemoryUtil.hx +++ b/source/funkin/backend/utils/MemoryUtil.hx @@ -175,25 +175,16 @@ final class MemoryUtil { reg.match(process.stdout.readAll().toString()); if (process.exitCode() == 0) return reg.matched(1); #elseif linux - var process = new HiddenProcess("pkexec", ["dmidecode", "--type", "17"]); - if (process.exitCode() != 0) return "Unknown"; - - var lines = process.stdout.readAll().toString().split("\n"); - for (line in lines) { - - var trimmed = StringTools.trim(line); - - if (trimmed.startsWith("Type:")) - { - var ramType = StringTools.trim(trimmed.substring("Type:".length)); - - if (ramType != "" && ramType != "Unknown" && ramType != "None") { - return ramType; - } - } - } - // TODO: sort of unsafe? also requires users to use `sudo` (or pkexec because pkexec will attempting to drop PolicyPolkit popup if you have any polkit manager installed and running on autostart) - // You can have polkit-gnome, polkit-xfce, polkit-kde, polkit-lxde, polkit-lxqt, polkit-hyprland (it must needs to have at least one i mentioned here!!) + try { + var process = new HiddenProcess("sh", ["-c", "inxi -m --c 0 | grep -i 'type:' | awk -F'type:' '{print $2}' | awk '{print $1}' | head -n 1"]); + var output = StringTools.trim(process.stdout.readAll().toString()); + process.close(); + + if (output != "" && output != "None" && output != "Unknown") { + return StringTools.replace(output, ",", ""); + } + } catch (e:Dynamic) {} + // TODO: sort of unsafe? also requires users to use `sudo` (or use inxi (YOU NEED INXI INSTALLED ON YOUR DISTRO FOR THIS OTHERWISE ENGINE WILL FREEZE ON INITIALISATION)) // when launching the engine through the CLI, REIMPLEMENT LATER. #end return "Unknown"; From 1bd8609d6e09825fed0f7b06699477ccf43633b0 Mon Sep 17 00:00:00 2001 From: ACoolioDude Date: Wed, 5 Aug 2026 00:05:36 +0200 Subject: [PATCH 3/4] Update SystemInfo.hx --- source/funkin/backend/system/framerate/SystemInfo.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/backend/system/framerate/SystemInfo.hx b/source/funkin/backend/system/framerate/SystemInfo.hx index 4aafb2b933..c1c9dc041e 100644 --- a/source/funkin/backend/system/framerate/SystemInfo.hx +++ b/source/funkin/backend/system/framerate/SystemInfo.hx @@ -108,7 +108,7 @@ class SystemInfo extends FramerateCategory { gpuName = Std.string(flixel.FlxG.stage.context3D.gl.getParameter(flixel.FlxG.stage.context3D.gl.RENDERER)).split("/")[0].trim(); #if !flash var size = FlxG.bitmap.maxTextureSize; - gpuMaxSize = size+"x"+size;//if (gpuMaxSize != "Unknown") StringMacro.addLine(buf, '\nMax Bitmap Size: ',gpuMaxSize); + gpuMaxSize = size+"x"+size; //if (gpuMaxSize != "Unknown") StringMacro.addLine(buf, '\nMax Bitmap Size: ',gpuMaxSize); #end if(openfl.display3D.Context3D.__glMemoryTotalAvailable != -1) { @@ -145,7 +145,7 @@ class SystemInfo extends FramerateCategory { StringMacro.addLine(buf, 'System: ${osInfo} '); } if (cpuName != "Unknown") { - StringMacro.addLine(buf, '\nCPU: ${cpuName} ${openfl.system.Capabilities.cpuArchitecture}-${openfl.system.Capabilities.supports64BitProcesses ? "64-Bit" : "32-Bit"}'); + StringMacro.addLine(buf, '\nCPU: ${cpuName} ${openfl.system.Capabilities.cpuArchitecture} ${openfl.system.Capabilities.supports64BitProcesses ? "64-Bit" : "32-Bit"}'); } if (gpuName != cpuName || vRAM != "Unknown") { var gpuNameKnown = gpuName != "Unknown" && gpuName != cpuName; From a54350eac6cfc4e6bc9a88ffb61b937a88577add Mon Sep 17 00:00:00 2001 From: r6915ee Date: Tue, 4 Aug 2026 15:12:21 -0700 Subject: [PATCH 4/4] Replace `inxi -m` with `inxi --mm` when getting memory type on Linux The `--mm` flag filters out devices with no module installed, unlike the `-m` flag, which would just place a warning that the module was not installed... right in the type field, for that matter. --- source/funkin/backend/utils/MemoryUtil.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/backend/utils/MemoryUtil.hx b/source/funkin/backend/utils/MemoryUtil.hx index 7578361c84..7571d3c943 100644 --- a/source/funkin/backend/utils/MemoryUtil.hx +++ b/source/funkin/backend/utils/MemoryUtil.hx @@ -176,7 +176,7 @@ final class MemoryUtil { if (process.exitCode() == 0) return reg.matched(1); #elseif linux try { - var process = new HiddenProcess("sh", ["-c", "inxi -m --c 0 | grep -i 'type:' | awk -F'type:' '{print $2}' | awk '{print $1}' | head -n 1"]); + var process = new HiddenProcess("sh", ["-c", "inxi --mm --c 0 | grep -i 'type:' | awk -F'type:' '{print $2}' | awk '{print $1}' | head -n 1"]); var output = StringTools.trim(process.stdout.readAll().toString()); process.close();