From c4ceb7ab0bfca6ffbc3fc8af39813297ffaf222e Mon Sep 17 00:00:00 2001 From: Daniel Scalzi Date: Thu, 26 Aug 2021 01:11:09 -0400 Subject: [PATCH] Patches to get 1.17 working, need to revise into real solutions. --- app/assets/js/assetguard.js | 10 ++++---- app/assets/js/processbuilder.js | 41 +++++++++++++++++++++++++++++---- 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/app/assets/js/assetguard.js b/app/assets/js/assetguard.js index 75f6bc5..662a036 100644 --- a/app/assets/js/assetguard.js +++ b/app/assets/js/assetguard.js @@ -468,15 +468,15 @@ class JavaGuard extends EventEmitter { break } } - } else { + } else if(verOb.major >= 16) { + // TODO Make this logic better. Make java 16 required. // Java 9+ - if(Util.mcVersionAtLeast('1.13', this.mcVersion)){ - console.log('Java 9+ not yet tested.') - /* meta.version = verOb + if(Util.mcVersionAtLeast('1.17', this.mcVersion)){ + meta.version = verOb ++checksum if(checksum === goal){ break - } */ + } } } // Space included so we get only the vendor. diff --git a/app/assets/js/processbuilder.js b/app/assets/js/processbuilder.js index bf907c3..25a6d33 100644 --- a/app/assets/js/processbuilder.js +++ b/app/assets/js/processbuilder.js @@ -96,6 +96,16 @@ class ProcessBuilder { return child } + /** + * Get the platform specific classpath separator. On windows, this is a semicolon. + * On Unix, this is a colon. + * + * @returns {string} The classpath separator for the current operating system. + */ + static getClasspathSeparator() { + return process.platform === 'win32' ? ';' : ':' + } + /** * Determine if an optional mod is enabled from its configuration value. If the * configuration value is null, the required object will be used to @@ -339,7 +349,7 @@ class ProcessBuilder { // Classpath Argument args.push('-cp') - args.push(this.classpathArg(mods, tempNativePath).join(process.platform === 'win32' ? ';' : ':')) + args.push(this.classpathArg(mods, tempNativePath).join(ProcessBuilder.getClasspathSeparator())) // Java Arguments if(process.platform === 'darwin'){ @@ -377,6 +387,19 @@ class ProcessBuilder { // JVM Arguments First let args = this.versionData.arguments.jvm + // Debug securejarhandler + // args.push('-Dbsl.debug=true') + + if(this.forgeData.arguments.jvm != null) { + for(const argStr of this.forgeData.arguments.jvm) { + args.push(argStr + .replaceAll('${library_directory}', this.libPath) + .replaceAll('${classpath_separator}', ProcessBuilder.getClasspathSeparator()) + .replaceAll('${version_name}', this.forgeData.id) + ) + } + } + //args.push('-Dlog4j.configurationFile=D:\\WesterosCraft\\game\\common\\assets\\log_configs\\client-1.12.xml') // Java Arguments @@ -489,7 +512,7 @@ class ProcessBuilder { val = args[i].replace(argDiscovery, this.launcherVersion) break case 'classpath': - val = this.classpathArg(mods, tempNativePath).join(process.platform === 'win32' ? ';' : ':') + val = this.classpathArg(mods, tempNativePath).join(ProcessBuilder.getClasspathSeparator()) break } if(val != null){ @@ -648,8 +671,9 @@ class ProcessBuilder { let cpArgs = [] // Add the version.jar to the classpath. - const version = this.versionData.id - cpArgs.push(path.join(this.commonDir, 'versions', version, version + '.jar')) + // TODO Needs to be removed for 1.17+, need to test earlier versions. + // const version = this.versionData.id + // cpArgs.push(path.join(this.commonDir, 'versions', version, version + '.jar')) if(this.usingLiteLoader){ cpArgs.push(this.llPath) @@ -788,6 +812,15 @@ class ProcessBuilder { let libs = [] for(let sm of mdl.getSubModules()){ if(sm.getType() === DistroManager.Types.Library){ + + // TODO Add as file or something. + const x = sm.getIdentifier() + console.log(x) + if(x.includes(':universal') || x.includes(':slim') || x.includes(':extra') || x.includes(':srg') || x.includes(':client')) { + console.log('SKIPPING ' + x) + continue + } + libs.push(sm.getArtifact().getPath()) } // If this module has submodules, we need to resolve the libraries for those.