add fastfile and zonefile support for all cods
This commit is contained in:
parent
588d03ad8f
commit
a90f1017f7
@ -1,6 +1,7 @@
|
||||
#include "encryption.h"
|
||||
#include "QtZlib/zlib.h"
|
||||
#include "ecrypt-sync.h"
|
||||
#include "compression.h"
|
||||
|
||||
void Encryption::Convert32BitTo8Bit(quint32 value, quint8 *array) {
|
||||
array[0] = static_cast<quint8>(value >> 0);
|
||||
@ -350,7 +351,7 @@ void Encryption::generateNewIV(int index, const QByteArray &hash, QByteArray &iv
|
||||
ivCounter[index]++;
|
||||
}
|
||||
|
||||
QByteArray Encryption::decryptFastFile(const QByteArray &fastFileData)
|
||||
QByteArray Encryption::decryptFastFile_BO2(const QByteArray &fastFileData)
|
||||
{
|
||||
const QByteArray bo2_salsa20_key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
|
||||
@ -438,3 +439,68 @@ QByteArray Encryption::decryptFastFile(const QByteArray &fastFileData)
|
||||
|
||||
return finalFastFile;
|
||||
}
|
||||
|
||||
QByteArray Encryption::decryptFastFile_BO3(const QByteArray &fastFileData) {
|
||||
const QByteArray salsaKey = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
|
||||
QByteArray ivTable(0xFB0, 0);
|
||||
fillIVTable(fastFileData, ivTable, 0xFB0 - 1);
|
||||
|
||||
QVector<quint32> ivCounter(4, 1);
|
||||
QDataStream stream(fastFileData);
|
||||
stream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
QByteArray finalFastFile;
|
||||
QByteArray sha1Hash(20, 0);
|
||||
QByteArray ivPtr(8, 0);
|
||||
int chunkIndex = 0;
|
||||
|
||||
while (!stream.atEnd()) {
|
||||
if (stream.device()->bytesAvailable() < 4) {
|
||||
qWarning() << "No sufficient data for chunk size at offset:" << stream.device()->pos();
|
||||
break;
|
||||
}
|
||||
|
||||
quint32 dataLength;
|
||||
stream >> dataLength;
|
||||
|
||||
if (dataLength == 0 || dataLength > fastFileData.size() - stream.device()->pos()) {
|
||||
qWarning() << "Invalid data length at offset:" << stream.device()->pos();
|
||||
break;
|
||||
}
|
||||
|
||||
fillIV(chunkIndex % 4, ivPtr, ivTable, ivCounter);
|
||||
|
||||
ECRYPT_ctx x;
|
||||
ECRYPT_keysetup(&x, reinterpret_cast<const u8*>(salsaKey.constData()), 256, 0);
|
||||
ECRYPT_ivsetup(&x, reinterpret_cast<const u8*>(ivPtr.constData()));
|
||||
|
||||
QByteArray encryptedBlock = fastFileData.mid(stream.device()->pos(), dataLength);
|
||||
QByteArray decryptedBlock(dataLength, Qt::Uninitialized);
|
||||
|
||||
ECRYPT_decrypt_bytes(&x,
|
||||
reinterpret_cast<const u8*>(encryptedBlock.constData()),
|
||||
reinterpret_cast<u8*>(decryptedBlock.data()),
|
||||
dataLength);
|
||||
|
||||
// SHA1 hash update
|
||||
sha1Hash = QCryptographicHash::hash(decryptedBlock, QCryptographicHash::Sha1);
|
||||
|
||||
// Decompress (ZLIB raw DEFLATE)
|
||||
QByteArray decompressedData = Compression::DecompressDeflate(decryptedBlock);
|
||||
if (decompressedData.isEmpty()) {
|
||||
qWarning() << "Failed decompression at chunk index:" << chunkIndex;
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
finalFastFile.append(decompressedData);
|
||||
|
||||
// Update IV table using SHA1
|
||||
generateNewIV(chunkIndex % 4, sha1Hash, ivTable, ivCounter);
|
||||
|
||||
stream.skipRawData(dataLength);
|
||||
chunkIndex++;
|
||||
}
|
||||
|
||||
return finalFastFile;
|
||||
}
|
||||
|
||||
@ -46,7 +46,8 @@ public:
|
||||
|
||||
static void generateNewIV(int index, const QByteArray& hash, QByteArray& ivTable, QVector<quint32>& ivCounter);
|
||||
|
||||
static QByteArray decryptFastFile(const QByteArray& fastFileData);
|
||||
static QByteArray decryptFastFile_BO2(const QByteArray& fastFileData);
|
||||
static QByteArray decryptFastFile_BO3(const QByteArray& fastFileData);
|
||||
};
|
||||
|
||||
#endif // ENCRYPTION_H
|
||||
|
||||
@ -17,4 +17,16 @@ HEADERS += \
|
||||
config_win32.h \
|
||||
sha1.h
|
||||
|
||||
app.depends += \
|
||||
compression
|
||||
|
||||
LIBS += \
|
||||
-L$$OUT_PWD/../ -lcompression
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/../compression
|
||||
|
||||
DEPENDPATH += \
|
||||
$$PWD/../compression
|
||||
|
||||
DESTDIR = $$OUT_PWD/../
|
||||
|
||||
115
libs/fastfile/360/fastfile_cod10_360.cpp
Normal file
115
libs/fastfile/360/fastfile_cod10_360.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
#include "fastfile_cod10_360.h"
|
||||
#include "zonefile_cod10_360.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD10_360::FastFile_COD10_360()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetPlatform("360");
|
||||
SetGame("COD10");
|
||||
}
|
||||
|
||||
FastFile_COD10_360::FastFile_COD10_360(const QByteArray& aData)
|
||||
: FastFile_COD10_360() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD10_360::FastFile_COD10_360(const QString aFilePath)
|
||||
: FastFile_COD10_360() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD10_360::~FastFile_COD10_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD10_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD10_360::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).section(".", 0, 0);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem + ".ff";
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD10_360::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
QByteArray fileName(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileName.data(), 32);
|
||||
|
||||
// Skip the RSA signature (256 bytes).
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
decompressedData = Encryption::decryptFastFile_BO2(aData);
|
||||
|
||||
// For COD9, write out the complete decompressed zone for testing.
|
||||
QFile testFile("exports/" + GetStem() + ".zone");
|
||||
if(testFile.open(QIODevice::WriteOnly)) {
|
||||
testFile.write(decompressedData);
|
||||
testFile.close();
|
||||
}
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD10_360 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD10_360>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/360/fastfile_cod10_360.h
Normal file
20
libs/fastfile/360/fastfile_cod10_360.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD10_360_H
|
||||
#define FASTFILE_COD10_360_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD10_360 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD10_360();
|
||||
FastFile_COD10_360(const QByteArray& aData);
|
||||
FastFile_COD10_360(const QString aFilePath);
|
||||
~FastFile_COD10_360();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD10_360_H
|
||||
107
libs/fastfile/360/fastfile_cod11_360.cpp
Normal file
107
libs/fastfile/360/fastfile_cod11_360.cpp
Normal file
@ -0,0 +1,107 @@
|
||||
#include "fastfile_cod11_360.h"
|
||||
#include "zonefile_cod11_360.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD11_360::FastFile_COD11_360()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD11");
|
||||
SetPlatform("PC");
|
||||
}
|
||||
|
||||
FastFile_COD11_360::FastFile_COD11_360(const QByteArray& aData)
|
||||
: FastFile_COD11_360() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD11_360::FastFile_COD11_360(const QString aFilePath)
|
||||
: FastFile_COD11_360() {
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD11_360::~FastFile_COD11_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD11_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD11_360::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).split('.').first();
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD11_360::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Prepare data stream for parsing
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Verify magic header
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "TAff0000") {
|
||||
qWarning() << "Invalid fast file magic for COD12!";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Skip: File size (4 bytes), flags/version (4 bytes), unknown (8 bytes), build tag (32 bytes), RSA signature (256 bytes)
|
||||
fastFileStream.skipRawData(4 + 4 + 8 + 32 + 256); // total 304 bytes skipped so far + 8 bytes magic = 312 bytes at correct position.
|
||||
|
||||
// Correctly positioned at 0x138
|
||||
QByteArray encryptedData = aData.mid(0x138);
|
||||
decompressedData = Encryption::decryptFastFile_BO3(encryptedData);
|
||||
|
||||
// Output for verification/testing
|
||||
Utils::ExportData(GetStem() + ".zone", decompressedData);
|
||||
|
||||
// Load the zone file with decompressed data
|
||||
ZoneFile_COD11_360 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
if (!zoneFile.Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
}
|
||||
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD11_360>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/360/fastfile_cod11_360.h
Normal file
20
libs/fastfile/360/fastfile_cod11_360.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD11_360_H
|
||||
#define FASTFILE_COD11_360_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD11_360 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD11_360();
|
||||
FastFile_COD11_360(const QByteArray &aData);
|
||||
FastFile_COD11_360(const QString aFilePath);
|
||||
~FastFile_COD11_360();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD11_360_H
|
||||
107
libs/fastfile/360/fastfile_cod12_360.cpp
Normal file
107
libs/fastfile/360/fastfile_cod12_360.cpp
Normal file
@ -0,0 +1,107 @@
|
||||
#include "fastfile_cod12_360.h"
|
||||
#include "zonefile_cod12_360.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD12_360::FastFile_COD12_360()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD12");
|
||||
SetPlatform("PC");
|
||||
}
|
||||
|
||||
FastFile_COD12_360::FastFile_COD12_360(const QByteArray& aData)
|
||||
: FastFile_COD12_360() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD12_360::FastFile_COD12_360(const QString aFilePath)
|
||||
: FastFile_COD12_360() {
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD12_360::~FastFile_COD12_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD12_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD12_360::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).split('.').first();
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD12_360::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Prepare data stream for parsing
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Verify magic header
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "TAff0000") {
|
||||
qWarning() << "Invalid fast file magic for COD12!";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Skip: File size (4 bytes), flags/version (4 bytes), unknown (8 bytes), build tag (32 bytes), RSA signature (256 bytes)
|
||||
fastFileStream.skipRawData(4 + 4 + 8 + 32 + 256); // total 304 bytes skipped so far + 8 bytes magic = 312 bytes at correct position.
|
||||
|
||||
// Correctly positioned at 0x138
|
||||
QByteArray encryptedData = aData.mid(0x138);
|
||||
decompressedData = Encryption::decryptFastFile_BO3(encryptedData);
|
||||
|
||||
// Output for verification/testing
|
||||
Utils::ExportData(GetStem() + ".zone", decompressedData);
|
||||
|
||||
// Load the zone file with decompressed data
|
||||
ZoneFile_COD12_360 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
if (!zoneFile.Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
}
|
||||
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD12_360>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/360/fastfile_cod12_360.h
Normal file
20
libs/fastfile/360/fastfile_cod12_360.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD12_360_H
|
||||
#define FASTFILE_COD12_360_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD12_360 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD12_360();
|
||||
FastFile_COD12_360(const QByteArray &aData);
|
||||
FastFile_COD12_360(const QString aFilePath);
|
||||
~FastFile_COD12_360();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD12_360_H
|
||||
89
libs/fastfile/360/fastfile_cod2_360.cpp
Normal file
89
libs/fastfile/360/fastfile_cod2_360.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
#include "fastfile_cod2_360.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "zonefile_cod2_360.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD2_360::FastFile_COD2_360()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetPlatform("360");
|
||||
SetGame("COD2");
|
||||
}
|
||||
|
||||
FastFile_COD2_360::FastFile_COD2_360(const QByteArray& aData)
|
||||
: FastFile_COD2_360() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD2_360::FastFile_COD2_360(const QString aFilePath)
|
||||
: FastFile_COD2_360() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD2_360::~FastFile_COD2_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD2_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD2_360::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).section(".", 0, 0);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD2_360::Load(const QByteArray aData) {
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
Utils::ReadUntilHex(&fastFileStream, "78");
|
||||
QByteArray compressedData = aData.mid(fastFileStream.device()->pos());
|
||||
QByteArray decompressedData = Compression::DecompressZLIB(compressedData);
|
||||
|
||||
Utils::ExportData(GetStem() + ".zone", decompressedData);
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD2_360 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD2_360>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/360/fastfile_cod2_360.h
Normal file
20
libs/fastfile/360/fastfile_cod2_360.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD2_360_H
|
||||
#define FASTFILE_COD2_360_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD2_360 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD2_360();
|
||||
FastFile_COD2_360(const QByteArray& aData);
|
||||
FastFile_COD2_360(const QString aFilePath);
|
||||
~FastFile_COD2_360();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD2_360_H
|
||||
93
libs/fastfile/360/fastfile_cod4_360.cpp
Normal file
93
libs/fastfile/360/fastfile_cod4_360.cpp
Normal file
@ -0,0 +1,93 @@
|
||||
#include "fastfile_cod4_360.h"
|
||||
#include "zonefile_cod4_360.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "statusbarmanager.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD4_360::FastFile_COD4_360()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetPlatform("360");
|
||||
SetGame("COD4");
|
||||
}
|
||||
|
||||
FastFile_COD4_360::FastFile_COD4_360(const QByteArray& aData)
|
||||
: FastFile_COD4_360() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD4_360::FastFile_COD4_360(const QString aFilePath)
|
||||
: FastFile_COD4_360() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD4_360::~FastFile_COD4_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD4_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD4_360::Load(const QString aFilePath) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD5 Fast File w/path", 1000);
|
||||
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
QString fastFileStem = aFilePath.split('/').last().replace(".ff", "");
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD4_360::Load(const QByteArray aData) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD5 Fast File w/data", 1000);
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// For COD5, simply decompress from offset 12.
|
||||
decompressedData = Compression::DecompressZLIB(aData.mid(12));
|
||||
|
||||
Utils::ExportData(GetStem() + ".zone", decompressedData);
|
||||
|
||||
ZoneFile_COD4_360 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD4_360>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/360/fastfile_cod4_360.h
Normal file
20
libs/fastfile/360/fastfile_cod4_360.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD4_360_H
|
||||
#define FASTFILE_COD4_360_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD4_360 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD4_360();
|
||||
FastFile_COD4_360(const QByteArray &aData);
|
||||
FastFile_COD4_360(const QString aFilePath);
|
||||
~FastFile_COD4_360();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD4_360_H
|
||||
89
libs/fastfile/360/fastfile_cod5_360.cpp
Normal file
89
libs/fastfile/360/fastfile_cod5_360.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
#include "fastfile_cod5_360.h"
|
||||
#include "zonefile_cod5_360.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "statusbarmanager.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD5_360::FastFile_COD5_360()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetPlatform("360");
|
||||
SetGame("COD5");
|
||||
}
|
||||
|
||||
FastFile_COD5_360::FastFile_COD5_360(const QByteArray& aData)
|
||||
: FastFile_COD5_360() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD5_360::FastFile_COD5_360(const QString aFilePath)
|
||||
: FastFile_COD5_360() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD5_360::~FastFile_COD5_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD5_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD5_360::Load(const QString aFilePath) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD5 Fast File w/path", 1000);
|
||||
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
QString fastFileStem = aFilePath.split('/').last().replace(".ff", "");
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD5_360::Load(const QByteArray aData) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD5 Fast File w/data", 1000);
|
||||
QByteArray decompressedData;
|
||||
|
||||
// For COD5, simply decompress from offset 12.
|
||||
decompressedData = Compression::DecompressZLIB(aData.mid(12));
|
||||
|
||||
Utils::ExportData(GetStem() + ".zone", decompressedData);
|
||||
|
||||
ZoneFile_COD5_360 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD5_360>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/360/fastfile_cod5_360.h
Normal file
20
libs/fastfile/360/fastfile_cod5_360.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD5_360_H
|
||||
#define FASTFILE_COD5_360_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD5_360 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD5_360();
|
||||
FastFile_COD5_360(const QByteArray &aData);
|
||||
FastFile_COD5_360(const QString aFilePath);
|
||||
~FastFile_COD5_360();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD5_360_H
|
||||
151
libs/fastfile/360/fastfile_cod6_360.cpp
Normal file
151
libs/fastfile/360/fastfile_cod6_360.cpp
Normal file
@ -0,0 +1,151 @@
|
||||
#include "fastfile_cod6_360.h"
|
||||
#include "zonefile_cod6_360.h"
|
||||
|
||||
#include "compression.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD6_360::FastFile_COD6_360()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetPlatform("360");
|
||||
SetGame("COD6");
|
||||
}
|
||||
|
||||
FastFile_COD6_360::FastFile_COD6_360(const QByteArray& aData)
|
||||
: FastFile_COD6_360() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD6_360::FastFile_COD6_360(const QString aFilePath)
|
||||
: FastFile_COD6_360() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD6_360::~FastFile_COD6_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD6_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD6_360::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD6_360::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD6_360 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key = QByteArray::fromHex("1ac1d12d527c59b40eca619120ff8217ccff09cd16896f81b829c7f52793405d");
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
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;
|
||||
qDebug() << "Section index:" << sectionIndex << "Size:" << sectionSize
|
||||
<< "Pos:" << fastFileStream.device()->pos();
|
||||
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.
|
||||
QByteArray compressedData;
|
||||
compressedData.append(char(0x78));
|
||||
compressedData.append(char(0x01));
|
||||
compressedData.append(decData);
|
||||
|
||||
decompressedData.append(Compression::DecompressZLIB(compressedData));
|
||||
|
||||
sectionIndex++;
|
||||
}
|
||||
|
||||
zoneFile.Load(decompressedData);
|
||||
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD6_360>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/360/fastfile_cod6_360.h
Normal file
20
libs/fastfile/360/fastfile_cod6_360.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD6_360_H
|
||||
#define FASTFILE_COD6_360_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD6_360 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD6_360();
|
||||
FastFile_COD6_360(const QByteArray& aData);
|
||||
FastFile_COD6_360(const QString aFilePath);
|
||||
~FastFile_COD6_360();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD6_360_H
|
||||
151
libs/fastfile/360/fastfile_cod7_360.cpp
Normal file
151
libs/fastfile/360/fastfile_cod7_360.cpp
Normal file
@ -0,0 +1,151 @@
|
||||
#include "fastfile_cod7_360.h"
|
||||
#include "zonefile_cod7_360.h"
|
||||
|
||||
#include "compression.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD7_360::FastFile_COD7_360()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetPlatform("360");
|
||||
SetGame("COD7");
|
||||
}
|
||||
|
||||
FastFile_COD7_360::FastFile_COD7_360(const QByteArray& aData)
|
||||
: FastFile_COD7_360() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD7_360::FastFile_COD7_360(const QString aFilePath)
|
||||
: FastFile_COD7_360() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD7_360::~FastFile_COD7_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD7_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD7_360::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD7_360::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD7_360 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key = QByteArray::fromHex("1ac1d12d527c59b40eca619120ff8217ccff09cd16896f81b829c7f52793405d");
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
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;
|
||||
qDebug() << "Section index:" << sectionIndex << "Size:" << sectionSize
|
||||
<< "Pos:" << fastFileStream.device()->pos();
|
||||
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.
|
||||
QByteArray compressedData;
|
||||
compressedData.append(char(0x78));
|
||||
compressedData.append(char(0x01));
|
||||
compressedData.append(decData);
|
||||
|
||||
decompressedData.append(Compression::DecompressZLIB(compressedData));
|
||||
|
||||
sectionIndex++;
|
||||
}
|
||||
|
||||
zoneFile.Load(decompressedData);
|
||||
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD7_360>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/360/fastfile_cod7_360.h
Normal file
20
libs/fastfile/360/fastfile_cod7_360.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD7_360_H
|
||||
#define FASTFILE_COD7_360_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD7_360 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD7_360();
|
||||
FastFile_COD7_360(const QByteArray& aData);
|
||||
FastFile_COD7_360(const QString aFilePath);
|
||||
~FastFile_COD7_360();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD7_360_H
|
||||
115
libs/fastfile/360/fastfile_cod8_360.cpp
Normal file
115
libs/fastfile/360/fastfile_cod8_360.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
#include "fastfile_cod8_360.h"
|
||||
#include "zonefile_cod8_360.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD8_360::FastFile_COD8_360()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetPlatform("360");
|
||||
SetGame("COD8");
|
||||
}
|
||||
|
||||
FastFile_COD8_360::FastFile_COD8_360(const QByteArray& aData)
|
||||
: FastFile_COD8_360() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD8_360::FastFile_COD8_360(const QString aFilePath)
|
||||
: FastFile_COD8_360() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD8_360::~FastFile_COD8_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD8_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD8_360::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).section(".", 0, 0);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem + ".ff";
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD8_360::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
QByteArray fileName(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileName.data(), 32);
|
||||
|
||||
// Skip the RSA signature (256 bytes).
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
decompressedData = Encryption::decryptFastFile_BO2(aData);
|
||||
|
||||
// For COD9, write out the complete decompressed zone for testing.
|
||||
QFile testFile("exports/" + GetStem() + ".zone");
|
||||
if(testFile.open(QIODevice::WriteOnly)) {
|
||||
testFile.write(decompressedData);
|
||||
testFile.close();
|
||||
}
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD8_360 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD8_360>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/360/fastfile_cod8_360.h
Normal file
20
libs/fastfile/360/fastfile_cod8_360.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD8_360_H
|
||||
#define FASTFILE_COD8_360_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD8_360 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD8_360();
|
||||
FastFile_COD8_360(const QByteArray& aData);
|
||||
FastFile_COD8_360(const QString aFilePath);
|
||||
~FastFile_COD8_360();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD8_360_H
|
||||
115
libs/fastfile/360/fastfile_cod9_360.cpp
Normal file
115
libs/fastfile/360/fastfile_cod9_360.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
#include "fastfile_cod9_360.h"
|
||||
#include "zonefile_cod9_360.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD9_360::FastFile_COD9_360()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetPlatform("360");
|
||||
SetGame("COD9");
|
||||
}
|
||||
|
||||
FastFile_COD9_360::FastFile_COD9_360(const QByteArray& aData)
|
||||
: FastFile_COD9_360() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD9_360::FastFile_COD9_360(const QString aFilePath)
|
||||
: FastFile_COD9_360() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD9_360::~FastFile_COD9_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD9_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD9_360::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).section(".", 0, 0);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem + ".ff";
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD9_360::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
QByteArray fileName(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileName.data(), 32);
|
||||
|
||||
// Skip the RSA signature (256 bytes).
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
decompressedData = Encryption::decryptFastFile_BO2(aData);
|
||||
|
||||
// For COD9, write out the complete decompressed zone for testing.
|
||||
QFile testFile("exports/" + GetStem() + ".zone");
|
||||
if(testFile.open(QIODevice::WriteOnly)) {
|
||||
testFile.write(decompressedData);
|
||||
testFile.close();
|
||||
}
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD9_360 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD9_360>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/360/fastfile_cod9_360.h
Normal file
20
libs/fastfile/360/fastfile_cod9_360.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD9_360_H
|
||||
#define FASTFILE_COD9_360_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD9_360 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD9_360();
|
||||
FastFile_COD9_360(const QByteArray& aData);
|
||||
FastFile_COD9_360(const QString aFilePath);
|
||||
~FastFile_COD9_360();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD9_360_H
|
||||
137
libs/fastfile/PC/fastfile_cod10_pc.cpp
Normal file
137
libs/fastfile/PC/fastfile_cod10_pc.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
#include "fastfile_cod10_pc.h"
|
||||
#include "zonefile_cod10_pc.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD10_PC::FastFile_COD10_PC()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD10");
|
||||
SetPlatform("PC");
|
||||
}
|
||||
|
||||
FastFile_COD10_PC::FastFile_COD10_PC(const QByteArray& aData)
|
||||
: FastFile_COD10_PC() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD10_PC::FastFile_COD10_PC(const QString aFilePath)
|
||||
: FastFile_COD10_PC() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD10_PC::~FastFile_COD10_PC() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD10_PC::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD10_PC::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).section(".", 0, 0);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem + ".ff";
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD10_PC::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD9");
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
if (GetPlatform() == "PC") {
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
}
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
if (GetPlatform() == "360") {
|
||||
key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
} else if (GetPlatform() == "PC") {
|
||||
key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
}
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
QByteArray fileName(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileName.data(), 32);
|
||||
|
||||
// Skip the RSA signature (256 bytes).
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
if (GetPlatform() == "360") {
|
||||
//decompressedData = Compressor::cod9_decryptFastFile(aData);
|
||||
} else if (GetPlatform() == "PC") {
|
||||
decompressedData = Encryption::decryptFastFile_BO2(aData);
|
||||
}
|
||||
|
||||
// For COD9, write out the complete decompressed zone for testing.
|
||||
QFile testFile("exports/" + GetStem() + ".zone");
|
||||
if(testFile.open(QIODevice::WriteOnly)) {
|
||||
testFile.write(decompressedData);
|
||||
testFile.close();
|
||||
}
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD10_PC zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD10_PC>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PC/fastfile_cod10_pc.h
Normal file
20
libs/fastfile/PC/fastfile_cod10_pc.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD10_PC_H
|
||||
#define FASTFILE_COD10_PC_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD10_PC : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD10_PC();
|
||||
FastFile_COD10_PC(const QByteArray &aData);
|
||||
FastFile_COD10_PC(const QString aFilePath);
|
||||
~FastFile_COD10_PC();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD10_PC_H
|
||||
137
libs/fastfile/PC/fastfile_cod11_pc.cpp
Normal file
137
libs/fastfile/PC/fastfile_cod11_pc.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
#include "fastfile_cod11_pc.h"
|
||||
#include "zonefile_cod11_pc.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD11_PC::FastFile_COD11_PC()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD11");
|
||||
SetPlatform("PC");
|
||||
}
|
||||
|
||||
FastFile_COD11_PC::FastFile_COD11_PC(const QByteArray& aData)
|
||||
: FastFile_COD11_PC() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD11_PC::FastFile_COD11_PC(const QString aFilePath)
|
||||
: FastFile_COD11_PC() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD11_PC::~FastFile_COD11_PC() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD11_PC::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD11_PC::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).section(".", 0, 0);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem + ".ff";
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD11_PC::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD9");
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
if (GetPlatform() == "PC") {
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
}
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
if (GetPlatform() == "360") {
|
||||
key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
} else if (GetPlatform() == "PC") {
|
||||
key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
}
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
QByteArray fileName(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileName.data(), 32);
|
||||
|
||||
// Skip the RSA signature (256 bytes).
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
if (GetPlatform() == "360") {
|
||||
//decompressedData = Compressor::cod9_decryptFastFile(aData);
|
||||
} else if (GetPlatform() == "PC") {
|
||||
decompressedData = Encryption::decryptFastFile_BO2(aData);
|
||||
}
|
||||
|
||||
// For COD9, write out the complete decompressed zone for testing.
|
||||
QFile testFile("exports/" + GetStem() + ".zone");
|
||||
if(testFile.open(QIODevice::WriteOnly)) {
|
||||
testFile.write(decompressedData);
|
||||
testFile.close();
|
||||
}
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD11_PC zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD11_PC>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PC/fastfile_cod11_pc.h
Normal file
20
libs/fastfile/PC/fastfile_cod11_pc.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD11_PC_H
|
||||
#define FASTFILE_COD11_PC_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD11_PC : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD11_PC();
|
||||
FastFile_COD11_PC(const QByteArray &aData);
|
||||
FastFile_COD11_PC(const QString aFilePath);
|
||||
~FastFile_COD11_PC();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD11_PC_H
|
||||
151
libs/fastfile/PC/fastfile_cod12_pc.cpp
Normal file
151
libs/fastfile/PC/fastfile_cod12_pc.cpp
Normal file
@ -0,0 +1,151 @@
|
||||
#include "fastfile_cod12_pc.h"
|
||||
#include "zonefile_cod12_pc.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD12_PC::FastFile_COD12_PC()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD12");
|
||||
SetPlatform("PC");
|
||||
}
|
||||
|
||||
FastFile_COD12_PC::FastFile_COD12_PC(const QByteArray& aData)
|
||||
: FastFile_COD12_PC() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD12_PC::FastFile_COD12_PC(const QString aFilePath)
|
||||
: FastFile_COD12_PC() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD12_PC::~FastFile_COD12_PC() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD12_PC::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD12_PC::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).split('.').first();
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD12_PC::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD12_PC zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
|
||||
// Skip header magic
|
||||
fastFileStream.skipRawData(8);
|
||||
|
||||
quint32 version;
|
||||
fastFileStream >> version;
|
||||
|
||||
quint8 unknownFlag, compressionFlag, platformFlag, encryptionFlag;
|
||||
fastFileStream >> unknownFlag >> compressionFlag >> platformFlag >> encryptionFlag;
|
||||
|
||||
if (compressionFlag != 1) {
|
||||
qDebug() << "Invalid fastfile compression: " << compressionFlag;
|
||||
return false;
|
||||
} else if (platformFlag != 0) {
|
||||
qDebug() << "Invalid platform: " << platformFlag;
|
||||
return false;
|
||||
} else if (encryptionFlag != 0) {
|
||||
qDebug() << "Decryption not supported yet!";
|
||||
return false;
|
||||
}
|
||||
|
||||
fastFileStream.skipRawData(128);
|
||||
|
||||
quint64 size;
|
||||
fastFileStream >> size;
|
||||
|
||||
fastFileStream.skipRawData(432);
|
||||
|
||||
int consumed = 0;
|
||||
while(consumed < size)
|
||||
{
|
||||
// Read Block Header
|
||||
quint32 compressedSize, decompressedSize, blockSize, blockPosition;
|
||||
fastFileStream >> compressedSize >> decompressedSize >> blockSize >> blockPosition;
|
||||
|
||||
// Validate the block position, it should match
|
||||
if(blockPosition != fastFileStream.device()->pos() - 16)
|
||||
{
|
||||
qDebug() << "Block Position does not match Stream Position.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for padding blocks
|
||||
if(decompressedSize == 0)
|
||||
{
|
||||
fastFileStream.device()->read((((fastFileStream.device()->pos()) + ((0x800000) - 1)) & ~((0x800000) - 1)) - fastFileStream.device()->pos());
|
||||
continue;
|
||||
}
|
||||
|
||||
fastFileStream.device()->read(2);
|
||||
|
||||
QByteArray compressedData(compressedSize - 2, Qt::Uninitialized);
|
||||
qDebug() << "Data position: " << fastFileStream.device()->pos() << " - Size: " << compressedSize;
|
||||
fastFileStream.readRawData(compressedData.data(), compressedSize - 2);
|
||||
decompressedData.append(Compression::DecompressDeflate(compressedData));
|
||||
|
||||
consumed += decompressedSize;
|
||||
|
||||
// Sinze Fast Files are aligns, we must skip the full block
|
||||
fastFileStream.device()->seek(blockPosition + 16 + blockSize);
|
||||
}
|
||||
|
||||
Utils::ExportData(GetStem() + ".zone", decompressedData);
|
||||
|
||||
zoneFile.Load(decompressedData);
|
||||
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD12_PC>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PC/fastfile_cod12_pc.h
Normal file
20
libs/fastfile/PC/fastfile_cod12_pc.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD12_PC_H
|
||||
#define FASTFILE_COD12_PC_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD12_PC : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD12_PC();
|
||||
FastFile_COD12_PC(const QByteArray &aData);
|
||||
FastFile_COD12_PC(const QString aFilePath);
|
||||
~FastFile_COD12_PC();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD12_PC_H
|
||||
93
libs/fastfile/PC/fastfile_cod4_pc.cpp
Normal file
93
libs/fastfile/PC/fastfile_cod4_pc.cpp
Normal file
@ -0,0 +1,93 @@
|
||||
#include "fastfile_cod4_pc.h"
|
||||
#include "zonefile_cod4_pc.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "statusbarmanager.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD4_PC::FastFile_COD4_PC()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetPlatform("PC");
|
||||
SetGame("COD4");
|
||||
}
|
||||
|
||||
FastFile_COD4_PC::FastFile_COD4_PC(const QByteArray& aData)
|
||||
: FastFile_COD4_PC() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD4_PC::FastFile_COD4_PC(const QString aFilePath)
|
||||
: FastFile_COD4_PC() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD4_PC::~FastFile_COD4_PC() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD4_PC::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD4_PC::Load(const QString aFilePath) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD5 Fast File w/path", 1000);
|
||||
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD4_PC::Load(const QByteArray aData) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD5 Fast File w/data", 1000);
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// For COD5, simply decompress from offset 12.
|
||||
decompressedData = Compression::DecompressZLIB(aData.mid(12));
|
||||
|
||||
Utils::ExportData(GetStem() + ".zone", decompressedData);
|
||||
|
||||
ZoneFile_COD4_PC zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD4_PC>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PC/fastfile_cod4_pc.h
Normal file
20
libs/fastfile/PC/fastfile_cod4_pc.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD4_PC_H
|
||||
#define FASTFILE_COD4_PC_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD4_PC : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD4_PC();
|
||||
FastFile_COD4_PC(const QByteArray &aData);
|
||||
FastFile_COD4_PC(const QString aFilePath);
|
||||
~FastFile_COD4_PC();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD4_PC_H
|
||||
93
libs/fastfile/PC/fastfile_cod5_pc.cpp
Normal file
93
libs/fastfile/PC/fastfile_cod5_pc.cpp
Normal file
@ -0,0 +1,93 @@
|
||||
#include "fastfile_cod5_pc.h"
|
||||
#include "zonefile_cod5_pc.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "statusbarmanager.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD5_PC::FastFile_COD5_PC()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetPlatform("PC");
|
||||
SetGame("COD5");
|
||||
}
|
||||
|
||||
FastFile_COD5_PC::FastFile_COD5_PC(const QByteArray& aData)
|
||||
: FastFile_COD5_PC() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD5_PC::FastFile_COD5_PC(const QString aFilePath)
|
||||
: FastFile_COD5_PC() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD5_PC::~FastFile_COD5_PC() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD5_PC::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD5_PC::Load(const QString aFilePath) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD5 Fast File w/path", 1000);
|
||||
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD5_PC::Load(const QByteArray aData) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD5 Fast File w/data", 1000);
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// For COD5, simply decompress from offset 12.
|
||||
decompressedData = Compression::DecompressZLIB(aData.mid(12));
|
||||
|
||||
Utils::ExportData(GetStem() + ".zone", decompressedData);
|
||||
|
||||
ZoneFile_COD5_PC zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD5_PC>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PC/fastfile_cod5_pc.h
Normal file
20
libs/fastfile/PC/fastfile_cod5_pc.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD5_PC_H
|
||||
#define FASTFILE_COD5_PC_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD5_PC : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD5_PC();
|
||||
FastFile_COD5_PC(const QByteArray &aData);
|
||||
FastFile_COD5_PC(const QString aFilePath);
|
||||
~FastFile_COD5_PC();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD5_PC_H
|
||||
93
libs/fastfile/PC/fastfile_cod6_pc.cpp
Normal file
93
libs/fastfile/PC/fastfile_cod6_pc.cpp
Normal file
@ -0,0 +1,93 @@
|
||||
#include "fastfile_cod6_pc.h"
|
||||
#include "zonefile_cod6_pc.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "statusbarmanager.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD6_PC::FastFile_COD6_PC()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetPlatform("PC");
|
||||
SetGame("COD6");
|
||||
}
|
||||
|
||||
FastFile_COD6_PC::FastFile_COD6_PC(const QByteArray& aData)
|
||||
: FastFile_COD6_PC() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD6_PC::FastFile_COD6_PC(const QString aFilePath)
|
||||
: FastFile_COD6_PC() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD6_PC::~FastFile_COD6_PC() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD6_PC::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD6_PC::Load(const QString aFilePath) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD5 Fast File w/path", 1000);
|
||||
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD6_PC::Load(const QByteArray aData) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD5 Fast File w/data", 1000);
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// For COD5, simply decompress from offset 12.
|
||||
decompressedData = Compression::DecompressZLIB(aData.mid(12));
|
||||
|
||||
Utils::ExportData(GetStem() + ".zone", decompressedData);
|
||||
|
||||
ZoneFile_COD6_PC zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD6_PC>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PC/fastfile_cod6_pc.h
Normal file
20
libs/fastfile/PC/fastfile_cod6_pc.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD6_PC_H
|
||||
#define FASTFILE_COD6_PC_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD6_PC : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD6_PC();
|
||||
FastFile_COD6_PC(const QByteArray &aData);
|
||||
FastFile_COD6_PC(const QString aFilePath);
|
||||
~FastFile_COD6_PC();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD6_PC_H
|
||||
170
libs/fastfile/PC/fastfile_cod7_pc.cpp
Normal file
170
libs/fastfile/PC/fastfile_cod7_pc.cpp
Normal file
@ -0,0 +1,170 @@
|
||||
#include "fastfile_cod7_pc.h"
|
||||
#include "zonefile_cod7_pc.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD7_PC::FastFile_COD7_PC()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD7");
|
||||
SetPlatform("PC");
|
||||
}
|
||||
|
||||
FastFile_COD7_PC::FastFile_COD7_PC(const QByteArray& aData)
|
||||
: FastFile_COD7_PC() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD7_PC::FastFile_COD7_PC(const QString aFilePath)
|
||||
: FastFile_COD7_PC() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD7_PC::~FastFile_COD7_PC() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD7_PC::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD7_PC::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD7_PC::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD7");
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD7_PC zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
fastFileStream.skipRawData(4);
|
||||
if (GetPlatform() == "360") {
|
||||
key = QByteArray::fromHex("1ac1d12d527c59b40eca619120ff8217ccff09cd16896f81b829c7f52793405d");
|
||||
} else if (GetPlatform() == "PS3") {
|
||||
key = QByteArray::fromHex("46D3F997F29C9ACE175B0DAE3AB8C0C1B8E423E2E3BF7E3C311EA35245BF193A");
|
||||
// or
|
||||
// key = QByteArray::fromHex("0C99B3DDB8D6D0845D1147E470F28A8BF2AE69A8A9F534767B54E9180FF55370");
|
||||
}
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
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;
|
||||
qDebug() << "Section index:" << sectionIndex << "Size:" << sectionSize
|
||||
<< "Pos:" << fastFileStream.device()->pos();
|
||||
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.
|
||||
QByteArray compressedData;
|
||||
compressedData.append(char(0x78));
|
||||
compressedData.append(char(0x01));
|
||||
compressedData.append(decData);
|
||||
|
||||
decompressedData.append(Compression::DecompressZLIB(compressedData));
|
||||
|
||||
sectionIndex++;
|
||||
}
|
||||
|
||||
zoneFile.Load(decompressedData);
|
||||
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD7_PC>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PC/fastfile_cod7_pc.h
Normal file
20
libs/fastfile/PC/fastfile_cod7_pc.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD7_PC_H
|
||||
#define FASTFILE_COD7_PC_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD7_PC : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD7_PC();
|
||||
FastFile_COD7_PC(const QByteArray &aData);
|
||||
FastFile_COD7_PC(const QString aFilePath);
|
||||
~FastFile_COD7_PC();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD7_PC_H
|
||||
170
libs/fastfile/PC/fastfile_cod8_pc.cpp
Normal file
170
libs/fastfile/PC/fastfile_cod8_pc.cpp
Normal file
@ -0,0 +1,170 @@
|
||||
#include "fastfile_cod8_pc.h"
|
||||
#include "zonefile_cod8_pc.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD8_PC::FastFile_COD8_PC()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD8");
|
||||
SetPlatform("PC");
|
||||
}
|
||||
|
||||
FastFile_COD8_PC::FastFile_COD8_PC(const QByteArray& aData)
|
||||
: FastFile_COD8_PC() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD8_PC::FastFile_COD8_PC(const QString aFilePath)
|
||||
: FastFile_COD8_PC() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD8_PC::~FastFile_COD8_PC() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD8_PC::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD8_PC::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD8_PC::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD7");
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD8_PC zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
fastFileStream.skipRawData(4);
|
||||
if (GetPlatform() == "360") {
|
||||
key = QByteArray::fromHex("1ac1d12d527c59b40eca619120ff8217ccff09cd16896f81b829c7f52793405d");
|
||||
} else if (GetPlatform() == "PS3") {
|
||||
key = QByteArray::fromHex("46D3F997F29C9ACE175B0DAE3AB8C0C1B8E423E2E3BF7E3C311EA35245BF193A");
|
||||
// or
|
||||
// key = QByteArray::fromHex("0C99B3DDB8D6D0845D1147E470F28A8BF2AE69A8A9F534767B54E9180FF55370");
|
||||
}
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
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;
|
||||
qDebug() << "Section index:" << sectionIndex << "Size:" << sectionSize
|
||||
<< "Pos:" << fastFileStream.device()->pos();
|
||||
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.
|
||||
QByteArray compressedData;
|
||||
compressedData.append(char(0x78));
|
||||
compressedData.append(char(0x01));
|
||||
compressedData.append(decData);
|
||||
|
||||
decompressedData.append(Compression::DecompressZLIB(compressedData));
|
||||
|
||||
sectionIndex++;
|
||||
}
|
||||
|
||||
zoneFile.Load(decompressedData);
|
||||
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD8_PC>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PC/fastfile_cod8_pc.h
Normal file
20
libs/fastfile/PC/fastfile_cod8_pc.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD8_PC_H
|
||||
#define FASTFILE_COD8_PC_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD8_PC : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD8_PC();
|
||||
FastFile_COD8_PC(const QByteArray &aData);
|
||||
FastFile_COD8_PC(const QString aFilePath);
|
||||
~FastFile_COD8_PC();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD8_PC_H
|
||||
137
libs/fastfile/PC/fastfile_cod9_pc.cpp
Normal file
137
libs/fastfile/PC/fastfile_cod9_pc.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
#include "fastfile_cod9_pc.h"
|
||||
#include "zonefile_cod9_pc.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD9_PC::FastFile_COD9_PC()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD9");
|
||||
SetPlatform("PC");
|
||||
}
|
||||
|
||||
FastFile_COD9_PC::FastFile_COD9_PC(const QByteArray& aData)
|
||||
: FastFile_COD9_PC() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD9_PC::FastFile_COD9_PC(const QString aFilePath)
|
||||
: FastFile_COD9_PC() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD9_PC::~FastFile_COD9_PC() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD9_PC::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD9_PC::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).section(".", 0, 0);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem + ".ff";
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD9_PC::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD9");
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
if (GetPlatform() == "PC") {
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
}
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
if (GetPlatform() == "360") {
|
||||
key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
} else if (GetPlatform() == "PC") {
|
||||
key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
}
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
QByteArray fileName(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileName.data(), 32);
|
||||
|
||||
// Skip the RSA signature (256 bytes).
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
if (GetPlatform() == "360") {
|
||||
//decompressedData = Compressor::cod9_decryptFastFile(aData);
|
||||
} else if (GetPlatform() == "PC") {
|
||||
decompressedData = Encryption::decryptFastFile_BO2(aData);
|
||||
}
|
||||
|
||||
// For COD9, write out the complete decompressed zone for testing.
|
||||
QFile testFile("exports/" + GetStem() + ".zone");
|
||||
if(testFile.open(QIODevice::WriteOnly)) {
|
||||
testFile.write(decompressedData);
|
||||
testFile.close();
|
||||
}
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD9_PC zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD9_PC>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PC/fastfile_cod9_pc.h
Normal file
20
libs/fastfile/PC/fastfile_cod9_pc.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD9_PC_H
|
||||
#define FASTFILE_COD9_PC_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD9_PC : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD9_PC();
|
||||
FastFile_COD9_PC(const QByteArray &aData);
|
||||
FastFile_COD9_PC(const QString aFilePath);
|
||||
~FastFile_COD9_PC();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD9_PC_H
|
||||
137
libs/fastfile/PS3/fastfile_cod10_ps3.cpp
Normal file
137
libs/fastfile/PS3/fastfile_cod10_ps3.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
#include "fastfile_cod10_ps3.h"
|
||||
#include "zonefile_cod10_ps3.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD10_PS3::FastFile_COD10_PS3()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD10");
|
||||
SetPlatform("PS3");
|
||||
}
|
||||
|
||||
FastFile_COD10_PS3::FastFile_COD10_PS3(const QByteArray& aData)
|
||||
: FastFile_COD10_PS3() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD10_PS3::FastFile_COD10_PS3(const QString aFilePath)
|
||||
: FastFile_COD10_PS3() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD10_PS3::~FastFile_COD10_PS3() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD10_PS3::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD10_PS3::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).section(".", 0, 0);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem + ".ff";
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD10_PS3::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD9");
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
if (GetPlatform() == "PC") {
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
}
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
if (GetPlatform() == "360") {
|
||||
key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
} else if (GetPlatform() == "PC") {
|
||||
key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
}
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
QByteArray fileName(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileName.data(), 32);
|
||||
|
||||
// Skip the RSA signature (256 bytes).
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
if (GetPlatform() == "360") {
|
||||
//decompressedData = Compressor::cod9_decryptFastFile(aData);
|
||||
} else if (GetPlatform() == "PC") {
|
||||
decompressedData = Encryption::decryptFastFile_BO2(aData);
|
||||
}
|
||||
|
||||
// For COD9, write out the complete decompressed zone for testing.
|
||||
QFile testFile("exports/" + GetStem() + ".zone");
|
||||
if(testFile.open(QIODevice::WriteOnly)) {
|
||||
testFile.write(decompressedData);
|
||||
testFile.close();
|
||||
}
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD10_PS3 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD10_PS3>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PS3/fastfile_cod10_ps3.h
Normal file
20
libs/fastfile/PS3/fastfile_cod10_ps3.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD10_PS3_H
|
||||
#define FASTFILE_COD10_PS3_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD10_PS3 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD10_PS3();
|
||||
FastFile_COD10_PS3(const QByteArray &aData);
|
||||
FastFile_COD10_PS3(const QString aFilePath);
|
||||
~FastFile_COD10_PS3();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD10_PS3_H
|
||||
137
libs/fastfile/PS3/fastfile_cod11_ps3.cpp
Normal file
137
libs/fastfile/PS3/fastfile_cod11_ps3.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
#include "fastfile_cod11_ps3.h"
|
||||
#include "zonefile_cod11_ps3.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD11_PS3::FastFile_COD11_PS3()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD11");
|
||||
SetPlatform("PS3");
|
||||
}
|
||||
|
||||
FastFile_COD11_PS3::FastFile_COD11_PS3(const QByteArray& aData)
|
||||
: FastFile_COD11_PS3() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD11_PS3::FastFile_COD11_PS3(const QString aFilePath)
|
||||
: FastFile_COD11_PS3() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD11_PS3::~FastFile_COD11_PS3() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD11_PS3::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD11_PS3::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).section(".", 0, 0);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem + ".ff";
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD11_PS3::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD9");
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
if (GetPlatform() == "PC") {
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
}
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
if (GetPlatform() == "360") {
|
||||
key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
} else if (GetPlatform() == "PC") {
|
||||
key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
}
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
QByteArray fileName(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileName.data(), 32);
|
||||
|
||||
// Skip the RSA signature (256 bytes).
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
if (GetPlatform() == "360") {
|
||||
//decompressedData = Compressor::cod9_decryptFastFile(aData);
|
||||
} else if (GetPlatform() == "PC") {
|
||||
decompressedData = Encryption::decryptFastFile_BO2(aData);
|
||||
}
|
||||
|
||||
// For COD9, write out the complete decompressed zone for testing.
|
||||
QFile testFile("exports/" + GetStem() + ".zone");
|
||||
if(testFile.open(QIODevice::WriteOnly)) {
|
||||
testFile.write(decompressedData);
|
||||
testFile.close();
|
||||
}
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD11_PS3 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD11_PS3>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PS3/fastfile_cod11_ps3.h
Normal file
20
libs/fastfile/PS3/fastfile_cod11_ps3.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD11_PS3_H
|
||||
#define FASTFILE_COD11_PS3_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD11_PS3 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD11_PS3();
|
||||
FastFile_COD11_PS3(const QByteArray &aData);
|
||||
FastFile_COD11_PS3(const QString aFilePath);
|
||||
~FastFile_COD11_PS3();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD11_PS3_H
|
||||
137
libs/fastfile/PS3/fastfile_cod12_ps3.cpp
Normal file
137
libs/fastfile/PS3/fastfile_cod12_ps3.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
#include "fastfile_cod12_ps3.h"
|
||||
#include "zonefile_cod12_ps3.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD12_PS3::FastFile_COD12_PS3()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD12");
|
||||
SetPlatform("PS3");
|
||||
}
|
||||
|
||||
FastFile_COD12_PS3::FastFile_COD12_PS3(const QByteArray& aData)
|
||||
: FastFile_COD12_PS3() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD12_PS3::FastFile_COD12_PS3(const QString aFilePath)
|
||||
: FastFile_COD12_PS3() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD12_PS3::~FastFile_COD12_PS3() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD12_PS3::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD12_PS3::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).section(".", 0, 0);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem + ".ff";
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD12_PS3::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD9");
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
if (GetPlatform() == "PC") {
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
}
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
if (GetPlatform() == "360") {
|
||||
key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
} else if (GetPlatform() == "PC") {
|
||||
key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
}
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
QByteArray fileName(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileName.data(), 32);
|
||||
|
||||
// Skip the RSA signature (256 bytes).
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
if (GetPlatform() == "360") {
|
||||
//decompressedData = Compressor::cod9_decryptFastFile(aData);
|
||||
} else if (GetPlatform() == "PC") {
|
||||
decompressedData = Encryption::decryptFastFile_BO2(aData);
|
||||
}
|
||||
|
||||
// For COD9, write out the complete decompressed zone for testing.
|
||||
QFile testFile("exports/" + GetStem() + ".zone");
|
||||
if(testFile.open(QIODevice::WriteOnly)) {
|
||||
testFile.write(decompressedData);
|
||||
testFile.close();
|
||||
}
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD12_PS3 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD12_PS3>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PS3/fastfile_cod12_ps3.h
Normal file
20
libs/fastfile/PS3/fastfile_cod12_ps3.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD12_PS3_H
|
||||
#define FASTFILE_COD12_PS3_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD12_PS3 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD12_PS3();
|
||||
FastFile_COD12_PS3(const QByteArray &aData);
|
||||
FastFile_COD12_PS3(const QString aFilePath);
|
||||
~FastFile_COD12_PS3();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD12_PS3_H
|
||||
120
libs/fastfile/PS3/fastfile_cod4_ps3.cpp
Normal file
120
libs/fastfile/PS3/fastfile_cod4_ps3.cpp
Normal file
@ -0,0 +1,120 @@
|
||||
#include "fastfile_cod4_ps3.h"
|
||||
#include "zonefile_cod4_ps3.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "statusbarmanager.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD4_PS3::FastFile_COD4_PS3()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD4");
|
||||
SetPlatform("PS3");
|
||||
}
|
||||
|
||||
FastFile_COD4_PS3::FastFile_COD4_PS3(const QByteArray& aData)
|
||||
: FastFile_COD4_PS3() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD4_PS3::FastFile_COD4_PS3(const QString aFilePath)
|
||||
: FastFile_COD4_PS3() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD4_PS3::~FastFile_COD4_PS3() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD4_PS3::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD4_PS3::Load(const QString aFilePath) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD5 Fast File w/path", 1000);
|
||||
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD4_PS3::Load(const QByteArray aData) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD5 Fast File w/data", 1000);
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
SetVersion(pParseFFVersion(&fastFileStream));
|
||||
|
||||
int pos = 12;
|
||||
// Loop until EOF or invalid chunk
|
||||
while (pos <= aData.size()) {
|
||||
// Read 2-byte BIG-ENDIAN chunk size
|
||||
quint16 chunkSize;
|
||||
QDataStream chunkStream(aData.mid(pos, 2));
|
||||
chunkStream.setByteOrder(QDataStream::BigEndian);
|
||||
chunkStream >> chunkSize;
|
||||
|
||||
pos += 2;
|
||||
|
||||
if (chunkSize == 0 || pos + chunkSize > aData.size()) {
|
||||
qWarning() << "Invalid or incomplete chunk detected, stopping.";
|
||||
break;
|
||||
}
|
||||
|
||||
const QByteArray compressedChunk = aData.mid(pos, chunkSize);
|
||||
|
||||
decompressedData.append(Compression::DecompressDeflate(compressedChunk));
|
||||
|
||||
pos += chunkSize;
|
||||
}
|
||||
|
||||
Utils::ExportData(GetStem() + ".zone", decompressedData);
|
||||
|
||||
ZoneFile_COD4_PS3 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD4_PS3>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PS3/fastfile_cod4_ps3.h
Normal file
20
libs/fastfile/PS3/fastfile_cod4_ps3.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD4_PS3_H
|
||||
#define FASTFILE_COD4_PS3_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD4_PS3 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD4_PS3();
|
||||
FastFile_COD4_PS3(const QByteArray &aData);
|
||||
FastFile_COD4_PS3(const QString aFilePath);
|
||||
~FastFile_COD4_PS3();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD4_PS3_H
|
||||
120
libs/fastfile/PS3/fastfile_cod5_ps3.cpp
Normal file
120
libs/fastfile/PS3/fastfile_cod5_ps3.cpp
Normal file
@ -0,0 +1,120 @@
|
||||
#include "fastfile_cod5_ps3.h"
|
||||
#include "zonefile_cod5_ps3.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "statusbarmanager.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD5_PS3::FastFile_COD5_PS3()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD5");
|
||||
SetPlatform("PS3");
|
||||
}
|
||||
|
||||
FastFile_COD5_PS3::FastFile_COD5_PS3(const QByteArray& aData)
|
||||
: FastFile_COD5_PS3() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD5_PS3::FastFile_COD5_PS3(const QString aFilePath)
|
||||
: FastFile_COD5_PS3() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD5_PS3::~FastFile_COD5_PS3() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD5_PS3::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD5_PS3::Load(const QString aFilePath) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD5 Fast File w/path", 1000);
|
||||
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD5_PS3::Load(const QByteArray aData) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD5 Fast File w/data", 1000);
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
SetVersion(pParseFFVersion(&fastFileStream));
|
||||
|
||||
int pos = 12;
|
||||
// Loop until EOF or invalid chunk
|
||||
while (pos <= aData.size()) {
|
||||
// Read 2-byte BIG-ENDIAN chunk size
|
||||
quint16 chunkSize;
|
||||
QDataStream chunkStream(aData.mid(pos, 2));
|
||||
chunkStream.setByteOrder(QDataStream::BigEndian);
|
||||
chunkStream >> chunkSize;
|
||||
|
||||
pos += 2;
|
||||
|
||||
if (chunkSize == 0 || pos + chunkSize > aData.size()) {
|
||||
qWarning() << "Invalid or incomplete chunk detected, stopping.";
|
||||
break;
|
||||
}
|
||||
|
||||
const QByteArray compressedChunk = aData.mid(pos, chunkSize);
|
||||
|
||||
decompressedData.append(Compression::DecompressDeflate(compressedChunk));
|
||||
|
||||
pos += chunkSize;
|
||||
}
|
||||
|
||||
Utils::ExportData(GetStem() + ".zone", decompressedData);
|
||||
|
||||
ZoneFile_COD5_PS3 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD5_PS3>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PS3/fastfile_cod5_ps3.h
Normal file
20
libs/fastfile/PS3/fastfile_cod5_ps3.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD5_PS3_H
|
||||
#define FASTFILE_COD5_PS3_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD5_PS3 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD5_PS3();
|
||||
FastFile_COD5_PS3(const QByteArray &aData);
|
||||
FastFile_COD5_PS3(const QString aFilePath);
|
||||
~FastFile_COD5_PS3();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD5_PS3_H
|
||||
104
libs/fastfile/PS3/fastfile_cod6_ps3.cpp
Normal file
104
libs/fastfile/PS3/fastfile_cod6_ps3.cpp
Normal file
@ -0,0 +1,104 @@
|
||||
#include "fastfile_cod6_ps3.h"
|
||||
#include "zonefile_cod6_ps3.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "statusbarmanager.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD6_PS3::FastFile_COD6_PS3()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD6");
|
||||
SetPlatform("PS3");
|
||||
}
|
||||
|
||||
FastFile_COD6_PS3::FastFile_COD6_PS3(const QByteArray& aData)
|
||||
: FastFile_COD6_PS3() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD6_PS3::FastFile_COD6_PS3(const QString aFilePath)
|
||||
: FastFile_COD6_PS3() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD6_PS3::~FastFile_COD6_PS3() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD6_PS3::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD6_PS3::Load(const QString aFilePath) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD5 Fast File w/path", 1000);
|
||||
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD6_PS3::Load(const QByteArray aData) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD5 Fast File w/data", 1000);
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
const QString platformStr = pCalculateFFPlatform(version);
|
||||
SetPlatform(platformStr);
|
||||
SetGame("COD5");
|
||||
|
||||
// For COD5, simply decompress from offset 12.
|
||||
decompressedData = Compression::DecompressZLIB(aData.mid(12));
|
||||
|
||||
Utils::ExportData(GetStem() + ".zone", decompressedData);
|
||||
|
||||
ZoneFile_COD6_PS3 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD6_PS3>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PS3/fastfile_cod6_ps3.h
Normal file
20
libs/fastfile/PS3/fastfile_cod6_ps3.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD6_PS3_H
|
||||
#define FASTFILE_COD6_PS3_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD6_PS3 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD6_PS3();
|
||||
FastFile_COD6_PS3(const QByteArray &aData);
|
||||
FastFile_COD6_PS3(const QString aFilePath);
|
||||
~FastFile_COD6_PS3();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD6_PS3_H
|
||||
173
libs/fastfile/PS3/fastfile_cod7_ps3.cpp
Normal file
173
libs/fastfile/PS3/fastfile_cod7_ps3.cpp
Normal file
@ -0,0 +1,173 @@
|
||||
#include "fastfile_cod7_ps3.h"
|
||||
#include "zonefile_cod7_ps3.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD7_PS3::FastFile_COD7_PS3()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD7");
|
||||
SetPlatform("PS3");
|
||||
}
|
||||
|
||||
FastFile_COD7_PS3::FastFile_COD7_PS3(const QByteArray& aData)
|
||||
: FastFile_COD7_PS3() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD7_PS3::FastFile_COD7_PS3(const QString aFilePath)
|
||||
: FastFile_COD7_PS3() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD7_PS3::~FastFile_COD7_PS3() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD7_PS3::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD7_PS3::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD7_PS3::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD7");
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD7_PS3 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
if (GetPlatform() == "PC") {
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
fastFileStream.skipRawData(4);
|
||||
if (GetPlatform() == "360") {
|
||||
key = QByteArray::fromHex("1ac1d12d527c59b40eca619120ff8217ccff09cd16896f81b829c7f52793405d");
|
||||
} else if (GetPlatform() == "PS3") {
|
||||
key = QByteArray::fromHex("46D3F997F29C9ACE175B0DAE3AB8C0C1B8E423E2E3BF7E3C311EA35245BF193A");
|
||||
// or
|
||||
// key = QByteArray::fromHex("0C99B3DDB8D6D0845D1147E470F28A8BF2AE69A8A9F534767B54E9180FF55370");
|
||||
}
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
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;
|
||||
qDebug() << "Section index:" << sectionIndex << "Size:" << sectionSize
|
||||
<< "Pos:" << fastFileStream.device()->pos();
|
||||
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.
|
||||
QByteArray compressedData;
|
||||
compressedData.append(char(0x78));
|
||||
compressedData.append(char(0x01));
|
||||
compressedData.append(decData);
|
||||
|
||||
decompressedData.append(Compression::DecompressZLIB(compressedData));
|
||||
|
||||
sectionIndex++;
|
||||
}
|
||||
|
||||
zoneFile.Load(decompressedData);
|
||||
}
|
||||
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD7_PS3>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PS3/fastfile_cod7_ps3.h
Normal file
20
libs/fastfile/PS3/fastfile_cod7_ps3.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD7_PS3_H
|
||||
#define FASTFILE_COD7_PS3_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD7_PS3 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD7_PS3();
|
||||
FastFile_COD7_PS3(const QByteArray &aData);
|
||||
FastFile_COD7_PS3(const QString aFilePath);
|
||||
~FastFile_COD7_PS3();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD7_PS3_H
|
||||
173
libs/fastfile/PS3/fastfile_cod8_ps3.cpp
Normal file
173
libs/fastfile/PS3/fastfile_cod8_ps3.cpp
Normal file
@ -0,0 +1,173 @@
|
||||
#include "fastfile_cod8_ps3.h"
|
||||
#include "zonefile_cod8_ps3.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD8_PS3::FastFile_COD8_PS3()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD8");
|
||||
SetPlatform("PS3");
|
||||
}
|
||||
|
||||
FastFile_COD8_PS3::FastFile_COD8_PS3(const QByteArray& aData)
|
||||
: FastFile_COD8_PS3() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD8_PS3::FastFile_COD8_PS3(const QString aFilePath)
|
||||
: FastFile_COD8_PS3() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD8_PS3::~FastFile_COD8_PS3() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD8_PS3::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD8_PS3::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD8_PS3::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD7");
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD8_PS3 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
if (GetPlatform() == "PC") {
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
fastFileStream.skipRawData(4);
|
||||
if (GetPlatform() == "360") {
|
||||
key = QByteArray::fromHex("1ac1d12d527c59b40eca619120ff8217ccff09cd16896f81b829c7f52793405d");
|
||||
} else if (GetPlatform() == "PS3") {
|
||||
key = QByteArray::fromHex("46D3F997F29C9ACE175B0DAE3AB8C0C1B8E423E2E3BF7E3C311EA35245BF193A");
|
||||
// or
|
||||
// key = QByteArray::fromHex("0C99B3DDB8D6D0845D1147E470F28A8BF2AE69A8A9F534767B54E9180FF55370");
|
||||
}
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
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;
|
||||
qDebug() << "Section index:" << sectionIndex << "Size:" << sectionSize
|
||||
<< "Pos:" << fastFileStream.device()->pos();
|
||||
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.
|
||||
QByteArray compressedData;
|
||||
compressedData.append(char(0x78));
|
||||
compressedData.append(char(0x01));
|
||||
compressedData.append(decData);
|
||||
|
||||
decompressedData.append(Compression::DecompressZLIB(compressedData));
|
||||
|
||||
sectionIndex++;
|
||||
}
|
||||
|
||||
zoneFile.Load(decompressedData);
|
||||
}
|
||||
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD8_PS3>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PS3/fastfile_cod8_ps3.h
Normal file
20
libs/fastfile/PS3/fastfile_cod8_ps3.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD8_PS3_H
|
||||
#define FASTFILE_COD8_PS3_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD8_PS3 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD8_PS3();
|
||||
FastFile_COD8_PS3(const QByteArray &aData);
|
||||
FastFile_COD8_PS3(const QString aFilePath);
|
||||
~FastFile_COD8_PS3();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD8_PS3_H
|
||||
137
libs/fastfile/PS3/fastfile_cod9_ps3.cpp
Normal file
137
libs/fastfile/PS3/fastfile_cod9_ps3.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
#include "fastfile_cod9_ps3.h"
|
||||
#include "zonefile_cod9_ps3.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD9_PS3::FastFile_COD9_PS3()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD9");
|
||||
SetPlatform("PS3");
|
||||
}
|
||||
|
||||
FastFile_COD9_PS3::FastFile_COD9_PS3(const QByteArray& aData)
|
||||
: FastFile_COD9_PS3() {
|
||||
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD9_PS3::FastFile_COD9_PS3(const QString aFilePath)
|
||||
: FastFile_COD9_PS3() {
|
||||
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD9_PS3::~FastFile_COD9_PS3() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD9_PS3::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD9_PS3::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).section(".", 0, 0);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem + ".ff";
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD9_PS3::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD9");
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
if (GetPlatform() == "PC") {
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
}
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
if (GetPlatform() == "360") {
|
||||
key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
} else if (GetPlatform() == "PC") {
|
||||
key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
}
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
QByteArray fileName(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileName.data(), 32);
|
||||
|
||||
// Skip the RSA signature (256 bytes).
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
if (GetPlatform() == "360") {
|
||||
//decompressedData = Compressor::cod9_decryptFastFile(aData);
|
||||
} else if (GetPlatform() == "PC") {
|
||||
decompressedData = Encryption::decryptFastFile_BO2(aData);
|
||||
}
|
||||
|
||||
// For COD9, write out the complete decompressed zone for testing.
|
||||
QFile testFile("exports/" + GetStem() + ".zone");
|
||||
if(testFile.open(QIODevice::WriteOnly)) {
|
||||
testFile.write(decompressedData);
|
||||
testFile.close();
|
||||
}
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD9_PS3 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD9_PS3>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/PS3/fastfile_cod9_ps3.h
Normal file
20
libs/fastfile/PS3/fastfile_cod9_ps3.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD9_PS3_H
|
||||
#define FASTFILE_COD9_PS3_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD9_PS3 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD9_PS3();
|
||||
FastFile_COD9_PS3(const QByteArray &aData);
|
||||
FastFile_COD9_PS3(const QString aFilePath);
|
||||
~FastFile_COD9_PS3();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD9_PS3_H
|
||||
114
libs/fastfile/Wii/fastfile_cod4_wii.cpp
Normal file
114
libs/fastfile/Wii/fastfile_cod4_wii.cpp
Normal file
@ -0,0 +1,114 @@
|
||||
#include "fastfile_cod4_wii.h"
|
||||
#include "zonefile_cod4_wii.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD4_Wii::FastFile_COD4_Wii()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD4");
|
||||
SetPlatform("Wii");
|
||||
}
|
||||
|
||||
FastFile_COD4_Wii::FastFile_COD4_Wii(const QByteArray& aData)
|
||||
: FastFile_COD4_Wii() {
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD4_Wii::FastFile_COD4_Wii(const QString aFilePath)
|
||||
: FastFile_COD4_Wii() {
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD4_Wii::~FastFile_COD4_Wii() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD4_Wii::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD4_Wii::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD4_Wii::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD7");
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD7_Wii zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
|
||||
// For COD7, simply decompress from offset 12.
|
||||
decompressedData = Compression::DecompressZLIB(aData.mid(12));
|
||||
|
||||
Utils::ExportData(GetStem() + ".zone", decompressedData);
|
||||
|
||||
QDir workingDir = QDir::currentPath();
|
||||
workingDir.mkdir("exports");
|
||||
|
||||
QFile outputFile("exports/" + GetStem() + ".zone");
|
||||
if (!outputFile.open(QIODevice::WriteOnly)) {
|
||||
qDebug() << "Failed to extract IPAK file.";
|
||||
}
|
||||
qDebug() << " - File Name: " << outputFile.fileName();
|
||||
outputFile.write(decompressedData);
|
||||
outputFile.close();
|
||||
|
||||
zoneFile.Load(decompressedData);
|
||||
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD7_Wii>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/Wii/fastfile_cod4_wii.h
Normal file
20
libs/fastfile/Wii/fastfile_cod4_wii.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD4_WII_H
|
||||
#define FASTFILE_COD4_WII_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD4_Wii : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD4_Wii();
|
||||
FastFile_COD4_Wii(const QByteArray &aData);
|
||||
FastFile_COD4_Wii(const QString aFilePath);
|
||||
~FastFile_COD4_Wii();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD4_WII_H
|
||||
114
libs/fastfile/Wii/fastfile_cod7_wii.cpp
Normal file
114
libs/fastfile/Wii/fastfile_cod7_wii.cpp
Normal file
@ -0,0 +1,114 @@
|
||||
#include "fastfile_cod7_wii.h"
|
||||
#include "zonefile_cod7_wii.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD7_Wii::FastFile_COD7_Wii()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD7");
|
||||
SetPlatform("Wii");
|
||||
}
|
||||
|
||||
FastFile_COD7_Wii::FastFile_COD7_Wii(const QByteArray& aData)
|
||||
: FastFile_COD7_Wii() {
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD7_Wii::FastFile_COD7_Wii(const QString aFilePath)
|
||||
: FastFile_COD7_Wii() {
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD7_Wii::~FastFile_COD7_Wii() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD7_Wii::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD7_Wii::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD7_Wii::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD7");
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD7_Wii zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
|
||||
// For COD7, simply decompress from offset 12.
|
||||
decompressedData = Compression::DecompressZLIB(aData.mid(12));
|
||||
|
||||
Utils::ExportData(GetStem() + ".zone", decompressedData);
|
||||
|
||||
QDir workingDir = QDir::currentPath();
|
||||
workingDir.mkdir("exports");
|
||||
|
||||
QFile outputFile("exports/" + GetStem() + ".zone");
|
||||
if (!outputFile.open(QIODevice::WriteOnly)) {
|
||||
qDebug() << "Failed to extract IPAK file.";
|
||||
}
|
||||
qDebug() << " - File Name: " << outputFile.fileName();
|
||||
outputFile.write(decompressedData);
|
||||
outputFile.close();
|
||||
|
||||
zoneFile.Load(decompressedData);
|
||||
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD7_Wii>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/Wii/fastfile_cod7_wii.h
Normal file
20
libs/fastfile/Wii/fastfile_cod7_wii.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD7_WII_H
|
||||
#define FASTFILE_COD7_WII_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD7_Wii : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD7_Wii();
|
||||
FastFile_COD7_Wii(const QByteArray &aData);
|
||||
FastFile_COD7_Wii(const QString aFilePath);
|
||||
~FastFile_COD7_Wii();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD7_WII_H
|
||||
114
libs/fastfile/Wii/fastfile_cod8_wii.cpp
Normal file
114
libs/fastfile/Wii/fastfile_cod8_wii.cpp
Normal file
@ -0,0 +1,114 @@
|
||||
#include "fastfile_cod8_wii.h"
|
||||
#include "zonefile_cod8_wii.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD8_Wii::FastFile_COD8_Wii()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD7");
|
||||
SetPlatform("Wii");
|
||||
}
|
||||
|
||||
FastFile_COD8_Wii::FastFile_COD8_Wii(const QByteArray& aData)
|
||||
: FastFile_COD8_Wii() {
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD8_Wii::FastFile_COD8_Wii(const QString aFilePath)
|
||||
: FastFile_COD8_Wii() {
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD8_Wii::~FastFile_COD8_Wii() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD8_Wii::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD8_Wii::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD8_Wii::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD7");
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD7_Wii zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
|
||||
// For COD7, simply decompress from offset 12.
|
||||
decompressedData = Compression::DecompressZLIB(aData.mid(12));
|
||||
|
||||
Utils::ExportData(GetStem() + ".zone", decompressedData);
|
||||
|
||||
QDir workingDir = QDir::currentPath();
|
||||
workingDir.mkdir("exports");
|
||||
|
||||
QFile outputFile("exports/" + GetStem() + ".zone");
|
||||
if (!outputFile.open(QIODevice::WriteOnly)) {
|
||||
qDebug() << "Failed to extract IPAK file.";
|
||||
}
|
||||
qDebug() << " - File Name: " << outputFile.fileName();
|
||||
outputFile.write(decompressedData);
|
||||
outputFile.close();
|
||||
|
||||
zoneFile.Load(decompressedData);
|
||||
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD7_Wii>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/Wii/fastfile_cod8_wii.h
Normal file
20
libs/fastfile/Wii/fastfile_cod8_wii.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD8_WII_H
|
||||
#define FASTFILE_COD8_WII_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD8_Wii : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD8_Wii();
|
||||
FastFile_COD8_Wii(const QByteArray &aData);
|
||||
FastFile_COD8_Wii(const QString aFilePath);
|
||||
~FastFile_COD8_Wii();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD8_WII_H
|
||||
135
libs/fastfile/WiiU/fastfile_cod10_wiiu.cpp
Normal file
135
libs/fastfile/WiiU/fastfile_cod10_wiiu.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
#include "fastfile_cod10_wiiu.h"
|
||||
#include "zonefile_cod10_wiiu.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD10_WiiU::FastFile_COD10_WiiU()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD10");
|
||||
SetPlatform("WiiU");
|
||||
}
|
||||
|
||||
FastFile_COD10_WiiU::FastFile_COD10_WiiU(const QByteArray& aData)
|
||||
: FastFile_COD10_WiiU() {
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD10_WiiU::FastFile_COD10_WiiU(const QString aFilePath)
|
||||
: FastFile_COD10_WiiU() {
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD10_WiiU::~FastFile_COD10_WiiU() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD10_WiiU::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD10_WiiU::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).section(".", 0, 0);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem + ".ff";
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD10_WiiU::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD9");
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
if (GetPlatform() == "PC") {
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
}
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
if (GetPlatform() == "360") {
|
||||
key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
} else if (GetPlatform() == "PC") {
|
||||
key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
}
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
QByteArray fileName(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileName.data(), 32);
|
||||
|
||||
// Skip the RSA signature (256 bytes).
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
if (GetPlatform() == "360") {
|
||||
//decompressedData = Compressor::cod9_decryptFastFile(aData);
|
||||
} else if (GetPlatform() == "PC") {
|
||||
decompressedData = Encryption::decryptFastFile_BO2(aData);
|
||||
}
|
||||
|
||||
// For COD9, write out the complete decompressed zone for testing.
|
||||
QFile testFile("exports/" + GetStem() + ".zone");
|
||||
if(testFile.open(QIODevice::WriteOnly)) {
|
||||
testFile.write(decompressedData);
|
||||
testFile.close();
|
||||
}
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD10_WiiU zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD10_WiiU>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/WiiU/fastfile_cod10_wiiu.h
Normal file
20
libs/fastfile/WiiU/fastfile_cod10_wiiu.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD10_WIIU_H
|
||||
#define FASTFILE_COD10_WIIU_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD10_WiiU : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD10_WiiU();
|
||||
FastFile_COD10_WiiU(const QByteArray &aData);
|
||||
FastFile_COD10_WiiU(const QString aFilePath);
|
||||
~FastFile_COD10_WiiU();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD10_WIIU_H
|
||||
135
libs/fastfile/WiiU/fastfile_cod9_wiiu.cpp
Normal file
135
libs/fastfile/WiiU/fastfile_cod9_wiiu.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
#include "fastfile_cod9_wiiu.h"
|
||||
#include "zonefile_cod9_wiiu.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD9_WiiU::FastFile_COD9_WiiU()
|
||||
: FastFile() {
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetGame("COD9");
|
||||
SetPlatform("WiiU");
|
||||
}
|
||||
|
||||
FastFile_COD9_WiiU::FastFile_COD9_WiiU(const QByteArray& aData)
|
||||
: FastFile_COD9_WiiU() {
|
||||
if (!aData.isEmpty()) {
|
||||
Load(aData);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD9_WiiU::FastFile_COD9_WiiU(const QString aFilePath)
|
||||
: FastFile_COD9_WiiU() {
|
||||
if (!aFilePath.isEmpty()) {
|
||||
Load(aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
FastFile_COD9_WiiU::~FastFile_COD9_WiiU() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD9_WiiU::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD9_WiiU::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).section(".", 0, 0);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem + ".ff";
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD9_WiiU::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD9");
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
if (GetPlatform() == "PC") {
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
}
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
if (GetPlatform() == "360") {
|
||||
key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
} else if (GetPlatform() == "PC") {
|
||||
key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
}
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
QByteArray fileName(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileName.data(), 32);
|
||||
|
||||
// Skip the RSA signature (256 bytes).
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
if (GetPlatform() == "360") {
|
||||
//decompressedData = Compressor::cod9_decryptFastFile(aData);
|
||||
} else if (GetPlatform() == "PC") {
|
||||
decompressedData = Encryption::decryptFastFile_BO2(aData);
|
||||
}
|
||||
|
||||
// For COD9, write out the complete decompressed zone for testing.
|
||||
QFile testFile("exports/" + GetStem() + ".zone");
|
||||
if(testFile.open(QIODevice::WriteOnly)) {
|
||||
testFile.write(decompressedData);
|
||||
testFile.close();
|
||||
}
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD9_WiiU zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD9_WiiU>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
20
libs/fastfile/WiiU/fastfile_cod9_wiiu.h
Normal file
20
libs/fastfile/WiiU/fastfile_cod9_wiiu.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FASTFILE_COD9_WIIU_H
|
||||
#define FASTFILE_COD9_WIIU_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD9_WiiU : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD9_WiiU();
|
||||
FastFile_COD9_WiiU(const QByteArray &aData);
|
||||
FastFile_COD9_WiiU(const QString aFilePath);
|
||||
~FastFile_COD9_WiiU();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD9_WIIU_H
|
||||
@ -3,37 +3,89 @@ TEMPLATE = lib
|
||||
CONFIG += staticlib c++17
|
||||
|
||||
SOURCES += \
|
||||
# Base class & factory
|
||||
fastfile.cpp \
|
||||
# 360 classes
|
||||
360/fastfile_cod2_360.cpp \
|
||||
360/fastfile_cod4_360.cpp \
|
||||
360/fastfile_cod5_360.cpp \
|
||||
360/fastfile_cod6_360.cpp \
|
||||
360/fastfile_cod7_360.cpp \
|
||||
360/fastfile_cod8_360.cpp \
|
||||
360/fastfile_cod9_360.cpp \
|
||||
360/fastfile_cod10_360.cpp \
|
||||
360/fastfile_cod11_360.cpp \
|
||||
360/fastfile_cod12_360.cpp \
|
||||
# PS3 classes
|
||||
PS3/fastfile_cod4_ps3.cpp \
|
||||
PS3/fastfile_cod5_ps3.cpp \
|
||||
PS3/fastfile_cod6_ps3.cpp \
|
||||
PS3/fastfile_cod7_ps3.cpp \
|
||||
PS3/fastfile_cod8_ps3.cpp \
|
||||
PS3/fastfile_cod9_ps3.cpp \
|
||||
PS3/fastfile_cod10_ps3.cpp \
|
||||
PS3/fastfile_cod11_ps3.cpp \
|
||||
PS3/fastfile_cod12_ps3.cpp \
|
||||
# PC classes
|
||||
PC/fastfile_cod4_pc.cpp \
|
||||
PC/fastfile_cod5_pc.cpp \
|
||||
PC/fastfile_cod6_pc.cpp \
|
||||
PC/fastfile_cod7_pc.cpp \
|
||||
PC/fastfile_cod8_pc.cpp \
|
||||
PC/fastfile_cod9_pc.cpp \
|
||||
PC/fastfile_cod10_pc.cpp \
|
||||
PC/fastfile_cod11_pc.cpp \
|
||||
PC/fastfile_cod12_pc.cpp \
|
||||
# Wii Classes
|
||||
Wii/fastfile_cod4_wii.cpp \
|
||||
Wii/fastfile_cod7_wii.cpp \
|
||||
WiiU/fastfile_cod9_wiiu.cpp
|
||||
Wii/fastfile_cod8_wii.cpp \
|
||||
# WiiU Classes
|
||||
WiiU/fastfile_cod9_wiiu.cpp \
|
||||
WiiU/fastfile_cod10_wiiu.cpp
|
||||
|
||||
HEADERS += \
|
||||
# Base class & factory
|
||||
fastfile.h \
|
||||
fastfile_factory.h \
|
||||
# 360 classes
|
||||
360/fastfile_cod2_360.h \
|
||||
360/fastfile_cod4_360.h \
|
||||
360/fastfile_cod5_360.h \
|
||||
360/fastfile_cod6_360.h \
|
||||
360/fastfile_cod7_360.h \
|
||||
360/fastfile_cod8_360.h \
|
||||
360/fastfile_cod9_360.h \
|
||||
360/fastfile_cod10_360.h \
|
||||
360/fastfile_cod11_360.h \
|
||||
360/fastfile_cod12_360.h \
|
||||
# PS3 classes
|
||||
PS3/fastfile_cod4_ps3.h \
|
||||
PS3/fastfile_cod5_ps3.h \
|
||||
PS3/fastfile_cod6_ps3.h \
|
||||
PS3/fastfile_cod7_ps3.h \
|
||||
PS3/fastfile_cod8_ps3.h \
|
||||
PS3/fastfile_cod9_ps3.h \
|
||||
PS3/fastfile_cod10_ps3.h \
|
||||
PS3/fastfile_cod11_ps3.h \
|
||||
PS3/fastfile_cod12_ps3.h \
|
||||
# PC classes
|
||||
PC/fastfile_cod4_pc.h \
|
||||
PC/fastfile_cod5_pc.h \
|
||||
PC/fastfile_cod6_pc.h \
|
||||
PC/fastfile_cod7_pc.h \
|
||||
PC/fastfile_cod8_pc.h \
|
||||
PC/fastfile_cod9_pc.h \
|
||||
PC/fastfile_cod10_pc.h \
|
||||
PC/fastfile_cod11_pc.h \
|
||||
PC/fastfile_cod12_pc.h \
|
||||
# Wii Classes
|
||||
Wii/fastfile_cod4_wii.h \
|
||||
Wii/fastfile_cod7_wii.h \
|
||||
Wii/fastfile_cod8_wii.h \
|
||||
# WiiU classes
|
||||
WiiU/fastfile_cod9_wiiu.h \
|
||||
fastfile_factory.h
|
||||
WiiU/fastfile_cod10_wiiu.h
|
||||
|
||||
LIBS += \
|
||||
-L$$OUT_PWD/../libs/core -lcore \
|
||||
|
||||
@ -3,42 +3,42 @@
|
||||
|
||||
#include "360/fastfile_cod2_360.h"
|
||||
//#include "360/fastfile_cod3_360.h"
|
||||
//#include "360/fastfile_cod4_360.h"
|
||||
#include "360/fastfile_cod4_360.h"
|
||||
#include "360/fastfile_cod5_360.h"
|
||||
//#include "360/fastfile_cod6_360.h"
|
||||
#include "360/fastfile_cod6_360.h"
|
||||
#include "360/fastfile_cod7_360.h"
|
||||
//#include "360/fastfile_cod8_360.h"
|
||||
#include "360/fastfile_cod8_360.h"
|
||||
#include "360/fastfile_cod9_360.h"
|
||||
//#include "360/fastfile_cod10_360.h"
|
||||
//#include "360/fastfile_cod11_360.h"
|
||||
//#include "360/fastfile_cod12_360.h"
|
||||
#include "360/fastfile_cod10_360.h"
|
||||
#include "360/fastfile_cod11_360.h"
|
||||
#include "360/fastfile_cod12_360.h"
|
||||
|
||||
//#include "PS3/fastfile_cod3_ps3.h"
|
||||
//#include "PS3/fastfile_cod4_ps3.h"
|
||||
#include "PS3/fastfile_cod4_ps3.h"
|
||||
#include "PS3/fastfile_cod5_ps3.h"
|
||||
//#include "PS3/fastfile_cod6_ps3.h"
|
||||
#include "PS3/fastfile_cod6_ps3.h"
|
||||
#include "PS3/fastfile_cod7_ps3.h"
|
||||
//#include "PS3/fastfile_cod8_ps3.h"
|
||||
#include "PS3/fastfile_cod8_ps3.h"
|
||||
#include "PS3/fastfile_cod9_ps3.h"
|
||||
//#include "PS3/fastfile_cod10_ps3.h"
|
||||
//#include "PS3/fastfile_cod11_ps3.h"
|
||||
//#include "PS3/fastfile_cod12_ps3.h"
|
||||
#include "PS3/fastfile_cod10_ps3.h"
|
||||
#include "PS3/fastfile_cod11_ps3.h"
|
||||
#include "PS3/fastfile_cod12_ps3.h"
|
||||
|
||||
//#include "PC/fastfile_cod3_pc.h"
|
||||
//#include "PC/fastfile_cod4_pc.h"
|
||||
#include "PC/fastfile_cod4_pc.h"
|
||||
#include "PC/fastfile_cod5_pc.h"
|
||||
//#include "PC/fastfile_cod6_pc.h"
|
||||
#include "PC/fastfile_cod6_pc.h"
|
||||
#include "PC/fastfile_cod7_pc.h"
|
||||
//#include "PC/fastfile_cod8_360.h"
|
||||
#include "PC/fastfile_cod8_pc.h"
|
||||
#include "PC/fastfile_cod9_pc.h"
|
||||
//#include "PC/fastfile_cod10_pc.h"
|
||||
//#include "PC/fastfile_cod11_pc.h"
|
||||
#include "PC/fastfile_cod10_pc.h"
|
||||
#include "PC/fastfile_cod11_pc.h"
|
||||
#include "PC/fastfile_cod12_pc.h"
|
||||
|
||||
#include "Wii//fastfile_cod7_wii.h"
|
||||
|
||||
#include "WiiU/fastfile_cod9_wiiu.h"
|
||||
//#include "WiiU/fastfile_cod10_wiiu.h"
|
||||
#include "WiiU/fastfile_cod10_wiiu.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
@ -60,21 +60,20 @@ enum FastFile_Platform {
|
||||
enum FastFile_Game {
|
||||
GAME_NONE = 0x00,
|
||||
GAME_COD2 = 0x01,
|
||||
GAME_COD3 = 0x02,
|
||||
GAME_COD4 = 0x03,
|
||||
GAME_COD5 = 0x04,
|
||||
GAME_COD6 = 0x05,
|
||||
GAME_COD7 = 0x06,
|
||||
GAME_COD8 = 0x07,
|
||||
GAME_COD9 = 0x08,
|
||||
GAME_COD10 = 0x09,
|
||||
GAME_COD11 = 0x010,
|
||||
GAME_COD12 = 0x011
|
||||
GAME_COD4 = 0x02,
|
||||
GAME_COD5 = 0x03,
|
||||
GAME_COD6 = 0x04,
|
||||
GAME_COD7 = 0x05,
|
||||
GAME_COD8 = 0x06,
|
||||
GAME_COD9 = 0x07,
|
||||
GAME_COD10 = 0x08,
|
||||
GAME_COD11 = 0x09,
|
||||
GAME_COD12 = 0x010
|
||||
};
|
||||
|
||||
class FastFileFactory {
|
||||
public:
|
||||
static std::shared_ptr<FastFile> Create(const QString& aFilePath) {
|
||||
static std::shared_ptr<FastFile> Create(const QString& aFilePath, bool aEmpty = false) {
|
||||
QFile fastFile(aFilePath);
|
||||
if (!fastFile.open(QIODevice::ReadOnly)) {
|
||||
qDebug() << "Factory failed to open fast file: " << aFilePath;
|
||||
@ -82,168 +81,166 @@ public:
|
||||
}
|
||||
|
||||
const QString stem = aFilePath.split('/').last().split('.').first();
|
||||
|
||||
const QString newPath = (aEmpty ? "" : aFilePath);
|
||||
|
||||
const QByteArray data = fastFile.readAll();
|
||||
std::shared_ptr<FastFile> resultFF = nullptr;
|
||||
if (pGetPlatform(data) == PLATFORM_360) {
|
||||
if (pGetGame(data) == GAME_COD2) {
|
||||
resultFF = std::make_shared<FastFile_COD2_360>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD3) {
|
||||
//resultFF = std::make_shared<FastFile_COD3_360>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD4) {
|
||||
//resultFF = std::make_shared<FastFile_COD4_360>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD5) {
|
||||
resultFF = std::make_shared<FastFile_COD5_360>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD6) {
|
||||
//resultFF = std::make_shared<FastFile_COD6_360>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD7) {
|
||||
resultFF = std::make_shared<FastFile_COD7_360>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD8) {
|
||||
//resultFF = std::make_shared<FastFile_COD8_360>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD9) {
|
||||
resultFF = std::make_shared<FastFile_COD9_360>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD10) {
|
||||
//resultFF = std::make_shared<FastFile_COD10_360>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD11) {
|
||||
//resultFF = std::make_shared<FastFile_COD11_360>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD12) {
|
||||
//resultFF = std::make_shared<FastFile_COD12_360>(aFilePath);
|
||||
|
||||
const FastFile_Platform platform = pGetPlatform(data);
|
||||
const FastFile_Game game = pGetGame(data);
|
||||
|
||||
if (platform == PLATFORM_360) {
|
||||
if (game == GAME_COD2) {
|
||||
resultFF = std::make_shared<FastFile_COD2_360>(newPath);
|
||||
} else if (game == GAME_COD4) {
|
||||
resultFF = std::make_shared<FastFile_COD4_360>(newPath);
|
||||
} else if (game == GAME_COD5) {
|
||||
resultFF = std::make_shared<FastFile_COD5_360>(newPath);
|
||||
} else if (game == GAME_COD6) {
|
||||
resultFF = std::make_shared<FastFile_COD6_360>(newPath);
|
||||
} else if (game == GAME_COD7) {
|
||||
resultFF = std::make_shared<FastFile_COD7_360>(newPath);
|
||||
} else if (game == GAME_COD8) {
|
||||
resultFF = std::make_shared<FastFile_COD8_360>(newPath);
|
||||
} else if (game == GAME_COD9) {
|
||||
resultFF = std::make_shared<FastFile_COD9_360>(newPath);
|
||||
} else if (game == GAME_COD10) {
|
||||
resultFF = std::make_shared<FastFile_COD10_360>(newPath);
|
||||
} else if (game == GAME_COD11) {
|
||||
resultFF = std::make_shared<FastFile_COD11_360>(newPath);
|
||||
} else if (game == GAME_COD12) {
|
||||
resultFF = std::make_shared<FastFile_COD12_360>(newPath);
|
||||
}
|
||||
} else if (pGetPlatform(data) == PLATFORM_PC) {
|
||||
if (pGetGame(data) == GAME_COD3) {
|
||||
//resultFF = std::make_shared<FastFile_COD3_PC>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD4) {
|
||||
//resultFF = std::make_shared<FastFile_COD4_PC>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD5) {
|
||||
resultFF = std::make_shared<FastFile_COD5_PC>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD6) {
|
||||
//resultFF = std::make_shared<FastFile_COD6_PC>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD7) {
|
||||
resultFF = std::make_shared<FastFile_COD7_PC>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD8) {
|
||||
//resultFF = std::make_shared<FastFile_COD8_PC>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD9) {
|
||||
resultFF = std::make_shared<FastFile_COD9_PC>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD10) {
|
||||
//resultFF = std::make_shared<FastFile_COD10_PC>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD11) {
|
||||
//resultFF = std::make_shared<FastFile_COD11_PC>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD12) {
|
||||
resultFF = std::make_shared<FastFile_COD12_PC>(aFilePath);
|
||||
} else if (platform == PLATFORM_PC) {
|
||||
if (game == GAME_COD4) {
|
||||
resultFF = std::make_shared<FastFile_COD4_PC>(newPath);
|
||||
} else if (game == GAME_COD5) {
|
||||
resultFF = std::make_shared<FastFile_COD5_PC>(newPath);
|
||||
} else if (game == GAME_COD6) {
|
||||
resultFF = std::make_shared<FastFile_COD6_PC>(newPath);
|
||||
} else if (game == GAME_COD7) {
|
||||
resultFF = std::make_shared<FastFile_COD7_PC>(newPath);
|
||||
} else if (game == GAME_COD8) {
|
||||
resultFF = std::make_shared<FastFile_COD8_PC>(newPath);
|
||||
} else if (game == GAME_COD9) {
|
||||
resultFF = std::make_shared<FastFile_COD9_PC>(newPath);
|
||||
} else if (game == GAME_COD10) {
|
||||
resultFF = std::make_shared<FastFile_COD10_PC>(newPath);
|
||||
} else if (game == GAME_COD11) {
|
||||
resultFF = std::make_shared<FastFile_COD11_PC>(newPath);
|
||||
} else if (game == GAME_COD12) {
|
||||
resultFF = std::make_shared<FastFile_COD12_PC>(newPath);
|
||||
}
|
||||
} else if (pGetPlatform(data) == PLATFORM_PS3) {
|
||||
if (pGetGame(data) == GAME_COD3) {
|
||||
//resultFF = std::make_shared<FastFile_COD3_PS3>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD4) {
|
||||
//resultFF = std::make_shared<FastFile_COD4_PS3>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD5) {
|
||||
resultFF = std::make_shared<FastFile_COD5_PS3>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD6) {
|
||||
//resultFF = std::make_shared<FastFile_COD6_PS3>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD7) {
|
||||
resultFF = std::make_shared<FastFile_COD7_PS3>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD8) {
|
||||
//resultFF = std::make_shared<FastFile_COD8_PS3>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD9) {
|
||||
resultFF = std::make_shared<FastFile_COD9_PS3>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD10) {
|
||||
//resultFF = std::make_shared<FastFile_COD10_PS3>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD11) {
|
||||
//resultFF = std::make_shared<FastFile_COD11_PS3>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD12) {
|
||||
//resultFF = std::make_shared<FastFile_COD12_PS3>(aFilePath);
|
||||
} else if (platform == PLATFORM_PS3) {
|
||||
if (game == GAME_COD4) {
|
||||
resultFF = std::make_shared<FastFile_COD4_PS3>(newPath);
|
||||
} else if (game == GAME_COD5) {
|
||||
resultFF = std::make_shared<FastFile_COD5_PS3>(newPath);
|
||||
} else if (game == GAME_COD6) {
|
||||
resultFF = std::make_shared<FastFile_COD6_PS3>(newPath);
|
||||
} else if (game == GAME_COD7) {
|
||||
resultFF = std::make_shared<FastFile_COD7_PS3>(newPath);
|
||||
} else if (game == GAME_COD8) {
|
||||
resultFF = std::make_shared<FastFile_COD8_PS3>(newPath);
|
||||
} else if (game == GAME_COD9) {
|
||||
resultFF = std::make_shared<FastFile_COD9_PS3>(newPath);
|
||||
} else if (game == GAME_COD10) {
|
||||
resultFF = std::make_shared<FastFile_COD10_PS3>(newPath);
|
||||
} else if (game == GAME_COD11) {
|
||||
resultFF = std::make_shared<FastFile_COD11_PS3>(newPath);
|
||||
} else if (game == GAME_COD12) {
|
||||
resultFF = std::make_shared<FastFile_COD12_PS3>(newPath);
|
||||
}
|
||||
} else if (pGetPlatform(data) == PLATFORM_WII) {
|
||||
if (pGetGame(data) == GAME_COD7) {
|
||||
resultFF = std::make_shared<FastFile_COD7_Wii>(aFilePath);
|
||||
} else if (platform == PLATFORM_WII) {
|
||||
if (game == GAME_COD7) {
|
||||
resultFF = std::make_shared<FastFile_COD7_Wii>(newPath);
|
||||
}
|
||||
} else if (pGetPlatform(data) == PLATFORM_WIIU) {
|
||||
if (pGetGame(data) == GAME_COD9) {
|
||||
resultFF = std::make_shared<FastFile_COD9_WiiU>(aFilePath);
|
||||
} else if (pGetGame(data) == GAME_COD10) {
|
||||
//resultFF = std::make_shared<FastFile_COD10_WiiU>(aFilePath);
|
||||
} else if (platform == PLATFORM_WIIU) {
|
||||
if (game == GAME_COD9) {
|
||||
resultFF = std::make_shared<FastFile_COD9_WiiU>(newPath);
|
||||
} else if (game == GAME_COD10) {
|
||||
resultFF = std::make_shared<FastFile_COD10_WiiU>(newPath);
|
||||
}
|
||||
}
|
||||
return resultFF;
|
||||
}
|
||||
static std::shared_ptr<FastFile> Create(const QByteArray& aData, const QString aStem = "no_name") {
|
||||
std::shared_ptr<FastFile> resultFF = nullptr;
|
||||
if (pGetPlatform(aData) == PLATFORM_360) {
|
||||
if (pGetGame(aData) == GAME_COD2) {
|
||||
|
||||
const FastFile_Platform platform = pGetPlatform(aData);
|
||||
const FastFile_Game game = pGetGame(aData);
|
||||
if (platform == PLATFORM_360) {
|
||||
if (game == GAME_COD2) {
|
||||
resultFF = std::make_shared<FastFile_COD2_360>(aData);
|
||||
} else if (pGetGame(aData) == GAME_COD3) {
|
||||
//resultFF = std::make_shared<FastFile_COD3_360>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD4) {
|
||||
//resultFF = std::make_shared<FastFile_COD4_360>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD5) {
|
||||
} else if (game == GAME_COD4) {
|
||||
resultFF = std::make_shared<FastFile_COD4_360>(aData);
|
||||
} else if (game == GAME_COD5) {
|
||||
resultFF = std::make_shared<FastFile_COD5_360>(aData);
|
||||
} else if (pGetGame(aData) == GAME_COD6) {
|
||||
//resultFF = std::make_shared<FastFile_COD6_360>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD7) {
|
||||
} else if (game == GAME_COD6) {
|
||||
resultFF = std::make_shared<FastFile_COD6_360>(aData);
|
||||
} else if (game == GAME_COD7) {
|
||||
resultFF = std::make_shared<FastFile_COD7_360>(aData);
|
||||
} else if (pGetGame(aData) == GAME_COD8) {
|
||||
//resultFF = std::make_shared<FastFile_COD8_360>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD9) {
|
||||
} else if (game == GAME_COD8) {
|
||||
resultFF = std::make_shared<FastFile_COD8_360>(aData);
|
||||
} else if (game == GAME_COD9) {
|
||||
resultFF = std::make_shared<FastFile_COD9_360>(aData);
|
||||
} else if (pGetGame(aData) == GAME_COD10) {
|
||||
//resultFF = std::make_shared<FastFile_COD10_360>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD11) {
|
||||
//resultFF = std::make_shared<FastFile_COD11_360>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD12) {
|
||||
//resultFF = std::make_shared<FastFile_COD12_360>(data);
|
||||
} else if (game == GAME_COD10) {
|
||||
resultFF = std::make_shared<FastFile_COD10_360>(aData);
|
||||
} else if (game == GAME_COD11) {
|
||||
resultFF = std::make_shared<FastFile_COD11_360>(aData);
|
||||
} else if (game == GAME_COD12) {
|
||||
resultFF = std::make_shared<FastFile_COD12_360>(aData);
|
||||
}
|
||||
} else if (pGetPlatform(aData) == PLATFORM_PC) {
|
||||
if (pGetGame(aData) == GAME_COD3) {
|
||||
//resultFF = std::make_shared<FastFile_COD3_PC>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD4) {
|
||||
//resultFF = std::make_shared<FastFile_COD4_PC>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD5) {
|
||||
} else if (platform == PLATFORM_PC) {
|
||||
if (game == GAME_COD4) {
|
||||
resultFF = std::make_shared<FastFile_COD4_PC>(aData);
|
||||
} else if (game == GAME_COD5) {
|
||||
resultFF = std::make_shared<FastFile_COD5_PC>(aData);
|
||||
} else if (pGetGame(aData) == GAME_COD6) {
|
||||
//resultFF = std::make_shared<FastFile_COD6_PC>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD7) {
|
||||
} else if (game == GAME_COD6) {
|
||||
resultFF = std::make_shared<FastFile_COD6_PC>(aData);
|
||||
} else if (game == GAME_COD7) {
|
||||
resultFF = std::make_shared<FastFile_COD7_PC>(aData);
|
||||
} else if (pGetGame(aData) == GAME_COD8) {
|
||||
//resultFF = std::make_shared<FastFile_COD8_PC>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD9) {
|
||||
} else if (game == GAME_COD8) {
|
||||
resultFF = std::make_shared<FastFile_COD8_PC>(aData);
|
||||
} else if (game == GAME_COD9) {
|
||||
resultFF = std::make_shared<FastFile_COD9_PC>(aData);
|
||||
} else if (pGetGame(aData) == GAME_COD10) {
|
||||
//resultFF = std::make_shared<FastFile_COD10_PC>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD11) {
|
||||
//resultFF = std::make_shared<FastFile_COD11_PC>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD12) {
|
||||
//resultFF = std::make_shared<FastFile_COD12_PC>(data);
|
||||
} else if (game == GAME_COD10) {
|
||||
resultFF = std::make_shared<FastFile_COD10_PC>(aData);
|
||||
} else if (game == GAME_COD11) {
|
||||
resultFF = std::make_shared<FastFile_COD11_PC>(aData);
|
||||
} else if (game == GAME_COD12) {
|
||||
resultFF = std::make_shared<FastFile_COD12_PC>(aData);
|
||||
}
|
||||
} else if (pGetPlatform(aData) == PLATFORM_PS3) {
|
||||
if (pGetGame(aData) == GAME_COD3) {
|
||||
//resultFF = std::make_shared<FastFile_COD3_PS3>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD4) {
|
||||
//resultFF = std::make_shared<FastFile_COD4_PS3>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD5) {
|
||||
} else if (platform == PLATFORM_PS3) {
|
||||
if (game == GAME_COD4) {
|
||||
resultFF = std::make_shared<FastFile_COD4_PS3>(aData);
|
||||
} else if (game == GAME_COD5) {
|
||||
resultFF = std::make_shared<FastFile_COD5_PS3>(aData);
|
||||
} else if (pGetGame(aData) == GAME_COD6) {
|
||||
//resultFF = std::make_shared<FastFile_COD6_PS3>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD7) {
|
||||
} else if (game == GAME_COD6) {
|
||||
resultFF = std::make_shared<FastFile_COD6_PS3>(aData);
|
||||
} else if (game == GAME_COD7) {
|
||||
resultFF = std::make_shared<FastFile_COD7_PS3>(aData);
|
||||
} else if (pGetGame(aData) == GAME_COD8) {
|
||||
//resultFF = std::make_shared<FastFile_COD8_PS3>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD9) {
|
||||
} else if (game == GAME_COD8) {
|
||||
resultFF = std::make_shared<FastFile_COD8_PS3>(aData);
|
||||
} else if (game == GAME_COD9) {
|
||||
resultFF = std::make_shared<FastFile_COD9_PS3>(aData);
|
||||
} else if (pGetGame(aData) == GAME_COD10) {
|
||||
//resultFF = std::make_shared<FastFile_COD10_PS3>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD11) {
|
||||
//resultFF = std::make_shared<FastFile_COD11_PS3>(data);
|
||||
} else if (pGetGame(aData) == GAME_COD12) {
|
||||
//resultFF = std::make_shared<FastFile_COD12_PS3>(data);
|
||||
} else if (game == GAME_COD10) {
|
||||
resultFF = std::make_shared<FastFile_COD10_PS3>(aData);
|
||||
} else if (game == GAME_COD11) {
|
||||
resultFF = std::make_shared<FastFile_COD11_PS3>(aData);
|
||||
} else if (game == GAME_COD12) {
|
||||
resultFF = std::make_shared<FastFile_COD12_PS3>(aData);
|
||||
}
|
||||
} else if (pGetPlatform(aData) == PLATFORM_WII) {
|
||||
if (pGetGame(aData) == GAME_COD7) {
|
||||
} else if (platform == PLATFORM_WII) {
|
||||
if (game == GAME_COD7) {
|
||||
resultFF = std::make_shared<FastFile_COD7_Wii>(aData);
|
||||
}
|
||||
} else if (pGetPlatform(aData) == PLATFORM_WIIU) {
|
||||
if (pGetGame(aData) == GAME_COD9) {
|
||||
} else if (platform == PLATFORM_WIIU) {
|
||||
if (game == GAME_COD9) {
|
||||
resultFF = std::make_shared<FastFile_COD9_WiiU>(aData);
|
||||
} else if (pGetGame(aData) == GAME_COD10) {
|
||||
//resultFF = std::make_shared<FastFile_COD10_WiiU>(data);
|
||||
} else if (game == GAME_COD10) {
|
||||
resultFF = std::make_shared<FastFile_COD10_WiiU>(aData);
|
||||
}
|
||||
}
|
||||
if (resultFF) {
|
||||
@ -261,6 +258,8 @@ private:
|
||||
sections << aData.mid(6, 2).toHex().toUpper();
|
||||
sections << aData.mid(8, 2).toHex().toUpper();
|
||||
sections << aData.mid(10, 2).toHex().toUpper();
|
||||
sections << aData.mid(12, 2).toHex().toUpper();
|
||||
sections << aData.mid(14, 2).toHex().toUpper();
|
||||
|
||||
return sections;
|
||||
}
|
||||
@ -270,29 +269,55 @@ private:
|
||||
if (sections[0] == "0000") {
|
||||
return PLATFORM_360;
|
||||
} else if (sections[4] == "0000") {
|
||||
if (sections[5] == "0001" ||
|
||||
sections[5] == "0183" ||
|
||||
sections[5] == "010D" ||
|
||||
sections[5] == "01D9" ||
|
||||
sections[5] == "0070" ||
|
||||
sections[5] == "0092" ||
|
||||
sections[5] == "022E" ||
|
||||
sections[5] == "072E" ||
|
||||
sections[5] == "0253") {
|
||||
|
||||
if (sections[5] == "0001" && sections[6] == "78DA") {
|
||||
return PLATFORM_360;
|
||||
} else if (sections[5] == "0183" && sections[6] == "7801") {
|
||||
return PLATFORM_360;
|
||||
} else if (sections[6] == "0101" && sections[7] == "CA3E") {
|
||||
return PLATFORM_360;
|
||||
} else if (sections[6] == "0000" && sections[7] == "0001") {
|
||||
return PLATFORM_360;
|
||||
} else if (sections[6] == "0101" && sections[7] == "CC76") {
|
||||
return PLATFORM_360;
|
||||
} else if (sections[6] == "0101" && sections[7] == "0101") {
|
||||
return PLATFORM_360;
|
||||
} else if (sections[2] == "7831") {
|
||||
return PLATFORM_360;
|
||||
} else if (sections[0] == "5331" && sections[2] == "7531") {
|
||||
return PLATFORM_360;
|
||||
} else if (sections[2] == "3030" && sections[3] == "3030") {
|
||||
return PLATFORM_360;
|
||||
}
|
||||
} else if (sections[5] == "0000") {
|
||||
return PLATFORM_PC;
|
||||
} else if (sections[5] == "01DD" && sections[6] == "7801") {
|
||||
return PLATFORM_WII;
|
||||
} else if (sections[5] == "0094" || sections[6] == "0100") {
|
||||
return PLATFORM_WIIU;
|
||||
}
|
||||
return PLATFORM_NONE;
|
||||
return PLATFORM_PS3;
|
||||
}
|
||||
|
||||
static FastFile_Game pGetGame(const QByteArray& aData) {
|
||||
const QStringList sections = pGetDataSections(aData);
|
||||
if (sections[0] == "0000") {
|
||||
return GAME_COD2;
|
||||
} else if (sections[5] == "0183") {
|
||||
} else if (sections[4] == "0500" || sections[5] == "0001") {
|
||||
return GAME_COD4;
|
||||
} else if (sections[4] == "8301" || sections[5] == "0183") {
|
||||
return GAME_COD5;
|
||||
} else if (sections[4] == "1401" || sections[5] == "010D") {
|
||||
return GAME_COD6;
|
||||
} else if (sections[4] == "D901" || sections[5] == "01D9") {
|
||||
return GAME_COD7;
|
||||
} else if (sections[4] == "0100" || sections[5] == "0070") {
|
||||
return GAME_COD8;
|
||||
} else if (sections[4] == "9300" || sections[5] == "0092"
|
||||
|| sections[5] == "0094") {
|
||||
return GAME_COD9;
|
||||
} else if (sections[4] == "3502" || sections[5] == "022E") {
|
||||
return GAME_COD10;
|
||||
} else if (sections[0] == "5331") {
|
||||
return GAME_COD11;
|
||||
} else if (sections[2] == "3030") {
|
||||
|
||||
1072
libs/zonefile/360/zonefile_cod10_360.cpp
Normal file
1072
libs/zonefile/360/zonefile_cod10_360.cpp
Normal file
File diff suppressed because it is too large
Load Diff
52
libs/zonefile/360/zonefile_cod10_360.h
Normal file
52
libs/zonefile/360/zonefile_cod10_360.h
Normal file
@ -0,0 +1,52 @@
|
||||
#ifndef ZONEFILE_COD10_360_H
|
||||
#define ZONEFILE_COD10_360_H
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD10_360 : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD10_360();
|
||||
~ZoneFile_COD10_360();
|
||||
|
||||
bool Load(const QByteArray aFileData) override;
|
||||
AssetType AssetStrToEnum(const QString aAssetType) override;
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
protected:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneSize(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsA(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneTagCount(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneRecordCount(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsB(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsC(QDataStream *aZoneFileStream) override;
|
||||
QStringList pParseZoneTags(QDataStream *aZoneFileStream, quint32 tagCount) override;
|
||||
QStringList pParseZoneIndex(QDataStream *aZoneFileStream, quint32 recordCount) override;
|
||||
AssetMap pParseAssets(QDataStream *aZoneFileStream, QStringList assetOrder) override;
|
||||
LocalString pParseAsset_LocalString(QDataStream *aZoneFileStream) override;
|
||||
RawFile pParseAsset_RawFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_PhysPreset(QDataStream *aZoneFileStream) override;
|
||||
Model pParseAsset_Model(QDataStream *aZoneFileStream) override;
|
||||
Material pParseAsset_Material(QDataStream *aZoneFileStream) override;
|
||||
Shader pParseAsset_Shader(QDataStream *aZoneFileStream) override;
|
||||
TechSet pParseAsset_TechSet(QDataStream *aZoneFileStream) override;
|
||||
Image pParseAsset_Image(QDataStream *aZoneFileStream) override;
|
||||
SoundAsset pParseAsset_Sound(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_ColMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapSP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_LightDef(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_UIMap(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_SNDDriverGlobals(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_AIType(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_FX(QDataStream *aZoneFileStream) override;
|
||||
Animation pParseAsset_Animation(QDataStream *aZoneFileStream) override;
|
||||
MenuFile pParseAsset_MenuFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_Weapon(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_D3DBSP(QDataStream *aZoneFileStream) override;
|
||||
StringTable pParseAsset_StringTable(QDataStream *aZoneFileStream) override;
|
||||
};
|
||||
|
||||
#endif // ZONEFILE_COD10_360_H
|
||||
1072
libs/zonefile/360/zonefile_cod11_360.cpp
Normal file
1072
libs/zonefile/360/zonefile_cod11_360.cpp
Normal file
File diff suppressed because it is too large
Load Diff
52
libs/zonefile/360/zonefile_cod11_360.h
Normal file
52
libs/zonefile/360/zonefile_cod11_360.h
Normal file
@ -0,0 +1,52 @@
|
||||
#ifndef ZONEFILE_COD11_360_H
|
||||
#define ZONEFILE_COD11_360_H
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD11_360 : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD11_360();
|
||||
~ZoneFile_COD11_360();
|
||||
|
||||
bool Load(const QByteArray aFileData) override;
|
||||
AssetType AssetStrToEnum(const QString aAssetType) override;
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
protected:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneSize(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsA(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneTagCount(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneRecordCount(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsB(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsC(QDataStream *aZoneFileStream) override;
|
||||
QStringList pParseZoneTags(QDataStream *aZoneFileStream, quint32 tagCount) override;
|
||||
QStringList pParseZoneIndex(QDataStream *aZoneFileStream, quint32 recordCount) override;
|
||||
AssetMap pParseAssets(QDataStream *aZoneFileStream, QStringList assetOrder) override;
|
||||
LocalString pParseAsset_LocalString(QDataStream *aZoneFileStream) override;
|
||||
RawFile pParseAsset_RawFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_PhysPreset(QDataStream *aZoneFileStream) override;
|
||||
Model pParseAsset_Model(QDataStream *aZoneFileStream) override;
|
||||
Material pParseAsset_Material(QDataStream *aZoneFileStream) override;
|
||||
Shader pParseAsset_Shader(QDataStream *aZoneFileStream) override;
|
||||
TechSet pParseAsset_TechSet(QDataStream *aZoneFileStream) override;
|
||||
Image pParseAsset_Image(QDataStream *aZoneFileStream) override;
|
||||
SoundAsset pParseAsset_Sound(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_ColMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapSP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_LightDef(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_UIMap(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_SNDDriverGlobals(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_AIType(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_FX(QDataStream *aZoneFileStream) override;
|
||||
Animation pParseAsset_Animation(QDataStream *aZoneFileStream) override;
|
||||
MenuFile pParseAsset_MenuFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_Weapon(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_D3DBSP(QDataStream *aZoneFileStream) override;
|
||||
StringTable pParseAsset_StringTable(QDataStream *aZoneFileStream) override;
|
||||
};
|
||||
|
||||
#endif // ZONEFILE_COD11_360_H
|
||||
1207
libs/zonefile/360/zonefile_cod12_360.cpp
Normal file
1207
libs/zonefile/360/zonefile_cod12_360.cpp
Normal file
File diff suppressed because it is too large
Load Diff
53
libs/zonefile/360/zonefile_cod12_360.h
Normal file
53
libs/zonefile/360/zonefile_cod12_360.h
Normal file
@ -0,0 +1,53 @@
|
||||
#ifndef ZONEFILE_COD12_360_H
|
||||
#define ZONEFILE_COD12_360_H
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD12_360: public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD12_360();
|
||||
~ZoneFile_COD12_360();
|
||||
|
||||
bool Load(const QByteArray aFileData) override;
|
||||
AssetType AssetStrToEnum(const QString aAssetType) override;
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
protected:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneSize(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsA(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneTagCount(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneRecordCount(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsB(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsC(QDataStream *aZoneFileStream) override;
|
||||
QStringList pParseZoneTags(QDataStream *aZoneFileStream, quint32 tagCount) override;
|
||||
QStringList pParseZoneIndex(QDataStream *aZoneFileStream, quint32 recordCount) override;
|
||||
AssetMap pParseAssets(QDataStream *aZoneFileStream, QStringList assetOrder) override;
|
||||
LocalString pParseAsset_LocalString(QDataStream *aZoneFileStream) override;
|
||||
RawFile pParseAsset_RawFile(QDataStream *aZoneFileStream) override;
|
||||
GscFile pParseAsset_GSCFile(QDataStream *aZoneFileStream) ;
|
||||
void pParseAsset_PhysPreset(QDataStream *aZoneFileStream) override;
|
||||
Model pParseAsset_Model(QDataStream *aZoneFileStream) override;
|
||||
Material pParseAsset_Material(QDataStream *aZoneFileStream) override;
|
||||
Shader pParseAsset_Shader(QDataStream *aZoneFileStream) override;
|
||||
TechSet pParseAsset_TechSet(QDataStream *aZoneFileStream) override;
|
||||
Image pParseAsset_Image(QDataStream *aZoneFileStream) override;
|
||||
SoundAsset pParseAsset_Sound(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_ColMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapSP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_LightDef(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_UIMap(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_SNDDriverGlobals(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_AIType(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_FX(QDataStream *aZoneFileStream) override;
|
||||
Animation pParseAsset_Animation(QDataStream *aZoneFileStream) override;
|
||||
MenuFile pParseAsset_MenuFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_Weapon(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_D3DBSP(QDataStream *aZoneFileStream) override;
|
||||
StringTable pParseAsset_StringTable(QDataStream *aZoneFileStream) override;
|
||||
};
|
||||
|
||||
#endif // ZONEFILE_COD12_PC_H
|
||||
1112
libs/zonefile/360/zonefile_cod2_360.cpp
Normal file
1112
libs/zonefile/360/zonefile_cod2_360.cpp
Normal file
File diff suppressed because it is too large
Load Diff
52
libs/zonefile/360/zonefile_cod2_360.h
Normal file
52
libs/zonefile/360/zonefile_cod2_360.h
Normal file
@ -0,0 +1,52 @@
|
||||
#ifndef ZONEFILE_COD2_360_H
|
||||
#define ZONEFILE_COD2_360_H
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD2_360 : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD2_360();
|
||||
~ZoneFile_COD2_360();
|
||||
|
||||
bool Load(const QByteArray aFileData) override;
|
||||
AssetType AssetStrToEnum(const QString aAssetType) override;
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
protected:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneSize(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsA(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneTagCount(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneRecordCount(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsB(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsC(QDataStream *aZoneFileStream) override;
|
||||
QStringList pParseZoneTags(QDataStream *aZoneFileStream, quint32 tagCount) override;
|
||||
QStringList pParseZoneIndex(QDataStream *aZoneFileStream, quint32 recordCount) override;
|
||||
AssetMap pParseAssets(QDataStream *aZoneFileStream, QStringList assetOrder) override;
|
||||
LocalString pParseAsset_LocalString(QDataStream *aZoneFileStream) override;
|
||||
RawFile pParseAsset_RawFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_PhysPreset(QDataStream *aZoneFileStream) override;
|
||||
Model pParseAsset_Model(QDataStream *aZoneFileStream) override;
|
||||
Material pParseAsset_Material(QDataStream *aZoneFileStream) override;
|
||||
Shader pParseAsset_Shader(QDataStream *aZoneFileStream) override;
|
||||
TechSet pParseAsset_TechSet(QDataStream *aZoneFileStream) override;
|
||||
Image pParseAsset_Image(QDataStream *aZoneFileStream) override;
|
||||
SoundAsset pParseAsset_Sound(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_ColMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapSP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_LightDef(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_UIMap(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_SNDDriverGlobals(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_AIType(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_FX(QDataStream *aZoneFileStream) override;
|
||||
Animation pParseAsset_Animation(QDataStream *aZoneFileStream) override;
|
||||
MenuFile pParseAsset_MenuFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_Weapon(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_D3DBSP(QDataStream *aZoneFileStream) override;
|
||||
StringTable pParseAsset_StringTable(QDataStream *aZoneFileStream) override;
|
||||
};
|
||||
|
||||
#endif // ZONEFILE_COD2_360_H
|
||||
1151
libs/zonefile/360/zonefile_cod4_360.cpp
Normal file
1151
libs/zonefile/360/zonefile_cod4_360.cpp
Normal file
File diff suppressed because it is too large
Load Diff
54
libs/zonefile/360/zonefile_cod4_360.h
Normal file
54
libs/zonefile/360/zonefile_cod4_360.h
Normal file
@ -0,0 +1,54 @@
|
||||
#ifndef ZONEFILE_COD4_360_H
|
||||
#define ZONEFILE_COD4_360_H
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD4_360 : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD4_360();
|
||||
~ZoneFile_COD4_360();
|
||||
|
||||
bool Load(const QByteArray aFileData) override;
|
||||
AssetType AssetStrToEnum(const QString aAssetType) override;
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
private:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneSize(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsA(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneTagCount(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneRecordCount(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsB(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsC(QDataStream *aZoneFileStream) override;
|
||||
QStringList pParseZoneTags(QDataStream *aZoneFileStream, quint32 tagCount) override;
|
||||
QStringList pParseZoneIndex(QDataStream *aZoneFileStream, quint32 recordCount) override;
|
||||
AssetMap pParseAssets(QDataStream *aZoneFileStream, QStringList assetOrder) override;
|
||||
LocalString pParseAsset_LocalString(QDataStream *aZoneFileStream) override;
|
||||
RawFile pParseAsset_RawFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_PhysPreset(QDataStream *aZoneFileStream) override;
|
||||
Model pParseAsset_Model(QDataStream *aZoneFileStream) override;
|
||||
Material pParseAsset_Material(QDataStream *aZoneFileStream) override;
|
||||
Shader pParseAsset_Shader(QDataStream *aZoneFileStream) override;
|
||||
TechSet pParseAsset_TechSet(QDataStream *aZoneFileStream) override;
|
||||
Image pParseAsset_Image(QDataStream *aZoneFileStream) override;
|
||||
SoundAsset pParseAsset_Sound(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_ColMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapSP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_LightDef(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_UIMap(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_SNDDriverGlobals(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_AIType(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_FX(QDataStream *aZoneFileStream) override;
|
||||
Animation pParseAsset_Animation(QDataStream *aZoneFileStream) override;
|
||||
MenuFile pParseAsset_MenuFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_Weapon(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_D3DBSP(QDataStream *aZoneFileStream) override;
|
||||
StringTable pParseAsset_StringTable(QDataStream *aZoneFileStream) override;
|
||||
};
|
||||
|
||||
#endif // ZONEFILE_COD4_360_H
|
||||
1151
libs/zonefile/360/zonefile_cod5_360.cpp
Normal file
1151
libs/zonefile/360/zonefile_cod5_360.cpp
Normal file
File diff suppressed because it is too large
Load Diff
54
libs/zonefile/360/zonefile_cod5_360.h
Normal file
54
libs/zonefile/360/zonefile_cod5_360.h
Normal file
@ -0,0 +1,54 @@
|
||||
#ifndef ZONEFILE_COD5_360_H
|
||||
#define ZONEFILE_COD5_360_H
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD5_360 : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD5_360();
|
||||
~ZoneFile_COD5_360();
|
||||
|
||||
bool Load(const QByteArray aFileData) override;
|
||||
AssetType AssetStrToEnum(const QString aAssetType) override;
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
private:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneSize(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsA(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneTagCount(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneRecordCount(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsB(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsC(QDataStream *aZoneFileStream) override;
|
||||
QStringList pParseZoneTags(QDataStream *aZoneFileStream, quint32 tagCount) override;
|
||||
QStringList pParseZoneIndex(QDataStream *aZoneFileStream, quint32 recordCount) override;
|
||||
AssetMap pParseAssets(QDataStream *aZoneFileStream, QStringList assetOrder) override;
|
||||
LocalString pParseAsset_LocalString(QDataStream *aZoneFileStream) override;
|
||||
RawFile pParseAsset_RawFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_PhysPreset(QDataStream *aZoneFileStream) override;
|
||||
Model pParseAsset_Model(QDataStream *aZoneFileStream) override;
|
||||
Material pParseAsset_Material(QDataStream *aZoneFileStream) override;
|
||||
Shader pParseAsset_Shader(QDataStream *aZoneFileStream) override;
|
||||
TechSet pParseAsset_TechSet(QDataStream *aZoneFileStream) override;
|
||||
Image pParseAsset_Image(QDataStream *aZoneFileStream) override;
|
||||
SoundAsset pParseAsset_Sound(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_ColMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapSP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_LightDef(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_UIMap(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_SNDDriverGlobals(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_AIType(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_FX(QDataStream *aZoneFileStream) override;
|
||||
Animation pParseAsset_Animation(QDataStream *aZoneFileStream) override;
|
||||
MenuFile pParseAsset_MenuFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_Weapon(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_D3DBSP(QDataStream *aZoneFileStream) override;
|
||||
StringTable pParseAsset_StringTable(QDataStream *aZoneFileStream) override;
|
||||
};
|
||||
|
||||
#endif // ZONEFILE_COD5_360_H
|
||||
1151
libs/zonefile/360/zonefile_cod6_360.cpp
Normal file
1151
libs/zonefile/360/zonefile_cod6_360.cpp
Normal file
File diff suppressed because it is too large
Load Diff
54
libs/zonefile/360/zonefile_cod6_360.h
Normal file
54
libs/zonefile/360/zonefile_cod6_360.h
Normal file
@ -0,0 +1,54 @@
|
||||
#ifndef ZONEFILE_COD6_360_H
|
||||
#define ZONEFILE_COD6_360_H
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD6_360 : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD6_360();
|
||||
~ZoneFile_COD6_360();
|
||||
|
||||
bool Load(const QByteArray aFileData) override;
|
||||
AssetType AssetStrToEnum(const QString aAssetType) override;
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
private:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneSize(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsA(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneTagCount(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneRecordCount(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsB(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsC(QDataStream *aZoneFileStream) override;
|
||||
QStringList pParseZoneTags(QDataStream *aZoneFileStream, quint32 tagCount) override;
|
||||
QStringList pParseZoneIndex(QDataStream *aZoneFileStream, quint32 recordCount) override;
|
||||
AssetMap pParseAssets(QDataStream *aZoneFileStream, QStringList assetOrder) override;
|
||||
LocalString pParseAsset_LocalString(QDataStream *aZoneFileStream) override;
|
||||
RawFile pParseAsset_RawFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_PhysPreset(QDataStream *aZoneFileStream) override;
|
||||
Model pParseAsset_Model(QDataStream *aZoneFileStream) override;
|
||||
Material pParseAsset_Material(QDataStream *aZoneFileStream) override;
|
||||
Shader pParseAsset_Shader(QDataStream *aZoneFileStream) override;
|
||||
TechSet pParseAsset_TechSet(QDataStream *aZoneFileStream) override;
|
||||
Image pParseAsset_Image(QDataStream *aZoneFileStream) override;
|
||||
SoundAsset pParseAsset_Sound(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_ColMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapSP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_LightDef(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_UIMap(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_SNDDriverGlobals(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_AIType(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_FX(QDataStream *aZoneFileStream) override;
|
||||
Animation pParseAsset_Animation(QDataStream *aZoneFileStream) override;
|
||||
MenuFile pParseAsset_MenuFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_Weapon(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_D3DBSP(QDataStream *aZoneFileStream) override;
|
||||
StringTable pParseAsset_StringTable(QDataStream *aZoneFileStream) override;
|
||||
};
|
||||
|
||||
#endif // ZONEFILE_COD6_360_H
|
||||
1077
libs/zonefile/360/zonefile_cod7_360.cpp
Normal file
1077
libs/zonefile/360/zonefile_cod7_360.cpp
Normal file
File diff suppressed because it is too large
Load Diff
52
libs/zonefile/360/zonefile_cod7_360.h
Normal file
52
libs/zonefile/360/zonefile_cod7_360.h
Normal file
@ -0,0 +1,52 @@
|
||||
#ifndef ZONEFILE_COD7_360_H
|
||||
#define ZONEFILE_COD7_360_H
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD7_360 : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD7_360();
|
||||
~ZoneFile_COD7_360();
|
||||
|
||||
bool Load(const QByteArray aFileData) override;
|
||||
AssetType AssetStrToEnum(const QString aAssetType) override;
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
protected:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneSize(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsA(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneTagCount(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneRecordCount(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsB(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsC(QDataStream *aZoneFileStream) override;
|
||||
QStringList pParseZoneTags(QDataStream *aZoneFileStream, quint32 tagCount) override;
|
||||
QStringList pParseZoneIndex(QDataStream *aZoneFileStream, quint32 recordCount) override;
|
||||
AssetMap pParseAssets(QDataStream *aZoneFileStream, QStringList assetOrder) override;
|
||||
LocalString pParseAsset_LocalString(QDataStream *aZoneFileStream) override;
|
||||
RawFile pParseAsset_RawFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_PhysPreset(QDataStream *aZoneFileStream) override;
|
||||
Model pParseAsset_Model(QDataStream *aZoneFileStream) override;
|
||||
Material pParseAsset_Material(QDataStream *aZoneFileStream) override;
|
||||
Shader pParseAsset_Shader(QDataStream *aZoneFileStream) override;
|
||||
TechSet pParseAsset_TechSet(QDataStream *aZoneFileStream) override;
|
||||
Image pParseAsset_Image(QDataStream *aZoneFileStream) override;
|
||||
SoundAsset pParseAsset_Sound(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_ColMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapSP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_LightDef(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_UIMap(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_SNDDriverGlobals(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_AIType(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_FX(QDataStream *aZoneFileStream) override;
|
||||
Animation pParseAsset_Animation(QDataStream *aZoneFileStream) override;
|
||||
MenuFile pParseAsset_MenuFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_Weapon(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_D3DBSP(QDataStream *aZoneFileStream) override;
|
||||
StringTable pParseAsset_StringTable(QDataStream *aZoneFileStream) override;
|
||||
};
|
||||
|
||||
#endif // ZONEFILE_COD7_360_H
|
||||
1077
libs/zonefile/360/zonefile_cod8_360.cpp
Normal file
1077
libs/zonefile/360/zonefile_cod8_360.cpp
Normal file
File diff suppressed because it is too large
Load Diff
52
libs/zonefile/360/zonefile_cod8_360.h
Normal file
52
libs/zonefile/360/zonefile_cod8_360.h
Normal file
@ -0,0 +1,52 @@
|
||||
#ifndef ZONEFILE_COD8_360_H
|
||||
#define ZONEFILE_COD8_360_H
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD8_360 : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD8_360();
|
||||
~ZoneFile_COD8_360();
|
||||
|
||||
bool Load(const QByteArray aFileData) override;
|
||||
AssetType AssetStrToEnum(const QString aAssetType) override;
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
protected:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneSize(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsA(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneTagCount(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneRecordCount(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsB(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsC(QDataStream *aZoneFileStream) override;
|
||||
QStringList pParseZoneTags(QDataStream *aZoneFileStream, quint32 tagCount) override;
|
||||
QStringList pParseZoneIndex(QDataStream *aZoneFileStream, quint32 recordCount) override;
|
||||
AssetMap pParseAssets(QDataStream *aZoneFileStream, QStringList assetOrder) override;
|
||||
LocalString pParseAsset_LocalString(QDataStream *aZoneFileStream) override;
|
||||
RawFile pParseAsset_RawFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_PhysPreset(QDataStream *aZoneFileStream) override;
|
||||
Model pParseAsset_Model(QDataStream *aZoneFileStream) override;
|
||||
Material pParseAsset_Material(QDataStream *aZoneFileStream) override;
|
||||
Shader pParseAsset_Shader(QDataStream *aZoneFileStream) override;
|
||||
TechSet pParseAsset_TechSet(QDataStream *aZoneFileStream) override;
|
||||
Image pParseAsset_Image(QDataStream *aZoneFileStream) override;
|
||||
SoundAsset pParseAsset_Sound(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_ColMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapSP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_LightDef(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_UIMap(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_SNDDriverGlobals(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_AIType(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_FX(QDataStream *aZoneFileStream) override;
|
||||
Animation pParseAsset_Animation(QDataStream *aZoneFileStream) override;
|
||||
MenuFile pParseAsset_MenuFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_Weapon(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_D3DBSP(QDataStream *aZoneFileStream) override;
|
||||
StringTable pParseAsset_StringTable(QDataStream *aZoneFileStream) override;
|
||||
};
|
||||
|
||||
#endif // ZONEFILE_COD8_360_H
|
||||
1072
libs/zonefile/360/zonefile_cod9_360.cpp
Normal file
1072
libs/zonefile/360/zonefile_cod9_360.cpp
Normal file
File diff suppressed because it is too large
Load Diff
52
libs/zonefile/360/zonefile_cod9_360.h
Normal file
52
libs/zonefile/360/zonefile_cod9_360.h
Normal file
@ -0,0 +1,52 @@
|
||||
#ifndef ZONEFILE_COD9_360_H
|
||||
#define ZONEFILE_COD9_360_H
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD9_360 : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD9_360();
|
||||
~ZoneFile_COD9_360();
|
||||
|
||||
bool Load(const QByteArray aFileData) override;
|
||||
AssetType AssetStrToEnum(const QString aAssetType) override;
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
protected:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneSize(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsA(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneTagCount(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneRecordCount(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsB(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsC(QDataStream *aZoneFileStream) override;
|
||||
QStringList pParseZoneTags(QDataStream *aZoneFileStream, quint32 tagCount) override;
|
||||
QStringList pParseZoneIndex(QDataStream *aZoneFileStream, quint32 recordCount) override;
|
||||
AssetMap pParseAssets(QDataStream *aZoneFileStream, QStringList assetOrder) override;
|
||||
LocalString pParseAsset_LocalString(QDataStream *aZoneFileStream) override;
|
||||
RawFile pParseAsset_RawFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_PhysPreset(QDataStream *aZoneFileStream) override;
|
||||
Model pParseAsset_Model(QDataStream *aZoneFileStream) override;
|
||||
Material pParseAsset_Material(QDataStream *aZoneFileStream) override;
|
||||
Shader pParseAsset_Shader(QDataStream *aZoneFileStream) override;
|
||||
TechSet pParseAsset_TechSet(QDataStream *aZoneFileStream) override;
|
||||
Image pParseAsset_Image(QDataStream *aZoneFileStream) override;
|
||||
SoundAsset pParseAsset_Sound(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_ColMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapSP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_LightDef(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_UIMap(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_SNDDriverGlobals(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_AIType(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_FX(QDataStream *aZoneFileStream) override;
|
||||
Animation pParseAsset_Animation(QDataStream *aZoneFileStream) override;
|
||||
MenuFile pParseAsset_MenuFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_Weapon(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_D3DBSP(QDataStream *aZoneFileStream) override;
|
||||
StringTable pParseAsset_StringTable(QDataStream *aZoneFileStream) override;
|
||||
};
|
||||
|
||||
#endif // ZONEFILE_COD9_360_H
|
||||
1072
libs/zonefile/PC/zonefile_cod10_pc.cpp
Normal file
1072
libs/zonefile/PC/zonefile_cod10_pc.cpp
Normal file
File diff suppressed because it is too large
Load Diff
52
libs/zonefile/PC/zonefile_cod10_pc.h
Normal file
52
libs/zonefile/PC/zonefile_cod10_pc.h
Normal file
@ -0,0 +1,52 @@
|
||||
#ifndef ZONEFILE_COD10_PC_H
|
||||
#define ZONEFILE_COD10_PC_H
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD10_PC : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD10_PC();
|
||||
~ZoneFile_COD10_PC();
|
||||
|
||||
bool Load(const QByteArray aFileData) override;
|
||||
AssetType AssetStrToEnum(const QString aAssetType) override;
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
protected:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneSize(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsA(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneTagCount(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneRecordCount(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsB(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsC(QDataStream *aZoneFileStream) override;
|
||||
QStringList pParseZoneTags(QDataStream *aZoneFileStream, quint32 tagCount) override;
|
||||
QStringList pParseZoneIndex(QDataStream *aZoneFileStream, quint32 recordCount) override;
|
||||
AssetMap pParseAssets(QDataStream *aZoneFileStream, QStringList assetOrder) override;
|
||||
LocalString pParseAsset_LocalString(QDataStream *aZoneFileStream) override;
|
||||
RawFile pParseAsset_RawFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_PhysPreset(QDataStream *aZoneFileStream) override;
|
||||
Model pParseAsset_Model(QDataStream *aZoneFileStream) override;
|
||||
Material pParseAsset_Material(QDataStream *aZoneFileStream) override;
|
||||
Shader pParseAsset_Shader(QDataStream *aZoneFileStream) override;
|
||||
TechSet pParseAsset_TechSet(QDataStream *aZoneFileStream) override;
|
||||
Image pParseAsset_Image(QDataStream *aZoneFileStream) override;
|
||||
SoundAsset pParseAsset_Sound(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_ColMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapSP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_LightDef(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_UIMap(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_SNDDriverGlobals(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_AIType(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_FX(QDataStream *aZoneFileStream) override;
|
||||
Animation pParseAsset_Animation(QDataStream *aZoneFileStream) override;
|
||||
MenuFile pParseAsset_MenuFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_Weapon(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_D3DBSP(QDataStream *aZoneFileStream) override;
|
||||
StringTable pParseAsset_StringTable(QDataStream *aZoneFileStream) override;
|
||||
};
|
||||
|
||||
#endif // ZONEFILE_COD10_PC_H
|
||||
1072
libs/zonefile/PC/zonefile_cod11_pc.cpp
Normal file
1072
libs/zonefile/PC/zonefile_cod11_pc.cpp
Normal file
File diff suppressed because it is too large
Load Diff
52
libs/zonefile/PC/zonefile_cod11_pc.h
Normal file
52
libs/zonefile/PC/zonefile_cod11_pc.h
Normal file
@ -0,0 +1,52 @@
|
||||
#ifndef ZONEFILE_COD11_H
|
||||
#define ZONEFILE_COD11_H
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD11_PC : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD11_PC();
|
||||
~ZoneFile_COD11_PC();
|
||||
|
||||
bool Load(const QByteArray aFileData) override;
|
||||
AssetType AssetStrToEnum(const QString aAssetType) override;
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
protected:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneSize(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsA(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneTagCount(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneRecordCount(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsB(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsC(QDataStream *aZoneFileStream) override;
|
||||
QStringList pParseZoneTags(QDataStream *aZoneFileStream, quint32 tagCount) override;
|
||||
QStringList pParseZoneIndex(QDataStream *aZoneFileStream, quint32 recordCount) override;
|
||||
AssetMap pParseAssets(QDataStream *aZoneFileStream, QStringList assetOrder) override;
|
||||
LocalString pParseAsset_LocalString(QDataStream *aZoneFileStream) override;
|
||||
RawFile pParseAsset_RawFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_PhysPreset(QDataStream *aZoneFileStream) override;
|
||||
Model pParseAsset_Model(QDataStream *aZoneFileStream) override;
|
||||
Material pParseAsset_Material(QDataStream *aZoneFileStream) override;
|
||||
Shader pParseAsset_Shader(QDataStream *aZoneFileStream) override;
|
||||
TechSet pParseAsset_TechSet(QDataStream *aZoneFileStream) override;
|
||||
Image pParseAsset_Image(QDataStream *aZoneFileStream) override;
|
||||
SoundAsset pParseAsset_Sound(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_ColMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapSP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_LightDef(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_UIMap(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_SNDDriverGlobals(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_AIType(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_FX(QDataStream *aZoneFileStream) override;
|
||||
Animation pParseAsset_Animation(QDataStream *aZoneFileStream) override;
|
||||
MenuFile pParseAsset_MenuFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_Weapon(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_D3DBSP(QDataStream *aZoneFileStream) override;
|
||||
StringTable pParseAsset_StringTable(QDataStream *aZoneFileStream) override;
|
||||
};
|
||||
|
||||
#endif // ZONEFILE_COD11_H
|
||||
1207
libs/zonefile/PC/zonefile_cod12_pc.cpp
Normal file
1207
libs/zonefile/PC/zonefile_cod12_pc.cpp
Normal file
File diff suppressed because it is too large
Load Diff
53
libs/zonefile/PC/zonefile_cod12_pc.h
Normal file
53
libs/zonefile/PC/zonefile_cod12_pc.h
Normal file
@ -0,0 +1,53 @@
|
||||
#ifndef ZONEFILE_COD12_PC_H
|
||||
#define ZONEFILE_COD12_PC_H
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD12_PC : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD12_PC();
|
||||
~ZoneFile_COD12_PC();
|
||||
|
||||
bool Load(const QByteArray aFileData) override;
|
||||
AssetType AssetStrToEnum(const QString aAssetType) override;
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
protected:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneSize(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsA(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneTagCount(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneRecordCount(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsB(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsC(QDataStream *aZoneFileStream) override;
|
||||
QStringList pParseZoneTags(QDataStream *aZoneFileStream, quint32 tagCount) override;
|
||||
QStringList pParseZoneIndex(QDataStream *aZoneFileStream, quint32 recordCount) override;
|
||||
AssetMap pParseAssets(QDataStream *aZoneFileStream, QStringList assetOrder) override;
|
||||
LocalString pParseAsset_LocalString(QDataStream *aZoneFileStream) override;
|
||||
RawFile pParseAsset_RawFile(QDataStream *aZoneFileStream) override;
|
||||
GscFile pParseAsset_GSCFile(QDataStream *aZoneFileStream) ;
|
||||
void pParseAsset_PhysPreset(QDataStream *aZoneFileStream) override;
|
||||
Model pParseAsset_Model(QDataStream *aZoneFileStream) override;
|
||||
Material pParseAsset_Material(QDataStream *aZoneFileStream) override;
|
||||
Shader pParseAsset_Shader(QDataStream *aZoneFileStream) override;
|
||||
TechSet pParseAsset_TechSet(QDataStream *aZoneFileStream) override;
|
||||
Image pParseAsset_Image(QDataStream *aZoneFileStream) override;
|
||||
SoundAsset pParseAsset_Sound(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_ColMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapSP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_LightDef(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_UIMap(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_SNDDriverGlobals(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_AIType(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_FX(QDataStream *aZoneFileStream) override;
|
||||
Animation pParseAsset_Animation(QDataStream *aZoneFileStream) override;
|
||||
MenuFile pParseAsset_MenuFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_Weapon(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_D3DBSP(QDataStream *aZoneFileStream) override;
|
||||
StringTable pParseAsset_StringTable(QDataStream *aZoneFileStream) override;
|
||||
};
|
||||
|
||||
#endif // ZONEFILE_COD12_PC_H
|
||||
1140
libs/zonefile/PC/zonefile_cod4_pc.cpp
Normal file
1140
libs/zonefile/PC/zonefile_cod4_pc.cpp
Normal file
File diff suppressed because it is too large
Load Diff
54
libs/zonefile/PC/zonefile_cod4_pc.h
Normal file
54
libs/zonefile/PC/zonefile_cod4_pc.h
Normal file
@ -0,0 +1,54 @@
|
||||
#ifndef ZONEFILE_COD4_PC_H
|
||||
#define ZONEFILE_COD4_PC_H
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD4_PC : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD4_PC();
|
||||
~ZoneFile_COD4_PC();
|
||||
|
||||
bool Load(const QByteArray aFileData) override;
|
||||
AssetType AssetStrToEnum(const QString aAssetType) override;
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
private:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneSize(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsA(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneTagCount(QDataStream *aZoneFileStream) override;
|
||||
quint32 pParseZoneRecordCount(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsB(QDataStream *aZoneFileStream) override;
|
||||
void pParseZoneUnknownsC(QDataStream *aZoneFileStream) override;
|
||||
QStringList pParseZoneTags(QDataStream *aZoneFileStream, quint32 tagCount) override;
|
||||
QStringList pParseZoneIndex(QDataStream *aZoneFileStream, quint32 recordCount) override;
|
||||
AssetMap pParseAssets(QDataStream *aZoneFileStream, QStringList assetOrder) override;
|
||||
LocalString pParseAsset_LocalString(QDataStream *aZoneFileStream) override;
|
||||
RawFile pParseAsset_RawFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_PhysPreset(QDataStream *aZoneFileStream) override;
|
||||
Model pParseAsset_Model(QDataStream *aZoneFileStream) override;
|
||||
Material pParseAsset_Material(QDataStream *aZoneFileStream) override;
|
||||
Shader pParseAsset_Shader(QDataStream *aZoneFileStream) override;
|
||||
TechSet pParseAsset_TechSet(QDataStream *aZoneFileStream) override;
|
||||
Image pParseAsset_Image(QDataStream *aZoneFileStream) override;
|
||||
SoundAsset pParseAsset_Sound(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_ColMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapSP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_GameMapMP(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_LightDef(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_UIMap(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_SNDDriverGlobals(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_AIType(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_FX(QDataStream *aZoneFileStream) override;
|
||||
Animation pParseAsset_Animation(QDataStream *aZoneFileStream) override;
|
||||
MenuFile pParseAsset_MenuFile(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_Weapon(QDataStream *aZoneFileStream) override;
|
||||
void pParseAsset_D3DBSP(QDataStream *aZoneFileStream) override;
|
||||
StringTable pParseAsset_StringTable(QDataStream *aZoneFileStream) override;
|
||||
};
|
||||
|
||||
#endif // ZONEFILE_COD4_PC_H
|
||||
1140
libs/zonefile/PC/zonefile_cod5_pc.cpp
Normal file
1140
libs/zonefile/PC/zonefile_cod5_pc.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user