This commit is contained in:
Julian 2023-02-06 18:35:55 -05:00
parent c1dca873c1
commit e9a5e56a9c
Signed by: NotNite
GPG Key ID: BD91A5402CCEB08A
2 changed files with 49 additions and 9 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net4.7.2</TargetFramework>
<Version>1.0.5</Version>
<Version>1.1.0</Version>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationFramework" />
@ -10,5 +10,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Lib.Harmony" Version="2.2.2" />
<PackageReference Include="SharpCompress" Version="0.32.2" />
</ItemGroup>
</Project>

View File

@ -1,9 +1,12 @@
using System;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Reflection;
using HarmonyLib;
using SharpCompress.Readers;
using SharpCompress.Readers.Zip;
namespace DeezShade {
public class Program {
@ -50,7 +53,6 @@ namespace DeezShade {
}
// I'm using the official GShade installer, am I not? :^
Console.WriteLine("Requesting new files through GShade installer...");
var assembly = Assembly.LoadFile(exePath);
var type = assembly.GetType("GShadeInstaller.App");
@ -65,6 +67,7 @@ namespace DeezShade {
var lolMethod = type.GetMethod("www", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch(lolMethod, new HarmonyMethod(typeof(Program).GetMethod(nameof(LolDetour))));
Console.WriteLine("Requesting new files through GShade installer...");
type.GetMethod("CopyZipDeployProcess").Invoke(null, null);
type.GetMethod("PresetDownloadProcess").Invoke(null, null);
type.GetMethod("PresetInstallProcess").Invoke(null, null);
@ -96,6 +99,41 @@ namespace DeezShade {
RecursiveClone("");
Directory.CreateDirectory(Path.Combine(gameInstall, "gshade-addons"));
Console.Write("Use ReShade (y/n)? ");
var useReShade = Console.ReadLine().ToLower() == "y";
if (useReShade) {
Console.WriteLine("Downloading ReShade...");
var reshadeUrl = "http://static.reshade.me/downloads/ReShade_Setup_5.6.0_Addon.exe";
var reshadePath = tempPath + "ReShade_Setup_5.6.0_Addon.exe";
using (var client = new WebClient()) {
client.DownloadFile(reshadeUrl, reshadePath);
}
Console.WriteLine("Installing ReShade...");
if (File.Exists(Path.Combine(gameInstall, "dxgi.dll"))) {
File.Move(Path.Combine(gameInstall, "dxgi.dll"), Path.Combine(gameInstall, "dxgi.dll.old"));
}
var reshadeProcess = new Process();
reshadeProcess.StartInfo.FileName = reshadePath;
reshadeProcess.StartInfo.Arguments =
$"\"{Path.Combine(gameInstall, "ffxiv_dx11.exe")}\" --api dxgi --headless";
reshadeProcess.Start();
var configPath = Path.Combine(gameInstall, "ReShade.ini");
if (!File.Exists(configPath)) {
Console.WriteLine("Writing ReShade config...");
var configText = @"[GENERAL]
[GENERAL]
EffectSearchPaths=.\gshade-shaders\Shaders\**
TextureSearchPaths=.\gshade-shaders\Textures\**
".Trim();
File.WriteAllText(configPath, configText);
}
} else {
Console.WriteLine("Extracting DLL and config...");
var zip = ZipFile.OpenRead(zipPath);
@ -105,6 +143,7 @@ namespace DeezShade {
zip.GetEntry("GShade64.dll").ExtractToFile(Path.Combine(gameInstall, "dxgi.dll"), true);
zip.GetEntry("GShade.ini").ExtractToFile(Path.Combine(gameInstall, "GShade.ini"), true);
}
Console.WriteLine("Done!\nSupport FOSS, and thank you for using DeezShade!\nPress any key to continue.");
Console.ReadKey();