mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Add test mode (#3012)
This commit is contained in:
parent
0b15b62e3d
commit
0cd87366a7
@ -38,9 +38,9 @@ namespace Bloxstrap
|
|||||||
private readonly CancellationTokenSource _cancelTokenSource = new();
|
private readonly CancellationTokenSource _cancelTokenSource = new();
|
||||||
|
|
||||||
private readonly IAppData AppData;
|
private readonly IAppData AppData;
|
||||||
|
private readonly LaunchMode _launchMode;
|
||||||
|
|
||||||
private string _launchCommandLine = App.LaunchSettings.RobloxLaunchArgs;
|
private string _launchCommandLine = App.LaunchSettings.RobloxLaunchArgs;
|
||||||
private LaunchMode _launchMode = App.LaunchSettings.RobloxLaunchMode;
|
|
||||||
private string _latestVersionGuid = null!;
|
private string _latestVersionGuid = null!;
|
||||||
private PackageManifest _versionPackageManifest = null!;
|
private PackageManifest _versionPackageManifest = null!;
|
||||||
|
|
||||||
@ -59,8 +59,10 @@ namespace Bloxstrap
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Core
|
#region Core
|
||||||
public Bootstrapper()
|
public Bootstrapper(LaunchMode launchMode)
|
||||||
{
|
{
|
||||||
|
_launchMode = launchMode;
|
||||||
|
|
||||||
// this is now always enabled as of v2.8.0
|
// this is now always enabled as of v2.8.0
|
||||||
if (Dialog is not null)
|
if (Dialog is not null)
|
||||||
Dialog.CancelEnabled = true;
|
Dialog.CancelEnabled = true;
|
||||||
@ -382,18 +384,23 @@ namespace Bloxstrap
|
|||||||
autoclosePids.Add(pid);
|
autoclosePids.Add(pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
string args = _appPid.ToString();
|
string argPids = _appPid.ToString();
|
||||||
|
|
||||||
if (autoclosePids.Any())
|
if (autoclosePids.Any())
|
||||||
args += $";{String.Join(',', autoclosePids)}";
|
argPids += $";{String.Join(',', autoclosePids)}";
|
||||||
|
|
||||||
if (App.Settings.Prop.EnableActivityTracking || autoclosePids.Any())
|
if (App.Settings.Prop.EnableActivityTracking || App.LaunchSettings.TestModeFlag.Active || autoclosePids.Any())
|
||||||
{
|
{
|
||||||
using var ipl = new InterProcessLock("Watcher", TimeSpan.FromSeconds(5));
|
using var ipl = new InterProcessLock("Watcher", TimeSpan.FromSeconds(5));
|
||||||
|
|
||||||
|
string args = $"-watcher \"{argPids}\"";
|
||||||
|
|
||||||
|
if (App.LaunchSettings.TestModeFlag.Active)
|
||||||
|
args += " -testmode";
|
||||||
|
|
||||||
// TODO: look into if this needs to be launched *before* roblox starts
|
// TODO: look into if this needs to be launched *before* roblox starts
|
||||||
if (ipl.IsAcquired)
|
if (ipl.IsAcquired)
|
||||||
Process.Start(Paths.Process, $"-watcher \"{args}\"");
|
Process.Start(Paths.Process, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,7 @@ namespace Bloxstrap
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case NextAction.LaunchRoblox:
|
case NextAction.LaunchRoblox:
|
||||||
App.LaunchSettings.RobloxLaunchMode = LaunchMode.Player;
|
LaunchRoblox(LaunchMode.Player);
|
||||||
LaunchRoblox();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -39,7 +38,7 @@ namespace Bloxstrap
|
|||||||
else if (App.LaunchSettings.WatcherFlag.Active)
|
else if (App.LaunchSettings.WatcherFlag.Active)
|
||||||
LaunchWatcher();
|
LaunchWatcher();
|
||||||
else if (App.LaunchSettings.RobloxLaunchMode != LaunchMode.None)
|
else if (App.LaunchSettings.RobloxLaunchMode != LaunchMode.None)
|
||||||
LaunchRoblox();
|
LaunchRoblox(App.LaunchSettings.RobloxLaunchMode);
|
||||||
else if (!App.LaunchSettings.QuietFlag.Active)
|
else if (!App.LaunchSettings.QuietFlag.Active)
|
||||||
LaunchMenu();
|
LaunchMenu();
|
||||||
else
|
else
|
||||||
@ -163,10 +162,13 @@ namespace Bloxstrap
|
|||||||
ProcessNextAction(dialog.CloseAction);
|
ProcessNextAction(dialog.CloseAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LaunchRoblox()
|
public static void LaunchRoblox(LaunchMode launchMode)
|
||||||
{
|
{
|
||||||
const string LOG_IDENT = "LaunchHandler::LaunchRoblox";
|
const string LOG_IDENT = "LaunchHandler::LaunchRoblox";
|
||||||
|
|
||||||
|
if (launchMode == LaunchMode.None)
|
||||||
|
throw new InvalidOperationException("No Roblox launch mode set");
|
||||||
|
|
||||||
if (!File.Exists(Path.Combine(Paths.System, "mfplat.dll")))
|
if (!File.Exists(Path.Combine(Paths.System, "mfplat.dll")))
|
||||||
{
|
{
|
||||||
Frontend.ShowMessageBox(Strings.Bootstrapper_WMFNotFound, MessageBoxImage.Error);
|
Frontend.ShowMessageBox(Strings.Bootstrapper_WMFNotFound, MessageBoxImage.Error);
|
||||||
@ -194,7 +196,7 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
// start bootstrapper and show the bootstrapper modal if we're not running silently
|
// start bootstrapper and show the bootstrapper modal if we're not running silently
|
||||||
App.Logger.WriteLine(LOG_IDENT, "Initializing bootstrapper");
|
App.Logger.WriteLine(LOG_IDENT, "Initializing bootstrapper");
|
||||||
var bootstrapper = new Bootstrapper();
|
var bootstrapper = new Bootstrapper(launchMode);
|
||||||
IBootstrapperDialog? dialog = null;
|
IBootstrapperDialog? dialog = null;
|
||||||
|
|
||||||
if (!App.LaunchSettings.QuietFlag.Active)
|
if (!App.LaunchSettings.QuietFlag.Active)
|
||||||
|
@ -22,6 +22,8 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
public LaunchFlag NoLaunchFlag { get; } = new("nolaunch");
|
public LaunchFlag NoLaunchFlag { get; } = new("nolaunch");
|
||||||
|
|
||||||
|
public LaunchFlag TestModeFlag { get; } = new("testmode");
|
||||||
|
|
||||||
public LaunchFlag NoGPUFlag { get; } = new("nogpu");
|
public LaunchFlag NoGPUFlag { get; } = new("nogpu");
|
||||||
|
|
||||||
public LaunchFlag UpgradeFlag { get; } = new("upgrade");
|
public LaunchFlag UpgradeFlag { get; } = new("upgrade");
|
||||||
|
22
Bloxstrap/Resources/Strings.Designer.cs
generated
22
Bloxstrap/Resources/Strings.Designer.cs
generated
@ -3241,6 +3241,28 @@ namespace Bloxstrap.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Test mode.
|
||||||
|
/// </summary>
|
||||||
|
public static string Menu_TestMode {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Menu.TestMode", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Test mode makes it easier to iteratively test how your settings affect Roblox.
|
||||||
|
///
|
||||||
|
///While enabled, it will automatically launch Roblox after closing Settings, and reopen Settings after closing Roblox, in a cycle until you disable it.
|
||||||
|
///
|
||||||
|
///Would you like to enable test mode?.
|
||||||
|
/// </summary>
|
||||||
|
public static string Menu_TestMode_Prompt {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Menu.TestMode.Prompt", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Bloxstrap Settings.
|
/// Looks up a localized string similar to Bloxstrap Settings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1237,4 +1237,14 @@ Please manually delete Bloxstrap.exe from the install location or try restarting
|
|||||||
<data name="Dialog.Exception.Report" xml:space="preserve">
|
<data name="Dialog.Exception.Report" xml:space="preserve">
|
||||||
<value>Report exception</value>
|
<value>Report exception</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Menu.TestMode" xml:space="preserve">
|
||||||
|
<value>Test mode</value>
|
||||||
|
</data>
|
||||||
|
<data name="Menu.TestMode.Prompt" xml:space="preserve">
|
||||||
|
<value>Test mode makes it easier to iteratively test how your settings affect Roblox.
|
||||||
|
|
||||||
|
While enabled, it will automatically launch Roblox after closing Settings, and reopen Settings after closing Roblox, in a cycle until you disable it.
|
||||||
|
|
||||||
|
Would you like to enable test mode?</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
@ -10,9 +10,9 @@
|
|||||||
xmlns:resources="clr-namespace:Bloxstrap.Resources"
|
xmlns:resources="clr-namespace:Bloxstrap.Resources"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="1500" d:DesignWidth="800"
|
d:DesignHeight="1500" d:DesignWidth="800"
|
||||||
|
d:DataContext="{d:DesignInstance dmodels:AboutViewModel, IsDesignTimeCreatable=True}"
|
||||||
Title="AboutPage"
|
Title="AboutPage"
|
||||||
Scrollable="True">
|
Scrollable="True">
|
||||||
<!--d:DataContext="{d:DesignInstance dmodels:AboutViewModel, IsDesignTimeCreatable=True}"-->
|
|
||||||
|
|
||||||
<StackPanel Margin="0,0,14,14">
|
<StackPanel Margin="0,0,14,14">
|
||||||
<StackPanel.Resources>
|
<StackPanel.Resources>
|
||||||
@ -126,6 +126,7 @@
|
|||||||
<controls:MarkdownTextBlock MarkdownText="[toyoda165](https://www.roblox.com/users/923416649/profile)" />
|
<controls:MarkdownTextBlock MarkdownText="[toyoda165](https://www.roblox.com/users/923416649/profile)" />
|
||||||
<controls:MarkdownTextBlock MarkdownText="[ShadowCodeX](https://github.com/ShadowCodeX-debug)" />
|
<controls:MarkdownTextBlock MarkdownText="[ShadowCodeX](https://github.com/ShadowCodeX-debug)" />
|
||||||
<controls:MarkdownTextBlock MarkdownText="[cub-has-injected](https://github.com/cub-has-injected)" />
|
<controls:MarkdownTextBlock MarkdownText="[cub-has-injected](https://github.com/cub-has-injected)" />
|
||||||
|
<controls:MarkdownTextBlock MarkdownText="[AskaLangly](https://github.com/AskaLangly)" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</controls:Expander>
|
</controls:Expander>
|
||||||
|
|
||||||
|
@ -36,14 +36,14 @@ namespace Bloxstrap.UI.Elements.ContextMenu
|
|||||||
_activityWatcher.OnLogOpen += ActivityWatcher_OnLogOpen;
|
_activityWatcher.OnLogOpen += ActivityWatcher_OnLogOpen;
|
||||||
_activityWatcher.OnGameJoin += ActivityWatcher_OnGameJoin;
|
_activityWatcher.OnGameJoin += ActivityWatcher_OnGameJoin;
|
||||||
_activityWatcher.OnGameLeave += ActivityWatcher_OnGameLeave;
|
_activityWatcher.OnGameLeave += ActivityWatcher_OnGameLeave;
|
||||||
|
|
||||||
|
if (!App.Settings.Prop.UseDisableAppPatch)
|
||||||
|
GameHistoryMenuItem.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_watcher.RichPresence is not null)
|
if (_watcher.RichPresence is not null)
|
||||||
RichPresenceMenuItem.Visibility = Visibility.Visible;
|
RichPresenceMenuItem.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
if (!App.Settings.Prop.UseDisableAppPatch)
|
|
||||||
GameHistoryMenuItem.Visibility = Visibility.Visible;
|
|
||||||
|
|
||||||
VersionTextBlock.Text = $"{App.ProjectName} v{App.Version}";
|
VersionTextBlock.Text = $"{App.ProjectName} v{App.Version}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,9 @@
|
|||||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||||
xmlns:base="clr-namespace:Bloxstrap.UI.Elements.Base"
|
xmlns:base="clr-namespace:Bloxstrap.UI.Elements.Base"
|
||||||
xmlns:resources="clr-namespace:Bloxstrap.Resources"
|
xmlns:resources="clr-namespace:Bloxstrap.Resources"
|
||||||
|
xmlns:dmodels="clr-namespace:Bloxstrap.UI.ViewModels.Settings"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
|
d:DataContext="{d:DesignInstance dmodels:MainWindowViewModel, IsDesignTimeCreatable=True}"
|
||||||
Title="{x:Static resources:Strings.Menu_Title}"
|
Title="{x:Static resources:Strings.Menu_Title}"
|
||||||
MinWidth="960"
|
MinWidth="960"
|
||||||
Width="980"
|
Width="980"
|
||||||
@ -16,7 +18,8 @@
|
|||||||
ExtendsContentIntoTitleBar="True"
|
ExtendsContentIntoTitleBar="True"
|
||||||
WindowBackdropType="Mica"
|
WindowBackdropType="Mica"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
Closing="WpfUiWindow_Closing">
|
Closing="WpfUiWindow_Closing"
|
||||||
|
Closed="WpfUiWindow_Closed">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
@ -84,6 +87,7 @@
|
|||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
@ -91,10 +95,16 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</StatusBar.ItemsPanel>
|
</StatusBar.ItemsPanel>
|
||||||
<StatusBarItem Grid.Column="1" Padding="0,0,4,0">
|
<StatusBarItem Grid.Column="0">
|
||||||
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<ui:ToggleSwitch IsChecked="{Binding TestModeEnabled, Mode=TwoWay}" />
|
||||||
|
<TextBlock Padding="12,0,0,0" Text="{x:Static resources:Strings.Menu_TestMode}" VerticalAlignment="Center" FontSize="14" />
|
||||||
|
</StackPanel>
|
||||||
|
</StatusBarItem>
|
||||||
|
<StatusBarItem Grid.Column="2" Padding="0,0,4,0">
|
||||||
<ui:Button Content="{x:Static resources:Strings.Menu_Save}" Appearance="Primary" Command="{Binding SaveSettingsCommand, Mode=OneWay}" />
|
<ui:Button Content="{x:Static resources:Strings.Menu_Save}" Appearance="Primary" Command="{Binding SaveSettingsCommand, Mode=OneWay}" />
|
||||||
</StatusBarItem>
|
</StatusBarItem>
|
||||||
<StatusBarItem Grid.Column="2" Padding="4,0,0,0">
|
<StatusBarItem Grid.Column="3" Padding="4,0,0,0">
|
||||||
<ui:Button Content="{x:Static resources:Strings.Common_Close}" Command="{Binding CloseWindowCommand, Mode=OneWay}" />
|
<ui:Button Content="{x:Static resources:Strings.Common_Close}" Command="{Binding CloseWindowCommand, Mode=OneWay}" />
|
||||||
</StatusBarItem>
|
</StatusBarItem>
|
||||||
</StatusBar>
|
</StatusBar>
|
||||||
|
@ -100,8 +100,13 @@ namespace Bloxstrap.UI.Elements.Settings
|
|||||||
_state.Left = this.Left;
|
_state.Left = this.Left;
|
||||||
|
|
||||||
App.State.Save();
|
App.State.Save();
|
||||||
|
}
|
||||||
|
|
||||||
if (!e.Cancel)
|
private void WpfUiWindow_Closed(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (App.LaunchSettings.TestModeFlag.Active)
|
||||||
|
LaunchHandler.LaunchRoblox(LaunchMode.Player);
|
||||||
|
else
|
||||||
App.SoftTerminate();
|
App.SoftTerminate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Windows.Input;
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
using Bloxstrap.UI.Elements.About;
|
using Bloxstrap.UI.Elements.About;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
|
||||||
@ -16,6 +17,23 @@ namespace Bloxstrap.UI.ViewModels.Settings
|
|||||||
|
|
||||||
public EventHandler? RequestCloseWindowEvent;
|
public EventHandler? RequestCloseWindowEvent;
|
||||||
|
|
||||||
|
public bool TestModeEnabled
|
||||||
|
{
|
||||||
|
get => App.LaunchSettings.TestModeFlag.Active;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
var result = Frontend.ShowMessageBox(Strings.Menu_TestMode_Prompt, MessageBoxImage.Information, MessageBoxButton.YesNo);
|
||||||
|
|
||||||
|
if (result != MessageBoxResult.Yes)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
App.LaunchSettings.TestModeFlag.Active = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OpenAbout() => new MainWindow().ShowDialog();
|
private void OpenAbout() => new MainWindow().ShowDialog();
|
||||||
|
|
||||||
private void CloseWindow() => RequestCloseWindowEvent?.Invoke(this, EventArgs.Empty);
|
private void CloseWindow() => RequestCloseWindowEvent?.Invoke(this, EventArgs.Empty);
|
||||||
|
@ -69,7 +69,7 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
if (App.Settings.Prop.UseDisableAppPatch)
|
if (App.Settings.Prop.UseDisableAppPatch)
|
||||||
{
|
{
|
||||||
ActivityWatcher.OnAppClose += (_, _) =>
|
ActivityWatcher.OnAppClose += delegate
|
||||||
{
|
{
|
||||||
App.Logger.WriteLine(LOG_IDENT, "Received desktop app exit, closing Roblox");
|
App.Logger.WriteLine(LOG_IDENT, "Received desktop app exit, closing Roblox");
|
||||||
using var process = Process.GetProcessById(_gameClientPid);
|
using var process = Process.GetProcessById(_gameClientPid);
|
||||||
@ -125,6 +125,9 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
foreach (int pid in _autoclosePids)
|
foreach (int pid in _autoclosePids)
|
||||||
CloseProcess(pid);
|
CloseProcess(pid);
|
||||||
|
|
||||||
|
if (App.LaunchSettings.TestModeFlag.Active)
|
||||||
|
Process.Start(Paths.Process, "-settings -testmode");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
Loading…
Reference in New Issue
Block a user