Skip to content

Commit 7bdcf72

Browse files
committed
Made fps unlocker a textbox
1 parent 24a582b commit 7bdcf72

4 files changed

Lines changed: 17 additions & 18 deletions

File tree

Bloxstrap/FpsUnlocker.cs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,31 @@ namespace Bloxstrap
55
{
66
public static class FpsUnlocker
77
{
8-
private static readonly string SettingsPath = Path.Combine(
9-
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
10-
"Roblox",
11-
"GlobalBasicSettings_13.xml"
12-
);
8+
private static readonly string SettingsPath = Path.Combine(Paths.RobloxGlobal, "GlobalBasicSettings_13.xml");
139

14-
public static bool IsUncapped()
10+
public static int GetFpsCap()
1511
{
1612
try
1713
{
18-
if (!File.Exists(SettingsPath)) return false;
14+
if (!File.Exists(SettingsPath)) return -1;
1915
var doc = XDocument.Load(SettingsPath);
2016
var fpsElement = FindFPSElement(doc);
21-
return fpsElement != null && int.TryParse(fpsElement.Value, out int fps) && fps > 240;
17+
if (fpsElement != null && int.TryParse(fpsElement.Value, out int fps))
18+
return fps;
2219
}
23-
catch { return false; }
20+
catch { }
21+
return -1;
2422
}
2523

26-
public static void SetUncapped(bool uncap)
24+
public static void SetFpsCap(int fpsCap)
2725
{
2826
try
2927
{
3028
if (!File.Exists(SettingsPath))
3129
{
3230
var newDoc = new XDocument(
3331
new XElement("robloxSettings",
34-
new XElement("int", new XAttribute("name", "FramerateCap"), uncap ? "9999" : "-1")
32+
new XElement("int", new XAttribute("name", "FramerateCap"), fpsCap.ToString())
3533
)
3634
);
3735
Directory.CreateDirectory(Path.GetDirectoryName(SettingsPath)!);
@@ -43,9 +41,9 @@ public static void SetUncapped(bool uncap)
4341
var fpsElement = FindFPSElement(doc);
4442

4543
if (fpsElement != null)
46-
fpsElement.Value = uncap ? "9999" : "-1";
44+
fpsElement.Value = fpsCap.ToString();
4745
else
48-
doc.Root?.Add(new XElement("int", new XAttribute("name", "FramerateCap"), uncap ? "9999" : "-1"));
46+
doc.Root?.Add(new XElement("int", new XAttribute("name", "FramerateCap"), fpsCap.ToString()));
4947

5048
doc.Save(SettingsPath);
5149
}

Bloxstrap/Paths.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ static class Paths
1515

1616
public static string TempUpdates => Path.Combine(Temp, "Updates");
1717
public static string TempLogs => Path.Combine(Temp, "Logs");
18+
public static string RobloxGlobal => Path.Combine(LocalAppData, "Roblox");
1819

1920
public static string Base { get; private set; } = "";
2021
public static string Downloads { get; private set; } = "";

Bloxstrap/UI/Elements/Settings/Pages/BootstrapperPage.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151

5252
<controls:OptionControl
5353
Header="FPS Unlocker"
54-
Description="Removes the 240 FPS Limit without using FastFlags.">
55-
<ui:ToggleSwitch IsChecked="{Binding UncapFPS, Mode=TwoWay}" />
54+
Description="Set a custom FPS cap, -1 means default.">
55+
<ui:TextBox Margin="5,0,0,0" Padding="10,7,10,7" Width="200" Text="{Binding FPSCap, Mode=TwoWay}" />
5656
</controls:OptionControl>
5757

5858
<controls:OptionControl

Bloxstrap/UI/ViewModels/Settings/BehaviourViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ public ProcessPriorityOption SelectedPriority
2828
}
2929
}
3030

31-
public bool UncapFPS
31+
public int FPSCap
3232
{
33-
get => FpsUnlocker.IsUncapped();
34-
set => FpsUnlocker.SetUncapped(value);
33+
get => FpsUnlocker.GetFpsCap();
34+
set => FpsUnlocker.SetFpsCap(value);
3535
}
3636

3737
public bool MultiInstances

0 commit comments

Comments
 (0)