From 926f72be0c0aa3b1f654a529c8fa46f4119815aa Mon Sep 17 00:00:00 2001 From: 0neGal Date: Thu, 21 Sep 2023 23:44:39 +0200 Subject: fixed gamepath buttons being disabled If the gamepath is lost or similar then it'll disable many buttons, notably the install/launch buttons and other similar buttons, however for obvious reasons we shouldn't be stopping the user from changing their gamepath in this scenario. This is still useful when installing a mod or updating NS, so it's just this scenario. --- src/app/main.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/app') diff --git a/src/app/main.js b/src/app/main.js index 8ccdce3..fcef7be 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -166,7 +166,7 @@ let log = console.log; // Disables or enables certain buttons when for example // updating/installing Northstar. -function setButtons(state) { +function setButtons(state, enable_gamepath_btns) { playNsBtn.disabled = !state; let disablearray = (array) => { @@ -186,6 +186,16 @@ function setButtons(state) { disablearray(document.querySelectorAll(".playBtnContainer .playBtn")); disablearray(document.querySelectorAll("#nsMods .buttons.modbtns button")); disablearray(document.querySelectorAll("#browser #browserEntries .text button")); + + if (enable_gamepath_btns) { + let gamepath_btns = + document.querySelectorAll('*[onclick="setpath()"]'); + + for (let i = 0; i < gamepath_btns.length; i++) { + gamepath_btns[i].disabled = false; + gamepath_btns[i].classList.remove("disabled"); + } + } } ipcRenderer.on("set-buttons", (event, state) => { @@ -194,7 +204,7 @@ ipcRenderer.on("set-buttons", (event, state) => { ipcRenderer.on("gamepath-lost", (event, state) => { page(0); - setButtons(false); + setButtons(false, true); alert(lang("gui.gamepath.lost")); }) -- cgit v1.2.3