Skip to content
Merged
Show file tree
Hide file tree
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
32 changes: 21 additions & 11 deletions ShinRyuModManager-CE/GameModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ShinRyuModManager-CE/ParRepacker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private static List<string> 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)) {
Expand Down
2 changes: 1 addition & 1 deletion ShinRyuModManager-CE/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ internal static List<ModInfo> 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...");
Expand Down
5 changes: 5 additions & 0 deletions ShinRyuModManager-CE/UserInterface/Assets/changelog.md
Original file line number Diff line number Diff line change
@@ -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

---
Expand Down
18 changes: 18 additions & 0 deletions ShinRyuModManager-CE/Utils.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text;
using ParLibrary.Converter;
using SharpCompress.Archives.SevenZip;
using SharpCompress.Common;
using SharpCompress.Readers;
Expand Down Expand Up @@ -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<NodeContainerFormat>();
using var par = node.TransformWith(typeof(ParArchiveWriter), parameters);
}
}