Merge branch 'main' into pr/397
This commit is contained in:
@@ -706,7 +706,10 @@ class CoolUtil
|
||||
*/
|
||||
@:noUsing public static inline function openURL(url:String) {
|
||||
#if linux
|
||||
Sys.command('/usr/bin/xdg-open', [url]);
|
||||
// generally `xdg-open` should work in every distro
|
||||
var cmd = Sys.command("xdg-open", [url]);
|
||||
// run old command JUST IN CASE it fails, which it shouldn't
|
||||
if (cmd != 0) cmd = Sys.command("/usr/bin/xdg-open", [url]);
|
||||
#else
|
||||
FlxG.openURL(url);
|
||||
#end
|
||||
|
||||
@@ -165,6 +165,7 @@ class DiscordUtil
|
||||
#end
|
||||
}
|
||||
|
||||
#if cpp
|
||||
@:noCompletion public static function fixString(str:String)
|
||||
{
|
||||
return new cpp.ConstCharStar(cast(str, String));
|
||||
@@ -174,6 +175,7 @@ class DiscordUtil
|
||||
{
|
||||
return cast(str, String);
|
||||
}
|
||||
#end
|
||||
|
||||
public static function changePresenceAdvanced(data:DPresence)
|
||||
{
|
||||
@@ -469,7 +471,7 @@ typedef DPresence =
|
||||
var ?matchSecret:String; /* max 128 bytes */
|
||||
var ?joinSecret:String; /* max 128 bytes */
|
||||
var ?spectateSecret:String; /* max 128 bytes */
|
||||
var ?instance:OneOfTwo<Int, cpp.Int8>;
|
||||
var ?instance:#if cpp OneOfTwo<Int, cpp.Int8> #else Int #end;
|
||||
var ?button1Label:String; /* max 32 bytes */
|
||||
var ?button1Url:String; /* max 512 bytes */
|
||||
var ?button2Label:String; /* max 32 bytes */
|
||||
|
||||
@@ -130,14 +130,16 @@ 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("sudo", ["dmidecode", "--type", "17"]);
|
||||
if (process.exitCode() != 0) return "Unknown";
|
||||
var lines = process.stdout.readAll().toString().split("\n");
|
||||
for (line in lines) {
|
||||
if (line.indexOf("Type:") == 0) {
|
||||
return line.substring("Type:".length).trim();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
// TODO: sort of unsafe? also requires users to use `sudo`
|
||||
// when launching the engine through the CLI, REIMPLEMENT LATER.
|
||||
#end
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@ import funkin.backend.system.ErrorCode;
|
||||
import funkin.backend.FunkinSprite.XMLAnimType;
|
||||
import flixel.util.FlxColor;
|
||||
import haxe.xml.Access;
|
||||
import funkin.backend.scripting.Script;
|
||||
import funkin.backend.scripting.DummyScript;
|
||||
import funkin.backend.scripting.ScriptPack;
|
||||
import flixel.util.typeLimit.OneOfTwo;
|
||||
import funkin.backend.system.interfaces.IOffsetCompatible;
|
||||
|
||||
@@ -326,6 +329,51 @@ class XMLUtil {
|
||||
}
|
||||
}
|
||||
|
||||
class XMLImportedScriptInfo {
|
||||
public var path:String;
|
||||
public var shortLived:Bool = false;
|
||||
public var loadBefore:Bool = true;
|
||||
public var importStageSprites:Bool = false; // maybe will change later?? - Nex
|
||||
public var parentScriptPack:ScriptPack = null;
|
||||
|
||||
public function new(path:String, parentScriptPack:ScriptPack) {
|
||||
this.parentScriptPack = parentScriptPack;
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public function getScript():Script
|
||||
return parentScriptPack == null ? null : parentScriptPack.getByPath(path);
|
||||
|
||||
public static function prepareInfos(node:Access, parentScriptPack:ScriptPack, ?onScriptPreLoad:XMLImportedScriptInfo->Void):XMLImportedScriptInfo {
|
||||
if (!node.has.script || parentScriptPack == null) return null;
|
||||
|
||||
var folder = node.getAtt("folder").getDefault("data/scripts/");
|
||||
if (!folder.endsWith("/")) folder += "/";
|
||||
|
||||
var path = Paths.script(folder + node.getAtt("script"));
|
||||
var daScript = Script.create(path);
|
||||
if (daScript is DummyScript) {
|
||||
Logs.trace('Script Extension at ${path} does not exist.', ERROR);
|
||||
return null;
|
||||
}
|
||||
|
||||
var infos = new XMLImportedScriptInfo(daScript.path, parentScriptPack);
|
||||
infos.shortLived = node.getAtt("isShortLived") == "true" || node.getAtt("shortLived") == "true";
|
||||
infos.importStageSprites = node.getAtt("importStageSprites") == "true";
|
||||
@:privateAccess infos.loadBefore = shouldLoadBefore(node);
|
||||
|
||||
if (onScriptPreLoad != null) onScriptPreLoad(infos);
|
||||
parentScriptPack.add(daScript);
|
||||
daScript.set("scriptInfo", infos);
|
||||
daScript.load();
|
||||
|
||||
return infos;
|
||||
}
|
||||
|
||||
@:dox(hide) public static inline function shouldLoadBefore(node:Access):Bool
|
||||
return node.getAtt("loadBefore") != "false";
|
||||
}
|
||||
|
||||
typedef AnimData = {
|
||||
var name:String;
|
||||
var anim:String;
|
||||
|
||||
Reference in New Issue
Block a user