Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions source/funkin/backend/system/framerate/SystemInfo.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand All @@ -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;
Expand All @@ -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();
}
Expand Down
22 changes: 16 additions & 6 deletions source/funkin/backend/utils/MemoryUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down