コード例 #1
0
        public static void deployReshadeFilesInjector(string source, string dest, bool bit64) //
        {
            string inject  = @"\inject32.exe";
            string reshade = @"\ReShade32.dll";

            if (bit64)
            {
                inject  = @"\inject64.exe";
                reshade = @"\ReShade64.dll";
            }
            SymbolicLink.CreateSymbolicLink(dest + @"\inject.exe", source + inject, 0);
            SymbolicLink.CreateSymbolicLink(dest + reshade, source + reshade, 0);
        }
コード例 #2
0
        public static void writeReshadeini(string dest, string workingDLLPath, string gameName, string gameDir)
        {
            if (!File.Exists(@".\ReShade_Template.ini"))
            {
                MessageBox.Show(@"ReShade_Template.ini not found, installing with old method.  Rename ReShade_Template_Example.ini to ReShade_Template.ini to use the new method.");
                writeReshadeiniFallback(dest, workingDLLPath, gameName, gameDir);
                return;
            }

            List <string> reshadeconfig = new List <string>();

            using (StreamReader r = new StreamReader(@".\ReShade_Template.ini"))
            {
                while (!r.EndOfStream)
                {
                    string line = r.ReadLine();
                    if (line.StartsWith(@"EffectSearchPaths="))
                    {
                        line = @"EffectSearchPaths=" + Program.shaders + @"," + Program.shaders + @"\development";
                    }
                    else if (line.StartsWith(@"IntermediateCachePath="))
                    {
                        line = @"IntermediateCachePath=" + workingDLLPath + @"\Cache";
                    }
                    else if (line.StartsWith(@"PresetPath="))
                    {
                        line = @"PresetPath=" + Program.presets + @"\" + gameName + @"\ReshadePreset.ini";
                    }
                    else if (line.StartsWith(@"TextureSearchPaths="))
                    {
                        line = @"TextureSearchPaths=" + Program.textures + @"," + Program.textures + @"\development";
                    }
                    else if (line.StartsWith(@"SavePath="))
                    {
                        line = @"SavePath=" + Program.screenshots + @"\" + gameName;
                    }
                    reshadeconfig.Add(line);
                }
            }
            using (StreamWriter w = new StreamWriter(dest + @"\reshade.ini"))
            {
                foreach (string line in reshadeconfig)
                {
                    w.WriteLine(line);
                }
            }
            SymbolicLink.CreateSymbolicLink(gameDir + @"\reshade.ini", dest + @"\reshade.ini", 0);
        }
コード例 #3
0
        public static void writeReshadeiniFallback(string dest, string workingDLLPath, string gameName, string gameDir) //Used if reshade_template.ini is missing
        {
            string nl = "\n";                                                                                           //makes typing up that multiline write a bit easier

            File.WriteAllText(dest + @"\reshade.ini",
                              @"[GENERAL]" + nl +
                              @"EffectSearchPaths=" + Program.shaders + @"," + Program.shaders + @"\development" + nl +
                              @"IntermediateCachePath=" + workingDLLPath + @"\Cache" + nl +
                              @"PerformanceMode=0" + nl +
                              @"PreprocessorDefinitions=RESHADE_DEPTH_INPUT_IS_REVERSED=0,RESHADE_DEPTH_INPUT_IS_LOGARITHMIC=0,RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN=0,RESHADE_DEPTH_LINEARIZATION_FAR_PLANE=1000" + nl +
                              @"PresetPath=" + Program.presets + @"\" + gameName + @"\ReshadePreset.ini" + nl +
                              @"PresetTransitionDelay=1000" + nl +
                              @"SkipLoadingDisabledEffects=0" + nl +
                              @"TextureSearchPaths=" + Program.textures + @"," + Program.textures + @"\development" + nl + nl +
                              @"[INPUT]" + nl +
                              @"ForceShortcutModifiers=1" + nl +
                              @"InputProcessing=2" + nl +
                              @"KeyEffects=145,0,0,0" + nl +
                              @"KeyNextPreset=0,0,0,0" + nl +
                              @"KeyOverlay=36,0,0,0" + nl +
                              @"KeyPerformanceMode=0,0,0,0" + nl +
                              @"KeyPreviousPreset=0,0,0,0" + nl +
                              @"KeyReload=0,0,0,0" + nl +
                              @"KeyScreenshot=44,0,0,0" + nl + nl +
                              @"[OVERLAY]" + nl +
                              @"ClockFormat=0" + nl +
                              @"FPSPosition=1" + nl +
                              @"NoFontScaling=1" + nl +
                              @"SaveWindowState=0" + nl +
                              @"ShowClock=0" + nl +
                              @"ShowForceLoadEffectsButton=1" + nl +
                              @"ShowFPS=0" + nl +
                              @"ShowFrameTime=0" + nl +
                              @"ShowScreenshotMessage=1" + nl +
                              @"TutorialProgress=4" + nl +
                              @"VariableListHeight=300.000000" + nl +
                              @"VariableListUseTabs=0" + nl + nl +
                              @"[SCREENSHOT]" + nl +
                              @"ClearAlpha=1" + nl +
                              @"FileFormat=1" + nl +
                              @"FileNamingFormat=0" + nl +
                              @"JPEGQuality=90" + nl +
                              @"SaveBeforeShot=1" + nl +
                              @"SaveOverlayShot=0" + nl +
                              @"SavePath=" + Program.screenshots + @"\" + gameName + nl +
                              @"SavePresetFile=0" + nl + nl +
                              @"[STYLE]" + nl +
                              @"Alpha=1.000000" + nl +
                              @"ChildRounding=0.000000" + nl +
                              @"ColFPSText=1.000000,1.000000,0.784314,1.000000" + nl +
                              @"EditorFont=ProggyClean.ttf" + nl +
                              @"EditorFontSize=13" + nl +
                              @"EditorStyleIndex=0" + nl +
                              @"Font=ProggyClean.ttf" + nl +
                              @"FontSize=13" + nl +
                              @"FPSScale=1.000000" + nl +
                              @"FrameRounding=0.000000" + nl +
                              @"GrabRounding=0.000000" + nl +
                              @"PopupRounding=0.000000" + nl +
                              @"ScrollbarRounding=0.000000" + nl +
                              @"StyleIndex=2" + nl +
                              @"TabRounding=4.000000" + nl +
                              @"WindowRounding=0.000000"
                              );
            SymbolicLink.CreateSymbolicLink(gameDir + @"\reshade.ini", dest + @"\reshade.ini", 0);
        }
