Remove rbxfpsunlocker in favor of target FPS FFlag

This commit is contained in:
pizzaboxer 2023-04-12 00:55:59 +02:00
parent 994d736eeb
commit 65c85b612a
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
11 changed files with 27 additions and 197 deletions

View File

@ -170,7 +170,7 @@ namespace Bloxstrap
CheckInstall();
await RbxFpsUnlocker.CheckInstall();
IntegrationMigrator.Execute();
// at this point we've finished updating our configs
App.Settings.Save();
@ -354,25 +354,6 @@ namespace Bloxstrap
return;
}
if (App.Settings.Prop.RFUEnabled && Process.GetProcessesByName(RbxFpsUnlocker.ApplicationName).Length == 0)
{
App.Logger.WriteLine("[Bootstrapper::StartRoblox] Using rbxfpsunlocker");
ProcessStartInfo startInfo = new()
{
WorkingDirectory = Path.Combine(Directories.Integrations, "rbxfpsunlocker"),
FileName = Path.Combine(Directories.Integrations, @"rbxfpsunlocker\rbxfpsunlocker.exe")
};
Process process = Process.Start(startInfo)!;
if (App.Settings.Prop.RFUAutoclose)
{
shouldWait = true;
autocloseProcesses.Add(process);
}
}
if (App.Settings.Prop.UseDiscordRichPresence || App.Settings.Prop.ShowServerDetails)
{
activityWatcher = new();

View File

@ -71,7 +71,12 @@ namespace Bloxstrap.Helpers
// set to 99999 by default if it doesnt immediately exist
if (GetValue("DFIntTaskSchedulerTargetFps") is null)
SetValue("DFIntTaskSchedulerTargetFps", 99999);
{
SetValue("DFIntTaskSchedulerTargetFps", 9999);
if (!App.IsFirstRun)
Save();
}
}
public override void Save()

View File

@ -0,0 +1,18 @@
using System.IO;
namespace Bloxstrap.Helpers
{
static class IntegrationMigrator
{
public static void Execute()
{
App.FastFlags.Load();
// v2.2.0 - remove rbxfpsunlocker
string rbxfpsunlocker = Path.Combine(Directories.Integrations, "rbxfpsunlocker");
if (Directory.Exists(rbxfpsunlocker))
Directory.Delete(rbxfpsunlocker, true);
}
}
}

View File

@ -1,122 +0,0 @@
using System;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Threading.Tasks;
using Bloxstrap.Helpers;
using Bloxstrap.Models;
namespace Bloxstrap.Integrations
{
internal class RbxFpsUnlocker
{
public const string ApplicationName = "rbxfpsunlocker";
public const string ProjectRepository = "axstin/rbxfpsunlocker";
// default settings but with QuickStart set to true and CheckForUpdates set to false
private static readonly string Settings =
"UnlockClient=true\n" +
"UnlockStudio=false\n" +
"FPSCapValues=[30.000000, 60.000000, 75.000000, 120.000000, 144.000000, 165.000000, 240.000000, 360.000000]\n" +
"FPSCapSelection=0\n" +
"FPSCap=0.000000\n" +
"CheckForUpdates=false\n" +
"NonBlockingErrors=true\n" +
"SilentErrors=false\n" +
"QuickStart=true\n";
public static void CheckIfRunning()
{
Process[] processes = Process.GetProcessesByName(ApplicationName);
if (processes.Length == 0)
return;
App.Logger.WriteLine("[RbxFpsUnlocker::CheckIfRunning] Closing currently running rbxfpsunlocker processes...");
try
{
foreach (Process process in processes)
{
if (process.MainModule?.FileName is null)
continue;
if (!process.MainModule.FileName.Contains(Directories.Base))
continue;
process.Kill();
process.Close();
}
}
catch (Exception ex)
{
App.Logger.WriteLine($"[RbxFpsUnlocker::CheckIfRunning] Could not close rbxfpsunlocker process! {ex}");
}
}
public static async Task CheckInstall()
{
string folderLocation = Path.Combine(Directories.Base, "Integrations\\rbxfpsunlocker");
string fileLocation = Path.Combine(folderLocation, "rbxfpsunlocker.exe");
string settingsLocation = Path.Combine(folderLocation, "settings");
if (!App.Settings.Prop.RFUEnabled)
{
// don't delete rbxfpsunlocker if rbxfpsunlocker and roblox is currently running
if (Utilities.CheckIfProcessRunning(ApplicationName) && Utilities.CheckIfRobloxRunning())
return;
App.State.Prop.RbxFpsUnlockerVersion = "";
App.State.Save();
if (Directory.Exists(folderLocation))
{
CheckIfRunning();
Directory.Delete(folderLocation, true);
}
return;
}
var releaseInfo = await Utilities.GetJson<GithubRelease>($"https://api.github.com/repos/{ProjectRepository}/releases/latest");
if (releaseInfo is null || releaseInfo.Assets is null)
return;
string downloadUrl = releaseInfo.Assets[0].BrowserDownloadUrl;
DirectoryInfo directory = new(folderLocation);
directory.Create();
// i have no idea how the read only flag enables itself but apparently it just does
directory.Attributes &= ~FileAttributes.ReadOnly;
if (File.Exists(fileLocation))
{
// no new release published, return
if (App.State.Prop.RbxFpsUnlockerVersion == releaseInfo.TagName)
return;
CheckIfRunning();
File.Delete(fileLocation);
}
App.Logger.WriteLine("[RbxFpsUnlocker::CheckInstall] Installing/Updating rbxfpsunlocker...");
{
byte[] bytes = await App.HttpClient.GetByteArrayAsync(downloadUrl);
using MemoryStream zipStream = new(bytes);
using ZipArchive archive = new(zipStream);
archive.ExtractToDirectory(folderLocation, true);
}
if (!File.Exists(settingsLocation))
await File.WriteAllTextAsync(settingsLocation, Settings);
App.State.Prop.RbxFpsUnlockerVersion = releaseInfo.TagName;
App.State.Save();
}
}
}

