mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-13 03:02:22 +01:00
10.0.3
This commit is contained in:
@@ -236,7 +236,7 @@
|
||||
"startGame": "Start fortnite",
|
||||
"stopGame": "Close fortnite",
|
||||
"waitingForGameServer": "Waiting for the game server to boot up...",
|
||||
"gameServerStartWarning": "The game server was started successfully, but Reboot didn't load",
|
||||
"gameServerStartWarning": "Unsupported version: the game server crashed while setting up the server",
|
||||
"gameServerStartLocalWarning": "The game server was started successfully, but other players can't join",
|
||||
"gameServerStarted": "The game server was started successfully",
|
||||
"gameClientStarted": "The game client was started successfully",
|
||||
|
||||
@@ -172,7 +172,7 @@ Future<void> _initWindow() async {
|
||||
await windowManager.setAlignment(Alignment.center);
|
||||
}
|
||||
await windowManager.setPreventClose(true);
|
||||
|
||||
await windowManager.setResizable(true);
|
||||
if(isWin11) {
|
||||
await Window.setEffect(
|
||||
effect: WindowEffect.acrylic,
|
||||
|
||||
@@ -8,10 +8,10 @@ import 'package:get/get.dart';
|
||||
import 'package:reboot_common/common.dart';
|
||||
import 'package:reboot_launcher/src/controller/game_controller.dart';
|
||||
import 'package:reboot_launcher/src/messenger/abstract/dialog.dart';
|
||||
import 'package:reboot_launcher/src/util/os.dart';
|
||||
import 'package:reboot_launcher/src/util/translations.dart';
|
||||
import 'package:reboot_launcher/src/util/types.dart';
|
||||
import 'package:reboot_launcher/src/widget/file_selector.dart';
|
||||
import 'package:universal_disk_space/universal_disk_space.dart';
|
||||
import 'package:windows_taskbar/windows_taskbar.dart';
|
||||
|
||||
class AddVersionDialog extends StatefulWidget {
|
||||
@@ -35,9 +35,7 @@ class _AddVersionDialogState extends State<AddVersionDialog> {
|
||||
final Rxn<double> _progress = Rxn();
|
||||
final RxInt _speed = RxInt(0);
|
||||
|
||||
late DiskSpace _diskSpace;
|
||||
late Future<List<FortniteBuild>> _fetchFuture;
|
||||
late Future _diskFuture;
|
||||
|
||||
SendPort? _downloadPort;
|
||||
Object? _error;
|
||||
@@ -45,10 +43,10 @@ class _AddVersionDialogState extends State<AddVersionDialog> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_fetchFuture = compute(fetchBuilds, null);
|
||||
_diskSpace = DiskSpace();
|
||||
_diskFuture = _diskSpace.scan()
|
||||
.then((_) => _updateFormDefaults());
|
||||
_fetchFuture = compute(fetchBuilds, null).then((value) {
|
||||
_updateFormDefaults();
|
||||
return value;
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@@ -71,7 +69,7 @@ class _AddVersionDialogState extends State<AddVersionDialog> {
|
||||
switch(_status.value){
|
||||
case _DownloadStatus.form:
|
||||
return FutureBuilder(
|
||||
future: Future.wait([_fetchFuture, _diskFuture]).then((_) async => await _fetchFuture),
|
||||
future: _fetchFuture,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasError) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => _onDownloadError(snapshot.error, snapshot.stackTrace));
|
||||
@@ -444,16 +442,16 @@ class _AddVersionDialogState extends State<AddVersionDialog> {
|
||||
_build.value = null;
|
||||
}
|
||||
|
||||
if(_source.value != _BuildSource.local && _diskSpace.disks.isNotEmpty) {
|
||||
await _fetchFuture;
|
||||
final bestDisk = _diskSpace.disks
|
||||
.reduce((first, second) => first.availableSpace > second.availableSpace ? first : second);
|
||||
final disks = WindowsDisk.available();
|
||||
if(_source.value != _BuildSource.local && disks.isNotEmpty) {
|
||||
final bestDisk = disks.reduce((first, second) => first.freeBytesAvailable > second.freeBytesAvailable ? first : second);
|
||||
final build = _build.value;
|
||||
if(build == null){
|
||||
return;
|
||||
}
|
||||
|
||||
final pathText = "${bestDisk.devicePath}\\FortniteBuilds\\${build.version}";
|
||||
print("${bestDisk.path}\\FortniteBuilds\\${build.version}");
|
||||
final pathText = "${bestDisk.path}FortniteBuilds\\${build.version}";
|
||||
_pathController.text = pathText;
|
||||
_pathController.selection = TextSelection.collapsed(offset: pathText.length);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:reboot_common/common.dart';
|
||||
|
||||
@@ -9,22 +10,24 @@ const Duration _timeout = Duration(seconds: 5);
|
||||
Completer<bool> pingGameServerOrTimeout(String address, Duration timeout) {
|
||||
final completer = Completer<bool>();
|
||||
final start = DateTime.now();
|
||||
(() async {
|
||||
while (!completer.isCompleted && DateTime.now().millisecondsSinceEpoch - start.millisecondsSinceEpoch < timeout.inMilliseconds) {
|
||||
final result = await pingGameServer(address);
|
||||
if(result) {
|
||||
completer.complete(true);
|
||||
}else {
|
||||
await Future.delayed(_timeout);
|
||||
}
|
||||
}
|
||||
if(!completer.isCompleted) {
|
||||
completer.complete(false);
|
||||
}
|
||||
})();
|
||||
_pingGameServerOrTimeout(completer, start, timeout, address);
|
||||
return completer;
|
||||
}
|
||||
|
||||
Future<void> _pingGameServerOrTimeout(Completer<bool> completer, DateTime start, Duration timeout, String address) async {
|
||||
while (!completer.isCompleted && max(DateTime.now().millisecondsSinceEpoch - start.millisecondsSinceEpoch, 0) < timeout.inMilliseconds) {
|
||||
final result = await pingGameServer(address);
|
||||
if(result) {
|
||||
completer.complete(true);
|
||||
}else {
|
||||
await Future.delayed(_timeout);
|
||||
}
|
||||
}
|
||||
if(!completer.isCompleted) {
|
||||
completer.complete(false);
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> pingGameServer(String address) async {
|
||||
final split = address.split(":");
|
||||
var hostname = split[0];
|
||||
|
||||
@@ -492,3 +492,57 @@ int _convertToHString(String string) {
|
||||
extension WindowManagerExtension on WindowManager {
|
||||
Future<void> maximizeOrRestore() async => await windowManager.isMaximized() ? windowManager.restore() : windowManager.maximize();
|
||||
}
|
||||
|
||||
class WindowsDisk {
|
||||
static final String _nullTerminator = String.fromCharCode(0);
|
||||
|
||||
final String path;
|
||||
final int freeBytesAvailable;
|
||||
final int totalNumberOfBytes;
|
||||
|
||||
const WindowsDisk._internal(this.path, this.freeBytesAvailable, this.totalNumberOfBytes);
|
||||
|
||||
static List<WindowsDisk> available() {
|
||||
final buffer = malloc.allocate<Utf16>(MAX_PATH);
|
||||
try {
|
||||
final length = GetLogicalDriveStrings(MAX_PATH, buffer);
|
||||
if (length == 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return buffer.toDartString(length: length)
|
||||
.split(_nullTerminator)
|
||||
.where((drive) => drive.length > 1)
|
||||
.map((driveName) {
|
||||
final freeBytesAvailable = calloc<Uint64>();
|
||||
final totalNumberOfBytes = calloc<Uint64>();
|
||||
final totalNumberOfFreeBytes = calloc<Uint64>();
|
||||
try {
|
||||
GetDiskFreeSpaceEx(
|
||||
driveName.toNativeUtf16(),
|
||||
freeBytesAvailable,
|
||||
totalNumberOfBytes,
|
||||
totalNumberOfFreeBytes
|
||||
);
|
||||
return WindowsDisk._internal(
|
||||
driveName,
|
||||
freeBytesAvailable.value,
|
||||
totalNumberOfBytes.value
|
||||
);
|
||||
} finally {
|
||||
calloc.free(freeBytesAvailable);
|
||||
calloc.free(totalNumberOfBytes);
|
||||
calloc.free(totalNumberOfFreeBytes);
|
||||
}
|
||||
})
|
||||
.toList(growable: false);
|
||||
} finally {
|
||||
calloc.free(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'WindowsDisk{path: $path, freeBytesAvailable: $freeBytesAvailable, totalNumberOfBytes: $totalNumberOfBytes}';
|
||||
}
|
||||
}
|
||||
@@ -492,7 +492,7 @@ class _LaunchButtonState extends State<LaunchButton> {
|
||||
|
||||
final pingOperation = pingGameServerOrTimeout(
|
||||
"$publicIp:$gameServerPort",
|
||||
const Duration(days: 365)
|
||||
const Duration(days: 1)
|
||||
);
|
||||
this._pingOperation = pingOperation;
|
||||
_gameServerInfoBar = showRebootInfoBar(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: reboot_launcher
|
||||
description: Graphical User Interface for Project Reboot
|
||||
version: "10.0.2"
|
||||
version: "10.0.3"
|
||||
|
||||
publish_to: 'none'
|
||||
|
||||
@@ -58,7 +58,6 @@ dependencies:
|
||||
|
||||
# Storage
|
||||
get_storage: ^2.1.1
|
||||
universal_disk_space: ^0.2.3
|
||||
path: ^1.9.0
|
||||
|
||||
# Translations
|
||||
|
||||
Reference in New Issue
Block a user