mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-11-25 17:35:42 +00:00
Set game exe rather than folder
This commit is contained in:
parent
64626230cf
commit
fff00ca815
@ -6,7 +6,7 @@
|
|||||||
"playPrivate": "Play on Grasscutter",
|
"playPrivate": "Play on Grasscutter",
|
||||||
"launchLocalServer": "Launch Local Server",
|
"launchLocalServer": "Launch Local Server",
|
||||||
|
|
||||||
"gameFolderSet": "Set game folder",
|
"gameExeSet": "Set game executable",
|
||||||
"grasscutterFileSet": "Set \"Grasscutter\" .jar file",
|
"grasscutterFileSet": "Set \"Grasscutter\" .jar file",
|
||||||
"folderNotSet": "Not set",
|
"folderNotSet": "Not set",
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"playPrivate": "Jugar en Grasscutter",
|
"playPrivate": "Jugar en Grasscutter",
|
||||||
"launchLocalServer": "Iniciar servidor local",
|
"launchLocalServer": "Iniciar servidor local",
|
||||||
|
|
||||||
"gameFolderSet": "Establece el folder game",
|
"gameExeSet": "Establece el folder game",
|
||||||
"grasscutterFileSet": "Establece el archivo .jar de \"Grasscutter\"",
|
"grasscutterFileSet": "Establece el archivo .jar de \"Grasscutter\"",
|
||||||
"folderNotSet": "No establecido",
|
"folderNotSet": "No establecido",
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"playPrivate": "Jouer sur Grasscutter",
|
"playPrivate": "Jouer sur Grasscutter",
|
||||||
"launchLocalServer": "Lancer le serveur en local",
|
"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\"",
|
"grasscutterFileSet": "Définir le fichier .jar \"Grasscutter\"",
|
||||||
"folderNotSet": "Pas encore défini",
|
"folderNotSet": "Pas encore défini",
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"playPrivate": "Mainkan Grasscutter",
|
"playPrivate": "Mainkan Grasscutter",
|
||||||
"launchLocalServer": "Luncurkan Local Server",
|
"launchLocalServer": "Luncurkan Local Server",
|
||||||
|
|
||||||
"gameFolderSet": "Atur folder game",
|
"gameExeSet": "Atur folder game",
|
||||||
"grasscutterFileSet": "Atur file \"Grasscutter\" .jar",
|
"grasscutterFileSet": "Atur file \"Grasscutter\" .jar",
|
||||||
"folderNotSet": "Belum diatur",
|
"folderNotSet": "Belum diatur",
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"playPrivate": "Op Grasscutter spelen",
|
"playPrivate": "Op Grasscutter spelen",
|
||||||
"launchLocalServer": "Lokale server starten",
|
"launchLocalServer": "Lokale server starten",
|
||||||
|
|
||||||
"gameFolderSet": "Selecteer de game folder",
|
"gameExeSet": "Selecteer de game folder",
|
||||||
"grasscutterFileSet": "Selecteer het \"Grasscutter\" .jar bestand",
|
"grasscutterFileSet": "Selecteer het \"Grasscutter\" .jar bestand",
|
||||||
"folderNotSet": "Niet geselecteerd",
|
"folderNotSet": "Niet geselecteerd",
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"playPrivate": "Jogar (Grasscutter)",
|
"playPrivate": "Jogar (Grasscutter)",
|
||||||
"launchLocalServer": "Abrir Servidor Local",
|
"launchLocalServer": "Abrir Servidor Local",
|
||||||
|
|
||||||
"gameFolderSet": "Definir a game pasta ",
|
"gameExeSet": "Definir a game pasta ",
|
||||||
"grasscutterFileSet": "Definir o arquivo .jar de \"Grasscutter\" ",
|
"grasscutterFileSet": "Definir o arquivo .jar de \"Grasscutter\" ",
|
||||||
"folderNotSet": "Não Definida",
|
"folderNotSet": "Não Definida",
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"playPrivate": "Grasscutter",
|
"playPrivate": "Grasscutter",
|
||||||
"launchLocalServer": "Локальный сервер",
|
"launchLocalServer": "Локальный сервер",
|
||||||
|
|
||||||
"gameFolderSet": "Папка с игрой",
|
"gameExeSet": "Папка с игрой",
|
||||||
"grasscutterFileSet": "Путь до файла \"Grasscutter\" (.jar)",
|
"grasscutterFileSet": "Путь до файла \"Grasscutter\" (.jar)",
|
||||||
"folderNotSet": "Папка не выбрана",
|
"folderNotSet": "Папка не выбрана",
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"playPrivate": "Grasscutter",
|
"playPrivate": "Grasscutter",
|
||||||
"launchLocalServer": "Khởi động 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\"",
|
"grasscutterFileSet": "Chỉnh địa điểm file \"Grasscutter\"",
|
||||||
"folderNotSet": "Chưa chỉnh file",
|
"folderNotSet": "Chưa chỉnh file",
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"playPrivate": "啟動私人伺服器",
|
"playPrivate": "啟動私人伺服器",
|
||||||
"launchLocalServer": "啟動本地伺服器",
|
"launchLocalServer": "啟動本地伺服器",
|
||||||
|
|
||||||
"gameFolderSet": "設定 \"Genshin Impact game\" 資料夾",
|
"gameExeSet": "設定 \"Genshin Impact game\" 資料夾",
|
||||||
"grasscutterFileSet": "設定 \"Grasscutter\" .jar 檔案",
|
"grasscutterFileSet": "設定 \"Grasscutter\" .jar 檔案",
|
||||||
"folderNotSet": "尚未設定Genshin Impact game資料夾",
|
"folderNotSet": "尚未設定Genshin Impact game資料夾",
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"playPrivate": "启动私人服务器",
|
"playPrivate": "启动私人服务器",
|
||||||
"launchLocalServer": "启动本地服务器",
|
"launchLocalServer": "启动本地服务器",
|
||||||
|
|
||||||
"gameFolderSet": "选择 \"Genshin Impact Game\" 文件夹",
|
"gameExeSet": "选择 \"Genshin Impact Game\" 文件夹",
|
||||||
"grasscutterFileSet": "选择 \"Grasscutter\" .jar 文件",
|
"grasscutterFileSet": "选择 \"Grasscutter\" .jar 文件",
|
||||||
"folderNotSet": "没有选择Genshin Impact Game文件夹或Grasscutter.jar文件",
|
"folderNotSet": "没有选择Genshin Impact Game文件夹或Grasscutter.jar文件",
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@
|
|||||||
<div id="bottomBar">
|
<div id="bottomBar">
|
||||||
<div class="bottomSection">
|
<div class="bottomSection">
|
||||||
<div>
|
<div>
|
||||||
<button class="smolBtn" onclick="setGameFolder()" id="gameFolderSet">Set game folder</button>
|
<button class="smolBtn" onclick="setGameExe()" id="gameExeSet">Set game folder</button>
|
||||||
<span id="gamePath" style="margin-top: 4px;"></span>
|
<span id="gamePath" style="margin-top: 4px;"></span>
|
||||||
</div>
|
</div>
|
||||||
<div style="display: none;">
|
<div style="display: none;">
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
async function getCfg() {
|
async function getCfg() {
|
||||||
const defaultConf = {
|
const defaultConf = {
|
||||||
gamefolder: '',
|
gameexe: '',
|
||||||
serverFolder: '',
|
serverFolder: '',
|
||||||
lastConnect: '',
|
lastConnect: '',
|
||||||
enableKillswitch: false,
|
enableKillswitch: false,
|
||||||
@ -57,22 +57,6 @@ async function proxyIsInstalled() {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name of the game executable
|
|
||||||
*
|
|
||||||
* @returns {Promise<String>}
|
|
||||||
*/
|
|
||||||
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
|
* Minimize the window
|
||||||
*/
|
*/
|
||||||
|
@ -75,7 +75,7 @@ async function displayGameFolder() {
|
|||||||
const elm = document.querySelector('#gamePath')
|
const elm = document.querySelector('#gamePath')
|
||||||
const config = await getCfg()
|
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')
|
await filesystem.createDirectory(NL_CWD + '/resources/bg/official')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.gamefolder) {
|
if (config.gameexe) {
|
||||||
// See if bg folder exists in parent dir
|
// 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')) {
|
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) {
|
if (officialImages.length > 0) {
|
||||||
for (const bg of officialImages) {
|
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
|
// See if the file exists already
|
||||||
const currentBgs = (await filesystem.readDirectory(NL_CWD + '/resources/bg/official/')).filter(file => file.type === 'FILE')
|
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'
|
settings.style.display = 'none'
|
||||||
|
|
||||||
// In case we installed the proxy server
|
// In case we installed the proxy server
|
||||||
if (await proxyIsInstalled() && config.gamefolder) {
|
if (await proxyIsInstalled() && config.gameexe) {
|
||||||
const playPriv = document.querySelector('#playPrivate')
|
const playPriv = document.querySelector('#playPrivate')
|
||||||
|
|
||||||
playPriv.classList.remove('disabled')
|
playPriv.classList.remove('disabled')
|
||||||
@ -335,22 +335,18 @@ async function displayServerLaunchSection() {
|
|||||||
/**
|
/**
|
||||||
* Set the game folder by opening a folder picker
|
* Set the game folder by opening a folder picker
|
||||||
*/
|
*/
|
||||||
async function setGameFolder() {
|
async function setGameExe() {
|
||||||
const folder = await Neutralino.os.showFolderDialog(localeObj.gameFolderDialog)
|
const gameExe = await Neutralino.os.showOpenDialog(localeObj.gameFolderDialog, {
|
||||||
|
filters: [
|
||||||
|
{ name: 'Executable files', extensions: ['exe'] }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
// Set the folder in our configuration
|
// Set the folder in our configuration
|
||||||
const config = await getCfg()
|
const config = await getCfg()
|
||||||
|
|
||||||
// See if the actual game folder is inside this one
|
// It's an array of selections, so only get the first one
|
||||||
const folderList = await filesystem.readDirectory(folder)
|
config.gameexe = gameExe[0]
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
Neutralino.storage.setData('config', JSON.stringify(config))
|
Neutralino.storage.setData('config', JSON.stringify(config))
|
||||||
|
|
||||||
@ -383,7 +379,7 @@ async function setGrasscutterFolder() {
|
|||||||
async function launchOfficial() {
|
async function launchOfficial() {
|
||||||
const config = await getCfg()
|
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))
|
Neutralino.storage.setData('config', JSON.stringify(config))
|
||||||
|
|
||||||
// Pass IP and game folder to the private server launcher
|
// 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() {
|
async function launchLocalServer() {
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
// Ensure we do the translation at the very end, after everything else has loaded
|
// Ensure we do the translation at the very end, after everything else has loaded
|
||||||
await doTranslation()
|
await doTranslation()
|
||||||
|
|
||||||
if (!config.gamefolder) {
|
if (!config.gameexe) {
|
||||||
handleGameNotSet()
|
handleGameNotSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ async function doTranslation() {
|
|||||||
set('serverLaunch', 'launchLocalServer')
|
set('serverLaunch', 'launchLocalServer')
|
||||||
|
|
||||||
// File select buttons
|
// File select buttons
|
||||||
set('gameFolderSet', 'gameFolderSet')
|
set('gameExeSet', 'gameExeSet')
|
||||||
set('grasscutterFileSet', 'grasscutterFileSet')
|
set('grasscutterFileSet', 'grasscutterFileSet')
|
||||||
|
|
||||||
// Private options
|
// Private options
|
||||||
|
Loading…
Reference in New Issue
Block a user