@ -1,6 +1,7 @@
using System ;
using System.Diagnostics ;
using System.IO ;
using System.IO.Compression ;
using System.Net ;
using System.Reflection ;
using HarmonyLib ;
@ -36,12 +37,17 @@ namespace DeezShade {
}
}
var installerUrl = "https://gshade.org/releases/GShade.Latest.Installer.exe" ;
var installerUrl =
"https://github.com/Mortalitas/GShade/releases/latest/download/GShade.Latest.Installer.exe" ;
var zipUrl = "https://github.com/Mortalitas/GShade/releases/latest/download/GShade.Latest.zip" ;
var exePath = tempPath + "GShade.Latest.Installer.exe" ;
var zipPath = tempPath + "GShade.Latest.zip" ;
Console . WriteLine ( "Downloading GShade installer..." ) ;
using ( var client = new WebClient ( ) ) {
client . DownloadFile ( installerUrl , exePath ) ;
client . DownloadFile ( zipUrl , zipPath ) ;
}
// I'm using the official GShade installer, am I not? :^
@ -54,10 +60,10 @@ namespace DeezShade {
// Patch GShade from shutting off your computer (LMAO)
Console . WriteLine ( "Patching GShade malware..." ) ;
type . GetField ( "_instReady" ) . SetValue ( null , true ) ; // wp
var harmony = new Harmony ( "com.notnite.thanks-marot" ) ;
var getProcessesByName = typeof ( Process ) . GetMethod ( "GetProcessesByName" , new [ ] { typeof ( string ) } ) ;
harmony . Patch ( getProcessesByName , new HarmonyMethod ( typeof ( Program ) . GetMethod ( nameof ( ProcessDetour ) ) ) ) ;
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 ) ;
@ -66,7 +72,7 @@ namespace DeezShade {
// File.Copy gives an access denied error, so let's make it ourself
var src = tempPath + "gshade-shaders" ;
var dst = Path . Combine ( gameInstall , " re shade-shaders") ;
var dst = Path . Combine ( gameInstall , " g shade-shaders") ;
void RecursiveClone ( string path ) {
var path2 = Path . Combine ( src , path ) ;
@ -89,13 +95,15 @@ namespace DeezShade {
Console . WriteLine ( "Moving shaders to game directory..." ) ;
RecursiveClone ( "" ) ;
Directory . CreateDirectory ( Path . Combine ( gameInstall , " re shade-addons") ) ;
Directory . CreateDirectory ( Path . Combine ( gameInstall , " g shade-addons") ) ;
Directory . Move ( Path . Combine ( gameInstall , "gshade-presets" ) , Path . Combine ( gameInstall , "reshade-presets" ) ) ;
Console . Write ( "Use ReShade (y/n)? " ) ;
var useReShade = Console . ReadLine ( ) . ToLower ( ) = = "y" ;
if ( useReShade ) {
Console . WriteLine ( "Downloading ReShade..." ) ;
var reshadeUrl = "http:// reshade.me/downloads/ReShade_Setup_5.7 .0_Addon.exe";
var reshadePath = tempPath + "ReShade_Setup_5. 7 .0_Addon.exe";
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 ) ;
}
@ -117,24 +125,31 @@ namespace DeezShade {
Console . WriteLine ( "Writing ReShade config..." ) ;
var configText = @ "[GENERAL]
[GENERAL]
EffectSearchPaths = . \ re shade- shaders \ Shaders \ * *
TextureSearchPaths = . \ re shade- shaders \ Textures \ * *
EffectSearchPaths = . \ g shade- shaders \ Shaders \ * *
TextureSearchPaths = . \ g shade- shaders \ Textures \ * *
".Trim();
File . WriteAllText ( configPath , configText ) ;
}
} else {
Console . WriteLine ( "Extracting DLL and config..." ) ;
var zip = ZipFile . OpenRead ( zipPath ) ;
if ( File . Exists ( Path . Combine ( gameInstall , "dxgi.dll" ) ) ) {
File . Move ( Path . Combine ( gameInstall , "dxgi.dll" ) , Path . Combine ( gameInstall , "dxgi.dll.old" ) ) ;
}
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 ( ) ;
}
public static bool ProcessDetour ( ref Process [ ] __result , string processName ) {
if ( processName = = "GShade.Installer" ) {
__result = Array . Empty < Process > ( ) ;
public static bool LolDetour ( ) {
// thank you for writing malware marot
return false ;
}
return true ;
}
}
}