mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-13 19:22:22 +01:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2046cb14f6 | ||
|
|
e3f7a1d2cc | ||
|
|
cd6752ed3f | ||
|
|
e1df46efd9 | ||
|
|
dccd05e57f | ||
|
|
eb7745cc4d | ||
|
|
7d5e17642a | ||
|
|
6f91ad0404 | ||
|
|
0c38528e77 | ||
|
|
dfebe74518 | ||
|
|
bfe15e43d9 |
8
archive/README.md
Normal file
8
archive/README.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Builds Archive
|
||||||
|
|
||||||
|
Builds are stored on a Cloudflare R2 instance at `https://builds.rebootfn.org/versions.json`.
|
||||||
|
If you want to move them to another AWS-compatible object storage, run:
|
||||||
|
```
|
||||||
|
move.ps1
|
||||||
|
```
|
||||||
|
and provide the required parameters.
|
||||||
98
archive/move.ps1
Normal file
98
archive/move.ps1
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
param(
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]$UrlListPath, # Path to a text file with one URL per line
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]$BucketName, # Name of the R2 bucket
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]$AccessKey, # Your R2 access key
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]$SecretKey, # Your R2 secret key
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]$EndPointURL, # Your R2 endpoint URL, e.g. https://<account_id>.r2.cloudflarestorage.com
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$false)]
|
||||||
|
[int]$MaxConcurrentConnections = 16, # Number of concurrent connections for each file download
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$false)]
|
||||||
|
[int]$SplitCount = 16, # Number of segments to split the download into
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$false)]
|
||||||
|
[string]$AwsRegion = "auto" # Region; often "auto" works for R2, but can be set if needed
|
||||||
|
)
|
||||||
|
|
||||||
|
# Set AWS environment variables for this session
|
||||||
|
$Env:AWS_ACCESS_KEY_ID = $AccessKey
|
||||||
|
$Env:AWS_SECRET_ACCESS_KEY = $SecretKey
|
||||||
|
$Env:AWS_REGION = $AwsRegion # If required, or leave as "auto"
|
||||||
|
|
||||||
|
# Read all URLs from file
|
||||||
|
$Urls = Get-Content $UrlListPath | Where-Object { $_ -and $_. Trim() -ne "" }
|
||||||
|
|
||||||
|
# Ensure aria2 is available
|
||||||
|
if (-not (Get-Command aria2c -ErrorAction SilentlyContinue)) {
|
||||||
|
Write-Error "aria2c not found in PATH. Please install aria2."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ensure aws CLI is available
|
||||||
|
if (-not (Get-Command aws -ErrorAction SilentlyContinue)) {
|
||||||
|
Write-Error "aws CLI not found in PATH. Please install AWS CLI."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function Process-Url {
|
||||||
|
param(
|
||||||
|
[string]$Url,
|
||||||
|
[string]$BucketName,
|
||||||
|
[string]$EndPointURL,
|
||||||
|
[int]$MaxConcurrentConnections,
|
||||||
|
[int]$SplitCount
|
||||||
|
)
|
||||||
|
|
||||||
|
# Extract the filename from the URL
|
||||||
|
$FileName = Split-Path -Leaf $Url
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-Host "Downloading: $Url"
|
||||||
|
|
||||||
|
# Use aria2c to download with multiple connections
|
||||||
|
& aria2c `
|
||||||
|
--max-connection-per-server=$MaxConcurrentConnections `
|
||||||
|
--split=$SplitCount `
|
||||||
|
--out=$FileName `
|
||||||
|
--check-certificate=false `
|
||||||
|
--header="Cookie: _c_t_c=1" `
|
||||||
|
$Url
|
||||||
|
|
||||||
|
if (!(Test-Path $FileName)) {
|
||||||
|
Write-Host "Failed to download $Url"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Uploading $FileName to R2 bucket: $BucketName"
|
||||||
|
& aws s3 cp $FileName "s3://$BucketName/$FileName" --endpoint-url $EndPointURL
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Host "Failed to upload $FileName to R2"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Upload successful. Deleting local file: $FileName"
|
||||||
|
Remove-Item $FileName -Force
|
||||||
|
|
||||||
|
Write-Host "Completed processing of $FileName."
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
Write-Host "Error processing $Url"
|
||||||
|
Write-Host $_
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Process each URL sequentially here. If you'd like to run multiple URLs in parallel,
|
||||||
|
# you could replace the foreach loop with a ForEach-Object -Parallel block.
|
||||||
|
foreach ($Url in $Urls) {
|
||||||
|
Process-Url -Url $Url -BucketName $BucketName -EndPointURL $EndPointURL -MaxConcurrentConnections $MaxConcurrentConnections -SplitCount $SplitCount
|
||||||
|
}
|
||||||
85
archive/versions.txt
Normal file
85
archive/versions.txt
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
https://builds.rebootfn.org/1.7.2.zip
|
||||||
|
https://builds.rebootfn.org/1.8.rar
|
||||||
|
https://builds.rebootfn.org/1.8.1.rar
|
||||||
|
https://builds.rebootfn.org/1.8.2.rar
|
||||||
|
https://builds.rebootfn.org/1.9.rar
|
||||||
|
https://builds.rebootfn.org/1.9.1.rar
|
||||||
|
https://builds.rebootfn.org/1.10.rar
|
||||||
|
https://builds.rebootfn.org/1.11.zip
|
||||||
|
https://builds.rebootfn.org/2.1.0.zip
|
||||||
|
https://builds.rebootfn.org/2.2.0.rar
|
||||||
|
https://builds.rebootfn.org/2.3.rar
|
||||||
|
https://builds.rebootfn.org/2.4.0.zip
|
||||||
|
https://builds.rebootfn.org/2.4.2.zip
|
||||||
|
https://builds.rebootfn.org/2.5.0.rar
|
||||||
|
https://builds.rebootfn.org/3.0.zip
|
||||||
|
https://builds.rebootfn.org/3.1.rar
|
||||||
|
https://builds.rebootfn.org/3.1.1.zip
|
||||||
|
https://builds.rebootfn.org/3.2.zip
|
||||||
|
https://builds.rebootfn.org/3.3.rar
|
||||||
|
https://builds.rebootfn.org/3.5.rar
|
||||||
|
https://builds.rebootfn.org/3.6.zip
|
||||||
|
https://builds.rebootfn.org/4.0.zip
|
||||||
|
https://builds.rebootfn.org/4.1.zip
|
||||||
|
https://builds.rebootfn.org/4.2.zip
|
||||||
|
https://builds.rebootfn.org/4.4.rar
|
||||||
|
https://builds.rebootfn.org/4.5.rar
|
||||||
|
https://builds.rebootfn.org/5.00.rar
|
||||||
|
https://builds.rebootfn.org/5.0.1.rar
|
||||||
|
https://builds.rebootfn.org/5.10.rar
|
||||||
|
https://builds.rebootfn.org/5.21.rar
|
||||||
|
https://builds.rebootfn.org/5.30.rar
|
||||||
|
https://builds.rebootfn.org/5.40.rar
|
||||||
|
https://builds.rebootfn.org/6.00.rar
|
||||||
|
https://builds.rebootfn.org/6.01.rar
|
||||||
|
https://builds.rebootfn.org/6.1.1.rar
|
||||||
|
https://builds.rebootfn.org/6.02.rar
|
||||||
|
https://builds.rebootfn.org/6.2.1.rar
|
||||||
|
https://builds.rebootfn.org/6.10.rar
|
||||||
|
https://builds.rebootfn.org/6.10.1.rar
|
||||||
|
https://builds.rebootfn.org/6.10.2.rar
|
||||||
|
https://builds.rebootfn.org/6.21.rar
|
||||||
|
https://builds.rebootfn.org/6.22.rar
|
||||||
|
https://builds.rebootfn.org/6.30.rar
|
||||||
|
https://builds.rebootfn.org/6.31.rar
|
||||||
|
https://builds.rebootfn.org/7.00.rar
|
||||||
|
https://builds.rebootfn.org/7.10.rar
|
||||||
|
https://builds.rebootfn.org/7.20.rar
|
||||||
|
https://builds.rebootfn.org/7.30.zip
|
||||||
|
https://builds.rebootfn.org/7.40.rar
|
||||||
|
https://builds.rebootfn.org/8.00.zip
|
||||||
|
https://builds.rebootfn.org/8.20.rar
|
||||||
|
https://builds.rebootfn.org/8.30.rar
|
||||||
|
https://builds.rebootfn.org/8.40.zip
|
||||||
|
https://builds.rebootfn.org/8.50.zip
|
||||||
|
https://builds.rebootfn.org/8.51.rar
|
||||||
|
https://builds.rebootfn.org/9.00.zip
|
||||||
|
https://builds.rebootfn.org/9.01.zip
|
||||||
|
https://builds.rebootfn.org/9.10.rar
|
||||||
|
https://builds.rebootfn.org/9.21.zip
|
||||||
|
https://builds.rebootfn.org/9.30.zip
|
||||||
|
https://builds.rebootfn.org/9.40.zip
|
||||||
|
https://builds.rebootfn.org/9.41.rar
|
||||||
|
https://builds.rebootfn.org/10.00.zip
|
||||||
|
https://builds.rebootfn.org/10.10.zip
|
||||||
|
https://builds.rebootfn.org/10.20.zip
|
||||||
|
https://builds.rebootfn.org/10.31.zip
|
||||||
|
https://builds.rebootfn.org/10.40.rar
|
||||||
|
https://builds.rebootfn.org/11.00.zip
|
||||||
|
https://builds.rebootfn.org/11.31.rar
|
||||||
|
https://builds.rebootfn.org/12.00.rar
|
||||||
|
https://builds.rebootfn.org/12.21.zip
|
||||||
|
https://builds.rebootfn.org/12.50.zip
|
||||||
|
https://builds.rebootfn.org/12.61.zip
|
||||||
|
https://builds.rebootfn.org/13.00.rar
|
||||||
|
https://builds.rebootfn.org/13.40.zip
|
||||||
|
https://builds.rebootfn.org/14.00.rar
|
||||||
|
https://builds.rebootfn.org/14.40.rar
|
||||||
|
https://builds.rebootfn.org/14.60.rar
|
||||||
|
https://builds.rebootfn.org/15.30.rar
|
||||||
|
https://builds.rebootfn.org/16.40.rar
|
||||||
|
https://builds.rebootfn.org/17.30.zip
|
||||||
|
https://builds.rebootfn.org/17.50.zip
|
||||||
|
https://builds.rebootfn.org/18.40.zip
|
||||||
|
https://builds.rebootfn.org/19.10.rar
|
||||||
|
https://builds.rebootfn.org/20.40.zip"
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
const String kDefaultPlayerName = "Player";
|
const String kDefaultPlayerName = "Player";
|
||||||
|
const String kDefaultHostName = "Host";
|
||||||
const String kDefaultGameServerHost = "127.0.0.1";
|
const String kDefaultGameServerHost = "127.0.0.1";
|
||||||
const String kDefaultGameServerPort = "7777";
|
const String kDefaultGameServerPort = "7777";
|
||||||
const String kInitializedLine = "Game Engine Initialized";
|
const String kInitializedLine = "Game Engine Initialized";
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
enum InjectableDll {
|
enum InjectableDll {
|
||||||
console,
|
console,
|
||||||
cobalt,
|
starfall,
|
||||||
reboot,
|
reboot,
|
||||||
memory
|
}
|
||||||
|
|
||||||
|
extension InjectableDllVersionAware on InjectableDll {
|
||||||
|
bool get isVersionDependent => this == InjectableDll.reboot;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,13 +17,15 @@ class FortniteBuild {
|
|||||||
|
|
||||||
class FortniteBuildDownloadProgress {
|
class FortniteBuildDownloadProgress {
|
||||||
final double progress;
|
final double progress;
|
||||||
final int? minutesLeft;
|
final int? timeLeft;
|
||||||
final bool extracting;
|
final bool extracting;
|
||||||
|
final int speed;
|
||||||
|
|
||||||
FortniteBuildDownloadProgress({
|
FortniteBuildDownloadProgress({
|
||||||
required this.progress,
|
required this.progress,
|
||||||
required this.extracting,
|
required this.extracting,
|
||||||
this.minutesLeft,
|
required this.timeLeft,
|
||||||
|
required this.speed
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:reboot_common/common.dart';
|
import 'package:reboot_common/common.dart';
|
||||||
|
import 'package:version/version.dart';
|
||||||
|
|
||||||
|
|
||||||
class GameInstance {
|
class GameInstance {
|
||||||
final String versionName;
|
final Version version;
|
||||||
final int gamePid;
|
final int gamePid;
|
||||||
final int? launcherPid;
|
final int? launcherPid;
|
||||||
final int? eacPid;
|
final int? eacPid;
|
||||||
@@ -17,7 +18,7 @@ class GameInstance {
|
|||||||
GameInstance? child;
|
GameInstance? child;
|
||||||
|
|
||||||
GameInstance({
|
GameInstance({
|
||||||
required this.versionName,
|
required this.version,
|
||||||
required this.gamePid,
|
required this.gamePid,
|
||||||
required this.launcherPid,
|
required this.launcherPid,
|
||||||
required this.eacPid,
|
required this.eacPid,
|
||||||
|
|||||||
@@ -3,165 +3,243 @@ import 'dart:convert';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:isolate';
|
import 'dart:isolate';
|
||||||
|
|
||||||
import 'package:dio/dio.dart';
|
|
||||||
import 'package:dio/io.dart';
|
|
||||||
import 'package:path/path.dart' as path;
|
import 'package:path/path.dart' as path;
|
||||||
import 'package:reboot_common/common.dart';
|
import 'package:reboot_common/common.dart';
|
||||||
import 'package:reboot_common/src/extension/types.dart';
|
import 'package:reboot_common/src/extension/types.dart';
|
||||||
|
import 'package:uuid/uuid.dart';
|
||||||
import 'package:version/version.dart';
|
import 'package:version/version.dart';
|
||||||
|
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
const String kStopBuildDownloadSignal = "kill";
|
const String kStopBuildDownloadSignal = "kill";
|
||||||
|
|
||||||
final Dio _dio = _buildDioInstance();
|
final Uri _archiveSourceUrl = Uri.parse("https://builds.rebootfn.org/versions.json");
|
||||||
Dio _buildDioInstance() {
|
final int _ariaPort = 6800;
|
||||||
final dio = Dio();
|
final Uri _ariaEndpoint = Uri.parse('http://localhost:$_ariaPort/jsonrpc');
|
||||||
final httpClientAdapter = dio.httpClientAdapter as IOHttpClientAdapter;
|
final Duration _ariaMaxSpawnTime = const Duration(seconds: 10);
|
||||||
httpClientAdapter.createHttpClient = () {
|
final String _ariaSecret = "RebootLauncher";
|
||||||
final client = HttpClient();
|
|
||||||
client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;
|
|
||||||
return client;
|
|
||||||
};
|
|
||||||
return dio;
|
|
||||||
}
|
|
||||||
|
|
||||||
final String _archiveSourceUrl = "https://raw.githubusercontent.com/simplyblk/Fortnitebuilds/main/README.md";
|
|
||||||
final RegExp _rarProgressRegex = RegExp("^((100)|(\\d{1,2}(.\\d*)?))%\$");
|
final RegExp _rarProgressRegex = RegExp("^((100)|(\\d{1,2}(.\\d*)?))%\$");
|
||||||
const String _deniedConnectionError = "The connection was denied: your firewall might be blocking the download";
|
|
||||||
const String _unavailableError = "The build downloader is not available right now";
|
|
||||||
const String _genericError = "The build downloader is not working correctly";
|
|
||||||
const int _maxErrors = 100;
|
|
||||||
|
|
||||||
Future<List<FortniteBuild>> fetchBuilds(ignored) async {
|
Future<List<FortniteBuild>> fetchBuilds(ignored) async {
|
||||||
final response = await _dio.get<String>(
|
final response = await http.get(_archiveSourceUrl);
|
||||||
_archiveSourceUrl,
|
|
||||||
options: Options(
|
|
||||||
responseType: ResponseType.plain
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if (response.statusCode != 200) {
|
if (response.statusCode != 200) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
var results = <FortniteBuild>[];
|
return jsonDecode(response.body)
|
||||||
for (final line in response.data?.split("\n") ?? []) {
|
.map((entry) {
|
||||||
if (!line.startsWith("|")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var parts = line.substring(1, line.length - 1).split("|");
|
|
||||||
if (parts.isEmpty) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var versionName = parts.first.trim();
|
|
||||||
final separator = versionName.indexOf("-");
|
|
||||||
if(separator != -1) {
|
|
||||||
versionName = versionName.substring(0, separator);
|
|
||||||
}
|
|
||||||
|
|
||||||
final link = parts.last.trim();
|
|
||||||
try {
|
try {
|
||||||
results.add(FortniteBuild(
|
final fileUrl = entry as String;
|
||||||
version: Version.parse(versionName),
|
final fileName = Uri.parse(fileUrl).pathSegments.last;
|
||||||
link: link,
|
final fileNameWithoutExtension = path.basenameWithoutExtension(fileName);
|
||||||
available: link.endsWith(".zip") || link.endsWith(".rar")
|
return FortniteBuild(
|
||||||
));
|
version: Version.parse(fileNameWithoutExtension),
|
||||||
} on FormatException {
|
link: entry,
|
||||||
// Ignore
|
available: true
|
||||||
|
);
|
||||||
|
}catch(_) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.whereType<FortniteBuild>()
|
||||||
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Future<void> downloadArchiveBuild(FortniteBuildDownloadOptions options) async {
|
Future<void> downloadArchiveBuild(FortniteBuildDownloadOptions options) async {
|
||||||
|
final fileName = options.build.link.substring(options.build.link.lastIndexOf("/") + 1);
|
||||||
|
final outputFile = File("${options.destination.path}\\.build\\$fileName");
|
||||||
try {
|
try {
|
||||||
final stopped = _setupLifecycle(options);
|
final stopped = _setupLifecycle(options);
|
||||||
final outputDir = Directory("${options.destination.path}\\.build");
|
await outputFile.parent.create(recursive: true);
|
||||||
await outputDir.create(recursive: true);
|
|
||||||
final fileName = options.build.link.substring(options.build.link.lastIndexOf("/") + 1);
|
|
||||||
final extension = path.extension(fileName);
|
|
||||||
final tempFile = File("${outputDir.path}\\$fileName");
|
|
||||||
if(await tempFile.exists()) {
|
|
||||||
await tempFile.delete(recursive: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
final startTime = DateTime.now().millisecondsSinceEpoch;
|
final downloadItemCompleter = Completer<File>();
|
||||||
final response = _downloadArchive(options, stopped, tempFile, startTime);
|
|
||||||
await Future.any([stopped.future, response]);
|
|
||||||
if(!stopped.isCompleted) {
|
|
||||||
await _extractArchive(stopped, extension, tempFile, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete(outputDir);
|
await _startAriaServer();
|
||||||
}catch(error) {
|
final downloadId = await _startAriaDownload(options, outputFile);
|
||||||
_onError(error, options);
|
Timer.periodic(const Duration(seconds: 5), (Timer timer) async {
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _downloadArchive(FortniteBuildDownloadOptions options, Completer stopped, File tempFile, int startTime, [int? byteStart = null, int errorsCount = 0]) async {
|
|
||||||
var received = byteStart ?? 0;
|
|
||||||
try {
|
try {
|
||||||
await _dio.download(
|
final statusRequestId = Uuid().toString().replaceAll("-", "");
|
||||||
options.build.link,
|
final statusRequest = {
|
||||||
tempFile.path,
|
"jsonrcp": "2.0",
|
||||||
onReceiveProgress: (data, length) {
|
"id": statusRequestId,
|
||||||
if(stopped.isCompleted) {
|
"method": "aria2.tellStatus",
|
||||||
throw StateError("Download interrupted");
|
"params": [
|
||||||
|
"token:${_ariaSecret}",
|
||||||
|
downloadId
|
||||||
|
]
|
||||||
|
};
|
||||||
|
final statusResponse = await http.post(_ariaEndpoint, body: jsonEncode(statusRequest));
|
||||||
|
final statusResponseJson = jsonDecode(statusResponse.body) as Map?;
|
||||||
|
if(statusResponseJson == null) {
|
||||||
|
downloadItemCompleter.completeError("Invalid download status (invalid JSON)");
|
||||||
|
timer.cancel();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
received = data;
|
final result = statusResponseJson["result"];
|
||||||
final percentage = (received / length) * 100;
|
final files = result["files"] as List?;
|
||||||
_onProgress(startTime, percentage < 1 ? null : DateTime.now().millisecondsSinceEpoch, percentage, false, options);
|
if(files == null || files.isEmpty) {
|
||||||
},
|
downloadItemCompleter.completeError("Download aborted");
|
||||||
deleteOnError: false,
|
timer.cancel();
|
||||||
options: Options(
|
return;
|
||||||
validateStatus: (statusCode) {
|
|
||||||
if(statusCode == 200) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(statusCode == 403 || statusCode == 503) {
|
final error = result["errorCode"];
|
||||||
throw _deniedConnectionError;
|
if(error != null) {
|
||||||
|
final errorCode = int.tryParse(error);
|
||||||
|
if(errorCode == 0) {
|
||||||
|
final path = File(files[0]["path"]);
|
||||||
|
downloadItemCompleter.complete(path);
|
||||||
|
}else if(errorCode == 3) {
|
||||||
|
downloadItemCompleter.completeError("This build is not available yet");
|
||||||
|
}else {
|
||||||
|
final errorMessage = result["errorMessage"];
|
||||||
|
downloadItemCompleter.completeError("$errorMessage (error code $errorCode)");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(statusCode == 404) {
|
timer.cancel();
|
||||||
throw _unavailableError;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw _genericError;
|
final speed = int.parse(result["downloadSpeed"] ?? "0");
|
||||||
},
|
final completedLength = int.parse(files[0]["completedLength"] ?? "0");
|
||||||
headers: byteStart == null || byteStart <= 0 ? {
|
final totalLength = int.parse(files[0]["length"] ?? "0");
|
||||||
"Cookie": "_c_t_c=1"
|
|
||||||
} : {
|
final percentage = completedLength * 100 / totalLength;
|
||||||
"Cookie": "_c_t_c=1",
|
final minutesLeft = speed == 0 ? -1 : ((totalLength - completedLength) / speed / 60).round();
|
||||||
"Range": "bytes=${byteStart}-"
|
_onProgress(
|
||||||
},
|
options.port,
|
||||||
)
|
percentage,
|
||||||
|
speed,
|
||||||
|
minutesLeft,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
}catch(error) {
|
}catch(error) {
|
||||||
if(stopped.isCompleted) {
|
throw "Invalid download status (${error})";
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if(errorsCount > _maxErrors || error.toString().contains(_deniedConnectionError) || error.toString().contains(_unavailableError)) {
|
await Future.any([stopped.future, downloadItemCompleter.future]);
|
||||||
|
if(!stopped.isCompleted) {
|
||||||
|
final extension = path.extension(fileName);
|
||||||
|
await _extractArchive(stopped, extension, await downloadItemCompleter.future, options);
|
||||||
|
}else {
|
||||||
|
await _stopAriaDownload(downloadId);
|
||||||
|
}
|
||||||
|
}catch(error) {
|
||||||
_onError(error, options);
|
_onError(error, options);
|
||||||
return;
|
}finally {
|
||||||
|
delete(outputFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await _downloadArchive(options, stopped, tempFile, startTime, received, errorsCount + 1);
|
Future<void> _startAriaServer() async {
|
||||||
|
final running = await _isAriaRunning();
|
||||||
|
if(running) {
|
||||||
|
await killProcessByPort(_ariaPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
final aria2c = File("${assetsDirectory.path}\\build\\aria2c.exe");
|
||||||
|
if(!aria2c.existsSync()) {
|
||||||
|
throw "Missing aria2c.exe";
|
||||||
|
}
|
||||||
|
|
||||||
|
await startProcess(
|
||||||
|
executable: aria2c,
|
||||||
|
args: [
|
||||||
|
"--max-connection-per-server=${Platform.numberOfProcessors}",
|
||||||
|
"--split=${Platform.numberOfProcessors}",
|
||||||
|
"--enable-rpc",
|
||||||
|
"--rpc-listen-all=true",
|
||||||
|
"--rpc-allow-origin-all",
|
||||||
|
"--rpc-secret=$_ariaSecret",
|
||||||
|
"--rpc-listen-port=$_ariaPort"
|
||||||
|
],
|
||||||
|
window: false
|
||||||
|
);
|
||||||
|
for(var i = 0; i < _ariaMaxSpawnTime.inSeconds; i++) {
|
||||||
|
if(await _isAriaRunning()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
|
}
|
||||||
|
throw "cannot start download server (timeout exceeded)";
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> _isAriaRunning() async {
|
||||||
|
try {
|
||||||
|
final statusRequestId = Uuid().toString().replaceAll("-", "");
|
||||||
|
final statusRequest = {
|
||||||
|
"jsonrcp": "2.0",
|
||||||
|
"id": statusRequestId,
|
||||||
|
"method": "aria2.getVersion",
|
||||||
|
"params": [
|
||||||
|
"token:${_ariaSecret}"
|
||||||
|
]
|
||||||
|
};
|
||||||
|
await http.post(_ariaEndpoint, body: jsonEncode(statusRequest));
|
||||||
|
return true;
|
||||||
|
}catch(_) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<String> _startAriaDownload(FortniteBuildDownloadOptions options, File outputFile) async {
|
||||||
|
http.Response? addDownloadResponse;
|
||||||
|
try {
|
||||||
|
final addDownloadRequestId = Uuid().toString().replaceAll("-", "");
|
||||||
|
final addDownloadRequest = {
|
||||||
|
"jsonrcp": "2.0",
|
||||||
|
"id": addDownloadRequestId,
|
||||||
|
"method": "aria2.addUri",
|
||||||
|
"params": [
|
||||||
|
"token:${_ariaSecret}",
|
||||||
|
[options.build.link],
|
||||||
|
{
|
||||||
|
"dir": outputFile.parent.path,
|
||||||
|
"out": path.basename(outputFile.path)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
addDownloadResponse = await http.post(_ariaEndpoint, body: jsonEncode(addDownloadRequest));
|
||||||
|
final addDownloadResponseJson = jsonDecode(addDownloadResponse.body);
|
||||||
|
final downloadId = addDownloadResponseJson is Map ? addDownloadResponseJson['result'] : null;
|
||||||
|
if(downloadId == null) {
|
||||||
|
throw "Start failed (${addDownloadResponse.body})";
|
||||||
|
}
|
||||||
|
|
||||||
|
return downloadId;
|
||||||
|
}catch(error) {
|
||||||
|
throw "Start failed (${addDownloadResponse?.body ?? error})";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _stopAriaDownload(String downloadId) async {
|
||||||
|
try {
|
||||||
|
final addDownloadRequestId = Uuid().toString().replaceAll("-", "");
|
||||||
|
final addDownloadRequest = {
|
||||||
|
"jsonrcp": "2.0",
|
||||||
|
"id": addDownloadRequestId,
|
||||||
|
"method": "aria2.forceRemove",
|
||||||
|
"params": [
|
||||||
|
"token:${_ariaSecret}",
|
||||||
|
downloadId
|
||||||
|
]
|
||||||
|
};
|
||||||
|
await http.post(_ariaEndpoint, body: jsonEncode(addDownloadRequest));
|
||||||
|
}catch(error) {
|
||||||
|
throw "Stop failed (${error})";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<void> _extractArchive(Completer<dynamic> stopped, String extension, File tempFile, FortniteBuildDownloadOptions options) async {
|
Future<void> _extractArchive(Completer<dynamic> stopped, String extension, File tempFile, FortniteBuildDownloadOptions options) async {
|
||||||
final startTime = DateTime.now().millisecondsSinceEpoch;
|
|
||||||
Process? process;
|
Process? process;
|
||||||
switch (extension.toLowerCase()) {
|
switch (extension.toLowerCase()) {
|
||||||
case ".zip":
|
case ".zip":
|
||||||
final sevenZip = File("${assetsDirectory.path}\\build\\7zip.exe");
|
final sevenZip = File("${assetsDirectory.path}\\build\\7zip.exe");
|
||||||
if(!sevenZip.existsSync()) {
|
if(!sevenZip.existsSync()) {
|
||||||
throw "Corrupted installation: missing 7zip.exe";
|
throw "Missing 7zip.exe";
|
||||||
}
|
}
|
||||||
|
|
||||||
process = await startProcess(
|
process = await startProcess(
|
||||||
@@ -176,10 +254,15 @@ Future<void> _extractArchive(Completer<dynamic> stopped, String extension, File
|
|||||||
);
|
);
|
||||||
var completed = false;
|
var completed = false;
|
||||||
process.stdOutput.listen((data) {
|
process.stdOutput.listen((data) {
|
||||||
final now = DateTime.now().millisecondsSinceEpoch;
|
|
||||||
if(data.toLowerCase().contains("everything is ok")) {
|
if(data.toLowerCase().contains("everything is ok")) {
|
||||||
completed = true;
|
completed = true;
|
||||||
_onProgress(startTime, now, 100, true, options);
|
_onProgress(
|
||||||
|
options.port,
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
-1,
|
||||||
|
true
|
||||||
|
);
|
||||||
process?.kill(ProcessSignal.sigabrt);
|
process?.kill(ProcessSignal.sigabrt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -190,7 +273,13 @@ Future<void> _extractArchive(Completer<dynamic> stopped, String extension, File
|
|||||||
}
|
}
|
||||||
|
|
||||||
final percentage = int.parse(element.substring(0, element.length - 1)).toDouble();
|
final percentage = int.parse(element.substring(0, element.length - 1)).toDouble();
|
||||||
_onProgress(startTime, now, percentage, true, options);
|
_onProgress(
|
||||||
|
options.port,
|
||||||
|
percentage,
|
||||||
|
0,
|
||||||
|
-1,
|
||||||
|
true
|
||||||
|
);
|
||||||
});
|
});
|
||||||
process.stdError.listen((data) {
|
process.stdError.listen((data) {
|
||||||
if(!data.isBlank) {
|
if(!data.isBlank) {
|
||||||
@@ -206,7 +295,7 @@ Future<void> _extractArchive(Completer<dynamic> stopped, String extension, File
|
|||||||
case ".rar":
|
case ".rar":
|
||||||
final winrar = File("${assetsDirectory.path}\\build\\winrar.exe");
|
final winrar = File("${assetsDirectory.path}\\build\\winrar.exe");
|
||||||
if(!winrar.existsSync()) {
|
if(!winrar.existsSync()) {
|
||||||
throw "Corrupted installation: missing winrar.exe";
|
throw "Missing winrar.exe";
|
||||||
}
|
}
|
||||||
|
|
||||||
process = await startProcess(
|
process = await startProcess(
|
||||||
@@ -221,11 +310,16 @@ Future<void> _extractArchive(Completer<dynamic> stopped, String extension, File
|
|||||||
);
|
);
|
||||||
var completed = false;
|
var completed = false;
|
||||||
process.stdOutput.listen((data) {
|
process.stdOutput.listen((data) {
|
||||||
final now = DateTime.now().millisecondsSinceEpoch;
|
|
||||||
data = data.replaceAll("\r", "").replaceAll("\b", "").trim();
|
data = data.replaceAll("\r", "").replaceAll("\b", "").trim();
|
||||||
if(data == "All OK") {
|
if(data == "All OK") {
|
||||||
completed = true;
|
completed = true;
|
||||||
_onProgress(startTime, now, 100, true, options);
|
_onProgress(
|
||||||
|
options.port,
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
-1,
|
||||||
|
true
|
||||||
|
);
|
||||||
process?.kill(ProcessSignal.sigabrt);
|
process?.kill(ProcessSignal.sigabrt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -236,7 +330,13 @@ Future<void> _extractArchive(Completer<dynamic> stopped, String extension, File
|
|||||||
}
|
}
|
||||||
|
|
||||||
final percentage = int.parse(element).toDouble();
|
final percentage = int.parse(element).toDouble();
|
||||||
_onProgress(startTime, now, percentage, true, options);
|
_onProgress(
|
||||||
|
options.port,
|
||||||
|
percentage,
|
||||||
|
0,
|
||||||
|
-1,
|
||||||
|
true
|
||||||
|
);
|
||||||
});
|
});
|
||||||
process.stdError.listen((data) {
|
process.stdError.listen((data) {
|
||||||
if(!data.isBlank) {
|
if(!data.isBlank) {
|
||||||
@@ -257,21 +357,22 @@ Future<void> _extractArchive(Completer<dynamic> stopped, String extension, File
|
|||||||
process.kill(ProcessSignal.sigabrt);
|
process.kill(ProcessSignal.sigabrt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onProgress(int startTime, int? now, double percentage, bool extracting, FortniteBuildDownloadOptions options) {
|
void _onProgress(SendPort port, double percentage, int speed, int minutesLeft, bool extracting) {
|
||||||
if(percentage == 0) {
|
if(percentage == 0) {
|
||||||
options.port.send(FortniteBuildDownloadProgress(
|
port.send(FortniteBuildDownloadProgress(
|
||||||
progress: percentage,
|
progress: percentage,
|
||||||
extracting: extracting
|
extracting: extracting,
|
||||||
|
timeLeft: null,
|
||||||
|
speed: speed
|
||||||
));
|
));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final msLeft = now == null ? null : startTime + (now - startTime) * 100 / percentage - now;
|
port.send(FortniteBuildDownloadProgress(
|
||||||
final minutesLeft = msLeft == null ? null : (msLeft / 1000 / 60).round();
|
|
||||||
options.port.send(FortniteBuildDownloadProgress(
|
|
||||||
progress: percentage,
|
progress: percentage,
|
||||||
extracting: extracting,
|
extracting: extracting,
|
||||||
minutesLeft: minutesLeft
|
timeLeft: minutesLeft,
|
||||||
|
speed: speed
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,3 +393,4 @@ Completer<dynamic> _setupLifecycle(FortniteBuildDownloadOptions options) {
|
|||||||
options.port.send(lifecyclePort.sendPort);
|
options.port.send(lifecyclePort.sendPort);
|
||||||
return stopped;
|
return stopped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,13 +6,16 @@ import 'package:path/path.dart' as path;
|
|||||||
import 'package:reboot_common/common.dart';
|
import 'package:reboot_common/common.dart';
|
||||||
|
|
||||||
bool _watcher = false;
|
bool _watcher = false;
|
||||||
final File rebootDllFile = File("${dllsDirectory.path}\\reboot.dll");
|
final File rebootBeforeS20DllFile = File("${dllsDirectory.path}\\reboot.dll");
|
||||||
const String kRebootDownloadUrl =
|
final File rebootAboveS20DllFile = File("${dllsDirectory.path}\\rebootS20.dll");
|
||||||
"http://nightly.link/Milxnor/Project-Reboot-3.0/workflows/msbuild/master/Release.zip";
|
const String kRebootBelowS20DownloadUrl =
|
||||||
|
"https://nightly.link/Milxnor/Project-Reboot-3.0/workflows/msbuild/master/Reboot.zip";
|
||||||
|
const String kRebootAboveS20DownloadUrl =
|
||||||
|
"https://nightly.link/Milxnor/Project-Reboot-3.0/workflows/msbuild/master/RebootS20.zip";
|
||||||
|
|
||||||
Future<bool> hasRebootDllUpdate(int? lastUpdateMs, {int hours = 24, bool force = false}) async {
|
Future<bool> hasRebootDllUpdate(int? lastUpdateMs, {int hours = 24, bool force = false}) async {
|
||||||
final lastUpdate = await _getLastUpdate(lastUpdateMs);
|
final lastUpdate = await _getLastUpdate(lastUpdateMs);
|
||||||
final exists = await rebootDllFile.exists();
|
final exists = await rebootBeforeS20DllFile.exists() && await rebootAboveS20DllFile.exists();
|
||||||
final now = DateTime.now();
|
final now = DateTime.now();
|
||||||
return force || !exists || (hours > 0 && lastUpdate != null && now.difference(lastUpdate).inHours > hours);
|
return force || !exists || (hours > 0 && lastUpdate != null && now.difference(lastUpdate).inHours > hours);
|
||||||
}
|
}
|
||||||
@@ -28,9 +31,8 @@ Future<void> downloadCriticalDll(String name, String outputPath) async {
|
|||||||
await output.writeAsBytes(response.bodyBytes, flush: true);
|
await output.writeAsBytes(response.bodyBytes, flush: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> downloadRebootDll(String url) async {
|
Future<void> downloadRebootDll(File file, String url) async {
|
||||||
Directory? outputDir;
|
Directory? outputDir;
|
||||||
final now = DateTime.now();
|
|
||||||
try {
|
try {
|
||||||
final response = await http.get(Uri.parse(url));
|
final response = await http.get(Uri.parse(url));
|
||||||
if(response.statusCode != 200) {
|
if(response.statusCode != 200) {
|
||||||
@@ -42,8 +44,7 @@ Future<int> downloadRebootDll(String url) async {
|
|||||||
await tempZip.writeAsBytes(response.bodyBytes, flush: true);
|
await tempZip.writeAsBytes(response.bodyBytes, flush: true);
|
||||||
await extractFileToDisk(tempZip.path, outputDir.path);
|
await extractFileToDisk(tempZip.path, outputDir.path);
|
||||||
final rebootDll = File(outputDir.listSync().firstWhere((element) => path.extension(element.path) == ".dll").path);
|
final rebootDll = File(outputDir.listSync().firstWhere((element) => path.extension(element.path) == ".dll").path);
|
||||||
await rebootDllFile.writeAsBytes(await rebootDll.readAsBytes(), flush: true);
|
await file.writeAsBytes(await rebootDll.readAsBytes(), flush: true);
|
||||||
return now.millisecondsSinceEpoch;
|
|
||||||
} finally{
|
} finally{
|
||||||
if(outputDir != null) {
|
if(outputDir != null) {
|
||||||
delete(outputDir);
|
delete(outputDir);
|
||||||
@@ -63,7 +64,7 @@ Stream<String> watchDlls() async* {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_watcher = true;
|
_watcher = true;
|
||||||
await for(final event in rebootDllFile.parent.watch(events: FileSystemEvent.delete | FileSystemEvent.move)) {
|
await for(final event in dllsDirectory.watch(events: FileSystemEvent.delete | FileSystemEvent.move)) {
|
||||||
if (event.path.endsWith(".dll")) {
|
if (event.path.endsWith(".dll")) {
|
||||||
yield event.path;
|
yield event.path;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ import 'dart:isolate';
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:ffi/ffi.dart';
|
import 'package:ffi/ffi.dart';
|
||||||
import 'package:path/path.dart' as path;
|
|
||||||
import 'package:reboot_common/common.dart';
|
import 'package:reboot_common/common.dart';
|
||||||
import 'package:reboot_common/src/util/log.dart';
|
|
||||||
import 'package:sync/semaphore.dart';
|
|
||||||
import 'package:win32/win32.dart';
|
import 'package:win32/win32.dart';
|
||||||
|
|
||||||
final _ntdll = DynamicLibrary.open('ntdll.dll');
|
final _ntdll = DynamicLibrary.open('ntdll.dll');
|
||||||
@@ -98,8 +95,8 @@ Future<bool> startElevatedProcess({required String executable, required String a
|
|||||||
var shellInput = calloc<SHELLEXECUTEINFO>();
|
var shellInput = calloc<SHELLEXECUTEINFO>();
|
||||||
shellInput.ref.lpFile = executable.toNativeUtf16();
|
shellInput.ref.lpFile = executable.toNativeUtf16();
|
||||||
shellInput.ref.lpParameters = args.toNativeUtf16();
|
shellInput.ref.lpParameters = args.toNativeUtf16();
|
||||||
shellInput.ref.nShow = window ? SW_SHOWNORMAL : SW_HIDE;
|
shellInput.ref.nShow = window ? SHOW_WINDOW_CMD.SW_SHOWNORMAL : SHOW_WINDOW_CMD.SW_HIDE;
|
||||||
shellInput.ref.fMask = ES_AWAYMODE_REQUIRED;
|
shellInput.ref.fMask = EXECUTION_STATE.ES_AWAYMODE_REQUIRED;
|
||||||
shellInput.ref.lpVerb = "runas".toNativeUtf16();
|
shellInput.ref.lpVerb = "runas".toNativeUtf16();
|
||||||
shellInput.ref.cbSize = sizeOf<SHELLEXECUTEINFO>();
|
shellInput.ref.cbSize = sizeOf<SHELLEXECUTEINFO>();
|
||||||
return ShellExecuteEx(shellInput) == 1;
|
return ShellExecuteEx(shellInput) == 1;
|
||||||
@@ -154,47 +151,36 @@ final _NtSuspendProcess = _ntdll.lookupFunction<Int32 Function(IntPtr hWnd),
|
|||||||
int Function(int hWnd)>('NtSuspendProcess');
|
int Function(int hWnd)>('NtSuspendProcess');
|
||||||
|
|
||||||
bool suspend(int pid) {
|
bool suspend(int pid) {
|
||||||
final processHandle = OpenProcess(PROCESS_SUSPEND_RESUME, FALSE, pid);
|
final processHandle = OpenProcess(PROCESS_ACCESS_RIGHTS.PROCESS_SUSPEND_RESUME, FALSE, pid);
|
||||||
final result = _NtSuspendProcess(processHandle);
|
|
||||||
CloseHandle(processHandle);
|
|
||||||
return result == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool resume(int pid) {
|
|
||||||
final processHandle = OpenProcess(PROCESS_SUSPEND_RESUME, FALSE, pid);
|
|
||||||
final result = _NtResumeProcess(processHandle);
|
|
||||||
CloseHandle(processHandle);
|
|
||||||
return result == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _watchProcess(int pid) {
|
|
||||||
final processHandle = OpenProcess(SYNCHRONIZE, FALSE, pid);
|
|
||||||
try {
|
try {
|
||||||
WaitForSingleObject(processHandle, INFINITE);
|
return _NtSuspendProcess(processHandle) == 0;
|
||||||
} finally {
|
} finally {
|
||||||
CloseHandle(processHandle);
|
CloseHandle(processHandle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> watchProcess(int pid) async {
|
bool resume(int pid) {
|
||||||
var completer = Completer<bool>();
|
final processHandle = OpenProcess(PROCESS_ACCESS_RIGHTS.PROCESS_SUSPEND_RESUME, FALSE, pid);
|
||||||
var exitPort = ReceivePort();
|
try {
|
||||||
exitPort.listen((_) {
|
return _NtResumeProcess(processHandle) == 0;
|
||||||
if(!completer.isCompleted) {
|
} finally {
|
||||||
completer.complete(true);
|
CloseHandle(processHandle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Future<void> watchProcess(int pid) => Isolate.run(() {
|
||||||
|
final processHandle = OpenProcess(FILE_ACCESS_RIGHTS.SYNCHRONIZE, FALSE, pid);
|
||||||
|
if (processHandle == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
WaitForSingleObject(processHandle, INFINITE);
|
||||||
|
}finally {
|
||||||
|
CloseHandle(processHandle);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var errorPort = ReceivePort();
|
|
||||||
errorPort.listen((_) => completer.complete(false));
|
|
||||||
await Isolate.spawn(
|
|
||||||
_watchProcess,
|
|
||||||
pid,
|
|
||||||
onExit: exitPort.sendPort,
|
|
||||||
onError: errorPort.sendPort,
|
|
||||||
errorsAreFatal: true
|
|
||||||
);
|
|
||||||
return await completer.future;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> createRebootArgs(String username, String password, bool host, GameServerType hostType, bool logging, String additionalArgs) {
|
List<String> createRebootArgs(String username, String password, bool host, GameServerType hostType, bool logging, String additionalArgs) {
|
||||||
log("[PROCESS] Generating reboot args");
|
log("[PROCESS] Generating reboot args");
|
||||||
|
|||||||
@@ -7,19 +7,18 @@ environment:
|
|||||||
sdk: ">=3.0.0 <=4.0.0"
|
sdk: ">=3.0.0 <=4.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
dio: ^5.3.2
|
win32: ^5.5.4
|
||||||
win32: 3.0.0
|
ffi: ^2.1.3
|
||||||
ffi: ^2.1.0
|
path: ^1.9.0
|
||||||
path: ^1.8.3
|
http: ^1.2.2
|
||||||
http: ^1.1.0
|
crypto: ^3.0.5
|
||||||
crypto: ^3.0.2
|
archive: ^3.6.1
|
||||||
archive: ^3.3.7
|
|
||||||
ini: ^2.1.0
|
ini: ^2.1.0
|
||||||
shelf_proxy: ^1.0.2
|
shelf_proxy: ^1.0.2
|
||||||
sync: ^0.3.0
|
sync: ^0.3.0
|
||||||
uuid: ^3.0.6
|
uuid: ^4.5.1
|
||||||
shelf_web_socket: ^2.0.0
|
shelf_web_socket: ^2.0.0
|
||||||
version: ^3.0.2
|
version: ^3.0.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_lints: ^2.0.1
|
flutter_lints: ^5.0.0
|
||||||
@@ -1,16 +1,39 @@
|
|||||||
# reboot_launcher
|
|
||||||
|
|
||||||
Launcher for project reboot
|
# Reboot Launcher
|
||||||
|
|
||||||
|
Welcome to the **Reboot Launcher**!
|
||||||
|
This is a GUI application developed as part of the **Reboot Project**.
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
This project is a starting point for a Flutter application.
|
### Running the Project
|
||||||
|
To launch the project in development mode, simply run:
|
||||||
|
```
|
||||||
|
flutter run
|
||||||
|
```
|
||||||
|
|
||||||
A few resources to get you started if this is your first Flutter project:
|
### Building the Project
|
||||||
|
To create a production-ready build, use:
|
||||||
|
```
|
||||||
|
flutter build
|
||||||
|
```
|
||||||
|
|
||||||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
### Packaging the Project
|
||||||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
|
To package the application for distribution, run:
|
||||||
|
```
|
||||||
|
package.bat
|
||||||
|
```
|
||||||
|
|
||||||
For help getting started with Flutter development, view the
|
## Requirements
|
||||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
- [Flutter SDK](https://flutter.dev/docs/get-started/install)
|
||||||
samples, guidance on mobile development, and a full API reference.
|
- Supported operating systems: Windows
|
||||||
|
|
||||||
|
## Other platforms
|
||||||
|
|
||||||
|
Native support for these platforms is not currently planned, but Linux support is a priority for the 10.0 release cycle
|
||||||
|
|
||||||
|
- [Linux Tutorial using Proton](https://www.reddit.com/r/linux_gaming/comments/1fwa4l8/guide_running_a_fortnite_private_server_to_play/)
|
||||||
|
- No tutorials are available for MacOS(got lost when the Reboot discord was banned), but it's possible to run Reboot using a compatibility layer
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
Contributions are welcome! Feel free to open an issue or submit a pull request.
|
||||||
BIN
gui/assets/build/aria2c.exe
Normal file
BIN
gui/assets/build/aria2c.exe
Normal file
Binary file not shown.
@@ -1,2 +0,0 @@
|
|||||||
taskkill /f /im winrar.exe
|
|
||||||
taskkill /f /im tar.exe
|
|
||||||
Binary file not shown.
Binary file not shown.
BIN
gui/dependencies/dlls/starfall.dll
Normal file
BIN
gui/dependencies/dlls/starfall.dll
Normal file
Binary file not shown.
@@ -76,7 +76,7 @@
|
|||||||
"playGameServerCustomContent": "Enter IP",
|
"playGameServerCustomContent": "Enter IP",
|
||||||
"settingsName": "Settings",
|
"settingsName": "Settings",
|
||||||
"settingsClientName": "Internal files",
|
"settingsClientName": "Internal files",
|
||||||
"settingsClientDescription": "Configure the internal files used by the launcher for Fortnite",
|
"settingsClientDescription": "Configure the internal files used by the launcher",
|
||||||
"settingsClientOptionsName": "Options",
|
"settingsClientOptionsName": "Options",
|
||||||
"settingsClientOptionsDescription": "Configure additional options for Fortnite",
|
"settingsClientOptionsDescription": "Configure additional options for Fortnite",
|
||||||
"settingsClientConsoleName": "Unreal engine patcher",
|
"settingsClientConsoleName": "Unreal engine patcher",
|
||||||
@@ -94,18 +94,19 @@
|
|||||||
"settingsServerSubtitle": "Configure the internal files used by the launcher for the game server",
|
"settingsServerSubtitle": "Configure the internal files used by the launcher for the game server",
|
||||||
"settingsServerOptionsName": "Options",
|
"settingsServerOptionsName": "Options",
|
||||||
"settingsServerOptionsSubtitle": "Configure additional options for the game server",
|
"settingsServerOptionsSubtitle": "Configure additional options for the game server",
|
||||||
"settingsServerTypeName": "Type",
|
"settingsServerTypeName": "Game server type",
|
||||||
"settingsServerTypeDescription": "The type of game server to inject",
|
"settingsServerTypeDescription": "The type of game server to inject",
|
||||||
"settingsServerTypeEmbeddedName": "Embedded",
|
"settingsServerTypeEmbeddedName": "Embedded",
|
||||||
"settingsServerTypeCustomName": "Custom",
|
"settingsServerTypeCustomName": "Custom",
|
||||||
"settingsServerFileName": "Implementation",
|
"settingsOldServerFileName": "Game server",
|
||||||
"settingsServerFileDescription": "The file injected to create the game server",
|
"settingsServerFileDescription": "The file injected to create the game server",
|
||||||
"settingsServerPortName": "Port",
|
"settingsServerPortName": "Port",
|
||||||
"settingsServerPortDescription": "The port the launcher expects the game server to be hosted on",
|
"settingsServerPortDescription": "The port the launcher expects the game server to be hosted on",
|
||||||
"settingsServerMirrorName": "Update mirror",
|
"settingsServerOldMirrorName": "Update mirror (Before season 20)",
|
||||||
|
"settingsServerNewMirrorName": "Update mirror (Season 20 and above)",
|
||||||
"settingsServerMirrorDescription": "The URL used to update the game server dll",
|
"settingsServerMirrorDescription": "The URL used to update the game server dll",
|
||||||
"settingsServerMirrorPlaceholder": "mirror",
|
"settingsServerMirrorPlaceholder": "mirror",
|
||||||
"settingsServerTimerName": "Update timer",
|
"settingsServerTimerName": "Game server updater",
|
||||||
"settingsServerTimerSubtitle": "Determines when the game server should be updated",
|
"settingsServerTimerSubtitle": "Determines when the game server should be updated",
|
||||||
"settingsUtilsName": "Launcher",
|
"settingsUtilsName": "Launcher",
|
||||||
"settingsUtilsSubtitle": "This section contains settings related to the launcher",
|
"settingsUtilsSubtitle": "This section contains settings related to the launcher",
|
||||||
@@ -215,6 +216,8 @@
|
|||||||
"downloadedVersion": "The download was completed successfully!",
|
"downloadedVersion": "The download was completed successfully!",
|
||||||
"download": "Download",
|
"download": "Download",
|
||||||
"downloading": "Downloading...",
|
"downloading": "Downloading...",
|
||||||
|
"allocatingSpace": "Allocating disk space...",
|
||||||
|
"startingDownload": "Starting download...",
|
||||||
"extracting": "Extracting...",
|
"extracting": "Extracting...",
|
||||||
"buildProgress": "{progress}%",
|
"buildProgress": "{progress}%",
|
||||||
"buildInstallationDirectory": "Installation directory",
|
"buildInstallationDirectory": "Installation directory",
|
||||||
@@ -324,6 +327,8 @@
|
|||||||
"backendErrorMessage": "The backend reported an unexpected error",
|
"backendErrorMessage": "The backend reported an unexpected error",
|
||||||
"welcomeTitle": "Welcome to Reboot Launcher",
|
"welcomeTitle": "Welcome to Reboot Launcher",
|
||||||
"welcomeDescription": "If you have never used a Fortnite game server, or this launcher in particular, please click on take a tour\nPlease don't ask for support on Discord without taking the tour: this helps me prioritize real bugs\nYou can always take the tour again in the Info tab",
|
"welcomeDescription": "If you have never used a Fortnite game server, or this launcher in particular, please click on take a tour\nPlease don't ask for support on Discord without taking the tour: this helps me prioritize real bugs\nYou can always take the tour again in the Info tab",
|
||||||
|
"hostAccountText": "The host tab shows different credentials compared to the play tab.\nIf you are advanced user, you can set a different email and password\nhere if the backend you are using needs authentication.",
|
||||||
|
"hostAccountAction": "I understand",
|
||||||
"welcomeAction": "Take the tour",
|
"welcomeAction": "Take the tour",
|
||||||
"startOnboardingText": "Start by choosing a username: this will be visible to other players on Fortnite.\nIf you are advanced user, you can set the email and password here if the backend\nyou are using supports authentication.",
|
"startOnboardingText": "Start by choosing a username: this will be visible to other players on Fortnite.\nIf you are advanced user, you can set the email and password here if the backend\nyou are using supports authentication.",
|
||||||
"startOnboardingActionLabel": "Let's do it",
|
"startOnboardingActionLabel": "Let's do it",
|
||||||
@@ -368,5 +373,7 @@
|
|||||||
"automaticGameServerDialogStart": "Start server",
|
"automaticGameServerDialogStart": "Start server",
|
||||||
"gameResetDefaultsName": "Reset",
|
"gameResetDefaultsName": "Reset",
|
||||||
"gameResetDefaultsDescription": "Resets the game's settings to their default values",
|
"gameResetDefaultsDescription": "Resets the game's settings to their default values",
|
||||||
"gameResetDefaultsContent": "Reset"
|
"gameResetDefaultsContent": "Reset",
|
||||||
|
"selectFile": "Select a file",
|
||||||
|
"reset": "Reset"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:bitsdojo_window/bitsdojo_window.dart';
|
|
||||||
import 'package:fluent_ui/fluent_ui.dart';
|
import 'package:fluent_ui/fluent_ui.dart';
|
||||||
import 'package:flutter_acrylic/flutter_acrylic.dart';
|
import 'package:flutter_acrylic/flutter_acrylic.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/reboot_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/reboot_localizations.dart';
|
||||||
@@ -19,9 +18,9 @@ import 'package:reboot_launcher/src/controller/settings_controller.dart';
|
|||||||
import 'package:reboot_launcher/src/messenger/implementation/error.dart';
|
import 'package:reboot_launcher/src/messenger/implementation/error.dart';
|
||||||
import 'package:reboot_launcher/src/page/implementation/home_page.dart';
|
import 'package:reboot_launcher/src/page/implementation/home_page.dart';
|
||||||
import 'package:reboot_launcher/src/util/os.dart';
|
import 'package:reboot_launcher/src/util/os.dart';
|
||||||
|
import 'package:reboot_launcher/src/util/url_protocol.dart';
|
||||||
import 'package:supabase_flutter/supabase_flutter.dart';
|
import 'package:supabase_flutter/supabase_flutter.dart';
|
||||||
import 'package:system_theme/system_theme.dart';
|
import 'package:system_theme/system_theme.dart';
|
||||||
import 'package:url_protocol/url_protocol.dart';
|
|
||||||
import 'package:version/version.dart';
|
import 'package:version/version.dart';
|
||||||
import 'package:window_manager/window_manager.dart';
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
@@ -146,31 +145,33 @@ Future<Object?> _initVersion() async {
|
|||||||
|
|
||||||
Future<Object?> _initUrlHandler() async {
|
Future<Object?> _initUrlHandler() async {
|
||||||
try {
|
try {
|
||||||
registerProtocolHandler(kCustomUrlSchema, arguments: ['%s']);
|
registerUrlProtocol(kCustomUrlSchema, arguments: ['%s']);
|
||||||
return null;
|
return null;
|
||||||
}catch(error) {
|
}catch(error) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _initWindow() => doWhenWindowReady(() async {
|
Future<void> _initWindow() async {
|
||||||
try {
|
try {
|
||||||
await SystemTheme.accentColor.load();
|
await SystemTheme.accentColor.load();
|
||||||
await windowManager.ensureInitialized();
|
await windowManager.ensureInitialized();
|
||||||
await Window.initialize();
|
await Window.initialize();
|
||||||
var settingsController = Get.find<SettingsController>();
|
var settingsController = Get.find<SettingsController>();
|
||||||
var size = Size(settingsController.width, settingsController.height);
|
var size = Size(settingsController.width, settingsController.height);
|
||||||
appWindow.size = size;
|
await windowManager.setSize(size);
|
||||||
var offsetX = settingsController.offsetX;
|
var offsetX = settingsController.offsetX;
|
||||||
var offsetY = settingsController.offsetY;
|
var offsetY = settingsController.offsetY;
|
||||||
if(offsetX != null && offsetY != null) {
|
if(offsetX != null && offsetY != null) {
|
||||||
appWindow.position = Offset(
|
final position = Offset(
|
||||||
offsetX,
|
offsetX,
|
||||||
offsetY
|
offsetY
|
||||||
);
|
);
|
||||||
|
await windowManager.setPosition(position);
|
||||||
}else {
|
}else {
|
||||||
appWindow.alignment = Alignment.center;
|
await windowManager.setAlignment(Alignment.center);
|
||||||
}
|
}
|
||||||
|
await windowManager.setPreventClose(true);
|
||||||
|
|
||||||
if(isWin11) {
|
if(isWin11) {
|
||||||
await Window.setEffect(
|
await Window.setEffect(
|
||||||
@@ -182,9 +183,9 @@ void _initWindow() => doWhenWindowReady(() async {
|
|||||||
}catch(error, stackTrace) {
|
}catch(error, stackTrace) {
|
||||||
onError(error, stackTrace, false);
|
onError(error, stackTrace, false);
|
||||||
}finally {
|
}finally {
|
||||||
appWindow.show();
|
windowManager.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
Future<List<Object>> _initStorage() async {
|
Future<List<Object>> _initStorage() async {
|
||||||
final errors = <Object>[];
|
final errors = <Object>[];
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import 'package:reboot_launcher/main.dart';
|
|||||||
import 'package:reboot_launcher/src/util/keyboard.dart';
|
import 'package:reboot_launcher/src/util/keyboard.dart';
|
||||||
|
|
||||||
class BackendController extends GetxController {
|
class BackendController extends GetxController {
|
||||||
static const String storageName = "backend_storage";
|
static const String storageName = "v2_backend_storage";
|
||||||
static const PhysicalKeyboardKey _kDefaultConsoleKey = PhysicalKeyboardKey(0x00070041);
|
static const PhysicalKeyboardKey _kDefaultConsoleKey = PhysicalKeyboardKey(0x00070041);
|
||||||
|
|
||||||
late final GetStorage? _storage;
|
late final GetStorage? _storage;
|
||||||
|
|||||||
@@ -4,28 +4,25 @@ import 'dart:io';
|
|||||||
import 'package:fluent_ui/fluent_ui.dart';
|
import 'package:fluent_ui/fluent_ui.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:get_storage/get_storage.dart';
|
import 'package:get_storage/get_storage.dart';
|
||||||
import 'package:http/http.dart' as http;
|
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart';
|
||||||
import 'package:reboot_common/common.dart';
|
import 'package:reboot_common/common.dart';
|
||||||
import 'package:reboot_launcher/main.dart';
|
import 'package:reboot_launcher/main.dart';
|
||||||
import 'package:reboot_launcher/src/messenger/abstract/info_bar.dart';
|
import 'package:reboot_launcher/src/messenger/abstract/info_bar.dart';
|
||||||
import 'package:reboot_launcher/src/util/translations.dart';
|
import 'package:reboot_launcher/src/util/translations.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
|
||||||
import 'package:version/version.dart';
|
import 'package:version/version.dart';
|
||||||
import 'package:yaml/yaml.dart';
|
|
||||||
|
|
||||||
class DllController extends GetxController {
|
class DllController extends GetxController {
|
||||||
static const String storageName = "dll_storage";
|
static const String storageName = "v2_dll_storage";
|
||||||
|
|
||||||
late final GetStorage? _storage;
|
late final GetStorage? _storage;
|
||||||
late final String originalDll;
|
late final String originalDll;
|
||||||
late final TextEditingController gameServerDll;
|
late final TextEditingController gameServerDll;
|
||||||
late final TextEditingController unrealEngineConsoleDll;
|
late final TextEditingController unrealEngineConsoleDll;
|
||||||
late final TextEditingController backendDll;
|
late final TextEditingController backendDll;
|
||||||
late final TextEditingController memoryLeakDll;
|
|
||||||
late final TextEditingController gameServerPort;
|
late final TextEditingController gameServerPort;
|
||||||
late final Rx<UpdateTimer> timer;
|
late final Rx<UpdateTimer> timer;
|
||||||
late final TextEditingController url;
|
late final TextEditingController beforeS20Mirror;
|
||||||
|
late final TextEditingController aboveS20Mirror;
|
||||||
late final RxBool customGameServer;
|
late final RxBool customGameServer;
|
||||||
late final RxnInt timestamp;
|
late final RxnInt timestamp;
|
||||||
late final Rx<UpdateStatus> status;
|
late final Rx<UpdateStatus> status;
|
||||||
@@ -36,15 +33,16 @@ class DllController extends GetxController {
|
|||||||
_storage = appWithNoStorage ? null : GetStorage(storageName);
|
_storage = appWithNoStorage ? null : GetStorage(storageName);
|
||||||
gameServerDll = _createController("game_server", InjectableDll.reboot);
|
gameServerDll = _createController("game_server", InjectableDll.reboot);
|
||||||
unrealEngineConsoleDll = _createController("unreal_engine_console", InjectableDll.console);
|
unrealEngineConsoleDll = _createController("unreal_engine_console", InjectableDll.console);
|
||||||
backendDll = _createController("backend", InjectableDll.cobalt);
|
backendDll = _createController("backend", InjectableDll.starfall);
|
||||||
memoryLeakDll = _createController("memory_leak", InjectableDll.memory);
|
|
||||||
gameServerPort = TextEditingController(text: _storage?.read("game_server_port") ?? kDefaultGameServerPort);
|
gameServerPort = TextEditingController(text: _storage?.read("game_server_port") ?? kDefaultGameServerPort);
|
||||||
gameServerPort.addListener(() => _storage?.write("game_server_port", gameServerPort.text));
|
gameServerPort.addListener(() => _storage?.write("game_server_port", gameServerPort.text));
|
||||||
final timerIndex = _storage?.read("timer");
|
final timerIndex = _storage?.read("timer");
|
||||||
timer = Rx(timerIndex == null ? UpdateTimer.hour : UpdateTimer.values.elementAt(timerIndex));
|
timer = Rx(timerIndex == null ? UpdateTimer.hour : UpdateTimer.values.elementAt(timerIndex));
|
||||||
timer.listen((value) => _storage?.write("timer", value.index));
|
timer.listen((value) => _storage?.write("timer", value.index));
|
||||||
url = TextEditingController(text: _storage?.read("update_url") ?? kRebootDownloadUrl);
|
beforeS20Mirror = TextEditingController(text: _storage?.read("update_url") ?? kRebootBelowS20DownloadUrl);
|
||||||
url.addListener(() => _storage?.write("update_url", url.text));
|
beforeS20Mirror.addListener(() => _storage?.write("update_url", beforeS20Mirror.text));
|
||||||
|
aboveS20Mirror = TextEditingController(text: _storage?.read("old_update_url") ?? kRebootAboveS20DownloadUrl);
|
||||||
|
aboveS20Mirror.addListener(() => _storage?.write("new_update_url", aboveS20Mirror.text));
|
||||||
status = Rx(UpdateStatus.waiting);
|
status = Rx(UpdateStatus.waiting);
|
||||||
customGameServer = RxBool(_storage?.read("custom_game_server") ?? false);
|
customGameServer = RxBool(_storage?.read("custom_game_server") ?? false);
|
||||||
customGameServer.listen((value) => _storage?.write("custom_game_server", value));
|
customGameServer.listen((value) => _storage?.write("custom_game_server", value));
|
||||||
@@ -61,14 +59,14 @@ class DllController extends GetxController {
|
|||||||
void resetGame() {
|
void resetGame() {
|
||||||
gameServerDll.text = getDefaultDllPath(InjectableDll.reboot);
|
gameServerDll.text = getDefaultDllPath(InjectableDll.reboot);
|
||||||
unrealEngineConsoleDll.text = getDefaultDllPath(InjectableDll.console);
|
unrealEngineConsoleDll.text = getDefaultDllPath(InjectableDll.console);
|
||||||
backendDll.text = getDefaultDllPath(InjectableDll.cobalt);
|
backendDll.text = getDefaultDllPath(InjectableDll.starfall);
|
||||||
memoryLeakDll.text = getDefaultDllPath(InjectableDll.memory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetServer() {
|
void resetServer() {
|
||||||
gameServerPort.text = kDefaultGameServerPort;
|
gameServerPort.text = kDefaultGameServerPort;
|
||||||
timer.value = UpdateTimer.hour;
|
timer.value = UpdateTimer.hour;
|
||||||
url.text = kRebootDownloadUrl;
|
beforeS20Mirror.text = kRebootBelowS20DownloadUrl;
|
||||||
|
aboveS20Mirror.text = kRebootAboveS20DownloadUrl;
|
||||||
status.value = UpdateStatus.waiting;
|
status.value = UpdateStatus.waiting;
|
||||||
customGameServer.value = false;
|
customGameServer.value = false;
|
||||||
timestamp.value = null;
|
timestamp.value = null;
|
||||||
@@ -109,7 +107,15 @@ class DllController extends GetxController {
|
|||||||
duration: null
|
duration: null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
timestamp.value = await downloadRebootDll(url.text);
|
await Future.wait(
|
||||||
|
[
|
||||||
|
downloadRebootDll(rebootBeforeS20DllFile, beforeS20Mirror.text),
|
||||||
|
downloadRebootDll(rebootAboveS20DllFile, aboveS20Mirror.text),
|
||||||
|
Future.delayed(const Duration(seconds: 1))
|
||||||
|
],
|
||||||
|
eagerError: false
|
||||||
|
);
|
||||||
|
timestamp.value = DateTime.now().millisecondsSinceEpoch;
|
||||||
status.value = UpdateStatus.success;
|
status.value = UpdateStatus.success;
|
||||||
infoBarEntry?.close();
|
infoBarEntry?.close();
|
||||||
if(!silent) {
|
if(!silent) {
|
||||||
@@ -126,15 +132,18 @@ class DllController extends GetxController {
|
|||||||
error = error.contains(": ") ? error.substring(error.indexOf(": ") + 2) : error;
|
error = error.contains(": ") ? error.substring(error.indexOf(": ") + 2) : error;
|
||||||
error = error.toLowerCase();
|
error = error.toLowerCase();
|
||||||
status.value = UpdateStatus.error;
|
status.value = UpdateStatus.error;
|
||||||
showRebootInfoBar(
|
infoBarEntry = showRebootInfoBar(
|
||||||
translations.downloadDllError("reboot.dll", error.toString()),
|
translations.downloadDllError(error.toString(), "reboot.dll"),
|
||||||
duration: infoBarLongDuration,
|
duration: infoBarLongDuration,
|
||||||
severity: InfoBarSeverity.error,
|
severity: InfoBarSeverity.error,
|
||||||
action: Button(
|
action: Button(
|
||||||
onPressed: () => updateGameServerDll(
|
onPressed: () async {
|
||||||
|
infoBarEntry?.close();
|
||||||
|
updateGameServerDll(
|
||||||
force: true,
|
force: true,
|
||||||
silent: silent
|
silent: silent
|
||||||
),
|
);
|
||||||
|
},
|
||||||
child: Text(translations.downloadDllRetry),
|
child: Text(translations.downloadDllRetry),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -144,27 +153,21 @@ class DllController extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(File, bool) getInjectableData(InjectableDll dll) {
|
(File, bool) getInjectableData(Version version, InjectableDll dll) {
|
||||||
final defaultPath = canonicalize(getDefaultDllPath(dll));
|
final defaultPath = canonicalize(getDefaultDllPath(dll));
|
||||||
switch(dll){
|
switch(dll){
|
||||||
case InjectableDll.reboot:
|
case InjectableDll.reboot:
|
||||||
if(customGameServer.value) {
|
if(customGameServer.value) {
|
||||||
final file = File(gameServerDll.text);
|
return (File(gameServerDll.text), true);
|
||||||
if(file.existsSync()) {
|
|
||||||
return (file, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (rebootDllFile, false);
|
return (version.major >= 20 ? rebootAboveS20DllFile : rebootBeforeS20DllFile, false);
|
||||||
case InjectableDll.console:
|
case InjectableDll.console:
|
||||||
final ue4ConsoleFile = File(unrealEngineConsoleDll.text);
|
final ue4ConsoleFile = File(unrealEngineConsoleDll.text);
|
||||||
return (ue4ConsoleFile, canonicalize(ue4ConsoleFile.path) != defaultPath);
|
return (ue4ConsoleFile, canonicalize(ue4ConsoleFile.path) != defaultPath);
|
||||||
case InjectableDll.cobalt:
|
case InjectableDll.starfall:
|
||||||
final backendFile = File(backendDll.text);
|
final backendFile = File(backendDll.text);
|
||||||
return (backendFile, canonicalize(backendFile.path) != defaultPath);
|
return (backendFile, canonicalize(backendFile.path) != defaultPath);
|
||||||
case InjectableDll.memory:
|
|
||||||
final memoryLeakFile = File(memoryLeakDll.text);
|
|
||||||
return (memoryLeakFile, canonicalize(memoryLeakFile.path) != defaultPath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +179,7 @@ class DllController extends GetxController {
|
|||||||
log("[DLL] File name: $fileName");
|
log("[DLL] File name: $fileName");
|
||||||
InfoBarEntry? entry;
|
InfoBarEntry? entry;
|
||||||
try {
|
try {
|
||||||
if (fileName == "reboot.dll") {
|
if (fileName.contains("reboot")) {
|
||||||
log("[DLL] Downloading reboot.dll...");
|
log("[DLL] Downloading reboot.dll...");
|
||||||
return await updateGameServerDll(
|
return await updateGameServerDll(
|
||||||
silent: silent
|
silent: silent
|
||||||
@@ -215,7 +218,7 @@ class DllController extends GetxController {
|
|||||||
error = error.toLowerCase();
|
error = error.toLowerCase();
|
||||||
final completer = Completer();
|
final completer = Completer();
|
||||||
await showRebootInfoBar(
|
await showRebootInfoBar(
|
||||||
translations.downloadDllError(fileName, error.toString()),
|
translations.downloadDllError(error.toString(), fileName),
|
||||||
duration: infoBarLongDuration,
|
duration: infoBarLongDuration,
|
||||||
severity: InfoBarSeverity.error,
|
severity: InfoBarSeverity.error,
|
||||||
onDismissed: () => completer.complete(null),
|
onDismissed: () => completer.complete(null),
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import 'package:reboot_common/common.dart';
|
|||||||
import 'package:reboot_launcher/main.dart';
|
import 'package:reboot_launcher/main.dart';
|
||||||
|
|
||||||
class GameController extends GetxController {
|
class GameController extends GetxController {
|
||||||
static const String storageName = "game_storage";
|
static const String storageName = "v2_game_storage";
|
||||||
|
|
||||||
late final GetStorage? _storage;
|
late final GetStorage? _storage;
|
||||||
late final TextEditingController username;
|
late final TextEditingController username;
|
||||||
|
|||||||
@@ -12,10 +12,12 @@ import 'package:sync/semaphore.dart';
|
|||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
class HostingController extends GetxController {
|
class HostingController extends GetxController {
|
||||||
static const String storageName = "hosting_storage";
|
static const String storageName = "v2_hosting_storage";
|
||||||
|
|
||||||
late final GetStorage? _storage;
|
late final GetStorage? _storage;
|
||||||
late final String uuid;
|
late final String uuid;
|
||||||
|
late final TextEditingController accountUsername;
|
||||||
|
late final TextEditingController accountPassword;
|
||||||
late final TextEditingController name;
|
late final TextEditingController name;
|
||||||
late final FocusNode nameFocusNode;
|
late final FocusNode nameFocusNode;
|
||||||
late final TextEditingController description;
|
late final TextEditingController description;
|
||||||
@@ -37,6 +39,10 @@ class HostingController extends GetxController {
|
|||||||
_storage = appWithNoStorage ? null : GetStorage(storageName);
|
_storage = appWithNoStorage ? null : GetStorage(storageName);
|
||||||
uuid = _storage?.read("uuid") ?? const Uuid().v4();
|
uuid = _storage?.read("uuid") ?? const Uuid().v4();
|
||||||
_storage?.write("uuid", uuid);
|
_storage?.write("uuid", uuid);
|
||||||
|
accountUsername = TextEditingController(text: _storage?.read("account_username") ?? kDefaultHostName);
|
||||||
|
accountUsername.addListener(() => _storage?.write("account_username", accountUsername.text));
|
||||||
|
accountPassword = TextEditingController(text: _storage?.read("account_password") ?? "");
|
||||||
|
accountPassword.addListener(() => _storage?.write("account_password", password.text));
|
||||||
name = TextEditingController(text: _storage?.read("name"));
|
name = TextEditingController(text: _storage?.read("name"));
|
||||||
name.addListener(() => _storage?.write("name", name.text));
|
name.addListener(() => _storage?.write("name", name.text));
|
||||||
description = TextEditingController(text: _storage?.read("description"));
|
description = TextEditingController(text: _storage?.read("description"));
|
||||||
@@ -56,20 +62,36 @@ class HostingController extends GetxController {
|
|||||||
published = RxBool(false);
|
published = RxBool(false);
|
||||||
showPassword = RxBool(false);
|
showPassword = RxBool(false);
|
||||||
instance = Rxn();
|
instance = Rxn();
|
||||||
final supabase = Supabase.instance.client;
|
|
||||||
servers = Rxn();
|
servers = Rxn();
|
||||||
supabase.from("hosting_v2")
|
_listenServers();
|
||||||
.stream(primaryKey: ['id'])
|
|
||||||
.map((event) => event.map((element) => FortniteServer.fromJson(element)).where((element) => element.ip.isNotEmpty).toSet())
|
|
||||||
.listen((event) {
|
|
||||||
servers.value = event;
|
|
||||||
published.value = event.any((element) => element.id == uuid);
|
|
||||||
});
|
|
||||||
customLaunchArgs = TextEditingController(text: _storage?.read("custom_launch_args") ?? "");
|
customLaunchArgs = TextEditingController(text: _storage?.read("custom_launch_args") ?? "");
|
||||||
customLaunchArgs.addListener(() => _storage?.write("custom_launch_args", customLaunchArgs.text));
|
customLaunchArgs.addListener(() => _storage?.write("custom_launch_args", customLaunchArgs.text));
|
||||||
_semaphore = Semaphore();
|
_semaphore = Semaphore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _listenServers([int attempt = 0]) {
|
||||||
|
log("[SUPABASE] Listening...");
|
||||||
|
final supabase = Supabase.instance.client;
|
||||||
|
supabase.from("hosting_v2")
|
||||||
|
.stream(primaryKey: ['id'])
|
||||||
|
.map((event) => event.map((element) => FortniteServer.fromJson(element)).where((element) => element.ip.isNotEmpty).toSet())
|
||||||
|
.listen(
|
||||||
|
_onNewServer,
|
||||||
|
onError: (error) async {
|
||||||
|
log("[SUPABASE] Error: ${error}");
|
||||||
|
await Future.delayed(Duration(seconds: attempt * 5));
|
||||||
|
_listenServers(attempt + 1);
|
||||||
|
},
|
||||||
|
cancelOnError: true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onNewServer(Set<FortniteServer> event) {
|
||||||
|
log("[SUPABASE] New event: ${event}");
|
||||||
|
servers.value = event;
|
||||||
|
published.value = event.any((element) => element.id == uuid);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> publishServer(String author, String version) async {
|
Future<void> publishServer(String author, String version) async {
|
||||||
try {
|
try {
|
||||||
_semaphore.acquire();
|
_semaphore.acquire();
|
||||||
@@ -136,6 +158,8 @@ class HostingController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
|
accountUsername.text = kDefaultHostName;
|
||||||
|
accountPassword.text = "";
|
||||||
name.text = "";
|
name.text = "";
|
||||||
description.text = "";
|
description.text = "";
|
||||||
showPassword.value = false;
|
showPassword.value = false;
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:fluent_ui/fluent_ui.dart';
|
import 'package:fluent_ui/fluent_ui.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:get_storage/get_storage.dart';
|
import 'package:get_storage/get_storage.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:path/path.dart';
|
|
||||||
import 'package:reboot_common/common.dart';
|
import 'package:reboot_common/common.dart';
|
||||||
import 'package:reboot_launcher/main.dart';
|
import 'package:reboot_launcher/main.dart';
|
||||||
import 'package:reboot_launcher/src/messenger/abstract/info_bar.dart';
|
import 'package:reboot_launcher/src/messenger/abstract/info_bar.dart';
|
||||||
@@ -15,13 +13,12 @@ import 'package:version/version.dart';
|
|||||||
import 'package:yaml/yaml.dart';
|
import 'package:yaml/yaml.dart';
|
||||||
|
|
||||||
class SettingsController extends GetxController {
|
class SettingsController extends GetxController {
|
||||||
static const String storageName = "settings_storage";
|
static const String storageName = "v2_settings_storage";
|
||||||
|
|
||||||
late final GetStorage? _storage;
|
late final GetStorage? _storage;
|
||||||
late final RxString language;
|
late final RxString language;
|
||||||
late final Rx<ThemeMode> themeMode;
|
late final Rx<ThemeMode> themeMode;
|
||||||
late final RxBool firstRun;
|
late final RxBool firstRun;
|
||||||
late final RxBool debug;
|
|
||||||
late double width;
|
late double width;
|
||||||
late double height;
|
late double height;
|
||||||
late double? offsetX;
|
late double? offsetX;
|
||||||
@@ -39,7 +36,6 @@ class SettingsController extends GetxController {
|
|||||||
language.listen((value) => _storage?.write("language", value));
|
language.listen((value) => _storage?.write("language", value));
|
||||||
firstRun = RxBool(_storage?.read("first_run_tutorial") ?? true);
|
firstRun = RxBool(_storage?.read("first_run_tutorial") ?? true);
|
||||||
firstRun.listen((value) => _storage?.write("first_run_tutorial", value));
|
firstRun.listen((value) => _storage?.write("first_run_tutorial", value));
|
||||||
debug = RxBool(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveWindowSize(Size size) {
|
void saveWindowSize(Size size) {
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ class _DialogButtonState extends State<DialogButton> {
|
|||||||
|
|
||||||
Widget get _primaryButton => Button(
|
Widget get _primaryButton => Button(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
backgroundColor: ButtonState.all(FluentTheme.of(context).accentColor)
|
backgroundColor: WidgetStateProperty.all(FluentTheme.of(context).accentColor)
|
||||||
),
|
),
|
||||||
onPressed: widget.onTap!,
|
onPressed: widget.onTap!,
|
||||||
child: Text(widget.text!),
|
child: Text(widget.text!),
|
||||||
@@ -308,7 +308,7 @@ class _DialogButtonState extends State<DialogButton> {
|
|||||||
|
|
||||||
Widget get _secondaryButton => Button(
|
Widget get _secondaryButton => Button(
|
||||||
style: widget.color != null ? ButtonStyle(
|
style: widget.color != null ? ButtonStyle(
|
||||||
backgroundColor: ButtonState.all(widget.color!)
|
backgroundColor: WidgetStateProperty.all(widget.color!)
|
||||||
) : null,
|
) : null,
|
||||||
onPressed: widget.onTap ?? _onDefaultSecondaryActionTap,
|
onPressed: widget.onTap ?? _onDefaultSecondaryActionTap,
|
||||||
child: Text(widget.text ?? translations.defaultDialogSecondaryAction),
|
child: Text(widget.text ?? translations.defaultDialogSecondaryAction),
|
||||||
|
|||||||
@@ -18,9 +18,12 @@ void onError(Object exception, StackTrace? stackTrace, bool framework) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lastError = exception.toString();
|
lastError = exception.toString();
|
||||||
final route = ModalRoute.of(pageKey.currentContext!);
|
if(inDialog){
|
||||||
if(route != null && !route.isCurrent){
|
final context = pageKey.currentContext;
|
||||||
Navigator.of(pageKey.currentContext!).pop(false);
|
if(context != null) {
|
||||||
|
Navigator.of(context).pop(false);
|
||||||
|
inDialog = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) => showRebootDialog(
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) => showRebootDialog(
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import 'package:reboot_launcher/src/util/translations.dart';
|
|||||||
import 'package:reboot_launcher/src/widget/version_selector.dart';
|
import 'package:reboot_launcher/src/widget/version_selector.dart';
|
||||||
|
|
||||||
void startOnboarding() {
|
void startOnboarding() {
|
||||||
|
final gameController = Get.find<GameController>();
|
||||||
final settingsController = Get.find<SettingsController>();
|
final settingsController = Get.find<SettingsController>();
|
||||||
settingsController.firstRun.value = false;
|
settingsController.firstRun.value = false;
|
||||||
profileOverlayKey.currentState!.showOverlay(
|
profileOverlayKey.currentState!.showOverlay(
|
||||||
@@ -27,7 +28,7 @@ void startOnboarding() {
|
|||||||
label: translations.startOnboardingActionLabel,
|
label: translations.startOnboardingActionLabel,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
onClose();
|
onClose();
|
||||||
await showProfileForm(context);
|
await showProfileForm(context, gameController.username, gameController.password);
|
||||||
_promptPlayPage();
|
_promptPlayPage();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -62,7 +63,7 @@ void _promptPlayVersion() {
|
|||||||
onTap: () async {
|
onTap: () async {
|
||||||
onClose();
|
onClose();
|
||||||
if(!hasBuilds) {
|
if(!hasBuilds) {
|
||||||
await VersionSelector.openDownloadDialog(closable: false);
|
await VersionSelector.openDownloadDialog();
|
||||||
}
|
}
|
||||||
_promptServerBrowserPage();
|
_promptServerBrowserPage();
|
||||||
}
|
}
|
||||||
@@ -78,6 +79,22 @@ void _promptServerBrowserPage() {
|
|||||||
context: context,
|
context: context,
|
||||||
label: translations.promptServerBrowserPageActionLabel,
|
label: translations.promptServerBrowserPageActionLabel,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
onClose();
|
||||||
|
_promptHostAccount();
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _promptHostAccount() {
|
||||||
|
pageIndex.value = RebootPageType.host.index;
|
||||||
|
profileOverlayKey.currentState!.showOverlay(
|
||||||
|
text: translations.hostAccountText,
|
||||||
|
offset: Offset(27.5, 17.5),
|
||||||
|
actionBuilder: (context, onClose) => _buildActionButton(
|
||||||
|
context: context,
|
||||||
|
label: translations.hostAccountAction,
|
||||||
|
onTap: () async {
|
||||||
onClose();
|
onClose();
|
||||||
_promptHostPage();
|
_promptHostPage();
|
||||||
}
|
}
|
||||||
@@ -86,7 +103,6 @@ void _promptServerBrowserPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _promptHostPage() {
|
void _promptHostPage() {
|
||||||
pageIndex.value = RebootPageType.host.index;
|
|
||||||
pageOverlayTargetKey.currentState!.showOverlay(
|
pageOverlayTargetKey.currentState!.showOverlay(
|
||||||
text: translations.promptHostPageText,
|
text: translations.promptHostPageText,
|
||||||
actionBuilder: (context, onClose) => _buildActionButton(
|
actionBuilder: (context, onClose) => _buildActionButton(
|
||||||
@@ -339,7 +355,7 @@ Widget _buildActionButton({
|
|||||||
required void Function() onTap,
|
required void Function() onTap,
|
||||||
}) => Button(
|
}) => Button(
|
||||||
style: themed ? ButtonStyle(
|
style: themed ? ButtonStyle(
|
||||||
backgroundColor: ButtonState.all(FluentTheme.of(context).accentColor)
|
backgroundColor: WidgetStateProperty.all(FluentTheme.of(context).accentColor)
|
||||||
) : null,
|
) : null,
|
||||||
child: Text(label),
|
child: Text(label),
|
||||||
onPressed: onTap
|
onPressed: onTap
|
||||||
|
|||||||
@@ -6,13 +6,11 @@ import 'package:reboot_launcher/src/controller/game_controller.dart';
|
|||||||
import 'package:reboot_launcher/src/messenger/abstract/dialog.dart';
|
import 'package:reboot_launcher/src/messenger/abstract/dialog.dart';
|
||||||
import 'package:reboot_launcher/src/util/translations.dart';
|
import 'package:reboot_launcher/src/util/translations.dart';
|
||||||
|
|
||||||
final GameController _gameController = Get.find<GameController>();
|
Future<bool> showProfileForm(BuildContext context, TextEditingController username, TextEditingController password) async{
|
||||||
|
|
||||||
Future<bool> showProfileForm(BuildContext context) async{
|
|
||||||
final showPassword = RxBool(false);
|
final showPassword = RxBool(false);
|
||||||
final oldUsername = _gameController.username.text;
|
final oldUsername = username.text;
|
||||||
final showPasswordTrailing = RxBool(oldUsername.isNotEmpty);
|
final showPasswordTrailing = RxBool(oldUsername.isNotEmpty);
|
||||||
final oldPassword = _gameController.password.text;
|
final oldPassword = password.text;
|
||||||
final result = await showRebootDialog<bool?>(
|
final result = await showRebootDialog<bool?>(
|
||||||
builder: (context) => Obx(() => FormDialog(
|
builder: (context) => Obx(() => FormDialog(
|
||||||
content: Column(
|
content: Column(
|
||||||
@@ -25,17 +23,17 @@ Future<bool> showProfileForm(BuildContext context) async{
|
|||||||
child: TextFormBox(
|
child: TextFormBox(
|
||||||
placeholder: translations.usernameOrEmailPlaceholder,
|
placeholder: translations.usernameOrEmailPlaceholder,
|
||||||
validator: (text) {
|
validator: (text) {
|
||||||
if(_gameController.password.text.isEmpty) {
|
if(password.text.isEmpty) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(EmailValidator.validate(_gameController.username.text)) {
|
if(EmailValidator.validate(username.text)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return translations.invalidEmail;
|
return translations.invalidEmail;
|
||||||
},
|
},
|
||||||
controller: _gameController.username,
|
controller: username,
|
||||||
autovalidateMode: AutovalidateMode.always,
|
autovalidateMode: AutovalidateMode.always,
|
||||||
enableSuggestions: true,
|
enableSuggestions: true,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
@@ -47,7 +45,7 @@ Future<bool> showProfileForm(BuildContext context) async{
|
|||||||
label: translations.password,
|
label: translations.password,
|
||||||
child: TextFormBox(
|
child: TextFormBox(
|
||||||
placeholder: translations.passwordPlaceholder,
|
placeholder: translations.passwordPlaceholder,
|
||||||
controller: _gameController.password,
|
controller: password,
|
||||||
autovalidateMode: AutovalidateMode.always,
|
autovalidateMode: AutovalidateMode.always,
|
||||||
obscureText: !showPassword.value,
|
obscureText: !showPassword.value,
|
||||||
enableSuggestions: false,
|
enableSuggestions: false,
|
||||||
@@ -56,8 +54,8 @@ Future<bool> showProfileForm(BuildContext context) async{
|
|||||||
suffix: Button(
|
suffix: Button(
|
||||||
onPressed: () => showPassword.value = !showPassword.value,
|
onPressed: () => showPassword.value = !showPassword.value,
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
shape: ButtonState.all(const CircleBorder()),
|
shape: WidgetStateProperty.all(const CircleBorder()),
|
||||||
backgroundColor: ButtonState.all(Colors.transparent)
|
backgroundColor: WidgetStateProperty.all(Colors.transparent)
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
showPassword.value ? Icons.visibility_off : Icons.visibility,
|
showPassword.value ? Icons.visibility_off : Icons.visibility,
|
||||||
@@ -87,7 +85,7 @@ Future<bool> showProfileForm(BuildContext context) async{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_gameController.username.text = oldUsername;
|
username.text = oldUsername;
|
||||||
_gameController.password.text = oldPassword;
|
password.text = oldPassword;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,8 +257,8 @@ extension ServerControllerDialog on BackendController {
|
|||||||
suffix: !showPasswordTrailing.value ? null : Button(
|
suffix: !showPasswordTrailing.value ? null : Button(
|
||||||
onPressed: () => showPassword.value = !showPassword.value,
|
onPressed: () => showPassword.value = !showPassword.value,
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
shape: ButtonState.all(const CircleBorder()),
|
shape: WidgetStateProperty.all(const CircleBorder()),
|
||||||
backgroundColor: ButtonState.all(Colors.transparent)
|
backgroundColor: WidgetStateProperty.all(Colors.transparent)
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
showPassword.value ? FluentIcons.eye_off_24_regular : FluentIcons.eye_24_regular
|
showPassword.value ? FluentIcons.eye_off_24_regular : FluentIcons.eye_24_regular
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import 'package:reboot_common/common.dart';
|
|||||||
import 'package:reboot_launcher/src/controller/game_controller.dart';
|
import 'package:reboot_launcher/src/controller/game_controller.dart';
|
||||||
import 'package:reboot_launcher/src/messenger/abstract/dialog.dart';
|
import 'package:reboot_launcher/src/messenger/abstract/dialog.dart';
|
||||||
import 'package:reboot_launcher/src/util/translations.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:reboot_launcher/src/widget/file_selector.dart';
|
||||||
import 'package:universal_disk_space/universal_disk_space.dart';
|
import 'package:universal_disk_space/universal_disk_space.dart';
|
||||||
import 'package:windows_taskbar/windows_taskbar.dart';
|
import 'package:windows_taskbar/windows_taskbar.dart';
|
||||||
@@ -32,12 +33,12 @@ class _AddVersionDialogState extends State<AddVersionDialog> {
|
|||||||
final Rxn<FortniteBuild> _build = Rxn();
|
final Rxn<FortniteBuild> _build = Rxn();
|
||||||
final RxnInt _timeLeft = RxnInt();
|
final RxnInt _timeLeft = RxnInt();
|
||||||
final Rxn<double> _progress = Rxn();
|
final Rxn<double> _progress = Rxn();
|
||||||
|
final RxInt _speed = RxInt(0);
|
||||||
|
|
||||||
late DiskSpace _diskSpace;
|
late DiskSpace _diskSpace;
|
||||||
late Future<List<FortniteBuild>> _fetchFuture;
|
late Future<List<FortniteBuild>> _fetchFuture;
|
||||||
late Future _diskFuture;
|
late Future _diskFuture;
|
||||||
|
|
||||||
Isolate? _isolate;
|
|
||||||
SendPort? _downloadPort;
|
SendPort? _downloadPort;
|
||||||
Object? _error;
|
Object? _error;
|
||||||
StackTrace? _stackTrace;
|
StackTrace? _stackTrace;
|
||||||
@@ -59,9 +60,8 @@ class _AddVersionDialogState extends State<AddVersionDialog> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _cancelDownload() {
|
void _cancelDownload() {
|
||||||
Process.run('${assetsDirectory.path}\\build\\stop.bat', []);
|
|
||||||
_downloadPort?.send(kStopBuildDownloadSignal);
|
_downloadPort?.send(kStopBuildDownloadSignal);
|
||||||
_isolate?.kill(priority: Isolate.immediate);
|
WindowsTaskbar.setProgressMode(TaskbarProgressMode.noProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -102,7 +102,12 @@ class _AddVersionDialogState extends State<AddVersionDialog> {
|
|||||||
return ErrorDialog(
|
return ErrorDialog(
|
||||||
exception: _error ?? Exception(translations.unknownError),
|
exception: _error ?? Exception(translations.unknownError),
|
||||||
stackTrace: _stackTrace,
|
stackTrace: _stackTrace,
|
||||||
errorMessageBuilder: (exception) => translations.downloadVersionError(exception.toString())
|
errorMessageBuilder: (exception) {
|
||||||
|
var error = exception.toString();
|
||||||
|
error = error.after("Error: ")?.replaceAll(":", ",") ?? error.after(": ") ?? error;
|
||||||
|
error = error.toLowerCase();
|
||||||
|
return translations.downloadVersionError(error);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
case _DownloadStatus.done:
|
case _DownloadStatus.done:
|
||||||
return InfoDialog(
|
return InfoDialog(
|
||||||
@@ -151,7 +156,7 @@ class _AddVersionDialogState extends State<AddVersionDialog> {
|
|||||||
final communicationPort = ReceivePort();
|
final communicationPort = ReceivePort();
|
||||||
communicationPort.listen((message) {
|
communicationPort.listen((message) {
|
||||||
if(message is FortniteBuildDownloadProgress) {
|
if(message is FortniteBuildDownloadProgress) {
|
||||||
_onProgress(build, message.progress, message.minutesLeft, message.extracting);
|
_onProgress(build, message);
|
||||||
}else if(message is SendPort) {
|
}else if(message is SendPort) {
|
||||||
_downloadPort = message;
|
_downloadPort = message;
|
||||||
}else {
|
}else {
|
||||||
@@ -165,7 +170,7 @@ class _AddVersionDialogState extends State<AddVersionDialog> {
|
|||||||
);
|
);
|
||||||
final errorPort = ReceivePort();
|
final errorPort = ReceivePort();
|
||||||
errorPort.listen((message) => _onDownloadError(message, null));
|
errorPort.listen((message) => _onDownloadError(message, null));
|
||||||
_isolate = await Isolate.spawn(
|
await Isolate.spawn(
|
||||||
downloadArchiveBuild,
|
downloadArchiveBuild,
|
||||||
options,
|
options,
|
||||||
onError: errorPort.sendPort,
|
onError: errorPort.sendPort,
|
||||||
@@ -205,23 +210,24 @@ class _AddVersionDialogState extends State<AddVersionDialog> {
|
|||||||
_stackTrace = stackTrace;
|
_stackTrace = stackTrace;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onProgress(FortniteBuild build, double progress, int? timeLeft, bool extracting) {
|
void _onProgress(FortniteBuild build, FortniteBuildDownloadProgress message) {
|
||||||
if (!mounted) {
|
if (!mounted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(progress >= 100 && extracting) {
|
if(message.progress >= 100 && message.extracting) {
|
||||||
_onDownloadComplete(build);
|
_onDownloadComplete(build);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_status.value = extracting ? _DownloadStatus.extracting : _DownloadStatus.downloading;
|
_status.value = message.extracting ? _DownloadStatus.extracting : _DownloadStatus.downloading;
|
||||||
if(progress >= 0) {
|
if(message.progress >= 0) {
|
||||||
WindowsTaskbar.setProgress(progress.round(), 100);
|
WindowsTaskbar.setProgress(message.progress.round(), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
_timeLeft.value = timeLeft;
|
_timeLeft.value = message.timeLeft;
|
||||||
_progress.value = progress;
|
_progress.value = message.progress;
|
||||||
|
_speed.value = message.speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget get _progressBody {
|
Widget get _progressBody {
|
||||||
@@ -232,16 +238,18 @@ class _AddVersionDialogState extends State<AddVersionDialog> {
|
|||||||
Align(
|
Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Text(
|
child: Text(
|
||||||
_status.value == _DownloadStatus.downloading ? translations.downloading : translations.extracting,
|
_statusText,
|
||||||
style: FluentTheme.maybeOf(context)?.typography.body,
|
style: FluentTheme.maybeOf(context)?.typography.body,
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
if(_progress.value != null && !_isAllocatingDiskSpace)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 8.0,
|
height: 8.0,
|
||||||
),
|
),
|
||||||
|
|
||||||
|
if(_progress.value != null && !_isAllocatingDiskSpace)
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@@ -264,7 +272,7 @@ class _AddVersionDialogState extends State<AddVersionDialog> {
|
|||||||
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: ProgressBar(value: (_progress.value ?? 0).toDouble())
|
child: ProgressBar(value: _isAllocatingDiskSpace ? null : _progress.value?.toDouble())
|
||||||
),
|
),
|
||||||
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
@@ -274,7 +282,26 @@ class _AddVersionDialogState extends State<AddVersionDialog> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildFormBody(List<FortniteBuild> builds) => Column(
|
String get _statusText {
|
||||||
|
if (_status.value != _DownloadStatus.downloading) {
|
||||||
|
return translations.extracting;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_progress.value == null) {
|
||||||
|
return translations.startingDownload;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_speed.value == 0) {
|
||||||
|
return translations.allocatingSpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
return translations.downloading;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get _isAllocatingDiskSpace => _status.value == _DownloadStatus.downloading && _speed.value == 0;
|
||||||
|
|
||||||
|
Widget _buildFormBody(List<FortniteBuild> builds) {
|
||||||
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@@ -292,7 +319,8 @@ class _AddVersionDialogState extends State<AddVersionDialog> {
|
|||||||
windowTitle: _source.value == _BuildSource.local ? translations.gameFolderPlaceWindowTitle : translations.buildInstallationDirectoryWindowTitle,
|
windowTitle: _source.value == _BuildSource.local ? translations.gameFolderPlaceWindowTitle : translations.buildInstallationDirectoryWindowTitle,
|
||||||
controller: _pathController,
|
controller: _pathController,
|
||||||
validator: _source.value == _BuildSource.local ? _checkGameFolder : _checkDownloadDestination,
|
validator: _source.value == _BuildSource.local ? _checkGameFolder : _checkDownloadDestination,
|
||||||
folder: true
|
folder: true,
|
||||||
|
allowNavigator: true
|
||||||
),
|
),
|
||||||
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
@@ -300,6 +328,7 @@ class _AddVersionDialogState extends State<AddVersionDialog> {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
String? _checkGameFolder(text) {
|
String? _checkGameFolder(text) {
|
||||||
if (text == null || text.isEmpty) {
|
if (text == null || text.isEmpty) {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:fluent_ui/fluent_ui.dart';
|
import 'package:fluent_ui/fluent_ui.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart';
|
|
||||||
import 'package:reboot_launcher/src/controller/settings_controller.dart';
|
import 'package:reboot_launcher/src/controller/settings_controller.dart';
|
||||||
import 'package:reboot_launcher/src/messenger/implementation/onboard.dart';
|
import 'package:reboot_launcher/src/messenger/implementation/onboard.dart';
|
||||||
import 'package:reboot_launcher/src/page/abstract/page_type.dart';
|
import 'package:reboot_launcher/src/page/abstract/page_type.dart';
|
||||||
@@ -35,7 +34,6 @@ abstract class RebootPageState<T extends RebootPage> extends State<T> with Autom
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_buildFirstLaunchInfo(),
|
_buildFirstLaunchInfo(),
|
||||||
_buildDebugInfo(),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _listView
|
child: _listView
|
||||||
)
|
)
|
||||||
@@ -47,7 +45,6 @@ abstract class RebootPageState<T extends RebootPage> extends State<T> with Autom
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_buildFirstLaunchInfo(),
|
_buildFirstLaunchInfo(),
|
||||||
_buildDebugInfo(),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -99,35 +96,6 @@ abstract class RebootPageState<T extends RebootPage> extends State<T> with Autom
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
Widget _buildDebugInfo() => Obx(() {
|
|
||||||
if(!_settingsController.debug.value) {
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
bottom: 8.0
|
|
||||||
),
|
|
||||||
child: SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
child: InfoBar(
|
|
||||||
title: Text("Debug mode is enabled"),
|
|
||||||
severity: InfoBarSeverity.warning,
|
|
||||||
isLong: true,
|
|
||||||
content: SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
child: Text( "• Automatic dll injection is disabled\n"
|
|
||||||
"• The game server cannot start automatically\n"
|
|
||||||
"• The game server runs in a normal window")
|
|
||||||
),
|
|
||||||
onClose: () {
|
|
||||||
_settingsController.debug.value = false;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
ListView get _listView => ListView.builder(
|
ListView get _listView => ListView.builder(
|
||||||
itemCount: settings.length,
|
itemCount: settings.length,
|
||||||
itemBuilder: (context, index) => settings[index],
|
itemBuilder: (context, index) => settings[index],
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:reboot_common/common.dart';
|
import 'package:reboot_common/common.dart';
|
||||||
import 'package:reboot_launcher/src/controller/backend_controller.dart';
|
import 'package:reboot_launcher/src/controller/backend_controller.dart';
|
||||||
import 'package:reboot_launcher/src/controller/game_controller.dart';
|
|
||||||
import 'package:reboot_launcher/src/messenger/abstract/info_bar.dart';
|
import 'package:reboot_launcher/src/messenger/abstract/info_bar.dart';
|
||||||
import 'package:reboot_launcher/src/messenger/abstract/overlay.dart';
|
import 'package:reboot_launcher/src/messenger/abstract/overlay.dart';
|
||||||
import 'package:reboot_launcher/src/messenger/implementation/data.dart';
|
import 'package:reboot_launcher/src/messenger/implementation/data.dart';
|
||||||
@@ -153,9 +152,9 @@ class _BackendPageState extends RebootPageState<BackendPage> {
|
|||||||
contentWidth: null,
|
contentWidth: null,
|
||||||
content: Row(
|
content: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Obx(() => Text(
|
||||||
_backendController.detached.value ? translations.on : translations.off
|
_backendController.detached.value ? translations.on : translations.off
|
||||||
),
|
)),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 16.0
|
width: 16.0
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -276,8 +276,8 @@ class _BrowsePageState extends RebootPageState<BrowsePage> {
|
|||||||
_filterControllerStream.add("");
|
_filterControllerStream.add("");
|
||||||
},
|
},
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
backgroundColor: ButtonState.all(Colors.transparent),
|
backgroundColor: WidgetStateProperty.all(Colors.transparent),
|
||||||
shape: ButtonState.all(Border())
|
shape: WidgetStateProperty.all(Border())
|
||||||
),
|
),
|
||||||
child: _searchBarIconData
|
child: _searchBarIconData
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'dart:io';
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:app_links/app_links.dart';
|
import 'package:app_links/app_links.dart';
|
||||||
import 'package:bitsdojo_window/bitsdojo_window.dart';
|
|
||||||
import 'package:fluent_ui/fluent_ui.dart';
|
import 'package:fluent_ui/fluent_ui.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart' show MaterialPage;
|
import 'package:flutter/material.dart' show MaterialPage;
|
||||||
@@ -27,6 +26,7 @@ import 'package:reboot_launcher/src/util/translations.dart';
|
|||||||
import 'package:reboot_launcher/src/widget/info_bar_area.dart';
|
import 'package:reboot_launcher/src/widget/info_bar_area.dart';
|
||||||
import 'package:reboot_launcher/src/widget/profile_tile.dart';
|
import 'package:reboot_launcher/src/widget/profile_tile.dart';
|
||||||
import 'package:reboot_launcher/src/widget/title_bar.dart';
|
import 'package:reboot_launcher/src/widget/title_bar.dart';
|
||||||
|
import 'package:version/version.dart';
|
||||||
import 'package:window_manager/window_manager.dart';
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
final GlobalKey<OverlayTargetState> profileOverlayKey = GlobalKey();
|
final GlobalKey<OverlayTargetState> profileOverlayKey = GlobalKey();
|
||||||
@@ -58,7 +58,6 @@ class _HomePageState extends State<HomePage> with WindowListener, AutomaticKeepA
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
windowManager.setPreventClose(true);
|
|
||||||
windowManager.addListener(this);
|
windowManager.addListener(this);
|
||||||
_syncPageViewWithNavigator();
|
_syncPageViewWithNavigator();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
@@ -111,7 +110,7 @@ class _HomePageState extends State<HomePage> with WindowListener, AutomaticKeepA
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = await pingGameServer(address);
|
final result = await pingGameServer(address);
|
||||||
if(result) {
|
if(result) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -135,13 +134,12 @@ class _HomePageState extends State<HomePage> with WindowListener, AutomaticKeepA
|
|||||||
dllsDirectory.createSync(recursive: true);
|
dllsDirectory.createSync(recursive: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final dummy = Version.parse("1");
|
||||||
|
final dummyS20 = Version.parse("20");
|
||||||
for(final injectable in InjectableDll.values) {
|
for(final injectable in InjectableDll.values) {
|
||||||
final (file, custom) = _dllController.getInjectableData(injectable);
|
_downloadDll(dummy, injectable);
|
||||||
if(!custom) {
|
if(injectable.isVersionDependent) {
|
||||||
_dllController.downloadCriticalDllInteractive(
|
_downloadDll(dummyS20, injectable);
|
||||||
file.path,
|
|
||||||
silent: true
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,12 +148,25 @@ class _HomePageState extends State<HomePage> with WindowListener, AutomaticKeepA
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _downloadDll(Version version, InjectableDll injectable) {
|
||||||
|
final (file, custom) = _dllController.getInjectableData(version, injectable);
|
||||||
|
if(!custom) {
|
||||||
|
_dllController.downloadCriticalDllInteractive(
|
||||||
|
file.path,
|
||||||
|
silent: false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onWindowClose() async {
|
void onWindowClose() async {
|
||||||
try {
|
try {
|
||||||
await _hostingController.discardServer();
|
await _hostingController.discardServer();
|
||||||
|
}catch(error) {
|
||||||
|
log("[HOSTING] Cannot discard server: $error");
|
||||||
}finally {
|
}finally {
|
||||||
exit(0); // Force closing
|
// Force closing because the backend might be running, but we want the process to exit
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,14 +231,18 @@ class _HomePageState extends State<HomePage> with WindowListener, AutomaticKeepA
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onWindowResized() {
|
void onWindowResized() {
|
||||||
_settingsController.saveWindowSize(appWindow.size);
|
|
||||||
_focused.value = true;
|
_focused.value = true;
|
||||||
|
windowManager.getSize().then((size) {
|
||||||
|
_settingsController.saveWindowSize(size);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onWindowMoved() {
|
void onWindowMoved() {
|
||||||
_settingsController.saveWindowOffset(appWindow.position);
|
|
||||||
_focused.value = true;
|
_focused.value = true;
|
||||||
|
windowManager.getPosition().then((position) {
|
||||||
|
_settingsController.saveWindowOffset(position);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -298,8 +313,7 @@ class _HomePageState extends State<HomePage> with WindowListener, AutomaticKeepA
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildBody() {
|
Widget _buildBody() => Expanded(
|
||||||
return Expanded(
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
left: HomePage.kDefaultPadding,
|
left: HomePage.kDefaultPadding,
|
||||||
@@ -339,7 +353,6 @@ class _HomePageState extends State<HomePage> with WindowListener, AutomaticKeepA
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildBodyContent() => PageView.builder(
|
Widget _buildBodyContent() => PageView.builder(
|
||||||
controller: _pageController,
|
controller: _pageController,
|
||||||
@@ -451,9 +464,12 @@ class _HomePageState extends State<HomePage> with WindowListener, AutomaticKeepA
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
ProfileWidget(
|
Obx(() {
|
||||||
|
pageIndex.value;
|
||||||
|
return ProfileWidget(
|
||||||
overlayKey: profileOverlayKey
|
overlayKey: profileOverlayKey
|
||||||
),
|
);
|
||||||
|
}),
|
||||||
_autoSuggestBox,
|
_autoSuggestBox,
|
||||||
const SizedBox(height: 12.0),
|
const SizedBox(height: 12.0),
|
||||||
_buildNavigationTrail()
|
_buildNavigationTrail()
|
||||||
@@ -500,7 +516,7 @@ class _HomePageState extends State<HomePage> with WindowListener, AutomaticKeepA
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ButtonThemeData.uncheckedInputColor(
|
color: ButtonThemeData.uncheckedInputColor(
|
||||||
FluentTheme.of(context),
|
FluentTheme.of(context),
|
||||||
pageIndex.value == index ? {ButtonStates.hovering} : states,
|
pageIndex.value == index ? {WidgetState.hovered} : states,
|
||||||
transparentWhenNone: true,
|
transparentWhenNone: true,
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.all(Radius.circular(6.0))
|
borderRadius: BorderRadius.all(Radius.circular(6.0))
|
||||||
@@ -529,12 +545,12 @@ class _HomePageState extends State<HomePage> with WindowListener, AutomaticKeepA
|
|||||||
stream: pagesController.stream,
|
stream: pagesController.stream,
|
||||||
builder: (context, _) => Button(
|
builder: (context, _) => Button(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
padding: ButtonState.all(const EdgeInsets.symmetric(
|
padding: WidgetStateProperty.all(const EdgeInsets.symmetric(
|
||||||
vertical: 12.0,
|
vertical: 12.0,
|
||||||
horizontal: 16.0
|
horizontal: 16.0
|
||||||
)),
|
)),
|
||||||
backgroundColor: ButtonState.all(Colors.transparent),
|
backgroundColor: WidgetStateProperty.all(Colors.transparent),
|
||||||
shape: ButtonState.all(Border())
|
shape: WidgetStateProperty.all(Border())
|
||||||
),
|
),
|
||||||
onPressed: appStack.isEmpty && !inDialog ? null : () {
|
onPressed: appStack.isEmpty && !inDialog ? null : () {
|
||||||
if(inDialog) {
|
if(inDialog) {
|
||||||
@@ -556,7 +572,7 @@ class _HomePageState extends State<HomePage> with WindowListener, AutomaticKeepA
|
|||||||
);
|
);
|
||||||
|
|
||||||
GestureDetector get _draggableArea => GestureDetector(
|
GestureDetector get _draggableArea => GestureDetector(
|
||||||
onDoubleTap: appWindow.maximizeOrRestore,
|
onDoubleTap: windowManager.maximizeOrRestore,
|
||||||
onHorizontalDragStart: (_) => windowManager.startDragging(),
|
onHorizontalDragStart: (_) => windowManager.startDragging(),
|
||||||
onVerticalDragStart: (_) => windowManager.startDragging()
|
onVerticalDragStart: (_) => windowManager.startDragging()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ class HostPage extends RebootPage {
|
|||||||
class _HostingPageState extends RebootPageState<HostPage> {
|
class _HostingPageState extends RebootPageState<HostPage> {
|
||||||
final GameController _gameController = Get.find<GameController>();
|
final GameController _gameController = Get.find<GameController>();
|
||||||
final HostingController _hostingController = Get.find<HostingController>();
|
final HostingController _hostingController = Get.find<HostingController>();
|
||||||
final SettingsController _settingsController = Get.find<SettingsController>();
|
|
||||||
final DllController _dllController = Get.find<DllController>();
|
final DllController _dllController = Get.find<DllController>();
|
||||||
|
|
||||||
late final RxBool _showPasswordTrailing = RxBool(_hostingController.password.text.isNotEmpty);
|
late final RxBool _showPasswordTrailing = RxBool(_hostingController.password.text.isNotEmpty);
|
||||||
@@ -85,7 +84,6 @@ class _HostingPageState extends RebootPageState<HostPage> {
|
|||||||
key: hostVersionOverlayTargetKey
|
key: hostVersionOverlayTargetKey
|
||||||
),
|
),
|
||||||
_options,
|
_options,
|
||||||
_internalFiles,
|
|
||||||
_share,
|
_share,
|
||||||
_resetDefaults
|
_resetDefaults
|
||||||
];
|
];
|
||||||
@@ -155,8 +153,8 @@ class _HostingPageState extends RebootPageState<HostPage> {
|
|||||||
suffix: Button(
|
suffix: Button(
|
||||||
onPressed: () => _hostingController.showPassword.value = !_hostingController.showPassword.value,
|
onPressed: () => _hostingController.showPassword.value = !_hostingController.showPassword.value,
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
shape: ButtonState.all(const CircleBorder()),
|
shape: WidgetStateProperty.all(const CircleBorder()),
|
||||||
backgroundColor: ButtonState.all(Colors.transparent)
|
backgroundColor: WidgetStateProperty.all(Colors.transparent)
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
_hostingController.showPassword.value ? FluentIcons.eye_off_24_filled : FluentIcons.eye_24_filled,
|
_hostingController.showPassword.value ? FluentIcons.eye_off_24_filled : FluentIcons.eye_24_filled,
|
||||||
@@ -175,9 +173,9 @@ class _HostingPageState extends RebootPageState<HostPage> {
|
|||||||
contentWidth: null,
|
contentWidth: null,
|
||||||
content: Obx(() => Row(
|
content: Obx(() => Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Obx(() => Text(
|
||||||
_hostingController.discoverable.value ? translations.on : translations.off
|
_hostingController.discoverable.value ? translations.on : translations.off
|
||||||
),
|
)),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 16.0
|
width: 16.0
|
||||||
),
|
),
|
||||||
@@ -221,12 +219,11 @@ class _HostingPageState extends RebootPageState<HostPage> {
|
|||||||
content: Obx(() => DropDownButton(
|
content: Obx(() => DropDownButton(
|
||||||
onOpen: () => inDialog = true,
|
onOpen: () => inDialog = true,
|
||||||
onClose: () => inDialog = false,
|
onClose: () => inDialog = false,
|
||||||
leading: Text(_settingsController.debug.value ? GameServerType.window.translatedName : _hostingController.type.value.translatedName),
|
leading: Text(_hostingController.type.value.translatedName),
|
||||||
items: GameServerType.values.map((entry) => MenuFlyoutItem(
|
items: GameServerType.values.map((entry) => MenuFlyoutItem(
|
||||||
text: Text(entry.translatedName),
|
text: Text(entry.translatedName),
|
||||||
onPressed: () => _hostingController.type.value = entry
|
onPressed: () => _hostingController.type.value = entry
|
||||||
)).toList(),
|
)).toList()
|
||||||
disabled: _settingsController.debug.value
|
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
SettingTile(
|
SettingTile(
|
||||||
@@ -238,9 +235,9 @@ class _HostingPageState extends RebootPageState<HostPage> {
|
|||||||
contentWidth: null,
|
contentWidth: null,
|
||||||
content: Row(
|
content: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Obx(() => Text(
|
||||||
_hostingController.autoRestart.value ? translations.on : translations.off
|
_hostingController.autoRestart.value ? translations.on : translations.off
|
||||||
),
|
)),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 16.0
|
width: 16.0
|
||||||
),
|
),
|
||||||
@@ -271,159 +268,6 @@ class _HostingPageState extends RebootPageState<HostPage> {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
SettingTile get _internalFiles => SettingTile(
|
|
||||||
icon: Icon(
|
|
||||||
FluentIcons.archive_settings_24_regular
|
|
||||||
),
|
|
||||||
title: Text(translations.settingsServerName),
|
|
||||||
subtitle: Text(translations.settingsServerSubtitle),
|
|
||||||
children: [
|
|
||||||
SettingTile(
|
|
||||||
icon: Icon(
|
|
||||||
FluentIcons.timer_24_regular
|
|
||||||
),
|
|
||||||
title: Text(translations.settingsServerTypeName),
|
|
||||||
subtitle: Text(translations.settingsServerTypeDescription),
|
|
||||||
content: Obx(() => DropDownButton(
|
|
||||||
onOpen: () => inDialog = true,
|
|
||||||
onClose: () => inDialog = false,
|
|
||||||
leading: Text(_dllController.customGameServer.value ? translations.settingsServerTypeCustomName : translations.settingsServerTypeEmbeddedName),
|
|
||||||
items: {
|
|
||||||
false: translations.settingsServerTypeEmbeddedName,
|
|
||||||
true: translations.settingsServerTypeCustomName
|
|
||||||
}.entries.map((entry) => MenuFlyoutItem(
|
|
||||||
text: Text(entry.value),
|
|
||||||
onPressed: () {
|
|
||||||
final oldValue = _dllController.customGameServer.value;
|
|
||||||
if(oldValue == entry.key) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_dllController.customGameServer.value = entry.key;
|
|
||||||
_dllController.infoBarEntry?.close();
|
|
||||||
if(!entry.key) {
|
|
||||||
_dllController.updateGameServerDll(
|
|
||||||
force: true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)).toList()
|
|
||||||
))
|
|
||||||
),
|
|
||||||
Obx(() {
|
|
||||||
if(!_dllController.customGameServer.value) {
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
|
|
||||||
return createFileSetting(
|
|
||||||
title: translations.settingsServerFileName,
|
|
||||||
description: translations.settingsServerFileDescription,
|
|
||||||
controller: _dllController.gameServerDll,
|
|
||||||
onReset: () {
|
|
||||||
final path = _dllController.getDefaultDllPath(InjectableDll.reboot);
|
|
||||||
_dllController.gameServerDll.text = path;
|
|
||||||
_dllController.downloadCriticalDllInteractive(path);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
Obx(() {
|
|
||||||
if(_dllController.customGameServer.value) {
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
|
|
||||||
return SettingTile(
|
|
||||||
icon: Icon(
|
|
||||||
FluentIcons.globe_24_regular
|
|
||||||
),
|
|
||||||
title: Text(translations.settingsServerMirrorName),
|
|
||||||
subtitle: Text(translations.settingsServerMirrorDescription),
|
|
||||||
content: Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: TextFormBox(
|
|
||||||
placeholder: translations.settingsServerMirrorPlaceholder,
|
|
||||||
controller: _dllController.url,
|
|
||||||
validator: _checkUpdateUrl
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8.0),
|
|
||||||
Button(
|
|
||||||
style: ButtonStyle(
|
|
||||||
padding: ButtonState.all(EdgeInsets.zero)
|
|
||||||
),
|
|
||||||
onPressed: () => _dllController.url.text = kRebootDownloadUrl,
|
|
||||||
child: SizedBox.square(
|
|
||||||
dimension: 30,
|
|
||||||
child: Icon(
|
|
||||||
FluentIcons.arrow_reset_24_regular
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
Obx(() {
|
|
||||||
if(_dllController.customGameServer.value) {
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
|
|
||||||
return SettingTile(
|
|
||||||
icon: Icon(
|
|
||||||
FluentIcons.timer_24_regular
|
|
||||||
),
|
|
||||||
title: Text(translations.settingsServerTimerName),
|
|
||||||
subtitle: Text(translations.settingsServerTimerSubtitle),
|
|
||||||
content: Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Obx(() => DropDownButton(
|
|
||||||
onOpen: () => inDialog = true,
|
|
||||||
onClose: () => inDialog = false,
|
|
||||||
leading: Text(_dllController.timer.value.text),
|
|
||||||
items: UpdateTimer.values.map((entry) => MenuFlyoutItem(
|
|
||||||
text: Text(entry.text),
|
|
||||||
onPressed: () {
|
|
||||||
_dllController.timer.value = entry;
|
|
||||||
_dllController.infoBarEntry?.close();
|
|
||||||
_dllController.updateGameServerDll(
|
|
||||||
force: true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
)).toList()
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8.0),
|
|
||||||
Button(
|
|
||||||
style: ButtonStyle(
|
|
||||||
padding: ButtonState.all(EdgeInsets.zero)
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
_dllController.updateGameServerDll(force: true);
|
|
||||||
},
|
|
||||||
child: SizedBox.square(
|
|
||||||
dimension: 30,
|
|
||||||
child: Icon(
|
|
||||||
FluentIcons.arrow_download_24_regular
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
);
|
|
||||||
})
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
String? _checkUpdateUrl(String? text) {
|
|
||||||
if (text == null || text.isEmpty) {
|
|
||||||
return translations.emptyURL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
SettingTile get _share => SettingTile(
|
SettingTile get _share => SettingTile(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
FluentIcons.link_24_regular
|
FluentIcons.link_24_regular
|
||||||
@@ -494,8 +338,8 @@ class _HostingPageState extends RebootPageState<HostPage> {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
_hostingController.publishServer(
|
_hostingController.publishServer(
|
||||||
_gameController.username.text,
|
_hostingController.accountUsername.text,
|
||||||
_hostingController.instance.value!.versionName
|
_hostingController.instance.value!.version.toString()
|
||||||
);
|
);
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
_showCannotUpdateGameServer(error);
|
_showCannotUpdateGameServer(error);
|
||||||
@@ -530,13 +374,3 @@ class _HostingPageState extends RebootPageState<HostPage> {
|
|||||||
duration: infoBarLongDuration
|
duration: infoBarLongDuration
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
extension _UpdateTimerExtension on UpdateTimer {
|
|
||||||
String get text {
|
|
||||||
if (this == UpdateTimer.never) {
|
|
||||||
return translations.updateGameServerDllNever;
|
|
||||||
}
|
|
||||||
|
|
||||||
return translations.updateGameServerDllEvery(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +1,12 @@
|
|||||||
import 'package:fluent_ui/fluent_ui.dart' hide FluentIcons;
|
import 'package:fluent_ui/fluent_ui.dart' hide FluentIcons;
|
||||||
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
|
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:reboot_common/common.dart';
|
|
||||||
import 'package:reboot_launcher/src/controller/dll_controller.dart';
|
|
||||||
import 'package:reboot_launcher/src/controller/game_controller.dart';
|
import 'package:reboot_launcher/src/controller/game_controller.dart';
|
||||||
import 'package:reboot_launcher/src/controller/settings_controller.dart';
|
|
||||||
import 'package:reboot_launcher/src/messenger/abstract/overlay.dart';
|
import 'package:reboot_launcher/src/messenger/abstract/overlay.dart';
|
||||||
import 'package:reboot_launcher/src/messenger/implementation/data.dart';
|
import 'package:reboot_launcher/src/messenger/implementation/data.dart';
|
||||||
import 'package:reboot_launcher/src/messenger/implementation/onboard.dart';
|
|
||||||
import 'package:reboot_launcher/src/page/abstract/page.dart';
|
import 'package:reboot_launcher/src/page/abstract/page.dart';
|
||||||
import 'package:reboot_launcher/src/page/abstract/page_type.dart';
|
import 'package:reboot_launcher/src/page/abstract/page_type.dart';
|
||||||
import 'package:reboot_launcher/src/util/translations.dart';
|
import 'package:reboot_launcher/src/util/translations.dart';
|
||||||
import 'package:reboot_launcher/src/widget/file_setting_tile.dart';
|
|
||||||
import 'package:reboot_launcher/src/widget/game_start_button.dart';
|
import 'package:reboot_launcher/src/widget/game_start_button.dart';
|
||||||
import 'package:reboot_launcher/src/widget/setting_tile.dart';
|
import 'package:reboot_launcher/src/widget/setting_tile.dart';
|
||||||
import 'package:reboot_launcher/src/widget/version_selector_tile.dart';
|
import 'package:reboot_launcher/src/widget/version_selector_tile.dart';
|
||||||
@@ -38,9 +33,7 @@ class PlayPage extends RebootPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PlayPageState extends RebootPageState<PlayPage> {
|
class _PlayPageState extends RebootPageState<PlayPage> {
|
||||||
final SettingsController _settingsController = Get.find<SettingsController>();
|
|
||||||
final GameController _gameController = Get.find<GameController>();
|
final GameController _gameController = Get.find<GameController>();
|
||||||
final DllController _dllController = Get.find<DllController>();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget? get button => LaunchButton(
|
Widget? get button => LaunchButton(
|
||||||
@@ -55,50 +48,9 @@ class _PlayPageState extends RebootPageState<PlayPage> {
|
|||||||
key: gameVersionOverlayTargetKey
|
key: gameVersionOverlayTargetKey
|
||||||
),
|
),
|
||||||
_options,
|
_options,
|
||||||
_internalFiles,
|
|
||||||
_resetDefaults
|
_resetDefaults
|
||||||
];
|
];
|
||||||
|
|
||||||
SettingTile get _internalFiles => SettingTile(
|
|
||||||
icon: Icon(
|
|
||||||
FluentIcons.archive_settings_24_regular
|
|
||||||
),
|
|
||||||
title: Text(translations.settingsClientName),
|
|
||||||
subtitle: Text(translations.settingsClientDescription),
|
|
||||||
children: [
|
|
||||||
createFileSetting(
|
|
||||||
title: translations.settingsClientConsoleName,
|
|
||||||
description: translations.settingsClientConsoleDescription,
|
|
||||||
controller: _dllController.unrealEngineConsoleDll,
|
|
||||||
onReset: () {
|
|
||||||
final path = _dllController.getDefaultDllPath(InjectableDll.console);
|
|
||||||
_dllController.unrealEngineConsoleDll.text = path;
|
|
||||||
_dllController.downloadCriticalDllInteractive(path, force: true);
|
|
||||||
}
|
|
||||||
),
|
|
||||||
createFileSetting(
|
|
||||||
title: translations.settingsClientAuthName,
|
|
||||||
description: translations.settingsClientAuthDescription,
|
|
||||||
controller: _dllController.backendDll,
|
|
||||||
onReset: () {
|
|
||||||
final path = _dllController.getDefaultDllPath(InjectableDll.cobalt);
|
|
||||||
_dllController.backendDll.text = path;
|
|
||||||
_dllController.downloadCriticalDllInteractive(path, force: true);
|
|
||||||
}
|
|
||||||
),
|
|
||||||
createFileSetting(
|
|
||||||
title: translations.settingsClientMemoryName,
|
|
||||||
description: translations.settingsClientMemoryDescription,
|
|
||||||
controller: _dllController.memoryLeakDll,
|
|
||||||
onReset: () {
|
|
||||||
final path = _dllController.getDefaultDllPath(InjectableDll.memory);
|
|
||||||
_dllController.memoryLeakDll.text = path;
|
|
||||||
_dllController.downloadCriticalDllInteractive(path, force: true);
|
|
||||||
}
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
SettingTile get _options => SettingTile(
|
SettingTile get _options => SettingTile(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
FluentIcons.options_24_regular
|
FluentIcons.options_24_regular
|
||||||
@@ -129,7 +81,6 @@ class _PlayPageState extends RebootPageState<PlayPage> {
|
|||||||
content: Button(
|
content: Button(
|
||||||
onPressed: () => showResetDialog(() {
|
onPressed: () => showResetDialog(() {
|
||||||
_gameController.reset();
|
_gameController.reset();
|
||||||
_dllController.resetGame();
|
|
||||||
}),
|
}),
|
||||||
child: Text(translations.gameResetDefaultsContent),
|
child: Text(translations.gameResetDefaultsContent),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ import 'package:flutter_gen/gen_l10n/reboot_localizations.dart';
|
|||||||
import 'package:flutter_localized_locales/flutter_localized_locales.dart';
|
import 'package:flutter_localized_locales/flutter_localized_locales.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:reboot_common/common.dart';
|
import 'package:reboot_common/common.dart';
|
||||||
|
import 'package:reboot_launcher/src/controller/dll_controller.dart';
|
||||||
import 'package:reboot_launcher/src/controller/settings_controller.dart';
|
import 'package:reboot_launcher/src/controller/settings_controller.dart';
|
||||||
import 'package:reboot_launcher/src/messenger/abstract/dialog.dart';
|
import 'package:reboot_launcher/src/messenger/abstract/dialog.dart';
|
||||||
import 'package:reboot_launcher/src/messenger/implementation/data.dart';
|
|
||||||
import 'package:reboot_launcher/src/page/abstract/page.dart';
|
import 'package:reboot_launcher/src/page/abstract/page.dart';
|
||||||
import 'package:reboot_launcher/src/page/abstract/page_type.dart';
|
import 'package:reboot_launcher/src/page/abstract/page_type.dart';
|
||||||
import 'package:reboot_launcher/src/util/translations.dart';
|
import 'package:reboot_launcher/src/util/translations.dart';
|
||||||
|
import 'package:reboot_launcher/src/widget/file_setting_tile.dart';
|
||||||
import 'package:reboot_launcher/src/widget/setting_tile.dart';
|
import 'package:reboot_launcher/src/widget/setting_tile.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
@@ -34,6 +35,7 @@ class SettingsPage extends RebootPage {
|
|||||||
|
|
||||||
class _SettingsPageState extends RebootPageState<SettingsPage> {
|
class _SettingsPageState extends RebootPageState<SettingsPage> {
|
||||||
final SettingsController _settingsController = Get.find<SettingsController>();
|
final SettingsController _settingsController = Get.find<SettingsController>();
|
||||||
|
final DllController _dllController = Get.find<DllController>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget? get button => null;
|
Widget? get button => null;
|
||||||
@@ -42,10 +44,235 @@ class _SettingsPageState extends RebootPageState<SettingsPage> {
|
|||||||
List<Widget> get settings => [
|
List<Widget> get settings => [
|
||||||
_language,
|
_language,
|
||||||
_theme,
|
_theme,
|
||||||
_debugMode,
|
_internalFiles,
|
||||||
_installationDirectory,
|
_installationDirectory,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
SettingTile get _internalFiles => SettingTile(
|
||||||
|
icon: Icon(
|
||||||
|
FluentIcons.archive_settings_24_regular
|
||||||
|
),
|
||||||
|
title: Text(translations.settingsClientName),
|
||||||
|
subtitle: Text(translations.settingsClientDescription),
|
||||||
|
children: [
|
||||||
|
createFileSetting(
|
||||||
|
title: translations.settingsClientConsoleName,
|
||||||
|
description: translations.settingsClientConsoleDescription,
|
||||||
|
controller: _dllController.unrealEngineConsoleDll,
|
||||||
|
onReset: () {
|
||||||
|
final path = _dllController.getDefaultDllPath(InjectableDll.console);
|
||||||
|
_dllController.unrealEngineConsoleDll.text = path;
|
||||||
|
_dllController.downloadCriticalDllInteractive(path, force: true);
|
||||||
|
}
|
||||||
|
),
|
||||||
|
createFileSetting(
|
||||||
|
title: translations.settingsClientAuthName,
|
||||||
|
description: translations.settingsClientAuthDescription,
|
||||||
|
controller: _dllController.backendDll,
|
||||||
|
onReset: () {
|
||||||
|
final path = _dllController.getDefaultDllPath(InjectableDll.starfall);
|
||||||
|
_dllController.backendDll.text = path;
|
||||||
|
_dllController.downloadCriticalDllInteractive(path, force: true);
|
||||||
|
}
|
||||||
|
),
|
||||||
|
_internalFilesServerType,
|
||||||
|
_internalFilesUpdateTimer,
|
||||||
|
_internalFilesServerSource,
|
||||||
|
_internalFilesNewServerSource,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget get _internalFilesServerType => SettingTile(
|
||||||
|
icon: Icon(
|
||||||
|
FluentIcons.games_24_regular
|
||||||
|
),
|
||||||
|
title: Text(translations.settingsServerTypeName),
|
||||||
|
subtitle: Text(translations.settingsServerTypeDescription),
|
||||||
|
contentWidth: SettingTile.kDefaultContentWidth + 30,
|
||||||
|
content: Obx(() => DropDownButton(
|
||||||
|
onOpen: () => inDialog = true,
|
||||||
|
onClose: () => inDialog = false,
|
||||||
|
leading: Text(_dllController.customGameServer.value ? translations.settingsServerTypeCustomName : translations.settingsServerTypeEmbeddedName),
|
||||||
|
items: {
|
||||||
|
false: translations.settingsServerTypeEmbeddedName,
|
||||||
|
true: translations.settingsServerTypeCustomName
|
||||||
|
}.entries.map((entry) => MenuFlyoutItem(
|
||||||
|
text: Text(entry.value),
|
||||||
|
onPressed: () {
|
||||||
|
final oldValue = _dllController.customGameServer.value;
|
||||||
|
if(oldValue == entry.key) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_dllController.customGameServer.value = entry.key;
|
||||||
|
_dllController.infoBarEntry?.close();
|
||||||
|
if(!entry.key) {
|
||||||
|
_dllController.updateGameServerDll(
|
||||||
|
force: true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)).toList()
|
||||||
|
))
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget get _internalFilesServerSource => Obx(() {
|
||||||
|
if(!_dllController.customGameServer.value) {
|
||||||
|
return SettingTile(
|
||||||
|
icon: Icon(
|
||||||
|
FluentIcons.globe_24_regular
|
||||||
|
),
|
||||||
|
title: Text(translations.settingsServerOldMirrorName),
|
||||||
|
subtitle: Text(translations.settingsServerMirrorDescription),
|
||||||
|
contentWidth: SettingTile.kDefaultContentWidth + 30,
|
||||||
|
content: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TextFormBox(
|
||||||
|
placeholder: translations.settingsServerMirrorPlaceholder,
|
||||||
|
controller: _dllController.beforeS20Mirror,
|
||||||
|
onChanged: (value) {
|
||||||
|
if(Uri.tryParse(value) != null) {
|
||||||
|
_dllController.updateGameServerDll(force: true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8.0),
|
||||||
|
Button(
|
||||||
|
style: ButtonStyle(
|
||||||
|
padding: WidgetStateProperty.all(EdgeInsets.zero)
|
||||||
|
),
|
||||||
|
onPressed: () => _dllController.updateGameServerDll(force: true),
|
||||||
|
child: SizedBox.square(
|
||||||
|
dimension: 30,
|
||||||
|
child: Icon(
|
||||||
|
FluentIcons.arrow_download_24_regular
|
||||||
|
),
|
||||||
|
)
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8.0),
|
||||||
|
Button(
|
||||||
|
style: ButtonStyle(
|
||||||
|
padding: WidgetStateProperty.all(EdgeInsets.zero)
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
_dllController.beforeS20Mirror.text = kRebootBelowS20DownloadUrl;
|
||||||
|
_dllController.updateGameServerDll(force: true);
|
||||||
|
},
|
||||||
|
child: SizedBox.square(
|
||||||
|
dimension: 30,
|
||||||
|
child: Icon(
|
||||||
|
FluentIcons.arrow_reset_24_regular
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}else {
|
||||||
|
return createFileSetting(
|
||||||
|
title: translations.settingsOldServerFileName,
|
||||||
|
description: translations.settingsServerFileDescription,
|
||||||
|
controller: _dllController.gameServerDll,
|
||||||
|
onReset: () {
|
||||||
|
final path = _dllController.getDefaultDllPath(InjectableDll.reboot);
|
||||||
|
_dllController.gameServerDll.text = path;
|
||||||
|
_dllController.downloadCriticalDllInteractive(path);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Widget get _internalFilesNewServerSource => Obx(() {
|
||||||
|
if(!_dllController.customGameServer.value) {
|
||||||
|
return SettingTile(
|
||||||
|
icon: Icon(
|
||||||
|
FluentIcons.globe_24_regular
|
||||||
|
),
|
||||||
|
title: Text(translations.settingsServerNewMirrorName),
|
||||||
|
subtitle: Text(translations.settingsServerMirrorDescription),
|
||||||
|
contentWidth: SettingTile.kDefaultContentWidth + 30,
|
||||||
|
content: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TextFormBox(
|
||||||
|
placeholder: translations.settingsServerMirrorPlaceholder,
|
||||||
|
controller: _dllController.aboveS20Mirror,
|
||||||
|
onChanged: (value) {
|
||||||
|
if(Uri.tryParse(value) != null) {
|
||||||
|
_dllController.updateGameServerDll(force: true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8.0),
|
||||||
|
Button(
|
||||||
|
style: ButtonStyle(
|
||||||
|
padding: WidgetStateProperty.all(EdgeInsets.zero)
|
||||||
|
),
|
||||||
|
onPressed: () => _dllController.updateGameServerDll(force: true),
|
||||||
|
child: SizedBox.square(
|
||||||
|
dimension: 30,
|
||||||
|
child: Icon(
|
||||||
|
FluentIcons.arrow_download_24_regular
|
||||||
|
),
|
||||||
|
)
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8.0),
|
||||||
|
Button(
|
||||||
|
style: ButtonStyle(
|
||||||
|
padding: WidgetStateProperty.all(EdgeInsets.zero)
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
_dllController.aboveS20Mirror.text = kRebootBelowS20DownloadUrl;
|
||||||
|
_dllController.updateGameServerDll(force: true);
|
||||||
|
},
|
||||||
|
child: SizedBox.square(
|
||||||
|
dimension: 30,
|
||||||
|
child: Icon(
|
||||||
|
FluentIcons.arrow_reset_24_regular
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}else {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Widget get _internalFilesUpdateTimer => Obx(() {
|
||||||
|
if(_dllController.customGameServer.value) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
|
||||||
|
return SettingTile(
|
||||||
|
icon: Icon(
|
||||||
|
FluentIcons.timer_24_regular
|
||||||
|
),
|
||||||
|
title: Text(translations.settingsServerTimerName),
|
||||||
|
subtitle: Text(translations.settingsServerTimerSubtitle),
|
||||||
|
contentWidth: SettingTile.kDefaultContentWidth + 30,
|
||||||
|
content: Obx(() => DropDownButton(
|
||||||
|
onOpen: () => inDialog = true,
|
||||||
|
onClose: () => inDialog = false,
|
||||||
|
leading: Text(_dllController.timer.value.text),
|
||||||
|
items: UpdateTimer.values.map((entry) => MenuFlyoutItem(
|
||||||
|
text: Text(entry.text),
|
||||||
|
onPressed: () {
|
||||||
|
_dllController.timer.value = entry;
|
||||||
|
_dllController.infoBarEntry?.close();
|
||||||
|
_dllController.updateGameServerDll(
|
||||||
|
force: true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
)).toList()
|
||||||
|
))
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
SettingTile get _language => SettingTile(
|
SettingTile get _language => SettingTile(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
FluentIcons.local_language_24_regular
|
FluentIcons.local_language_24_regular
|
||||||
@@ -100,29 +327,6 @@ class _SettingsPageState extends RebootPageState<SettingsPage> {
|
|||||||
child: Text(translations.settingsUtilsInstallationDirectoryContent),
|
child: Text(translations.settingsUtilsInstallationDirectoryContent),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
SettingTile get _debugMode => SettingTile(
|
|
||||||
icon: Icon(
|
|
||||||
FluentIcons.developer_board_24_regular
|
|
||||||
),
|
|
||||||
title: Text("Debug mode"),
|
|
||||||
subtitle: Text("Whether the launcher should disable automatic features for troubleshooting"),
|
|
||||||
contentWidth: null,
|
|
||||||
content: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
_settingsController.debug.value ? translations.on : translations.off
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 16.0
|
|
||||||
),
|
|
||||||
Obx(() => ToggleSwitch(
|
|
||||||
checked: _settingsController.debug.value,
|
|
||||||
onChanged: (value) => _settingsController.debug.value = value
|
|
||||||
))
|
|
||||||
],
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension _ThemeModeExtension on ThemeMode {
|
extension _ThemeModeExtension on ThemeMode {
|
||||||
@@ -137,3 +341,13 @@ extension _ThemeModeExtension on ThemeMode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension _UpdateTimerExtension on UpdateTimer {
|
||||||
|
String get text {
|
||||||
|
if (this == UpdateTimer.never) {
|
||||||
|
return translations.updateGameServerDllNever;
|
||||||
|
}
|
||||||
|
|
||||||
|
return translations.updateGameServerDllEvery(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
@@ -5,8 +6,39 @@ import 'package:reboot_common/common.dart';
|
|||||||
|
|
||||||
const Duration _timeout = Duration(seconds: 5);
|
const Duration _timeout = Duration(seconds: 5);
|
||||||
|
|
||||||
Future<bool> pingGameServer(String address, {Duration? timeout}) async {
|
Completer<bool> pingGameServerOrTimeout(String address, Duration timeout) {
|
||||||
Future<bool> ping(String hostname, int port) async {
|
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);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
return completer;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> pingGameServer(String address) async {
|
||||||
|
final split = address.split(":");
|
||||||
|
var hostname = split[0];
|
||||||
|
if(isLocalHost(hostname)) {
|
||||||
|
hostname = "127.0.0.1";
|
||||||
|
}
|
||||||
|
|
||||||
|
final port = int.parse(split.length > 1 ? split[1] : kDefaultGameServerPort);
|
||||||
|
return await _ping(hostname, port)
|
||||||
|
.timeout(_timeout, onTimeout: () => false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Future<bool> _ping(String hostname, int port) async {
|
||||||
log("[MATCHMAKER] Pinging $hostname:$port");
|
log("[MATCHMAKER] Pinging $hostname:$port");
|
||||||
RawDatagramSocket? socket;
|
RawDatagramSocket? socket;
|
||||||
try {
|
try {
|
||||||
@@ -35,29 +67,3 @@ Future<bool> pingGameServer(String address, {Duration? timeout}) async {
|
|||||||
socket?.close();
|
socket?.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final start = DateTime.now();
|
|
||||||
var firstTime = true;
|
|
||||||
final split = address.split(":");
|
|
||||||
var hostname = split[0];
|
|
||||||
if(isLocalHost(hostname)) {
|
|
||||||
hostname = "127.0.0.1";
|
|
||||||
}
|
|
||||||
|
|
||||||
final port = int.parse(split.length > 1 ? split[1] : kDefaultGameServerPort);
|
|
||||||
while (firstTime || (timeout != null && DateTime.now().millisecondsSinceEpoch - start.millisecondsSinceEpoch < timeout.inMilliseconds)) {
|
|
||||||
final result = await ping(hostname, port)
|
|
||||||
.timeout(_timeout, onTimeout: () => false);
|
|
||||||
if(result) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(firstTime) {
|
|
||||||
firstTime = false;
|
|
||||||
}else {
|
|
||||||
await Future.delayed(_timeout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
@@ -7,6 +7,7 @@ import 'package:file_picker/file_picker.dart';
|
|||||||
import 'package:fluent_ui/fluent_ui.dart';
|
import 'package:fluent_ui/fluent_ui.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
import 'package:win32/win32.dart';
|
import 'package:win32/win32.dart';
|
||||||
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
final RegExp _winBuildRegex = RegExp(r'(?<=\(Build )(.*)(?=\))');
|
final RegExp _winBuildRegex = RegExp(r'(?<=\(Build )(.*)(?=\))');
|
||||||
|
|
||||||
@@ -24,10 +25,13 @@ bool get isWin11 {
|
|||||||
return intBuild != null && intBuild > 22000;
|
return intBuild != null && intBuild > 22000;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String?> openFolderPicker(String title) async =>
|
Future<String?> openFolderPicker(String title) async {
|
||||||
await FilePicker.platform.getDirectoryPath(dialogTitle: title);
|
FilePicker.platform = FilePickerWindows();
|
||||||
|
return await FilePicker.platform.getDirectoryPath(dialogTitle: title);
|
||||||
|
}
|
||||||
|
|
||||||
Future<String?> openFilePicker(String extension) async {
|
Future<String?> openFilePicker(String extension) async {
|
||||||
|
FilePicker.platform = FilePickerWindows();
|
||||||
var result = await FilePicker.platform.pickFiles(
|
var result = await FilePicker.platform.pickFiles(
|
||||||
type: FileType.custom,
|
type: FileType.custom,
|
||||||
allowMultiple: false,
|
allowMultiple: false,
|
||||||
@@ -93,7 +97,7 @@ class IVirtualDesktop extends IUnknown {
|
|||||||
throw WindowsException(code);
|
throw WindowsException(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
return convertFromHString(result.value);
|
return _convertFromHString(result.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +284,7 @@ class _IVirtualDesktopManagerInternal extends IUnknown {
|
|||||||
HRESULT Function(Pointer, COMObject, Int8)>>>()
|
HRESULT Function(Pointer, COMObject, Int8)>>>()
|
||||||
.value
|
.value
|
||||||
.asFunction<int Function(Pointer, COMObject, int)>()(
|
.asFunction<int Function(Pointer, COMObject, int)>()(
|
||||||
ptr.ref.lpVtbl, desktop.ptr.ref, convertToHString(newName));
|
ptr.ref.lpVtbl, desktop.ptr.ref, _convertToHString(newName));
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
throw WindowsException(code);
|
throw WindowsException(code);
|
||||||
}
|
}
|
||||||
@@ -369,7 +373,7 @@ List<int> _getHWnds(int pid, String? excludedWindowName) {
|
|||||||
result.ref.excluded = excludedWindowName.toNativeUtf16();
|
result.ref.excluded = excludedWindowName.toNativeUtf16();
|
||||||
}
|
}
|
||||||
|
|
||||||
EnumWindows(Pointer.fromFunction<EnumWindowsProc>(_filter, TRUE), result.address);
|
EnumWindows(Pointer.fromFunction<WNDENUMPROC>(_filter, TRUE), result.address);
|
||||||
final length = result.ref.HWndLength;
|
final length = result.ref.HWndLength;
|
||||||
final HWndsPointer = result.ref.HWnd;
|
final HWndsPointer = result.ref.HWnd;
|
||||||
if(HWndsPointer == nullptr) {
|
if(HWndsPointer == nullptr) {
|
||||||
@@ -397,7 +401,7 @@ class VirtualDesktopManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final hr = CoInitializeEx(
|
final hr = CoInitializeEx(
|
||||||
nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
nullptr, COINIT.COINIT_APARTMENTTHREADED | COINIT.COINIT_DISABLE_OLE1DDE);
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
throw WindowsException(hr);
|
throw WindowsException(hr);
|
||||||
}
|
}
|
||||||
@@ -468,3 +472,23 @@ class VirtualDesktopManager {
|
|||||||
void setDesktopName(IVirtualDesktop desktop, String newName) =>
|
void setDesktopName(IVirtualDesktop desktop, String newName) =>
|
||||||
windowManager.setDesktopName(desktop, newName);
|
windowManager.setDesktopName(desktop, newName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String _convertFromHString(int hstring) =>
|
||||||
|
WindowsGetStringRawBuffer(hstring, nullptr).toDartString();
|
||||||
|
|
||||||
|
int _convertToHString(String string) {
|
||||||
|
final hString = calloc<HSTRING>();
|
||||||
|
final stringPtr = string.toNativeUtf16();
|
||||||
|
try {
|
||||||
|
final hr = WindowsCreateString(stringPtr, string.length, hString);
|
||||||
|
if (FAILED(hr)) throw WindowsException(hr);
|
||||||
|
return hString.value;
|
||||||
|
} finally {
|
||||||
|
free(stringPtr);
|
||||||
|
free(hString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension WindowManagerExtension on WindowManager {
|
||||||
|
Future<void> maximizeOrRestore() async => await windowManager.isMaximized() ? windowManager.restore() : windowManager.maximize();
|
||||||
|
}
|
||||||
@@ -6,3 +6,14 @@ extension IterableExtension<E> on Iterable<E> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension StringExtension on String {
|
||||||
|
String? after(String leading) {
|
||||||
|
final index = indexOf(leading);
|
||||||
|
if(index == -1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return substring(index + leading.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
63
gui/lib/src/util/url_protocol.dart
Normal file
63
gui/lib/src/util/url_protocol.dart
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:ffi/ffi.dart';
|
||||||
|
import 'package:win32/win32.dart';
|
||||||
|
|
||||||
|
final _hive = HKEY_CURRENT_USER;
|
||||||
|
|
||||||
|
void registerUrlProtocol(String scheme, {String? executable, List<String>? arguments}) {
|
||||||
|
final prefix = _regPrefix(scheme);
|
||||||
|
final capitalized = scheme[0].toUpperCase() + scheme.substring(1);
|
||||||
|
final args = _getArguments(arguments).map((a) => _sanitize(a));
|
||||||
|
final cmd =
|
||||||
|
'${executable ?? Platform.resolvedExecutable} ${args.join(' ')}';
|
||||||
|
_regCreateStringKey(_hive, prefix, '', 'URL:$capitalized');
|
||||||
|
_regCreateStringKey(_hive, prefix, 'URL Protocol', '');
|
||||||
|
_regCreateStringKey(_hive, prefix + '\\shell\\open\\command', '', cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void unregisterUrlProtocol(String scheme) {
|
||||||
|
final txtKey = TEXT(_regPrefix(scheme));
|
||||||
|
try {
|
||||||
|
RegDeleteTree(HKEY_CURRENT_USER, txtKey);
|
||||||
|
} finally {
|
||||||
|
free(txtKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _regPrefix(String scheme) => 'SOFTWARE\\Classes\\$scheme';
|
||||||
|
|
||||||
|
int _regCreateStringKey(int hKey, String key, String valueName, String data) {
|
||||||
|
final txtKey = TEXT(key);
|
||||||
|
final txtValue = TEXT(valueName);
|
||||||
|
final txtData = TEXT(data);
|
||||||
|
try {
|
||||||
|
return RegSetKeyValue(
|
||||||
|
hKey,
|
||||||
|
txtKey,
|
||||||
|
txtValue,
|
||||||
|
REG_VALUE_TYPE.REG_SZ,
|
||||||
|
txtData,
|
||||||
|
txtData.length * 2 + 2,
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
free(txtKey);
|
||||||
|
free(txtValue);
|
||||||
|
free(txtData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _sanitize(String value) {
|
||||||
|
value = value.replaceAll(r'%s', '%1').replaceAll(r'"', '\\"');
|
||||||
|
return '"$value"';
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> _getArguments(List<String>? arguments) {
|
||||||
|
if (arguments == null) return ['%s'];
|
||||||
|
|
||||||
|
if (arguments.isEmpty && !arguments.any((e) => e.contains('%s'))) {
|
||||||
|
throw ArgumentError('arguments must contain at least 1 instance of "%s"');
|
||||||
|
}
|
||||||
|
|
||||||
|
return arguments;
|
||||||
|
}
|
||||||
@@ -19,10 +19,10 @@ class FileSelector extends StatefulWidget {
|
|||||||
required this.controller,
|
required this.controller,
|
||||||
required this.validator,
|
required this.validator,
|
||||||
required this.folder,
|
required this.folder,
|
||||||
|
required this.allowNavigator,
|
||||||
this.label,
|
this.label,
|
||||||
this.extension,
|
this.extension,
|
||||||
this.validatorMode,
|
this.validatorMode,
|
||||||
this.allowNavigator = true,
|
|
||||||
Key? key})
|
Key? key})
|
||||||
: assert(folder || extension != null, "Missing extension for file selector"),
|
: assert(folder || extension != null, "Missing extension for file selector"),
|
||||||
super(key: key);
|
super(key: key);
|
||||||
|
|||||||
@@ -1,21 +1,30 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:fluent_ui/fluent_ui.dart' as fluentIcons show FluentIcons;
|
||||||
import 'package:fluent_ui/fluent_ui.dart' hide FluentIcons;
|
import 'package:fluent_ui/fluent_ui.dart' hide FluentIcons;
|
||||||
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
|
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:reboot_launcher/src/util/os.dart';
|
||||||
import 'package:reboot_launcher/src/util/translations.dart';
|
import 'package:reboot_launcher/src/util/translations.dart';
|
||||||
import 'package:reboot_launcher/src/widget/file_selector.dart';
|
import 'package:reboot_launcher/src/widget/file_selector.dart';
|
||||||
import 'package:reboot_launcher/src/widget/setting_tile.dart';
|
import 'package:reboot_launcher/src/widget/setting_tile.dart';
|
||||||
|
|
||||||
|
const double _kButtonDimensions = 30;
|
||||||
|
const double _kButtonSpacing = 8;
|
||||||
|
|
||||||
|
// FIXME: If the user clicks on the reset button, the text field checker won't be called
|
||||||
SettingTile createFileSetting({required String title, required String description, required TextEditingController controller, required void Function() onReset}) {
|
SettingTile createFileSetting({required String title, required String description, required TextEditingController controller, required void Function() onReset}) {
|
||||||
final obx = RxString(controller.text);
|
final obx = RxString(controller.text);
|
||||||
controller.addListener(() => obx.value = controller.text);
|
controller.addListener(() => obx.value = controller.text);
|
||||||
|
final selecting = RxBool(false);
|
||||||
return SettingTile(
|
return SettingTile(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
FluentIcons.document_24_regular
|
FluentIcons.document_24_regular
|
||||||
),
|
),
|
||||||
title: Text(title),
|
title: Text(title),
|
||||||
subtitle: Text(description),
|
subtitle: Text(description),
|
||||||
|
contentWidth: SettingTile.kDefaultContentWidth + _kButtonDimensions,
|
||||||
content: Row(
|
content: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -26,32 +35,74 @@ SettingTile createFileSetting({required String title, required String descriptio
|
|||||||
validator: _checkDll,
|
validator: _checkDll,
|
||||||
extension: "dll",
|
extension: "dll",
|
||||||
folder: false,
|
folder: false,
|
||||||
validatorMode: AutovalidateMode.always
|
validatorMode: AutovalidateMode.always,
|
||||||
|
allowNavigator: false,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8.0),
|
const SizedBox(width: _kButtonSpacing),
|
||||||
Obx(() => Padding(
|
Obx(() => Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
bottom: _checkDll(obx.value) == null ? 0.0 : 20.0
|
bottom: _checkDll(obx.value) == null ? 0.0 : 20.0
|
||||||
),
|
),
|
||||||
|
child: Tooltip(
|
||||||
|
message: translations.selectFile,
|
||||||
child: Button(
|
child: Button(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
padding: ButtonState.all(EdgeInsets.zero)
|
padding: WidgetStateProperty.all(EdgeInsets.zero)
|
||||||
|
),
|
||||||
|
onPressed: () => _onPressed(selecting, controller),
|
||||||
|
child: SizedBox.square(
|
||||||
|
dimension: _kButtonDimensions,
|
||||||
|
child: Icon(
|
||||||
|
fluentIcons.FluentIcons.open_folder_horizontal
|
||||||
|
),
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
const SizedBox(width: _kButtonSpacing),
|
||||||
|
Obx(() => Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
bottom: _checkDll(obx.value) == null ? 0.0 : 20.0
|
||||||
|
),
|
||||||
|
child: Tooltip(
|
||||||
|
message: translations.reset,
|
||||||
|
child: Button(
|
||||||
|
style: ButtonStyle(
|
||||||
|
padding: WidgetStateProperty.all(EdgeInsets.zero)
|
||||||
),
|
),
|
||||||
onPressed: onReset,
|
onPressed: onReset,
|
||||||
child: SizedBox.square(
|
child: SizedBox.square(
|
||||||
dimension: 30,
|
dimension: _kButtonDimensions,
|
||||||
child: Icon(
|
child: Icon(
|
||||||
FluentIcons.arrow_reset_24_regular
|
FluentIcons.arrow_reset_24_regular
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
),
|
||||||
))
|
))
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _onPressed(RxBool selecting, TextEditingController controller) {
|
||||||
|
if(selecting.value){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
selecting.value = true;
|
||||||
|
compute(openFilePicker, "dll")
|
||||||
|
.then((value) => _updateText(controller, value))
|
||||||
|
.then((_) => selecting.value = false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _updateText(TextEditingController controller, String? value) {
|
||||||
|
final text = value ?? controller.text;
|
||||||
|
controller.text = text;
|
||||||
|
controller.selection = TextSelection.collapsed(offset: text.length);
|
||||||
|
}
|
||||||
|
|
||||||
String? _checkDll(String? text) {
|
String? _checkDll(String? text) {
|
||||||
if (text == null || text.isEmpty) {
|
if (text == null || text.isEmpty) {
|
||||||
return translations.invalidDllPath;
|
return translations.invalidDllPath;
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import 'package:reboot_launcher/src/controller/backend_controller.dart';
|
|||||||
import 'package:reboot_launcher/src/controller/dll_controller.dart';
|
import 'package:reboot_launcher/src/controller/dll_controller.dart';
|
||||||
import 'package:reboot_launcher/src/controller/game_controller.dart';
|
import 'package:reboot_launcher/src/controller/game_controller.dart';
|
||||||
import 'package:reboot_launcher/src/controller/hosting_controller.dart';
|
import 'package:reboot_launcher/src/controller/hosting_controller.dart';
|
||||||
import 'package:reboot_launcher/src/controller/settings_controller.dart';
|
|
||||||
import 'package:reboot_launcher/src/messenger/abstract/dialog.dart';
|
import 'package:reboot_launcher/src/messenger/abstract/dialog.dart';
|
||||||
import 'package:reboot_launcher/src/messenger/abstract/info_bar.dart';
|
import 'package:reboot_launcher/src/messenger/abstract/info_bar.dart';
|
||||||
import 'package:reboot_launcher/src/messenger/implementation/server.dart';
|
import 'package:reboot_launcher/src/messenger/implementation/server.dart';
|
||||||
@@ -22,6 +21,7 @@ import 'package:reboot_launcher/src/util/os.dart';
|
|||||||
import 'package:reboot_launcher/src/util/translations.dart';
|
import 'package:reboot_launcher/src/util/translations.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
import 'package:version/version.dart';
|
||||||
|
|
||||||
class LaunchButton extends StatefulWidget {
|
class LaunchButton extends StatefulWidget {
|
||||||
final bool host;
|
final bool host;
|
||||||
@@ -41,12 +41,11 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
final HostingController _hostingController = Get.find<HostingController>();
|
final HostingController _hostingController = Get.find<HostingController>();
|
||||||
final BackendController _backendController = Get.find<BackendController>();
|
final BackendController _backendController = Get.find<BackendController>();
|
||||||
final DllController _dllController = Get.find<DllController>();
|
final DllController _dllController = Get.find<DllController>();
|
||||||
final SettingsController _settingsController = Get.find<SettingsController>();
|
|
||||||
|
|
||||||
InfoBarEntry? _gameClientInfoBar;
|
InfoBarEntry? _gameClientInfoBar;
|
||||||
InfoBarEntry? _gameServerInfoBar;
|
InfoBarEntry? _gameServerInfoBar;
|
||||||
CancelableOperation? _operation;
|
CancelableOperation? _operation;
|
||||||
CancelableOperation? _pingOperation;
|
Completer? _pingOperation;
|
||||||
IVirtualDesktop? _virtualDesktop;
|
IVirtualDesktop? _virtualDesktop;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -95,7 +94,7 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
log("[${host ? 'HOST' : 'GAME'}] Set started");
|
log("[${host ? 'HOST' : 'GAME'}] Set started");
|
||||||
log("[${host ? 'HOST' : 'GAME'}] Checking dlls: ${InjectableDll.values}");
|
log("[${host ? 'HOST' : 'GAME'}] Checking dlls: ${InjectableDll.values}");
|
||||||
for (final injectable in InjectableDll.values) {
|
for (final injectable in InjectableDll.values) {
|
||||||
if(await _getDllFileOrStop(injectable, host) == null) {
|
if(await _getDllFileOrStop(version.content, injectable, host) == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,7 +120,7 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log("[${host ? 'HOST' : 'GAME'}] Backend works");
|
log("[${host ? 'HOST' : 'GAME'}] Backend works");
|
||||||
final serverType = _settingsController.debug.value ? GameServerType.window : _hostingController.type.value;
|
final serverType = _hostingController.type.value;
|
||||||
log("[${host ? 'HOST' : 'GAME'}] Implicit game server metadata: headless($serverType)");
|
log("[${host ? 'HOST' : 'GAME'}] Implicit game server metadata: headless($serverType)");
|
||||||
final linkedHostingInstance = await _startMatchMakingServer(version, host, serverType, false);
|
final linkedHostingInstance = await _startMatchMakingServer(version, host, serverType, false);
|
||||||
log("[${host ? 'HOST' : 'GAME'}] Implicit game server result: $linkedHostingInstance");
|
log("[${host ? 'HOST' : 'GAME'}] Implicit game server result: $linkedHostingInstance");
|
||||||
@@ -159,11 +158,6 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_settingsController.debug.value) {
|
|
||||||
log("[${host ? 'HOST' : 'GAME'}] The user is on debug mode, not asking for auto server");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!forceLinkedHosting && _backendController.type.value == ServerType.embedded && !isLocalHost(_backendController.gameServerAddress.text)) {
|
if(!forceLinkedHosting && _backendController.type.value == ServerType.embedded && !isLocalHost(_backendController.gameServerAddress.text)) {
|
||||||
log("[${host ? 'HOST' : 'GAME'}] Backend is not set to embedded and/or not pointing to the local game server");
|
log("[${host ? 'HOST' : 'GAME'}] Backend is not set to embedded and/or not pointing to the local game server");
|
||||||
return null;
|
return null;
|
||||||
@@ -235,7 +229,7 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
|
|
||||||
log("[${host ? 'HOST' : 'GAME'}] Created game process: ${gameProcess}");
|
log("[${host ? 'HOST' : 'GAME'}] Created game process: ${gameProcess}");
|
||||||
final instance = GameInstance(
|
final instance = GameInstance(
|
||||||
versionName: version.content.toString(),
|
version: version.content,
|
||||||
gamePid: gameProcess,
|
gamePid: gameProcess,
|
||||||
launcherPid: launcherProcess,
|
launcherPid: launcherProcess,
|
||||||
eacPid: eacProcess,
|
eacPid: eacProcess,
|
||||||
@@ -248,7 +242,7 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
}else{
|
}else{
|
||||||
_gameController.instance.value = instance;
|
_gameController.instance.value = instance;
|
||||||
}
|
}
|
||||||
await _injectOrShowError(InjectableDll.cobalt, host);
|
await _injectOrShowError(InjectableDll.starfall, host);
|
||||||
log("[${host ? 'HOST' : 'GAME'}] Finished creating game instance");
|
log("[${host ? 'HOST' : 'GAME'}] Finished creating game instance");
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
@@ -256,8 +250,8 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
Future<int?> _createGameProcess(FortniteVersion version, File executable, bool host, GameServerType hostType, GameInstance? linkedHosting) async {
|
Future<int?> _createGameProcess(FortniteVersion version, File executable, bool host, GameServerType hostType, GameInstance? linkedHosting) async {
|
||||||
log("[${host ? 'HOST' : 'GAME'}] Generating instance args...");
|
log("[${host ? 'HOST' : 'GAME'}] Generating instance args...");
|
||||||
final gameArgs = createRebootArgs(
|
final gameArgs = createRebootArgs(
|
||||||
_gameController.username.text,
|
host ? _hostingController.accountUsername.text : _gameController.username.text,
|
||||||
_gameController.password.text,
|
host ? _hostingController.accountPassword.text :_gameController.password.text,
|
||||||
host,
|
host,
|
||||||
hostType,
|
hostType,
|
||||||
false,
|
false,
|
||||||
@@ -280,13 +274,7 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
line: line,
|
line: line,
|
||||||
host: host,
|
host: host,
|
||||||
onShutdown: () => _onStop(reason: _StopReason.normal),
|
onShutdown: () => _onStop(reason: _StopReason.normal),
|
||||||
onTokenError: () {
|
onTokenError: () => _onStop(reason: _StopReason.tokenError),
|
||||||
if(_settingsController.debug.value) {
|
|
||||||
log("[PROCESS] Ignoring token error because debug mode is on");
|
|
||||||
}else {
|
|
||||||
_onStop(reason: _StopReason.tokenError);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onBuildCorrupted: () {
|
onBuildCorrupted: () {
|
||||||
if(instance == null) {
|
if(instance == null) {
|
||||||
return;
|
return;
|
||||||
@@ -410,7 +398,6 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
if(instance != null && !instance.launched) {
|
if(instance != null && !instance.launched) {
|
||||||
instance.launched = true;
|
instance.launched = true;
|
||||||
instance.tokenError = false;
|
instance.tokenError = false;
|
||||||
await _injectOrShowError(InjectableDll.memory, host);
|
|
||||||
if(!host){
|
if(!host){
|
||||||
await _injectOrShowError(InjectableDll.console, host);
|
await _injectOrShowError(InjectableDll.console, host);
|
||||||
_onGameClientInjected();
|
_onGameClientInjected();
|
||||||
@@ -449,11 +436,12 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
duration: null
|
duration: null
|
||||||
);
|
);
|
||||||
final gameServerPort = _dllController.gameServerPort.text;
|
final gameServerPort = _dllController.gameServerPort.text;
|
||||||
this._pingOperation = await CancelableOperation.fromFuture(pingGameServer(
|
final pingOperation = pingGameServerOrTimeout(
|
||||||
"127.0.0.1:$gameServerPort",
|
"127.0.0.1:$gameServerPort",
|
||||||
timeout: const Duration(minutes: 2)
|
const Duration(minutes: 2)
|
||||||
));
|
);
|
||||||
final localPingResult = (await _pingOperation?.value) ?? false;
|
this._pingOperation = pingOperation;
|
||||||
|
final localPingResult = await pingOperation.future;
|
||||||
_gameServerInfoBar?.close();
|
_gameServerInfoBar?.close();
|
||||||
if (!localPingResult) {
|
if (!localPingResult) {
|
||||||
showRebootInfoBar(
|
showRebootInfoBar(
|
||||||
@@ -475,8 +463,8 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await _hostingController.publishServer(
|
await _hostingController.publishServer(
|
||||||
_gameController.username.text,
|
_hostingController.accountUsername.text,
|
||||||
_hostingController.instance.value!.versionName,
|
_hostingController.instance.value!.version.toString(),
|
||||||
);
|
);
|
||||||
showRebootInfoBar(
|
showRebootInfoBar(
|
||||||
translations.gameServerStarted,
|
translations.gameServerStarted,
|
||||||
@@ -496,18 +484,17 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
duration: null
|
duration: null
|
||||||
);
|
);
|
||||||
final publicIp = await Ipify.ipv4();
|
final publicIp = await Ipify.ipv4();
|
||||||
this._pingOperation = CancelableOperation.fromFuture(pingGameServer("$publicIp:$gameServerPort"));
|
final available = await pingGameServer("$publicIp:$gameServerPort");
|
||||||
final externalResult = (await _pingOperation?.value) ?? false;
|
if(available) {
|
||||||
if (externalResult) {
|
_gameServerInfoBar?.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_gameServerInfoBar?.close();
|
final pingOperation = pingGameServerOrTimeout(
|
||||||
this._pingOperation = CancelableOperation.fromFuture(pingGameServer(
|
|
||||||
"$publicIp:$gameServerPort",
|
"$publicIp:$gameServerPort",
|
||||||
timeout: const Duration(days: 365)
|
const Duration(days: 365)
|
||||||
));
|
);
|
||||||
final future = await _pingOperation?.value ?? false;
|
this._pingOperation = pingOperation;
|
||||||
_gameServerInfoBar = showRebootInfoBar(
|
_gameServerInfoBar = showRebootInfoBar(
|
||||||
translations.checkGameServerFixMessage(gameServerPort),
|
translations.checkGameServerFixMessage(gameServerPort),
|
||||||
action: Button(
|
action: Button(
|
||||||
@@ -518,7 +505,9 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
duration: null,
|
duration: null,
|
||||||
loading: true
|
loading: true
|
||||||
);
|
);
|
||||||
return await future;
|
final result = await pingOperation.future;
|
||||||
|
_gameServerInfoBar?.close();
|
||||||
|
return result;
|
||||||
}finally {
|
}finally {
|
||||||
_gameServerInfoBar?.close();
|
_gameServerInfoBar?.close();
|
||||||
}
|
}
|
||||||
@@ -526,8 +515,13 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
|
|
||||||
Future<void> _onStop({required _StopReason reason, bool? host, String? error, StackTrace? stackTrace}) async {
|
Future<void> _onStop({required _StopReason reason, bool? host, String? error, StackTrace? stackTrace}) async {
|
||||||
if(host == null) {
|
if(host == null) {
|
||||||
await _pingOperation?.cancel();
|
try {
|
||||||
|
_pingOperation?.complete(false);
|
||||||
|
}catch(_) {
|
||||||
|
// Ignore: might be running, don't bother checking
|
||||||
|
} finally {
|
||||||
_pingOperation = null;
|
_pingOperation = null;
|
||||||
|
}
|
||||||
await _operation?.cancel();
|
await _operation?.cancel();
|
||||||
_operation = null;
|
_operation = null;
|
||||||
_backendController.cancelInteractive();
|
_backendController.cancelInteractive();
|
||||||
@@ -535,9 +529,6 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
|
|
||||||
host = host ?? widget.host;
|
host = host ?? widget.host;
|
||||||
final instance = host ? _hostingController.instance.value : _gameController.instance.value;
|
final instance = host ? _hostingController.instance.value : _gameController.instance.value;
|
||||||
if(instance == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(host){
|
if(host){
|
||||||
_hostingController.instance.value = null;
|
_hostingController.instance.value = null;
|
||||||
@@ -561,11 +552,11 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(reason == _StopReason.normal) {
|
if(reason == _StopReason.normal) {
|
||||||
instance.launched = true;
|
instance?.launched = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.kill();
|
instance?.kill();
|
||||||
final child = instance.child;
|
final child = instance?.child;
|
||||||
if(child != null) {
|
if(child != null) {
|
||||||
await _onStop(
|
await _onStop(
|
||||||
reason: reason,
|
reason: reason,
|
||||||
@@ -602,7 +593,7 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case _StopReason.exitCode:
|
case _StopReason.exitCode:
|
||||||
if(!instance.launched) {
|
if(instance != null && !instance.launched) {
|
||||||
showRebootInfoBar(
|
showRebootInfoBar(
|
||||||
translations.corruptedVersionError,
|
translations.corruptedVersionError,
|
||||||
severity: InfoBarSeverity.error,
|
severity: InfoBarSeverity.error,
|
||||||
@@ -638,7 +629,7 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
case _StopReason.tokenError:
|
case _StopReason.tokenError:
|
||||||
_backendController.stop();
|
_backendController.stop();
|
||||||
showRebootInfoBar(
|
showRebootInfoBar(
|
||||||
translations.tokenError(instance.injectedDlls.map((element) => element.name).join(", ")),
|
translations.tokenError(instance == null ? translations.none : instance.injectedDlls.map((element) => element.name).join(", ")),
|
||||||
severity: InfoBarSeverity.error,
|
severity: InfoBarSeverity.error,
|
||||||
duration: infoBarLongDuration,
|
duration: infoBarLongDuration,
|
||||||
action: Button(
|
action: Button(
|
||||||
@@ -674,7 +665,7 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
try {
|
try {
|
||||||
final gameProcess = instance.gamePid;
|
final gameProcess = instance.gamePid;
|
||||||
log("[${hosting ? 'HOST' : 'GAME'}] Injecting ${injectable.name} into process with pid $gameProcess");
|
log("[${hosting ? 'HOST' : 'GAME'}] Injecting ${injectable.name} into process with pid $gameProcess");
|
||||||
final dllPath = await _getDllFileOrStop(injectable, hosting);
|
final dllPath = await _getDllFileOrStop(instance.version, injectable, hosting);
|
||||||
log("[${hosting ? 'HOST' : 'GAME'}] File to inject for ${injectable.name} at path $dllPath");
|
log("[${hosting ? 'HOST' : 'GAME'}] File to inject for ${injectable.name} at path $dllPath");
|
||||||
if(dllPath == null) {
|
if(dllPath == null) {
|
||||||
log("[${hosting ? 'HOST' : 'GAME'}] The file doesn't exist");
|
log("[${hosting ? 'HOST' : 'GAME'}] The file doesn't exist");
|
||||||
@@ -687,10 +678,6 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log("[${hosting ? 'HOST' : 'GAME'}] Trying to inject ${injectable.name}...");
|
log("[${hosting ? 'HOST' : 'GAME'}] Trying to inject ${injectable.name}...");
|
||||||
if(_settingsController.debug.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await injectDll(gameProcess, dllPath);
|
await injectDll(gameProcess, dllPath);
|
||||||
instance.injectedDlls.add(injectable);
|
instance.injectedDlls.add(injectable);
|
||||||
log("[${hosting ? 'HOST' : 'GAME'}] Injected ${injectable.name}");
|
log("[${hosting ? 'HOST' : 'GAME'}] Injected ${injectable.name}");
|
||||||
@@ -705,9 +692,9 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<File?> _getDllFileOrStop(InjectableDll injectable, bool host, [bool isRetry = false]) async {
|
Future<File?> _getDllFileOrStop(Version version, InjectableDll injectable, bool host, [bool isRetry = false]) async {
|
||||||
log("[${host ? 'HOST' : 'GAME'}] Checking dll ${injectable}...");
|
log("[${host ? 'HOST' : 'GAME'}] Checking dll ${injectable}...");
|
||||||
final (file, customDll) = _dllController.getInjectableData(injectable);
|
final (file, customDll) = _dllController.getInjectableData(version, injectable);
|
||||||
log("[${host ? 'HOST' : 'GAME'}] Path: ${file.path}, custom: $customDll");
|
log("[${host ? 'HOST' : 'GAME'}] Path: ${file.path}, custom: $customDll");
|
||||||
if(await file.exists()) {
|
if(await file.exists()) {
|
||||||
log("[${host ? 'HOST' : 'GAME'}] Path exists");
|
log("[${host ? 'HOST' : 'GAME'}] Path exists");
|
||||||
@@ -727,7 +714,7 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
log("[${host ? 'HOST' : 'GAME'}] Path does not exist, downloading critical dll again...");
|
log("[${host ? 'HOST' : 'GAME'}] Path does not exist, downloading critical dll again...");
|
||||||
await _dllController.downloadCriticalDllInteractive(file.path, force: true);
|
await _dllController.downloadCriticalDllInteractive(file.path, force: true);
|
||||||
log("[${host ? 'HOST' : 'GAME'}] Downloaded dll again, retrying check...");
|
log("[${host ? 'HOST' : 'GAME'}] Downloaded dll again, retrying check...");
|
||||||
return _getDllFileOrStop(injectable, host, true);
|
return _getDllFileOrStop(version, injectable, host, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoBarEntry _showLaunchingGameServerWidget() => _gameServerInfoBar = showRebootInfoBar(
|
InfoBarEntry _showLaunchingGameServerWidget() => _gameServerInfoBar = showRebootInfoBar(
|
||||||
@@ -742,7 +729,7 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
loading: true,
|
loading: true,
|
||||||
duration: null,
|
duration: null,
|
||||||
action: Obx(() {
|
action: Obx(() {
|
||||||
if(_settingsController.debug.value || _hostingController.started.value || linkedHosting) {
|
if(_hostingController.started.value || linkedHosting) {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ class InfoBarAreaState extends State<InfoBarArea> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Obx(() => Padding(
|
Widget build(BuildContext context) => StreamBuilder(
|
||||||
|
stream: pagesController.stream,
|
||||||
|
builder: (context, _) => Obx(() => Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
bottom: hasPageButton ? 72.0 : 16.0
|
bottom: hasPageButton ? 72.0 : 16.0
|
||||||
),
|
),
|
||||||
@@ -38,5 +40,6 @@ class InfoBarAreaState extends State<InfoBarArea> {
|
|||||||
child: child
|
child: child
|
||||||
)).toList(growable: false)
|
)).toList(growable: false)
|
||||||
),
|
),
|
||||||
));
|
))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,11 @@ import 'package:fluent_ui/fluent_ui.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:reboot_common/common.dart';
|
import 'package:reboot_common/common.dart';
|
||||||
import 'package:reboot_launcher/src/controller/game_controller.dart';
|
import 'package:reboot_launcher/src/controller/game_controller.dart';
|
||||||
|
import 'package:reboot_launcher/src/controller/hosting_controller.dart';
|
||||||
import 'package:reboot_launcher/src/messenger/abstract/overlay.dart';
|
import 'package:reboot_launcher/src/messenger/abstract/overlay.dart';
|
||||||
import 'package:reboot_launcher/src/messenger/implementation/profile.dart';
|
import 'package:reboot_launcher/src/messenger/implementation/profile.dart';
|
||||||
|
import 'package:reboot_launcher/src/page/abstract/page_type.dart';
|
||||||
|
import 'package:reboot_launcher/src/page/pages.dart';
|
||||||
|
|
||||||
class ProfileWidget extends StatefulWidget {
|
class ProfileWidget extends StatefulWidget {
|
||||||
final GlobalKey<OverlayTargetState> overlayKey;
|
final GlobalKey<OverlayTargetState> overlayKey;
|
||||||
@@ -15,6 +18,7 @@ class ProfileWidget extends StatefulWidget {
|
|||||||
|
|
||||||
class _ProfileWidgetState extends State<ProfileWidget> {
|
class _ProfileWidgetState extends State<ProfileWidget> {
|
||||||
final GameController _gameController = Get.find<GameController>();
|
final GameController _gameController = Get.find<GameController>();
|
||||||
|
final HostingController _hostingController = Get.find<HostingController>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => OverlayTarget(
|
Widget build(BuildContext context) => OverlayTarget(
|
||||||
@@ -22,7 +26,7 @@ class _ProfileWidgetState extends State<ProfileWidget> {
|
|||||||
child: HoverButton(
|
child: HoverButton(
|
||||||
margin: const EdgeInsets.all(8.0),
|
margin: const EdgeInsets.all(8.0),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
if(await showProfileForm(context)) {
|
if(await showProfileForm(context, _username, _password)) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -57,7 +61,7 @@ class _ProfileWidgetState extends State<ProfileWidget> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
_username,
|
_usernameLabel,
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.w600
|
fontWeight: FontWeight.w600
|
||||||
@@ -65,7 +69,7 @@ class _ProfileWidgetState extends State<ProfileWidget> {
|
|||||||
maxLines: 1
|
maxLines: 1
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
_email,
|
_emailLabel,
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.w100
|
fontWeight: FontWeight.w100
|
||||||
@@ -81,8 +85,8 @@ class _ProfileWidgetState extends State<ProfileWidget> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
String get _username {
|
String get _usernameLabel {
|
||||||
var username = _gameController.username.text;
|
final username = _username.text;
|
||||||
if(username.isEmpty) {
|
if(username.isEmpty) {
|
||||||
return kDefaultPlayerName;
|
return kDefaultPlayerName;
|
||||||
}
|
}
|
||||||
@@ -96,8 +100,8 @@ class _ProfileWidgetState extends State<ProfileWidget> {
|
|||||||
return result.substring(0, 1).toUpperCase() + result.substring(1);
|
return result.substring(0, 1).toUpperCase() + result.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
String get _email {
|
String get _emailLabel {
|
||||||
var username = _gameController.username.text;
|
final username = _username.text;
|
||||||
if(username.isEmpty) {
|
if(username.isEmpty) {
|
||||||
return "$kDefaultPlayerName@projectreboot.dev";
|
return "$kDefaultPlayerName@projectreboot.dev";
|
||||||
}
|
}
|
||||||
@@ -108,4 +112,7 @@ class _ProfileWidgetState extends State<ProfileWidget> {
|
|||||||
|
|
||||||
return "$username@projectreboot.dev".toLowerCase();
|
return "$username@projectreboot.dev".toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextEditingController get _username => pageIndex.value == RebootPageType.host.index ? _hostingController.accountUsername : _gameController.username;
|
||||||
|
TextEditingController get _password => pageIndex.value == RebootPageType.host.index ? _hostingController.accountPassword : _gameController.password;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:bitsdojo_window/bitsdojo_window.dart' show appWindow;
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:reboot_launcher/src/util/os.dart';
|
||||||
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
import 'title_bar_icons.dart';
|
import 'title_bar_icons.dart';
|
||||||
import 'title_bar_mouse.dart';
|
import 'title_bar_mouse.dart';
|
||||||
@@ -132,7 +133,7 @@ class MinimizeWindowButton extends WindowButton {
|
|||||||
animate: animate ?? false,
|
animate: animate ?? false,
|
||||||
iconBuilder: (buttonContext) =>
|
iconBuilder: (buttonContext) =>
|
||||||
MinimizeIcon(color: buttonContext.iconColor),
|
MinimizeIcon(color: buttonContext.iconColor),
|
||||||
onPressed: onPressed ?? () => appWindow.minimize());
|
onPressed: onPressed ?? () => windowManager.minimize());
|
||||||
}
|
}
|
||||||
|
|
||||||
class MaximizeWindowButton extends WindowButton {
|
class MaximizeWindowButton extends WindowButton {
|
||||||
@@ -148,7 +149,7 @@ class MaximizeWindowButton extends WindowButton {
|
|||||||
iconBuilder: (buttonContext) =>
|
iconBuilder: (buttonContext) =>
|
||||||
MaximizeIcon(color: buttonContext.iconColor),
|
MaximizeIcon(color: buttonContext.iconColor),
|
||||||
onPressed: onPressed ??
|
onPressed: onPressed ??
|
||||||
() => appWindow.maximizeOrRestore());
|
() => windowManager.maximizeOrRestore());
|
||||||
}
|
}
|
||||||
|
|
||||||
final _defaultCloseButtonColors = WindowButtonColors(
|
final _defaultCloseButtonColors = WindowButtonColors(
|
||||||
@@ -169,5 +170,5 @@ class CloseWindowButton extends WindowButton {
|
|||||||
animate: animate ?? false,
|
animate: animate ?? false,
|
||||||
iconBuilder: (buttonContext) =>
|
iconBuilder: (buttonContext) =>
|
||||||
CloseIcon(color: buttonContext.iconColor),
|
CloseIcon(color: buttonContext.iconColor),
|
||||||
onPressed: onPressed ?? () => appWindow.close());
|
onPressed: onPressed ?? () => windowManager.close());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ import 'package:url_launcher/url_launcher.dart';
|
|||||||
class VersionSelector extends StatefulWidget {
|
class VersionSelector extends StatefulWidget {
|
||||||
const VersionSelector({Key? key}) : super(key: key);
|
const VersionSelector({Key? key}) : super(key: key);
|
||||||
|
|
||||||
static Future<void> openDownloadDialog({bool closable = true}) => showRebootDialog<bool>(
|
static Future<void> openDownloadDialog() => showRebootDialog<bool>(
|
||||||
builder: (context) => AddVersionDialog(
|
builder: (context) => AddVersionDialog(
|
||||||
closable: closable,
|
closable: true,
|
||||||
),
|
),
|
||||||
dismissWithEsc: closable
|
dismissWithEsc: true
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: reboot_launcher
|
name: reboot_launcher
|
||||||
description: Graphical User Interface for Project Reboot
|
description: Graphical User Interface for Project Reboot
|
||||||
version: "9.2.6"
|
version: "10.0.1"
|
||||||
|
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
@@ -17,53 +17,49 @@ dependencies:
|
|||||||
path: ./../common
|
path: ./../common
|
||||||
|
|
||||||
# Windows UI 3
|
# Windows UI 3
|
||||||
fluent_ui: ^4.8.7
|
fluent_ui: ^4.9.1
|
||||||
flutter_acrylic:
|
flutter_acrylic:
|
||||||
path: ./dependencies/flutter_acrylic
|
path: ./dependencies/flutter_acrylic
|
||||||
fluentui_system_icons: ^1.1.238
|
fluentui_system_icons: ^1.1.258
|
||||||
system_theme: ^2.0.0
|
system_theme: ^3.1.1
|
||||||
skeletons:
|
skeletons:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/talok/skeletons
|
url: https://github.com/talok/skeletons
|
||||||
ref: main
|
ref: main
|
||||||
|
|
||||||
# Window management
|
# Window management
|
||||||
bitsdojo_window: ^0.1.5
|
window_manager: ^0.4.2
|
||||||
window_manager: ^0.3.8
|
|
||||||
|
|
||||||
# Extract zip archives (for example the reboot.zip)
|
# Extract zip archives (for example the reboot.zip)
|
||||||
archive: ^3.3.1
|
archive: ^3.6.1
|
||||||
|
|
||||||
# Cryptographic functions
|
# Cryptographic functions
|
||||||
crypto: ^3.0.2
|
|
||||||
bcrypt: ^1.1.3
|
bcrypt: ^1.1.3
|
||||||
pointycastle: ^3.7.3
|
pointycastle: ^3.9.1
|
||||||
|
|
||||||
# Async helpers
|
# Async helpers
|
||||||
async: ^2.8.2
|
async: ^2.11.0
|
||||||
sync: ^0.3.0
|
sync: ^0.3.0
|
||||||
|
|
||||||
# State management
|
# State management
|
||||||
get: ^4.6.5
|
get: ^4.6.6
|
||||||
|
|
||||||
# Native utilities
|
# Native utilities
|
||||||
clipboard: ^0.1.3
|
clipboard: ^0.1.3
|
||||||
app_links: ^6.0.2
|
app_links: ^6.3.2
|
||||||
url_protocol: ^1.0.0
|
|
||||||
windows_taskbar: ^1.1.2
|
windows_taskbar: ^1.1.2
|
||||||
file_picker: ^8.0.3
|
file_picker: ^8.1.2
|
||||||
url_launcher: ^6.1.5
|
url_launcher: ^6.3.0
|
||||||
local_notifier: ^0.1.6
|
local_notifier: ^0.1.6
|
||||||
|
|
||||||
# Server browser
|
# Server browser
|
||||||
supabase_flutter: ^2.5.2
|
supabase_flutter: ^2.7.0
|
||||||
uuid: ^3.0.6
|
|
||||||
dart_ipify: ^1.1.1
|
dart_ipify: ^1.1.1
|
||||||
|
|
||||||
# Storage
|
# Storage
|
||||||
get_storage: ^2.0.3
|
get_storage: ^2.1.1
|
||||||
universal_disk_space: ^0.2.3
|
universal_disk_space: ^0.2.3
|
||||||
path: ^1.8.3
|
path: ^1.9.0
|
||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
intl: any
|
intl: any
|
||||||
@@ -71,23 +67,17 @@ dependencies:
|
|||||||
|
|
||||||
# Auto updater
|
# Auto updater
|
||||||
yaml: ^3.1.2
|
yaml: ^3.1.2
|
||||||
package_info_plus: ^8.0.0
|
package_info_plus: ^8.0.2
|
||||||
version: ^3.0.2
|
version: ^3.0.2
|
||||||
|
|
||||||
# Validate profile
|
# Validate profile
|
||||||
email_validator: ^3.0.0
|
email_validator: ^3.0.0
|
||||||
|
|
||||||
dependency_overrides:
|
|
||||||
xml: ^6.3.0
|
|
||||||
http: ^0.13.5
|
|
||||||
win32: ^3.0.0
|
|
||||||
ffi: ^2.0.0
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
flutter_lints: ^4.0.0
|
flutter_lints: ^5.0.0
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
#include <app_links/app_links_plugin_c_api.h>
|
#include <app_links/app_links_plugin_c_api.h>
|
||||||
#include <bitsdojo_window_windows/bitsdojo_window_plugin.h>
|
|
||||||
#include <flutter_acrylic/flutter_acrylic_plugin.h>
|
#include <flutter_acrylic/flutter_acrylic_plugin.h>
|
||||||
#include <local_notifier/local_notifier_plugin.h>
|
#include <local_notifier/local_notifier_plugin.h>
|
||||||
#include <screen_retriever/screen_retriever_plugin.h>
|
#include <screen_retriever/screen_retriever_plugin.h>
|
||||||
@@ -19,8 +18,6 @@
|
|||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
AppLinksPluginCApiRegisterWithRegistrar(
|
AppLinksPluginCApiRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("AppLinksPluginCApi"));
|
registry->GetRegistrarForPlugin("AppLinksPluginCApi"));
|
||||||
BitsdojoWindowPluginRegisterWithRegistrar(
|
|
||||||
registry->GetRegistrarForPlugin("BitsdojoWindowPlugin"));
|
|
||||||
FlutterAcrylicPluginRegisterWithRegistrar(
|
FlutterAcrylicPluginRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("FlutterAcrylicPlugin"));
|
registry->GetRegistrarForPlugin("FlutterAcrylicPlugin"));
|
||||||
LocalNotifierPluginRegisterWithRegistrar(
|
LocalNotifierPluginRegisterWithRegistrar(
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
app_links
|
app_links
|
||||||
bitsdojo_window_windows
|
|
||||||
flutter_acrylic
|
flutter_acrylic
|
||||||
local_notifier
|
local_notifier
|
||||||
screen_retriever
|
screen_retriever
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
#include <bitsdojo_window_windows/bitsdojo_window_plugin.h>
|
|
||||||
auto bdw = bitsdojo_window_configure(BDW_CUSTOM_FRAME | BDW_HIDE_ON_STARTUP);
|
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include <flutter/dart_project.h>
|
#include <flutter/dart_project.h>
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ bool Win32Window::CreateAndShow(const std::wstring &title,
|
|||||||
HWND window = CreateWindow(
|
HWND window = CreateWindow(
|
||||||
window_class,
|
window_class,
|
||||||
title.c_str(),
|
title.c_str(),
|
||||||
WS_OVERLAPPED | WS_BORDER | WS_THICKFRAME,
|
WS_OVERLAPPEDWINDOW,
|
||||||
Scale(origin.x, scale_factor),
|
Scale(origin.x, scale_factor),
|
||||||
Scale(origin.y, scale_factor),
|
Scale(origin.y, scale_factor),
|
||||||
Scale(size.width, scale_factor),
|
Scale(size.width, scale_factor),
|
||||||
@@ -198,6 +198,9 @@ Win32Window::MessageHandler(HWND hwnd,
|
|||||||
SetFocus(child_content_);
|
SetFocus(child_content_);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case WM_NCCALCSIZE:
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(window_handle_, message, wparam, lparam);
|
return DefWindowProc(window_handle_, message, wparam, lparam);
|
||||||
|
|||||||
Reference in New Issue
Block a user