From f08bbcc3e04111ec28fc60f49974e2acf43043d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20Gress=C3=A9-Lugu=C3=A9?= <106011457+Ulysse2211@users.noreply.github.com> Date: Mon, 6 May 2024 13:58:18 +0200 Subject: [PATCH 1/2] Update processbuilder.js --- app/assets/js/processbuilder.js | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/app/assets/js/processbuilder.js b/app/assets/js/processbuilder.js index 0e955621..1b4fa7f1 100644 --- a/app/assets/js/processbuilder.js +++ b/app/assets/js/processbuilder.js @@ -416,7 +416,7 @@ class ProcessBuilder { } //args.push('-Dlog4j.configurationFile=D:\\WesterosCraft\\game\\common\\assets\\log_configs\\client-1.12.xml') - + // Java Arguments if(process.platform === 'darwin'){ args.push('-Xdock:name=HeliosLauncher') @@ -432,6 +432,26 @@ class ProcessBuilder { // Vanilla Arguments args = args.concat(this.vanillaManifest.arguments.game) + async function WriteFullscreenToOptions(filePath, lineToReplace, newLine) { + try { + const exists = await fs.pathExists(filePath); + + if (exists) { + let fileContent = await fs.readFile(filePath, 'utf8'); + if (fileContent.includes(lineToReplace)) { + fileContent = fileContent.replace(lineToReplace, newLine); + await fs.outputFile(filePath, fileContent); + } else { + await fs.outputFile(filePath, newLine); + } + } else { + await fs.outputFile(filePath, newLine); + } + } catch (err) { + logger.info('Error while writing fullscreen to options.txt:', err); + } + } + for(let i=0; i Date: Thu, 23 May 2024 13:22:16 +0200 Subject: [PATCH 2/2] Update processbuilder.js --- app/assets/js/processbuilder.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/assets/js/processbuilder.js b/app/assets/js/processbuilder.js index 1b4fa7f1..857d68bc 100644 --- a/app/assets/js/processbuilder.js +++ b/app/assets/js/processbuilder.js @@ -474,18 +474,15 @@ class ProcessBuilder { if(rule.features.has_custom_resolution != null && rule.features.has_custom_resolution === true){ if(ConfigManager.getFullscreen()){ logger.info("gamedir: ", this.gameDir) - - const filePath = path.join(this.gameDir, "options.txt"); - const lineToReplace = 'fullscreen:false'; - const newLine = 'fullscreen:true'; - - WriteFullscreenToOptions(filePath, lineToReplace, newLine); - + WriteFullscreenToOptions(path.join(this.gameDir, "options.txt"), 'fullscreen:false', 'fullscreen:true') args[i].value = [ '--fullscreen', 'true' ] + } else { + WriteFullscreenToOptions(path.join(this.gameDir, "options.txt"), 'fullscreen:true', 'fullscreen:false'); } + checksum++ } }