mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Add FFlag preset for setting framerate cap
this will replace rbxfpsunlocker, and yeah having a default value of 99999 might be a bit weird lol
This commit is contained in:
parent
7281cbf54a
commit
aeeb89445e
@ -1,4 +1,5 @@
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
@ -64,6 +65,15 @@ namespace Bloxstrap.Helpers
|
|||||||
SetValue(RenderingModes[value], "True");
|
SetValue(RenderingModes[value], "True");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Load()
|
||||||
|
{
|
||||||
|
base.Load();
|
||||||
|
|
||||||
|
// set to 99999 by default if it doesnt immediately exist
|
||||||
|
if (GetValue("DFIntTaskSchedulerTargetFps") is null)
|
||||||
|
SetValue("DFIntTaskSchedulerTargetFps", 99999);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Save()
|
public override void Save()
|
||||||
{
|
{
|
||||||
App.Logger.WriteLine($"[FastFlagManager::Save] Attempting to save JSON to {FileLocation}...");
|
App.Logger.WriteLine($"[FastFlagManager::Save] Attempting to save JSON to {FileLocation}...");
|
||||||
|
@ -1,15 +1,6 @@
|
|||||||
using Bloxstrap.Models;
|
using System;
|
||||||
using Bloxstrap.Properties;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace Bloxstrap.Helpers
|
namespace Bloxstrap.Helpers
|
||||||
{
|
{
|
||||||
@ -19,14 +10,19 @@ namespace Bloxstrap.Helpers
|
|||||||
public virtual string FileLocation => AltFileLocation ?? Path.Combine(Directories.Base, $"{typeof(T).Name}.json");
|
public virtual string FileLocation => AltFileLocation ?? Path.Combine(Directories.Base, $"{typeof(T).Name}.json");
|
||||||
public string? AltFileLocation { get; set; }
|
public string? AltFileLocation { get; set; }
|
||||||
|
|
||||||
public void Load()
|
public virtual void Load()
|
||||||
{
|
{
|
||||||
App.Logger.WriteLine($"[JsonManager<{typeof(T).Name}>::Load] Loading JSON from {FileLocation}...");
|
App.Logger.WriteLine($"[JsonManager<{typeof(T).Name}>::Load] Loading JSON from {FileLocation}...");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
T? settings = JsonSerializer.Deserialize<T>(File.ReadAllText(FileLocation));
|
T? settings = JsonSerializer.Deserialize<T>(File.ReadAllText(FileLocation));
|
||||||
Prop = settings ?? throw new ArgumentNullException("Deserialization returned null");
|
|
||||||
|
if (settings is null)
|
||||||
|
throw new ArgumentNullException("Deserialization returned null");
|
||||||
|
|
||||||
|
Prop = settings;
|
||||||
|
|
||||||
App.Logger.WriteLine($"[JsonManager<{typeof(T).Name}>::Load] JSON loaded successfully!");
|
App.Logger.WriteLine($"[JsonManager<{typeof(T).Name}>::Load] JSON loaded successfully!");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
@ -39,6 +40,12 @@ namespace Bloxstrap.ViewModels
|
|||||||
|
|
||||||
public IReadOnlyDictionary<string, string> RenderingModes => FastFlagManager.RenderingModes;
|
public IReadOnlyDictionary<string, string> RenderingModes => FastFlagManager.RenderingModes;
|
||||||
|
|
||||||
|
public int FramerateLimit
|
||||||
|
{
|
||||||
|
get => Int32.TryParse(App.FastFlags.GetValue("DFIntTaskSchedulerTargetFps"), out int x) ? x : 60;
|
||||||
|
set => App.FastFlags.Changes["DFIntTaskSchedulerTargetFps"] = value;
|
||||||
|
}
|
||||||
|
|
||||||
public string SelectedRenderingMode
|
public string SelectedRenderingMode
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -61,7 +68,7 @@ namespace Bloxstrap.ViewModels
|
|||||||
get => App.FastFlags.GetValue("FFlagHandleAltEnterFullscreenManually") == "False";
|
get => App.FastFlags.GetValue("FFlagHandleAltEnterFullscreenManually") == "False";
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
App.FastFlags.Changes["FFlagHandleAltEnterFullscreenManually"] = value ? false : null;
|
App.FastFlags.SetValue("FFlagHandleAltEnterFullscreenManually", value ? false : null);
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
|
@ -99,9 +99,19 @@
|
|||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<ui:CardControl Grid.Row="0" Margin="0,8,0,0" Padding="16,13,16,12">
|
<ui:CardControl Grid.Row="0" Margin="0,8,0,0" Padding="16,13,16,12">
|
||||||
|
<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}" />
|
||||||
|
</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" />
|
||||||
|
</ui:CardControl>
|
||||||
|
<ui:CardControl Grid.Row="1" Margin="0,8,0,0" Padding="16,13,16,12">
|
||||||
<ui:CardControl.Header>
|
<ui:CardControl.Header>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock FontSize="14" Text="Rendering mode" />
|
<TextBlock FontSize="14" Text="Rendering mode" />
|
||||||
@ -110,7 +120,7 @@
|
|||||||
</ui:CardControl.Header>
|
</ui:CardControl.Header>
|
||||||
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding RenderingModes.Keys, Mode=OneTime}" Text="{Binding SelectedRenderingMode, Mode=TwoWay}" />
|
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding RenderingModes.Keys, Mode=OneTime}" Text="{Binding SelectedRenderingMode, Mode=TwoWay}" />
|
||||||
</ui:CardControl>
|
</ui:CardControl>
|
||||||
<ui:CardControl Grid.Row="1" Margin="0,8,0,0" Padding="16,13,16,12">
|
<ui:CardControl Grid.Row="2" Margin="0,8,0,0" Padding="16,13,16,12">
|
||||||
<ui:CardControl.Header>
|
<ui:CardControl.Header>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock FontSize="14" Text="Use exclusive fullscreen" />
|
<TextBlock FontSize="14" Text="Use exclusive fullscreen" />
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
using Bloxstrap.ViewModels;
|
using Bloxstrap.ViewModels;
|
||||||
|
|
||||||
namespace Bloxstrap.Views.Pages
|
namespace Bloxstrap.Views.Pages
|
||||||
@ -21,5 +23,7 @@ namespace Bloxstrap.Views.Pages
|
|||||||
if (Environment.OSVersion.Version.Build < 17093)
|
if (Environment.OSVersion.Version.Build < 17093)
|
||||||
this.MiscellaneousOptions.Visibility = Visibility.Collapsed;
|
this.MiscellaneousOptions.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ValidateInt32(object sender, TextCompositionEventArgs e) => e.Handled = !Int32.TryParse(e.Text, out int _);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user