diff --git a/src/ts/core/Domain.ts b/src/ts/core/Domain.ts index be04fc3..c706198 100644 --- a/src/ts/core/Domain.ts +++ b/src/ts/core/Domain.ts @@ -26,6 +26,8 @@ export default class Domain process.outputInterval = null; process.runningInterval = null; + process.kill(); + debugThread.log({ message: info }); resolve(info); diff --git a/src/ts/launcher/states/Launch.ts b/src/ts/launcher/states/Launch.ts index dbf0a15..add08d5 100644 --- a/src/ts/launcher/states/Launch.ts +++ b/src/ts/launcher/states/Launch.ts @@ -126,17 +126,33 @@ export default (launcher: Launcher): Promise => { cwd: await constants.paths.gameDir }); - // Game closed event + // Game was started by the launcher.bat file + // so we just need to wait until GenshinImpact process + // will be closed process.finish(() => { - const stopTime = Date.now(); + const waiter = async () => { + const processes: string = (await Neutralino.os.execCommand('ps -A')).stdOut; - Window.current.show(); + // Game is still running + if (processes.includes('GenshinImpact')) + setTimeout(waiter, 3000); - launcher.updateDiscordRPC('in-launcher'); + // Game was closed + else + { + const stopTime = Date.now(); - // TODO + Window.current.show(); - resolve(); + launcher.updateDiscordRPC('in-launcher'); + + // TODO + + resolve(); + } + }; + + setTimeout(waiter, 5000); }); } }); diff --git a/src/ts/neutralino/Process.ts b/src/ts/neutralino/Process.ts index ec8171c..92d2687 100644 --- a/src/ts/neutralino/Process.ts +++ b/src/ts/neutralino/Process.ts @@ -170,6 +170,8 @@ class Process */ public kill(forced: boolean = false): Promise { + Neutralino.filesystem.removeFile(this.outputFile); + return Process.kill(this.id, forced); }