diff --git a/source/funkin/backend/system/framerate/SystemInfo.hx b/source/funkin/backend/system/framerate/SystemInfo.hx index 4562b338a1..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; + 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,7 +142,7 @@ 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"}'); @@ -159,7 +161,7 @@ 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}'); } diff --git a/source/funkin/backend/utils/MemoryUtil.hx b/source/funkin/backend/utils/MemoryUtil.hx index 2de56184c1..7571d3c943 100644 --- a/source/funkin/backend/utils/MemoryUtil.hx +++ b/source/funkin/backend/utils/MemoryUtil.hx @@ -175,15 +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("sudo", ["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(); + try { + 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(); + + if (output != "" && output != "None" && output != "Unknown") { + return StringTools.replace(output, ",", ""); } - }*/ - // TODO: sort of unsafe? also requires users to use `sudo` + } 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";