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.
This commit is contained in:
pizzaboxer 2023-01-17 22:13:51 +00:00
parent fea122f928
commit 83f37ee6c3
18 changed files with 223 additions and 53 deletions

View File

@ -61,19 +61,6 @@ namespace Bloxstrap
" <BaseUrl>http://www.roblox.com</BaseUrl>\n" +
"</Settings>\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<string> 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);
}

View File

@ -0,0 +1,39 @@
<Window x:Class="Bloxstrap.Dialogs.Menu.ModHelp"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Bloxstrap.Dialogs.Menu"
mc:Ignorable="d"
Style="{DynamicResource MainWindowStyle}"
Title="Modification Help"
SizeToContent="WidthAndHeight"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--<ResourceDictionary Source="Themes\ColourfulDarkTheme.xaml" />-->
<ResourceDictionary Source="Themes\LightTheme.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid Width="420" Height="260">
<StackPanel Margin="10">
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Modification Help" VerticalAlignment="Top" FontSize="18" />
<StackPanel Margin="10">
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="The Modifications folder is where you can modify your Roblox files while ensuring that they're preserved whenever Roblox updates." />
<TextBlock HorizontalAlignment="Left" Margin="0,10,0,0" TextWrapping="Wrap" Text="For example, Modifications\content\sounds\ouch.ogg will automatically override Versions\Version-{id}\content\sounds\ouch.ogg" />
<TextBlock HorizontalAlignment="Left" Margin="0,10,0,0" TextWrapping="Wrap" Text="When you remove a file from the folder, Bloxstrap restores the original version of the file the next time Roblox launches." />
<TextBlock HorizontalAlignment="Left" Margin="0,10,0,0" TextWrapping="Wrap" Text="The folder is also used for handling presets and files for ReShade, so if you find any files or folders that already exist, you can just ignore them." />
</StackPanel>
</StackPanel>
<Border Background="{DynamicResource ControlSelectedBackground}" BorderBrush="{DynamicResource ControlSelectedBorderBrush}" BorderThickness="1" Margin="-1,0,-1,0" Height="42" VerticalAlignment="Bottom">
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Name="ButtonClose" Content="Close" Width="66" Height="23" HorizontalAlignment="Right" Margin="0,0,10,0" Click="ButtonClose_Click" />
</StackPanel>
</Grid>
</Border>
</Grid>
</Window>

View File

@ -0,0 +1,33 @@
using System.Windows;
using Bloxstrap.Enums;
namespace Bloxstrap.Dialogs.Menu
{
/// <summary>
/// Interaction logic for ModHelp.xaml
/// </summary>
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();
}
}
}

View File

