diff --git a/CUE4Parse b/CUE4Parse
index 73c12732..4b6ca53b 160000
--- a/CUE4Parse
+++ b/CUE4Parse
@@ -1 +1 @@
-Subproject commit 73c12732922e4ad797c522895382a0b1a2c01a24
+Subproject commit 4b6ca53b19ec4e8af9eac6c838eb2f97c104d2d1
diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj
index ebbc5296..a081481e 100644
--- a/FModel/FModel.csproj
+++ b/FModel/FModel.csproj
@@ -110,9 +110,10 @@
-
+
+
diff --git a/FModel/MainWindow.xaml.cs b/FModel/MainWindow.xaml.cs
index 1219d593..e7a0afc7 100644
--- a/FModel/MainWindow.xaml.cs
+++ b/FModel/MainWindow.xaml.cs
@@ -78,6 +78,7 @@ namespace FModel
await _applicationView.AesManager.UpdateProvider(true);
await _applicationView.CUE4Parse.InitBenMappings();
await _applicationView.InitVgmStream();
+ await _applicationView.InitOodle();
if (UserSettings.Default.DiscordRpc == EDiscordRpc.Always)
_discordHandler.Initialize(_applicationView.CUE4Parse.Game);
diff --git a/FModel/ViewModels/ApplicationViewModel.cs b/FModel/ViewModels/ApplicationViewModel.cs
index 988a3da9..335821e6 100644
--- a/FModel/ViewModels/ApplicationViewModel.cs
+++ b/FModel/ViewModels/ApplicationViewModel.cs
@@ -1,19 +1,25 @@
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Threading.Tasks;
-using System.Windows;
-using FModel.Extensions;
+using FModel.Extensions;
using FModel.Framework;
using FModel.Services;
using FModel.Settings;
using FModel.ViewModels.Commands;
using FModel.Views;
using FModel.Views.Resources.Controls;
+
using Ionic.Zip;
+
+using Oodle.NET;
+
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Threading.Tasks;
+using System.Windows;
+
using MessageBox = AdonisUI.Controls.MessageBox;
using MessageBoxButton = AdonisUI.Controls.MessageBoxButton;
using MessageBoxImage = AdonisUI.Controls.MessageBoxImage;
+using OodleCUE4 = CUE4Parse.Compression.Oodle;
namespace FModel.ViewModels
{
@@ -65,6 +71,7 @@ namespace FModel.ViewModels
public AudioPlayerViewModel AudioPlayer { get; }
public MapViewerViewModel MapViewer { get; }
public ModelViewerViewModel ModelViewer { get; }
+ private OodleCompressor _oodle;
public ApplicationViewModel()
{
@@ -164,5 +171,33 @@ namespace FModel.ViewModels
FLogger.AppendText("Could not download VgmStream", Constants.WHITE, true);
}
}
+
+ public async Task InitOodle()
+ {
+ var dataDir = Directory.CreateDirectory(Path.Combine(UserSettings.Default.OutputDirectory, ".data"));
+ var oodlePath = Path.Combine(dataDir.FullName, OodleCUE4.OODLE_DLL_NAME);
+
+ if (File.Exists(OodleCUE4.OODLE_DLL_NAME))
+ {
+ File.Move(OodleCUE4.OODLE_DLL_NAME, oodlePath, true);
+ }
+ else if (!File.Exists(oodlePath))
+ {
+ var result = await OodleCUE4.DownloadOodleDll(oodlePath);
+ if (!result) return;
+ }
+
+ if (File.Exists("oo2core_8_win64.dll"))
+ File.Delete("oo2core_8_win64.dll");
+
+ _oodle = new OodleCompressor(oodlePath);
+
+ unsafe
+ {
+ OodleCUE4.DecompressFunc = (bufferPtr, bufferSize, outputPtr, outputSize, a, b, c, d, e, f, g, h, i, threadModule) =>
+ _oodle.Decompress(new IntPtr(bufferPtr), bufferSize, new IntPtr(outputPtr), outputSize,
+ (OodleLZ_FuzzSafe)a, (OodleLZ_CheckCRC)b, (OodleLZ_Verbosity)c, d, e, f, g, h, i, (OodleLZ_Decode_ThreadPhase)threadModule);
+ }
+ }
}
}