mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-11-21 22:58:24 +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",
|
||||
"launchLocalServer": "Launch Local Server",
|
||||
|
||||
"gameFolderSet": "Set game folder",
|
||||
"gameExeSet": "Set game executable",
|
||||
"grasscutterFileSet": "Set \"Grasscutter\" .jar file",
|
||||
"folderNotSet": "Not set",
|
||||
|
||||
|
@ -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",
|
||||
|
||||
|
@ -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",
|
||||
|
||||
|
@ -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",
|
||||
|
||||
|
@ -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",
|
||||
|
||||
|
@ -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",
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
"playPrivate": "Grasscutter",
|
||||
"launchLocalServer": "Локальный сервер",
|
||||
|
||||
"gameFolderSet": "Папка с игрой",
|
||||
"gameExeSet": "Папка с игрой",
|
||||
"grasscutterFileSet": "Путь до файла \"Grasscutter\" (.jar)",
|
||||
"folderNotSet": "Папка не выбрана",
|
||||
|
||||
|
@ -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",
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
"playPrivate": "啟動私人伺服器",
|
||||
"launchLocalServer": "啟動本地伺服器",
|
||||
|
||||
"gameFolderSet": "設定 \"Genshin Impact game\" 資料夾",
|
||||
"gameExeSet": "設定 \"Genshin Impact game\" 資料夾",
|
||||
"grasscutterFileSet": "設定 \"Grasscutter\" .jar 檔案",
|
||||
"folderNotSet": "尚未設定Genshin Impact game資料夾",
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
"playPrivate": "启动私人服务器",
|
||||
"launchLocalServer": "启动本地服务器",
|
||||
|
||||
"gameFolderSet": "选择 \"Genshin Impact Game\" 文件夹",
|
||||
"gameExeSet": "选择 \"Genshin Impact Game\" 文件夹",
|
||||
"grasscutterFileSet": "选择 \"Grasscutter\" .jar 文件",
|
||||
"folderNotSet": "没有选择Genshin Impact Game文件夹或Grasscutter.jar文件",
|
||||
|
||||
|
@ -128,7 +128,7 @@
|
||||
<div id="bottomBar">
|
||||
<div class="bottomSection">
|
||||
<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>
|
||||
</div>
|
||||
<div style="display: none;">
|
||||
|
@ -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<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
|
||||
*/
|
||||
|
@ -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() {
|
||||
|
@ -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()
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ async function doTranslation() {
|
||||
set('serverLaunch', 'launchLocalServer')
|
||||
|
||||
// File select buttons
|
||||
set('gameFolderSet', 'gameFolderSet')
|
||||
set('gameExeSet', 'gameExeSet')
|
||||
set('grasscutterFileSet', 'grasscutterFileSet')
|
||||
|
||||
// Private options
|
||||
|
Loading…
Reference in New Issue
Block a user