コード例 #4
0
        private void installwin32_Click(object sender, EventArgs e)
        {
            OpenFileDialog gameDialog = new OpenFileDialog();

            gameDialog.Title  = "Select the game's runtime executable.";
            gameDialog.Filter = "Select EXE|*.exe";
            //gameDialog.InitialDirectory = @"C:\";
            if (gameDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }


            string gamedll = System.String.Empty;

            switch ((Prompt.ShowRadioButtons(new string[] { @"DirectX 9", @"DirectX 10+", @"OpenGL", @"Vulkan" }, "Select the Rendering API.", 0, 0)).Text)
            {
            case "DirectX 9":
                gamedll = @"\d3d9.dll";
                break;

            case "DirectX 10+":
                gamedll = @"\dxgi.dll";
                break;

            case "OpenGL":
                gamedll = @"\opengl32.dll";
                break;

            case "Vulkan":
                MessageBox.Show("Feature coming soon.  For now, install ReShade for Vulkan globally through the normal ReShade installer.  This program will setup the rest.");
                //Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Khronos\Vulkan\ImplicitLayers");
                //key = key.CreateSubKey(@"SOFTWARE\Khronos\Vulkan\ImplicitLayers");
                //key.SetValue(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @"ReShade\ReShade64.json"), 0, Microsoft.Win32.RegistryValueKind.DWord);
                //key.SetValue(@"C:\ProgramData\ReShade\ReShade64.json", 0, Microsoft.Win32.RegistryValueKind.DWord);
                //key.Close();
                break;
            }

            string gameName = Functions.getGameName();

            string workingDLLPath = Program.dlls; //apply working path to variable, mostly for reshade.ini generation

            if (Prompt.ShowRadioButtons(new string[] { "Official", "Modified" }, @"Select Official or Modified ReShade.", 250, 140, @"Modified ReShade files are self provided.  Place ReShade64.dll and ReShade32.dll in the reshade-files-mod folder to use.").Text == "Official")
            {
                if (File.Exists(Path.GetDirectoryName(gameDialog.FileName) + gamedll)) //placed here and duplicated in Else{} just in case the user closes the application when prompted
                {
                    File.Delete(Path.GetDirectoryName(gameDialog.FileName) + gamedll);
                }
                if (Functions.GetMachineType(gameDialog.FileName) == Functions.MachineType.x64)
                {
                    SymbolicLink.CreateSymbolicLink(Path.GetDirectoryName(gameDialog.FileName) + gamedll, workingDLLPath + @"\ReShade64.dll", 0);
                }
                else
                {
                    SymbolicLink.CreateSymbolicLink(Path.GetDirectoryName(gameDialog.FileName) + gamedll, workingDLLPath + @"\ReShade32.dll", 0);
                }
            }
            else
            {
                if (File.Exists(Path.GetDirectoryName(gameDialog.FileName) + gamedll))
                {
                    File.Delete(Path.GetDirectoryName(gameDialog.FileName) + gamedll);
                }
                workingDLLPath = Program.mdlls;
                if (Functions.GetMachineType(gameDialog.FileName) == Functions.MachineType.x64)
                {
                    SymbolicLink.CreateSymbolicLink(Path.GetDirectoryName(gameDialog.FileName) + gamedll, workingDLLPath + @"\ReShade64.dll", 0);
                }
                else
                {
                    SymbolicLink.CreateSymbolicLink(Path.GetDirectoryName(gameDialog.FileName) + gamedll, workingDLLPath + @"\ReShade32.dll", 0);
                }
            }

            Directory.CreateDirectory(Program.screenshots + @"\" + gameName);
            Directory.CreateDirectory(Program.presets + @"\" + gameName);

            Functions.deployReshadeConfigs(gameName, workingDLLPath, Path.GetDirectoryName(gameDialog.FileName));
            MessageBox.Show("ReShade Successfully Installed!");
        }