@ -1,9 +1,9 @@
<Window x:Class="Bloxstrap.Dialogs.Preferences"
<Window x:Class="Bloxstrap.Dialogs.Menu.Preferences"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Bloxstrap.Dialogs"
xmlns:local="clr-namespace:Bloxstrap.Dialogs.Menu"
mc:Ignorable="d"
Style="{DynamicResource MainWindowStyle}"
Title="PreferencesWPF"
@ -49,21 +49,19 @@
<StackPanel VerticalAlignment="Center">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130" />
<ColumnDefinition Width="155" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0" x:Name="CheckBoxUseReShade" Content=" Use ReShade" Margin="5" IsChecked="{Binding UseReShade, Mode=TwoWay}" />
<CheckBox Grid.Column="1" x:Name="CheckBoxUseReShadeExtraviPresets" Content=" Use Extravi's presets w/ shaders" Margin="5" IsChecked="{Binding UseReShadeExtraviPresets, Mode=TwoWay}" />
<CheckBox Grid.Column="0" x:Name="CheckBoxUseReShade" Content=" Use ReShade" ToolTip="Choose whether to use ReShade to enhance your graphics with shaders." Margin="5" IsChecked="{Binding UseReShade, Mode=TwoWay}" />
<CheckBox Grid.Column="1" x:Name="CheckBoxUseReShadeExtraviPresets" Content=" Use Extravi's shader presets" ToolTip="Choose whether to use Extravi's shader presets with ReShade." Margin="5" IsEnabled="{Binding IsChecked, ElementName=CheckBoxUseReShade, Mode=OneWay}" IsChecked="{Binding UseReShadeExtraviPresets, Mode=TwoWay}" />
</Grid>
<Grid Margin="5,5,5,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="80" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0" x:Name="ButtonOpenReShadeFolder" ToolTip="{Binding ReShadeFolderButtonTooltip, Mode=OneTime}" IsEnabled="{Binding ReShadeFolderButtonEnabled, Mode=OneTime}" Content="Open ReShade folder" Height="23" Margin="0,0,5,0" />
<Button Grid.Column="1" x:Name="ButtonOpenReShadeHelp" Content="Help" Height="23" Click="ButtonOpenReShadeHelp_Click" />
<Button Grid.Column="2" x:Name="ButtonOpenReShadeCredits" Content="Credits" Height="23" Margin="5,0,0,0" />
<Button Grid.Column="0" x:Name="ButtonOpenReShadeFolder" ToolTip="{Binding ReShadeFolderButtonTooltip, Mode=OneTime}" IsEnabled="{Binding ReShadeFolderButtonEnabled, Mode=OneTime}" Content="Open ReShade folder" Height="23" Margin="0,0,5,0" Click="ButtonOpenReShadeFolder_Click" />
<Button Grid.Column="1" x:Name="ButtonOpenReShadeHelp" Content="Help" Height="23" Margin="5,0,0,0" Click="ButtonOpenReShadeHelp_Click" />
</Grid>
</StackPanel>
</GroupBox>
@ -91,7 +89,14 @@
</Grid>
</StackPanel>
</GroupBox>
<Button x:Name="ButtonOpenModFolder" Content="Open mod folder" ToolTip="{Binding ModFolderButtonTooltip, Mode=OneTime}" IsEnabled="{Binding ModFolderButtonEnabled, Mode=OneTime}" Height="23" Margin="10,5,10,0" Click="ButtonOpenModFolder_Click" />
<Grid Margin="10,5,10,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="80" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0" x:Name="ButtonOpenModFolder" Content="Open Modifications folder" ToolTip="{Binding ModFolderButtonTooltip, Mode=OneTime}" IsEnabled="{Binding ModFolderButtonEnabled, Mode=OneTime}" Height="23" Margin="0,0,5,0" Click="ButtonOpenModFolder_Click" />
<Button Grid.Column="1" x:Name="ButtonOpenModHelp" Content="Help" Height="23" Margin="5,0,0,0" Click="ButtonOpenModHelp_Click" />
</Grid>
</StackPanel>
</TabItem>
<TabItem Padding="5">

View File

@ -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
{
/// <summary>
/// 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

View File

@ -0,0 +1,54 @@
<Window x:Class="Bloxstrap.Dialogs.Menu.ReShadeHelp"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Bloxstrap.Dialogs.Menu"
mc:Ignorable="d"
Style="{DynamicResource MainWindowStyle}"
Title="ReShade Help"
SizeToContent="WidthAndHeight"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--<ResourceDictionary Source="Themes\ColourfulDarkTheme.xaml" />-->
<ResourceDictionary Source="Themes\LightTheme.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid Width="420" Height="220">
<StackPanel Margin="10">
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="ReShade Help" VerticalAlignment="Top" FontSize="18" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Toggle Menu" FontSize="16" />
<TextBlock HorizontalAlignment="Left" Margin="10,0,0,0" TextWrapping="Wrap" Text="Shift + Tab" />
</StackPanel>
<StackPanel Grid.Column="1">
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Toggle Shaders" FontSize="16" />
<TextBlock HorizontalAlignment="Left" Margin="10,0,0,0" TextWrapping="Wrap" Text="Shift + F6" />
</StackPanel>
<StackPanel Grid.Column="2">
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Take Screenshot" FontSize="16" />
<TextBlock HorizontalAlignment="Left" Margin="10,0,0,0" TextWrapping="Wrap" Text="Print Screen" />
</StackPanel>
</Grid>
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="If you're using a compact keyboard, you may have to hold down the Fn key when pressing F6." />
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Any screenshots you take are saved to the Screenshots folder in the ReShade folder." />
</StackPanel>
<Border Background="{DynamicResource ControlSelectedBackground}" BorderBrush="{DynamicResource ControlSelectedBorderBrush}" BorderThickness="1" Margin="-1,0,-1,0" Height="42" VerticalAlignment="Bottom">
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Name="ButtonClose" Content="Close" Width="66" Height="23" HorizontalAlignment="Right" Margin="0,0,10,0" Click="ButtonClose_Click" />
</StackPanel>
</Grid>
</Border>
</Grid>
</Window>

View File

@ -0,0 +1,33 @@
using System.Windows;
using Bloxstrap.Enums;
namespace Bloxstrap.Dialogs.Menu
{
/// <summary>
/// Interaction logic for ReShadeHelp.xaml
/// </summary>
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();
}
}
}

View File

@ -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"));

View File

@ -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
{

View File

@ -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)