Skip to content

Commit

Permalink
Merge branch 'version-2.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzaboxer committed Apr 21, 2023
2 parents 61b2c4b + 89e76ef commit 43555d7
Show file tree
Hide file tree
Showing 26 changed files with 610 additions and 627 deletions.
3 changes: 2 additions & 1 deletion Bloxstrap/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Bloxstrap"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
ShutdownMode="OnExplicitShutdown">
ShutdownMode="OnExplicitShutdown"
DispatcherUnhandledException="GlobalExceptionHandler">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand Down
276 changes: 140 additions & 136 deletions Bloxstrap/App.xaml.cs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Bloxstrap/Bloxstrap.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<UseWPF>true</UseWPF>
<UseWindowsForms>True</UseWindowsForms>
<ApplicationIcon>Bloxstrap.ico</ApplicationIcon>
<Version>2.1.1</Version>
<FileVersion>2.1.1.0</FileVersion>
<Version>2.2.0</Version>
<FileVersion>2.2.0.0</FileVersion>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>

Expand Down
349 changes: 171 additions & 178 deletions Bloxstrap/Bootstrapper.cs

Large diffs are not rendered by default.

32 changes: 7 additions & 25 deletions Bloxstrap/Helpers/DeployManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,43 +76,25 @@ public string BaseUrl
}
}

// basically any channel that has had a deploy within the past month with a windowsplayer build
public static readonly List<string> ChannelsAbstracted = new()
// most commonly used/interesting channels
public static readonly List<string> SelectableChannels = new()
{
"LIVE",
"ZWinPlayer64",
"ZFlag",
"ZNext",
"ZCanary",
"ZIntegration"
};

// why not?
public static readonly List<string> ChannelsAll = new()
{
"LIVE",
"ZAvatarTeam",
"ZAvatarRelease",
"ZCanary",
"ZCanary1",
"ZCanary2",
"ZCanary3",
"ZCanaryApps",
"ZFlag",
"ZIntegration",
"ZIntegration1",
"ZLive",
"ZLive1",
"ZNext",
"ZSocialTeam",
"ZStudioInt1",
"ZStudioInt2"
"ZAvatarTeam",
"ZSocialTeam"
};
#endregion

