diff --git a/ConsoleTools/Program.cs b/ConsoleTools/Program.cs index 9f87c0c3..cc210e29 100644 --- a/ConsoleTools/Program.cs +++ b/ConsoleTools/Program.cs @@ -102,15 +102,45 @@ public static async Task HandleConsoleArgs() { code = await UnwrapFile(); } + else if (cmd == "/list") + { + code = await ListRoot(); + } else { - await ShowHelp(); + Console.WriteLine("Unknown Command: " + cmd); code = -1; } return code; } + private static async Task ListRoot() + { + if (_Args.Length < 2) + { + return -1; + } + + var rootSt = _Args[1]; + var rootInfo = XivCache.GetFileNameRootInfo(rootSt, true); + + if (!rootInfo.IsValid()) + { + Console.WriteLine("Given Root ID is not valid: " + rootSt); + return -1; + } + var root = new XivDependencyRoot(rootInfo); + + var files = await root.GetAllFiles(); + + foreach(var file in files) + { + Console.WriteLine(file); + } + return 0; + } + public static async Task HandleUpgrade() { if (_Args.Length < 3) @@ -322,6 +352,8 @@ public static async Task ShowHelp() System.Console.WriteLine(""); System.Console.WriteLine("\t/unwrap [SourceFilePath] [DestFilePath] [IntendedFfxivFilePath] - Unwraps a given on-disk SqPacked or Flat FFXIV file into the given format. FF Path only needed for MDLs Skeleton/Texture info."); System.Console.WriteLine(""); + System.Console.WriteLine("\t/list [RootId] - List the entire collection of files associated with a given root ID. ( Ex. c0101h0010 )"); + System.Console.WriteLine(""); System.Console.WriteLine("== FORMATS =="); System.Console.WriteLine("\tModpacks may be read or written in .ttmp2, .pmp, or unzipped PMP folder path formats."); System.Console.WriteLine("\tImages may be saved as DDS, TEX, TGA, PNG, BMP."); diff --git a/FFXIV_TexTools/FFXIV_TexTools.csproj b/FFXIV_TexTools/FFXIV_TexTools.csproj index c24a2421..6484baa2 100644 --- a/FFXIV_TexTools/FFXIV_TexTools.csproj +++ b/FFXIV_TexTools/FFXIV_TexTools.csproj @@ -23,9 +23,9 @@ FFXIV_TexTools Copyright © 2024 - 3.0.5.5 - 3.0.5.5 - 3.0.5.5 + 3.0.5.6 + 3.0.5.6 + 3.0.5.6 9.0 true diff --git a/FFXIV_TexTools/MainWindow.xaml.cs b/FFXIV_TexTools/MainWindow.xaml.cs index 0ad9f807..ec6c697c 100644 --- a/FFXIV_TexTools/MainWindow.xaml.cs +++ b/FFXIV_TexTools/MainWindow.xaml.cs @@ -285,6 +285,9 @@ private void AutoUpdater_ApplicationExitEvent() } public MainWindow(string[] args) { + + var hasPenumbra = PenumbraAPI.IsPenumbraInstalled(); + _Args = args; _mainWindow = this; @@ -1518,6 +1521,10 @@ private async void Menu_StartOver_Click(object sender, RoutedEventArgs e) if(MainWindow.UserTransaction.ModifiedFiles.Count > 0) { var r = FlexibleMessageBox.Show(ViewHelpers.GetWin32Window(this), "Your current transaction must be closed in order to proceed.\n\nYou will lose any active changes if you continue.", "Transaction Cancel Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); + if (r != System.Windows.Forms.DialogResult.OK) + { + return; + } } await ModTransaction.CancelTransaction(MainWindow.UserTransaction, true); } diff --git a/FFXIV_TexTools/Models/PenumbraUpgradeStatus.cs b/FFXIV_TexTools/Models/PenumbraUpgradeStatus.cs index c7f78ae7..6055bf28 100644 --- a/FFXIV_TexTools/Models/PenumbraUpgradeStatus.cs +++ b/FFXIV_TexTools/Models/PenumbraUpgradeStatus.cs @@ -10,6 +10,7 @@ using FFXIV_TexTools.Helpers; using System.Diagnostics; using xivModdingFramework.Mods; +using xivModdingFramework.Exd.FileTypes; namespace FFXIV_TexTools.Models { @@ -49,8 +50,23 @@ public async Task ProcessMod(string baseDir, string targetDir, s { if (source != target) { - IOUtil.RecursiveDeleteDirectory(target); - IOUtil.CopyFolder(source, target); + try + { + IOUtil.RecursiveDeleteDirectory(target); + } + catch(Exception ex2) + { + throw new Exception("Unable to delete directory for failed conversion, possibly due to security issue: " + target + "\n"+ ex2.Message + "\n\nOriginal Conversion Failure: " + ex.Message); + } + + try + { + IOUtil.CopyFolder(source, target); + } + catch (Exception ex2) + { + throw new Exception("Unable to copy failed mod directory to destination.\nFrom: " + source + "\nTo: " + target + "\n" + ex2.Message + "\n\nOriginal Conversion Failure: " + ex.Message); + } } } res = EUpgradeResult.Failure; diff --git a/FFXIV_TexTools/ViewModels/MainViewModel.cs b/FFXIV_TexTools/ViewModels/MainViewModel.cs index 6d1858f4..e50573af 100644 --- a/FFXIV_TexTools/ViewModels/MainViewModel.cs +++ b/FFXIV_TexTools/ViewModels/MainViewModel.cs @@ -237,6 +237,7 @@ public async Task DoPostPatchCleanup() { // Original offset moved. Just update the mod entry. var m = mod; + Dat.AssertOriginalOffsetIsSafe(mod.DataFile, currentOffset); m.OriginalOffset8x = currentOffset; await tx.UpdateMod(mod, mod.FilePath); } else if(currentOK && !moddedOk && !originalOk) diff --git a/FFXIV_TexTools/Views/Controls/FileListControl.xaml b/FFXIV_TexTools/Views/Controls/FileListControl.xaml index 24d52c9f..3669ef19 100644 --- a/FFXIV_TexTools/Views/Controls/FileListControl.xaml +++ b/FFXIV_TexTools/Views/Controls/FileListControl.xaml @@ -54,16 +54,12 @@ - - -