diff --git a/Bloxstrap/Bloxstrap.csproj b/Bloxstrap/Bloxstrap.csproj index 11901f0..f1ce5f1 100644 --- a/Bloxstrap/Bloxstrap.csproj +++ b/Bloxstrap/Bloxstrap.csproj @@ -1,4 +1,4 @@ - + WinExe @@ -24,10 +24,12 @@ + + + + - - diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 1f6e4d9..16059f8 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -998,15 +998,20 @@ namespace Bloxstrap if (!Directory.Exists(modFolder)) Directory.CreateDirectory(modFolder); - await CheckModPreset(App.Settings.Prop.UseOldDeathSound, @"content\sounds\ouch.ogg", "OldDeath.ogg"); - await CheckModPreset(App.Settings.Prop.UseOldMouseCursor, @"content\textures\Cursors\KeyboardMouse\ArrowCursor.png", "OldCursor.png"); - await CheckModPreset(App.Settings.Prop.UseOldMouseCursor, @"content\textures\Cursors\KeyboardMouse\ArrowFarCursor.png", "OldFarCursor.png"); + // cursors + await CheckModPreset(App.Settings.Prop.CursorType != CursorType.Default, @"content\textures\Cursors\KeyboardMouse\ArrowCursor.png", $"Cursor.{App.Settings.Prop.CursorType}.ArrowCursor.png"); + await CheckModPreset(App.Settings.Prop.CursorType != CursorType.Default, @"content\textures\Cursors\KeyboardMouse\ArrowFarCursor.png", $"Cursor.{App.Settings.Prop.CursorType}.ArrowFarCursor.png"); + + // character sounds await CheckModPreset(App.Settings.Prop.UseOldCharacterSounds, @"content\sounds\action_footsteps_plastic.mp3", "OldWalk.mp3"); await CheckModPreset(App.Settings.Prop.UseOldCharacterSounds, @"content\sounds\action_jump.mp3", "OldJump.mp3"); await CheckModPreset(App.Settings.Prop.UseOldCharacterSounds, @"content\sounds\action_falling.mp3", "Empty.mp3"); await CheckModPreset(App.Settings.Prop.UseOldCharacterSounds, @"content\sounds\action_jump_land.mp3", "Empty.mp3"); await CheckModPreset(App.Settings.Prop.UseOldCharacterSounds, @"content\sounds\action_swim.mp3", "Empty.mp3"); await CheckModPreset(App.Settings.Prop.UseOldCharacterSounds, @"content\sounds\impact_water.mp3", "Empty.mp3"); + await CheckModPreset(App.Settings.Prop.UseOldDeathSound, @"content\sounds\ouch.ogg", "OldDeath.ogg"); + + // misc await CheckModPreset(App.Settings.Prop.UseDisableAppPatch && !_launchCommandLine.Contains("--deeplink"), @"ExtraContent\places\Mobile.rbxl", ""); // emoji presets are downloaded remotely from github due to how large they are @@ -1104,26 +1109,22 @@ namespace Bloxstrap private static async Task CheckModPreset(bool condition, string location, string name) { - string modFolderLocation = Path.Combine(Directories.Modifications, location); - byte[] binaryData = string.IsNullOrEmpty(name) ? Array.Empty() : await Resource.Get(name); + string fullLocation = Path.Combine(Directories.Modifications, location); + byte[] embeddedData = string.IsNullOrEmpty(name) ? Array.Empty() : await Resource.Get(name); - if (condition) - { - if (!File.Exists(modFolderLocation)) - { - string? directory = Path.GetDirectoryName(modFolderLocation); + string fileHash = File.Exists(fullLocation) ? Utility.MD5Hash.FromFile(fullLocation) : ""; + string embeddedHash = Utility.MD5Hash.FromBytes(embeddedData); - if (directory is null) - return; + if (condition && fileHash != embeddedHash) + { + Directory.CreateDirectory(Path.GetDirectoryName(fullLocation)!); + File.Delete(fullLocation); - Directory.CreateDirectory(directory); - - await File.WriteAllBytesAsync(modFolderLocation, binaryData); - } + await File.WriteAllBytesAsync(fullLocation, embeddedData); } - else if (File.Exists(modFolderLocation) && Utility.MD5Hash.FromFile(modFolderLocation) == Utility.MD5Hash.FromBytes(binaryData)) + else if (!condition && fileHash != "") { - File.Delete(modFolderLocation); + File.Delete(fullLocation); } } diff --git a/Bloxstrap/Enums/CursorType.cs b/Bloxstrap/Enums/CursorType.cs new file mode 100644 index 0000000..98e8ec4 --- /dev/null +++ b/Bloxstrap/Enums/CursorType.cs @@ -0,0 +1,9 @@ +namespace Bloxstrap.Enums +{ + public enum CursorType + { + Default, + From2006, + From2013 + } +} diff --git a/Bloxstrap/Extensions/CursorTypeEx.cs b/Bloxstrap/Extensions/CursorTypeEx.cs new file mode 100644 index 0000000..3afe692 --- /dev/null +++ b/Bloxstrap/Extensions/CursorTypeEx.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +using Bloxstrap.Enums; + +namespace Bloxstrap.Extensions +{ + static class CursorTypeEx + { + public static IReadOnlyDictionary Selections => new Dictionary + { + { "Default", CursorType.Default }, + { "Before 2022", CursorType.From2013 }, + { "Before 2013", CursorType.From2006 }, + }; + } +} diff --git a/Bloxstrap/Models/Settings.cs b/Bloxstrap/Models/Settings.cs index 80e28c2..604e3c2 100644 --- a/Bloxstrap/Models/Settings.cs +++ b/Bloxstrap/Models/Settings.cs @@ -29,8 +29,8 @@ namespace Bloxstrap.Models // mod preset configuration public bool UseOldDeathSound { get; set; } = true; public bool UseOldCharacterSounds { get; set; } = false; - public bool UseOldMouseCursor { get; set; } = false; public bool UseDisableAppPatch { get; set; } = false; + public CursorType CursorType { get; set; } = CursorType.Default; public EmojiType EmojiType { get; set; } = EmojiType.Default; public bool DisableFullscreenOptimizations { get; set; } = false; } diff --git a/Bloxstrap/Resources/Mods/Cursor/From2006/ArrowCursor.png b/Bloxstrap/Resources/Mods/Cursor/From2006/ArrowCursor.png new file mode 100644 index 0000000..85c4639 Binary files /dev/null and b/Bloxstrap/Resources/Mods/Cursor/From2006/ArrowCursor.png differ diff --git a/Bloxstrap/Resources/Mods/Cursor/From2006/ArrowFarCursor.png b/Bloxstrap/Resources/Mods/Cursor/From2006/ArrowFarCursor.png new file mode 100644 index 0000000..9a1954a Binary files /dev/null and b/Bloxstrap/Resources/Mods/Cursor/From2006/ArrowFarCursor.png differ diff --git a/Bloxstrap/Resources/Mods/OldCursor.png b/Bloxstrap/Resources/Mods/Cursor/From2013/ArrowCursor.png similarity index 100% rename from Bloxstrap/Resources/Mods/OldCursor.png rename to Bloxstrap/Resources/Mods/Cursor/From2013/ArrowCursor.png diff --git a/Bloxstrap/Resources/Mods/OldFarCursor.png b/Bloxstrap/Resources/Mods/Cursor/From2013/ArrowFarCursor.png similarity index 100% rename from Bloxstrap/Resources/Mods/OldFarCursor.png rename to Bloxstrap/Resources/Mods/Cursor/From2013/ArrowFarCursor.png diff --git a/Bloxstrap/UI/Elements/Menu/Pages/ModsPage.xaml b/Bloxstrap/UI/Elements/Menu/Pages/ModsPage.xaml index 548cdf8..9e3e57e 100644 --- a/Bloxstrap/UI/Elements/Menu/Pages/ModsPage.xaml +++ b/Bloxstrap/UI/Elements/Menu/Pages/ModsPage.xaml @@ -60,67 +60,56 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/Bloxstrap/UI/ViewModels/Menu/ModsViewModel.cs b/Bloxstrap/UI/ViewModels/Menu/ModsViewModel.cs index 1f94b4c..86cac7e 100644 --- a/Bloxstrap/UI/ViewModels/Menu/ModsViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Menu/ModsViewModel.cs @@ -28,10 +28,12 @@ namespace Bloxstrap.UI.ViewModels.Menu set => App.Settings.Prop.UseOldCharacterSounds = value; } - public bool OldMouseCursorEnabled + public IReadOnlyDictionary CursorTypes => CursorTypeEx.Selections; + + public string SelectedCursorType { - get => App.Settings.Prop.UseOldMouseCursor; - set => App.Settings.Prop.UseOldMouseCursor = value; + get => CursorTypes.FirstOrDefault(x => x.Value == App.Settings.Prop.CursorType).Key; + set => App.Settings.Prop.CursorType = CursorTypes[value]; } public bool DisableAppPatchEnabled