Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions Plugins/CafeLibrary/ShaderTools/ShaderLoaders/CafeShaderDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Toolbox.Core;
using Toolbox.Core.IO;
using System.Diagnostics;
using System.Runtime.InteropServices;
using GLFrameworkEngine;
using OpenTK;
using OpenTK.Graphics.OpenGL;
Expand Down Expand Up @@ -197,8 +198,15 @@ static string ConvertStages(List<ShaderStage> stages)
File.WriteAllBytes(Path.Combine(Runtime.ExecutableDir,"GFD",stage.Name), stage.Data);

ProcessStartInfo start = new ProcessStartInfo();
start.FileName = "GFD/gx2shader-decompiler.exe";
start.WorkingDirectory = System.IO.Path.Combine(Runtime.ExecutableDir, "GFD");
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
start.FileName = "GFD/gx2shader-decompiler.exe";
else
{
start.FileName = "wine";
start.Arguments += $"\"{Path.Combine(Runtime.ExecutableDir, "GFD", "gx2shader-decompiler.exe")}\" ";
}

start.WorkingDirectory = Path.Combine(Runtime.ExecutableDir, "GFD");
foreach (var stage in stages)
{
if (!File.Exists(Path.Combine(Runtime.ExecutableDir,"GFD",stage.Name)))
Expand Down Expand Up @@ -263,9 +271,15 @@ static string SPIRV2GLSL(string filePath, string output)
string remapFlags = "";

ProcessStartInfo start = new ProcessStartInfo();
start.FileName = $"GFD/spirv-cross.exe";
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
start.FileName = "GFD/spirv-cross.exe";
else
{
start.FileName = "wine";
start.Arguments += $"\"{Path.Combine(Runtime.ExecutableDir, "GFD", "spirv-cross.exe")}\" ";
}
start.WorkingDirectory = Runtime.ExecutableDir;
start.Arguments = $"{AddQuotesIfRequired(filePath)} {remapFlags} --no-es --extension GL_ARB_shader_storage_buffer_object --extension GL_ARB_separate_shader_objects --no-420pack-extension --no-support-nonzero-baseinstance --version 440 --output {AddQuotesIfRequired(output)}";
start.Arguments += $"{AddQuotesIfRequired(filePath)} {remapFlags} --no-es --extension GL_ARB_shader_storage_buffer_object --extension GL_ARB_separate_shader_objects --no-420pack-extension --no-support-nonzero-baseinstance --version 440 --output {AddQuotesIfRequired(output)}";
start.UseShellExecute = false;
start.RedirectStandardOutput = true;
start.CreateNoWindow = true;
Expand Down