diff --git a/Ryujinx.Graphics/AGraphicsConfig.cs b/Ryujinx.Graphics/AGraphicsConfig.cs deleted file mode 100644 index 61674ea81a..0000000000 --- a/Ryujinx.Graphics/AGraphicsConfig.cs +++ /dev/null @@ -1,4 +0,0 @@ -public static class AGraphicsConfig -{ - public static string ShadersDumpPath = ""; -} diff --git a/Ryujinx.Graphics/Gal/ShaderDumper.cs b/Ryujinx.Graphics/Gal/ShaderDumper.cs index 370956fa18..7cd56b21ef 100644 --- a/Ryujinx.Graphics/Gal/ShaderDumper.cs +++ b/Ryujinx.Graphics/Gal/ShaderDumper.cs @@ -5,22 +5,24 @@ namespace Ryujinx.Graphics.Gal { static class ShaderDumper { - private static string RuntimeDir = ""; + private static string RuntimeDir; private static int DumpIndex = 1; public static void Dump(IGalMemory Memory, long Position, GalShaderType Type, string ExtSuffix = "") { - if (AGraphicsConfig.ShadersDumpPath == "") + if (string.IsNullOrWhiteSpace(GraphicsConfig.ShadersDumpPath)) { return; } - string Path = DumpDir() + "/Shader" + DumpIndex.ToString("d4") + "." + ShaderExtension(Type) + ExtSuffix + ".bin"; + string FileName = "Shader" + DumpIndex.ToString("d4") + "." + ShaderExtension(Type) + ExtSuffix + ".bin"; + + string FilePath = Path.Combine(DumpDir(), FileName); DumpIndex++; - using (FileStream Output = File.Create(Path)) + using (FileStream Output = File.Create(FilePath)) using (BinaryWriter Writer = new BinaryWriter(Output)) { long Offset = 0; @@ -28,12 +30,12 @@ namespace Ryujinx.Graphics.Gal ulong Instruction = 0; //Dump until a NOP instruction is found - while (Instruction >> 52 != 0x50b) + while ((Instruction >> 52 & 0xfff8) != 0x50b0) { uint Word0 = (uint)Memory.ReadInt32(Position + Offset + 0); uint Word1 = (uint)Memory.ReadInt32(Position + Offset + 4); - Instruction = Word0 | (ulong) Word1 << 32; + Instruction = Word0 | (ulong)Word1 << 32; //Zero instructions (other kind of NOP) stop immediatly, //this is to avoid two rows of zeroes @@ -59,13 +61,13 @@ namespace Ryujinx.Graphics.Gal private static string DumpDir() { - if (RuntimeDir == "") + if (string.IsNullOrEmpty(RuntimeDir)) { int Index = 1; do { - RuntimeDir = AGraphicsConfig.ShadersDumpPath + "/Dumps" + Index.ToString("d2"); + RuntimeDir = Path.Combine(GraphicsConfig.ShadersDumpPath, "Dumps" + Index.ToString("d2")); Index++; } diff --git a/Ryujinx.Graphics/GraphicsConfig.cs b/Ryujinx.Graphics/GraphicsConfig.cs new file mode 100644 index 0000000000..3e3ef4ffa7 --- /dev/null +++ b/Ryujinx.Graphics/GraphicsConfig.cs @@ -0,0 +1,4 @@ +public static class GraphicsConfig +{ + public static string ShadersDumpPath; +} diff --git a/Ryujinx/Config.cs b/Ryujinx/Config.cs index 70a3f977d0..0f346122af 100644 --- a/Ryujinx/Config.cs +++ b/Ryujinx/Config.cs @@ -29,7 +29,7 @@ namespace Ryujinx AOptimizations.DisableMemoryChecks = !Convert.ToBoolean(Parser.Value("Enable_Memory_Checks")); - AGraphicsConfig.ShadersDumpPath = Parser.Value("Graphics_Shaders_Dump_Path"); + GraphicsConfig.ShadersDumpPath = Parser.Value("Graphics_Shaders_Dump_Path"); Log.SetEnable(LogLevel.Debug, Convert.ToBoolean(Parser.Value("Logging_Enable_Debug"))); Log.SetEnable(LogLevel.Stub, Convert.ToBoolean(Parser.Value("Logging_Enable_Stub")));