<feat: New release>

This commit is contained in:
Alessandro Autiero
2023-09-09 12:46:16 +02:00
parent badf41b044
commit 485e757e83
424 changed files with 37224 additions and 818815 deletions

View File

@@ -0,0 +1,34 @@
import 'dart:io';
import 'package:reboot_common/common.dart';
final File _script = File("${assetsDirectory.path}\\misc\\udp.ps1");
Future<bool> pingGameServer(String address, {Duration? timeout}) async {
var start = DateTime.now();
var firstTime = true;
while (firstTime || (timeout != null && DateTime.now().millisecondsSinceEpoch - start.millisecondsSinceEpoch < timeout.inMilliseconds)) {
var split = address.split(":");
var hostname = split[0];
var port = split.length > 1 ? split[1] : kDefaultGameServerPort;
var result = await Process.run(
"powershell",
[
_script.path,
hostname,
port
]
);
if (result.exitCode == 0) {
return true;
}
if(firstTime) {
firstTime = false;
}else {
await Future.delayed(const Duration(seconds: 2));
}
}
return false;
}

View File

@@ -9,11 +9,12 @@ import 'package:supabase_flutter/supabase_flutter.dart';
final SupabaseClient _supabase = Supabase.instance.client;
final GameController _gameController = Get.find<GameController>();
final HostingController _hostingController = Get.find<HostingController>();
final File _executable = File("${assetsDirectory.path}\\misc\\watch.exe");
extension GameInstanceWatcher on GameInstance {
Future<void> startObserver() async {
if(watchPid != null) {
Process.killPid(watchPid!, ProcessSignal.sigabrt);
if(observerPid != null) {
Process.killPid(observerPid!, ProcessSignal.sigabrt);
}
watchProcess(gamePid).then((value) async {
@@ -24,9 +25,15 @@ extension GameInstanceWatcher on GameInstance {
_onGameStopped();
});
watchPid = startBackgroundProcess(
'${assetsDirectory.path}\\misc\\watch.exe',
[_gameController.uuid, gamePid.toString(), launcherPid?.toString() ?? "-1", eacPid?.toString() ?? "-1", hosting.toString()]
observerPid = await startBackgroundProcess(
executable: _executable,
args: [
_gameController.uuid,
gamePid.toString(),
launcherPid?.toString() ?? "-1",
eacPid?.toString() ?? "-1",
hosting.toString()
]
);
}