blob: 21eb3d79b5e4f28fd3da63923882b2a15289f831 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
using Ryujinx.Graphics.Gal;
using Ryujinx.Graphics.Gal.Shader;
using System;
using System.IO;
namespace Ryushader
{
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;
}
byte[] Data = File.ReadAllBytes(args[1]);
int[] Code = new int[Data.Length / 4];
for (int Offset = 0; Offset < Data.Length; Offset += 4)
{
int Value = BitConverter.ToInt32(Data, Offset);
Code[Offset >> 2] = Value;
}
GlslProgram Program = Decompiler.Decompile(Code, ShaderType);
Console.WriteLine(Program.Code);
}
else
{
Console.WriteLine("Usage: Ryushader [v|tc|te|g|f] shader.bin");
}
}
}
}
|