Files
Reboot-Launcher/common/lib/src/model/game_instance.dart
Alessandro Autiero e24f4e97b3 9.1.4
2024-06-15 17:57:17 +02:00

55 lines
1.1 KiB
Dart

import 'dart:io';
import 'package:reboot_common/common.dart';
class GameInstance {
final String versionName;
final int gamePid;
final int? launcherPid;
final int? eacPid;
final List<InjectableDll> injectedDlls;
final GameServerType? serverType;
bool launched;
bool movedToVirtualDesktop;
bool tokenError;
GameInstance? child;
GameInstance({
required this.versionName,
required this.gamePid,
required this.launcherPid,
required this.eacPid,
required this.serverType,
required this.child
}): tokenError = false, launched = false, movedToVirtualDesktop = false, injectedDlls = [];
void kill() {
Process.killPid(gamePid, ProcessSignal.sigabrt);
if(launcherPid != null) {
Process.killPid(launcherPid!, ProcessSignal.sigabrt);
}
if(eacPid != null) {
Process.killPid(eacPid!, ProcessSignal.sigabrt);
}
}
bool get nestedHosting {
GameInstance? child = this;
while(child != null) {
if(child.serverType != null) {
return true;
}
child = child.child;
}
return false;
}
}
enum GameServerType {
headless,
virtualWindow,
window
}