Skip to content

Commit 643a562

Browse files
Experimental YK3 Talk & HAct Repack (#29)
1 parent efb9582 commit 643a562

File tree

9 files changed

+105
-7
lines changed

9 files changed

+105
-7
lines changed

CpkTools/CpkTools.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
<ItemGroup>
1010
<PackageReference Include="CommunityToolkit.HighPerformance" Version="8.4.0" />
11-
<PackageReference Include="System.Text.Encoding.CodePages" Version="10.0.1" />
1211
</ItemGroup>
1312

1413
</Project>

CpkTools/Model/Cpk.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ public sealed class Cpk {
1818
private Memory<byte> _tocPacket;
1919
private Memory<byte> _itocPacket;
2020
private Memory<byte> _etocPacket;
21+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
2122
private Memory<byte> _gtocPacket;
23+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
2224
private ulong _tocOffset = ulong.MaxValue;
2325
private ulong _etocOffset = ulong.MaxValue;
2426
private ulong _itocOffset = ulong.MaxValue;

ParLibrary/ParLibrary.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="System.Text.Encoding.CodePages" Version="10.0.1" />
1312
<PackageReference Include="Yarhl" Version="4.0.0" />
1413
</ItemGroup>
1514

ShinRyuModManager-CE/GameModel.cs

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,4 +401,96 @@ public static void DoUBIKProcedure(MLO mlo) {
401401

402402
par.Dispose();
403403
}
404+
405+
public static void DoYK3HActProcedure(MLO mlo, string codename) {
406+
var hactDir = new DirectoryInfo(GamePath.DataPath).EnumerateDirectories().FirstOrDefault(x => x.Name.StartsWith("hact_"))?.FullName;
407+
408+
if (string.IsNullOrEmpty(hactDir))
409+
return;
410+
411+
var haveTalk = mlo.Files.Any(x => x.Name.Contains("/hact_"));
412+
413+
if (!haveTalk)
414+
return;
415+
416+
var rootHActDir = Path.Combine(GamePath.ParlessDir, "hact_" + codename);
417+
418+
Directory.CreateDirectory(rootHActDir);
419+
420+
// This is really bad but it will have to do:
421+
// Get the smallest hact in the hact dir
422+
// Use that as a dummy file.
423+
// Our created pars inf load the game for some reason.
424+
var smallestHAct = new DirectoryInfo(hactDir)
425+
.EnumerateFiles("*.par", SearchOption.TopDirectoryOnly)
426+
.OrderBy(f => f.Length)
427+
.First();
428+
429+
foreach (var mod in mlo.Mods) {
430+
var modPath = GamePath.GetModDirectory(mod);
431+
var hActDirPath = Directory.EnumerateDirectories(modPath).FirstOrDefault(x => x.Contains("hact_"));
432+
433+
if (string.IsNullOrEmpty(hActDirPath))
434+
continue;
435+
436+
var hActDir = new DirectoryInfo(hActDirPath);
437+
438+
foreach (var dir in hActDir.EnumerateDirectories()) {
439+
var dummyParDir = new DirectoryInfo(rootHActDir);
440+
441+
if (!dummyParDir.Exists)
442+
dummyParDir.Create();
443+
444+
var dummyParPath = new FileInfo(Path.Combine(dummyParDir.FullName, dir.Name + ".par"));
445+
File.Copy(smallestHAct.FullName, dummyParPath.FullName, true);
446+
}
447+
}
448+
}
449+
450+
public static void DoTalkProcedureYK3(MLO mlo, string codename) {
451+
var hactDir = new DirectoryInfo(GamePath.DataPath).GetDirectories().FirstOrDefault(x => x.Name.StartsWith("hact_"))?.FullName;
452+
453+
if (string.IsNullOrEmpty(hactDir))
454+
return;
455+
456+
var haveTalk = mlo.Files.Any(x => x.Name.Contains("/talk_"));
457+
458+
if (!haveTalk)
459+
return;
460+
461+
var rootTalkDir = Path.Combine(GamePath.ParlessDir, "talk_" + codename);
462+
463+
if (!Directory.Exists(rootTalkDir))
464+
Directory.CreateDirectory(rootTalkDir);
465+
466+
//This is really bad but it will have to do:
467+
//Get the smallest hact in the hact dir
468+
//Use that as a dummy file.
469+
//Our created pars inf load the game for some reason.
470+
var smallestHAct = new DirectoryInfo(hactDir)
471+
.GetFiles("*.par", SearchOption.TopDirectoryOnly)
472+
.OrderBy(f => f.Length)
473+
.First();
474+
475+
foreach (var mod in mlo.Mods) {
476+
var modPath = GamePath.GetModDirectory(mod);
477+
var talkDirs = Directory.EnumerateDirectories(modPath).Where(x => x.Contains("talk_"));
478+
479+
foreach (var modTalkDir in talkDirs) {
480+
var talksDirs = new DirectoryInfo(modTalkDir).EnumerateDirectories();
481+
482+
foreach (var talkCategory in talksDirs) {
483+
foreach (var talkDir in talkCategory.EnumerateDirectories()) {
484+
var dummyParDir = new DirectoryInfo(Path.Combine(rootTalkDir, talkCategory.Name));
485+
486+
if (!dummyParDir.Exists)
487+
dummyParDir.Create();
488+
489+
var dummyParPath = new FileInfo(Path.Combine(dummyParDir.FullName, talkDir.Name + ".par"));
490+
File.Copy(smallestHAct.FullName, dummyParPath.FullName, true);
491+
}
492+
}
493+
}
494+
}
495+
}
404496
}

ShinRyuModManager-CE/ModLoadOrder/Mods/Mod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public void AddFiles(string path, string check) {
176176
}
177177
}
178178

