From 83f37ee6c37d2d2d42b33614b04c306c8e7a917e Mon Sep 17 00:00:00 2001
From: pizzaboxer <41478239+pizzaboxer@users.noreply.github.com>
Date: Tue, 17 Jan 2023 22:13:51 +0000
Subject: [PATCH] Rework Preferences menu and file modding
Adds help windows to the Preferences menu, reworked directory structure and allowed files in the root mod directory to be applied to the version folder.
---
Bloxstrap/Bootstrapper.cs | 23 ++------
Bloxstrap/Dialogs/Menu/ModHelp.xaml | 39 ++++++++++++++
Bloxstrap/Dialogs/Menu/ModHelp.xaml.cs | 33 ++++++++++++
Bloxstrap/Dialogs/{ => Menu}/Preferences.xaml | 25 +++++----
.../Dialogs/{ => Menu}/Preferences.xaml.cs | 44 +++++++++++----
Bloxstrap/Dialogs/Menu/ReShadeHelp.xaml | 54 +++++++++++++++++++
Bloxstrap/Dialogs/Menu/ReShadeHelp.xaml.cs | 33 ++++++++++++
.../{ => Menu}/Themes/ColourfulDarkTheme.xaml | 0
.../Themes/ColourfulDarkTheme.xaml.cs | 0
.../Themes/ColourfulLightTheme.xaml | 0
.../Themes/ColourfulLightTheme.xaml.cs | 0
.../Dialogs/{ => Menu}/Themes/DarkTheme.xaml | 0
.../{ => Menu}/Themes/DarkTheme.xaml.cs | 0
.../Dialogs/{ => Menu}/Themes/LightTheme.xaml | 0
.../{ => Menu}/Themes/LightTheme.xaml.cs | 0
Bloxstrap/Helpers/Integrations/ReShade.cs | 4 ++
Bloxstrap/Helpers/Updater.cs | 7 +--
Bloxstrap/Program.cs | 14 +++--
18 files changed, 223 insertions(+), 53 deletions(-)
create mode 100644 Bloxstrap/Dialogs/Menu/ModHelp.xaml
create mode 100644 Bloxstrap/Dialogs/Menu/ModHelp.xaml.cs
rename Bloxstrap/Dialogs/{ => Menu}/Preferences.xaml (88%)
rename Bloxstrap/Dialogs/{ => Menu}/Preferences.xaml.cs (90%)
create mode 100644 Bloxstrap/Dialogs/Menu/ReShadeHelp.xaml
create mode 100644 Bloxstrap/Dialogs/Menu/ReShadeHelp.xaml.cs
rename Bloxstrap/Dialogs/{ => Menu}/Themes/ColourfulDarkTheme.xaml (100%)
rename Bloxstrap/Dialogs/{ => Menu}/Themes/ColourfulDarkTheme.xaml.cs (100%)
rename Bloxstrap/Dialogs/{ => Menu}/Themes/ColourfulLightTheme.xaml (100%)
rename Bloxstrap/Dialogs/{ => Menu}/Themes/ColourfulLightTheme.xaml.cs (100%)
rename Bloxstrap/Dialogs/{ => Menu}/Themes/DarkTheme.xaml (100%)
rename Bloxstrap/Dialogs/{ => Menu}/Themes/DarkTheme.xaml.cs (100%)
rename Bloxstrap/Dialogs/{ => Menu}/Themes/LightTheme.xaml (100%)
rename Bloxstrap/Dialogs/{ => Menu}/Themes/LightTheme.xaml.cs (100%)
diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs
index f46d55f..ab1bbd0 100644
--- a/Bloxstrap/Bootstrapper.cs
+++ b/Bloxstrap/Bootstrapper.cs
@@ -61,19 +61,6 @@ namespace Bloxstrap
" http://www.roblox.com\n" +
"\n";
- private static readonly string ModReadme =
- "This is where you can modify your Roblox files while preserving modifications\n" +
- "whenever Roblox updates.\n" +
- "\n" +
- "For example, Modifications\\content\\sounds\\ouch.ogg will\n" +
- "automatically overwrite Versions\\version-xx...\\content\\sounds\\ouch.ogg\n" +
- "\n" +
- "If you remove a file mod from here, Bloxstrap will restore the stock version\n" +
- "of the file the next time it's launched.\n" +
- "\n" +
- "Any files added here to the root modification directory are ignored, so be sure\n" +
- "that they're inside a folder.";
-
private string? LaunchCommandLine;
private string VersionGuid = null!;
@@ -544,10 +531,7 @@ namespace Bloxstrap
List modFolderFiles = new();
if (!Directory.Exists(modFolder))
- {
Directory.CreateDirectory(modFolder);
- await File.WriteAllTextAsync(Path.Combine(modFolder, "README.txt"), ModReadme);
- }
await CheckModPreset(Program.Settings.UseOldDeathSound, @"content\sounds\ouch.ogg", "OldDeath.ogg");
await CheckModPreset(Program.Settings.UseOldMouseCursor, @"content\textures\Cursors\KeyboardMouse\ArrowCursor.png", "OldCursor.png");
@@ -561,9 +545,12 @@ namespace Bloxstrap
// get relative directory path
string relativeFile = file.Substring(modFolder.Length + 1);
- // ignore files placed in the root directory as long as they're not ini or dll files
- if (!relativeFile.Contains('\\') && !relativeFile.EndsWith(".ini") && !relativeFile.EndsWith(".dll"))
+ // v1.7.0 - README has been moved to the preferences menu now
+ if (relativeFile == "README.txt")
+ {
+ File.Delete(file);
continue;
+ }
modFolderFiles.Add(relativeFile);
}
diff --git a/Bloxstrap/Dialogs/Menu/ModHelp.xaml b/Bloxstrap/Dialogs/Menu/ModHelp.xaml
new file mode 100644
index 0000000..4775db9
--- /dev/null
+++ b/Bloxstrap/Dialogs/Menu/ModHelp.xaml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Bloxstrap/Dialogs/Menu/ModHelp.xaml.cs b/Bloxstrap/Dialogs/Menu/ModHelp.xaml.cs
new file mode 100644
index 0000000..00b042c
--- /dev/null
+++ b/Bloxstrap/Dialogs/Menu/ModHelp.xaml.cs
@@ -0,0 +1,33 @@
+using System.Windows;
+
+using Bloxstrap.Enums;
+
+namespace Bloxstrap.Dialogs.Menu
+{
+ ///
+ /// Interaction logic for ModHelp.xaml
+ ///
+ public partial class ModHelp : Window
+ {
+ public ModHelp()
+ {
+ InitializeComponent();
+ SetTheme();
+ }
+
+ public void SetTheme()
+ {
+ string theme = "Light";
+
+ if (Program.Settings.Theme.GetFinal() == Theme.Dark)
+ theme = "ColourfulDark";
+
+ this.Resources.MergedDictionaries[0] = new ResourceDictionary() { Source = new Uri($"Dialogs/Menu/Themes/{theme}Theme.xaml", UriKind.Relative) };
+ }
+
+ private void ButtonClose_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
+ }
+}
diff --git a/Bloxstrap/Dialogs/Preferences.xaml b/Bloxstrap/Dialogs/Menu/Preferences.xaml
similarity index 88%
rename from Bloxstrap/Dialogs/Preferences.xaml
rename to Bloxstrap/Dialogs/Menu/Preferences.xaml
index d907b74..7ab694c 100644
--- a/Bloxstrap/Dialogs/Preferences.xaml
+++ b/Bloxstrap/Dialogs/Menu/Preferences.xaml
@@ -1,9 +1,9 @@
-
-
+
-
-
+
+
-
-
-
-
+
+
@@ -91,7 +89,14 @@
-
+
+
+
+
+
+
+
+
diff --git a/Bloxstrap/Dialogs/Preferences.xaml.cs b/Bloxstrap/Dialogs/Menu/Preferences.xaml.cs
similarity index 90%
rename from Bloxstrap/Dialogs/Preferences.xaml.cs
rename to Bloxstrap/Dialogs/Menu/Preferences.xaml.cs
index 5dd98fc..d9ed354 100644
--- a/Bloxstrap/Dialogs/Preferences.xaml.cs
+++ b/Bloxstrap/Dialogs/Menu/Preferences.xaml.cs
@@ -12,10 +12,7 @@ using Bloxstrap.Enums;
using Bloxstrap.Helpers;
using Bloxstrap.Models;
-using REghZyFramework.Themes;
-using System.Windows.Forms;
-
-namespace Bloxstrap.Dialogs
+namespace Bloxstrap.Dialogs.Menu
{
///
/// Interaction logic for PreferencesWPF.xaml
@@ -54,12 +51,17 @@ namespace Bloxstrap.Dialogs
if (Program.Settings.Theme.GetFinal() == Theme.Dark)
theme = "ColourfulDark";
- this.Resources.MergedDictionaries[0] = new ResourceDictionary() { Source = new Uri($"Dialogs/Themes/{theme}Theme.xaml", UriKind.Relative) };
+ this.Resources.MergedDictionaries[0] = new ResourceDictionary() { Source = new Uri($"Dialogs/Menu/Themes/{theme}Theme.xaml", UriKind.Relative) };
+ }
+
+ private void ButtonOpenReShadeFolder_Click(object sender, EventArgs e)
+ {
+ Process.Start("explorer.exe", Directories.ReShade);
}
private void ButtonOpenReShadeHelp_Click(object sender, EventArgs e)
{
-
+ new ReShadeHelp().Show();
}
private void ButtonOpenModFolder_Click(object sender, EventArgs e)
@@ -67,6 +69,11 @@ namespace Bloxstrap.Dialogs
Process.Start("explorer.exe", Directories.Modifications);
}
+ private void ButtonOpenModHelp_Click(object sender, EventArgs e)
+ {
+ new ModHelp().Show();
+ }
+
private void ButtonLocationBrowse_Click(object sender, EventArgs e)
{
using (var dialog = new FolderBrowserDialog())
@@ -178,8 +185,13 @@ namespace Bloxstrap.Dialogs
#region Integrations
public bool DRPEnabled
{
- get => Program.Settings.UseDiscordRichPresence;
- set => Program.Settings.UseDiscordRichPresence = value;
+ get => Program.Settings.UseDiscordRichPresence;
+ set
+ {
+ // if user wants discord rpc, auto-enable buttons by default
+ _window.CheckBoxDRPButtons.IsChecked = value;
+ Program.Settings.UseDiscordRichPresence = value;
+ }
}
public bool DRPButtons
@@ -190,8 +202,13 @@ namespace Bloxstrap.Dialogs
public bool RFUEnabled
{
- get => Program.Settings.RFUEnabled;
- set => Program.Settings.RFUEnabled = value;
+ get => Program.Settings.RFUEnabled;
+ set
+ {
+ // if user wants to use rbxfpsunlocker, auto-enable autoclosing by default
+ _window.CheckBoxRFUAutoclose.IsChecked = value;
+ Program.Settings.RFUEnabled = value;
+ }
}
public bool RFUAutoclose
@@ -203,7 +220,12 @@ namespace Bloxstrap.Dialogs
public bool UseReShade
{
get => Program.Settings.UseReShade;
- set => Program.Settings.UseReShade = value;
+ set
+ {
+ // if user wants to use reshade, auto-enable use of extravi's presets by default
+ _window.CheckBoxUseReShadeExtraviPresets.IsChecked = value;
+ Program.Settings.UseReShade = value;
+ }
}
public bool UseReShadeExtraviPresets
diff --git a/Bloxstrap/Dialogs/Menu/ReShadeHelp.xaml b/Bloxstrap/Dialogs/Menu/ReShadeHelp.xaml
new file mode 100644
index 0000000..b44ccfe
--- /dev/null
+++ b/Bloxstrap/Dialogs/Menu/ReShadeHelp.xaml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Bloxstrap/Dialogs/Menu/ReShadeHelp.xaml.cs b/Bloxstrap/Dialogs/Menu/ReShadeHelp.xaml.cs
new file mode 100644
index 0000000..d0e8e32
--- /dev/null
+++ b/Bloxstrap/Dialogs/Menu/ReShadeHelp.xaml.cs
@@ -0,0 +1,33 @@
+using System.Windows;
+
+using Bloxstrap.Enums;
+
+namespace Bloxstrap.Dialogs.Menu
+{
+ ///
+ /// Interaction logic for ReShadeHelp.xaml
+ ///
+ public partial class ReShadeHelp : Window
+ {
+ public ReShadeHelp()
+ {
+ InitializeComponent();
+ SetTheme();
+ }
+
+ public void SetTheme()
+ {
+ string theme = "Light";
+
+ if (Program.Settings.Theme.GetFinal() == Theme.Dark)
+ theme = "ColourfulDark";
+
+ this.Resources.MergedDictionaries[0] = new ResourceDictionary() { Source = new Uri($"Dialogs/Menu/Themes/{theme}Theme.xaml", UriKind.Relative) };
+ }
+
+ private void ButtonClose_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
+ }
+}
diff --git a/Bloxstrap/Dialogs/Themes/ColourfulDarkTheme.xaml b/Bloxstrap/Dialogs/Menu/Themes/ColourfulDarkTheme.xaml
similarity index 100%
rename from Bloxstrap/Dialogs/Themes/ColourfulDarkTheme.xaml
rename to Bloxstrap/Dialogs/Menu/Themes/ColourfulDarkTheme.xaml
diff --git a/Bloxstrap/Dialogs/Themes/ColourfulDarkTheme.xaml.cs b/Bloxstrap/Dialogs/Menu/Themes/ColourfulDarkTheme.xaml.cs
similarity index 100%
rename from Bloxstrap/Dialogs/Themes/ColourfulDarkTheme.xaml.cs
rename to Bloxstrap/Dialogs/Menu/Themes/ColourfulDarkTheme.xaml.cs
diff --git a/Bloxstrap/Dialogs/Themes/ColourfulLightTheme.xaml b/Bloxstrap/Dialogs/Menu/Themes/ColourfulLightTheme.xaml
similarity index 100%
rename from Bloxstrap/Dialogs/Themes/ColourfulLightTheme.xaml
rename to Bloxstrap/Dialogs/Menu/Themes/ColourfulLightTheme.xaml
diff --git a/Bloxstrap/Dialogs/Themes/ColourfulLightTheme.xaml.cs b/Bloxstrap/Dialogs/Menu/Themes/ColourfulLightTheme.xaml.cs
similarity index 100%
rename from Bloxstrap/Dialogs/Themes/ColourfulLightTheme.xaml.cs
rename to Bloxstrap/Dialogs/Menu/Themes/ColourfulLightTheme.xaml.cs
diff --git a/Bloxstrap/Dialogs/Themes/DarkTheme.xaml b/Bloxstrap/Dialogs/Menu/Themes/DarkTheme.xaml
similarity index 100%
rename from Bloxstrap/Dialogs/Themes/DarkTheme.xaml
rename to Bloxstrap/Dialogs/Menu/Themes/DarkTheme.xaml
diff --git a/Bloxstrap/Dialogs/Themes/DarkTheme.xaml.cs b/Bloxstrap/Dialogs/Menu/Themes/DarkTheme.xaml.cs
similarity index 100%
rename from Bloxstrap/Dialogs/Themes/DarkTheme.xaml.cs
rename to Bloxstrap/Dialogs/Menu/Themes/DarkTheme.xaml.cs
diff --git a/Bloxstrap/Dialogs/Themes/LightTheme.xaml b/Bloxstrap/Dialogs/Menu/Themes/LightTheme.xaml
similarity index 100%
rename from Bloxstrap/Dialogs/Themes/LightTheme.xaml
rename to Bloxstrap/Dialogs/Menu/Themes/LightTheme.xaml
diff --git a/Bloxstrap/Dialogs/Themes/LightTheme.xaml.cs b/Bloxstrap/Dialogs/Menu/Themes/LightTheme.xaml.cs
similarity index 100%
rename from Bloxstrap/Dialogs/Themes/LightTheme.xaml.cs
rename to Bloxstrap/Dialogs/Menu/Themes/LightTheme.xaml.cs
diff --git a/Bloxstrap/Helpers/Integrations/ReShade.cs b/Bloxstrap/Helpers/Integrations/ReShade.cs
index d1dd4b3..7b02ec9 100644
--- a/Bloxstrap/Helpers/Integrations/ReShade.cs
+++ b/Bloxstrap/Helpers/Integrations/ReShade.cs
@@ -53,6 +53,9 @@ namespace Bloxstrap.Helpers.Integrations
"KeyReload=0,0,0,0\r\n" +
"KeyScreenshot=44,0,0,0\r\n" +
"\r\n" +
+ "[SCREENSHOT]\r\n" +
+ "SavePath=..\\..\\ReShade\\Screenshots\r\n" +
+ "\r\n" +
"[STYLE]\r\n" +
"Alpha=1.000000\r\n" +
"Border=0.862745,0.862745,0.862745,0.300000\r\n" +
@@ -370,6 +373,7 @@ namespace Bloxstrap.Helpers.Integrations
// initialize directories
Directory.CreateDirectory(Directories.ReShade);
Directory.CreateDirectory(Path.Combine(Directories.ReShade, "Fonts"));
+ Directory.CreateDirectory(Path.Combine(Directories.ReShade, "Screenshots"));
Directory.CreateDirectory(Path.Combine(Directories.ReShade, "Shaders"));
Directory.CreateDirectory(Path.Combine(Directories.ReShade, "Textures"));
Directory.CreateDirectory(Path.Combine(Directories.ReShade, "Presets"));
diff --git a/Bloxstrap/Helpers/Updater.cs b/Bloxstrap/Helpers/Updater.cs
index 272a729..853b563 100644
--- a/Bloxstrap/Helpers/Updater.cs
+++ b/Bloxstrap/Helpers/Updater.cs
@@ -1,12 +1,7 @@
using System.Diagnostics;
using System.IO;
-using System.Net.Http;
-using System.Text.Json;
-using Newtonsoft.Json.Linq;
-
-using Bloxstrap.Models;
-using Bloxstrap.Dialogs;
+using Bloxstrap.Dialogs.Menu;
namespace Bloxstrap.Helpers
{
diff --git a/Bloxstrap/Program.cs b/Bloxstrap/Program.cs
index 48dfb39..a1f8406 100644
--- a/Bloxstrap/Program.cs
+++ b/Bloxstrap/Program.cs
@@ -1,18 +1,16 @@
-using System.Diagnostics;
using System.Globalization;
using System.IO;
+using System.Net.Http;
+using System.Net;
+using System.Reflection;
using Microsoft.Win32;
using Bloxstrap.Enums;
using Bloxstrap.Helpers;
using Bloxstrap.Models;
-using Bloxstrap.Dialogs;
-using System.Net.Http;
-using System.Net;
-using System.Reflection;
-using Newtonsoft.Json.Linq;
-using System;
+using Bloxstrap.Dialogs.Menu;
+
namespace Bloxstrap
{
@@ -132,7 +130,7 @@ namespace Bloxstrap
string commandLine = "";
-#if false//DEBUG
+#if DEBUG
new Preferences().ShowDialog();
#else
if (args.Length > 0)