diff --git a/ShinRyuModManager-CE/GameModel.cs b/ShinRyuModManager-CE/GameModel.cs index 95a919e..b458fef 100644 --- a/ShinRyuModManager-CE/GameModel.cs +++ b/ShinRyuModManager-CE/GameModel.cs @@ -472,10 +472,6 @@ public static void DoTalkProcedureYK3(MLO mlo, string codename) { //Get the smallest hact in the hact dir //Use that as a dummy file. //Our created pars inf load the game for some reason. - var smallestHAct = new DirectoryInfo(hactDir) - .GetFiles("*.par", SearchOption.TopDirectoryOnly) - .OrderBy(f => f.Length) - .First(); foreach (var mod in mlo.Mods) { var modPath = GamePath.GetModDirectory(mod); @@ -485,14 +481,28 @@ public static void DoTalkProcedureYK3(MLO mlo, string codename) { var talksDirs = new DirectoryInfo(modTalkDir).EnumerateDirectories(); foreach (var talkCategory in talksDirs) { - foreach (var talkDir in talkCategory.EnumerateDirectories()) { - var dummyParDir = new DirectoryInfo(Path.Combine(rootTalkDir, talkCategory.Name)); + var dummyParDir = new DirectoryInfo(Path.Combine(rootTalkDir, talkCategory.Name)); - if (!dummyParDir.Exists) - dummyParDir.Create(); - - var dummyParPath = new FileInfo(Path.Combine(dummyParDir.FullName, talkDir.Name + ".par")); - File.Copy(smallestHAct.FullName, dummyParPath.FullName, true); + if (!dummyParDir.Exists) + dummyParDir.Create(); + + foreach (var talkDir in talkCategory.EnumerateDirectories()) { + var talkPath = Path.Combine(dummyParDir.FullName, talkDir.Name); + + Directory.CreateDirectory(talkPath); + + if (!Directory.Exists(Path.Combine(talkDir.FullName, "000")) || !Directory.Exists(Path.Combine(talkDir.FullName, "cmn"))) + continue; + + foreach (var dir in talkDir.EnumerateDirectories()) { + var outputPath = Path.Combine(talkPath, $"{dir.Name}.par"); + + Utils.CreateParFromDirectory(dir.FullName, outputPath); + } + + Utils.CreateParFromDirectory(talkPath, $"{talkPath}.par"); + + new DirectoryInfo(talkPath).Delete(true); } } } diff --git a/ShinRyuModManager-CE/ParRepacker.cs b/ShinRyuModManager-CE/ParRepacker.cs index d8ac876..459bfb1 100644 --- a/ShinRyuModManager-CE/ParRepacker.cs +++ b/ShinRyuModManager-CE/ParRepacker.cs @@ -219,7 +219,7 @@ private static List GetModFiles(string path) { return files; } - private static Node ReadDirectory(string dirPath, string nodeName = "") { + public static Node ReadDirectory(string dirPath, string nodeName = "") { dirPath = Path.GetFullPath(dirPath); if (string.IsNullOrEmpty(nodeName)) { diff --git a/ShinRyuModManager-CE/Program.cs b/ShinRyuModManager-CE/Program.cs index fe8a3ea..42ceb70 100644 --- a/ShinRyuModManager-CE/Program.cs +++ b/ShinRyuModManager-CE/Program.cs @@ -214,7 +214,7 @@ internal static List PreRun(Profile? profile = null) { // Rename dinput8.dll to version.dll to prevent the game from crashing File.Move(Constants.DINPUT8DLL, Constants.VERSIONDLL); } - } else if (GamePath.CurrentGame is Game.Judgment or Game.LostJudgment) { + } else if (GamePath.CurrentGame is >= Game.YakuzaKiwami2 and not Game.LikeADragonGaiden) { // Lost Judgment (and Judgment post update 1) does not like Ultimate ASI Loader, so instead we use a custom build of DllSpoofer (https://github.com/Kazurin-775/DllSpoofer) if (File.Exists(Constants.DINPUT8DLL)) { Log.Warning($"Game specific patch: Deleting {Constants.DINPUT8DLL} because it causes crashes with Judgment games..."); diff --git a/ShinRyuModManager-CE/UserInterface/Assets/changelog.md b/ShinRyuModManager-CE/UserInterface/Assets/changelog.md index 9be4233..cd817b6 100644 --- a/ShinRyuModManager-CE/UserInterface/Assets/changelog.md +++ b/ShinRyuModManager-CE/UserInterface/Assets/changelog.md @@ -1,4 +1,9 @@ > ### **%{color:gold} Version 1.4.3 %** ### +* Implemented changes from SRMM 4.7.8 + +--- + +> ### **%{color:orange} Version 1.4.3 %** ### * Implemented improved PYIH and newer hashing from SRMM 4.7.7 --- diff --git a/ShinRyuModManager-CE/Utils.cs b/ShinRyuModManager-CE/Utils.cs index 8a2a731..ae9ac5d 100644 --- a/ShinRyuModManager-CE/Utils.cs +++ b/ShinRyuModManager-CE/Utils.cs @@ -1,4 +1,5 @@ using System.Text; +using ParLibrary.Converter; using SharpCompress.Archives.SevenZip; using SharpCompress.Common; using SharpCompress.Readers; @@ -124,4 +125,21 @@ public static void CopyDirectory(string srcDirectory, string destDirectory) { CopyDirectory(dir, destSubDir); } } + + public static void CreateParFromDirectory(string inputPath, string outputPath) { + var parameters = new ParArchiveWriterParameters { + CompressorVersion = 0, + OutputPath = outputPath, + IncludeDots = true, + ResetFileDates = true + }; + + var nodeName = new DirectoryInfo(inputPath).Name; + using var node = ParRepacker.ReadDirectory(inputPath, nodeName); + + node.SortChildren((x, y) => string.CompareOrdinal(x.Name.ToLowerInvariant(), y.Name.ToLowerInvariant())); + + using var containerNode = node.GetFormatAs(); + using var par = node.TransformWith(typeof(ParArchiveWriter), parameters); + } }