aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2023-09-21 23:44:39 +0200
committer0neGal <mail@0negal.com>2023-09-21 23:47:15 +0200
commit926f72be0c0aa3b1f654a529c8fa46f4119815aa (patch)
tree59082e7ac865084082e1e525be954dcf90422091
parent9ca69f49b4559419273066a17f578cb26a3bd328 (diff)
downloadViper-926f72be0c0aa3b1f654a529c8fa46f4119815aa.tar.gz
Viper-926f72be0c0aa3b1f654a529c8fa46f4119815aa.zip
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.
-rw-r--r--src/app/main.js14
1 files changed, 12 insertions, 2 deletions
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"));
})