Experimental: Tried changingto definition files per game (json).
This commit is contained in:
parent
f49ca74b17
commit
1024f96b1f
@ -42,36 +42,36 @@ void XTreeWidget::AddFastFile(FastFile* aFastFile) {
|
||||
XTreeWidgetItem *fastFileItem = new XTreeWidgetItem(this);
|
||||
fastFileItem->setText(0, aFastFile->GetStem());
|
||||
fastFileItem->setIcon(0, Utils::CreateAssetIcon("FF"));
|
||||
if (aFastFile->GetCommonInfo().GetPlatform() == PLATFORM_PC) {
|
||||
if (aFastFile->GetPlatform() == PLATFORM_PC) {
|
||||
fastFileItem->setIcon(1, Utils::CreateAssetIcon("PC"));
|
||||
} else if (aFastFile->GetCommonInfo().GetPlatform() == PLATFORM_XBOX) {
|
||||
} else if (aFastFile->GetPlatform() == PLATFORM_XBOX) {
|
||||
fastFileItem->setIcon(1, Utils::CreateAssetIcon("360"));
|
||||
} else if (aFastFile->GetCommonInfo().GetPlatform() == PLATFORM_PS3) {
|
||||
} else if (aFastFile->GetPlatform() == PLATFORM_PS3) {
|
||||
fastFileItem->setIcon(1, Utils::CreateAssetIcon("PS3"));
|
||||
} else if (aFastFile->GetCommonInfo().GetPlatform() == PLATFORM_WII) {
|
||||
} else if (aFastFile->GetPlatform() == PLATFORM_WII) {
|
||||
fastFileItem->setIcon(1, Utils::CreateAssetIcon("WII"));
|
||||
} else if (aFastFile->GetCommonInfo().GetPlatform() == PLATFORM_WIIU) {
|
||||
} else if (aFastFile->GetPlatform() == PLATFORM_WIIU) {
|
||||
fastFileItem->setIcon(1, Utils::CreateAssetIcon("WU"));
|
||||
}
|
||||
if (aFastFile->GetCommonInfo().GetGame() == GAME_COD2) {
|
||||
if (aFastFile->GetGame() == GAME_COD2) {
|
||||
fastFileItem->setIcon(2, Utils::CreateGameIcon(2));
|
||||
} if (aFastFile->GetCommonInfo().GetGame() == GAME_COD4) {
|
||||
} if (aFastFile->GetGame() == GAME_COD4) {
|
||||
fastFileItem->setIcon(2, Utils::CreateGameIcon(4));
|
||||
} else if (aFastFile->GetCommonInfo().GetGame() == GAME_COD5) {
|
||||
} else if (aFastFile->GetGame() == GAME_COD5) {
|
||||
fastFileItem->setIcon(2, Utils::CreateGameIcon(5));
|
||||
} else if (aFastFile->GetCommonInfo().GetGame() == GAME_COD6) {
|
||||
} else if (aFastFile->GetGame() == GAME_COD6) {
|
||||
fastFileItem->setIcon(2, Utils::CreateGameIcon(6));
|
||||
} else if (aFastFile->GetCommonInfo().GetGame() == GAME_COD7) {
|
||||
} else if (aFastFile->GetGame() == GAME_COD7) {
|
||||
fastFileItem->setIcon(2, Utils::CreateGameIcon(7));
|
||||
} else if (aFastFile->GetCommonInfo().GetGame() == GAME_COD8) {
|
||||
} else if (aFastFile->GetGame() == GAME_COD8) {
|
||||
fastFileItem->setIcon(2, Utils::CreateGameIcon(8));
|
||||
} else if (aFastFile->GetCommonInfo().GetGame() == GAME_COD9) {
|
||||
} else if (aFastFile->GetGame() == GAME_COD9) {
|
||||
fastFileItem->setIcon(2, Utils::CreateGameIcon(9));
|
||||
} else if (aFastFile->GetCommonInfo().GetGame() == GAME_COD10) {
|
||||
} else if (aFastFile->GetGame() == GAME_COD10) {
|
||||
fastFileItem->setIcon(2, Utils::CreateGameIcon(10));
|
||||
} else if (aFastFile->GetCommonInfo().GetGame() == GAME_COD11) {
|
||||
} else if (aFastFile->GetGame() == GAME_COD11) {
|
||||
fastFileItem->setIcon(2, Utils::CreateGameIcon(11));
|
||||
} else if (aFastFile->GetCommonInfo().GetGame() == GAME_COD12) {
|
||||
} else if (aFastFile->GetGame() == GAME_COD12) {
|
||||
fastFileItem->setIcon(2, Utils::CreateGameIcon(12));
|
||||
}
|
||||
|
||||
|
||||
136
definitions/cod4_pc.def
Normal file
136
definitions/cod4_pc.def
Normal file
@ -0,0 +1,136 @@
|
||||
{
|
||||
"compression": "ZLIB"
|
||||
"compressed_offset": 12,
|
||||
"byte_order": "LE",
|
||||
"header_ptr_count": 10
|
||||
"assets": [
|
||||
{
|
||||
"type": "ASSET_TYPE_XMODELPIECES",
|
||||
"value": "0x00"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_PHYSPRESET",
|
||||
"value": "0x01"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_XANIMPARTS",
|
||||
"value": "0x02"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_XMODEL",
|
||||
"value": "0x03"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_MATERIAL",
|
||||
"value": "0x04"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_TECHNIQUE_SET",
|
||||
"value": "0x05"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_IMAGE",
|
||||
"value": "0x06"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_PIXELSHADER",
|
||||
"value": "0x07"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_SOUND_CURVE",
|
||||
"value": "0x08"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_LOADED_SOUND",
|
||||
"value": "0x09"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_COL_MAP_MP",
|
||||
"value": "0x0A"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_COL_MAP_SP",
|
||||
"value": "0x0B"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_COM_MAP",
|
||||
"value": "0x0C"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_GAME_MAP_SP",
|
||||
"value": "0x0D"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_GAME_MAP_MP",
|
||||
"value": "0x0E"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_MAP_ENTS",
|
||||
"value": "0x0F"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_GFX_MAP",
|
||||
"value": "0x10"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_LIGHT_DEF",
|
||||
"value": "0x11"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_UI_MAP",
|
||||
"value": "0x12"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_FONT",
|
||||
"value": "0x13"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_MENULIST",
|
||||
"value": "0x14"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_MENU",
|
||||
"value": "0x15"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_LOCALIZE_ENTRY",
|
||||
"value": "0x16"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_WEAPON",
|
||||
"value": "0x17"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_SNDDRIVER_GLOBALS",
|
||||
"value": "0x18"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_IMPACT_FX",
|
||||
"value": "0x19"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_AITYPE",
|
||||
"value": "0x1A"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_MPTYPE",
|
||||
"value": "0x1B"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_CHARACTER",
|
||||
"value": "0x1C"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_XMODELALIAS",
|
||||
"value": "0x1D"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_RAWFILE",
|
||||
"value": "0x1F"
|
||||
},
|
||||
{
|
||||
"type": "ASSET_TYPE_STRINGTABLE",
|
||||
"value": "0x20"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -2,10 +2,8 @@ QT += core widgets
|
||||
TEMPLATE = lib
|
||||
CONFIG += staticlib c++17
|
||||
|
||||
SOURCES += $$files($$PWD/*.cpp, true) \
|
||||
xdatastream.cpp
|
||||
HEADERS += $$files($$PWD/*.h, true) \
|
||||
xdatastream.h
|
||||
SOURCES += $$files($$PWD/*.cpp, true)
|
||||
HEADERS += $$files($$PWD/*.h, true)
|
||||
|
||||
LIBS += -L$$OUT_PWD/../libs/xassets -lxassets
|
||||
|
||||
|
||||
231
libs/core/coredefinition.cpp
Normal file
231
libs/core/coredefinition.cpp
Normal file
@ -0,0 +1,231 @@
|
||||
#include "coredefinition.h"
|
||||
|
||||
#include "xasset.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonValue>
|
||||
#include <QJsonObject>
|
||||
|
||||
CoreDefinition::CoreDefinition()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString CoreDefinition::DefinitionPath() const
|
||||
{
|
||||
QString defPath = QDir::currentPath();
|
||||
|
||||
const XGame game = GetGame();
|
||||
if (game == GAME_NONE)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else if (game == GAME_COD7_5)
|
||||
{
|
||||
defPath += "cod7_5_";
|
||||
}
|
||||
else
|
||||
{
|
||||
defPath += QString("cod%_").arg(game);
|
||||
}
|
||||
|
||||
const XPlatform platform = GetPlatform();
|
||||
if (platform == PLATFORM_PC)
|
||||
{
|
||||
defPath += "pc";
|
||||
}
|
||||
else if (platform == PLATFORM_PS3)
|
||||
{
|
||||
defPath += "ps3";
|
||||
}
|
||||
else if (platform == PLATFORM_XBOX)
|
||||
{
|
||||
defPath += "xbox";
|
||||
}
|
||||
else if (platform == PLATFORM_WII)
|
||||
{
|
||||
defPath += "wii";
|
||||
}
|
||||
else if (platform == PLATFORM_WIIU)
|
||||
{
|
||||
defPath += "wiiu";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return defPath + ".def";
|
||||
}
|
||||
|
||||
XCompression CoreDefinition::Compression() const
|
||||
{
|
||||
return mCompression;
|
||||
}
|
||||
|
||||
void CoreDefinition::SetCompression(XCompression aCompression)
|
||||
{
|
||||
mCompression = aCompression;
|
||||
}
|
||||
|
||||
quint64 CoreDefinition::CompressedOffset() const
|
||||
{
|
||||
return mCompressedOffset;
|
||||
}
|
||||
|
||||
void CoreDefinition::SetCompressedOffset(quint64 aCompressedOffset)
|
||||
{
|
||||
mCompressedOffset = aCompressedOffset;
|
||||
}
|
||||
|
||||
QDataStream::ByteOrder CoreDefinition::ByteOrder() const
|
||||
{
|
||||
return mByteOrder;
|
||||
}
|
||||
|
||||
void CoreDefinition::SetByteOrder(QDataStream::ByteOrder aByteOrder)
|
||||
{
|
||||
mByteOrder = aByteOrder;
|
||||
}
|
||||
|
||||
quint32 CoreDefinition::PtrCount() const
|
||||
{
|
||||
return mPtrCount;
|
||||
}
|
||||
|
||||
void CoreDefinition::SetPtrCount(quint32 aPtrCount)
|
||||
{
|
||||
mPtrCount = aPtrCount;
|
||||
}
|
||||
|
||||
QMap<XAssetType, quint32> CoreDefinition::AssetMapping() const
|
||||
{
|
||||
return mAssetMapping;
|
||||
}
|
||||
|
||||
void CoreDefinition::SetAssetMapping(const QMap<XAssetType, quint32> &aAssetMapping)
|
||||
{
|
||||
mAssetMapping = aAssetMapping;
|
||||
}
|
||||
|
||||
bool CoreDefinition::Load()
|
||||
{
|
||||
const QString defFilePath = DefinitionPath();
|
||||
QFile defFile(defFilePath);
|
||||
if (!defFile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
qDebug() << "ERROR: Failed to open def file: " << defFile.errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
const QByteArray defData = defFile.readAll();
|
||||
defFile.close();
|
||||
|
||||
QJsonDocument defDoc = QJsonDocument::fromJson(defData);
|
||||
QJsonObject defObj = defDoc.object();
|
||||
|
||||
// Check for compression
|
||||
if (!defObj.contains("compression"))
|
||||
{
|
||||
qDebug() << "ERROR: Failed to find 'compression' key in definition file!";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parse compression
|
||||
QString compressionStr = defObj["compression"].toString();
|
||||
if (compressionStr == "ZLIB")
|
||||
{
|
||||
mCompression = COMPRESSION_ZLIB;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "ERROR: Invalid compression string: " << byteOrderStr;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for compressed offset
|
||||
if (!defObj.contains("compressed_offset"))
|
||||
{
|
||||
qDebug() << "ERROR: Failed to find 'compressed_offset' key in definition file!";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parse compressed offset
|
||||
mCompressedOffset = defObj["compressed_offset"].toInt();
|
||||
|
||||
// Check for byte order
|
||||
if (!defObj.contains("byte_order"))
|
||||
{
|
||||
qDebug() << "ERROR: Failed to find 'byte_order' key in definition file!";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parse byte order
|
||||
QString byteOrderStr = defObj["byte_order"].toString();
|
||||
if (byteOrderStr == "LE")
|
||||
{
|
||||
mByteOrder = QDataStream::LittleEndian;
|
||||
}
|
||||
else if (byteOrderStr == "BE")
|
||||
{
|
||||
mByteOrder = QDataStream::BigEndian;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "ERROR: Invalid byte order string: " << byteOrderStr;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for header pointer count
|
||||
if (!defObj.contains("header_ptr_count"))
|
||||
{
|
||||
qDebug() << "ERROR: Failed to find 'header_ptr_count' key in definition file!";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parse header pointer count
|
||||
mPtrCount = defObj["header_ptr_count"].toInt();
|
||||
|
||||
// Check for asset mappings
|
||||
if (!defObj.contains("assets"))
|
||||
{
|
||||
qDebug() << "ERROR: Failed to find 'assets' key in definition file!";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parse asset mappings
|
||||
foreach (const QJsonValue val, defObj["assets"].toArray())
|
||||
{
|
||||
QJsonObject valObj = val.toObject();
|
||||
|
||||
// Check for asset type
|
||||
if (!valObj.contains("type"))
|
||||
{
|
||||
qDebug() << "ERROR: Failed to find 'type' key in definition file!";
|
||||
continue;
|
||||
}
|
||||
QString typeStr = valObj["type"].toString();
|
||||
|
||||
// Check for asset value
|
||||
if (!valObj.contains("value"))
|
||||
{
|
||||
qDebug() << "ERROR: Failed to find 'value' key in definition file!";
|
||||
continue;
|
||||
}
|
||||
quint32 value = valObj["value"].toInt();
|
||||
|
||||
for (int i = ASSET_TYPE_XMODELPIECES; i != ASSET_TYPE_NONE; i++)
|
||||
{
|
||||
XAssetType type = static_cast<XAssetType>(i);
|
||||
if (XAsset::XAssetTypeToString(type) == typeStr)
|
||||
{
|
||||
mAssetMapping[type] = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return !mAssetMapping.isEmpty();
|
||||
}
|
||||
46
libs/core/coredefinition.h
Normal file
46
libs/core/coredefinition.h
Normal file
@ -0,0 +1,46 @@
|
||||
#ifndef COREDEFINITION_H
|
||||
#define COREDEFINITION_H
|
||||
|
||||
#include "xassettype.h"
|
||||
#include "xcommoninfo.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QMap>
|
||||
|
||||
enum XCompression
|
||||
{
|
||||
COMPRESSION_NONE = 0,
|
||||
COMPRESSION_ZLIB = 1
|
||||
};
|
||||
|
||||
class CoreDefinition : public XCommonInfo
|
||||
{
|
||||
public:
|
||||
CoreDefinition();
|
||||
|
||||
bool Load();
|
||||
|
||||
QDataStream::ByteOrder ByteOrder() const;
|
||||
void SetByteOrder(QDataStream::ByteOrder aByteOrder);
|
||||
quint32 PtrCount() const;
|
||||
void SetPtrCount(quint32 aPtrCount);
|
||||
QMap<XAssetType, quint32> AssetMapping() const;
|
||||
void SetAssetMapping(const QMap<XAssetType, quint32> &aAssetMapping);
|
||||
|
||||
XCompression Compression() const;
|
||||
void SetCompression(XCompression aCompression);
|
||||
quint64 CompressedOffset() const;
|
||||
void SetCompressedOffset(quint64 aCompressedOffset);
|
||||
|
||||
private:
|
||||
QString DefinitionPath() const;
|
||||
|
||||
XCompression mCompression;
|
||||
quint64 mCompressedOffset;
|
||||
|
||||
QDataStream::ByteOrder mByteOrder;
|
||||
quint32 mPtrCount;
|
||||
QMap<XAssetType, quint32> mAssetMapping;
|
||||
};
|
||||
|
||||
#endif // COREDEFINITION_H
|
||||
@ -101,7 +101,9 @@ bool FastFile_COD10_360::Load(const QByteArray aData) {
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD10_360* zoneFile = new ZoneFile_COD10_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -139,7 +139,9 @@ bool FastFile_COD11_360::Load(const QByteArray aData) {
|
||||
// Load the zone file with decompressed data
|
||||
ZoneFile_COD11_360* zoneFile = new ZoneFile_COD11_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -139,7 +139,9 @@ bool FastFile_COD12_360::Load(const QByteArray aData) {
|
||||
// Load the zone file with decompressed data
|
||||
ZoneFile_COD12_360* zoneFile = new ZoneFile_COD12_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -1,90 +0,0 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
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() const {
|
||||
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
|
||||
SetStem(aFilePath.section("/", -1, -1));
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << GetStem();
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD2_360::Load(const QByteArray aData) {
|
||||
// Create a XDataStream on the input data.
|
||||
XDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
|
||||
Utils::ReadUntilHex(&fastFileStream, "78");
|
||||
QByteArray compressedData = aData.mid(fastFileStream.device()->pos());
|
||||
QByteArray decompressedData = Compression::DecompressZLIB(compressedData);
|
||||
|
||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD2_360* zoneFile = new ZoneFile_COD2_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
}
|
||||
SetZoneFile(zoneFile);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
#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() const override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD2_360_H
|
||||
@ -1,139 +0,0 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
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() const {
|
||||
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;
|
||||
|
||||
const QString header = aData.left(8);
|
||||
if (header == "IWffu100") {
|
||||
// For COD5, simply decompress from offset 12.
|
||||
decompressedData = Compression::DecompressZLIB(aData.mid(12));
|
||||
} else if (header == "IWff0100") {
|
||||
// Create a XDataStream on the input data.
|
||||
XDataStream fastFileStream(aData.mid(12));
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
|
||||
QByteArray magic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(magic.data(), 8);
|
||||
if (magic != "IWffs100") {
|
||||
qDebug() << "Found invalid signed header: " << magic;
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
QByteArray rsaSigChecksum(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSigChecksum.data(), 32);
|
||||
|
||||
QByteArray rsaSig(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSig.data(), 256);
|
||||
|
||||
QByteArray fileName(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileName.data(), 32);
|
||||
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
QByteArray bigSigBlock(7856, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(bigSigBlock.data(), 7856);
|
||||
|
||||
QVector<QByteArray> sigBlocks = QVector<QByteArray>();
|
||||
QByteArray compressedData;
|
||||
|
||||
for (int i = 0; i < (aData.size() / 202000) + 1; i++)
|
||||
{
|
||||
QByteArray newSigBlocks;
|
||||
for (int j = 0; j < 256; j++) {
|
||||
QByteArray newSigBlock(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(newSigBlock.data(), 32);
|
||||
sigBlocks.append(newSigBlock);
|
||||
}
|
||||
newSigBlocks.append(newSigBlocks);
|
||||
for (int j = 0; j < 256; j++) {
|
||||
QByteArray compressedChunk(8192, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(compressedChunk.data(), 8192);
|
||||
compressedData.append(compressedChunk);
|
||||
}
|
||||
}
|
||||
decompressedData = Compression::DecompressZLIB(compressedData);
|
||||
}
|
||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||
|
||||
ZoneFile_COD4_360* zoneFile = new ZoneFile_COD4_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
}
|
||||
SetZoneFile(zoneFile);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
#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() const override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD4_360_H
|
||||
@ -1,91 +0,0 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
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() const {
|
||||
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(GetBaseStem() + ".zone", decompressedData);
|
||||
|
||||
ZoneFile_COD5_360* zoneFile = new ZoneFile_COD5_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
}
|
||||
SetZoneFile(zoneFile);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
#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() const override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD5_360_H
|
||||
@ -113,7 +113,9 @@ bool FastFile_COD6_360::Load(const QByteArray aData) {
|
||||
|
||||
ZoneFile_COD6_360* zoneFile = new ZoneFile_COD6_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -138,7 +138,9 @@ bool FastFile_COD7_360::Load(const QByteArray aData) {
|
||||
|
||||
ZoneFile_COD7_360* zoneFile = new ZoneFile_COD7_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -136,7 +136,9 @@ bool FastFile_COD7_5_360::Load(const QByteArray aData) {
|
||||
|
||||
ZoneFile_COD7_360* zoneFile = new ZoneFile_COD7_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -99,7 +99,9 @@ bool FastFile_COD8_360::Load(const QByteArray aData) {
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD8_360* zoneFile = new ZoneFile_COD8_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -103,7 +103,9 @@ bool FastFile_COD9_360::Load(const QByteArray aData) {
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD9_360* zoneFile = new ZoneFile_COD9_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -81,7 +81,7 @@ bool FastFile_COD10_PC::Load(const QByteArray aData) {
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(XDataStream::BigEndian);
|
||||
if (GetCommonInfo().GetPlatform() == PLATFORM_PC) {
|
||||
if (GetPlatform() == PLATFORM_PC) {
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
}
|
||||
|
||||
@ -118,7 +118,9 @@ bool FastFile_COD10_PC::Load(const QByteArray aData) {
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD10_PC* zoneFile = new ZoneFile_COD10_PC();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -114,7 +114,9 @@ bool FastFile_COD11_PC::Load(const QByteArray aData) {
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD11_PC* zoneFile = new ZoneFile_COD11_PC();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -1,95 +0,0 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
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() const {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD4_PC::Load(const QString aFilePath) {
|
||||
StatusBarManager::instance().updateStatus("Loading COD" + GetCommonInfo().GetGameString() + " 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 XDataStream on the input data.
|
||||
XDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
|
||||
// For COD5, simply decompress from offset 12.
|
||||
decompressedData = Compression::DecompressZLIB(aData.mid(12));
|
||||
|
||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||
|
||||
ZoneFile_COD4_PC* zoneFile = new ZoneFile_COD4_PC();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
}
|
||||
SetZoneFile(zoneFile);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
#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() const override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD4_PC_H
|
||||
@ -1,95 +0,0 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
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() const {
|
||||
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 XDataStream on the input data.
|
||||
XDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
|
||||
// For COD5, simply decompress from offset 12.
|
||||
decompressedData = Compression::DecompressZLIB(aData.mid(12));
|
||||
|
||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||
|
||||
ZoneFile_COD5_PC* zoneFile = new ZoneFile_COD5_PC();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
}
|
||||
SetZoneFile(zoneFile);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
#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() const override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD5_PC_H
|
||||
@ -99,7 +99,9 @@ bool FastFile_COD6_PC::Load(const QByteArray aData) {
|
||||
|
||||
ZoneFile_COD6_PC* zoneFile = new ZoneFile_COD6_PC();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -89,7 +89,8 @@ bool FastFile_COD7_PC::Load(const QByteArray aData) {
|
||||
|
||||
// ZoneFile_COD7_PC* zoneFile = new ZoneFile_COD7_PC();
|
||||
// zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
// zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
// zoneFile->SetGame(GetGame());
|
||||
// zoneFile->SetPlatform(GetPlatform());
|
||||
// if (!zoneFile->Load(decompressedData)) {
|
||||
// qWarning() << "Failed to load ZoneFile!";
|
||||
// return false;
|
||||
|
||||
@ -86,7 +86,9 @@ bool FastFile_COD8_PC::Load(const QByteArray aData) {
|
||||
|
||||
ZoneFile_COD8_PC* zoneFile = new ZoneFile_COD8_PC();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -172,7 +172,9 @@ bool FastFile_COD9_PC::Load(const QByteArray aData) {
|
||||
// Load zone file
|
||||
ZoneFile_COD9_PC* zoneFile = new ZoneFile_COD9_PC();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(finalZone)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -81,15 +81,15 @@ bool FastFile_COD10_PS3::Load(const QByteArray aData) {
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(XDataStream::BigEndian);
|
||||
if (GetCommonInfo().GetPlatform() == PLATFORM_PC) {
|
||||
if (GetPlatform() == PLATFORM_PC) {
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
}
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
if (GetCommonInfo().GetPlatform() == PLATFORM_XBOX) {
|
||||
if (GetPlatform() == PLATFORM_XBOX) {
|
||||
key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
} else if (GetCommonInfo().GetPlatform() == PLATFORM_PC) {
|
||||
} else if (GetPlatform() == PLATFORM_PC) {
|
||||
key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
}
|
||||
|
||||
@ -118,7 +118,9 @@ bool FastFile_COD10_PS3::Load(const QByteArray aData) {
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD10_PS3* zoneFile = new ZoneFile_COD10_PS3();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -138,7 +138,9 @@ bool FastFile_COD11_PS3::Load(const QByteArray aData) {
|
||||
// Load the zone file with decompressed data
|
||||
ZoneFile_COD11_PS3* zoneFile = new ZoneFile_COD11_PS3();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -81,15 +81,15 @@ bool FastFile_COD12_PS3::Load(const QByteArray aData) {
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(XDataStream::BigEndian);
|
||||
if (GetCommonInfo().GetPlatform() == PLATFORM_PC) {
|
||||
if (GetPlatform() == PLATFORM_PC) {
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
}
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
if (GetCommonInfo().GetPlatform() == PLATFORM_XBOX) {
|
||||
if (GetPlatform() == PLATFORM_XBOX) {
|
||||
key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
} else if (GetCommonInfo().GetPlatform() == PLATFORM_PC) {
|
||||
} else if (GetPlatform() == PLATFORM_PC) {
|
||||
key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
}
|
||||
|
||||
@ -118,7 +118,9 @@ bool FastFile_COD12_PS3::Load(const QByteArray aData) {
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD12_PS3* zoneFile = new ZoneFile_COD12_PS3();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -106,7 +106,9 @@ bool FastFile_COD4_PS3::Load(const QByteArray aData) {
|
||||
|
||||
ZoneFile_COD4_PS3* zoneFile = new ZoneFile_COD4_PS3();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -77,13 +77,6 @@ bool FastFile_COD5_PS3::Load(const QByteArray aData) {
|
||||
XDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
SetVersion(pParseFFVersion(&fastFileStream));
|
||||
|
||||
// Loop until EOF or invalid chunk
|
||||
fastFileStream.setByteOrder(XDataStream::BigEndian);
|
||||
while (!fastFileStream.atEnd()) {
|
||||
@ -106,7 +99,9 @@ bool FastFile_COD5_PS3::Load(const QByteArray aData) {
|
||||
|
||||
ZoneFile_COD5_PS3* zoneFile = new ZoneFile_COD5_PS3();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -99,7 +99,9 @@ bool FastFile_COD6_PS3::Load(const QByteArray aData) {
|
||||
|
||||
ZoneFile_COD6_PS3* zoneFile = new ZoneFile_COD6_PS3();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -82,7 +82,9 @@ bool FastFile_COD7_PS3::Load(const QByteArray aData) {
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD7_PS3* zoneFile = new ZoneFile_COD7_PS3();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(XDataStream::BigEndian);
|
||||
|
||||
@ -84,19 +84,21 @@ bool FastFile_COD8_PS3::Load(const QByteArray aData) {
|
||||
|
||||
ZoneFile_COD8_PS3* zoneFile = new ZoneFile_COD8_PS3();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(XDataStream::BigEndian);
|
||||
if (GetCommonInfo().GetPlatform() == PLATFORM_PC) {
|
||||
if (GetPlatform() == PLATFORM_PC) {
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
fastFileStream.skipRawData(4);
|
||||
if (GetCommonInfo().GetPlatform() == PLATFORM_XBOX) {
|
||||
if (GetPlatform() == PLATFORM_XBOX) {
|
||||
key = QByteArray::fromHex("1ac1d12d527c59b40eca619120ff8217ccff09cd16896f81b829c7f52793405d");
|
||||
} else if (GetCommonInfo().GetPlatform() == PLATFORM_PS3) {
|
||||
} else if (GetPlatform() == PLATFORM_PS3) {
|
||||
key = QByteArray::fromHex("46D3F997F29C9ACE175B0DAE3AB8C0C1B8E423E2E3BF7E3C311EA35245BF193A");
|
||||
// or
|
||||
// key = QByteArray::fromHex("0C99B3DDB8D6D0845D1147E470F28A8BF2AE69A8A9F534767B54E9180FF55370");
|
||||
|
||||
@ -81,15 +81,15 @@ bool FastFile_COD9_PS3::Load(const QByteArray aData) {
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(XDataStream::BigEndian);
|
||||
if (GetCommonInfo().GetPlatform() == PLATFORM_PC) {
|
||||
if (GetPlatform() == PLATFORM_PC) {
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
}
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
if (GetCommonInfo().GetPlatform() == PLATFORM_XBOX) {
|
||||
if (GetPlatform() == PLATFORM_XBOX) {
|
||||
key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
} else if (GetCommonInfo().GetPlatform() == PLATFORM_PC) {
|
||||
} else if (GetPlatform() == PLATFORM_PC) {
|
||||
key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
}
|
||||
|
||||
@ -110,9 +110,9 @@ bool FastFile_COD9_PS3::Load(const QByteArray aData) {
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
if (GetCommonInfo().GetPlatform() == PLATFORM_XBOX) {
|
||||
if (GetPlatform() == PLATFORM_XBOX) {
|
||||
//decompressedData = Compressor::cod9_decryptFastFile(aData);
|
||||
} else if (GetCommonInfo().GetPlatform() == PLATFORM_PC) {
|
||||
} else if (GetPlatform() == PLATFORM_PC) {
|
||||
//decompressedData = Encryption::decryptFastFile_BO2(aData);
|
||||
}
|
||||
|
||||
@ -126,7 +126,9 @@ bool FastFile_COD9_PS3::Load(const QByteArray aData) {
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD9_PS3* zoneFile = new ZoneFile_COD9_PS3();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -73,7 +73,9 @@ bool FastFile_COD4_Wii::Load(const QByteArray aData) {
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD4_Wii* zoneFile = new ZoneFile_COD4_Wii();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -99,7 +99,9 @@ bool FastFile_COD7_Wii::Load(const QByteArray aData) {
|
||||
|
||||
ZoneFile_COD7_Wii* zoneFile = new ZoneFile_COD7_Wii();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -88,7 +88,9 @@ bool FastFile_COD8_Wii::Load(const QByteArray aData) {
|
||||
|
||||
ZoneFile_COD8_Wii* zoneFile = new ZoneFile_COD8_Wii();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -79,15 +79,15 @@ bool FastFile_COD10_WiiU::Load(const QByteArray aData) {
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(XDataStream::BigEndian);
|
||||
if (GetCommonInfo().GetPlatform() == PLATFORM_PC) {
|
||||
if (GetPlatform() == PLATFORM_PC) {
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
}
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
if (GetCommonInfo().GetPlatform() == PLATFORM_XBOX) {
|
||||
if (GetPlatform() == PLATFORM_XBOX) {
|
||||
key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
} else if (GetCommonInfo().GetPlatform() == PLATFORM_PC) {
|
||||
} else if (GetPlatform() == PLATFORM_PC) {
|
||||
key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
}
|
||||
|
||||
@ -108,9 +108,9 @@ bool FastFile_COD10_WiiU::Load(const QByteArray aData) {
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
if (GetCommonInfo().GetPlatform() == PLATFORM_XBOX) {
|
||||
if (GetPlatform() == PLATFORM_XBOX) {
|
||||
//decompressedData = Compressor::cod9_decryptFastFile(aData);
|
||||
} else if (GetCommonInfo().GetPlatform() == PLATFORM_PC) {
|
||||
} else if (GetPlatform() == PLATFORM_PC) {
|
||||
//decompressedData = Encryption::decryptFastFile_BO2(aData);
|
||||
}
|
||||
|
||||
@ -124,7 +124,9 @@ bool FastFile_COD10_WiiU::Load(const QByteArray aData) {
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD10_WiiU *zoneFile = new ZoneFile_COD10_WiiU();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -79,15 +79,15 @@ bool FastFile_COD9_WiiU::Load(const QByteArray aData) {
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(XDataStream::BigEndian);
|
||||
if (GetCommonInfo().GetPlatform() == PLATFORM_PC) {
|
||||
if (GetPlatform() == PLATFORM_PC) {
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
}
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
if (GetCommonInfo().GetPlatform() == PLATFORM_XBOX) {
|
||||
if (GetPlatform() == PLATFORM_XBOX) {
|
||||
key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
} else if (GetCommonInfo().GetPlatform() == PLATFORM_PC) {
|
||||
} else if (GetPlatform() == PLATFORM_PC) {
|
||||
key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
}
|
||||
|
||||
@ -108,9 +108,9 @@ bool FastFile_COD9_WiiU::Load(const QByteArray aData) {
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
if (GetCommonInfo().GetPlatform() == PLATFORM_XBOX) {
|
||||
if (GetPlatform() == PLATFORM_XBOX) {
|
||||
//decompressedData = Compressor::cod9_decryptFastFile(aData);
|
||||
} else if (GetCommonInfo().GetPlatform() == PLATFORM_PC) {
|
||||
} else if (GetPlatform() == PLATFORM_PC) {
|
||||
//decompressedData = Encryption::decryptFastFile_BO2(aData);
|
||||
}
|
||||
|
||||
@ -124,7 +124,9 @@ bool FastFile_COD9_WiiU::Load(const QByteArray aData) {
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD9_WiiU* zoneFile = new ZoneFile_COD9_WiiU();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile->SetCommonInfo(&mCommonInfo);
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
|
||||
@ -7,8 +7,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
FastFile::FastFile()
|
||||
: mCommonInfo(),
|
||||
mStem(""),
|
||||
: mStem(""),
|
||||
mType(FILETYPE_NONE),
|
||||
mCompany(COMPANY_NONE),
|
||||
mSignage(SIGNAGE_NONE),
|
||||
@ -20,12 +19,11 @@ FastFile::FastFile()
|
||||
}
|
||||
|
||||
FastFile::FastFile(const QByteArray &aData) {
|
||||
Q_UNUSED(aData);
|
||||
Load(aData);
|
||||
}
|
||||
|
||||
FastFile::FastFile(FastFile &fastFile)
|
||||
: mCommonInfo(fastFile.GetCommonInfo()),
|
||||
mStem(fastFile.GetStem()),
|
||||
: mStem(fastFile.GetStem()),
|
||||
mType(fastFile.GetType()),
|
||||
mCompany(fastFile.GetCompany()),
|
||||
mSignage(fastFile.GetSignage()),
|
||||
@ -36,8 +34,67 @@ FastFile::FastFile(FastFile &fastFile)
|
||||
|
||||
}
|
||||
|
||||
FastFile::~FastFile() {
|
||||
bool FastFile::Load(const QString aFilePath)
|
||||
{
|
||||
StatusBarManager::instance().updateStatus("Loading COD" + GetGameString() + " 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();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile::Load(const QByteArray aData)
|
||||
{
|
||||
StatusBarManager::instance().updateStatus("Loading COD" + GetGameString() + " Fast File w/data", 1000);
|
||||
QByteArray decompressedData;
|
||||
|
||||
mDefinition.SetGame(GetGame());
|
||||
mDefinition.SetPlatform(GetPlatform());
|
||||
mDefinition.Load();
|
||||
|
||||
// Create a XDataStream on the input data.
|
||||
XDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
|
||||
const QByteArray compressedData = aData.mid(mDefinition.CompressedOffset());
|
||||
if (mDefinition.Compression() == COMPRESSION_ZLIB)
|
||||
{
|
||||
decompressedData = Compression::DecompressZLIB(compressedData);
|
||||
}
|
||||
|
||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||
|
||||
ZoneFile_COD4_PC* zoneFile = new ZoneFile_COD4_PC();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
|
||||
zoneFile->SetGame(GetGame());
|
||||
zoneFile->SetPlatform(GetPlatform());
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
}
|
||||
SetZoneFile(zoneFile);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString FastFile::GetStem() const {
|
||||
@ -258,16 +315,6 @@ FastFile* FastFile::Open(const QString &aFilePath) {
|
||||
return fastFile;
|
||||
}
|
||||
|
||||
XCommonInfo FastFile::GetCommonInfo() const
|
||||
{
|
||||
return mCommonInfo;
|
||||
}
|
||||
|
||||
void FastFile::SetCommonInfo(const XCommonInfo &newCommonInfo)
|
||||
{
|
||||
mCommonInfo = newCommonInfo;
|
||||
}
|
||||
|
||||
bool FastFile::Debug() const
|
||||
{
|
||||
return mDebug;
|
||||
|
||||
@ -11,16 +11,15 @@
|
||||
|
||||
class ZoneFile;
|
||||
|
||||
class FastFile
|
||||
class FastFile : public XCommonInfo
|
||||
{
|
||||
public:
|
||||
FastFile();
|
||||
FastFile(const QByteArray& aData);
|
||||
FastFile(FastFile &fastFile);
|
||||
~FastFile();
|
||||
|
||||
virtual bool Load(const QString aFilePath) = 0;
|
||||
virtual bool Load(const QByteArray aData) = 0;
|
||||
virtual bool Load(const QString aFilePath);
|
||||
virtual bool Load(const QByteArray aData);
|
||||
|
||||
virtual bool ExportFastFile(const QString aFastFilePath) const;
|
||||
|
||||
@ -54,15 +53,9 @@ public:
|
||||
|
||||
static FastFile* Open(const QString& aFilePath);
|
||||
|
||||
XCommonInfo GetCommonInfo() const;
|
||||
void SetCommonInfo(const XCommonInfo &newCommonInfo);
|
||||
|
||||
bool Debug() const;
|
||||
void SetDebug(bool aDebug);
|
||||
|
||||
protected:
|
||||
XCommonInfo mCommonInfo;
|
||||
|
||||
private:
|
||||
QString mStem;
|
||||
FF_FILETYPE mType;
|
||||
|
||||
@ -152,7 +152,8 @@ public:
|
||||
|
||||
if (resultFF)
|
||||
{
|
||||
resultFF->SetCommonInfo(XCommonInfo(aGame, aPlatform));
|
||||
resultFF->SetGame(aGame);
|
||||
resultFF->SetPlatform(aPlatform);
|
||||
}
|
||||
|
||||
return resultFF;
|
||||
@ -250,7 +251,8 @@ public:
|
||||
}
|
||||
if (resultFF) {
|
||||
resultFF->SetStem(aStem);
|
||||
resultFF->SetCommonInfo(XCommonInfo(aGame, aPlatform));
|
||||
resultFF->SetGame(aGame);
|
||||
resultFF->SetPlatform(aPlatform);
|
||||
resultFF->Load(aData);
|
||||
}
|
||||
|
||||
|
||||
@ -24,7 +24,6 @@ XAsset::XAsset()
|
||||
, mType(ASSET_TYPE_NONE)
|
||||
, mName("Unknown Asset")
|
||||
, mDisplayName("Unknown")
|
||||
, mCommonInfo(nullptr)
|
||||
, mSubAssets()
|
||||
{
|
||||
|
||||
@ -443,16 +442,6 @@ QString XAsset::XAssetTypeToString(XAssetType type) {
|
||||
}
|
||||
}
|
||||
|
||||
const XCommonInfo *XAsset::GetCommonInfo() const
|
||||
{
|
||||
return mCommonInfo;
|
||||
}
|
||||
|
||||
void XAsset::SetCommonInfo(const XCommonInfo *newCommonInfo)
|
||||
{
|
||||
mCommonInfo = newCommonInfo;
|
||||
}
|
||||
|
||||
QString XAsset::DisplayName() const
|
||||
{
|
||||
return mDisplayName;
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
class ZoneFile;
|
||||
|
||||
class XAsset
|
||||
class XAsset : public XCommonInfo
|
||||
{
|
||||
public:
|
||||
explicit XAsset();
|
||||
@ -39,9 +39,6 @@ public:
|
||||
|
||||
static bool mDebug;
|
||||
|
||||
const XCommonInfo *GetCommonInfo() const;
|
||||
void SetCommonInfo(const XCommonInfo *newCommonInfo);
|
||||
|
||||
QString DisplayName() const;
|
||||
void SetDisplayName(const QString &aDisplayName);
|
||||
|
||||
@ -55,8 +52,6 @@ private:
|
||||
QString mName;
|
||||
QString mDisplayName;
|
||||
|
||||
const XCommonInfo* mCommonInfo;
|
||||
|
||||
QVector<XAsset*> mSubAssets;
|
||||
};
|
||||
|
||||
|
||||
@ -61,8 +61,10 @@ void XAssetList::ParseData(XDataStream *aStream) {
|
||||
XAsset* asset = XAsset::Create(assetHeader.GetAssetType());
|
||||
if (asset)
|
||||
{
|
||||
asset->SetGame(GetGame());
|
||||
asset->SetPlatform(GetPlatform());
|
||||
|
||||
asset->SetPtr(assetHeader.GetAssetPtr());
|
||||
asset->SetCommonInfo(GetCommonInfo());
|
||||
asset->ParseDataSafe(aStream);
|
||||
|
||||
mAssets.append(asset);
|
||||
|
||||
@ -142,8 +142,7 @@ enum XAssetType
|
||||
ASSET_TYPE_BEAM,
|
||||
ASSET_TYPE_STREAMER_HINT,
|
||||
ASSET_TYPE_CG_MEDIA_TABLE,
|
||||
|
||||
ASSET_TYPE_NONE = 0x1000
|
||||
ASSET_TYPE_NONE
|
||||
};
|
||||
|
||||
#endif // XASSETTYPE_H
|
||||
|
||||
@ -12,7 +12,7 @@ XFile::XFile()
|
||||
void XFile::ParseData(XDataStream *aStream)
|
||||
{
|
||||
quint32 contentLength = aStream->ParseUInt32(QString("%1 content length").arg(GetName()));
|
||||
if (GetCommonInfo()->GetGame() == GAME_COD5)
|
||||
if (GetGame() == GAME_COD5)
|
||||
{
|
||||
contentLength += 36;
|
||||
aStream->skipRawData(8 * 4);
|
||||
|
||||
@ -48,7 +48,7 @@ void XGfxImage::ParseData(XDataStream *aStream)
|
||||
mCategory = aStream->ParseUInt8(QString("%1 category").arg(GetName()));
|
||||
mDelayLoadPixels = aStream->ParseUInt8(QString("%1 delay load pixels").arg(GetName()));
|
||||
|
||||
if (GetCommonInfo()->GetGame() == GAME_COD4)
|
||||
if (GetGame() == GAME_COD4)
|
||||
{
|
||||
pixelsPtr = 0;
|
||||
}
|
||||
|
||||
@ -103,7 +103,8 @@ void XItemDef::Clear()
|
||||
|
||||
void XItemDef::ParseData(XDataStream *aStream)
|
||||
{
|
||||
mWindow.SetCommonInfo(GetCommonInfo());
|
||||
mWindow.SetGame(GetGame());
|
||||
mWindow.SetPlatform(GetPlatform());
|
||||
mWindow.ParseData(aStream);
|
||||
|
||||
for (int i = 0; i < 1; i++)
|
||||
@ -157,28 +158,36 @@ void XItemDef::ParseData(XDataStream *aStream)
|
||||
|
||||
mImageTrack = aStream->ParseInt32(QString("%1 image track").arg(GetName()));
|
||||
|
||||
mVisibleExp.SetCommonInfo(GetCommonInfo());
|
||||
mVisibleExp.SetGame(GetGame());
|
||||
mVisibleExp.SetPlatform(GetPlatform());
|
||||
mVisibleExp.ParseData(aStream);
|
||||
|
||||
mTextExp.SetCommonInfo(GetCommonInfo());
|
||||
mTextExp.SetGame(GetGame());
|
||||
mTextExp.SetPlatform(GetPlatform());
|
||||
mTextExp.ParseData(aStream);
|
||||
|
||||
mMaterialExp.SetCommonInfo(GetCommonInfo());
|
||||
mMaterialExp.SetGame(GetGame());
|
||||
mMaterialExp.SetPlatform(GetPlatform());
|
||||
mMaterialExp.ParseData(aStream);
|
||||
|
||||
mRectXExp.SetCommonInfo(GetCommonInfo());
|
||||
mRectXExp.SetGame(GetGame());
|
||||
mRectXExp.SetPlatform(GetPlatform());
|
||||
mRectXExp.ParseData(aStream);
|
||||
|
||||
mRectYExp.SetCommonInfo(GetCommonInfo());
|
||||
mRectYExp.SetGame(GetGame());
|
||||
mRectYExp.SetPlatform(GetPlatform());
|
||||
mRectYExp.ParseData(aStream);
|
||||
|
||||
mRectWExp.SetCommonInfo(GetCommonInfo());
|
||||
mRectWExp.SetGame(GetGame());
|
||||
mRectWExp.SetPlatform(GetPlatform());
|
||||
mRectWExp.ParseData(aStream);
|
||||
|
||||
mRectHExp.SetCommonInfo(GetCommonInfo());
|
||||
mRectHExp.SetGame(GetGame());
|
||||
mRectHExp.SetPlatform(GetPlatform());
|
||||
mRectHExp.ParseData(aStream);
|
||||
|
||||
mForecolorAExp.SetCommonInfo(GetCommonInfo());
|
||||
mRectHExp.SetGame(GetGame());
|
||||
mForecolorAExp.SetPlatform(GetPlatform());
|
||||
mForecolorAExp.ParseData(aStream);
|
||||
|
||||
|
||||
|
||||
@ -36,13 +36,20 @@ void XMaterial::ParseData(XDataStream *aStream)
|
||||
|
||||
aStream->skipRawData(1);
|
||||
|
||||
mTechniqueSet.SetCommonInfo(GetCommonInfo());
|
||||
mTechniqueSet.SetGame(GetGame());
|
||||
mTechniqueSet.SetPlatform(GetPlatform());
|
||||
mTechniqueSet.ParsePtr(aStream, false);
|
||||
mTextureTable.SetCommonInfo(GetCommonInfo());
|
||||
|
||||
mTextureTable.SetGame(GetGame());
|
||||
mTextureTable.SetPlatform(GetPlatform());
|
||||
mTextureTable.ParsePtr(aStream, false);
|
||||
mConstantTable.SetCommonInfo(GetCommonInfo());
|
||||
|
||||
mConstantTable.SetGame(GetGame());
|
||||
mConstantTable.SetPlatform(GetPlatform());
|
||||
mConstantTable.ParsePtr(aStream, false);
|
||||
mStateBitsTable.SetCommonInfo(GetCommonInfo());
|
||||
|
||||
mStateBitsTable.SetGame(GetGame());
|
||||
mStateBitsTable.SetPlatform(GetPlatform());
|
||||
mStateBitsTable.ParsePtr(aStream, false);
|
||||
|
||||
XString materialName = mInfo.MaterialName();
|
||||
|
||||
@ -35,7 +35,7 @@ void XMaterialPass::ParseData(XDataStream *aStream)
|
||||
}
|
||||
|
||||
mVertexDecl.ParsePtr(aStream, false);
|
||||
if (GetCommonInfo()->GetGame() != GAME_COD4)
|
||||
if (GetGame() != GAME_COD4)
|
||||
{
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
@ -45,7 +45,7 @@ void XMaterialPass::ParseData(XDataStream *aStream)
|
||||
mVertexShader.ParsePtr(aStream, false);
|
||||
mPixelShader.ParsePtr(aStream, false);
|
||||
|
||||
if (GetCommonInfo()->GetGame() == GAME_COD4)
|
||||
if (GetGame() == GAME_COD4)
|
||||
{
|
||||
mPerPrimArgCount = aStream->ParseUInt8(QString("%1 per primary arg count").arg(GetName()));
|
||||
mPerObjArgCount = aStream->ParseUInt8(QString("%1 per object arg count").arg(GetName()));
|
||||
@ -68,7 +68,7 @@ void XMaterialPass::ParseData(XDataStream *aStream)
|
||||
|
||||
mVertexDecl.ParseDataSafe(aStream);
|
||||
|
||||
if (GetCommonInfo()->GetGame() != GAME_COD4)
|
||||
if (GetGame() != GAME_COD4)
|
||||
{
|
||||
for (int i = 0; i < mVertexShaderArray.size(); i++)
|
||||
{
|
||||
|
||||
@ -25,7 +25,8 @@ void XMaterialTechnique::ParseData(XDataStream *aStream)
|
||||
|
||||
for (int i = 0; i < mPassCount; i++)
|
||||
{
|
||||
mPassArray[i].SetCommonInfo(GetCommonInfo());
|
||||
mPassArray[i].SetGame(GetGame());
|
||||
mPassArray[i].SetPlatform(GetPlatform());
|
||||
mPassArray[i].ParseData(aStream);
|
||||
}
|
||||
|
||||
|
||||
@ -36,7 +36,8 @@ void XMaterialTechniqueSet::ParseData(XDataStream *aStream)
|
||||
for (int i = 0; i < GetMaxTechniqueCount(); i++)
|
||||
{
|
||||
XMaterialTechnique newTechnique;
|
||||
newTechnique.SetCommonInfo(GetCommonInfo());
|
||||
newTechnique.SetGame(GetGame());
|
||||
newTechnique.SetPlatform(GetPlatform());
|
||||
newTechnique.ParsePtr(aStream, false);
|
||||
mTechniques.push_back(newTechnique);
|
||||
|
||||
@ -62,7 +63,8 @@ void XMaterialTechniqueSet::ParseData(XDataStream *aStream)
|
||||
{
|
||||
qDebug() << QString("Parsing technique: %1").arg(i);
|
||||
}
|
||||
mTechniques[i].SetCommonInfo(GetCommonInfo());
|
||||
mTechniques[i].SetGame(GetGame());
|
||||
mTechniques[i].SetPlatform(GetPlatform());
|
||||
mTechniques[i].ParseDataSafe(aStream);
|
||||
AddSubAsset(&mTechniques[i]);
|
||||
}
|
||||
@ -79,44 +81,44 @@ void XMaterialTechniqueSet::Clear()
|
||||
|
||||
quint32 XMaterialTechniqueSet::GetMaxTechniqueCount() const
|
||||
{
|
||||
if (GetCommonInfo()->GetPlatform() == PLATFORM_PS3) {
|
||||
if (GetCommonInfo()->GetGame() == GAME_COD4) {
|
||||
if (GetPlatform() == PLATFORM_PS3) {
|
||||
if (GetGame() == GAME_COD4) {
|
||||
return 26;
|
||||
} else if (GetCommonInfo()->GetGame() == GAME_COD5) {
|
||||
} else if (GetGame() == GAME_COD5) {
|
||||
return 51;
|
||||
} else if (GetCommonInfo()->GetGame() == GAME_COD6) {
|
||||
} else if (GetGame() == GAME_COD6) {
|
||||
return 37;
|
||||
} else if (GetCommonInfo()->GetGame() == GAME_COD7) {
|
||||
} else if (GetGame() == GAME_COD7) {
|
||||
return 71;
|
||||
} else if (GetCommonInfo()->GetGame() == GAME_COD8) {
|
||||
} else if (GetGame() == GAME_COD8) {
|
||||
return 41;
|
||||
} else if (GetCommonInfo()->GetGame() == GAME_COD10) {
|
||||
} else if (GetGame() == GAME_COD10) {
|
||||
return 39;
|
||||
}
|
||||
} else if (GetCommonInfo()->GetPlatform() == PLATFORM_XBOX) {
|
||||
if (GetCommonInfo()->GetGame() == GAME_COD4) {
|
||||
} else if (GetPlatform() == PLATFORM_XBOX) {
|
||||
if (GetGame() == GAME_COD4) {
|
||||
return 26;
|
||||
} else if (GetCommonInfo()->GetGame() == GAME_COD5) {
|
||||
} else if (GetGame() == GAME_COD5) {
|
||||
return 51;
|
||||
} else if (GetCommonInfo()->GetGame() == GAME_COD6) {
|
||||
} else if (GetGame() == GAME_COD6) {
|
||||
return 33;
|
||||
} else if (GetCommonInfo()->GetGame() == GAME_COD7) {
|
||||
} else if (GetGame() == GAME_COD7) {
|
||||
return 71;
|
||||
} else if (GetCommonInfo()->GetGame() == GAME_COD8) {
|
||||
} else if (GetGame() == GAME_COD8) {
|
||||
return 37;
|
||||
} else if (GetCommonInfo()->GetGame() == GAME_COD10) {
|
||||
} else if (GetGame() == GAME_COD10) {
|
||||
return 36;
|
||||
}
|
||||
} else if (GetCommonInfo()->GetPlatform() == PLATFORM_PC) {
|
||||
if (GetCommonInfo()->GetGame() == GAME_COD4) {
|
||||
} else if (GetPlatform() == PLATFORM_PC) {
|
||||
if (GetGame() == GAME_COD4) {
|
||||
return 34;
|
||||
} else if (GetCommonInfo()->GetGame() == GAME_COD5) {
|
||||
} else if (GetGame() == GAME_COD5) {
|
||||
return 59;
|
||||
} else if (GetCommonInfo()->GetGame() == GAME_COD6) {
|
||||
} else if (GetGame() == GAME_COD6) {
|
||||
return 48;
|
||||
} else if (GetCommonInfo()->GetGame() == GAME_COD7) {
|
||||
} else if (GetGame() == GAME_COD7) {
|
||||
return 130;
|
||||
} else if (GetCommonInfo()->GetGame() == GAME_COD8) {
|
||||
} else if (GetGame() == GAME_COD8) {
|
||||
return 54;
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,8 @@ void XMaterialTextureDef::ParseData(XDataStream *aStream)
|
||||
>> mSemantic;
|
||||
// TODO: Convert tempSamplerState to mSamplerState
|
||||
|
||||
mDefInfo.SetCommonInfo(GetCommonInfo());
|
||||
mDefInfo.SetGame(GetGame());
|
||||
mDefInfo.SetPlatform(GetPlatform());
|
||||
mDefInfo.ParseData(aStream);
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,12 +27,14 @@ XMaterialTextureDefInfo::~XMaterialTextureDefInfo()
|
||||
void XMaterialTextureDefInfo::ParseData(XDataStream *aStream)
|
||||
{
|
||||
if (aParent && aParent->GetSemantic() == 11) {
|
||||
mWater.SetCommonInfo(GetCommonInfo());
|
||||
mWater.SetGame(GetGame());
|
||||
mWater.SetPlatform(GetPlatform());
|
||||
mWater.ParsePtr(aStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
mImage.SetCommonInfo(GetCommonInfo());
|
||||
mImage.SetGame(GetGame());
|
||||
mImage.SetPlatform(GetPlatform());
|
||||
mImage.ParsePtr(aStream);
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +134,8 @@ void XMenuDef::ParseData(XDataStream *aStream)
|
||||
for (int i = 0; i < mItemCount; i++)
|
||||
{
|
||||
XItemDef newItemDef;
|
||||
newItemDef.SetCommonInfo(GetCommonInfo());
|
||||
newItemDef.SetGame(GetGame());
|
||||
newItemDef.SetPlatform(GetPlatform());
|
||||
newItemDef.ParsePtr(aStream, false);
|
||||
mItems.push_back(newItemDef);
|
||||
}
|
||||
|
||||
@ -63,7 +63,8 @@ void XMenuList::ParseData(XDataStream *aStream)
|
||||
for (uint i = 0; i < mMenuCount; i++)
|
||||
{
|
||||
XMenuDef newMenu;
|
||||
newMenu.SetCommonInfo(GetCommonInfo());
|
||||
newMenu.SetGame(GetGame());
|
||||
newMenu.SetPlatform(GetPlatform());
|
||||
newMenu.ParsePtr(aStream, false);
|
||||
mMenus.push_back(newMenu);
|
||||
}
|
||||
|
||||
@ -153,7 +153,8 @@ void XModel::ParseData(XDataStream *aStream) {
|
||||
if (matHandlesPtr == -1) {
|
||||
for (int i = 0; i < mNumSurfs; i++) {
|
||||
XMaterial newMaterial;
|
||||
newMaterial.SetCommonInfo(GetCommonInfo());
|
||||
newMaterial.SetGame(GetGame());
|
||||
newMaterial.SetPlatform(GetPlatform());
|
||||
newMaterial.ParseData(aStream);
|
||||
mMaterialHandles.append(newMaterial);
|
||||
}
|
||||
|
||||
@ -28,8 +28,8 @@ public slots:
|
||||
private:
|
||||
XString* mName;
|
||||
XStringArray* mValues;
|
||||
int mColumnCount;
|
||||
int mRowCount;
|
||||
qint32 mColumnCount;
|
||||
qint32 mRowCount;
|
||||
};
|
||||
|
||||
#endif // STRINGTABLESH_H
|
||||
|
||||
@ -77,7 +77,8 @@ void XWindowDef::ParseData(XDataStream *aStream)
|
||||
a = aStream->ParseSingle(QString("%1 outline alpha").arg(GetName()));
|
||||
mOutlineColor = QColor(r, g, b, a);
|
||||
|
||||
mBackground.SetCommonInfo(GetCommonInfo());
|
||||
mBackground.SetGame(GetGame());
|
||||
mBackground.SetPlatform(GetPlatform());
|
||||
mBackground.ParsePtr(aStream, false);
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@ ZoneFile::ZoneFile()
|
||||
, mTags()
|
||||
, mRecordCount()
|
||||
, mRecords()
|
||||
, mCommonInfo(nullptr)
|
||||
, mTypeMap()
|
||||
, mHeaderData()
|
||||
, mAssetList(this)
|
||||
@ -31,7 +30,6 @@ ZoneFile::ZoneFile(const ZoneFile &aZoneFile)
|
||||
, mRecordCount(aZoneFile.mRecordCount)
|
||||
, mRecords(aZoneFile.mRecords)
|
||||
, mAssetTypes(aZoneFile.mAssetTypes)
|
||||
, mCommonInfo(aZoneFile.mCommonInfo)
|
||||
, mTypeMap(aZoneFile.mTypeMap)
|
||||
, mHeaderData(aZoneFile.mHeaderData)
|
||||
, mAssetList(aZoneFile.mAssetList)
|
||||
@ -50,7 +48,6 @@ ZoneFile &ZoneFile::operator=(const ZoneFile &other)
|
||||
mRecordCount = other.mRecordCount;
|
||||
mRecords = other.mRecords;
|
||||
mAssetTypes = other.mAssetTypes;
|
||||
mCommonInfo = other.mCommonInfo;
|
||||
mTypeMap = other.mTypeMap;
|
||||
mHeaderData = other.mHeaderData;
|
||||
mAssetList = other.mAssetList;
|
||||
@ -60,18 +57,24 @@ ZoneFile &ZoneFile::operator=(const ZoneFile &other)
|
||||
|
||||
bool ZoneFile::Load(const QByteArray aFileData)
|
||||
{
|
||||
XDataStream zoneStream(aFileData);
|
||||
zoneStream.SetDebug(mDebug);
|
||||
|
||||
if (GetCommonInfo()->GetPlatform() == PLATFORM_PC)
|
||||
mDefinition.SetGame(GetGame());
|
||||
mDefinition.SetPlatform(GetPlatform());
|
||||
if (!mDefinition.Load())
|
||||
{
|
||||
zoneStream.setByteOrder(QDataStream::LittleEndian);
|
||||
qDebug() << "ERROR: Failed to load Zone File Definition file!";
|
||||
return false;
|
||||
}
|
||||
|
||||
mHeaderData.SetCommonInfo(mCommonInfo);
|
||||
XDataStream zoneStream(aFileData);
|
||||
zoneStream.SetDebug(mDebug);
|
||||
zoneStream.setByteOrder(mDefinition.ByteOrder());
|
||||
|
||||
mHeaderData.SetGame(GetGame());
|
||||
mHeaderData.SetPlatform(GetPlatform());
|
||||
mHeaderData.ParseData(&zoneStream);
|
||||
|
||||
mAssetList.SetCommonInfo(mCommonInfo);
|
||||
mAssetList.SetGame(GetGame());
|
||||
mAssetList.SetPlatform(GetPlatform());
|
||||
mAssetList.ParseData(&zoneStream);
|
||||
|
||||
return true;
|
||||
@ -233,13 +236,3 @@ void ZoneFile::SetDebug(bool aDebug)
|
||||
{
|
||||
mDebug = aDebug;
|
||||
}
|
||||
|
||||
const XCommonInfo *ZoneFile::GetCommonInfo() const
|
||||
{
|
||||
return mCommonInfo;
|
||||
}
|
||||
|
||||
void ZoneFile::SetCommonInfo(const XCommonInfo *newCommonInfo)
|
||||
{
|
||||
mCommonInfo = newCommonInfo;
|
||||
}
|
||||
|
||||
@ -4,12 +4,13 @@
|
||||
#include "xasset.h"
|
||||
#include "xassetlist.h"
|
||||
#include "xfile.h"
|
||||
#include "zonefiledef.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QIcon>
|
||||
#include <QMap>
|
||||
|
||||
class ZoneFile
|
||||
class ZoneFile : public XCommonInfo
|
||||
{
|
||||
public:
|
||||
ZoneFile();
|
||||
@ -40,9 +41,6 @@ public:
|
||||
void SetAssetList(XAssetList aAssetList);
|
||||
XAssetType GetType(quint32 aRawType) const;
|
||||
|
||||
const XCommonInfo *GetCommonInfo() const;
|
||||
void SetCommonInfo(const XCommonInfo *newCommonInfo);
|
||||
|
||||
quint32 RecordCount() const;
|
||||
QStringList Records() const;
|
||||
QVector<XAssetType> AssetTypes() const;
|
||||
@ -57,6 +55,8 @@ protected:
|
||||
void pSetType(quint32 aRawType, XAssetType aType);
|
||||
|
||||
private:
|
||||
ZoneFileDef mDefinition;
|
||||
|
||||
QString mStem;
|
||||
quint32 mSize;
|
||||
quint32 mTagCount;
|
||||
@ -64,7 +64,6 @@ private:
|
||||
quint32 mRecordCount;
|
||||
QStringList mRecords;
|
||||
QVector<XAssetType> mAssetTypes;
|
||||
const XCommonInfo* mCommonInfo;
|
||||
|
||||
QMap<quint32, XAssetType> mTypeMap;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user