View File

@ -25,8 +25,6 @@ namespace Bloxstrap.Models
// integration configuration
public bool UseDiscordRichPresence { get; set; } = true;
public bool HideRPCButtons { get; set; } = true;
public bool RFUEnabled { get; set; } = false;
public bool RFUAutoclose { get; set; } = false;
public bool UseReShade { get; set; } = true;
public bool UseReShadeExtraviPresets { get; set; } = true;
public bool ShowServerDetails { get; set; } = false;

View File

@ -9,7 +9,6 @@ namespace Bloxstrap.Models
public class State
{
public string VersionGuid { get; set; } = "";
public string RbxFpsUnlockerVersion { get; set; } = "";
public string ReShadeConfigVersion { get; set; } = "";
public string ExtraviReShadePresetsVersion { get; set; } = "";
public List<string> ModManifest { get; set; } = new();

View File

@ -97,23 +97,6 @@ namespace Bloxstrap.ViewModels
set => App.Settings.Prop.UseReShadeExtraviPresets = value;
}
public bool RbxFpsUnlockerEnabled
{
get => App.Settings.Prop.RFUEnabled;
set
{
App.Settings.Prop.RFUEnabled = value;
RbxFpsUnlockerAutocloseEnabled = value;
OnPropertyChanged(nameof(RbxFpsUnlockerAutocloseEnabled));
}
}
public bool RbxFpsUnlockerAutocloseEnabled
{
get => App.Settings.Prop.RFUAutoclose;
set => App.Settings.Prop.RFUAutoclose = value;
}
public bool ShowServerDetailsEnabled
{
get => App.Settings.Prop.ShowServerDetails;

View File

@ -137,12 +137,6 @@
<TextBlock Margin="0,2,0,0" FontSize="12" Text="BSD 3-Clause License" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardAction>
<ui:CardAction Grid.Row="4" Grid.Column="2" Margin="0,8,0,0" Padding="16,13,16,12" Command="models:GlobalViewModel.OpenWebpageCommand" CommandParameter="https://github.com/axstin/rbxfpsunlocker/blob/master/LICENSE">
<StackPanel>
<TextBlock FontSize="14" Text="rbxfpsunlocker by axstin" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="MIT License" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardAction>
</Grid>
</StackPanel>
</ui:UiPage>

View File

@ -93,28 +93,6 @@
</ui:CardAction>
</Grid>
<StackPanel x:Name="RbxFpsUnlockerOptions">
<TextBlock Text="FPS Unlocking" FontSize="16" FontWeight="Medium" Margin="0,16,0,0" />
<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12">
<ui:CardControl.Header>
<StackPanel>
<TextBlock FontSize="14" Text="Use axstin's rbxfpsunlocker" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="rbxfpsunlocker removes Roblox's 60FPS cap and will launch alongside Roblox." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardControl.Header>
<ui:ToggleSwitch x:Name="RbxFpsUnlockerEnabledToggle" IsChecked="{Binding RbxFpsUnlockerEnabled, Mode=TwoWay}" />
</ui:CardControl>
<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12" IsEnabled="{Binding IsChecked, ElementName=RbxFpsUnlockerEnabledToggle, Mode=OneWay}">
<ui:CardControl.Header>
<StackPanel>
<TextBlock FontSize="14" Text="Auto close when Roblox closes" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="rbxfpsunlocker will automatically close when Roblox closes." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardControl.Header>
<ui:ToggleSwitch IsChecked="{Binding RbxFpsUnlockerAutocloseEnabled, Mode=TwoWay}" />
</ui:CardControl>
</StackPanel>
<TextBlock Text="Miscellaneous" FontSize="16" FontWeight="Medium" Margin="0,16,0,0" />
<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12">
<ui:CardControl.Header>
@ -127,7 +105,7 @@
</ui:CardControl>
<TextBlock Text="Custom Integrations" FontSize="16" FontWeight="Medium" Margin="0,16,0,0" />
<TextBlock Margin="0,4,0,0" Text="Here, you can have other programs launch with Roblox automatically like how rbxfpsunlocker does." TextWrapping="Wrap" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
<TextBlock Margin="0,4,0,0" Text="Here, you can have other programs launch with Roblox automatically." TextWrapping="Wrap" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
<Grid Margin="0,8,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="*" />

View File

@ -15,10 +15,6 @@ namespace Bloxstrap.Views.Pages
{
DataContext = new IntegrationsViewModel();
InitializeComponent();
// rbxfpsunlocker does not have 64 bit support
if (!Environment.Is64BitOperatingSystem)
this.RbxFpsUnlockerOptions.Visibility = Visibility.Collapsed;
}
public void CustomIntegrationSelection(object sender, SelectionChangedEventArgs e)

View File

@ -106,7 +106,7 @@
<ui:CardControl.Header>
<StackPanel>
<TextBlock FontSize="14" Text="Framerate limit" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="By default, it's 60FPS. Use a really high number like 99999 for no limit." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="By default, it's 60FPS. Use a really high number like 9999 for no limit." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardControl.Header>
<ui:TextBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" Text="{Binding FramerateLimit, Mode=TwoWay}" PreviewTextInput="ValidateInt32" />