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";