179-
if (GamePath.CurrentGame >= Game.Yakuza6) {
179+
if (GamePath.CurrentGame >= Game.Yakuza6 && GamePath.CurrentGame != Game.YakuzaKiwami3) {
180180
//Dragon Engine talks use pars directly for these
181181
if (path.Contains("talk_")) {
182182
if (char.IsDigit(basename[0]) || check == "cmn") {

ShinRyuModManager-CE/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ internal static async Task RunGeneration(List<ModInfo> mods) {
388388
break;
389389

390390
case Game.YakuzaKiwami3:
391-
GameModel.DoDEHActProcedure(result, "bis");
391+
GameModel.DoYK3HActProcedure(result, "bis");
392+
GameModel.DoTalkProcedureYK3(result, "bis");
392393
break;
393394
}
394395

ShinRyuModManager-CE/ShinRyuModManager-CE.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
1515

1616
<!-- Versioning -->
17-
<AssemblyVersion>1.4.1</AssemblyVersion>
17+
<AssemblyVersion>1.4.2</AssemblyVersion>
1818
<VersionPrefix>$(AssemblyVersion)</VersionPrefix>
1919
<AssemblyTitle>ShinRyuModManager-CE</AssemblyTitle>
2020
<Company>SRMM Studio</Company>

ShinRyuModManager-CE/UserInterface/Assets/changelog.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
> ### **%{color:gold} Version 1.4.1 %** ###
1+
> ### **%{color:gold} Version 1.4.2 %** ###
2+
* Implemented **experimental** Talk and HAct repack methods from SRMM 4.7.6
3+
4+
---
5+
6+
> ### **%{color:orange} Version 1.4.1 %** ###
27
* Yakuza Kiwami 3 Support
38
* Fixed PYIH gmt hash lookup
49
* Fixed bug when removing an installed mod

Utils/GamePath.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static GamePath() {
2525
ParlessDir = Path.Combine(ModsPath, "Parless");
2626
ExternalModsPath = Path.Combine(ModsPath, Constants.EXTERNAL_MODS);
2727
LibrariesPath = Path.Combine(FullGamePath, LIBRARIES);
28-
LocalLibrariesPath = Path.Combine(GamePath.LibrariesPath, Constants.LIBRARIES_INFO_REPO_FILE_PATH);
28+
LocalLibrariesPath = Path.Combine(LibrariesPath, Constants.LIBRARIES_INFO_REPO_FILE_PATH);
2929

3030
// Try to get game
3131
foreach (var file in Directory.GetFiles(FullGamePath, "*.exe")) {

0 commit comments

Comments
 (0)