From 385dca7c78ec12a531aeaa7fdb81d5a9f10a5158 Mon Sep 17 00:00:00 2001 From: zerocker Date: Wed, 10 Dec 2025 10:51:23 +0900 Subject: [PATCH 1/2] add a CLI flag to skip `Updates.pak` when unpacking the game this makes possible to unpack resources from older versions of the game that may not have this file. --- Interface/Actions/UnpackGameAction.cs | 11 ++++++++++- README.md | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Interface/Actions/UnpackGameAction.cs b/Interface/Actions/UnpackGameAction.cs index e3e94a1..784c6d2 100644 --- a/Interface/Actions/UnpackGameAction.cs +++ b/Interface/Actions/UnpackGameAction.cs @@ -10,6 +10,7 @@ internal class UnpackGameAction : CommandLineAction private const string DestinationFolder = "destination-folder"; private const string UseLegacyAo = "use-legacy-ao"; private const string UseLegacyTs = "use-legacy-ts"; + private const string SkipUpdates = "skip-updates"; public string Name => "--unpack-fez-content"; @@ -22,7 +23,8 @@ internal class UnpackGameAction : CommandLineAction new CommandLineArgument(FezContentDirectory), new CommandLineArgument(DestinationFolder), new CommandLineArgument(UseLegacyAo, ArgumentType.Flag), - new CommandLineArgument(UseLegacyTs, ArgumentType.Flag) + new CommandLineArgument(UseLegacyTs, ArgumentType.Flag), + new CommandLineArgument(SkipUpdates, ArgumentType.Flag) }; public void Execute(Dictionary args) @@ -37,6 +39,13 @@ public void Execute(Dictionary args) { if (!File.Exists(packagePath)) { + if (packagePath.EndsWith("Updates.pak") && args.ContainsKey(SkipUpdates)) + { + // Older, pre-FNA releases may not have this PAK. + Console.WriteLine($"Skipping the {Path.GetFileName(packagePath)} directory."); + continue; + } + throw new Exception($"Given directory is not FEZ's Content directory (missing {Path.GetFileName(packagePath)})."); } } diff --git a/README.md b/README.md index 7655796..db4c11c 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Unpacks entire .PAK package into specified directory (creates one if doesn't exi - `--unpack-decompressed [pak-path] [destination-folder] --use-legacy-ao --use-legacy-ts` Unpacks entire .PAK package into specified directory (creates one if doesn't exist).and attempts to decompress all XNB assets, but does not convert them. -- `[--unpack-fez-content, -g] [fez-content-directory] [destination-folder] --use-legacy-ao --use-legacy-ts` +- `[--unpack-fez-content, -g] [fez-content-directory] [destination-folder] --use-legacy-ao --use-legacy-ts --skip-updates` Unpacks and converts all game assets into specified directory (creates one if doesn't exist). - `[--pack, -p] [input-directory-path] [destination-pak-path] ` From 890aaab2f15e9881479c917a4fcb5595437f5e20 Mon Sep 17 00:00:00 2001 From: zerocker Date: Thu, 11 Dec 2025 10:38:52 +0900 Subject: [PATCH 2/2] rework the behavior of unpacking the game without a flag also issue a warning if the `Updates.pak` file was not found. --- Interface/Actions/UnpackGameAction.cs | 33 ++++++++++++--------------- README.md | 2 +- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/Interface/Actions/UnpackGameAction.cs b/Interface/Actions/UnpackGameAction.cs index 784c6d2..37444c7 100644 --- a/Interface/Actions/UnpackGameAction.cs +++ b/Interface/Actions/UnpackGameAction.cs @@ -10,7 +10,6 @@ internal class UnpackGameAction : CommandLineAction private const string DestinationFolder = "destination-folder"; private const string UseLegacyAo = "use-legacy-ao"; private const string UseLegacyTs = "use-legacy-ts"; - private const string SkipUpdates = "skip-updates"; public string Name => "--unpack-fez-content"; @@ -23,8 +22,7 @@ internal class UnpackGameAction : CommandLineAction new CommandLineArgument(FezContentDirectory), new CommandLineArgument(DestinationFolder), new CommandLineArgument(UseLegacyAo, ArgumentType.Flag), - new CommandLineArgument(UseLegacyTs, ArgumentType.Flag), - new CommandLineArgument(SkipUpdates, ArgumentType.Flag) + new CommandLineArgument(UseLegacyTs, ArgumentType.Flag) }; public void Execute(Dictionary args) @@ -32,22 +30,21 @@ public void Execute(Dictionary args) var contentPath = args[FezContentDirectory]; var outputDir = args[DestinationFolder]; - var packagePaths = new string[] { "Essentials.pak", "Music.pak", "Other.pak", "Updates.pak" } - .Select(path => Path.Combine(contentPath, path)).ToArray(); - - foreach (var packagePath in packagePaths) + var packagePaths = Directory.GetFiles(contentPath, "*.pak").OrderBy(f => f).ToList(); + Console.WriteLine($"Found directories: {string.Join(", ", packagePaths.Select(Path.GetFileName))}"); + + var updatesPak = packagePaths.FirstOrDefault(f => f.EndsWith("Updates.pak")); + if (!string.IsNullOrEmpty(updatesPak)) { - if (!File.Exists(packagePath)) - { - if (packagePath.EndsWith("Updates.pak") && args.ContainsKey(SkipUpdates)) - { - // Older, pre-FNA releases may not have this PAK. - Console.WriteLine($"Skipping the {Path.GetFileName(packagePath)} directory."); - continue; - } - - throw new Exception($"Given directory is not FEZ's Content directory (missing {Path.GetFileName(packagePath)})."); - } + // Files from this directory are overwritten on top of existing ones, so process them last. + packagePaths.Remove(updatesPak); + packagePaths.Add(updatesPak); + } + else + { + Console.WriteLine("\n WARNING! Updates.pak directory was not found."); + Console.WriteLine(" Only older versions of the game (usually released before the current 1.12)"); + Console.WriteLine(" may not have this directory!\n"); } var settings = new FormatConverterSettings diff --git a/README.md b/README.md index db4c11c..7655796 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Unpacks entire .PAK package into specified directory (creates one if doesn't exi - `--unpack-decompressed [pak-path] [destination-folder] --use-legacy-ao --use-legacy-ts` Unpacks entire .PAK package into specified directory (creates one if doesn't exist).and attempts to decompress all XNB assets, but does not convert them. -- `[--unpack-fez-content, -g] [fez-content-directory] [destination-folder] --use-legacy-ao --use-legacy-ts --skip-updates` +- `[--unpack-fez-content, -g] [fez-content-directory] [destination-folder] --use-legacy-ao --use-legacy-ts` Unpacks and converts all game assets into specified directory (creates one if doesn't exist). - `[--pack, -p] [input-directory-path] [destination-pak-path] `