mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Remove ReShade
also fixed a bug with deleted mods not being correctly applied after adding webview2 support
This commit is contained in:
parent
c87eff997a
commit
6cc701f6a2
@ -25,7 +25,6 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.1.0" />
|
||||
<PackageReference Include="DiscordRichPresence" Version="1.1.3.18" />
|
||||
<PackageReference Include="ini-parser-netstandard" Version="2.5.2" />
|
||||
<PackageReference Include="securifybv.ShellLink" Version="0.1.0" />
|
||||
<PackageReference Include="WPF-UI" Version="2.0.3" />
|
||||
</ItemGroup>
|
||||
|
@ -181,11 +181,6 @@ namespace Bloxstrap
|
||||
if (ShouldInstallWebView2)
|
||||
await InstallWebView2();
|
||||
|
||||
if (App.Settings.Prop.UseReShade)
|
||||
SetStatus("Configuring/Downloading ReShade...");
|
||||
|
||||
await ReShade.CheckModifications();
|
||||
|
||||
await ApplyModifications();
|
||||
|
||||
if (App.IsFirstRun || FreshInstall)
|
||||
@ -720,8 +715,6 @@ namespace Bloxstrap
|
||||
|
||||
if (!FreshInstall)
|
||||
{
|
||||
ReShade.SynchronizeConfigFile();
|
||||
|
||||
// let's take this opportunity to delete any packages we don't need anymore
|
||||
foreach (string filename in Directory.GetFiles(Directories.Downloads))
|
||||
{
|
||||
@ -894,7 +887,7 @@ namespace Bloxstrap
|
||||
|
||||
try
|
||||
{
|
||||
packageDirectory = PackageDirectories.First(x => x.Key != "RobloxApp.zip" && fileLocation.StartsWith(x.Value));
|
||||
packageDirectory = PackageDirectories.First(x => x.Key != "RobloxApp.zip" && x.Key != "WebView2.zip" && fileLocation.StartsWith(x.Value));
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
|
@ -113,8 +113,8 @@ namespace Bloxstrap.Helpers
|
||||
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"))
|
||||
// exclusive fullscreen requires direct3d 11 to work
|
||||
if (GetValue(RenderingModes["Direct3D 11"]) != "True" && App.FastFlags.GetValue("FFlagHandleAltEnterFullscreenManually") == "False")
|
||||
SetRenderingMode("Direct3D 11");
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
|
||||
namespace Bloxstrap.Helpers
|
||||
{
|
||||
@ -11,6 +12,23 @@ namespace Bloxstrap.Helpers
|
||||
|
||||
if (Directory.Exists(rbxfpsunlocker))
|
||||
Directory.Delete(rbxfpsunlocker, true);
|
||||
|
||||
// v2.2.0 - remove reshade
|
||||
string reshadeLocation = Path.Combine(Directories.Modifications, "dxgi.dll");
|
||||
|
||||
if (File.Exists(reshadeLocation))
|
||||
{
|
||||
App.ShowMessageBox(
|
||||
"As of April 18th, Roblox has started out rolling out the Byfron anticheat as well as 64-bit support. Because of this, ReShade will no longer work, and will be deactivated from now on.\n\n" +
|
||||
$"Your ReShade configs and files will still be kept, which are all located in the {App.ProjectName} folder.",
|
||||
MessageBoxImage.Warning
|
||||
);
|
||||
|
||||
File.Delete(reshadeLocation);
|
||||
|
||||
if (App.FastFlags.GetValue(FastFlagManager.RenderingModes["Direct3D 11"]) == "True" && App.FastFlags.GetValue("FFlagHandleAltEnterFullscreenManually") != "False")
|
||||
App.FastFlags.SetRenderingMode("Automatic");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,505 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Bloxstrap.Helpers;
|
||||
|
||||
using Bloxstrap.Models;
|
||||
|
||||
using IniParser;
|
||||
using IniParser.Model;
|
||||
|
||||
namespace Bloxstrap.Integrations
|
||||
{
|
||||
internal class ReShade
|
||||
{
|
||||
// i havent even started this and i know for a fact this is gonna be a mess of an integration lol
|
||||
// there's a lot of nuances involved in how reshade functionality is supposed to work (shader management, config management, etc)
|
||||
// it's gonna be a bit of a pain in the ass, and i'm expecting a lot of bugs to arise from this...
|
||||
// well, looks like v1.7.0 is gonna be held back for quite a while lol
|
||||
|
||||
// also, this is going to be fairly restrictive without a lot of heavy work
|
||||
// reshade's official installer gives you a list of shader packs and lets you choose which ones you want to install
|
||||
// and here we're effectively choosing for the user... hm...
|
||||
// i mean, it should be fine? importing shaders is still gonna be a thing, though maybe not as simple, but most people would be looking to use extravi's presets anyway
|
||||
|
||||
private static string BaseDirectory => Path.Combine(Directories.Integrations, "ReShade");
|
||||
private static string FontsFolder => Path.Combine(BaseDirectory, "Fonts");
|
||||
private static string PresetsFolder => Path.Combine(BaseDirectory, "Presets");
|
||||
private static string ShadersFolder => Path.Combine(BaseDirectory, "Shaders");
|
||||
private static string TexturesFolder => Path.Combine(BaseDirectory, "Textures");
|
||||
private static string ConfigLocation => Path.Combine(Directories.Modifications, "ReShade.ini");
|
||||
|
||||
// the base url that we're fetching all our remote configs and resources and stuff from
|
||||
private const string BaseUrl = "https://raw.githubusercontent.com/Extravi/extravi.github.io/main/update";
|
||||
|
||||
// this is a list of selectable shaders to download
|
||||
private static readonly List<ReShadeShaderConfig> Shaders = new()
|
||||
{
|
||||
// shaders required for extravi's presets:
|
||||
new ReShadeShaderConfig { Name = "AstrayFX", DownloadLocation = "https://github.com/BlueSkyDefender/AstrayFX/archive/refs/heads/master.zip" },
|
||||
new ReShadeShaderConfig { Name = "Brussell", DownloadLocation = "https://github.com/brussell1/Shaders/archive/refs/heads/master.zip" },
|
||||
new ReShadeShaderConfig { Name = "Depth3D", DownloadLocation = "https://github.com/BlueSkyDefender/Depth3D/archive/refs/heads/master.zip" },
|
||||
new ReShadeShaderConfig { Name = "Glamarye", DownloadLocation = "https://github.com/rj200/Glamarye_Fast_Effects_for_ReShade/archive/refs/heads/main.zip" },
|
||||
new ReShadeShaderConfig { Name = "NiceGuy", DownloadLocation = "https://github.com/mj-ehsan/NiceGuy-Shaders/archive/refs/heads/main.zip" },
|
||||
new ReShadeShaderConfig { Name = "prod80", DownloadLocation = "https://github.com/prod80/prod80-ReShade-Repository/archive/refs/heads/master.zip" },
|
||||
new ReShadeShaderConfig { Name = "qUINT", DownloadLocation = "https://github.com/martymcmodding/qUINT/archive/refs/heads/master.zip" },
|
||||
new ReShadeShaderConfig { Name = "StockLegacy", DownloadLocation = "https://github.com/crosire/reshade-shaders/archive/refs/heads/legacy.zip" },
|
||||
new ReShadeShaderConfig { Name = "SweetFX", DownloadLocation = "https://github.com/CeeJayDK/SweetFX/archive/refs/heads/master.zip" },
|
||||
|
||||
// these ones needs some additional configuration
|
||||
|
||||
new ReShadeShaderConfig
|
||||
{
|
||||
Name = "Stock",
|
||||
DownloadLocation = "https://github.com/crosire/reshade-shaders/archive/refs/heads/master.zip",
|
||||
ExcludedFiles = new List<string>()
|
||||
{
|
||||
// overriden by stormshade
|
||||
"Shaders/MXAO.fx"
|
||||
}
|
||||
},
|
||||
|
||||
new ReShadeShaderConfig
|
||||
{
|
||||
Name = "AlucardDH",
|
||||
DownloadLocation = "https://github.com/AlucardDH/dh-reshade-shaders/archive/refs/heads/master.zip",
|
||||
ExcludedFiles = new List<string>()
|
||||
{
|
||||
// compiler errors
|
||||
// dh_Lain only errors when performance mode is disabled, but it's not used by any presets anyway
|
||||
"Shaders/dh_rtgi.fx",
|
||||
"Shaders/dh_Lain.fx"
|
||||
}
|
||||
},
|
||||
|
||||
new ReShadeShaderConfig
|
||||
{
|
||||
Name = "Stormshade",
|
||||
DownloadLocation = "https://github.com/cyrie/Stormshade/archive/refs/heads/master.zip",
|
||||
BaseFolder = "reshade-shaders/",
|
||||
ExcludedFiles = new List<string>()
|
||||
{
|
||||
// these file names conflict with effects in the stock reshade config
|
||||
"Shaders/AmbientLight.fx",
|
||||
"Shaders/Clarity.fx",
|
||||
"Shaders/DOF.fx",
|
||||
"Shaders/DPX.fx",
|
||||
"Shaders/FilmGrain.fx",
|
||||
"Shaders/FineSharp.fx",
|
||||
"Shaders/FXAA.fx",
|
||||
"Shaders/FXAA.fxh",
|
||||
"Shaders/LumaSharpen.fx",
|
||||
//"Shaders/MXAO.fx",
|
||||
"Shaders/ReShade.fxh",
|
||||
"Shaders/Vibrance.fx",
|
||||
"Shaders/Vignette.fx"
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
private static readonly string[] ExtraviPresetsShaders = new string[]
|
||||
{
|
||||
"AlucardDH",
|
||||
"Brussell",
|
||||
"AstrayFX",
|
||||
"Brussell",
|
||||
"Depth3D",
|
||||
"Glamarye",
|
||||
"NiceGuy",
|
||||
"prod80",
|
||||
"qUINT",
|
||||
"StockLegacy",
|
||||
"Stormshade",
|
||||
"SweetFX",
|
||||
};
|
||||
|
||||
private static string GetSearchPath(string type, string name)
|
||||
{
|
||||
return $",..\\..\\Integrations\\ReShade\\{type}\\{name}";
|
||||
}
|
||||
|
||||
public static async Task DownloadConfig()
|
||||
{
|
||||
App.Logger.WriteLine("[ReShade::DownloadConfig] Downloading/Upgrading config file...");
|
||||
|
||||
{
|
||||
byte[] bytes = await App.HttpClient.GetByteArrayAsync($"{BaseUrl}/config.zip");
|
||||
|
||||
using MemoryStream zipStream = new(bytes);
|
||||
using ZipArchive archive = new(zipStream);
|
||||
|
||||
|
||||
archive.Entries.First(x => x.FullName == "ReShade.ini").ExtractToFile(ConfigLocation, true);
|
||||
|
||||
// when we extract the file we have to make sure the last modified date is overwritten
|
||||
// or else it will synchronize with the config in the version folder
|
||||
// really the config adjustments below should do this for us, but this is just to be safe
|
||||
File.SetLastWriteTime(ConfigLocation, DateTime.Now);
|
||||
|
||||
// we also gotta download the editor fonts
|
||||
foreach (ZipArchiveEntry entry in archive.Entries.Where(x => x.FullName.EndsWith(".ttf")))
|
||||
entry.ExtractToFile(Path.Combine(FontsFolder, entry.FullName), true);
|
||||
}
|
||||
|
||||
// now we have to adjust the config file to use the paths that we need
|
||||
// some of these can be removed later when the config file is better adjusted for bloxstrap by default
|
||||
|
||||
FileIniDataParser parser = new();
|
||||
IniData data = parser.ReadFile(ConfigLocation);
|
||||
|
||||
data["GENERAL"]["EffectSearchPaths"] = "..\\..\\Integrations\\ReShade\\Shaders";
|
||||
data["GENERAL"]["TextureSearchPaths"] = "..\\..\\Integrations\\ReShade\\Textures";
|
||||
data["GENERAL"]["PresetPath"] = data["GENERAL"]["PresetPath"].Replace(".\\reshade-presets\\", "..\\..\\Integrations\\ReShade\\Presets\\");
|
||||
//data["SCREENSHOT"]["SavePath"] = "..\\..\\ReShade\\Screenshots";
|
||||
data["SCREENSHOT"]["SavePath"] = Path.Combine(Directories.MyPictures, "Roblox-ReShade");
|
||||
data["STYLE"]["EditorFont"] = data["STYLE"]["EditorFont"].Replace(".\\", "..\\..\\Integrations\\ReShade\\Fonts\\");
|
||||
data["STYLE"]["Font"] = data["STYLE"]["Font"].Replace(".\\", "..\\..\\Integrations\\ReShade\\Fonts\\");
|
||||
|
||||
// add search paths for shaders and textures
|
||||
|
||||
foreach (string name in Directory.GetDirectories(ShadersFolder).Select(x => Path.GetRelativePath(ShadersFolder, x)).ToArray())
|
||||
data["GENERAL"]["EffectSearchPaths"] += GetSearchPath("Shaders", name);
|
||||
|
||||
foreach (string name in Directory.GetDirectories(TexturesFolder).Select(x => Path.GetRelativePath(TexturesFolder, x)).ToArray())
|
||||
data["GENERAL"]["TextureSearchPaths"] += GetSearchPath("Textures", name);
|
||||
|
||||
parser.WriteFile(ConfigLocation, data);
|
||||
}
|
||||
|
||||
public static void SynchronizeConfigFile()
|
||||
{
|
||||
App.Logger.WriteLine($"[ReShade::SynchronizeConfigFile] Synchronizing configuration file...");
|
||||
|
||||
// yeah, this is going to be a bit of a pain
|
||||
// keep in mind the config file is going to be in two places: the mod folder and the version folder
|
||||
// so we have to make sure the two below scenaros work flawlessly:
|
||||
// - if the user manually updates their reshade config in the mod folder or it gets updated, it must be copied to the version folder
|
||||
// - if the user updates their reshade settings ingame, the updated config must be copied to the mod folder
|
||||
// the easiest way to manage this is to just compare the modification dates of the two
|
||||
// anyway, this is where i'm expecting most of the bugs to arise from
|
||||
// config synchronization will be done whenever roblox updates or whenever we launch roblox
|
||||
|
||||
string modFolderConfigPath = ConfigLocation;
|
||||
string versionFolderConfigPath = Path.Combine(Directories.Versions, App.State.Prop.VersionGuid, "ReShade.ini");
|
||||
|
||||
// we shouldn't be here if the mod config doesn't already exist
|
||||
if (!File.Exists(modFolderConfigPath))
|
||||
{
|
||||
App.Logger.WriteLine($"[ReShade::SynchronizeConfigFile] ReShade.ini in modifications folder does not exist, aborting sync");
|
||||
return;
|
||||
}
|
||||
|
||||
// copy to the version folder if it doesn't already exist there
|
||||
if (!File.Exists(versionFolderConfigPath))
|
||||
{
|
||||
App.Logger.WriteLine($"[ReShade::SynchronizeConfigFile] ReShade.ini in version folder does not exist, synchronized with modifications folder");
|
||||
File.Copy(modFolderConfigPath, versionFolderConfigPath);
|
||||
}
|
||||
|
||||
// if both the mod and version configs match, then we don't need to do anything
|
||||
if (Utilities.MD5File(modFolderConfigPath) == Utilities.MD5File(versionFolderConfigPath))
|
||||
{
|
||||
App.Logger.WriteLine($"[ReShade::SynchronizeConfigFile] ReShade.ini in version and modifications folder match");
|
||||
return;
|
||||
}
|
||||
|
||||
FileInfo modFolderConfigFile = new(modFolderConfigPath);
|
||||
FileInfo versionFolderConfigFile = new(versionFolderConfigPath);
|
||||
|
||||
if (modFolderConfigFile.LastWriteTime > versionFolderConfigFile.LastWriteTime)
|
||||
{
|
||||
// overwrite version config if mod config was modified most recently
|
||||
App.Logger.WriteLine($"[ReShade::SynchronizeConfigFile] ReShade.ini in version folder is older, synchronized with modifications folder");
|
||||
File.Copy(modFolderConfigPath, versionFolderConfigPath, true);
|
||||
}
|
||||
else if (versionFolderConfigFile.LastWriteTime > modFolderConfigFile.LastWriteTime)
|
||||
{
|
||||
// overwrite mod config if version config was modified most recently
|
||||
App.Logger.WriteLine($"[ReShade::SynchronizeConfigFile] ReShade.ini in modifications folder is older, synchronized with version folder");
|
||||
File.Copy(versionFolderConfigPath, modFolderConfigPath, true);
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task DownloadShaders(string name)
|
||||
{
|
||||
ReShadeShaderConfig config = Shaders.First(x => x.Name == name);
|
||||
|
||||
// not all shader packs have a textures folder, so here we're determining if they exist purely based on if they have a Shaders folder
|
||||
if (Directory.Exists(Path.Combine(ShadersFolder, name)))
|
||||
return;
|
||||
|
||||
App.Logger.WriteLine($"[ReShade::DownloadShaders] Downloading shaders for {name}");
|
||||
|
||||
{
|
||||
byte[] bytes = await App.HttpClient.GetByteArrayAsync(config.DownloadLocation);
|
||||
|
||||
using MemoryStream zipStream = new(bytes);
|
||||
using ZipArchive archive = new(zipStream);
|
||||
|
||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||
{
|
||||
if (entry.FullName.EndsWith('/') || !entry.FullName.Contains(config.BaseFolder))
|
||||
continue;
|
||||
|
||||
// github branch zips have a root folder of the name of the branch, so let's just remove that
|
||||
string fullPath = entry.FullName.Substring(entry.FullName.IndexOf(config.BaseFolder) + config.BaseFolder.Length);
|
||||
|
||||
// skip file if it's not in the Shaders or Textures folder
|
||||
if (!fullPath.StartsWith("Shaders") && !fullPath.StartsWith("Textures"))
|
||||
continue;
|
||||
|
||||
if (config.ExcludedFiles.Contains(fullPath))
|
||||
continue;
|
||||
|
||||
// and now we do it again because of how we're handling folder management
|
||||
// e.g. reshade-shaders-master/Shaders/Vignette.fx should go to ReShade/Shaders/Stock/Vignette.fx
|
||||
// so in this case, relativePath should just be "Vignette.fx"
|
||||
string relativePath = fullPath.Substring(fullPath.IndexOf('/') + 1);
|
||||
|
||||
// now we stitch it all together
|
||||
string extractionPath = Path.Combine(
|
||||
BaseDirectory,
|
||||
fullPath.StartsWith("Shaders") ? "Shaders" : "Textures",
|
||||
name,
|
||||
relativePath
|
||||
);
|
||||
|
||||
// make sure the folder that we're extracting it to exists
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(extractionPath)!);
|
||||
|
||||
// and now extract
|
||||
await Task.Run(() => entry.ExtractToFile(extractionPath));
|
||||
}
|
||||
}
|
||||
|
||||
// now we have to update ReShade.ini and add the installed shaders to the search paths
|
||||
FileIniDataParser parser = new();
|
||||
IniData data = parser.ReadFile(ConfigLocation);
|
||||
|
||||
if (!data["GENERAL"]["EffectSearchPaths"].Contains(name))
|
||||
data["GENERAL"]["EffectSearchPaths"] += GetSearchPath("Shaders", name);
|
||||
|
||||
// not every shader pack has a textures folder
|
||||
if (Directory.Exists(Path.Combine(TexturesFolder, name)) && !data["GENERAL"]["TextureSearchPaths"].Contains(name))
|
||||
data["GENERAL"]["TextureSearchPaths"] += GetSearchPath("Textures", name);
|
||||
|
||||
parser.WriteFile(ConfigLocation, data);
|
||||
}
|
||||
|
||||
public static void DeleteShaders(string name)
|
||||
{
|
||||
App.Logger.WriteLine($"[ReShade::DeleteShaders] Deleting shaders for {name}");
|
||||
|
||||
string shadersPath = Path.Combine(ShadersFolder, name);
|
||||
string texturesPath = Path.Combine(TexturesFolder, name);
|
||||
|
||||
if (Directory.Exists(shadersPath))
|
||||
Directory.Delete(shadersPath, true);
|
||||
|
||||
if (Directory.Exists(texturesPath))
|
||||
Directory.Delete(texturesPath, true);
|
||||
|
||||
if (!File.Exists(ConfigLocation))
|
||||
return;
|
||||
|
||||
// now we have to update ReShade.ini and remove the installed shaders from the search paths
|
||||
FileIniDataParser parser = new();
|
||||
IniData data = parser.ReadFile(ConfigLocation);
|
||||
|
||||
string shaderSearchPaths = data["GENERAL"]["EffectSearchPaths"];
|
||||
string textureSearchPaths = data["GENERAL"]["TextureSearchPaths"];
|
||||
|
||||
if (shaderSearchPaths.Contains(name))
|
||||
{
|
||||
string searchPath = GetSearchPath("Shaders", name);
|
||||
if (shaderSearchPaths.Contains(searchPath))
|
||||
data["GENERAL"]["EffectSearchPaths"] = shaderSearchPaths.Remove(shaderSearchPaths.IndexOf(searchPath), searchPath.Length);
|
||||
}
|
||||
|
||||
if (textureSearchPaths.Contains(name))
|
||||
{
|
||||
string searchPath = GetSearchPath("Textures", name);
|
||||
if (textureSearchPaths.Contains(searchPath))
|
||||
data["GENERAL"]["TextureSearchPaths"] = textureSearchPaths.Remove(textureSearchPaths.IndexOf(searchPath), searchPath.Length);
|
||||
}
|
||||
|
||||
parser.WriteFile(ConfigLocation, data);
|
||||
}
|
||||
|
||||
public static async Task InstallExtraviPresets()
|
||||
{
|
||||
App.Logger.WriteLine("[ReShade::InstallExtraviPresets] Installing Extravi's presets...");
|
||||
|
||||
foreach (string name in ExtraviPresetsShaders)
|
||||
await DownloadShaders(name);
|
||||
|
||||
byte[] bytes = await App.HttpClient.GetByteArrayAsync($"{BaseUrl}/reshade-presets.zip");
|
||||
|
||||
using MemoryStream zipStream = new(bytes);
|
||||
using ZipArchive archive = new(zipStream);
|
||||
|
||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||
{
|
||||
if (entry.FullName.EndsWith('/'))
|
||||
continue;
|
||||
|
||||
// remove containing folder
|
||||
string filename = entry.FullName.Substring(entry.FullName.IndexOf('/') + 1);
|
||||
|
||||
await Task.Run(() => entry.ExtractToFile(Path.Combine(PresetsFolder, filename), true));
|
||||
}
|
||||
}
|
||||
|
||||
public static void UninstallExtraviPresets()
|
||||
{
|
||||
if (!Directory.Exists(PresetsFolder))
|
||||
return;
|
||||
|
||||
App.Logger.WriteLine("[ReShade::UninstallExtraviPresets] Uninstalling Extravi's ReShade presets...");
|
||||
|
||||
FileInfo[] presets = new DirectoryInfo(PresetsFolder).GetFiles();
|
||||
|
||||
foreach (FileInfo preset in presets)
|
||||
{
|
||||
if (preset.Name.StartsWith("Extravi"))
|
||||
preset.Delete();
|
||||
}
|
||||
|
||||
foreach (string name in ExtraviPresetsShaders)
|
||||
DeleteShaders(name);
|
||||
}
|
||||
|
||||
public static async Task CheckModifications()
|
||||
{
|
||||
App.Logger.WriteLine("[ReShade::CheckModifications] Checking ReShade modifications...");
|
||||
|
||||
string injectorLocation = Path.Combine(Directories.Modifications, "dxgi.dll");
|
||||
|
||||
if (!App.Settings.Prop.UseReShadeExtraviPresets && !string.IsNullOrEmpty(App.State.Prop.ExtraviReShadePresetsVersion))
|
||||
{
|
||||
if (Utilities.CheckIfRobloxRunning())
|
||||
return;
|
||||
|
||||
UninstallExtraviPresets();
|
||||
|
||||
App.State.Prop.ExtraviReShadePresetsVersion = "";
|
||||
App.State.Save();
|
||||
}
|
||||
|
||||
if (!App.Settings.Prop.UseReShade)
|
||||
{
|
||||
if (Utilities.CheckIfRobloxRunning())
|
||||
return;
|
||||
|
||||
App.Logger.WriteLine("[ReShade::CheckModifications] ReShade is not enabled");
|
||||
|
||||
// we should already be uninstalled
|
||||
// we want to ensure this is done one-time only as this could possibly interfere with other rendering hooks using dxgi.dll
|
||||
if (string.IsNullOrEmpty(App.State.Prop.ReShadeConfigVersion))
|
||||
return;
|
||||
|
||||
App.Logger.WriteLine("[ReShade::CheckModifications] Uninstalling ReShade...");
|
||||
|
||||
// delete any stock config files
|
||||
File.Delete(injectorLocation);
|
||||
File.Delete(ConfigLocation);
|
||||
|
||||
if (Directory.Exists(BaseDirectory))
|
||||
Directory.Delete(BaseDirectory, true);
|
||||
|
||||
App.State.Prop.ReShadeConfigVersion = "";
|
||||
App.State.Save();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// the version manfiest contains the version of reshade available for download and the last date the presets were updated
|
||||
var versionManifest = await Utilities.GetJson<ReShadeVersionManifest>("https://raw.githubusercontent.com/Extravi/extravi.github.io/main/update/version.json");
|
||||
bool shouldFetchReShade = false;
|
||||
bool shouldFetchConfig = false;
|
||||
|
||||
if (!File.Exists(injectorLocation))
|
||||
{
|
||||
shouldFetchReShade = true;
|
||||
}
|
||||
else if (versionManifest is not null)
|
||||
{
|
||||
// check if an update for reshade is available
|
||||
FileVersionInfo injectorVersionInfo = FileVersionInfo.GetVersionInfo(injectorLocation);
|
||||
|
||||
if (injectorVersionInfo.ProductVersion != versionManifest.ReShade)
|
||||
shouldFetchReShade = true;
|
||||
|
||||
// UPDATE CHECK - if we're upgrading to reshade 5.7.0, or we have extravi's presets
|
||||
// enabled with a known shader downloaded (like AlucardDH) but without stormshade downloaded (5.7.0+ specific),
|
||||
// we need to redownload all our shaders fresh
|
||||
if (
|
||||
injectorVersionInfo.ProductVersion != versionManifest.ReShade && versionManifest.ReShade == "5.7.0" ||
|
||||
App.Settings.Prop.UseReShadeExtraviPresets && Directory.Exists(Path.Combine(ShadersFolder, "AlucardDH")) && !Directory.Exists(Path.Combine(ShadersFolder, "Stormshade"))
|
||||
)
|
||||
{
|
||||
Directory.Delete(ShadersFolder, true);
|
||||
Directory.Delete(TexturesFolder, true);
|
||||
App.State.Prop.ExtraviReShadePresetsVersion = "";
|
||||
App.Logger.WriteLine("[ReShade::CheckModifications] Upgrading to ReShade 5.7.0 - redownloading all shaders!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
App.Logger.WriteLine("[ReShade::CheckModifications] versionManifest is null!");
|
||||
}
|
||||
|
||||
// we're about to download - initialize directories
|
||||
Directory.CreateDirectory(BaseDirectory);
|
||||
Directory.CreateDirectory(FontsFolder);
|
||||
Directory.CreateDirectory(ShadersFolder);
|
||||
Directory.CreateDirectory(TexturesFolder);
|
||||
Directory.CreateDirectory(PresetsFolder);
|
||||
|
||||
// check if we should download a fresh copy of the config
|
||||
// extravi may need to update the config ota, in which case we'll redownload it
|
||||
if (!File.Exists(ConfigLocation) || versionManifest is not null && App.State.Prop.ReShadeConfigVersion != versionManifest.ConfigFile)
|
||||
shouldFetchConfig = true;
|
||||
|
||||
if (shouldFetchReShade)
|
||||
{
|
||||
App.Logger.WriteLine("[ReShade::CheckModifications] Installing/Upgrading ReShade...");
|
||||
|
||||
{
|
||||
byte[] bytes = await App.HttpClient.GetByteArrayAsync($"{BaseUrl}/dxgi.zip");
|
||||
using MemoryStream zipStream = new(bytes);
|
||||
using ZipArchive archive = new(zipStream);
|
||||
archive.ExtractToDirectory(Directories.Modifications, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldFetchConfig)
|
||||
{
|
||||
await DownloadConfig();
|
||||
|
||||
if (versionManifest is not null)
|
||||
{
|
||||
App.State.Prop.ReShadeConfigVersion = versionManifest.ConfigFile;
|
||||
App.State.Save();
|
||||
}
|
||||
}
|
||||
|
||||
await DownloadShaders("Stock");
|
||||
|
||||
if (App.Settings.Prop.UseReShadeExtraviPresets && App.State.Prop.ExtraviReShadePresetsVersion != versionManifest!.Presets)
|
||||
{
|
||||
await InstallExtraviPresets();
|
||||
App.State.Prop.ExtraviReShadePresetsVersion = versionManifest.Presets;
|
||||
App.State.Save();
|
||||
}
|
||||
|
||||
SynchronizeConfigFile();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bloxstrap.Models
|
||||
{
|
||||
public class ReShadeShaderConfig
|
||||
{
|
||||
// it's assumed that the BaseFolder has a "Textures" folder and a "Shaders" folder
|
||||
// the files listed in ExcludedFiles are relative to the BaseFolder
|
||||
|
||||
public string Name { get; set; } = null!;
|
||||
public string DownloadLocation { get; set; } = null!;
|
||||
public string BaseFolder { get; set; } = "/";
|
||||
public List<string> ExcludedFiles { get; set; } = new List<string>();
|
||||
|
||||
public override string ToString() => Name;
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
namespace Bloxstrap.Models
|
||||
{
|
||||
public class ReShadeVersionManifest
|
||||
{
|
||||
public string ReShade { get; set; } = null!;
|
||||
public string Presets { get; set; } = null!;
|
||||
public string ConfigFile { get; set; } = null!;
|
||||
}
|
||||
}
|
@ -25,8 +25,6 @@ namespace Bloxstrap.Models
|
||||
// integration configuration
|
||||
public bool UseDiscordRichPresence { get; set; } = true;
|
||||
public bool HideRPCButtons { get; set; } = true;
|
||||
public bool UseReShade { get; set; } = true;
|
||||
public bool UseReShadeExtraviPresets { get; set; } = true;
|
||||
public bool ShowServerDetails { get; set; } = false;
|
||||
public ObservableCollection<CustomIntegration> CustomIntegrations { get; set; } = new();
|
||||
|
||||
|
@ -9,8 +9,6 @@ namespace Bloxstrap.Models
|
||||
public class State
|
||||
{
|
||||
public string VersionGuid { get; set; } = "";
|
||||
public string ReShadeConfigVersion { get; set; } = "";
|
||||
public string ExtraviReShadePresetsVersion { get; set; } = "";
|
||||
public List<string> ModManifest { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -15,17 +15,9 @@ namespace Bloxstrap.ViewModels
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
|
||||
public ICommand OpenReShadeFolderCommand => new RelayCommand(OpenReShadeFolder);
|
||||
public ICommand AddIntegrationCommand => new RelayCommand(AddIntegration);
|
||||
public ICommand DeleteIntegrationCommand => new RelayCommand(DeleteIntegration);
|
||||
|
||||
public bool CanOpenReShadeFolder => App.Settings.Prop.UseReShade;
|
||||
|
||||
private void OpenReShadeFolder()
|
||||
{
|
||||
Process.Start("explorer.exe", Path.Combine(Directories.Integrations, "ReShade"));
|
||||
}
|
||||
|
||||
private void AddIntegration()
|
||||
{
|
||||
CustomIntegrations.Add(new CustomIntegration()
|
||||
@ -76,34 +68,13 @@ namespace Bloxstrap.ViewModels
|
||||
set => App.Settings.Prop.HideRPCButtons = !value;
|
||||
}
|
||||
|
||||
public bool ReShadeEnabled
|
||||
{
|
||||
get => App.Settings.Prop.UseReShade;
|
||||
set
|
||||
{
|
||||
App.Settings.Prop.UseReShade = value;
|
||||
ReShadePresetsEnabled = value;
|
||||
|
||||
if (value)
|
||||
App.FastFlags.SetRenderingMode("Direct3D 11");
|
||||
|
||||
OnPropertyChanged(nameof(ReShadePresetsEnabled));
|
||||
}
|
||||
}
|
||||
|
||||
public bool ReShadePresetsEnabled
|
||||
{
|
||||
get => App.Settings.Prop.UseReShadeExtraviPresets;
|
||||
set => App.Settings.Prop.UseReShadeExtraviPresets = value;
|
||||
}
|
||||
|
||||
public bool ShowServerDetailsEnabled
|
||||
{
|
||||
get => App.Settings.Prop.ShowServerDetails;
|
||||
set => App.Settings.Prop.ShowServerDetails = value;
|
||||
set => App.Settings.Prop.ShowServerDetails = value;
|
||||
}
|
||||
|
||||
public ObservableCollection<CustomIntegration> CustomIntegrations
|
||||
public ObservableCollection<CustomIntegration> CustomIntegrations
|
||||
{
|
||||
get => App.Settings.Prop.CustomIntegrations;
|
||||
set => App.Settings.Prop.CustomIntegrations = value;
|
||||
|
@ -83,8 +83,6 @@
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
@ -111,32 +109,18 @@
|
||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="MIT License" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
</StackPanel>
|
||||
</ui:CardAction>
|
||||
<ui:CardAction Grid.Row="2" Grid.Column="0" Margin="0,8,8,0" Padding="16,13,16,12" Command="models:GlobalViewModel.OpenWebpageCommand" CommandParameter="https://github.com/rickyah/ini-parser/blob/development/LICENSE">
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="14" Text="IniParser by rickyah" />
|
||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="MIT License" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
</StackPanel>
|
||||
</ui:CardAction>
|
||||
<ui:CardAction Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,8,0,0" Padding="16,13,16,12" Command="models:GlobalViewModel.OpenWebpageCommand" CommandParameter="https://github.com/MaximumADHD/Roblox-Studio-Mod-Manager/blob/main/LICENSE">
|
||||
<ui:CardAction Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,8,8,0" Padding="16,13,16,12" Command="models:GlobalViewModel.OpenWebpageCommand" CommandParameter="https://github.com/MaximumADHD/Roblox-Studio-Mod-Manager/blob/main/LICENSE">
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="14" Text="Roblox Studio Mod Manager by MaximumADHD" />
|
||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="MIT License" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
</StackPanel>
|
||||
</ui:CardAction>
|
||||
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="Integrations" FontSize="14" TextWrapping="Wrap" Margin="0,8,0,0" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
<ui:CardAction Grid.Row="4" Grid.Column="0" Margin="0,8,8,0" Padding="16,13,16,12" Command="models:GlobalViewModel.OpenWebpageCommand" CommandParameter="https://github.com/Lachee/discord-rpc-csharp/blob/master/LICENSE">
|
||||
<ui:CardAction Grid.Row="2" Grid.Column="2" Margin="0,8,0,0" Padding="16,13,16,12" Command="models:GlobalViewModel.OpenWebpageCommand" CommandParameter="https://github.com/Lachee/discord-rpc-csharp/blob/master/LICENSE">
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="14" Text="DiscordRPC by Lachee" />
|
||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="MIT License" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
</StackPanel>
|
||||
</ui:CardAction>
|
||||
<ui:CardAction Grid.Row="4" Grid.Column="1" Margin="0,8,8,0" Padding="16,13,16,12" Command="models:GlobalViewModel.OpenWebpageCommand" CommandParameter="https://github.com/crosire/reshade/blob/main/LICENSE.md">
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="14" Text="ReShade by crosire" />
|
||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="BSD 3-Clause License" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
</StackPanel>
|
||||
</ui:CardAction>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ui:UiPage>
|
||||
|
@ -33,66 +33,6 @@
|
||||
<ui:ToggleSwitch IsChecked="{Binding DiscordActivityJoinEnabled, Mode=TwoWay}" />
|
||||
</ui:CardControl>
|
||||
|
||||
<TextBlock Text="ReShade" FontSize="16" FontWeight="Medium" Margin="0,16,0,0" />
|
||||
<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12">
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="14" Text="Use ReShade" />
|
||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Reshade is a post-processing injector that enables the use of shaders." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
</StackPanel>
|
||||
</ui:CardControl.Header>
|
||||
<ui:ToggleSwitch x:Name="ReShadeEnabledToggle" IsChecked="{Binding ReShadeEnabled, Mode=TwoWay}" />
|
||||
</ui:CardControl>
|
||||
<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12" IsEnabled="{Binding IsChecked, ElementName=ReShadeEnabledToggle, Mode=OneWay}">
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="14" Text="Use Extravi's shader presets" />
|
||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="ReShade presets made specifically for Roblox that enhance your graphics." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
</StackPanel>
|
||||
</ui:CardControl.Header>
|
||||
<ui:ToggleSwitch IsChecked="{Binding ReShadePresetsEnabled, Mode=TwoWay}" />
|
||||
</ui:CardControl>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:CardAction Grid.Column="0" Margin="0,8,4,0" Padding="16,13,16,12" Icon="Folder24" Command="{Binding OpenReShadeFolderCommand}" IsEnabled="{Binding CanOpenReShadeFolder}">
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="14" Text="Open ReShade Folder">
|
||||
<!--this is so fucking stupid the disabled state of the cardaction doesnt change the header text colour-->
|
||||
<TextBlock.Style>
|
||||
<Style>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding CanOpenReShadeFolder}" Value="False">
|
||||
<Setter Property="TextBlock.Foreground" Value="{DynamicResource TextFillColorDisabledBrush}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
<TextBlock Margin="0,2,0,0" FontSize="12" Foreground="{DynamicResource TextFillColorTertiaryBrush}">
|
||||
<TextBlock.Style>
|
||||
<Style>
|
||||
<Setter Property="TextBlock.Text" Value="Where ReShade's resources are stored." />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding CanOpenReShadeFolder}" Value="False">
|
||||
<Setter Property="TextBlock.Text" Value="Please launch Roblox with ReShade first." />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</ui:CardAction>
|
||||
<ui:CardAction Grid.Column="1" Margin="4,8,0,0" Padding="16,13,16,12" Icon="BookQuestionMark24" Command="models:GlobalViewModel.OpenWebpageCommand" CommandParameter="https://github.com/pizzaboxer/bloxstrap/wiki/Using-ReShade">
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="14" Text="Help" />
|
||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="See info about using ReShade." Padding="0,0,16,0" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
</StackPanel>
|
||||
</ui:CardAction>
|
||||
</Grid>
|
||||
|
||||
<TextBlock Text="Miscellaneous" FontSize="16" FontWeight="Medium" Margin="0,16,0,0" />
|
||||
<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12">
|
||||
<ui:CardControl.Header>
|
||||
|
@ -117,7 +117,7 @@
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="14" Text="Rendering mode" />
|
||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Select which renderer Roblox should use. ReShade requires Direct3D 11." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Select which renderer Roblox should use." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
</StackPanel>
|
||||
</ui:CardControl.Header>
|
||||
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding RenderingModes.Keys, Mode=OneTime}" Text="{Binding SelectedRenderingMode, Mode=TwoWay}" />
|
||||
|
Loading…
Reference in New Issue
Block a user