desktop app disabling: revamp w/ activity tracking

This commit is contained in:
pizzaboxer 2024-05-19 00:17:09 +01:00
parent 68f2a457c1
commit 374feedb11
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
9 changed files with 55 additions and 54 deletions

View File

@ -274,13 +274,6 @@ namespace Bloxstrap
SetStatus(Resources.Strings.Bootstrapper_Status_Starting);
if (_launchCommandLine == "--app" && App.Settings.Prop.UseDisableAppPatch)
{
Utilities.ShellExecute("https://www.roblox.com/games");
Dialog?.CloseBootstrapper();
return;
}
if (!File.Exists(Path.Combine(Paths.System, "mfplat.dll")))
{
Frontend.ShowMessageBox(
@ -357,7 +350,7 @@ namespace Bloxstrap
if (App.Settings.Prop.EnableActivityTracking)
{
activityWatcher = new();
activityWatcher = new(gameClientPid);
shouldWait = true;
App.NotifyIcon?.SetActivityWatcher(activityWatcher);
@ -1122,8 +1115,6 @@ namespace Bloxstrap
if (!Directory.Exists(Paths.Modifications))
Directory.CreateDirectory(Paths.Modifications);
bool appDisabled = App.Settings.Prop.UseDisableAppPatch && !_launchCommandLine.Contains("--deeplink");
// cursors
await CheckModPreset(App.Settings.Prop.CursorType == CursorType.From2006, new Dictionary<string, string>
{
@ -1152,8 +1143,7 @@ namespace Bloxstrap
});
// Mobile.rbxl
await CheckModPreset(appDisabled, @"ExtraContent\places\Mobile.rbxl", "");
await CheckModPreset(App.Settings.Prop.UseOldAvatarBackground && !appDisabled, @"ExtraContent\places\Mobile.rbxl", "OldAvatarBackground.rbxl");
await CheckModPreset(App.Settings.Prop.UseOldAvatarBackground, @"ExtraContent\places\Mobile.rbxl", "OldAvatarBackground.rbxl");
// emoji presets are downloaded remotely from github due to how large they are
string contentFonts = Path.Combine(Paths.Modifications, "content\\fonts");

View File

@ -12,11 +12,13 @@
private const string GameDisconnectedEntry = "[FLog::Network] Time to disconnect replication data:";
private const string GameTeleportingEntry = "[FLog::SingleSurfaceApp] initiateTeleport";
private const string GameMessageEntry = "[FLog::Output] [BloxstrapRPC]";
private const string GameLeavingEntry = "[FLog::SingleSurfaceApp] leaveUGCGameInternal";
private const string GameJoiningEntryPattern = @"! Joining game '([0-9a-f\-]{36})' place ([0-9]+) at ([0-9\.]+)";
private const string GameJoiningUDMUXPattern = @"UDMUX Address = ([0-9\.]+), Port = [0-9]+ \| RCC Server Address = ([0-9\.]+), Port = [0-9]+";
private const string GameJoinedEntryPattern = @"serverId: ([0-9\.]+)\|[0-9]+";
private int _gameClientPid;
private int _logEntriesRead = 0;
private bool _teleportMarker = false;
private bool _reservedTeleportMarker = false;
@ -43,6 +45,11 @@
public bool IsDisposed = false;
public ActivityWatcher(int gameClientPid)
{
_gameClientPid = gameClientPid;
}
public async void StartWatcher()
{
const string LOG_IDENT = "ActivityWatcher::StartWatcher";
@ -207,7 +214,13 @@
}
else if (ActivityInGame && ActivityPlaceId != 0)
{
if (entry.Contains(GameDisconnectedEntry))
if (App.Settings.Prop.UseDisableAppPatch && entry.Contains(GameLeavingEntry))
{
App.Logger.WriteLine(LOG_IDENT, "Received desktop app exit, closing Roblox");
using var process = Process.GetProcessById(_gameClientPid);
process.CloseMainWindow();
}
else if (entry.Contains(GameDisconnectedEntry))
{
App.Logger.WriteLine(LOG_IDENT, $"Disconnected from Game ({ActivityPlaceId}/{ActivityJobId}/{ActivityMachineAddress})");

View File

@ -86,11 +86,6 @@ namespace Bloxstrap
}
else if (arg.StartsWith("roblox:"))
{
if (App.Settings.Prop.UseDisableAppPatch)
Frontend.ShowMessageBox(
Resources.Strings.Bootstrapper_DeeplinkTempEnabled,
MessageBoxImage.Information
);
RobloxLaunchArgs = $"--app --deeplink {arg}";

View File

@ -2448,6 +2448,24 @@ namespace Bloxstrap.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Roblox will fully close when you leave a game instead of dropping you back into the app..
/// </summary>
public static string Menu_Integrations_DesktopApp_Description {
get {
return ResourceManager.GetString("Menu.Integrations.DesktopApp.Description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Don&apos;t exit to desktop app.
/// </summary>
public static string Menu_Integrations_DesktopApp_Title {
get {
return ResourceManager.GetString("Menu.Integrations.DesktopApp.Title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Allows for Bloxstrap to detect what Roblox game you&apos;re playing. Certain features may require this..
/// </summary>
@ -2637,24 +2655,6 @@ namespace Bloxstrap.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Stops the desktop app from showing, especially when you leave a game..
/// </summary>
public static string Menu_Mods_Presets_DisableDesktopApp_Description {
get {
return ResourceManager.GetString("Menu.Mods.Presets.DisableDesktopApp.Description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Disable desktop app.
/// </summary>
public static string Menu_Mods_Presets_DisableDesktopApp_Title {
get {
return ResourceManager.GetString("Menu.Mods.Presets.DisableDesktopApp.Title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Choose which type of emoji should Roblox use..
/// </summary>

View File

@ -927,6 +927,12 @@ Selecting 'No' will ignore this warning and continue installation.</value>
<data name="Menu.Integrations.Description" xml:space="preserve">
<value>Configure quick and easy ways to improve the Roblox gameplay experience.</value>
</data>
<data name="Menu.Integrations.DesktopApp.Description" xml:space="preserve">
<value>Roblox will fully close when you leave a game instead of dropping you back into the app.</value>
</data>
<data name="Menu.Integrations.DesktopApp.Title" xml:space="preserve">
<value>Don't exit to desktop app</value>
</data>
<data name="Menu.Integrations.EnableActivityTracking.Description" xml:space="preserve">
<value>Allows for Bloxstrap to detect what Roblox game you're playing. Certain features may require this.</value>
</data>
@ -991,12 +997,6 @@ Selecting 'No' will ignore this warning and continue installation.</value>
<data name="Menu.Mods.OpenModsFolder.Title" xml:space="preserve">
<value>Open Mods Folder</value>
</data>
<data name="Menu.Mods.Presets.DisableDesktopApp.Description" xml:space="preserve">
<value>Stops the desktop app from showing, especially when you leave a game.</value>
</data>
<data name="Menu.Mods.Presets.DisableDesktopApp.Title" xml:space="preserve">
<value>Disable desktop app</value>
</data>
<data name="Menu.Mods.Presets.EmojiType.Description" xml:space="preserve">
<value>Choose which type of emoji should Roblox use.</value>
</data>

View File

@ -32,6 +32,13 @@
<ui:ToggleSwitch IsChecked="{Binding ShowServerDetailsEnabled, Mode=TwoWay}" />
</controls:OptionControl>
<controls:OptionControl
Header="{x:Static resources:Strings.Menu_Integrations_DesktopApp_Title}"
Description="{x:Static resources:Strings.Menu_Integrations_DesktopApp_Description}"
IsEnabled="{Binding InnerContent.IsChecked, ElementName=ActivityTrackingOption, Mode=OneWay}">
<ui:ToggleSwitch IsChecked="{Binding DisableAppPatchEnabled, Mode=TwoWay}" />
</controls:OptionControl>
<TextBlock Text="{x:Static resources:Strings.Common_DiscordRichPresence}" FontSize="16" FontWeight="Medium" Margin="0,16,0,0" />
<TextBlock Text="{x:Static resources:Strings.Menu_Integrations_RequiresActivityTracking}" TextWrapping="Wrap" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />

View File

@ -93,12 +93,6 @@
<ui:ToggleSwitch IsChecked="{Binding OldCharacterSoundsEnabled, Mode=TwoWay}" />
</controls:OptionControl>
<controls:OptionControl
Header="{x:Static resources:Strings.Menu_Mods_Presets_DisableDesktopApp_Title}"
Description="{x:Static resources:Strings.Menu_Mods_Presets_DisableDesktopApp_Description}">
<ui:ToggleSwitch IsChecked="{Binding DisableAppPatchEnabled, Mode=TwoWay}" />
</controls:OptionControl>
<controls:OptionControl
Header="{x:Static resources:Strings.Menu_Mods_Presets_EmojiType_Title}"
Description="{x:Static resources:Strings.Menu_Mods_Presets_EmojiType_Description}">

View File

@ -49,10 +49,12 @@ namespace Bloxstrap.UI.ViewModels.Menu
if (!value)
{
ShowServerDetailsEnabled = value;
DisableAppPatchEnabled = value;
DiscordActivityEnabled = value;
DiscordActivityJoinEnabled = value;
OnPropertyChanged(nameof(ShowServerDetailsEnabled));
OnPropertyChanged(nameof(DisableAppPatchEnabled));
OnPropertyChanged(nameof(DiscordActivityEnabled));
OnPropertyChanged(nameof(DiscordActivityJoinEnabled));
}
@ -92,6 +94,12 @@ namespace Bloxstrap.UI.ViewModels.Menu
set => App.Settings.Prop.MultiInstanceLaunching = value;
}
public bool DisableAppPatchEnabled
{
get => App.Settings.Prop.UseDisableAppPatch;
set => App.Settings.Prop.UseDisableAppPatch = value;
}
public ObservableCollection<CustomIntegration> CustomIntegrations
{
get => App.Settings.Prop.CustomIntegrations;

View File

@ -96,12 +96,6 @@ namespace Bloxstrap.UI.ViewModels.Menu
set => App.Settings.Prop.UseOldAvatarBackground = value;
}
public bool DisableAppPatchEnabled
{
get => App.Settings.Prop.UseDisableAppPatch;
set => App.Settings.Prop.UseDisableAppPatch = value;
}
public IReadOnlyCollection<EmojiType> EmojiTypes => EmojiTypeEx.Selections;
public EmojiType SelectedEmojiType