mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-13 11:12:23 +01:00
Fixed some UI things and nightly
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:bitsdojo_window/bitsdojo_window.dart';
|
import 'package:bitsdojo_window/bitsdojo_window.dart';
|
||||||
import 'package:bitsdojo_window_windows/bitsdojo_window_windows.dart'
|
import 'package:bitsdojo_window_windows/bitsdojo_window_windows.dart'
|
||||||
show WinDesktopWindow;
|
show WinDesktopWindow;
|
||||||
@@ -7,11 +9,14 @@ import 'package:get_storage/get_storage.dart';
|
|||||||
import 'package:reboot_launcher/src/controller/build_controller.dart';
|
import 'package:reboot_launcher/src/controller/build_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/server_controller.dart';
|
import 'package:reboot_launcher/src/controller/server_controller.dart';
|
||||||
|
import 'package:reboot_launcher/src/util/binary.dart';
|
||||||
import 'package:reboot_launcher/src/util/os.dart';
|
import 'package:reboot_launcher/src/util/os.dart';
|
||||||
import 'package:system_theme/system_theme.dart';
|
import 'package:system_theme/system_theme.dart';
|
||||||
import 'package:reboot_launcher/src/page/home_page.dart';
|
import 'package:reboot_launcher/src/page/home_page.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
|
await Directory(safeBinariesDirectory)
|
||||||
|
.create(recursive: true);
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
await SystemTheme.accentColor.load();
|
await SystemTheme.accentColor.load();
|
||||||
await GetStorage.init("game");
|
await GetStorage.init("game");
|
||||||
@@ -22,7 +27,7 @@ void main() async {
|
|||||||
Get.put(BuildController());
|
Get.put(BuildController());
|
||||||
SystemTheme.accentColor.load();
|
SystemTheme.accentColor.load();
|
||||||
doWhenWindowReady(() {
|
doWhenWindowReady(() {
|
||||||
const size = Size(600, 380);
|
const size = Size(600, 365);
|
||||||
var window = appWindow as WinDesktopWindow;
|
var window = appWindow as WinDesktopWindow;
|
||||||
window.setWindowCutOnMaximize(appBarSize * 2);
|
window.setWindowCutOnMaximize(appBarSize * 2);
|
||||||
appWindow.size = size;
|
appWindow.size = size;
|
||||||
|
|||||||
@@ -5,13 +5,14 @@ import 'package:get/get.dart';
|
|||||||
import 'package:get_storage/get_storage.dart';
|
import 'package:get_storage/get_storage.dart';
|
||||||
|
|
||||||
import 'package:reboot_launcher/src/util/binary.dart';
|
import 'package:reboot_launcher/src/util/binary.dart';
|
||||||
|
import 'package:reboot_launcher/src/util/server.dart';
|
||||||
|
|
||||||
class ServerController extends GetxController {
|
class ServerController extends GetxController {
|
||||||
late final TextEditingController host;
|
late final TextEditingController host;
|
||||||
late final TextEditingController port;
|
late final TextEditingController port;
|
||||||
late final RxBool embedded;
|
late final RxBool embedded;
|
||||||
late final RxBool started;
|
late final RxBool warning;
|
||||||
Process? process;
|
late RxBool started;
|
||||||
|
|
||||||
ServerController() {
|
ServerController() {
|
||||||
var storage = GetStorage("server");
|
var storage = GetStorage("server");
|
||||||
@@ -24,7 +25,12 @@ class ServerController extends GetxController {
|
|||||||
embedded = RxBool(storage.read("embedded") ?? true);
|
embedded = RxBool(storage.read("embedded") ?? true);
|
||||||
embedded.listen((value) => storage.write("embedded", value));
|
embedded.listen((value) => storage.write("embedded", value));
|
||||||
|
|
||||||
|
warning = RxBool(storage.read("warning") ?? true);
|
||||||
|
warning.listen((value) => storage.write("warning", value));
|
||||||
|
|
||||||
started = RxBool(false);
|
started = RxBool(false);
|
||||||
|
isLawinPortFree()
|
||||||
|
.then((value) => started = RxBool(!value));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future kill() async {
|
Future kill() async {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:bitsdojo_window/bitsdojo_window.dart' hide WindowBorder;
|
|
||||||
import 'package:fluent_ui/fluent_ui.dart';
|
import 'package:fluent_ui/fluent_ui.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:get_storage/get_storage.dart';
|
||||||
import 'package:reboot_launcher/src/page/info_page.dart';
|
import 'package:reboot_launcher/src/page/info_page.dart';
|
||||||
import 'package:reboot_launcher/src/page/launcher_page.dart';
|
import 'package:reboot_launcher/src/page/launcher_page.dart';
|
||||||
import 'package:reboot_launcher/src/page/server_page.dart';
|
import 'package:reboot_launcher/src/page/server_page.dart';
|
||||||
@@ -25,7 +26,10 @@ class _HomePageState extends State<HomePage> with WindowListener {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
windowManager.addListener(this);
|
windowManager.addListener(this);
|
||||||
_future = downloadRebootDll();
|
var storage = GetStorage("update");
|
||||||
|
int? lastUpdateMs = storage.read("last_update");
|
||||||
|
_future = compute(downloadRebootDll, lastUpdateMs);
|
||||||
|
_future.then((value) => storage.write("last_update", value));
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,8 +60,8 @@ class _HomePageState extends State<HomePage> with WindowListener {
|
|||||||
displayMode: PaneDisplayMode.top,
|
displayMode: PaneDisplayMode.top,
|
||||||
indicator: const EndNavigationIndicator(),
|
indicator: const EndNavigationIndicator(),
|
||||||
items: [
|
items: [
|
||||||
_createPane("Launcher", FluentIcons.game),
|
_createPane("Home", FluentIcons.game),
|
||||||
_createPane("Server", FluentIcons.server_enviroment),
|
_createPane("Lawin", FluentIcons.server_enviroment),
|
||||||
_createPane("Info", FluentIcons.info),
|
_createPane("Info", FluentIcons.info),
|
||||||
],
|
],
|
||||||
trailing: WindowTitleBar(focused: _focused)),
|
trailing: WindowTitleBar(focused: _focused)),
|
||||||
@@ -70,6 +74,7 @@ class _HomePageState extends State<HomePage> with WindowListener {
|
|||||||
"An error occurred while loading the launcher: ${snapshot.error}",
|
"An error occurred while loading the launcher: ${snapshot.error}",
|
||||||
textAlign: TextAlign.center));
|
textAlign: TextAlign.center));
|
||||||
}
|
}
|
||||||
|
|
||||||
return NavigationBody(
|
return NavigationBody(
|
||||||
index: _index,
|
index: _index,
|
||||||
children: _createPages(snapshot.hasData));
|
children: _createPages(snapshot.hasData));
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class InfoPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const Expanded(
|
const Expanded(
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.bottomLeft, child: Text("Version 3.1${kDebugMode ? '-DEBUG' : ''}")))
|
alignment: Alignment.bottomLeft, child: Text("Version 3.4${kDebugMode ? '-DEBUG' : ''}")))
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class LauncherPage extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
UsernameBox(),
|
UsernameBox(),
|
||||||
VersionSelector(),
|
VersionSelector(),
|
||||||
DeploymentSelector(enabled: true),
|
DeploymentSelector(enabled: false),
|
||||||
const LaunchButton()
|
const LaunchButton()
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,14 +1,58 @@
|
|||||||
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:reboot_launcher/src/widget/local_server_switch.dart';
|
import 'package:reboot_launcher/src/widget/local_server_switch.dart';
|
||||||
import 'package:reboot_launcher/src/widget/port_input.dart';
|
import 'package:reboot_launcher/src/widget/port_input.dart';
|
||||||
|
|
||||||
import 'package:reboot_launcher/src/widget/host_input.dart';
|
import 'package:reboot_launcher/src/widget/host_input.dart';
|
||||||
import 'package:reboot_launcher/src/widget/server_button.dart';
|
import 'package:reboot_launcher/src/widget/server_button.dart';
|
||||||
|
|
||||||
class ServerPage extends StatelessWidget {
|
import '../controller/server_controller.dart';
|
||||||
|
|
||||||
|
class ServerPage extends StatefulWidget {
|
||||||
const ServerPage({Key? key}) : super(key: key);
|
const ServerPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ServerPage> createState() => _ServerPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ServerPageState extends State<ServerPage> {
|
||||||
|
final ServerController _serverController = Get.find<ServerController>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
if (_serverController.warning.value) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
|
await _showAdvancedUserWarning();
|
||||||
|
_serverController.warning.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _showAdvancedUserWarning() async {
|
||||||
|
await showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => ContentDialog(
|
||||||
|
content: const SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: Text("This section is reserved for advanced users",
|
||||||
|
textAlign: TextAlign.center),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: FilledButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: const Text('I understand'),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
|
|||||||
@@ -25,5 +25,8 @@ File _locateInternalBinary(String binary){
|
|||||||
String get internalBinariesDirectory =>
|
String get internalBinariesDirectory =>
|
||||||
"${File(Platform.resolvedExecutable).parent.path}\\data\\flutter_assets\\assets\\binaries";
|
"${File(Platform.resolvedExecutable).parent.path}\\data\\flutter_assets\\assets\\binaries";
|
||||||
|
|
||||||
|
Directory get tempDirectory =>
|
||||||
|
Directory("${Platform.environment["Temp"]}");
|
||||||
|
|
||||||
String get safeBinariesDirectory =>
|
String get safeBinariesDirectory =>
|
||||||
"${Platform.environment["UserProfile"]}\\.reboot_launcher";
|
"${Platform.environment["UserProfile"]}\\.reboot_launcher";
|
||||||
@@ -15,7 +15,7 @@ const _userAgent =
|
|||||||
|
|
||||||
final _cookieRegex = RegExp("cookie=\"(.*?);");
|
final _cookieRegex = RegExp("cookie=\"(.*?);");
|
||||||
final _manifestSourceUrl = Uri.parse(
|
final _manifestSourceUrl = Uri.parse(
|
||||||
"https://github.com/VastBlast/FortniteManifestArchive/blob/main/INSTALLATION.md");
|
"https://github.com/VastBlast/FortniteManifestArchive/blob/main/README.md");
|
||||||
final _archiveCookieUrl = Uri.parse("http://allinstaller.xyz/rel");
|
final _archiveCookieUrl = Uri.parse("http://allinstaller.xyz/rel");
|
||||||
final _archiveSourceUrl = Uri.parse("http://allinstaller.xyz/rel?i=1");
|
final _archiveSourceUrl = Uri.parse("http://allinstaller.xyz/rel?i=1");
|
||||||
|
|
||||||
|
|||||||
@@ -1,47 +1,47 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:archive/archive_io.dart';
|
import 'package:archive/archive_io.dart';
|
||||||
import 'package:get_storage/get_storage.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:reboot_launcher/src/util/binary.dart';
|
import 'package:reboot_launcher/src/util/binary.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:crypto/crypto.dart';
|
import 'package:crypto/crypto.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:path/path.dart' as path;
|
||||||
|
|
||||||
const _rebootUrl =
|
const _rebootUrl =
|
||||||
"https://nightly.link/Milxnor/Universal-Walking-Simulator/workflows/msbuild/master/Release.zip";
|
"https://nightly.link/Milxnor/Universal-Walking-Simulator/workflows/msbuild/master/Release.zip";
|
||||||
final GetStorage _storage = GetStorage("update");
|
|
||||||
|
|
||||||
Future<DateTime?> _getLastUpdate() async {
|
Future<DateTime?> _getLastUpdate(int? lastUpdateMs) async {
|
||||||
int? timeInMillis = _storage.read("last_update");
|
return lastUpdateMs != null ? DateTime.fromMillisecondsSinceEpoch(lastUpdateMs) : null;
|
||||||
return timeInMillis != null ? DateTime.fromMillisecondsSinceEpoch(timeInMillis) : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<File> downloadRebootDll() async {
|
Future<int> downloadRebootDll(int? lastUpdateMs) async {
|
||||||
var now = DateTime.now();
|
var now = DateTime.now();
|
||||||
var oldRebootDll = await loadBinary("reboot.dll", true);
|
var oldRebootDll = await loadBinary("reboot.dll", true);
|
||||||
var lastUpdate = await _getLastUpdate();
|
var lastUpdate = await _getLastUpdate(lastUpdateMs);
|
||||||
var exists = await oldRebootDll.exists();
|
var exists = await oldRebootDll.exists();
|
||||||
if(lastUpdate != null && now.difference(lastUpdate).inHours <= 24 && exists){
|
if(lastUpdate != null && now.difference(lastUpdate).inHours <= 24 && await oldRebootDll.exists()){
|
||||||
return oldRebootDll;
|
return lastUpdateMs!;
|
||||||
}
|
}
|
||||||
|
|
||||||
var response = await http.get(Uri.parse(_rebootUrl));
|
var response = await http.get(Uri.parse(_rebootUrl));
|
||||||
var tempZip = File("${Platform.environment["Temp"]}/reboot.zip");
|
var tempZip = File("${tempDirectory.path}/reboot.zip");
|
||||||
await tempZip.writeAsBytes(response.bodyBytes);
|
await tempZip.writeAsBytes(response.bodyBytes);
|
||||||
await extractFileToDisk(tempZip.path, safeBinariesDirectory);
|
|
||||||
var pdb = await loadBinary("Project Reboot.pdb", true);
|
var outputDir = await tempDirectory.createTemp("reboot");
|
||||||
pdb.delete();
|
await extractFileToDisk(tempZip.path, outputDir.path);
|
||||||
var rebootDll = await loadBinary("Project Reboot.dll", true);
|
|
||||||
if (!(await rebootDll.exists())) {
|
var rebootDll = outputDir.listSync()
|
||||||
|
.firstWhereOrNull((element) => path.extension(element.path) == ".dll");
|
||||||
|
if(rebootDll == null){
|
||||||
throw Exception("Missing reboot dll");
|
throw Exception("Missing reboot dll");
|
||||||
}
|
}
|
||||||
|
|
||||||
_storage.write("last_update", now.millisecondsSinceEpoch);
|
if (exists && sha1.convert(await oldRebootDll.readAsBytes()) == sha1.convert(await File(rebootDll.path).readAsBytes())) {
|
||||||
if (exists && sha1.convert(await oldRebootDll.readAsBytes()) == sha1.convert(await rebootDll.readAsBytes())) {
|
outputDir.delete();
|
||||||
rebootDll.delete();
|
return lastUpdateMs!;
|
||||||
return oldRebootDll;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await rebootDll.rename(oldRebootDll.path);
|
await rebootDll.rename(oldRebootDll.path);
|
||||||
return oldRebootDll;
|
outputDir.delete();
|
||||||
|
return now.millisecondsSinceEpoch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:archive/archive_io.dart';
|
import 'package:archive/archive_io.dart';
|
||||||
import 'package:fluent_ui/fluent_ui.dart';
|
import 'package:fluent_ui/fluent_ui.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:path/path.dart' as path;
|
import 'package:path/path.dart' as path;
|
||||||
import 'package:process_run/shell.dart';
|
import 'package:process_run/shell.dart';
|
||||||
@@ -13,8 +14,6 @@ const String _serverUrl =
|
|||||||
"https://github.com/Lawin0129/LawinServer/archive/refs/heads/main.zip";
|
"https://github.com/Lawin0129/LawinServer/archive/refs/heads/main.zip";
|
||||||
const String _portableServerUrl =
|
const String _portableServerUrl =
|
||||||
"https://cdn.discordapp.com/attachments/998020695223193673/1019999251994005504/LawinServer.exe";
|
"https://cdn.discordapp.com/attachments/998020695223193673/1019999251994005504/LawinServer.exe";
|
||||||
const String _nodeUrl =
|
|
||||||
"https://nodejs.org/dist/v16.16.0/node-v16.16.0-x64.msi";
|
|
||||||
|
|
||||||
Future<bool> downloadServer(bool portable) async {
|
Future<bool> downloadServer(bool portable) async {
|
||||||
if(!portable){
|
if(!portable){
|
||||||
@@ -41,17 +40,7 @@ Future<void> updateEngineConfig() async {
|
|||||||
await engine.writeAsString(await patchedEngine.readAsString());
|
await engine.writeAsString(await patchedEngine.readAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<File> downloadNode() async {
|
Future<bool> isLawinPortFree() async {
|
||||||
var client = HttpClient();
|
|
||||||
client.badCertificateCallback = ((cert, host, port) => true);
|
|
||||||
var request = await client.getUrl(Uri.parse(_nodeUrl));
|
|
||||||
var response = await request.close();
|
|
||||||
var file = File("${Platform.environment["Temp"]}\\node.msi");
|
|
||||||
await response.pipe(file.openWrite());
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool> isPortFree() async {
|
|
||||||
var portBat = await loadBinary("port.bat", false);
|
var portBat = await loadBinary("port.bat", false);
|
||||||
var process = await Process.run(portBat.path, []);
|
var process = await Process.run(portBat.path, []);
|
||||||
return !process.outText.contains(" LISTENING "); // Goofy way, best we got
|
return !process.outText.contains(" LISTENING "); // Goofy way, best we got
|
||||||
@@ -104,33 +93,23 @@ Future<bool> _pingAddress(String host, String port) async {
|
|||||||
&& process.outText.contains("TcpTestSucceeded : True");
|
&& process.outText.contains("TcpTestSucceeded : True");
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Process?> startEmbedded(BuildContext context, bool running, bool needsFreePort) async {
|
Future<bool> changeEmbeddedServerState(BuildContext context, bool running) async {
|
||||||
var releaseBat = await loadBinary("release.bat", false);
|
|
||||||
if (running) {
|
if (running) {
|
||||||
|
var releaseBat = await loadBinary("release.bat", false);
|
||||||
await Process.run(releaseBat.path, []);
|
await Process.run(releaseBat.path, []);
|
||||||
return null;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
var free = await isPortFree();
|
|
||||||
if (!free && needsFreePort) {
|
|
||||||
var shouldKill = await _showAlreadyBindPortWarning(context);
|
|
||||||
if (!shouldKill) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
await Process.run(releaseBat.path, []);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var nodeProcess = await Process.run("where", ["node"]);
|
var nodeProcess = await Process.run("where", ["node"]);
|
||||||
if(nodeProcess.exitCode == 0) {
|
if(nodeProcess.exitCode == 0) {
|
||||||
if(!(await serverLocation.exists()) && !(await _showServerDownloadInfo(context, false))){
|
if(!(await serverLocation.exists()) && !(await _showServerDownloadInfo(context, false))){
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var serverRunner = File("${serverLocation.path}/start.bat");
|
var serverRunner = File("${serverLocation.path}/start.bat");
|
||||||
if (!(await serverRunner.exists())) {
|
if (!(await serverRunner.exists())) {
|
||||||
_showEmbeddedError(context, serverRunner.path);
|
_showEmbeddedError(context, serverRunner.path);
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var nodeModules = Directory("${serverLocation.path}/node_modules");
|
var nodeModules = Directory("${serverLocation.path}/node_modules");
|
||||||
@@ -139,20 +118,21 @@ Future<Process?> startEmbedded(BuildContext context, bool running, bool needsFre
|
|||||||
workingDirectory: serverLocation.path);
|
workingDirectory: serverLocation.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return await Process.start(serverRunner.path, [],
|
await Process.start(serverRunner.path, [], workingDirectory: serverLocation.path);
|
||||||
workingDirectory: serverLocation.path);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var portableServer = await loadBinary("LawinServer.exe", true);
|
var portableServer = await loadBinary("LawinServer.exe", true);
|
||||||
if(!(await portableServer.exists()) && !(await _showServerDownloadInfo(context, true))){
|
if(!(await portableServer.exists()) && !(await _showServerDownloadInfo(context, true))){
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await Process.start(portableServer.path, []);
|
await Process.start(portableServer.path, []);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> _showServerDownloadInfo(BuildContext context, bool portable) async {
|
Future<bool> _showServerDownloadInfo(BuildContext context, bool portable) async {
|
||||||
var nodeFuture = downloadServer(portable);
|
var nodeFuture = compute(downloadServer, portable);
|
||||||
var result = await showDialog<bool>(
|
var result = await showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => ContentDialog(
|
builder: (context) => ContentDialog(
|
||||||
@@ -222,26 +202,3 @@ void _showEmbeddedError(BuildContext context, String path) {
|
|||||||
],
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<bool> _showAlreadyBindPortWarning(BuildContext context) async {
|
|
||||||
return await showDialog<bool>(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => ContentDialog(
|
|
||||||
content: const Text(
|
|
||||||
"Port 3551 is already in use, do you want to kill the associated process?",
|
|
||||||
textAlign: TextAlign.center),
|
|
||||||
actions: [
|
|
||||||
FilledButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(false),
|
|
||||||
style: ButtonStyle(
|
|
||||||
backgroundColor: ButtonState.all(Colors.red)),
|
|
||||||
child: const Text('Close'),
|
|
||||||
),
|
|
||||||
FilledButton(
|
|
||||||
child: const Text('Kill'),
|
|
||||||
onPressed: () => Navigator.of(context).pop(true)),
|
|
||||||
],
|
|
||||||
)) ??
|
|
||||||
false;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:async/async.dart';
|
|||||||
import 'package:fluent_ui/fluent_ui.dart';
|
import 'package:fluent_ui/fluent_ui.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:process_run/shell.dart';
|
||||||
import 'package:reboot_launcher/src/controller/build_controller.dart';
|
import 'package:reboot_launcher/src/controller/build_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/util/build.dart';
|
import 'package:reboot_launcher/src/util/build.dart';
|
||||||
@@ -12,6 +13,7 @@ import 'package:reboot_launcher/src/widget/select_file.dart';
|
|||||||
import 'package:reboot_launcher/src/widget/version_name_input.dart';
|
import 'package:reboot_launcher/src/widget/version_name_input.dart';
|
||||||
|
|
||||||
import 'package:reboot_launcher/src/model/fortnite_version.dart';
|
import 'package:reboot_launcher/src/model/fortnite_version.dart';
|
||||||
|
import '../model/fortnite_build.dart';
|
||||||
import 'build_selector.dart';
|
import 'build_selector.dart';
|
||||||
|
|
||||||
class AddServerVersion extends StatefulWidget {
|
class AddServerVersion extends StatefulWidget {
|
||||||
@@ -40,7 +42,7 @@ class _AddServerVersionState extends State<AddServerVersion> {
|
|||||||
_future = _buildController.builds != null
|
_future = _buildController.builds != null
|
||||||
? Future.value(true)
|
? Future.value(true)
|
||||||
: compute(fetchBuilds, null)
|
: compute(fetchBuilds, null)
|
||||||
.then((value) => _buildController.builds = value);
|
.then((value) => _buildController.builds = value);
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,14 +12,21 @@ class DeploymentSelector extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SmartSwitch(
|
return Tooltip(
|
||||||
value: _gameController.host,
|
message: enabled ? "Whether the launched client should be used to host multiplayer games or not" : "Hosting is not allowed",
|
||||||
onDisabledPress: !enabled
|
child: _buildSwitch(context)
|
||||||
? () => showSnackbar(context,
|
|
||||||
const Snackbar(content: Text("Hosting is not allowed")))
|
|
||||||
: null,
|
|
||||||
label: "Host",
|
|
||||||
enabled: enabled
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SmartSwitch _buildSwitch(BuildContext context) {
|
||||||
|
return SmartSwitch(
|
||||||
|
value: _gameController.host,
|
||||||
|
onDisabledPress: !enabled
|
||||||
|
? () => showSnackbar(context,
|
||||||
|
const Snackbar(content: Text("Hosting is not allowed")))
|
||||||
|
: null,
|
||||||
|
label: "Host",
|
||||||
|
enabled: enabled
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,17 +11,26 @@ class HostInput extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Obx(() => SmartInput(
|
return Obx(() => Tooltip(
|
||||||
label: "Host",
|
message: _serverController.embedded.value
|
||||||
placeholder: "Type the host name",
|
? "The remote lawin host cannot be set when running on embedded"
|
||||||
controller: _serverController.host,
|
: "The remote host of the lawin server to use for authentication",
|
||||||
enabled: !_serverController.embedded.value,
|
child: _buildInput(context),
|
||||||
onTap: () => _serverController.embedded.value
|
|
||||||
? showSnackbar(
|
|
||||||
context,
|
|
||||||
const Snackbar(
|
|
||||||
content: Text("The host is locked when embedded is on")))
|
|
||||||
: {},
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SmartInput _buildInput(BuildContext context) {
|
||||||
|
return SmartInput(
|
||||||
|
label: "Host",
|
||||||
|
placeholder: "Type the host name",
|
||||||
|
controller: _serverController.host,
|
||||||
|
enabled: !_serverController.embedded.value,
|
||||||
|
onTap: () => _serverController.embedded.value
|
||||||
|
? showSnackbar(
|
||||||
|
context,
|
||||||
|
const Snackbar(
|
||||||
|
content: Text("The host is locked when embedded is on")))
|
||||||
|
: {},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,12 +32,13 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
alignment: AlignmentDirectional.bottomCenter,
|
alignment: AlignmentDirectional.bottomCenter,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: Listener(
|
child: Obx(() => Tooltip(
|
||||||
child: Obx(() => Button(
|
message: _gameController.started.value ? "Close the running Fortnite instance" : "Launch a new Fortnite instance",
|
||||||
|
child: Button(
|
||||||
onPressed: () => _onPressed(context),
|
onPressed: () => _onPressed(context),
|
||||||
child: Text(_gameController.started.value ? "Close" : "Launch")
|
child: Text(_gameController.started.value ? "Close" : "Launch")
|
||||||
)),
|
),
|
||||||
),
|
)),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -63,10 +64,9 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_updateServerState(true);
|
_updateServerState(true);
|
||||||
if (!_serverController.started.value && _serverController.embedded.value && await isPortFree()) {
|
if (!_serverController.started.value && _serverController.embedded.value && await isLawinPortFree()) {
|
||||||
var process = await startEmbedded(context, false, false);
|
var result = await changeEmbeddedServerState(context, false);
|
||||||
_serverController.process = process;
|
_serverController.started(result);
|
||||||
_serverController.started(process != null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_onStart();
|
_onStart();
|
||||||
|
|||||||
@@ -11,9 +11,12 @@ class LocalServerSwitch extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SmartSwitch(
|
return Tooltip(
|
||||||
value: _serverController.embedded,
|
message: "Determines whether an embedded or remote lawin server should be used",
|
||||||
label: "Embedded"
|
child: SmartSwitch(
|
||||||
|
value: _serverController.embedded,
|
||||||
|
label: "Embedded"
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,17 +11,25 @@ class PortInput extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Obx(() => SmartInput(
|
return Obx(() => Tooltip(
|
||||||
|
message: _serverController.embedded.value
|
||||||
|
? "The remote lawin port cannot be set when running on embedded"
|
||||||
|
: "The remote port of the lawin server to use for authentication",
|
||||||
|
child: _buildInput(context)));
|
||||||
|
}
|
||||||
|
|
||||||
|
SmartInput _buildInput(BuildContext context) {
|
||||||
|
return SmartInput(
|
||||||
label: "Port",
|
label: "Port",
|
||||||
placeholder: "Type the host port",
|
placeholder: "Type the host port",
|
||||||
controller: _serverController.port,
|
controller: _serverController.port,
|
||||||
enabled: !_serverController.embedded.value,
|
enabled: !_serverController.embedded.value,
|
||||||
onTap: () => _serverController.embedded.value
|
onTap: () => _serverController.embedded.value
|
||||||
? showSnackbar(
|
? showSnackbar(
|
||||||
context,
|
context,
|
||||||
const Snackbar(
|
const Snackbar(
|
||||||
content: Text("The port is locked when embedded is on")))
|
content: Text("The port is locked when embedded is on")))
|
||||||
: {},
|
: {},
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:reboot_launcher/src/util/server.dart';
|
|||||||
|
|
||||||
class ServerButton extends StatelessWidget {
|
class ServerButton extends StatelessWidget {
|
||||||
final ServerController _serverController = Get.find<ServerController>();
|
final ServerController _serverController = Get.find<ServerController>();
|
||||||
|
|
||||||
ServerButton({Key? key}) : super(key: key);
|
ServerButton({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -14,31 +15,36 @@ class ServerButton extends StatelessWidget {
|
|||||||
alignment: AlignmentDirectional.bottomCenter,
|
alignment: AlignmentDirectional.bottomCenter,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: Obx(() => Button(
|
child: Obx(() => Tooltip(
|
||||||
onPressed: () => _onPressed(context),
|
message: !_serverController.embedded.value
|
||||||
child: Text(_serverController.embedded.value
|
? "Check the address of the remote Lawin server"
|
||||||
? !_serverController.started.value
|
: _serverController.started.value
|
||||||
? "Start"
|
? "Stop the running Lawin server instance"
|
||||||
: "Stop"
|
: "Start a new Lawin server instance",
|
||||||
: "Check address"))),
|
child: Button(
|
||||||
|
onPressed: () => _onPressed(context),
|
||||||
|
child: Text(_serverController.embedded.value
|
||||||
|
? !_serverController.started.value
|
||||||
|
? "Start"
|
||||||
|
: "Stop"
|
||||||
|
: "Check address")),
|
||||||
|
)),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onPressed(BuildContext context) async {
|
void _onPressed(BuildContext context) async {
|
||||||
if (!_serverController.embedded.value) {
|
if (!_serverController.embedded.value) {
|
||||||
checkAddress(context, _serverController.host.text, _serverController.port.text);
|
checkAddress(
|
||||||
|
context, _serverController.host.text, _serverController.port.text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var running = _serverController.started.value;
|
var running = _serverController.started.value;
|
||||||
_serverController.started(!running);
|
_serverController.started.value = !running;
|
||||||
var process = await startEmbedded(context, running, true);
|
var updatedRunning = await changeEmbeddedServerState(context, running);
|
||||||
var updatedRunning = process != null;
|
|
||||||
if (updatedRunning != _serverController.started.value) {
|
if (updatedRunning != _serverController.started.value) {
|
||||||
_serverController.started.value = updatedRunning;
|
_serverController.started.value = updatedRunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
_serverController.process = process;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,14 @@ class UsernameBox extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Obx(() => SmartInput(
|
return Obx(() => Tooltip(
|
||||||
label: "Username",
|
message: _gameController.host.value ? "The username of the game hoster" : "The in-game username of your player",
|
||||||
placeholder: "Type your ${_gameController.host.value ? 'hosting' : "in-game"} username",
|
child: SmartInput(
|
||||||
controller: _gameController.username,
|
label: "Username",
|
||||||
populate: true
|
placeholder: "Type your ${_gameController.host.value ? 'hosting' : "in-game"} username",
|
||||||
|
controller: _gameController.username,
|
||||||
|
populate: true
|
||||||
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,33 +22,36 @@ class VersionSelector extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InfoLabel(
|
return Tooltip(
|
||||||
label: "Version",
|
message: "The version of Fortnite to launch",
|
||||||
child: Align(
|
child: InfoLabel(
|
||||||
alignment: AlignmentDirectional.centerStart,
|
label: "Version",
|
||||||
child: Row(
|
child: Align(
|
||||||
children: [
|
alignment: AlignmentDirectional.centerStart,
|
||||||
Expanded(child: _createSelector(context)),
|
child: Row(
|
||||||
const SizedBox(
|
children: [
|
||||||
width: 16,
|
Expanded(child: _createSelector(context)),
|
||||||
),
|
const SizedBox(
|
||||||
Tooltip(
|
width: 16,
|
||||||
message: "Add a local fortnite build to the versions list",
|
),
|
||||||
child: Button(
|
Tooltip(
|
||||||
child: const Icon(FluentIcons.open_file),
|
message: "Add a local fortnite build to the versions list",
|
||||||
onPressed: () => _openLocalVersionDialog(context)),
|
child: Button(
|
||||||
),
|
child: const Icon(FluentIcons.open_file),
|
||||||
const SizedBox(
|
onPressed: () => _openLocalVersionDialog(context)),
|
||||||
width: 16,
|
),
|
||||||
),
|
const SizedBox(
|
||||||
Tooltip(
|
width: 16,
|
||||||
message: "Download a fortnite build from the archive",
|
),
|
||||||
child: Button(
|
Tooltip(
|
||||||
child: const Icon(FluentIcons.download),
|
message: "Download a fortnite build from the archive",
|
||||||
onPressed: () => _openDownloadVersionDialog(context)),
|
child: Button(
|
||||||
)
|
child: const Icon(FluentIcons.download),
|
||||||
],
|
onPressed: () => _openDownloadVersionDialog(context)),
|
||||||
)));
|
)
|
||||||
|
],
|
||||||
|
))),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _createSelector(BuildContext context) {
|
Widget _createSelector(BuildContext context) {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
name: reboot_launcher
|
name: reboot_launcher
|
||||||
description: Launcher for project reboot
|
description: Launcher for project reboot
|
||||||
version: "3.1.0"
|
version: "3.4.0"
|
||||||
|
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.17.6 <3.0.5"
|
sdk: ">=2.17.6 <=3.3.2"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
@@ -48,7 +48,7 @@ msix_config:
|
|||||||
display_name: Reboot Launcher
|
display_name: Reboot Launcher
|
||||||
publisher_display_name: Auties00
|
publisher_display_name: Auties00
|
||||||
identity_name: 31868Auties00.RebootLauncher
|
identity_name: 31868Auties00.RebootLauncher
|
||||||
msix_version: 3.1.0.0
|
msix_version: 3.4.0.0
|
||||||
publisher: CN=E6CD08C6-DECF-4034-A3EB-2D5FA2CA8029
|
publisher: CN=E6CD08C6-DECF-4034-A3EB-2D5FA2CA8029
|
||||||
logo_path: ./assets/icons/reboot.ico
|
logo_path: ./assets/icons/reboot.ico
|
||||||
architecture: x64
|
architecture: x64
|
||||||
|
|||||||
Reference in New Issue
Block a user