Skip to content

Commit

Permalink
Update to 1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-luchack authored Sep 1, 2022
2 parents 94ff10c + e308983 commit a210da3
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 66 deletions.
54 changes: 4 additions & 50 deletions app/assets/js/assetguard.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,15 +468,14 @@ class JavaGuard extends EventEmitter {
break
}
}
} else {
} else if(verOb.major >= 16) {
// 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.
Expand Down Expand Up @@ -1620,51 +1619,6 @@ class AssetGuard extends EventEmitter {
}
}

// _enqueueMojangJRE(dir){
// return new Promise((resolve, reject) => {
// // Mojang does not host the JRE for linux.
// if(process.platform === 'linux'){
// resolve(false)
// }
// AssetGuard.loadMojangLauncherData().then(data => {
// if(data != null) {

// try {
// const mJRE = data[Library.mojangFriendlyOS()]['64'].jre
// const url = mJRE.url

// request.head(url, (err, resp, body) => {
// if(err){
// resolve(false)
// } else {
// const name = url.substring(url.lastIndexOf('/')+1)
// const fDir = path.join(dir, name)
// const jre = new Asset('jre' + mJRE.version, mJRE.sha1, resp.headers['content-length'], url, fDir)
// this.java = new DLTracker([jre], jre.size, a => {
// fs.readFile(a.to, (err, data) => {
// // Data buffer needs to be decompressed from lzma,
// // not really possible using node.js
// })
// })
// }
// })
// } catch (err){
// resolve(false)
// }

// }
// })
// })
// }


// #endregion

// #endregion

// Control Flow Functions
// #region

/**
* Initiate an async download process for an AssetGuard DLTracker.
*
Expand Down
16 changes: 8 additions & 8 deletions app/assets/js/authmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ async function fullMicrosoftAuthFlow(entryCode, authMode) {
if(xblResponse.responseStatus === RestResponseStatus.ERROR) {
return Promise.reject(microsoftErrorDisplayable(xblResponse.microsoftErrorCode))
}
const xstsResonse = await MicrosoftAuth.getXSTSToken(xblResponse.data)
if(xstsResonse.responseStatus === RestResponseStatus.ERROR) {
return Promise.reject(microsoftErrorDisplayable(xstsResonse.microsoftErrorCode))
const xstsResponse = await MicrosoftAuth.getXSTSToken(xblResponse.data)
if(xstsResponse.responseStatus === RestResponseStatus.ERROR) {
return Promise.reject(microsoftErrorDisplayable(xstsResponse.microsoftErrorCode))
}
const mcTokenResponse = await MicrosoftAuth.getMCAccessToken(xstsResonse.data)
const mcTokenResponse = await MicrosoftAuth.getMCAccessToken(xstsResponse.data)
if(mcTokenResponse.responseStatus === RestResponseStatus.ERROR) {
return Promise.reject(microsoftErrorDisplayable(mcTokenResponse.microsoftErrorCode))
}
Expand All @@ -106,7 +106,7 @@ async function fullMicrosoftAuthFlow(entryCode, authMode) {
accessToken,
accessTokenRaw,
xbl: xblResponse.data,
xsts: xstsResonse.data,
xsts: xstsResponse.data,
mcToken: mcTokenResponse.data,
mcProfile: mcProfileResponse.data
}
Expand All @@ -121,11 +121,11 @@ async function fullMicrosoftAuthFlow(entryCode, authMode) {
* to reduce the liklihood of working with an expired token.
*
* @param {number} nowMs Current time milliseconds.
* @param {number} epiresInS Expires in (seconds)
* @param {number} expiresInS Expires in (seconds)
* @returns
*/
function calculateExpiryDate(nowMs, epiresInS) {
return nowMs + ((epiresInS-10)*1000)
function calculateExpiryDate(nowMs, expiresInS) {
return nowMs + ((expiresInS-10)*1000)
}

/**
Expand Down
45 changes: 40 additions & 5 deletions app/assets/js/processbuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'){
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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){
Expand Down Expand Up @@ -647,9 +670,12 @@ 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)
Expand Down Expand Up @@ -788,6 +814,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.
Expand Down
4 changes: 2 additions & 2 deletions app/settings.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
<div class="settingsFileSelContainer">
<div class="settingsFileSelTitle">Java Executable</div>
<div class="settingsFileSelContent">
<div id="settingsJavaExecDetails">Selected: Java 8 Update 172 (x64)</div>
<div id="settingsJavaExecDetails">Selected: Java</div>
<div class="settingsFileSelActions">
<div class="settingsFileSelIcon">
<svg class="settingsFileSelSVG" x="0px" y="0px" viewBox="0 0 305.001 305.001">
Expand All @@ -248,7 +248,7 @@
<button class="settingsFileSelButton" id="settingsJavaExecSel" dialogTitle="Select Java Executable" dialogDirectory="false">Choose File</button>
</div>
</div>
<div class="settingsFileSelDesc">The Java executable is validated before game launch. <strong>Requires Java 8 x64.</strong><br>The path should end with <strong>bin<%= process.platform === 'win32' ? '\\javaw.exe' : '/java' %></strong>.</div>
<div class="settingsFileSelDesc">The Java executable is validated before game launch. <strong>Requires Java JRE x64.</strong><br>The path should end with <strong>bin<%= process.platform === 'win32' ? '\\javaw.exe' : '/java' %></strong>.</div>
</div>
<div id="settingsJVMOptsContainer">
<div id="settingsJVMOptsTitle">Additional JVM Options</div>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gaialauncher",
"version": "1.2.0",
"version": "1.2.1",
"productName": "Gaïa Launcher",
"description": "Modded Minecraft Launcher",
"author": "Valbion Group",
Expand Down

0 comments on commit a210da3

Please sign in to comment.