get genshin exe regardless of name

This commit is contained in:
SpikeHD 2022-04-19 21:55:25 -07:00
parent 4cf3575374
commit 803feb116e
3 changed files with 15 additions and 5 deletions

View File

@ -1 +0,0 @@
{"accessToken":"5MwsrKLchb8OnvKTd7b00-wJDz6E-6MQbmre-TC7jiEs6mJs","port":57800}

View File

@ -18,10 +18,10 @@ reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v Pr
:: Start proxy server
start "Proxy Server" ./ext/mitmdump.exe -s "./proxy/proxy.py" --ssl-insecure --set ip=%ip%
echo Opening %gamePath%/Genshin Impact Game/GenshinImpact.exe
echo Opening %gamePath%
:: Launch game
"%gamePath%/Genshin Impact Game/GenshinImpact.exe"
"%gamePath%"
:: On exit clean proxy stuff
:EXIT

View File

@ -75,10 +75,21 @@ async function setGenshinImpactFolder() {
setBackgroundImage()
}
async function getGenshinExecName() {
// Scan genshin dir
const config = await getCfg()
const genshinDir = await Neutralino.filesystem.readDirectory(config.genshinImpactFolder + '/Genshin Impact Game')
// Find the executable
const genshinExec = genshinDir.find(file => file.entry.endsWith('.exe'))
return genshinExec.entry
}
async function launchOfficial() {
const config = await getCfg()
Neutralino.os.execCommand(config.genshinImpactFolder + '/Genshin Impact Game/GenshinImpact.exe')
Neutralino.os.execCommand(config.genshinImpactFolder + '/Genshin Impact Game/' + await getGenshinExecName())
}
async function launchPrivate() {
@ -89,5 +100,5 @@ async function launchPrivate() {
console.log('connecting to ' + ip)
// Pass IP and game folder to the private server launcher
Neutralino.os.execCommand(`${NL_CWD}/private_server_launch.cmd ${ip} "${config.genshinImpactFolder}"`).catch(e => console.log(e))
Neutralino.os.execCommand(`${NL_CWD}/private_server_launch.cmd ${ip} "${config.genshinImpactFolder}/Genshin Impact Game/${await getGenshinExecName()}"`).catch(e => console.log(e))
}