Minor fixes and improvements.

Fixed issue with passing fullscreen argment to 1.13+, although it doesnt seem to be working well clientside.
Improved the forge version check logic.
Fixed launch area toggling and added a min linger time so that the transition doesnt look abrupt.
Upgraded dependencies.
This commit is contained in:
Daniel Scalzi
2020-06-08 14:00:07 -04:00
parent 7f821f36d7
commit 71b25d3e5c
5 changed files with 78 additions and 64 deletions

View File

@@ -172,23 +172,26 @@ class Util {
return true
}
let forgeVer = null
try {
forgeVer = forgeVersion.split('-')[1]
const forgeVer = forgeVersion.split('-')[1]
const maxFG2 = [14, 23, 5, 2847]
const verSplit = forgeVer.split('.').map(v => Number(v))
for(let i=0; i<maxFG2.length; i++) {
if(verSplit[i] > maxFG2[i]) {
return true
} else if(verSplit[i] < maxFG2[i]) {
return false
}
}
return false
} catch(err) {
throw new Error('Forge version is complex (changed).. launcher requires a patch.')
}
const maxFG2 = [14, 23, 5, 2847]
const verSplit = forgeVer.split('.').map(v => Number(v))
for(let i=0; i<maxFG2.length; i++) {
if(verSplit[i] > maxFG2[i]) {
return true
}
}
return false
}
}

View File

@@ -377,7 +377,7 @@ class ProcessBuilder {
// This should be fine for a while.
if(rule.features.has_custom_resolution != null && rule.features.has_custom_resolution === true){
if(ConfigManager.getFullscreen()){
rule.values = [
args[i].value = [
'--fullscreen',
'true'
]

View File

@@ -467,7 +467,8 @@ let hasRPC = false
// Joined server regex
const SERVER_JOINED_REGEX = /\[.+\]: \[CHAT\] [a-zA-Z0-9_]{1,16} joined the game/
const GAME_JOINED_REGEX = /\[.+\]: Skipping bad option: lastServer:/
const GAME_LAUNCH_REGEX = /^\[.+\]: MinecraftForge .+ Initialized$/
const GAME_LAUNCH_REGEX = /^\[.+\]: (?:MinecraftForge .+ Initialized|ModLauncher .+ starting: .+)$/
const MIN_LINGER = 5000
let aEx
let serv
@@ -647,19 +648,29 @@ function dlAsync(login = true){
let pb = new ProcessBuilder(serv, versionData, forgeData, authUser, remote.app.getVersion())
setLaunchDetails('Launching game..')
const onLoadComplete = () => {
toggleLaunchArea(false)
if(hasRPC){
DiscordWrapper.updateDetails('Loading game..')
}
proc.stdout.on('data', gameStateChange)
proc.stdout.removeListener('data', tempListener)
proc.stderr.removeListener('data', gameErrorListener)
}
const start = Date.now()
// Attach a temporary listener to the client output.
// Will wait for a certain bit of text meaning that
// the client application has started, and we can hide
// the progress bar stuff.
const tempListener = function(data){
if(GAME_LAUNCH_REGEX.test(data.trim())){
toggleLaunchArea(false)
if(hasRPC){
DiscordWrapper.updateDetails('Loading game..')
const diff = Date.now()-start
if(diff < MIN_LINGER) {
setTimeout(onLoadComplete, MIN_LINGER-diff)
} else {
onLoadComplete()
}
proc.stdout.on('data', gameStateChange)
proc.stdout.removeListener('data', tempListener)
proc.stderr.removeListener('data', gameErrorListener)
}
}