mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Followup on ReShade support
Added ReShade/preset updating, UI fonts and Extravi's ReShade config
This commit is contained in:
parent
7f978c22a4
commit
fea122f928
@ -136,13 +136,10 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
Program.SettingsManager.Save();
|
Program.SettingsManager.Save();
|
||||||
|
|
||||||
|
|
||||||
if (Program.IsFirstRun && Program.IsNoLaunch)
|
if (Program.IsFirstRun && Program.IsNoLaunch)
|
||||||
Dialog.ShowSuccess($"{Program.ProjectName} has successfully installed");
|
Dialog.ShowSuccess($"{Program.ProjectName} has successfully installed");
|
||||||
else if (!Program.IsNoLaunch)
|
else if (!Program.IsNoLaunch)
|
||||||
await StartRoblox();
|
await StartRoblox();
|
||||||
|
|
||||||
Program.Exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task CheckForUpdates()
|
private async Task CheckForUpdates()
|
||||||
@ -184,9 +181,11 @@ namespace Bloxstrap
|
|||||||
foreach (string arg in Program.LaunchArgs)
|
foreach (string arg in Program.LaunchArgs)
|
||||||
startInfo.ArgumentList.Add(arg);
|
startInfo.ArgumentList.Add(arg);
|
||||||
|
|
||||||
|
Program.SettingsManager.Save();
|
||||||
|
|
||||||
Process.Start(startInfo);
|
Process.Start(startInfo);
|
||||||
|
|
||||||
Program.Exit();
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task CheckLatestVersion()
|
private async Task CheckLatestVersion()
|
||||||
|
@ -112,6 +112,8 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
|||||||
ShowError(message);
|
ShowError(message);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Program.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void ShowSuccess(string message)
|
public virtual void ShowSuccess(string message)
|
||||||
|
@ -58,10 +58,12 @@
|
|||||||
<Grid Margin="5,5,5,5">
|
<Grid Margin="5,5,5,5">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="90" />
|
<ColumnDefinition Width="80" />
|
||||||
|
<ColumnDefinition Width="80" />
|
||||||
</Grid.ColumnDefinitions>
|
</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="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="ButtonOpenReShadeCredits" Content="Credits" Height="23" Margin="5,0,0,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" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
|
@ -57,6 +57,11 @@ namespace Bloxstrap.Dialogs
|
|||||||
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/Themes/{theme}Theme.xaml", UriKind.Relative) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ButtonOpenReShadeHelp_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void ButtonOpenModFolder_Click(object sender, EventArgs e)
|
private void ButtonOpenModFolder_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Process.Start("explorer.exe", Directories.Modifications);
|
Process.Start("explorer.exe", Directories.Modifications);
|
||||||
|
@ -91,20 +91,17 @@ namespace Bloxstrap.Helpers.Integrations
|
|||||||
|
|
||||||
Debug.WriteLine("Installing/Updating rbxfpsunlocker...");
|
Debug.WriteLine("Installing/Updating rbxfpsunlocker...");
|
||||||
|
|
||||||
byte[] bytes = await Program.HttpClient.GetByteArrayAsync(downloadUrl);
|
|
||||||
|
|
||||||
using (MemoryStream zipStream = new(bytes))
|
|
||||||
{
|
{
|
||||||
using (ZipArchive zip = new(zipStream))
|
byte[] bytes = await Program.HttpClient.GetByteArrayAsync(downloadUrl);
|
||||||
{
|
|
||||||
zip.ExtractToDirectory(folderLocation, true);
|
using MemoryStream zipStream = new(bytes);
|
||||||
}
|
using ZipArchive archive = new(zipStream);
|
||||||
|
|
||||||
|
archive.ExtractToDirectory(folderLocation, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!File.Exists(settingsLocation))
|
if (!File.Exists(settingsLocation))
|
||||||
{
|
|
||||||
await File.WriteAllTextAsync(settingsLocation, Settings);
|
await File.WriteAllTextAsync(settingsLocation, Settings);
|
||||||
}
|
|
||||||
|
|
||||||
Program.Settings.RFUVersion = releaseInfo.TagName;
|
Program.Settings.RFUVersion = releaseInfo.TagName;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ using Bloxstrap.Models;
|
|||||||
using IniParser;
|
using IniParser;
|
||||||
using IniParser.Model;
|
using IniParser.Model;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace Bloxstrap.Helpers.Integrations
|
namespace Bloxstrap.Helpers.Integrations
|
||||||
{
|
{
|
||||||
@ -28,6 +27,7 @@ namespace Bloxstrap.Helpers.Integrations
|
|||||||
// 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
|
// 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
|
||||||
|
|
||||||
// based on the shaders we have installed, we're gonna have to parse and adjust this... yay.............
|
// based on the shaders we have installed, we're gonna have to parse and adjust this... yay.............
|
||||||
|
#region Config
|
||||||
private static readonly string StockConfig =
|
private static readonly string StockConfig =
|
||||||
"[APP]\r\n" +
|
"[APP]\r\n" +
|
||||||
"ForceFullscreen=0\r\n" +
|
"ForceFullscreen=0\r\n" +
|
||||||
@ -36,13 +36,96 @@ namespace Bloxstrap.Helpers.Integrations
|
|||||||
"\r\n" +
|
"\r\n" +
|
||||||
"[GENERAL]\r\n" +
|
"[GENERAL]\r\n" +
|
||||||
"EffectSearchPaths=..\\..\\ReShade\\Shaders\r\n" +
|
"EffectSearchPaths=..\\..\\ReShade\\Shaders\r\n" +
|
||||||
|
"PerformanceMode=1\r\n" +
|
||||||
"PreprocessorDefinitions=RESHADE_DEPTH_LINEARIZATION_FAR_PLANE=1000.0,RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN=0,RESHADE_DEPTH_INPUT_IS_REVERSED=1,RESHADE_DEPTH_INPUT_IS_LOGARITHMIC=0\r\n" +
|
"PreprocessorDefinitions=RESHADE_DEPTH_LINEARIZATION_FAR_PLANE=1000.0,RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN=0,RESHADE_DEPTH_INPUT_IS_REVERSED=1,RESHADE_DEPTH_INPUT_IS_LOGARITHMIC=0\r\n" +
|
||||||
"PresetPath=..\\..\\ReShade\\Presets\\ReShadePreset.ini\r\n" +
|
"PresetPath=..\\..\\ReShade\\Presets\\ReShadePreset.ini\r\n" +
|
||||||
"TextureSearchPaths=..\\..\\ReShade\\Textures\r\n" +
|
"TextureSearchPaths=..\\..\\ReShade\\Textures\r\n" +
|
||||||
"\r\n" +
|
"\r\n" +
|
||||||
"[INPUT]\r\n" +
|
"[INPUT]\r\n" +
|
||||||
|
"ForceShortcutModifiers=1\r\n" +
|
||||||
|
"InputProcessing=2\r\n" +
|
||||||
"GamepadNavigation=1\r\n" +
|
"GamepadNavigation=1\r\n" +
|
||||||
"KeyOverlay=36,0,0,0\r\n";
|
"KeyEffects=117,0,1,0\r\n" +
|
||||||
|
"KeyNextPreset=0,0,0,0\r\n" +
|
||||||
|
"KeyOverlay=9,0,1,0\r\n" +
|
||||||
|
"KeyPerformanceMode=0,0,0,0\r\n" +
|
||||||
|
"KeyPreviousPreset=0,0,0,0\r\n" +
|
||||||
|
"KeyReload=0,0,0,0\r\n" +
|
||||||
|
"KeyScreenshot=44,0,0,0\r\n" +
|
||||||
|
"\r\n" +
|
||||||
|
"[STYLE]\r\n" +
|
||||||
|
"Alpha=1.000000\r\n" +
|
||||||
|
"Border=0.862745,0.862745,0.862745,0.300000\r\n" +
|
||||||
|
"BorderShadow=0.000000,0.000000,0.000000,0.000000\r\n" +
|
||||||
|
"Button=0.156863,0.313726,0.941177,0.440000\r\n" +
|
||||||
|
"ButtonActive=0.156863,0.313726,0.941177,1.000000\r\n" +
|
||||||
|
"ButtonHovered=0.156863,0.313726,0.941177,0.860000\r\n" +
|
||||||
|
"CheckMark=0.156863,0.313726,0.941177,0.800000\r\n" +
|
||||||
|
"ChildBg=0.109804,0.109804,0.109804,0.000000\r\n" +
|
||||||
|
"ChildRounding=6.000000\r\n" +
|
||||||
|
"ColFPSText=1.000000,1.000000,0.784314,1.000000\r\n" +
|
||||||
|
"DockingEmptyBg=0.200000,0.200000,0.200000,1.000000\r\n" +
|
||||||
|
"DockingPreview=0.156863,0.313726,0.941177,0.532000\r\n" +
|
||||||
|
"DragDropTarget=1.000000,1.000000,0.000000,0.900000\r\n" +
|
||||||
|
"EditorFont=..\\..\\ReShade\\Fonts\\Hack-Regular.ttf\r\n" +
|
||||||
|
"EditorFontSize=18\r\n" +
|
||||||
|
"EditorStyleIndex=0\r\n" +
|
||||||
|
"Font=..\\..\\ReShade\\Fonts\\NunitoSans-Regular.ttf\r\n" +
|
||||||
|
"FontSize=18\r\n" +
|
||||||
|
"FPSScale=1.000000\r\n" +
|
||||||
|
"FrameBg=0.109804,0.109804,0.109804,1.000000\r\n" +
|
||||||
|
"FrameBgActive=0.156863,0.313726,0.941177,1.000000\r\n" +
|
||||||
|
"FrameBgHovered=0.156863,0.313726,0.941177,0.680000\r\n" +
|
||||||
|
"FrameRounding=6.000000\r\n" +
|
||||||
|
"GrabRounding=6.000000\r\n" +
|
||||||
|
"Header=0.156863,0.313726,0.941177,0.760000\r\n" +
|
||||||
|
"HeaderActive=0.156863,0.313726,0.941177,1.000000\r\n" +
|
||||||
|
"HeaderHovered=0.156863,0.313726,0.941177,0.860000\r\n" +
|
||||||
|
"MenuBarBg=0.109804,0.109804,0.109804,0.570000\r\n" +
|
||||||
|
"ModalWindowDimBg=0.800000,0.800000,0.800000,0.350000\r\n" +
|
||||||
|
"NavHighlight=0.260000,0.590000,0.980000,1.000000\r\n" +
|
||||||
|
"NavWindowingDimBg=0.800000,0.800000,0.800000,0.200000\r\n" +
|
||||||
|
"NavWindowingHighlight=1.000000,1.000000,1.000000,0.700000\r\n" +
|
||||||
|
"PlotHistogram=0.862745,0.862745,0.862745,0.630000\r\n" +
|
||||||
|
"PlotHistogramHovered=0.156863,0.313726,0.941177,1.000000\r\n" +
|
||||||
|
"PlotLines=0.862745,0.862745,0.862745,0.630000\r\n" +
|
||||||
|
"PlotLinesHovered=0.156863,0.313726,0.941177,1.000000\r\n" +
|
||||||
|
"PopupBg=0.047059,0.047059,0.047059,0.920000\r\n" +
|
||||||
|
"PopupRounding=6.000000\r\n" +
|
||||||
|
"ResizeGrip=0.156863,0.313726,0.941177,0.200000\r\n" +
|
||||||
|
"ResizeGripActive=0.156863,0.313726,0.941177,1.000000\r\n" +
|
||||||
|
"ResizeGripHovered=0.156863,0.313726,0.941177,0.780000\r\n" +
|
||||||
|
"ScrollbarBg=0.109804,0.109804,0.109804,1.000000\r\n" +
|
||||||
|
"ScrollbarGrab=0.156863,0.313726,0.941177,0.310000\r\n" +
|
||||||
|
"ScrollbarGrabActive=0.156863,0.313726,0.941177,1.000000\r\n" +
|
||||||
|
"ScrollbarGrabHovered=0.156863,0.313726,0.941177,0.780000\r\n" +
|
||||||
|
"ScrollbarRounding=6.000000\r\n" +
|
||||||
|
"Separator=0.862745,0.862745,0.862745,0.320000\r\n" +
|
||||||
|
"SeparatorActive=0.862745,0.862745,0.862745,1.000000\r\n" +
|
||||||
|
"SeparatorHovered=0.862745,0.862745,0.862745,0.780000\r\n" +
|
||||||
|
"SliderGrab=0.156863,0.313726,0.941177,0.240000\r\n" +
|
||||||
|
"SliderGrabActive=0.156863,0.313726,0.941177,1.000000\r\n" +
|
||||||
|
"StyleIndex=3\r\n" +
|
||||||
|
"Tab=0.156863,0.313726,0.941177,0.440000\r\n" +
|
||||||
|
"TabActive=0.156863,0.313726,0.941177,1.000000\r\n" +
|
||||||
|
"TabHovered=0.156863,0.313726,0.941177,0.860000\r\n" +
|
||||||
|
"TableBorderLight=0.230000,0.230000,0.250000,1.000000\r\n" +
|
||||||
|
"TableBorderStrong=0.310000,0.310000,0.350000,1.000000\r\n" +
|
||||||
|
"TableHeaderBg=0.190000,0.190000,0.200000,1.000000\r\n" +
|
||||||
|
"TableRowBg=0.000000,0.000000,0.000000,0.000000\r\n" +
|
||||||
|
"TableRowBgAlt=1.000000,1.000000,1.000000,0.060000\r\n" +
|
||||||
|
"TabRounding=6.000000\r\n" +
|
||||||
|
"TabUnfocused=0.156863,0.313726,0.941177,0.448000\r\n" +
|
||||||
|
"TabUnfocusedActive=0.156863,0.313726,0.941177,0.780000\r\n" +
|
||||||
|
"Text=0.862745,0.862745,0.862745,1.000000\r\n" +
|
||||||
|
"TextDisabled=0.862745,0.862745,0.862745,0.580000\r\n" +
|
||||||
|
"TextSelectedBg=0.156863,0.313726,0.941177,0.430000\r\n" +
|
||||||
|
"TitleBg=0.156863,0.313726,0.941177,0.450000\r\n" +
|
||||||
|
"TitleBgActive=0.156863,0.313726,0.941177,0.580000\r\n" +
|
||||||
|
"TitleBgCollapsed=0.156863,0.313726,0.941177,0.350000\r\n" +
|
||||||
|
"WindowBg=0.047059,0.047059,0.047059,1.000000\r\n" +
|
||||||
|
"WindowRounding=6.000000";
|
||||||
|
#endregion
|
||||||
|
|
||||||
// this is a list of selectable shaders to download:
|
// this is a list of selectable shaders to download:
|
||||||
// this should be formatted as { FolderName, GithubRepositoryUrl }
|
// this should be formatted as { FolderName, GithubRepositoryUrl }
|
||||||
@ -140,43 +223,46 @@ namespace Bloxstrap.Helpers.Integrations
|
|||||||
|
|
||||||
Debug.WriteLine($"[ReShade] Downloading shaders for {name}");
|
Debug.WriteLine($"[ReShade] Downloading shaders for {name}");
|
||||||
|
|
||||||
byte[] bytes = await Program.HttpClient.GetByteArrayAsync(downloadUrl);
|
|
||||||
|
|
||||||
using (MemoryStream zipStream = new(bytes))
|
|
||||||
{
|
{
|
||||||
using (ZipArchive archive = new(zipStream))
|
byte[] bytes = await Program.HttpClient.GetByteArrayAsync(downloadUrl);
|
||||||
|
|
||||||
|
using MemoryStream zipStream = new(bytes);
|
||||||
|
using ZipArchive archive = new(zipStream);
|
||||||
|
|
||||||
|
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||||
{
|
{
|
||||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
if (entry.FullName.EndsWith('/'))
|
||||||
{
|
continue;
|
||||||
if (entry.FullName.EndsWith('/'))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// github branch zips have a root folder of the name of the branch, so let's just remove that
|
// 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('/') + 1);
|
string fullPath = entry.FullName.Substring(entry.FullName.IndexOf('/') + 1);
|
||||||
|
|
||||||
// skip file if it's not in the Shaders or Textures folder
|
// skip file if it's not in the Shaders or Textures folder
|
||||||
if (!fullPath.StartsWith("Shaders") && !fullPath.StartsWith("Textures"))
|
if (!fullPath.StartsWith("Shaders") && !fullPath.StartsWith("Textures"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// and now we do it again because of how we're handling folder management
|
// ingore shaders with compiler errors
|
||||||
// e.g. reshade-shaders-master/Shaders/Vignette.fx should go to ReShade/Shaders/Stock/Vignette.fx
|
if (fullPath.EndsWith("dh_Lain.fx") || fullPath.EndsWith("dh_rtgi.fx"))
|
||||||
// so in this case, relativePath should just be "Vignette.fx"
|
continue;
|
||||||
string relativePath = fullPath.Substring(fullPath.IndexOf('/') + 1);
|
|
||||||
|
|
||||||
// now we stitch it all together
|
// and now we do it again because of how we're handling folder management
|
||||||
string extractionPath = Path.Combine(
|
// e.g. reshade-shaders-master/Shaders/Vignette.fx should go to ReShade/Shaders/Stock/Vignette.fx
|
||||||
Directories.ReShade,
|
// so in this case, relativePath should just be "Vignette.fx"
|
||||||
fullPath.StartsWith("Shaders") ? "Shaders" : "Textures",
|
string relativePath = fullPath.Substring(fullPath.IndexOf('/') + 1);
|
||||||
name,
|
|
||||||
relativePath
|
|
||||||
);
|
|
||||||
|
|
||||||
// make sure the folder that we're extracting it to exists
|
// now we stitch it all together
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(extractionPath)!);
|
string extractionPath = Path.Combine(
|
||||||
|
Directories.ReShade,
|
||||||
|
fullPath.StartsWith("Shaders") ? "Shaders" : "Textures",
|
||||||
|
name,
|
||||||
|
relativePath
|
||||||
|
);
|
||||||
|
|
||||||
// and now extract
|
// make sure the folder that we're extracting it to exists
|
||||||
await Task.Run(() => entry.ExtractToFile(extractionPath));
|
Directory.CreateDirectory(Path.GetDirectoryName(extractionPath)!);
|
||||||
}
|
|
||||||
|
// and now extract
|
||||||
|
await Task.Run(() => entry.ExtractToFile(extractionPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,33 +327,20 @@ namespace Bloxstrap.Helpers.Integrations
|
|||||||
foreach (string name in ExtraviPresetsShaders)
|
foreach (string name in ExtraviPresetsShaders)
|
||||||
await DownloadShaders(name);
|
await DownloadShaders(name);
|
||||||
|
|
||||||
int count = new DirectoryInfo(Path.Combine(Directories.ReShade, "Presets")).GetFiles().Where(x => x.Name.StartsWith("Extravi")).Count();
|
|
||||||
|
|
||||||
// there should be at least 7 presets beginning with "Extravi", if there aren't then presume they're not installed
|
|
||||||
if (count >= 7)
|
|
||||||
{
|
|
||||||
Debug.WriteLine("[ReShade] Extravi's presets are already installed, aborting");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we're also gonna need some sort of versioning for this somehow so that extravi can update the presets ota
|
|
||||||
byte[] bytes = await Program.HttpClient.GetByteArrayAsync("https://github.com/Extravi/extravi.github.io/raw/main/update/reshade-presets.zip");
|
byte[] bytes = await Program.HttpClient.GetByteArrayAsync("https://github.com/Extravi/extravi.github.io/raw/main/update/reshade-presets.zip");
|
||||||
|
|
||||||
using (MemoryStream zipStream = new(bytes))
|
using MemoryStream zipStream = new(bytes);
|
||||||
|
using ZipArchive archive = new(zipStream);
|
||||||
|
|
||||||
|
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||||
{
|
{
|
||||||
using (ZipArchive archive = new(zipStream))
|
if (entry.FullName.EndsWith('/'))
|
||||||
{
|
continue;
|
||||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
|
||||||
{
|
|
||||||
if (entry.FullName.EndsWith('/'))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// github branch zips have a root folder of the name of the branch, so let's just remove that
|
// remove containing folder
|
||||||
string filename = entry.FullName.Substring(entry.FullName.IndexOf('/') + 1);
|
string filename = entry.FullName.Substring(entry.FullName.IndexOf('/') + 1);
|
||||||
|
|
||||||
await Task.Run(() => entry.ExtractToFile(Path.Combine(Directories.ReShade, "Presets", filename), true));
|
await Task.Run(() => entry.ExtractToFile(Path.Combine(Directories.ReShade, "Presets", filename), true));
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,12 +369,16 @@ namespace Bloxstrap.Helpers.Integrations
|
|||||||
|
|
||||||
// initialize directories
|
// initialize directories
|
||||||
Directory.CreateDirectory(Directories.ReShade);
|
Directory.CreateDirectory(Directories.ReShade);
|
||||||
|
Directory.CreateDirectory(Path.Combine(Directories.ReShade, "Fonts"));
|
||||||
Directory.CreateDirectory(Path.Combine(Directories.ReShade, "Shaders"));
|
Directory.CreateDirectory(Path.Combine(Directories.ReShade, "Shaders"));
|
||||||
Directory.CreateDirectory(Path.Combine(Directories.ReShade, "Textures"));
|
Directory.CreateDirectory(Path.Combine(Directories.ReShade, "Textures"));
|
||||||
Directory.CreateDirectory(Path.Combine(Directories.ReShade, "Presets"));
|
Directory.CreateDirectory(Path.Combine(Directories.ReShade, "Presets"));
|
||||||
|
|
||||||
if (!Program.Settings.UseReShadeExtraviPresets)
|
if (!Program.Settings.UseReShadeExtraviPresets)
|
||||||
|
{
|
||||||
UninstallExtraviPresets();
|
UninstallExtraviPresets();
|
||||||
|
Program.Settings.ExtraviPresetsVersion = "";
|
||||||
|
}
|
||||||
|
|
||||||
if (!Program.Settings.UseReShade)
|
if (!Program.Settings.UseReShade)
|
||||||
{
|
{
|
||||||
@ -320,23 +397,44 @@ namespace Bloxstrap.Helpers.Integrations
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// first, let's check to make sure the injector dll is downloaded
|
// 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;
|
||||||
|
|
||||||
if (!File.Exists(injectorLocation))
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldFetchReShade)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("[ReShade] Installing ReShade...");
|
Debug.WriteLine("[ReShade] Installing ReShade...");
|
||||||
|
|
||||||
// here we're downloading the dll through extravi's repository as reshade doesn't officially distribute binaries
|
|
||||||
// uhhh... i'm not sure how we're gonna handle checking for updates? there's not exactly a version number to check here...
|
|
||||||
// only way i can think of is to check the latest commit to the file but thats messy and requires the github api fsdkjhgusedjfzlikohskeolgdfazszwhs\aripy\aws;j/riows\ajuygh
|
|
||||||
// i think i might have to (or get extravi to) host the binary version somewhere
|
|
||||||
byte[] bytes = await Program.HttpClient.GetByteArrayAsync("https://github.com/Extravi/extravi.github.io/raw/main/update/dxgi.zip");
|
|
||||||
|
|
||||||
using (MemoryStream zipStream = new(bytes))
|
|
||||||
{
|
{
|
||||||
using (ZipArchive zip = new(zipStream))
|
byte[] bytes = await Program.HttpClient.GetByteArrayAsync("https://github.com/Extravi/extravi.github.io/raw/main/update/dxgi.zip");
|
||||||
{
|
using MemoryStream zipStream = new(bytes);
|
||||||
zip.ExtractToDirectory(Directories.Modifications, true);
|
using ZipArchive archive = new(zipStream);
|
||||||
}
|
archive.ExtractToDirectory(Directories.Modifications, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// we also gotta download the editor fonts
|
||||||
|
if (Utilities.IsDirectoryEmpty(Path.Combine(Directories.ReShade, "Fonts")))
|
||||||
|
{
|
||||||
|
byte[] bytes = await Program.HttpClient.GetByteArrayAsync("https://github.com/Extravi/extravi.github.io/raw/main/update/config.zip");
|
||||||
|
|
||||||
|
using MemoryStream zipStream = new(bytes);
|
||||||
|
using ZipArchive archive = new(zipStream);
|
||||||
|
|
||||||
|
foreach (ZipArchiveEntry entry in archive.Entries.Where(x => x.FullName.EndsWith(".ttf")))
|
||||||
|
entry.ExtractToFile(Path.Combine(Directories.ReShade, "Fonts", entry.FullName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,8 +444,11 @@ namespace Bloxstrap.Helpers.Integrations
|
|||||||
|
|
||||||
await DownloadShaders("Stock");
|
await DownloadShaders("Stock");
|
||||||
|
|
||||||
if (Program.Settings.UseReShadeExtraviPresets)
|
if (Program.Settings.UseReShadeExtraviPresets && Program.Settings.ExtraviPresetsVersion != versionManifest!.Presets)
|
||||||
|
{
|
||||||
await InstallExtraviPresets();
|
await InstallExtraviPresets();
|
||||||
|
Program.Settings.ExtraviPresetsVersion = versionManifest.Presets;
|
||||||
|
}
|
||||||
|
|
||||||
SynchronizeConfigFile();
|
SynchronizeConfigFile();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
@ -7,6 +8,11 @@ namespace Bloxstrap.Helpers
|
|||||||
{
|
{
|
||||||
public class Utilities
|
public class Utilities
|
||||||
{
|
{
|
||||||
|
public static bool IsDirectoryEmpty(string path)
|
||||||
|
{
|
||||||
|
return !Directory.EnumerateFileSystemEntries(path).Any();
|
||||||
|
}
|
||||||
|
|
||||||
public static long GetFreeDiskSpace(string path)
|
public static long GetFreeDiskSpace(string path)
|
||||||
{
|
{
|
||||||
foreach (DriveInfo drive in DriveInfo.GetDrives())
|
foreach (DriveInfo drive in DriveInfo.GetDrives())
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace Bloxstrap.Models
|
|
||||||
{
|
|
||||||
public class GithubCommits
|
|
||||||
{
|
|
||||||
[JsonPropertyName("assets")]
|
|
||||||
public List<GithubCommit>? Commits { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class GithubCommit
|
|
||||||
{
|
|
||||||
[JsonPropertyName("commit")]
|
|
||||||
public GithubCommitData Commit { get; set; } = null!;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class GithubCommitData
|
|
||||||
{
|
|
||||||
[JsonPropertyName("author")]
|
|
||||||
public GithubCommitAuthor Author { get; set; } = null!;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class GithubCommitAuthor
|
|
||||||
{
|
|
||||||
[JsonPropertyName("date")]
|
|
||||||
public string Date { get; set; } = null!;
|
|
||||||
}
|
|
||||||
}
|
|
8
Bloxstrap/Models/ReShadeVersionManifest.cs
Normal file
8
Bloxstrap/Models/ReShadeVersionManifest.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace Bloxstrap.Models
|
||||||
|
{
|
||||||
|
public class ReShadeVersionManifest
|
||||||
|
{
|
||||||
|
public string ReShade { get; set; } = null!;
|
||||||
|
public string Presets { get; set; } = null!;
|
||||||
|
}
|
||||||
|
}
|
@ -21,6 +21,7 @@ namespace Bloxstrap.Models
|
|||||||
public bool RFUAutoclose { get; set; } = false;
|
public bool RFUAutoclose { get; set; } = false;
|
||||||
|
|
||||||
public string RFUVersion { get; set; } = "";
|
public string RFUVersion { get; set; } = "";
|
||||||
|
public string ExtraviPresetsVersion { get; set; } = "";
|
||||||
|
|
||||||
public bool UseReShade { get; set; } = false;
|
public bool UseReShade { get; set; } = false;
|
||||||
public bool UseReShadeExtraviPresets { get; set; } = false;
|
public bool UseReShadeExtraviPresets { get; set; } = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user