diff --git a/languages/en.json b/languages/en.json
index a4ce9b9..b1249c3 100644
--- a/languages/en.json
+++ b/languages/en.json
@@ -6,7 +6,7 @@
"playPrivate": "Play on Grasscutter",
"launchLocalServer": "Launch Local Server",
- "gameFolderSet": "Set game folder",
+ "gameExeSet": "Set game executable",
"grasscutterFileSet": "Set \"Grasscutter\" .jar file",
"folderNotSet": "Not set",
diff --git a/languages/es.json b/languages/es.json
index c3cc788..9fce461 100644
--- a/languages/es.json
+++ b/languages/es.json
@@ -6,7 +6,7 @@
"playPrivate": "Jugar en Grasscutter",
"launchLocalServer": "Iniciar servidor local",
- "gameFolderSet": "Establece el folder game",
+ "gameExeSet": "Establece el folder game",
"grasscutterFileSet": "Establece el archivo .jar de \"Grasscutter\"",
"folderNotSet": "No establecido",
diff --git a/languages/fr.json b/languages/fr.json
index 3eb9246..485d401 100644
--- a/languages/fr.json
+++ b/languages/fr.json
@@ -6,7 +6,7 @@
"playPrivate": "Jouer sur Grasscutter",
"launchLocalServer": "Lancer le serveur en local",
- "gameFolderSet": "Définir le dossier game",
+ "gameExeSet": "Définir le dossier game",
"grasscutterFileSet": "Définir le fichier .jar \"Grasscutter\"",
"folderNotSet": "Pas encore défini",
diff --git a/languages/id.json b/languages/id.json
index 5c200f0..63608f9 100644
--- a/languages/id.json
+++ b/languages/id.json
@@ -6,7 +6,7 @@
"playPrivate": "Mainkan Grasscutter",
"launchLocalServer": "Luncurkan Local Server",
- "gameFolderSet": "Atur folder game",
+ "gameExeSet": "Atur folder game",
"grasscutterFileSet": "Atur file \"Grasscutter\" .jar",
"folderNotSet": "Belum diatur",
diff --git a/languages/nl.json b/languages/nl.json
index cdbeed2..03cdb3b 100644
--- a/languages/nl.json
+++ b/languages/nl.json
@@ -6,7 +6,7 @@
"playPrivate": "Op Grasscutter spelen",
"launchLocalServer": "Lokale server starten",
- "gameFolderSet": "Selecteer de game folder",
+ "gameExeSet": "Selecteer de game folder",
"grasscutterFileSet": "Selecteer het \"Grasscutter\" .jar bestand",
"folderNotSet": "Niet geselecteerd",
diff --git a/languages/pt-br.json b/languages/pt-br.json
index 23c3402..cc11e7b 100644
--- a/languages/pt-br.json
+++ b/languages/pt-br.json
@@ -6,7 +6,7 @@
"playPrivate": "Jogar (Grasscutter)",
"launchLocalServer": "Abrir Servidor Local",
- "gameFolderSet": "Definir a game pasta ",
+ "gameExeSet": "Definir a game pasta ",
"grasscutterFileSet": "Definir o arquivo .jar de \"Grasscutter\" ",
"folderNotSet": "Não Definida",
diff --git a/languages/ru.json b/languages/ru.json
index 5905a58..86c42c3 100644
--- a/languages/ru.json
+++ b/languages/ru.json
@@ -6,7 +6,7 @@
"playPrivate": "Grasscutter",
"launchLocalServer": "Локальный сервер",
- "gameFolderSet": "Папка с игрой",
+ "gameExeSet": "Папка с игрой",
"grasscutterFileSet": "Путь до файла \"Grasscutter\" (.jar)",
"folderNotSet": "Папка не выбрана",
diff --git a/languages/vie.json b/languages/vie.json
index 31800c3..a64da64 100644
--- a/languages/vie.json
+++ b/languages/vie.json
@@ -6,7 +6,7 @@
"playPrivate": "Grasscutter",
"launchLocalServer": "Khởi động Grasscutter",
- "gameFolderSet": "Chỉnh địa điểm thư mục trò chơi",
+ "gameExeSet": "Chỉnh địa điểm thư mục trò chơi",
"grasscutterFileSet": "Chỉnh địa điểm file \"Grasscutter\"",
"folderNotSet": "Chưa chỉnh file",
diff --git a/languages/zh-tw.json b/languages/zh-tw.json
index b2604eb..ca1984a 100644
--- a/languages/zh-tw.json
+++ b/languages/zh-tw.json
@@ -6,7 +6,7 @@
"playPrivate": "啟動私人伺服器",
"launchLocalServer": "啟動本地伺服器",
- "gameFolderSet": "設定 \"Genshin Impact game\" 資料夾",
+ "gameExeSet": "設定 \"Genshin Impact game\" 資料夾",
"grasscutterFileSet": "設定 \"Grasscutter\" .jar 檔案",
"folderNotSet": "尚未設定Genshin Impact game資料夾",
diff --git a/languages/zh.json b/languages/zh.json
index e1f6008..1e2fdba 100644
--- a/languages/zh.json
+++ b/languages/zh.json
@@ -6,7 +6,7 @@
"playPrivate": "启动私人服务器",
"launchLocalServer": "启动本地服务器",
- "gameFolderSet": "选择 \"Genshin Impact Game\" 文件夹",
+ "gameExeSet": "选择 \"Genshin Impact Game\" 文件夹",
"grasscutterFileSet": "选择 \"Grasscutter\" .jar 文件",
"folderNotSet": "没有选择Genshin Impact Game文件夹或Grasscutter.jar文件",
diff --git a/resources/index.html b/resources/index.html
index 708db52..3b97fb9 100644
--- a/resources/index.html
+++ b/resources/index.html
@@ -128,7 +128,7 @@
-
+
diff --git a/resources/js/helpers.js b/resources/js/helpers.js
index 7d53e14..d4fe160 100644
--- a/resources/js/helpers.js
+++ b/resources/js/helpers.js
@@ -5,7 +5,7 @@
*/
async function getCfg() {
const defaultConf = {
- gamefolder: '',
+ gameexe: '',
serverFolder: '',
lastConnect: '',
enableKillswitch: false,
@@ -57,22 +57,6 @@ async function proxyIsInstalled() {
return false
}
-/**
- * Get the name of the game executable
- *
- * @returns {Promise}
- */
- async function getGameExecName() {
- // Scan game dir
- const config = await getCfg()
- const gameDir = await filesystem.readDirectory(config.gamefolder)
-
- // Find the executable
- const gameExec = gameDir.find(file => file.entry.endsWith('.exe'))
-
- return gameExec.entry
-}
-
/**
* Minimize the window
*/
diff --git a/resources/js/index.js b/resources/js/index.js
index e99068f..8135997 100644
--- a/resources/js/index.js
+++ b/resources/js/index.js
@@ -75,7 +75,7 @@ async function displayGameFolder() {
const elm = document.querySelector('#gamePath')
const config = await getCfg()
- elm.innerHTML = config.gamefolder
+ elm.innerHTML = config.gameexe
}
/**
@@ -129,17 +129,17 @@ async function setBackgroundImage() {
await filesystem.createDirectory(NL_CWD + '/resources/bg/official')
}
- if (config.gamefolder) {
+ if (config.gameexe) {
// See if bg folder exists in parent dir
- const parentDir = await filesystem.readDirectory(config.gamefolder + '/..')
+ const parentDir = await filesystem.readDirectory(config.gameexe + '/..')
if (parentDir.find(dir => dir.entry === 'bg')) {
- const officialImages = (await filesystem.readDirectory(config.gamefolder + '/../bg')).filter(file => file.type === 'FILE')
+ const officialImages = (await filesystem.readDirectory(config.gameexe + '/../bg')).filter(file => file.type === 'FILE')
if (officialImages.length > 0) {
for (const bg of officialImages) {
- const path = config.gamefolder.replace('\\', '/') + '/../bg/' + bg.entry
+ const path = config.gameexe.replace('\\', '/') + '/../bg/' + bg.entry
// See if the file exists already
const currentBgs = (await filesystem.readDirectory(NL_CWD + '/resources/bg/official/')).filter(file => file.type === 'FILE')
@@ -272,7 +272,7 @@ async function closeSettings() {
settings.style.display = 'none'
// In case we installed the proxy server
- if (await proxyIsInstalled() && config.gamefolder) {
+ if (await proxyIsInstalled() && config.gameexe) {
const playPriv = document.querySelector('#playPrivate')
playPriv.classList.remove('disabled')
@@ -335,22 +335,18 @@ async function displayServerLaunchSection() {
/**
* Set the game folder by opening a folder picker
*/
-async function setGameFolder() {
- const folder = await Neutralino.os.showFolderDialog(localeObj.gameFolderDialog)
+async function setGameExe() {
+ const gameExe = await Neutralino.os.showOpenDialog(localeObj.gameFolderDialog, {
+ filters: [
+ { name: 'Executable files', extensions: ['exe'] }
+ ]
+ })
// Set the folder in our configuration
const config = await getCfg()
- // See if the actual game folder is inside this one
- const folderList = await filesystem.readDirectory(folder)
- const gameFolder = folderList.filter(file => file.entry.includes('Genshin Impact Game'))
-
- if (gameFolder.length > 0) {
- config.gamefolder = folder + '\\Genshin Impact Game'
- Neutralino.storage.setData('config', JSON.stringify(config))
- } else {
- config.gamefolder = folder
- }
+ // It's an array of selections, so only get the first one
+ config.gameexe = gameExe[0]
Neutralino.storage.setData('config', JSON.stringify(config))
@@ -383,7 +379,7 @@ async function setGrasscutterFolder() {
async function launchOfficial() {
const config = await getCfg()
- createCmdWindow(config.gamefolder + '/' + await getGameExecName())
+ Neutralino.os.execCommand(`"${config.gameexe}"`)
}
/**
@@ -402,7 +398,7 @@ async function launchPrivate() {
Neutralino.storage.setData('config', JSON.stringify(config))
// Pass IP and game folder to the private server launcher
- createCmdWindow(`${NL_CWD}/scripts/private_server_launch.cmd ${ip} ${port} ${config.useHttps} "${config.gamefolder}/${await getGameExecName()}" "${NL_CWD}" ${config.enableKillswitch} true`).catch(e => console.log(e))
+ createCmdWindow(`${NL_CWD}/scripts/private_server_launch.cmd ${ip} ${port} ${config.useHttps} "${config.gameexe}" "${NL_CWD}" ${config.enableKillswitch} true`).catch(e => console.log(e))
}
async function launchLocalServer() {
diff --git a/resources/js/onLoad.js b/resources/js/onLoad.js
index 48c50b8..88bfb85 100644
--- a/resources/js/onLoad.js
+++ b/resources/js/onLoad.js
@@ -68,7 +68,7 @@
// Ensure we do the translation at the very end, after everything else has loaded
await doTranslation()
- if (!config.gamefolder) {
+ if (!config.gameexe) {
handleGameNotSet()
}
diff --git a/resources/js/translation.js b/resources/js/translation.js
index aa8fbf7..40f058b 100644
--- a/resources/js/translation.js
+++ b/resources/js/translation.js
@@ -34,7 +34,7 @@ async function doTranslation() {
set('serverLaunch', 'launchLocalServer')
// File select buttons
- set('gameFolderSet', 'gameFolderSet')
+ set('gameExeSet', 'gameExeSet')
set('grasscutterFileSet', 'grasscutterFileSet')
// Private options