diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index bd08b005..26a786ee 100644 Binary files a/.vs/Switch_Toolbox/v15/.suo and b/.vs/Switch_Toolbox/v15/.suo differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide index 7c83c19b..9aaa23b2 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal index f4cc3f88..a1e56f13 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal differ diff --git a/Switch_Toolbox_Library/FileFormats/SizeTables/RSTB.cs b/Switch_Toolbox_Library/FileFormats/SizeTables/RSTB.cs index 1ce46c6c..94b3624e 100644 --- a/Switch_Toolbox_Library/FileFormats/SizeTables/RSTB.cs +++ b/Switch_Toolbox_Library/FileFormats/SizeTables/RSTB.cs @@ -22,9 +22,9 @@ namespace Switch_Toolbox.Library public Dictionary NameTables { get; set; } public Dictionary Crc32Tables { get; set; } - private int ParseSize(string FilePath, byte[] Data = null, bool Force = false) + private int ParseSize(string FilePath, byte[] Data = null, bool IsYaz0Compressed = false, bool Force = false) { - var size = new RSTB.SizeCalculator().CalculateFileSize(FilePath, Data, IsWiiU, Force); + var size = new RSTB.SizeCalculator().CalculateFileSize(FilePath, Data, IsWiiU, IsYaz0Compressed, Force); if (size == 0) { var result = MessageBox.Show("Error! Could not calculate size for resource entry! Do you want to remove it instead?", "Resource Table", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); @@ -36,10 +36,10 @@ namespace Switch_Toolbox.Library return size; } - public void SetEntry(string FileName, byte[] Data = null, bool Force = false) + public void SetEntry(string FileName, byte[] Data = null, bool IsYaz0Compressed = false, bool Force = false) { uint OldSize = GetSize(FileName); - uint NewSize = (uint)ParseSize(FileName, Data, Force); + uint NewSize = (uint)ParseSize(FileName, Data, IsYaz0Compressed, Force); STConsole.WriteLine($"Setting RSTB Entry!"); STConsole.WriteLine($"{FileName} OldSize {OldSize}"); @@ -265,17 +265,17 @@ namespace Switch_Toolbox.Library float.TryParse(value, out output); } - public int CalculateFileSize(string FileName, byte[] Data, bool IsWiiU, bool Force) + public int CalculateFileSize(string FileName, byte[] Data, bool IsWiiU,bool IsYaz0Compressed, bool Force) { - return CalculateFileSizeByExtension(FileName, Data, IsWiiU, System.IO.Path.GetExtension(FileName), Force); + return CalculateFileSizeByExtension(FileName, Data, IsWiiU, System.IO.Path.GetExtension(FileName), IsYaz0Compressed, Force); } - private int CalculateFileSizeByExtension(string FileName, byte[] Data, bool WiiU, string Ext, bool Force = false) + private int CalculateFileSizeByExtension(string FileName, byte[] Data, bool WiiU, string Ext, bool IsYaz0Compressed, bool Force = false) { int Size = 0; if (System.IO.File.Exists(FileName)) { - if (Ext.StartsWith("s")) + if (Ext.StartsWith("s") || IsYaz0Compressed) { using (var reader = new FileReader(FileName)) { diff --git a/Switch_Toolbox_Library/IO/STFileSaver.cs b/Switch_Toolbox_Library/IO/STFileSaver.cs index d845fc97..6d4b5d80 100644 --- a/Switch_Toolbox_Library/IO/STFileSaver.cs +++ b/Switch_Toolbox_Library/IO/STFileSaver.cs @@ -52,7 +52,7 @@ namespace Switch_Toolbox.Library.IO Cursor.Current = Cursors.Default; } - private static string SatisfyFileTables(IFileFormat FileFormat, string FilePath, byte[] Data, uint DecompressedSize, uint CompressedSize, bool IsCompressed) + private static string SatisfyFileTables(IFileFormat FileFormat, string FilePath, byte[] Data, uint DecompressedSize, uint CompressedSize, bool IsYaz0Compressed) { string FileLog = ""; @@ -95,7 +95,7 @@ namespace Switch_Toolbox.Library.IO } - BotwResourceTable.SetEntry(newFilePath, Data); + BotwResourceTable.SetEntry(newFilePath, Data, IsYaz0Compressed); BotwResourceTable.Write(new FileWriter(RstbPath)); File.WriteAllBytes(RstbPath, EveryFileExplorer.YAZ0.Compress(RstbPath)); }