public async Task<ClientVersion> GetLastDeploy(bool timestamp = false)
{
App.Logger.WriteLine($"[DeployManager::GetLastDeploy] Getting deploy info for channel {Channel} (timestamp={timestamp})");

HttpResponseMessage deployInfoResponse = await App.HttpClient.GetAsync($"https://clientsettings.roblox.com/v2/client-version/WindowsPlayer/channel/{Channel}");
HttpResponseMessage deployInfoResponse = await App.HttpClient.GetAsync($"https://clientsettings.roblox.com/v2/client-version/WindowsPlayer/channel/{Channel}").ConfigureAwait(false);

string rawResponse = await deployInfoResponse.Content.ReadAsStringAsync();

Expand Down
87 changes: 77 additions & 10 deletions Bloxstrap/Helpers/FastFlagManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;
Expand All @@ -15,18 +16,71 @@ public class FastFlagManager : JsonManager<Dictionary<string, object>>
public Dictionary<string, object?> Changes = new();

// only one missing here is Metal because lol
public static IReadOnlyDictionary<string, string> RenderingModes { get; set; } = new Dictionary<string, string>()
public static IReadOnlyDictionary<string, string> RenderingModes => new Dictionary<string, string>
{
{ "Automatic", "" },
{ "Direct3D 11", "FFlagDebugGraphicsPreferD3D11" },
{ "OpenGL", "FFlagDebugGraphicsPreferOpenGL" },
{ "Vulkan", "FFlagDebugGraphicsPreferVulkan" }
};

// this is one hell of a variable definition lmao
public static IReadOnlyDictionary<string, Dictionary<string, string?>> IGMenuVersions => new Dictionary<string, Dictionary<string, string?>>
{
{
"Default",
new Dictionary<string, string?>
{
{ "FFlagDisableNewIGMinDUA", null },
{ "FFlagEnableInGameMenuV3", null }
}
},

{
"Version 1 (2015)",
new Dictionary<string, string?>
{
{ "FFlagDisableNewIGMinDUA", "True" },
{ "FFlagEnableInGameMenuV3", "False" }
}
},

{
"Version 2 (2020)",
new Dictionary<string, string?>
{
{ "FFlagDisableNewIGMinDUA", "False" },
{ "FFlagEnableInGameMenuV3", "False" }
}
},

{
"Version 3 (2021)",
new Dictionary<string, string?>
{
{ "FFlagDisableNewIGMinDUA", "False" },
{ "FFlagEnableInGameMenuV3", "True" }
}
}
};

// all fflags are stored as strings
// to delete a flag, set the value as null
public void SetValue(string key, object? value)
{
if (value is null)
{
Changes[key] = null;
App.Logger.WriteLine($"[FastFlagManager::SetValue] Deletion of '{key}' is pending");
}
else
{
Changes[key] = value.ToString();
App.Logger.WriteLine($"[FastFlagManager::SetValue] Value change for '{key}' to '{value}' is pending");
}
}

// this returns null if the fflag doesn't exist
// this also returns as a string because deserializing an object doesn't
// deserialize back into the original object type, it instead deserializes
// as a "JsonElement" which is annoying
public string? GetValue(string key)
{
// check if we have an updated change for it pushed first
Expand All @@ -44,26 +98,39 @@ public void SetRenderingMode(string value)
foreach (var mode in RenderingModes)
{
if (mode.Key != "Automatic")
App.FastFlags.Changes[mode.Value] = null;
SetValue(mode.Value, null);
}

if (value != "Automatic")
App.FastFlags.Changes[RenderingModes[value]] = true;
SetValue(RenderingModes[value], "True");
}

public override void Load()
{
base.Load();

// set to 9999 by default if it doesnt already exist
if (GetValue("DFIntTaskSchedulerTargetFps") is null)
SetValue("DFIntTaskSchedulerTargetFps", 9999);

// reshade / exclusive fullscreen requires direct3d 11 to work
if (GetValue(RenderingModes["Direct3D 11"]) != "True" && (App.Settings.Prop.UseReShade || App.FastFlags.GetValue("FFlagHandleAltEnterFullscreenManually") == "False"))
SetRenderingMode("Direct3D 11");
}

public override void Save()
{
App.Logger.WriteLine($"[FastFlagManager::Save] Attempting to save JSON to {FileLocation}...");

// reload for any changes made while the menu was open
Load();

if (Changes.Count == 0)
{
App.Logger.WriteLine($"[FastFlagManager::Save] No changes to apply, aborting.");
return;
}

// reload for any changes made while the menu was open
Load();

foreach (var change in Changes)
{
if (change.Value is null)
Expand All @@ -73,7 +140,7 @@ public override void Save()
continue;
}

App.Logger.WriteLine($"[FastFlagManager::Save] Setting '{change.Key}' to {change.Value}");
App.Logger.WriteLine($"[FastFlagManager::Save] Setting '{change.Key}' to '{change.Value}'");
Prop[change.Key] = change.Value;
}

Expand Down
23 changes: 9 additions & 14 deletions Bloxstrap/Helpers/JsonManager.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
using Bloxstrap.Models;
using Bloxstrap.Properties;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.Json;
using System.Threading;

namespace Bloxstrap.Helpers
{
public class JsonManager<T> where T : new()
{
public T Prop { get; set; } = new();
public virtual string FileLocation => AltFileLocation ?? Path.Combine(Directories.Base, $"{typeof(T).Name}.json");
public string? AltFileLocation { get; set; }
public virtual string FileLocation => Path.Combine(Directories.Base, $"{typeof(T).Name}.json");

public void Load()
public virtual void Load()
{
App.Logger.WriteLine($"[JsonManager<{typeof(T).Name}>::Load] Loading JSON from {FileLocation}...");

try
{
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!");
}
catch (Exception ex)
Expand Down
6 changes: 5 additions & 1 deletion Bloxstrap/Helpers/Protocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class Protocol
{ "launchmode", "--" },
{ "gameinfo", "-t " },
{ "placelauncherurl", "-j "},
// { "launchtime", "--launchtime=" }, we'll set this when launching the game client
{ "launchtime", "--launchtime=" },
{ "browsertrackerid", "-b " },
{ "robloxLocale", "--rloc " },
{ "gameLocale", "--gloc " },
Expand Down Expand Up @@ -50,6 +50,10 @@ public static string ParseUri(string protocol)
if (key == "placelauncherurl")
val = HttpUtility.UrlDecode(val);

// we'll set this before launching because for some reason roblox just refuses to launch if its like a few minutes old so ???
if (key == "launchtime")
val = "LAUNCHTIMEPLACEHOLDER";

if (key == "channel")
{
if (val.ToLower() != App.Settings.Prop.Channel.ToLower())
Expand Down
8 changes: 0 additions & 8 deletions Bloxstrap/Helpers/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,6 @@ public static void CheckInstalledVersion()

Bootstrapper.Register();

// update check: if we're upgrading to v2.1.0 and have reshade enabled,
// we need to set our renderer to direct3d 11
if (App.Settings.Prop.UseReShade && App.FastFlags.GetValue(FastFlagManager.RenderingModes["Direct3D 11"]) is null)
{
App.FastFlags.SetRenderingMode("Direct3D 11");
App.FastFlags.Save();
}

if (isAutoUpgrade)
{
NotifyIcon notification = new()
Expand Down
Loading

0 comments on commit 43555d7

Please sign in to comment.