aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.ShaderTools
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-06-10 21:46:42 -0300
committergdkchan <gab.dark.100@gmail.com>2018-06-10 21:46:42 -0300
commit76f3b1b3a4637ec72abfbb8cbc0679f2e0ca838f (patch)
tree0411b709de31c1c0517763512df8eeb9f7491bc9 /Ryujinx.ShaderTools
parent518fe799da6dd4f12c58c9e6e174767effb0b868 (diff)
Rename Ryujinx.Core to Ryujinx.HLE and add a separate project for a future LLE implementation
Diffstat (limited to 'Ryujinx.ShaderTools')
-rw-r--r--Ryujinx.ShaderTools/Memory.cs26
-rw-r--r--Ryujinx.ShaderTools/Program.cs42
-rw-r--r--Ryujinx.ShaderTools/Ryujinx.ShaderTools.csproj12
3 files changed, 80 insertions, 0 deletions
diff --git a/Ryujinx.ShaderTools/Memory.cs b/Ryujinx.ShaderTools/Memory.cs
new file mode 100644
index 00000000..f801ab39
--- /dev/null
+++ b/Ryujinx.ShaderTools/Memory.cs
@@ -0,0 +1,26 @@
+using Ryujinx.Graphics.Gal;
+using System.IO;
+
+namespace Ryujinx.ShaderTools
+{
+ class Memory : IGalMemory
+ {
+ private Stream BaseStream;
+
+ private BinaryReader Reader;
+
+ public Memory(Stream BaseStream)
+ {
+ this.BaseStream = BaseStream;
+
+ Reader = new BinaryReader(BaseStream);
+ }
+
+ public int ReadInt32(long Position)
+ {
+ BaseStream.Seek(Position, SeekOrigin.Begin);
+
+ return Reader.ReadInt32();
+ }
+ }
+}
diff --git a/Ryujinx.ShaderTools/Program.cs b/Ryujinx.ShaderTools/Program.cs
new file mode 100644
index 00000000..3597f256
--- /dev/null
+++ b/Ryujinx.ShaderTools/Program.cs
@@ -0,0 +1,42 @@
+using Ryujinx.Graphics.Gal;
+using Ryujinx.Graphics.Gal.Shader;
+using System;
+using System.IO;
+
+namespace Ryujinx.ShaderTools
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ if (args.Length == 2)
+ {
+ GlslDecompiler Decompiler = new GlslDecompiler();
+
+ GalShaderType ShaderType = GalShaderType.Vertex;
+
+ switch (args[0].ToLower())
+ {
+ case "v": ShaderType = GalShaderType.Vertex; break;
+ case "tc": ShaderType = GalShaderType.TessControl; break;
+ case "te": ShaderType = GalShaderType.TessEvaluation; break;
+ case "g": ShaderType = GalShaderType.Geometry; break;
+ case "f": ShaderType = GalShaderType.Fragment; break;
+ }
+
+ using (FileStream FS = new FileStream(args[1], FileMode.Open, FileAccess.Read))
+ {
+ Memory Mem = new Memory(FS);
+
+ GlslProgram Program = Decompiler.Decompile(Mem, 0, ShaderType);
+
+ Console.WriteLine(Program.Code);
+ }
+ }
+ else
+ {
+ Console.WriteLine("Usage: Ryujinx.ShaderTools [v|tc|te|g|f] shader.bin");
+ }
+ }
+ }
+}
diff --git a/Ryujinx.ShaderTools/Ryujinx.ShaderTools.csproj b/Ryujinx.ShaderTools/Ryujinx.ShaderTools.csproj
new file mode 100644
index 00000000..9eeee2ba
--- /dev/null
+++ b/Ryujinx.ShaderTools/Ryujinx.ShaderTools.csproj
@@ -0,0 +1,12 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <ItemGroup>
+ <ProjectReference Include="..\Ryujinx.Graphics\Ryujinx.Graphics.csproj" />
+ </ItemGroup>
+
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>netcoreapp2.1</TargetFramework>
+ </PropertyGroup>
+
+</Project>