rip to the person who put wmic in their codename folder
This commit is contained in:
@@ -71,11 +71,6 @@ class Flx3DView extends FlxView3D {
|
||||
});
|
||||
}
|
||||
|
||||
@:deprecated public function addMesh(assetPath:String, callback:Mesh->Void, ?texturePath:String, smoothTexture:Bool = true) {
|
||||
Logs.trace('The addMesh() function is deprecated, use addModel instead!', ERROR, RED);
|
||||
}
|
||||
|
||||
|
||||
private var __cur3DStageID:Int;
|
||||
private var _loaders:Map<Asset3DLibraryBundle, AssetLoaderToken> = [];
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package funkin.backend.system.framerate;
|
||||
|
||||
import funkin.backend.utils.native.HiddenProcess;
|
||||
import funkin.backend.utils.MemoryUtil;
|
||||
import funkin.backend.system.Logs;
|
||||
|
||||
using StringTools;
|
||||
|
||||
@@ -13,36 +14,69 @@ class SystemInfo extends FramerateCategory {
|
||||
public static var totalMem:String = "Unknown";
|
||||
public static var memType:String = "Unknown";
|
||||
|
||||
static var __formattedSysText:String = "";
|
||||
|
||||
public static inline function init() {
|
||||
osInfo = '${lime.system.System.platformLabel.replace(lime.system.System.platformVersion, "").trim()} ${lime.system.System.platformVersion}';
|
||||
if (lime.system.System.platformLabel != null && lime.system.System.platformLabel != "" && lime.system.System.platformVersion != null && lime.system.System.platformVersion != "")
|
||||
osInfo = '${lime.system.System.platformLabel.replace(lime.system.System.platformVersion, "").trim()} ${lime.system.System.platformVersion}';
|
||||
else
|
||||
Logs.trace('Unable to grab OS Label', ERROR, RED);
|
||||
|
||||
#if windows
|
||||
var process = new HiddenProcess("wmic", ["cpu", "get", "name"]);
|
||||
if (process.exitCode() == 0) cpuName = process.stdout.readAll().toString().trim().split("\n")[1].trim();
|
||||
#elseif mac
|
||||
var process = new HiddenProcess("sysctl -a | grep brand_string");
|
||||
if (process.exitCode() == 0) cpuName = process.stdout.readAll().toString().trim().split(":")[1].trim();
|
||||
#elseif linux
|
||||
var process = new HiddenProcess("cat", ["/proc/cpuinfo"]);
|
||||
if (process.exitCode() != 0) return;
|
||||
try {
|
||||
#if windows
|
||||
var process = new HiddenProcess("wmic", ["cpu", "get", "name"]);
|
||||
if (process.exitCode() == 0) cpuName = process.stdout.readAll().toString().trim().split("\n")[1].trim();
|
||||
#elseif mac
|
||||
var process = new HiddenProcess("sysctl -a | grep brand_string");
|
||||
if (process.exitCode() == 0) cpuName = process.stdout.readAll().toString().trim().split(":")[1].trim();
|
||||
#elseif linux
|
||||
var process = new HiddenProcess("cat", ["/proc/cpuinfo"]);
|
||||
if (process.exitCode() != 0) return;
|
||||
|
||||
for (line in process.stdout.readAll().toString().split("\n")) {
|
||||
if (line.indexOf("model name") == 0) {
|
||||
cpuName = line.substring(line.indexOf(":") + 2);
|
||||
break;
|
||||
for (line in process.stdout.readAll().toString().split("\n")) {
|
||||
if (line.indexOf("model name") == 0) {
|
||||
cpuName = line.substring(line.indexOf(":") + 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#end
|
||||
} catch (e) {
|
||||
Logs.trace('Unable to grab CPU Name: $e', ERROR, RED);
|
||||
}
|
||||
#end
|
||||
|
||||
|
||||
@:privateAccess {
|
||||
gpuName = Std.string(flixel.FlxG.stage.context3D.gl.getParameter(flixel.FlxG.stage.context3D.gl.RENDERER)).split("/")[0];
|
||||
vRAM = CoolUtil.getSizeString(cast(flixel.FlxG.stage.context3D.gl.getParameter(openfl.display3D.Context3D.__glMemoryTotalAvailable), UInt) * 1000);
|
||||
if (flixel.FlxG.stage.context3D != null && flixel.FlxG.stage.context3D.gl != null) {
|
||||
gpuName = Std.string(flixel.FlxG.stage.context3D.gl.getParameter(flixel.FlxG.stage.context3D.gl.RENDERER)).split("/")[0].trim();
|
||||
|
||||
var vRAMBytes:UInt = cast(flixel.FlxG.stage.context3D.gl.getParameter(openfl.display3D.Context3D.__glMemoryTotalAvailable), UInt);
|
||||
if (vRAMBytes == 1000 || vRAMBytes <= 0)
|
||||
Logs.trace('Unable to grab GPU VRAM', ERROR, RED);
|
||||
else
|
||||
vRAM = CoolUtil.getSizeString(vRAMBytes * 1000);
|
||||
} else
|
||||
Logs.trace('Unable to grab GPU Info', ERROR, RED);
|
||||
}
|
||||
|
||||
#if cpp
|
||||
totalMem = Std.string(MemoryUtil.getTotalMem() / 1024) + " GB";
|
||||
#else
|
||||
Logs.trace('Unable to grab RAM Amount', ERROR, RED);
|
||||
#end
|
||||
memType = MemoryUtil.getMemType();
|
||||
|
||||
try {
|
||||
memType = MemoryUtil.getMemType();
|
||||
} catch (e) {
|
||||
Logs.trace('Unable to grab RAM Type: $e', ERROR, RED);
|
||||
}
|
||||
formatSysInfo();
|
||||
}
|
||||
|
||||
static function formatSysInfo() {
|
||||
if (osInfo != "Unknown") __formattedSysText = 'System: $osInfo';
|
||||
if (cpuName != "Unknown") __formattedSysText += '\nCPU: ${cpuName} ${openfl.system.Capabilities.cpuArchitecture} ${(openfl.system.Capabilities.supports64BitProcesses ? '64-Bit' : '32-Bit')}';
|
||||
if (gpuName != cpuName && (gpuName != "Unknown" && vRAM != "Unknown")) __formattedSysText += '\nGPU: ${gpuName} | VRAM: ${vRAM}'; // 1000 bytes of vram (apus)
|
||||
if (totalMem != "Unknown" && memType != "Unknown") __formattedSysText += '\nTotal MEM: ${totalMem} $memType';
|
||||
}
|
||||
|
||||
public function new() {
|
||||
@@ -51,13 +85,9 @@ class SystemInfo extends FramerateCategory {
|
||||
|
||||
public override function __enterFrame(t:Int) {
|
||||
if (alpha <= 0.05) return;
|
||||
_text = 'System: $osInfo';
|
||||
_text += '\nCPU: ${cpuName} ${openfl.system.Capabilities.cpuArchitecture} ${(openfl.system.Capabilities.supports64BitProcesses ? '64-Bit' : '32-Bit')}';
|
||||
if (gpuName != cpuName) _text += '\nGPU: ${gpuName}'; // 1000 bytes of vram (apus)
|
||||
if (FlxG.stage != null && FlxG.stage.context3D != null)
|
||||
_text += '\nVRAM: ${CoolUtil.getSizeString(cast(FlxG.stage.context3D.totalGPUMemory, UInt))} / $vRAM';
|
||||
_text += '\nTotal MEM: ${totalMem} $memType';
|
||||
_text += '\nGarbage Collector: ${MemoryUtil.disableCount > 0 ? "OFF" : "ON"} (${MemoryUtil.disableCount})';
|
||||
|
||||
_text = __formattedSysText;
|
||||
_text += '${__formattedSysText == "" ? "" : "\n"}Garbage Collector: ${MemoryUtil.disableCount > 0 ? "OFF" : "ON"} (${MemoryUtil.disableCount})';
|
||||
|
||||
this.text.text = _text;
|
||||
super.__enterFrame(t);
|
||||
|
||||
@@ -137,7 +137,6 @@ class MemoryUtil {
|
||||
}
|
||||
}
|
||||
#end
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user