Check rules for natives (makes Fabric work again.. OwO')
This commit is contained in:
parent
dd687d451a
commit
76dcc5a689
@ -14,6 +14,9 @@ gamePath=$+sp$
|
|||||||
# Override the OS name. Choose windows, linux or macos, if the detection doesn't work right.
|
# Override the OS name. Choose windows, linux or macos, if the detection doesn't work right.
|
||||||
osName=
|
osName=
|
||||||
|
|
||||||
|
# Override JVM architecture (x86/amd64)
|
||||||
|
jvmArch=
|
||||||
|
|
||||||
# Default version to choose
|
# Default version to choose
|
||||||
#version=b1.8.1
|
#version=b1.8.1
|
||||||
|
|
||||||
|
@ -113,6 +113,21 @@ def parseJavaLibraryName(libName):
|
|||||||
libFilePath = libSplit[0].replace(".","/").replace(":","/") + "/" + libVersion + "/" +libName+ "-" +libVersion+ ".jar"
|
libFilePath = libSplit[0].replace(".","/").replace(":","/") + "/" + libVersion + "/" +libName+ "-" +libVersion+ ".jar"
|
||||||
return libPath,libName,libVersion,libFilePath
|
return libPath,libName,libVersion,libFilePath
|
||||||
|
|
||||||
|
def checkRules(ruleList):
|
||||||
|
action = "disallow"
|
||||||
|
for rule in ruleList:
|
||||||
|
if "os" in rule:
|
||||||
|
if "name" in rule["os"]:
|
||||||
|
if rule["os"]["name"] == "osx": rule["os"]["name"] = "macos"
|
||||||
|
if lv["osName"] != rule["os"]["name"]: continue
|
||||||
|
|
||||||
|
if "arch" in ruleList["os"]:
|
||||||
|
if lv["jvmArch"] != rule["os"]["arch"]: continue
|
||||||
|
|
||||||
|
action = rule["action"]
|
||||||
|
|
||||||
|
return action
|
||||||
|
|
||||||
def processVersion(versionsPath,libraryPath,nativePath,version):
|
def processVersion(versionsPath,libraryPath,nativePath,version):
|
||||||
versionPath = p(versionsPath,version)
|
versionPath = p(versionsPath,version)
|
||||||
clientJson = readJsonFile(p(versionPath,version + ".json"))
|
clientJson = readJsonFile(p(versionPath,version + ".json"))
|
||||||
@ -126,6 +141,7 @@ def processVersion(versionsPath,libraryPath,nativePath,version):
|
|||||||
l = {}
|
l = {}
|
||||||
l["path"],l["name"],l["version"],l["filePath"] = parseJavaLibraryName(library["name"])
|
l["path"],l["name"],l["version"],l["filePath"] = parseJavaLibraryName(library["name"])
|
||||||
l["type"] = "library"
|
l["type"] = "library"
|
||||||
|
l["data"] = library
|
||||||
|
|
||||||
if "downloads" in library:
|
if "downloads" in library:
|
||||||
# Libraries
|
# Libraries
|
||||||
@ -197,6 +213,12 @@ def main():
|
|||||||
lv["osName"] = platform.system().lower()
|
lv["osName"] = platform.system().lower()
|
||||||
if lv["osName"] == "darwin": lv["osName"] = "macos"
|
if lv["osName"] == "darwin": lv["osName"] = "macos"
|
||||||
|
|
||||||
|
if lv["jvmArch"] == "":
|
||||||
|
if "64-Bit" in subprocess.check_output([lv["java"],"-version"]).decode("utf-8"):
|
||||||
|
lv["jvmArch"] = "amd64"
|
||||||
|
else:
|
||||||
|
lv["jvmArch"] = "x86"
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
for arg in sys.argv[1:]:
|
for arg in sys.argv[1:]:
|
||||||
argSplit = arg.split("=",1)
|
argSplit = arg.split("=",1)
|
||||||
@ -223,7 +245,7 @@ def main():
|
|||||||
clientJson,libraries,arguments = processVersion(versionsPath,libraryPath,nativePath,lv["version"])
|
clientJson,libraries,arguments = processVersion(versionsPath,libraryPath,nativePath,lv["version"])
|
||||||
|
|
||||||
versionPath = p(lv["gamePath"],"versions",lv["version"])
|
versionPath = p(lv["gamePath"],"versions",lv["version"])
|
||||||
nativesOutPath = p(versionPath,"natives-" +lv["osName"])
|
nativesOutPath = p(versionPath,"natives-" +lv["osName"]+ "." +lv["jvmArch"])
|
||||||
assetsPath = p(lv["gamePath"],"assets")
|
assetsPath = p(lv["gamePath"],"assets")
|
||||||
|
|
||||||
print("\nDownloading libraries...")
|
print("\nDownloading libraries...")
|
||||||
@ -259,6 +281,7 @@ def main():
|
|||||||
if not os.path.isdir(nativesOutPath): os.makedirs(nativesOutPath)
|
if not os.path.isdir(nativesOutPath): os.makedirs(nativesOutPath)
|
||||||
for library in libraries:
|
for library in libraries:
|
||||||
if library["type"] == "native":
|
if library["type"] == "native":
|
||||||
|
if "rules" in library and checkRules(library["rules"]) == "disallow": continue
|
||||||
subprocess.run(["7z","x",library["filePathOS"],"-o" +nativesOutPath,"-aos"],check=True,stdout=subprocess.DEVNULL)
|
subprocess.run(["7z","x",library["filePathOS"],"-o" +nativesOutPath,"-aos"],check=True,stdout=subprocess.DEVNULL)
|
||||||
|
|
||||||
launcherVariables = {}
|
launcherVariables = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user