1
0
mirror of synced 2025-03-01 16:10:52 +01:00

Quick SDF fix

This commit is contained in:
KillzXGaming 2019-06-18 15:48:18 -04:00
parent b0cecddee4
commit b1b9230146
2 changed files with 8 additions and 4 deletions

View File

@ -104,8 +104,6 @@ namespace FirstPlugin
//Read last id //Read last id
endId = new SDFTOC_ID(reader); endId = new SDFTOC_ID(reader);
MessageBox.Show("Note! Support for this format is experimental. The tool will only load < 4000 files atm due to slow loading");
for (int i = 0; i < FileEntries.Count; i++) for (int i = 0; i < FileEntries.Count; i++)
files.Add(FileEntries[i]); files.Add(FileEntries[i]);
} }
@ -199,6 +197,10 @@ namespace FirstPlugin
set { base.FileData = value;} set { base.FileData = value;}
} }
public override string FileSize => STMath.GetFileSize((long)DecompressedSize, 4);
public override object DisplayProperties => this;
public override IFileFormat OpenFile() public override IFileFormat OpenFile()
{ {
var FileFormat = STFileLoader.OpenFileFormat( var FileFormat = STFileLoader.OpenFileFormat(
@ -226,8 +228,7 @@ namespace FirstPlugin
if (!Directory.Exists(FolerPath)) if (!Directory.Exists(FolerPath))
Directory.CreateDirectory(FolerPath); Directory.CreateDirectory(FolerPath);
block.Dispose(); Data.Add(stream.getSection((int)Offset, (int)DecompressedSize));
return stream.getSection((int)Offset, (int)DecompressedSize);
} }
else else
{ {

View File

@ -39,6 +39,9 @@ namespace Switch_Toolbox.Library
{ {
using (var reader = new Switch_Toolbox.Library.IO.FileReader(stream, true)) using (var reader = new Switch_Toolbox.Library.IO.FileReader(stream, true))
{ {
if (reader.BaseStream.Length < 30)
return false;
reader.Position = reader.BaseStream.Length - 18; reader.Position = reader.BaseStream.Length - 18;
bool IsValidMagic = reader.ReadString(10) == MagicFileConstant; bool IsValidMagic = reader.ReadString(10) == MagicFileConstant;
return IsValidMagic || Utils.GetExtension(FileName) == ".tga"; return IsValidMagic || Utils.GetExtension(FileName) == ".tga";