From 0075e1dece144fb6e30236836819c9e3f0890ba5 Mon Sep 17 00:00:00 2001 From: GekoXD <113216523+GekoXD@users.noreply.github.com> Date: Tue, 15 Nov 2022 12:02:38 -0500 Subject: [PATCH] 1.9.1 ac --- app/assets/js/assetguard.js | 24 +++++----------- app/assets/js/distromanager.js | 2 +- app/assets/js/processbuilder.js | 50 +++++++++++++++++++++++++++------ app/loginOptions.ejs | 4 +-- app/settings.ejs | 14 ++++----- app/waiting.ejs | 2 +- docs/distro.md | 2 +- docs/sample_distribution.json | 4 +-- package-lock.json | 2 +- package.json | 4 +-- 10 files changed, 66 insertions(+), 42 deletions(-) diff --git a/app/assets/js/assetguard.js b/app/assets/js/assetguard.js index 75f6bc54..3219e61d 100644 --- a/app/assets/js/assetguard.js +++ b/app/assets/js/assetguard.js @@ -227,14 +227,13 @@ class JavaGuard extends EventEmitter { * Fetch the last open JDK binary. * * HOTFIX: Uses Corretto 8 for macOS. - * See: https://github.com/dscalzi/HeliosLauncher/issues/70 * See: https://github.com/AdoptOpenJDK/openjdk-support/issues/101 * * @param {string} major The major version of Java to fetch. * * @returns {Promise.} Promise which resolved to an object containing the JRE download data. */ - static _latestOpenJDK(major = '8'){ + static _latestOpenJDK(major = '17'){ if(process.platform === 'darwin') { return this._latestCorretto(major) @@ -380,7 +379,7 @@ class JavaGuard extends EventEmitter { static parseJavaRuntimeVersion(verString){ const major = verString.split('.')[0] if(major == 1){ - return JavaGuard._parseJavaRuntimeVersion_8(verString) + return JavaGuard._parseJavaRuntimeVersion_9(verString) } else { return JavaGuard._parseJavaRuntimeVersion_9(verString) } @@ -459,25 +458,16 @@ class JavaGuard extends EventEmitter { let verString = props[i].split('=')[1].trim() console.log(props[i].trim()) const verOb = JavaGuard.parseJavaRuntimeVersion(verString) - if(verOb.major < 9){ - // Java 8 - if(verOb.major === 8 && verOb.update > 52){ + if(verOb.major >= 16) { + // TODO Make this logic better. Make java 16 required. + // Java 9+ + if(Util.mcVersionAtLeast('1.17', this.mcVersion)){ meta.version = verOb ++checksum if(checksum === goal){ break } } - } else { - // Java 9+ - if(Util.mcVersionAtLeast('1.13', this.mcVersion)){ - console.log('Java 9+ not yet tested.') - /* meta.version = verOb - ++checksum - if(checksum === goal){ - break - } */ - } } // Space included so we get only the vendor. } else if(props[i].lastIndexOf('java.vendor ') > -1) { @@ -1544,7 +1534,7 @@ class AssetGuard extends EventEmitter { _enqueueOpenJDK(dataDir){ return new Promise((resolve, reject) => { - JavaGuard._latestOpenJDK('8').then(verData => { + JavaGuard._latestOpenJDK('17').then(verData => { if(verData != null){ dataDir = path.join(dataDir, 'runtime', 'x64') diff --git a/app/assets/js/distromanager.js b/app/assets/js/distromanager.js index 90a2ab8d..36668038 100644 --- a/app/assets/js/distromanager.js +++ b/app/assets/js/distromanager.js @@ -537,7 +537,7 @@ exports.pullRemote = function(){ return exports.pullLocal() } return new Promise((resolve, reject) => { - const distroURL = 'http://mc.westeroscraft.com/WesterosCraftLauncher/distribution.json' + const distroURL = 'http://127.0.0.1:8080/distribution.json' //const distroURL = 'https://gist.githubusercontent.com/dscalzi/53b1ba7a11d26a5c353f9d5ae484b71b/raw/' const opts = { url: distroURL, diff --git a/app/assets/js/processbuilder.js b/app/assets/js/processbuilder.js index bf907c35..14d086e3 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,11 +349,11 @@ 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'){ - args.push('-Xdock:name=HeliosLauncher') + args.push('-Xdock:name=KingdomsLauncher') args.push('-Xdock:icon=' + path.join(__dirname, '..', 'images', 'minecraft.icns')) } args.push('-Xmx' + ConfigManager.getMaxRAM()) @@ -377,7 +387,18 @@ class ProcessBuilder { // JVM Arguments First let args = this.versionData.arguments.jvm - //args.push('-Dlog4j.configurationFile=D:\\WesterosCraft\\game\\common\\assets\\log_configs\\client-1.12.xml') + // 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) + ) + } + } // Java Arguments if(process.platform === 'darwin'){ @@ -483,13 +504,13 @@ class ProcessBuilder { val = args[i].replace(argDiscovery, tempNativePath) break case 'launcher_name': - val = args[i].replace(argDiscovery, 'Helios-Launcher') + val = args[i].replace(argDiscovery, 'Kingdoms-Launcher') break case 'launcher_version': 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){ @@ -647,9 +668,13 @@ class ProcessBuilder { classpathArg(mods, tempNativePath){ let cpArgs = [] - // Add the version.jar to the classpath. - const version = this.versionData.id - cpArgs.push(path.join(this.commonDir, 'versions', version, version + '.jar')) + if(!Util.mcVersionAtLeast('1.17', this.server.getMinecraftVersion())) { + // Add the version.jar to the classpath. + // Must not be added to the classpath for Forge 1.17+. + const version = this.versionData.id + cpArgs.push(path.join(this.commonDir, 'versions', version, version + '.jar')) + } + if(this.usingLiteLoader){ cpArgs.push(this.llPath) @@ -788,6 +813,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. diff --git a/app/loginOptions.ejs b/app/loginOptions.ejs index 9f80a08b..b245807d 100644 --- a/app/loginOptions.ejs +++ b/app/loginOptions.ejs @@ -11,7 +11,7 @@ - Logearte en Microsoft + Logearte con Microsoft
@@ -21,7 +21,7 @@ - Logearte con Microsoft + Logearte con Mojang
diff --git a/app/settings.ejs b/app/settings.ejs index 64292cad..bbb7b208 100644 --- a/app/settings.ejs +++ b/app/settings.ejs @@ -25,7 +25,7 @@
- Account Settings + Ajustes Cuenta Add new accounts or manage existing ones.
@@ -71,11 +71,11 @@