Add simple launcher
This commit is contained in:
parent
4e8b92fc52
commit
c91a3578c3
11
src/launcher/Haru.Eft.Models.ts
Normal file
11
src/launcher/Haru.Eft.Models.ts
Normal file
@ -0,0 +1,11 @@
|
||||
export class ServerConfig
|
||||
{
|
||||
public backendUrl: string;
|
||||
public version: string;
|
||||
|
||||
constructor(backendUrl: string = "http://localhost:8000", version: string = "live")
|
||||
{
|
||||
this.backendUrl = backendUrl;
|
||||
this.version = version;
|
||||
}
|
||||
}
|
29
src/launcher/Haru.Launcher.ts
Normal file
29
src/launcher/Haru.Launcher.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { exec, ExecException } from "child_process";
|
||||
import { Json, Log } from "../common/Haru.Utils";
|
||||
import { ServerConfig } from "./Haru.Eft.Models";
|
||||
|
||||
export class GameStarter
|
||||
{
|
||||
public static run(): void
|
||||
{
|
||||
const sessionId = "haru-singleplayer"
|
||||
const serverConfig = Json.serialize(new ServerConfig());
|
||||
exec(`EscapeFromTarkov.exe -force-gfx-jobs native -token=${sessionId} -config=${serverConfig}`, GameStarter.onLaunch);
|
||||
}
|
||||
|
||||
private static onLaunch(error: ExecException | null, stdout: string, stderr: string): void
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
throw error;
|
||||
}
|
||||
|
||||
Log.write(stdout);
|
||||
GameStarter.exitSuccess();
|
||||
}
|
||||
|
||||
private static exitSuccess(): void
|
||||
{
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
@ -1,14 +1,11 @@
|
||||
import { Log } from "../common/Haru.Utils";
|
||||
import { GameStarter } from "./Haru.Launcher";
|
||||
|
||||
export class Program
|
||||
{
|
||||
public static main(args: string[])
|
||||
{
|
||||
Log.init("./Logs/Haru.log");
|
||||
|
||||
for (const command of args)
|
||||
{
|
||||
Log.info(command);
|
||||
}
|
||||
GameStarter.run();
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
import { PingNotification } from "./Haru.Eft.Models";
|
||||
import { CachedResponseService, CachedResponseHelper, FileResponseHelper, FileService } from "./Haru.Eft.Services";
|
||||
import { HttpServer, WsServer, IServer } from "../common/Haru.Http";
|
||||
import { Json } from "../common/Haru.Utils";
|
||||
import { PingNotification } from "./Haru.Eft.Models";
|
||||
import { CachedResponseService, CachedResponseHelper, FileResponseHelper, FileService } from "./Haru.Eft.Services";
|
||||
|
||||
export class ServerCluster
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { IncomingMessage, ServerResponse } from "http";
|
||||
import { CheckVersionResponse, FriendList, KeepAliveResponse, LogoutResponse, ResponseBody, ServerInfo } from "./Haru.Eft.Models";
|
||||
import { Json } from "../common/Haru.Utils";
|
||||
import { Service } from "../common/Haru.Http";
|
||||
import { Json } from "../common/Haru.Utils";
|
||||
import { CheckVersionResponse, FriendList, KeepAliveResponse, LogoutResponse, ResponseBody, ServerInfo } from "./Haru.Eft.Models";
|
||||
|
||||
export class FileResponseHelper
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user