diff --git a/ArcFormats/ArcFormats.csproj b/ArcFormats/ArcFormats.csproj index 7e7a5890..144b7643 100644 --- a/ArcFormats/ArcFormats.csproj +++ b/ArcFormats/ArcFormats.csproj @@ -111,6 +111,7 @@ + @@ -1268,10 +1269,16 @@ - + PreserveNewest - + + PreserveNewest + + + PreserveNewest + + PreserveNewest diff --git a/ArcFormats/ImageJXL.cs b/ArcFormats/ImageJXL.cs new file mode 100644 index 00000000..5fec0c85 --- /dev/null +++ b/ArcFormats/ImageJXL.cs @@ -0,0 +1,23 @@ +using System; +using System.ComponentModel.Composition; +using System.IO; +using System.Runtime.InteropServices; +using System.Windows.Media; +using System.Windows.Media.Imaging; + +namespace GameRes.Formats +{ +// [Export(typeof(ImageFormat))] +// public class JxlImageFormat : ImageFormat, IDisposable +// { +// public override string Tag { get { return "JXL"; } } +// public override string Description { get { return "JPEG XL image format"; } } +// public override uint Signature { get { return 0; } } // JXL signature starts with 0xFF 0x0A +// public override bool CanWrite { get { return false; } } + +// public JxlImageFormat() +// { +// Extensions = new[] { "jxl" }; +// } +// } +} diff --git a/ArcFormats/ZstdStream.cs b/ArcFormats/ZstdStream.cs index 0c37afa4..253186ac 100644 --- a/ArcFormats/ZstdStream.cs +++ b/ArcFormats/ZstdStream.cs @@ -9,13 +9,13 @@ namespace GameRes.Compression { private const int BUFFER_SIZE = 4096; - [DllImport("zstd.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("zstd-1.dll", CallingConvention = CallingConvention.Cdecl)] private static extern IntPtr ZSTD_createDStream(); - [DllImport("zstd.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("zstd-1.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int ZSTD_decompressStream(IntPtr zds, ref ZSTD_outBuffer output, ref ZSTD_inBuffer input); - [DllImport("zstd.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("zstd-1.dll", CallingConvention = CallingConvention.Cdecl)] private static extern int ZSTD_freeDStream(IntPtr zds); [StructLayout(LayoutKind.Sequential)] diff --git a/ArcFormats/x64/jxl_dec.dll b/ArcFormats/x64/jxl_dec.dll new file mode 100644 index 00000000..154e2e11 Binary files /dev/null and b/ArcFormats/x64/jxl_dec.dll differ diff --git a/ArcFormats/x64/zstd.dll b/ArcFormats/x64/zstd-1.dll similarity index 100% rename from ArcFormats/x64/zstd.dll rename to ArcFormats/x64/zstd-1.dll diff --git a/ArcFormats/x86/jxl_dec.dll b/ArcFormats/x86/jxl_dec.dll new file mode 100644 index 00000000..25fbf484 Binary files /dev/null and b/ArcFormats/x86/jxl_dec.dll differ diff --git a/ArcFormats/x86/zstd.dll b/ArcFormats/x86/zstd-1.dll similarity index 100% rename from ArcFormats/x86/zstd.dll rename to ArcFormats/x86/zstd-1.dll diff --git a/GUI/App.xaml.cs b/GUI/App.xaml.cs index 56a9024d..2165e32c 100644 --- a/GUI/App.xaml.cs +++ b/GUI/App.xaml.cs @@ -30,6 +30,8 @@ using GARbro.GUI.Properties; using GameRes; using GameRes.Compression; using System.Reflection; +using System.Runtime.InteropServices; +using System.Windows; namespace GARbro.GUI { @@ -46,8 +48,13 @@ namespace GARbro.GUI /// public string InitPath { get; private set; } + [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + static extern bool SetDllDirectory(string lpPathName); + void ApplicationStartup (object sender, StartupEventArgs e) { + SetupDllDirectory(); string exe_dir = Path.GetDirectoryName (System.Reflection.Assembly.GetExecutingAssembly().Location); #if DEBUG Trace.Listeners.Add (new TextWriterTraceListener (Path.Combine (exe_dir, "trace.log"))); @@ -159,5 +166,20 @@ namespace GARbro.GUI } return false; } + + private static void SetupDllDirectory() { + string arch = Environment.Is64BitProcess ? "x64" : "x86"; + string appPath = AppDomain.CurrentDomain.BaseDirectory; + string dllPath = Path.Combine(appPath, arch); + + if (Directory.Exists(dllPath)) { + Console.WriteLine($"Setting DLL search directory to: {dllPath}"); + if (!SetDllDirectory(dllPath)) { + Console.WriteLine("Warning: Failed to set DLL directory."); + } + } else { + Console.WriteLine($"Warning: Directory not found: {dllPath}"); + } + } } }