diff --git a/tests/360/autotest_cod10_360.cpp b/tests/360/autotest_cod10_360.cpp index e923f2a..0cc1619 100644 --- a/tests/360/autotest_cod10_360.cpp +++ b/tests/360/autotest_cod10_360.cpp @@ -120,7 +120,7 @@ void AutoTest_COD10_360::testFactory() { const QString testName = "Factory ingest: " + fastFilePath; - FastFile* fastFile = FastFileFactory::Create(fastFilePath); + FastFile* fastFile = FastFile::Open(fastFilePath); const QString game = fastFile->GetGame(); bool correctGame = game == "COD10"; diff --git a/tests/360/autotest_cod11_360.cpp b/tests/360/autotest_cod11_360.cpp index b2f9809..c5e363a 100644 --- a/tests/360/autotest_cod11_360.cpp +++ b/tests/360/autotest_cod11_360.cpp @@ -120,7 +120,7 @@ void AutoTest_COD11_360::testFactory() { const QString testName = "Factory ingest: " + fastFilePath; - FastFile* fastFile = FastFileFactory::Create(fastFilePath); + FastFile* fastFile = FastFile::Open(fastFilePath); const QString game = fastFile->GetGame(); bool correctGame = game == "COD11"; diff --git a/tests/360/autotest_cod12_360.cpp b/tests/360/autotest_cod12_360.cpp index c8af006..972e0d4 100644 --- a/tests/360/autotest_cod12_360.cpp +++ b/tests/360/autotest_cod12_360.cpp @@ -238,7 +238,7 @@ void AutoTest_COD12_360::testFactory() { const QString testName = "Factory ingest: " + fastFilePath; - FastFile* fastFile = FastFileFactory::Create(fastFilePath); + FastFile* fastFile = FastFile::Open(fastFilePath); const QString game = fastFile->GetGame(); bool correctGame = game == "COD12"; diff --git a/tests/360/autotest_cod2_360.cpp b/tests/360/autotest_cod2_360.cpp index 28bc3a8..ffa266f 100644 --- a/tests/360/autotest_cod2_360.cpp +++ b/tests/360/autotest_cod2_360.cpp @@ -143,7 +143,7 @@ void AutoTest_COD2_360::testFactory() { const QString testName = "Factory ingest: " + fastFilePath; - FastFile* fastFile = FastFileFactory::Create(fastFilePath); + FastFile* fastFile = FastFile::Open(fastFilePath); const QString game = fastFile->GetGame(); bool correctGame = game == "COD2"; diff --git a/tests/360/autotest_cod5_360.cpp b/tests/360/autotest_cod5_360.cpp index 23f9cbb..26a469d 100644 --- a/tests/360/autotest_cod5_360.cpp +++ b/tests/360/autotest_cod5_360.cpp @@ -126,7 +126,7 @@ void AutoTest_COD5_360::testFactory() { const QString testName = "Factory ingest: " + fastFilePath; - FastFile* fastFile = FastFileFactory::Create(fastFilePath); + FastFile* fastFile = FastFile::Open(fastFilePath); const QString game = fastFile->GetGame(); bool correctGame = game == "COD5"; diff --git a/tests/360/autotest_cod6_360.cpp b/tests/360/autotest_cod6_360.cpp index 90e23da..c598a6f 100644 --- a/tests/360/autotest_cod6_360.cpp +++ b/tests/360/autotest_cod6_360.cpp @@ -146,7 +146,7 @@ void AutoTest_COD6_360::testFactory() { const QString testName = "Factory ingest: " + fastFilePath; - FastFile* fastFile = FastFileFactory::Create(fastFilePath); + FastFile* fastFile = FastFile::Open(fastFilePath); const QString game = fastFile->GetGame(); bool correctGame = game == "COD6"; diff --git a/tests/360/autotest_cod7_360.cpp b/tests/360/autotest_cod7_360.cpp index 612b1a6..6df2a19 100644 --- a/tests/360/autotest_cod7_360.cpp +++ b/tests/360/autotest_cod7_360.cpp @@ -67,45 +67,6 @@ void AutoTest_COD7_360::testDecompression() { QByteArray fileName(32, Qt::Uninitialized); fastFileStream.readRawData(fileName.data(), 32); - // Build the IV table from the fileName. - QByteArray ivTable = Encryption::InitIVTable(fileName); - - // Skip the RSA signature (256 bytes). - QByteArray rsaSignature(256, Qt::Uninitialized); - fastFileStream.readRawData(rsaSignature.data(), 256); - - // Now the stream should be positioned at 0x13C, where sections begin. - int sectionIndex = 0; - while (true) { - qint32 sectionSize = 0; - fastFileStream >> sectionSize; - if (sectionSize == 0) - break; - - // Read the section data. - QByteArray sectionData; - sectionData.resize(sectionSize); - fastFileStream.readRawData(sectionData.data(), sectionSize); - - // Compute the IV for this section. - QByteArray iv = Encryption::GetIV(ivTable, sectionIndex); - - // Decrypt the section using Salsa20. - QByteArray decData = Encryption::salsa20DecryptSection(sectionData, key, iv); - - // Compute SHA1 hash of the decrypted data. - QByteArray sectionHash = QCryptographicHash::hash(decData, QCryptographicHash::Sha1); - - // Update the IV table based on the section hash. - Encryption::UpdateIVTable(ivTable, sectionIndex, sectionHash); - - // Build a compressed data buffer by prepending the two-byte zlib header. - decompressedData.append(Compression::DecompressDeflate(decData)); - - sectionIndex++; - } - - const QByteArray testZoneData = decompressedData; // Verify the decompressed data via its embedded zone size. @@ -149,7 +110,7 @@ void AutoTest_COD7_360::testCompression() { zoneFile.close(); QByteArray compressedData; - QByteArray key = QByteArray::fromHex("1ac1d12d527c59b40eca619120ff8217ccff09cd16896f81b829c7f52793405d"); + //QByteArray key = QByteArray::fromHex("1ac1d12d527c59b40eca619120ff8217ccff09cd16896f81b829c7f52793405d"); // Read the original fastfile header to recover metadata (filename, IV table, etc.) QString ffPath = zoneFilePath; @@ -163,40 +124,17 @@ void AutoTest_COD7_360::testCompression() { originalFF.read(fileName.data(), 32); originalFF.close(); - QByteArray ivTable = Encryption::InitIVTable(fileName); - // Rebuild sections from zone data QDataStream zoneStream(zoneData); zoneStream.setByteOrder(QDataStream::BigEndian); quint32 zoneSize; zoneStream >> zoneSize; - QByteArray remainingData = zoneData.mid(4); // exclude size field - const int chunkSize = 0x40000; // 256KB max section size + //QByteArray remainingData = zoneData.mid(4); // exclude size field QDataStream fastFileStreamOut(&compressedData, QIODevice::WriteOnly); fastFileStreamOut.setByteOrder(QDataStream::BigEndian); - int sectionIndex = 0; - int offset = 0; - while (offset < remainingData.size()) { - int sectionLen = qMin(chunkSize, remainingData.size() - offset); - QByteArray chunk = remainingData.mid(offset, sectionLen); - - QByteArray deflated = Compression::CompressDeflate(chunk); - - QByteArray iv = Encryption::GetIV(ivTable, sectionIndex); - QByteArray encrypted = Encryption::salsa20DecryptSection(deflated, key, iv); - QByteArray sha1 = QCryptographicHash::hash(chunk, QCryptographicHash::Sha1); - Encryption::UpdateIVTable(ivTable, sectionIndex, sha1); - - fastFileStreamOut << static_cast(encrypted.size()); - fastFileStreamOut.writeRawData(encrypted.constData(), encrypted.size()); - - offset += sectionLen; - sectionIndex++; - } - // Write 0 section size terminator fastFileStreamOut << static_cast(0); diff --git a/tests/360/autotest_cod8_360.cpp b/tests/360/autotest_cod8_360.cpp index 7bee4d1..b8a0e80 100644 --- a/tests/360/autotest_cod8_360.cpp +++ b/tests/360/autotest_cod8_360.cpp @@ -139,7 +139,7 @@ void AutoTest_COD8_360::testFactory() { const QString testName = "Factory ingest: " + fastFilePath; - FastFile* fastFile = FastFileFactory::Create(fastFilePath); + FastFile* fastFile = FastFile::Open(fastFilePath); const QString game = fastFile->GetGame(); bool correctGame = game == "COD8"; diff --git a/tests/360/autotest_cod9_360.cpp b/tests/360/autotest_cod9_360.cpp index 57905ff..caac420 100644 --- a/tests/360/autotest_cod9_360.cpp +++ b/tests/360/autotest_cod9_360.cpp @@ -120,7 +120,7 @@ void AutoTest_COD9_360::testFactory() { const QString testName = "Factory ingest: " + fastFilePath; - FastFile* fastFile = FastFileFactory::Create(fastFilePath); + FastFile* fastFile = FastFile::Open(fastFilePath); const QString game = fastFile->GetGame(); bool correctGame = game == "COD9";