Skip to content

Commit

Permalink
Fix TPP PC QAR extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
emoose committed Oct 1, 2015
1 parent 62240ca commit 148ee84
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion GzsTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public static void ReadCryptedSection(string path)
{
using (FileStream input = new FileStream(path, FileMode.Open))
{
var retVal = QarEntry.GetOriginalData(input, 0, 0, (uint)input.Length, 2);
var retVal = QarEntry.GetOriginalData(input, false, 0, 0, (uint)input.Length, 2);

File.WriteAllBytes(path + ".dec", retVal.Item3.ToArray());
}
Expand Down
6 changes: 3 additions & 3 deletions GzsTool/Qar/QarEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private Func<Stream> ReadDataLazy(Stream input)
};
}

public static Tuple<uint, bool, Stream> GetOriginalData(Stream input, ulong hash, long dataOffset, uint dataSize, int qarVersion = 3)
public static Tuple<uint, bool, Stream> GetOriginalData(Stream input, bool isCompressed, ulong hash, long dataOffset, uint dataSize, int qarVersion = 3)
{
input.Position = dataOffset;
BinaryReader reader = new BinaryReader(input, Encoding.Default, true);
Expand Down Expand Up @@ -163,7 +163,7 @@ private Func<Stream> ReadDataLazy(Stream input)
if (qarVersion == 3)
Decrypt1(sectionData, hashLow: (uint)(hash & 0xFFFFFFFF));

bool compressed = false;
bool compressed = isCompressed;

uint magicEntry = BitConverter.ToUInt32(sectionData, 0);
if (magicEntry == 0xA0F8EFE6)
Expand Down Expand Up @@ -203,7 +203,7 @@ private Func<Stream> ReadDataLazy(Stream input)

private Stream ReadData(Stream input)
{
var retVal = GetOriginalData(input, Hash, DataOffset, UncompressedSize, QarVersion);
var retVal = GetOriginalData(input, Compressed, Hash, DataOffset, UncompressedSize, QarVersion);
Key = retVal.Item1;
Compressed = retVal.Item2;
return retVal.Item3;
Expand Down
2 changes: 1 addition & 1 deletion GzsTool/Qar/QarFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public override void Read(Stream input)
reader.BaseStream.Position = (long)sectionOffset;

var entry = new QarEntry();
entry.Read(reader);
entry.Read(reader, QarVersion);
Entries.Add(entry);
}
}
Expand Down

0 comments on commit 148ee84

Please sign in to comment.