mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-22 20:43:09 +00:00
Now twilight princess file table works
This commit is contained in:
parent
35f547e9a7
commit
0b87737eac
93 changed files with 11 additions and 28 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -56,7 +56,6 @@ namespace FirstPlugin
|
|||
|
||||
public Dictionary<long, byte[]> SavedDataEntries = new Dictionary<long, byte[]>();
|
||||
public Dictionary<long, string> SavedStringEntries = new Dictionary<long, string>();
|
||||
public Dictionary<string, uint> ArchiveSizes = new Dictionary<string, uint>();
|
||||
|
||||
public uint Alignment;
|
||||
public static readonly uint DefaultAlignment = 4;
|
||||
|
@ -81,19 +80,6 @@ namespace FirstPlugin
|
|||
}
|
||||
}
|
||||
|
||||
private void SatisfyFileSizeTable()
|
||||
{
|
||||
uint TotalDecompressedSize = IFileInfo.DecompressedSize;
|
||||
uint TotalCompressedSize = IFileInfo.CompressedSize;
|
||||
|
||||
if (Runtime.TpGamePath != "" && Directory.Exists(Runtime.TpGamePath))
|
||||
{
|
||||
string TablePath = $"{Runtime.TpGamePath}/FileSizeList.txt";
|
||||
|
||||
TPFileSizeTable.SetTables(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void Save(object sender, EventArgs args)
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
|
@ -104,15 +90,11 @@ namespace FirstPlugin
|
|||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
STFileSaver.SaveFileFormat(this, sfd.FileName);
|
||||
|
||||
SatisfyFileSizeTable();
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveFile(FileWriter writer)
|
||||
{
|
||||
ArchiveSizes.Clear();
|
||||
|
||||
writer.ByteOrder = Syroot.BinaryData.ByteOrder.BigEndian;
|
||||
|
||||
writer.WriteSignature("TMPK");
|
||||
|
@ -126,8 +108,6 @@ namespace FirstPlugin
|
|||
writer.Write(uint.MaxValue);
|
||||
writer.Write(files[i].FileData.Length); //Padding
|
||||
writer.Write(0); //Padding
|
||||
|
||||
ArchiveSizes.Add(files[i].FileName, (uint)files[i].FileData.Length);
|
||||
}
|
||||
for (int i = 0; i < files.Count; i++)
|
||||
{
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1 +0,0 @@
|
|||
81115f490d097ea68b62b86788a8bc08ded17c3e
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -189,7 +189,7 @@ namespace Switch_Toolbox.Library.IO
|
|||
{
|
||||
using (MemoryStream mem = new MemoryStream())
|
||||
{
|
||||
using (GZipStream source = new GZipStream(new MemoryStream(b), CompressionMode.Decompress))
|
||||
using (GZipStream source = new GZipStream(new MemoryStream(b), CompressionMode.Decompress, false))
|
||||
{
|
||||
source.CopyTo(mem);
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ namespace Switch_Toolbox.Library.IO
|
|||
using (MemoryStream mem = new MemoryStream())
|
||||
{
|
||||
using (GZipStream gzip = new GZipStream(mem,
|
||||
CompressionMode.Compress, true))
|
||||
CompressionMode.Compress))
|
||||
{
|
||||
gzip.Write(b, 0, b.Length);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Switch_Toolbox.Library.IO
|
|||
{
|
||||
//These always get created on loading a file,however not on creating a new file
|
||||
if (FileFormat.IFileInfo == null)
|
||||
throw new System.Exception("Make sure to impliment a IFileInfo instance if a format is being created!");
|
||||
throw new System.NotImplementedException("Make sure to impliment a IFileInfo instance if a format is being created!");
|
||||
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
FileFormat.FilePath = FileName;
|
||||
|
@ -119,7 +119,8 @@ namespace Switch_Toolbox.Library.IO
|
|||
TPFileSizeTable DecompressedFileTbl = new TPFileSizeTable();
|
||||
DecompressedFileTbl.ReadDecompressedTable(new FileReader($"{Runtime.TpGamePath}/DecompressedSizeList.txt"));
|
||||
|
||||
newFilePath = $"/DVDRoot/{newFilePath}";
|
||||
newFilePath = $"./DVDRoot/{newFilePath}";
|
||||
newFilePath = newFilePath.Replace(".gz", string.Empty);
|
||||
|
||||
//Write the decompressed file size
|
||||
if (DecompressedFileTbl.IsInDecompressedFileSizeList(newFilePath))
|
||||
|
@ -133,8 +134,11 @@ namespace Switch_Toolbox.Library.IO
|
|||
//Check if archive type
|
||||
bool IsArchive = false;
|
||||
foreach (var inter in FileFormat.GetType().GetInterfaces())
|
||||
if (inter.IsGenericType && inter.GetGenericTypeDefinition() == typeof(IArchiveFile))
|
||||
{
|
||||
if (inter == typeof(IArchiveFile))
|
||||
IsArchive = true;
|
||||
}
|
||||
|
||||
|
||||
//Write all the file sizes in the archive if it's an archive type
|
||||
if (IsArchive)
|
||||
|
@ -155,8 +159,8 @@ namespace Switch_Toolbox.Library.IO
|
|||
}
|
||||
}
|
||||
|
||||
CompressedFileTbl.WriteCompressedTable(new FileWriter($"{Runtime.TpGamePath}/FileSizeListTEST.txt"));
|
||||
DecompressedFileTbl.WriteDecompressedTable(new FileWriter($"{Runtime.TpGamePath}/DecompressedSizeListTEST.txt"));
|
||||
CompressedFileTbl.WriteCompressedTable(new FileWriter($"{Runtime.TpGamePath}/FileSizeList.txt"));
|
||||
DecompressedFileTbl.WriteDecompressedTable(new FileWriter($"{Runtime.TpGamePath}/DecompressedSizeList.txt"));
|
||||
}
|
||||
|
||||
return FileLog;
|
||||
|
|
Loading…
Reference in a new issue