add some bo3 ff processing logic.
This commit is contained in:
parent
8e71f570c4
commit
b58561eb78
@ -4,3 +4,5 @@ SUBDIRS += libs \
|
||||
app \
|
||||
tools \
|
||||
tests
|
||||
|
||||
QMAKE_PRE_BUILD += make clean
|
||||
|
||||
@ -70,6 +70,8 @@ app.depends += \
|
||||
libs/iwifile \
|
||||
libs/zonefile
|
||||
|
||||
QMAKE_PRE_BUILD += make clean
|
||||
|
||||
LIBS += \
|
||||
-L$$PWD/../third_party/devil_sdk/lib/ -lDevIL -lILU -lILUT \
|
||||
-L$$PWD/../third_party/zlib/lib/ -lzlib \
|
||||
|
||||
@ -18,7 +18,7 @@ FastFileViewer::~FastFileViewer()
|
||||
void FastFileViewer::SetFastFile(std::shared_ptr<FastFile> aFastFile) {
|
||||
mFastFile.swap(aFastFile);
|
||||
|
||||
ui->label_Title->setText(mFastFile->GetStem() + ".ff");
|
||||
ui->label_Title->setText(mFastFile->GetStem());
|
||||
ui->comboBox_Company->setCurrentIndex(mFastFile->GetCompany());
|
||||
ui->comboBox_FileType->setCurrentIndex(mFastFile->GetType());
|
||||
ui->checkBox_Signed->setChecked(mFastFile->GetSignage() == SIGNAGE_SIGNED);
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
#include "techsetviewer.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "compression.h"
|
||||
#include "fastfile_factory.h"
|
||||
#include "iwifile.h"
|
||||
#include "ddsfile.h"
|
||||
#include "statusbarmanager.h"
|
||||
@ -268,9 +269,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
fastFileViewer->SetFastFile(aFastFile);
|
||||
fastFileViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||
|
||||
QString fileStem = aFastFile->GetStem() + ".ff";
|
||||
QString fileStem = aFastFile->GetStem();
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
if (ui->tabWidget->tabText(i) == fileStem) {
|
||||
if (ui->tabWidget->tabText(i) == fileStem + ".ff") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -481,8 +482,7 @@ bool MainWindow::OpenFastFile(const QString aFastFilePath) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFile::Open(aFastFilePath);
|
||||
fastFile->SetStem(fastFileStem);
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(aFastFilePath);
|
||||
mTreeWidget->AddFastFile(fastFile);
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
|
||||
@ -20,18 +20,11 @@ void MaterialViewer::SetMaterial(std::shared_ptr<Material> aMaterial) {
|
||||
ui->lineEdit_Name->setText(aMaterial->name);
|
||||
ui->lineEdit_RefPtr->setText(ToHexStr(aMaterial->refNamePtr));
|
||||
ui->lineEdit_RefName->setText(aMaterial->refName);
|
||||
ui->lineEdit_Unknowns->setText(ToHexStr(aMaterial->unknownA[0])
|
||||
+ ToHexStr(aMaterial->unknownA[1])
|
||||
+ ToHexStr(aMaterial->unknownA[2])
|
||||
+ ToHexStr(aMaterial->unknownA[3])
|
||||
+ ToHexStr(aMaterial->unknownA[4])
|
||||
+ ToHexStr(aMaterial->unknownA[5])
|
||||
+ ToHexStr(aMaterial->unknownA[6])
|
||||
+ ToHexStr(aMaterial->unknownA[7])
|
||||
+ ToHexStr(aMaterial->unknownA[8])
|
||||
+ ToHexStr(aMaterial->unknownA[9])
|
||||
+ ToHexStr(aMaterial->unknownA[10])
|
||||
+ ToHexStr(aMaterial->unknownA[11]));
|
||||
QString unknownStr = "";
|
||||
foreach (quint32 unknownPtr, aMaterial->pointers) {
|
||||
unknownStr += ToHexStr(unknownPtr) + "\n";
|
||||
}
|
||||
ui->lineEdit_Unknowns->setText(unknownStr);
|
||||
ui->lineEdit_StateA->setText(ToHexStr(aMaterial->stateBits[0]));
|
||||
ui->lineEdit_StateA->setText(ToHexStr(aMaterial->stateBits[1]));
|
||||
ui->spinBox_TextureCount->setValue(aMaterial->textureCount);
|
||||
|
||||
@ -63,6 +63,12 @@ void XTreeWidget::AddFastFile(std::shared_ptr<FastFile> aFastFile) {
|
||||
fastFileItem->setIcon(2, QIcon(":/icons/icons/Icon_COD8.png"));
|
||||
} else if (aFastFile->GetGame() == "COD9") {
|
||||
fastFileItem->setIcon(2, QIcon(":/icons/icons/Icon_COD9.png"));
|
||||
} else if (aFastFile->GetGame() == "COD10") {
|
||||
fastFileItem->setIcon(2, QIcon(":/icons/icons/Icon_COD10.png"));
|
||||
} else if (aFastFile->GetGame() == "COD11") {
|
||||
fastFileItem->setIcon(2, QIcon(":/icons/icons/Icon_COD11.png"));
|
||||
} else if (aFastFile->GetGame() == "COD12") {
|
||||
fastFileItem->setIcon(2, QIcon(":/icons/icons/Icon_COD12.png"));
|
||||
}
|
||||
|
||||
AddZoneFile(aFastFile->GetZoneFile(), fastFileItem);
|
||||
@ -155,7 +161,7 @@ void XTreeWidget::AddZoneFile(std::shared_ptr<ZoneFile> aZoneFile, XTreeWidgetIt
|
||||
menuFileRoot->setText(0, QString("Menu %1").arg(menuIndex));
|
||||
for (Menu menu : menuFile.menuDefs) {
|
||||
XTreeWidgetItem *menuItem = new XTreeWidgetItem(menuFileRoot);
|
||||
menuItem->setText(0, menu.name);
|
||||
menuItem->setText(0, menu.filePath);
|
||||
menuItem->setIcon(0, QIcon(":/icons/icons/Icon_MenuFile.png"));
|
||||
}
|
||||
menuIndex++;
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#include "zonefile.h"
|
||||
|
||||
#include <QTreeWidget>
|
||||
#include <QFileDialog>
|
||||
|
||||
class XTreeWidget : public QTreeWidget
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@ ZoneFileViewer::ZoneFileViewer(QWidget *parent)
|
||||
, ui(new Ui::ZoneFileViewer) {
|
||||
ui->setupUi(this);
|
||||
|
||||
aZoneFile = nullptr;
|
||||
mZoneFile = nullptr;
|
||||
|
||||
ui->tableWidget_RecordCounts->setColumnCount(4);
|
||||
ui->tableWidget_RecordCounts->setHorizontalHeaderLabels({ "Identifier", "Asset", "Count", "Icon" });
|
||||
@ -15,20 +15,64 @@ ZoneFileViewer::ZoneFileViewer(QWidget *parent)
|
||||
ui->tableWidget_RecordOrder->setColumnCount(4);
|
||||
ui->tableWidget_RecordOrder->setHorizontalHeaderLabels({ "Identifier", "Asset", "Count", "Icon" });
|
||||
ui->tableWidget_RecordOrder->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
connect(ui->lineEdit_TagSearch, &QLineEdit::textChanged, this, &ZoneFileViewer::SortTags);
|
||||
connect(ui->tableWidget_RecordCounts, &QTableWidget::itemSelectionChanged, this, &ZoneFileViewer::HighlightRecordInOrder);
|
||||
}
|
||||
|
||||
ZoneFileViewer::~ZoneFileViewer() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ZoneFileViewer::HighlightRecordInOrder() {
|
||||
ui->tableWidget_RecordOrder->clearSelection();
|
||||
|
||||
foreach (auto selectedItem, ui->tableWidget_RecordCounts->selectedItems()) {
|
||||
int selectedRow = selectedItem->row();
|
||||
const QString assetId = ui->tableWidget_RecordCounts->item(selectedRow, 0)->text();
|
||||
|
||||
for (int i = 0; i < ui->tableWidget_RecordOrder->rowCount(); i++) {
|
||||
const QString testAssetId = ui->tableWidget_RecordOrder->item(i, 0)->text();
|
||||
if (testAssetId != assetId) { continue; }
|
||||
|
||||
ui->tableWidget_RecordOrder->selectRow(i);
|
||||
ui->tableWidget_RecordOrder->item(i, 0)->setSelected(true);
|
||||
ui->tableWidget_RecordOrder->item(i, 1)->setSelected(true);
|
||||
ui->tableWidget_RecordOrder->item(i, 2)->setSelected(true);
|
||||
ui->tableWidget_RecordOrder->item(i, 3)->setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ZoneFileViewer::SortTags(const QString &aSearchText) {
|
||||
ui->listWidget_Tags->clear();
|
||||
|
||||
const QStringList tags = mZoneFile->GetTags();
|
||||
if (aSearchText.isEmpty()) {
|
||||
ui->listWidget_Tags->addItems(tags);
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList sortedTags;
|
||||
foreach (const QString tag, tags) {
|
||||
if (tag.contains(aSearchText)) {
|
||||
sortedTags << tag;
|
||||
}
|
||||
}
|
||||
|
||||
ui->listWidget_Tags->addItems(sortedTags);
|
||||
}
|
||||
|
||||
void ZoneFileViewer::SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile) {
|
||||
mZoneFile = aZoneFile;
|
||||
|
||||
ui->tableWidget_RecordCounts->clearContents();
|
||||
ui->tableWidget_RecordOrder->clearContents();
|
||||
ui->listWidget_Tags->clear();
|
||||
|
||||
const QStringList tags = aZoneFile->GetTags();
|
||||
const QStringList tags = mZoneFile->GetTags();
|
||||
ui->listWidget_Tags->addItems(tags);
|
||||
ui->label_Title->setText(aZoneFile->GetStem() + ".zone");
|
||||
ui->label_Title->setText(mZoneFile->GetStem() + ".zone");
|
||||
|
||||
if (tags.isEmpty()) {
|
||||
ui->groupBox_Tags->hide();
|
||||
@ -36,79 +80,62 @@ void ZoneFileViewer::SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile) {
|
||||
ui->groupBox_Tags->show();
|
||||
}
|
||||
|
||||
QString lastAsset = "";
|
||||
QString lastRecord = "";
|
||||
QIcon assetIcon;
|
||||
int consecutiveCount = 1;
|
||||
int consecutiveIndex = 0;
|
||||
const QStringList records = aZoneFile->GetRecords();
|
||||
QMap<QString, int> recordCounts = QMap<QString, int>();
|
||||
for (const QString &record : records) {
|
||||
lastRecord = record;
|
||||
if (record == "ffffffff") { break; }
|
||||
QVector<QPair<QString, int>> assetOccurances = QVector<QPair<QString, int>>();
|
||||
for (const QString &record : mZoneFile->GetRecords()) {
|
||||
if (!recordCounts.contains(record)) {
|
||||
recordCounts[record] = 0;
|
||||
}
|
||||
recordCounts[record]++;
|
||||
|
||||
QString assetType = aZoneFile->AssetTypeToString(record);
|
||||
if (!assetOccurances.isEmpty() && assetOccurances.last().first == record) {
|
||||
assetOccurances.last().second++;
|
||||
continue;
|
||||
}
|
||||
|
||||
QPair<QString, int> assetOccurance(record, 1);
|
||||
assetOccurances << assetOccurance;
|
||||
}
|
||||
ui->tableWidget_RecordOrder->setRowCount(assetOccurances.size());
|
||||
|
||||
int assetIndex = 0;
|
||||
foreach (auto assetOccurance, assetOccurances) {
|
||||
const QString record = assetOccurance.first;
|
||||
AssetType assetType = mZoneFile->AssetStrToEnum(record);
|
||||
int assetCount = assetOccurance.second;
|
||||
|
||||
QIcon assetIcon = mZoneFile->AssetTypeToIcon(assetType);
|
||||
if (assetIcon.isNull()) {
|
||||
qDebug() << "Icon is null for record: " << record;
|
||||
}
|
||||
|
||||
if (lastAsset.isEmpty()) {
|
||||
lastAsset = assetType;
|
||||
lastRecord = record;
|
||||
} else if (lastAsset == assetType) {
|
||||
consecutiveCount++;
|
||||
} else {
|
||||
ui->tableWidget_RecordOrder->setRowCount(consecutiveIndex + 1);
|
||||
|
||||
QTableWidgetItem *recordItem = new QTableWidgetItem(lastRecord.toUpper());
|
||||
QTableWidgetItem *recordStrItem = new QTableWidgetItem(lastAsset);
|
||||
QTableWidgetItem *recordCountItem = new QTableWidgetItem(QString::number(consecutiveCount));
|
||||
QTableWidgetItem *recordItem = new QTableWidgetItem(record.toUpper());
|
||||
QTableWidgetItem *recordStrItem = new QTableWidgetItem(mZoneFile->AssetEnumToStr(assetType));
|
||||
QTableWidgetItem *recordCountItem = new QTableWidgetItem(QString::number(assetCount));
|
||||
QTableWidgetItem *recordIconItem = new QTableWidgetItem();
|
||||
assetIcon = aZoneFile->AssetStrToIcon(lastAsset);
|
||||
recordIconItem->setIcon(assetIcon);
|
||||
|
||||
ui->tableWidget_RecordOrder->setItem(consecutiveIndex, 0, recordItem);
|
||||
ui->tableWidget_RecordOrder->setItem(consecutiveIndex, 1, recordStrItem);
|
||||
ui->tableWidget_RecordOrder->setItem(consecutiveIndex, 2, recordCountItem);
|
||||
ui->tableWidget_RecordOrder->setItem(consecutiveIndex, 3, recordIconItem);
|
||||
ui->tableWidget_RecordOrder->setItem(assetIndex, 0, recordItem);
|
||||
ui->tableWidget_RecordOrder->setItem(assetIndex, 1, recordStrItem);
|
||||
ui->tableWidget_RecordOrder->setItem(assetIndex, 2, recordCountItem);
|
||||
ui->tableWidget_RecordOrder->setItem(assetIndex, 3, recordIconItem);
|
||||
|
||||
consecutiveCount = 1;
|
||||
consecutiveIndex++;
|
||||
lastAsset = assetType;
|
||||
lastRecord = record;
|
||||
assetIndex++;
|
||||
}
|
||||
}
|
||||
ui->tableWidget_RecordOrder->setRowCount(consecutiveIndex + 1);
|
||||
|
||||
QTableWidgetItem *recordItem = new QTableWidgetItem(lastRecord.toUpper());
|
||||
QTableWidgetItem *recordStrItem = new QTableWidgetItem(lastAsset);
|
||||
QTableWidgetItem *recordCountItem = new QTableWidgetItem(QString::number(consecutiveCount));
|
||||
QTableWidgetItem *recordIconItem = new QTableWidgetItem();
|
||||
assetIcon = aZoneFile->AssetStrToIcon(lastAsset);
|
||||
recordIconItem->setIcon(assetIcon);
|
||||
|
||||
ui->tableWidget_RecordOrder->setItem(consecutiveIndex, 0, recordItem);
|
||||
ui->tableWidget_RecordOrder->setItem(consecutiveIndex, 1, recordStrItem);
|
||||
ui->tableWidget_RecordOrder->setItem(consecutiveIndex, 2, recordCountItem);
|
||||
ui->tableWidget_RecordOrder->setItem(consecutiveIndex, 3, recordIconItem);
|
||||
|
||||
int recordIndex = 0;
|
||||
for (const QString &record : recordCounts.keys()) {
|
||||
int recordCount = recordCounts[record];
|
||||
|
||||
QString assetType = aZoneFile->AssetTypeToString(record);
|
||||
assetIcon = aZoneFile->AssetStrToIcon(assetType);
|
||||
AssetType assetType = mZoneFile->AssetStrToEnum(record);
|
||||
QIcon assetIcon = mZoneFile->AssetTypeToIcon(assetType);
|
||||
if (assetIcon.isNull()) {
|
||||
qDebug() << "Icon is null for record: " << record;
|
||||
}
|
||||
|
||||
ui->tableWidget_RecordCounts->setRowCount(recordIndex + 1);
|
||||
|
||||
QTableWidgetItem *recordCountStrItem = new QTableWidgetItem(assetType);
|
||||
QTableWidgetItem *recordCountStrItem = new QTableWidgetItem(mZoneFile->AssetEnumToStr(assetType));
|
||||
QTableWidgetItem *recordItem = new QTableWidgetItem(record.toUpper());
|
||||
QTableWidgetItem *recordCountItem = new QTableWidgetItem(QString::number(recordCount));
|
||||
QTableWidgetItem *recordIconItem = new QTableWidgetItem();
|
||||
|
||||
@ -19,9 +19,15 @@ public:
|
||||
~ZoneFileViewer();
|
||||
|
||||
void SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile);
|
||||
|
||||
public slots:
|
||||
void SortTags(const QString &aSearchText);
|
||||
|
||||
void HighlightRecordInOrder();
|
||||
|
||||
private:
|
||||
Ui::ZoneFileViewer *ui;
|
||||
std::shared_ptr<ZoneFile> aZoneFile;
|
||||
std::shared_ptr<ZoneFile> mZoneFile;
|
||||
};
|
||||
|
||||
#endif // ZONEFILEVIEWER_H
|
||||
|
||||
@ -61,7 +61,14 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget_Tags"/>
|
||||
<widget class="QListWidget" name="listWidget_Tags">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@ -73,7 +80,20 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget_RecordCounts"/>
|
||||
<widget class="QTableWidget" name="tableWidget_RecordCounts">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SelectionMode::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectionBehavior::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@ -85,7 +105,17 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget_RecordOrder"/>
|
||||
<widget class="QTableWidget" name="tableWidget_RecordOrder">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SelectionMode::NoSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
@ -87,5 +87,8 @@
|
||||
<file>icons/Icon_PhysPreset.png</file>
|
||||
<file>icons/Icon_Wii.png</file>
|
||||
<file>icons/Icon_WiiU.png</file>
|
||||
<file>icons/Icon_COD10.png</file>
|
||||
<file>icons/Icon_COD11.png</file>
|
||||
<file>icons/Icon_COD12.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@ -234,7 +234,7 @@
|
||||
"WEIGHTS_0": 6
|
||||
},
|
||||
"indices": 1,
|
||||
"material": 0,
|
||||
ASSET_MATERIAL: 0,
|
||||
"mode": 4
|
||||
}
|
||||
]
|
||||
@ -250,7 +250,7 @@
|
||||
"WEIGHTS_0": 12
|
||||
},
|
||||
"indices": 7,
|
||||
"material": 0,
|
||||
ASSET_MATERIAL: 0,
|
||||
"mode": 4
|
||||
}
|
||||
]
|
||||
|
||||
@ -650,25 +650,6 @@ enum MENU_BUTTON {
|
||||
APAD_RIGHT = 31
|
||||
};
|
||||
|
||||
enum ASSET_TYPE {
|
||||
ASSET_UNKNOWN = 0,
|
||||
ASSET_ANIMATION = 4, // x_anim PARTIALLY VERIFIED
|
||||
ASSET_MODEL = 5, // xmodel PARTIALLY VERIFIED
|
||||
ASSET_MATERIAL = 6, // material VERIFIED
|
||||
ASSET_BIK_FILE = 7, // .bik file PARTIALLY VERIFIED
|
||||
ASSET_SOUND = 9, // loaded_sound VERIFIED
|
||||
ASSET_COLLISION_MAP = 12, // collision_map PARTIALLY VERIFIED
|
||||
ASSET_SHADER = 13, // shader PARTIALLY VERIFIED
|
||||
ASSET_D3DBSP_DUMP = 17, // d3dbsp dump VERIFIED
|
||||
ASSET_FONT = 20, // font PARTIALLY VERIFIED
|
||||
ASSET_MENU = 21, // menu_file VERIFIED
|
||||
ASSET_LOCAL_STRING = 23, // localized string VERIFIED
|
||||
ASSET_WEAPON = 24, // weapon VERIFIED
|
||||
ASSET_EFFECT = 26, // fx VERIFIED
|
||||
ASSET_RAW_FILE = 32, // raw_file VERIFIED
|
||||
ASSET_STRING_TABLE = 33 // string_table PARTIALLY VERIFIED
|
||||
};
|
||||
|
||||
enum SHADER_TYPE {
|
||||
SHADER_NONE = 0x00,
|
||||
SHADER_PIXEL = 0x01,
|
||||
|
||||
@ -90,53 +90,6 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
AssetTypeToString()
|
||||
|
||||
Convert asset type string to asset desc string
|
||||
*/
|
||||
static QString AssetTypeToString(const QString aAssetType) {
|
||||
const QString cleanedType = aAssetType.toUpper();
|
||||
if (cleanedType == "17000000") { // localized string PARTIALLY VERIFIED
|
||||
return "LOCAL STRING";
|
||||
} else if (cleanedType == "20000000") { // raw_file PARTIALLY VERIFIED
|
||||
return "RAW FILE";
|
||||
} else if (cleanedType == "1A000000") { // fx PARTIALLY VERIFIED
|
||||
return "EFFECT";
|
||||
} else if (cleanedType == "09000000") { // loaded_sound PARTIALLY VERIFIED
|
||||
return "SOUND";
|
||||
} else if (cleanedType == "04000000") { // x_anim PARTIALLY VERIFIED
|
||||
return "ANIMATION";
|
||||
} else if (cleanedType == "0C000000") { // collision_map PARTIALLY VERIFIED
|
||||
return "COLLISION MAP";
|
||||
} else if (cleanedType == "21000000") { // string_table PARTIALLY VERIFIED
|
||||
return "STRING TABLE";
|
||||
} else if (cleanedType == "15000000") { // menu_file PARTIALLY VERIFIED
|
||||
return "MENU";
|
||||
} else if (cleanedType == "07000000") { // tech set PARTIALLY VERIFIED
|
||||
return "TECH SET";
|
||||
} else if (cleanedType == "18000000") { // weapon PARTIALLY VERIFIED
|
||||
return "WEAPON";
|
||||
} else if (cleanedType == "11000000") { // gfx map PARTIALLY VERIFIED
|
||||
return "GFX MAP";
|
||||
} else if (cleanedType == "12000000") { // light_def PARTIALLY VERIFIED
|
||||
return "LIGHT DEF";
|
||||
} else if (cleanedType == "14000000") { // font PARTIALLY VERIFIED
|
||||
return "FONT";
|
||||
} else if (cleanedType == "05000000") { // xmodel PARTIALLY VERIFIED
|
||||
return "MODEL";
|
||||
} else if (cleanedType == "0D000000") { // d3dbsp PARTIALLY VERIFIED
|
||||
return "D3DBSP";
|
||||
} else if (cleanedType == "06000000") { // image PARTIALLY VERIFIED
|
||||
return "IMAGE";
|
||||
} else if (cleanedType == "0E000000") { // game map sp PARTIALLY VERIFIED
|
||||
return "GAME MAP SP";
|
||||
} else if (cleanedType == "0B000000") { // col map sp PARTIALLY VERIFIED
|
||||
return "COL MAP SP";
|
||||
}
|
||||
return aAssetType;
|
||||
}
|
||||
|
||||
/*
|
||||
LumpTypeToString()
|
||||
|
||||
|
||||
@ -648,25 +648,6 @@ enum MENU_BUTTON {
|
||||
APAD_RIGHT = 31
|
||||
};
|
||||
|
||||
enum ASSET_TYPE {
|
||||
ASSET_UNKNOWN = 0,
|
||||
ASSET_ANIMATION = 4, // x_anim PARTIALLY VERIFIED
|
||||
ASSET_MODEL = 5, // xmodel PARTIALLY VERIFIED
|
||||
ASSET_MATERIAL = 6, // material VERIFIED
|
||||
ASSET_BIK_FILE = 7, // .bik file PARTIALLY VERIFIED
|
||||
ASSET_SOUND = 9, // loaded_sound VERIFIED
|
||||
ASSET_COLLISION_MAP = 12, // collision_map PARTIALLY VERIFIED
|
||||
ASSET_SHADER = 13, // shader PARTIALLY VERIFIED
|
||||
ASSET_D3DBSP_DUMP = 17, // d3dbsp dump VERIFIED
|
||||
ASSET_FONT = 20, // font PARTIALLY VERIFIED
|
||||
ASSET_MENU = 21, // menu_file VERIFIED
|
||||
ASSET_LOCAL_STRING = 23, // localized string VERIFIED
|
||||
ASSET_WEAPON = 24, // weapon VERIFIED
|
||||
ASSET_EFFECT = 26, // fx VERIFIED
|
||||
ASSET_RAW_FILE = 32, // raw_file VERIFIED
|
||||
ASSET_STRING_TABLE = 33 // string_table PARTIALLY VERIFIED
|
||||
};
|
||||
|
||||
enum SHADER_TYPE {
|
||||
SHADER_NONE = 0x00,
|
||||
SHADER_PIXEL = 0x01,
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
#include "fastfile.h"
|
||||
|
||||
#include "fastfile_cod2.h"
|
||||
#include "fastfile_cod5.h"
|
||||
#include "fastfile_cod7.h"
|
||||
#include "fastfile_cod9.h"
|
||||
#include "fastfile_factory.h"
|
||||
#include "logmanager.h"
|
||||
|
||||
#include <QFile>
|
||||
@ -22,6 +19,10 @@ FastFile::FastFile()
|
||||
|
||||
}
|
||||
|
||||
FastFile::FastFile(const QByteArray &aData) {
|
||||
Q_UNUSED(aData);
|
||||
}
|
||||
|
||||
FastFile::FastFile(FastFile &fastFile)
|
||||
: mStem(fastFile.GetStem()),
|
||||
mType(fastFile.GetType()),
|
||||
@ -297,32 +298,12 @@ std::shared_ptr<FastFile> FastFile::Open(const QString &aFilePath) {
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1).section('.', 0, 0);
|
||||
LogManager::instance().addEntry(QString("Stem: %1").arg(fastFileStem));
|
||||
|
||||
FastFile *fastFile;
|
||||
bool validff = true;
|
||||
if (game == "COD2") {
|
||||
fastFile = new FastFile_COD2();
|
||||
} else if (game == "COD5") {
|
||||
fastFile = new FastFile_COD5();
|
||||
} else if (game == "COD7") {
|
||||
fastFile = new FastFile_COD7();
|
||||
} else if (game == "COD9") {
|
||||
fastFile = new FastFile_COD9();
|
||||
} else {
|
||||
validff = false;
|
||||
}
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(data);
|
||||
|
||||
LogManager::instance().addLine();
|
||||
|
||||
if (validff) {
|
||||
fastFile->SetCompany(company);
|
||||
fastFile->SetStem(fastFileStem);
|
||||
fastFile->Load(data);
|
||||
return std::unique_ptr<FastFile>(fastFile);
|
||||
}
|
||||
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return nullptr;
|
||||
return fastFile;
|
||||
}
|
||||
bool FastFile::ExportFastFile(const QString aFastFilePath) {
|
||||
QFile fastFile(aFastFilePath);
|
||||
|
||||
@ -6,12 +6,14 @@
|
||||
|
||||
#include <QString>
|
||||
#include <QCryptographicHash>
|
||||
#include <QFileDialog>
|
||||
|
||||
class ZoneFile;
|
||||
|
||||
class FastFile
|
||||
{
|
||||
public:
|
||||
FastFile();
|
||||
FastFile(const QByteArray& aData);
|
||||
FastFile(FastFile &fastFile);
|
||||
~FastFile();
|
||||
|
||||
|
||||
@ -3,18 +3,37 @@ TEMPLATE = lib
|
||||
CONFIG += staticlib c++17
|
||||
|
||||
SOURCES += \
|
||||
fastfile_cod2.cpp \
|
||||
fastfile_cod5.cpp \
|
||||
fastfile_cod7.cpp \
|
||||
fastfile_cod9.cpp \
|
||||
fastfile.cpp
|
||||
fastfile.cpp \
|
||||
360/fastfile_cod2_360.cpp \
|
||||
360/fastfile_cod5_360.cpp \
|
||||
360/fastfile_cod7_360.cpp \
|
||||
360/fastfile_cod9_360.cpp \
|
||||
PS3/fastfile_cod5_ps3.cpp \
|
||||
PS3/fastfile_cod7_ps3.cpp \
|
||||
PS3/fastfile_cod9_ps3.cpp \
|
||||
PC/fastfile_cod5_pc.cpp \
|
||||
PC/fastfile_cod7_pc.cpp \
|
||||
PC/fastfile_cod9_pc.cpp \
|
||||
PC/fastfile_cod12_pc.cpp \
|
||||
Wii/fastfile_cod7_wii.cpp \
|
||||
WiiU/fastfile_cod9_wiiu.cpp
|
||||
|
||||
HEADERS += \
|
||||
fastfile.h \
|
||||
fastfile_cod2.h \
|
||||
fastfile_cod5.h \
|
||||
fastfile_cod7.h \
|
||||
fastfile_cod9.h
|
||||
360/fastfile_cod2_360.h \
|
||||
360/fastfile_cod5_360.h \
|
||||
360/fastfile_cod7_360.h \
|
||||
360/fastfile_cod9_360.h \
|
||||
PS3/fastfile_cod5_ps3.h \
|
||||
PS3/fastfile_cod7_ps3.h \
|
||||
PS3/fastfile_cod9_ps3.h \
|
||||
PC/fastfile_cod5_pc.h \
|
||||
PC/fastfile_cod7_pc.h \
|
||||
PC/fastfile_cod9_pc.h \
|
||||
PC/fastfile_cod12_pc.h \
|
||||
Wii/fastfile_cod7_wii.h \
|
||||
WiiU/fastfile_cod9_wiiu.h \
|
||||
fastfile_factory.h
|
||||
|
||||
LIBS += \
|
||||
-L$$OUT_PWD/../libs/core -lcore \
|
||||
@ -26,7 +45,12 @@ INCLUDEPATH += \
|
||||
$$PWD/../core \
|
||||
$$PWD/../compression \
|
||||
$$PWD/../encryption \
|
||||
$$PWD/../zonefile
|
||||
$$PWD/../zonefile \
|
||||
$$PWD/../zonefile/360 \
|
||||
$$PWD/../zonefile/PC \
|
||||
$$PWD/../zonefile/PS3 \
|
||||
$$PWD/../zonefile/Wii \
|
||||
$$PWD/../zonefile/WiiU
|
||||
|
||||
DEPENDPATH += \
|
||||
$$PWD/../core \
|
||||
|
||||
@ -1,83 +0,0 @@
|
||||
#include "fastfile_cod2.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "zonefile_cod2.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD2::FastFile_COD2() {
|
||||
|
||||
}
|
||||
|
||||
FastFile_COD2::~FastFile_COD2() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD2::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD2::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);
|
||||
qDebug() << "fastFileStem: " << fastFileStem;
|
||||
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::Load(const QByteArray aData) {
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(COMPANY_INFINITY_WARD);
|
||||
SetType(FILETYPE_FAST_FILE);
|
||||
SetSignage(SIGNAGE_UNSIGNED);
|
||||
SetMagic(0);
|
||||
SetVersion(0);
|
||||
SetPlatform("360");
|
||||
SetGame("COD2");
|
||||
|
||||
Utils::ReadUntilHex(&fastFileStream, "78");
|
||||
QByteArray compressedData = aData.mid(fastFileStream.device()->pos());
|
||||
QByteArray decompressedData = Compression::DecompressZLIB(compressedData);
|
||||
|
||||
QDir exportsDir(QDir::currentPath());
|
||||
exportsDir.mkdir("exports");
|
||||
|
||||
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_COD2 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData, FF_PLATFORM_XBOX);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD2>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
#ifndef FASTFILE_COD2_H
|
||||
#define FASTFILE_COD2_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD2 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD2();
|
||||
~FastFile_COD2();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD2_H
|
||||
@ -1,88 +0,0 @@
|
||||
#include "fastfile_cod5.h"
|
||||
#include "zonefile_cod5.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "statusbarmanager.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD5::FastFile_COD5() {
|
||||
|
||||
}
|
||||
|
||||
FastFile_COD5::~FastFile_COD5() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD5::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD5::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::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);
|
||||
|
||||
FF_PLATFORM platform = FF_PLATFORM_NONE;
|
||||
if (platformStr == "PC") {
|
||||
platform = FF_PLATFORM_PC;
|
||||
} else if (platformStr == "360") {
|
||||
platform = FF_PLATFORM_XBOX;
|
||||
}
|
||||
|
||||
ZoneFile_COD5 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData, platform);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD5>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
#ifndef FASTFILE_COD5_H
|
||||
#define FASTFILE_COD5_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD5 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD5();
|
||||
~FastFile_COD5();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD5_H
|
||||
@ -1,168 +0,0 @@
|
||||
#include "fastfile_cod7.h"
|
||||
#include "zonefile_cod7.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compression.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD7::FastFile_COD7() {
|
||||
|
||||
}
|
||||
|
||||
FastFile_COD7::~FastFile_COD7() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD7::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD7::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::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 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, FF_PLATFORM_XBOX);
|
||||
} else if (GetPlatform() == "Wii") {
|
||||
// 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, FF_PLATFORM_WII);
|
||||
}
|
||||
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD7>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
#ifndef FASTFILE_COD7_H
|
||||
#define FASTFILE_COD7_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD7 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD7();
|
||||
~FastFile_COD7();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD7_H
|
||||
@ -1,114 +0,0 @@
|
||||
#include "fastfile_cod9.h"
|
||||
#include "zonefile_cod9.h"
|
||||
#include "encryption.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD9::FastFile_COD9() {
|
||||
|
||||
}
|
||||
|
||||
FastFile_COD9::~FastFile_COD9() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD9::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool FastFile_COD9::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::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(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 zoneFile;
|
||||
zoneFile.SetStem(GetStem());
|
||||
zoneFile.Load(decompressedData, FF_PLATFORM_PC);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD9>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
#ifndef FASTFILE_COD9_H
|
||||
#define FASTFILE_COD9_H
|
||||
|
||||
#include "fastfile.h"
|
||||
|
||||
class FastFile_COD9 : public FastFile
|
||||
{
|
||||
public:
|
||||
FastFile_COD9();
|
||||
~FastFile_COD9();
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
};
|
||||
|
||||
#endif // FASTFILE_COD9_H
|
||||
305
libs/fastfile/fastfile_factory.h
Normal file
305
libs/fastfile/fastfile_factory.h
Normal file
@ -0,0 +1,305 @@
|
||||
#ifndef FASTFILE_FACTORY_H
|
||||
#define FASTFILE_FACTORY_H
|
||||
|
||||
#include "360/fastfile_cod2_360.h"
|
||||
//#include "360/fastfile_cod3_360.h"
|
||||
//#include "360/fastfile_cod4_360.h"
|
||||
#include "360/fastfile_cod5_360.h"
|
||||
//#include "360/fastfile_cod6_360.h"
|
||||
#include "360/fastfile_cod7_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 "PS3/fastfile_cod3_ps3.h"
|
||||
//#include "PS3/fastfile_cod4_ps3.h"
|
||||
#include "PS3/fastfile_cod5_ps3.h"
|
||||
//#include "PS3/fastfile_cod6_ps3.h"
|
||||
#include "PS3/fastfile_cod7_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 "PC/fastfile_cod3_pc.h"
|
||||
//#include "PC/fastfile_cod4_pc.h"
|
||||
#include "PC/fastfile_cod5_pc.h"
|
||||
//#include "PC/fastfile_cod6_pc.h"
|
||||
#include "PC/fastfile_cod7_pc.h"
|
||||
//#include "PC/fastfile_cod8_360.h"
|
||||
#include "PC/fastfile_cod9_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 <QByteArray>
|
||||
#include <QString>
|
||||
#include <memory>
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
class FastFile;
|
||||
|
||||
enum FastFile_Platform {
|
||||
PLATFORM_NONE = 0x00,
|
||||
PLATFORM_PC = 0x01,
|
||||
PLATFORM_360 = 0x02,
|
||||
PLATFORM_PS3 = 0x03,
|
||||
PLATFORM_WII = 0x04,
|
||||
PLATFORM_WIIU = 0x05
|
||||
};
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
class FastFileFactory {
|
||||
public:
|
||||
static std::shared_ptr<FastFile> Create(const QString& aFilePath) {
|
||||
QFile fastFile(aFilePath);
|
||||
if (!fastFile.open(QIODevice::ReadOnly)) {
|
||||
qDebug() << "Factory failed to open fast file: " << aFilePath;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const QString stem = aFilePath.split('/').last().split('.').first();
|
||||
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);
|
||||
}
|
||||
} 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 (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 (pGetPlatform(data) == PLATFORM_WII) {
|
||||
if (pGetGame(data) == GAME_COD7) {
|
||||
resultFF = std::make_shared<FastFile_COD7_Wii>(aFilePath);
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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 (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) {
|
||||
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) {
|
||||
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) {
|
||||
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 (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) {
|
||||
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) {
|
||||
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) {
|
||||
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 (pGetPlatform(aData) == PLATFORM_WII) {
|
||||
if (pGetGame(aData) == GAME_COD7) {
|
||||
resultFF = std::make_shared<FastFile_COD7_Wii>(aData);
|
||||
}
|
||||
} else if (pGetPlatform(aData) == PLATFORM_WIIU) {
|
||||
if (pGetGame(aData) == GAME_COD9) {
|
||||
resultFF = std::make_shared<FastFile_COD9_WiiU>(aData);
|
||||
} else if (pGetGame(aData) == GAME_COD10) {
|
||||
//resultFF = std::make_shared<FastFile_COD10_WiiU>(data);
|
||||
}
|
||||
}
|
||||
if (resultFF) {
|
||||
resultFF->SetStem(aStem);
|
||||
}
|
||||
return resultFF;
|
||||
}
|
||||
private:
|
||||
static QStringList pGetDataSections(const QByteArray& aData) {
|
||||
QStringList sections;
|
||||
|
||||
sections << aData.mid(0, 2).toHex().toUpper();
|
||||
sections << aData.mid(2, 2).toHex().toUpper();
|
||||
sections << aData.mid(4, 2).toHex().toUpper();
|
||||
sections << aData.mid(6, 2).toHex().toUpper();
|
||||
sections << aData.mid(8, 2).toHex().toUpper();
|
||||
sections << aData.mid(10, 2).toHex().toUpper();
|
||||
|
||||
return sections;
|
||||
}
|
||||
|
||||
static FastFile_Platform pGetPlatform(const QByteArray& aData) {
|
||||
const QStringList sections = pGetDataSections(aData);
|
||||
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") {
|
||||
return PLATFORM_360;
|
||||
}
|
||||
} else if (sections[5] == "0000") {
|
||||
return PLATFORM_PC;
|
||||
}
|
||||
return PLATFORM_NONE;
|
||||
}
|
||||
|
||||
static FastFile_Game pGetGame(const QByteArray& aData) {
|
||||
const QStringList sections = pGetDataSections(aData);
|
||||
if (sections[0] == "0000") {
|
||||
return GAME_COD2;
|
||||
} else if (sections[5] == "0183") {
|
||||
return GAME_COD5;
|
||||
} else if (sections[0] == "5331") {
|
||||
return GAME_COD11;
|
||||
} else if (sections[2] == "3030") {
|
||||
return GAME_COD12;
|
||||
}
|
||||
return GAME_NONE;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // FASTFILE_FACTORY_H
|
||||
@ -8,6 +8,87 @@
|
||||
#include <QRectF>
|
||||
#include <QMap>
|
||||
|
||||
enum AssetType {
|
||||
ASSET_NONE = 0x00,
|
||||
ASSET_RAW_FILE = 0x01,
|
||||
ASSET_SCRIPT_PARSE_TREE = 0x02,
|
||||
ASSET_EFFECT = 0x03,
|
||||
ASSET_SOUND = 0x04,
|
||||
ASSET_ANIMATION = 0x05,
|
||||
ASSET_COLLISION_MAP = 0x06,
|
||||
ASSET_STRING_TABLE = 0x07,
|
||||
ASSET_MENU = 0x08,
|
||||
ASSET_TECH_SET = 0x09,
|
||||
ASSET_WEAPON = 0x10,
|
||||
ASSET_GFX_MAP = 0x11,
|
||||
ASSET_LIGHT_DEF = 0x12,
|
||||
ASSET_FONT = 0x13,
|
||||
ASSET_MODEL = 0x14,
|
||||
ASSET_D3DBSP = 0x15,
|
||||
ASSET_IMAGE = 0x16,
|
||||
ASSET_GAME_MAP_SP = 0x17,
|
||||
ASSET_COL_MAP_SP = 0x18,
|
||||
ASSET_PHYS_PRESET = 0x19,
|
||||
ASSET_DESTRUCTIBLE = 0x20,
|
||||
ASSET_LOCAL_STRING = 0x21,
|
||||
ASSET_SHADER = 0x22,
|
||||
ASSET_MP_MAP = 0x23,
|
||||
ASSET_SP_MAP = 0x24,
|
||||
ASSET_UI_MAP = 0x25,
|
||||
ASSET_SND_DRIVER_GLOBALS = 0x26,
|
||||
ASSET_AI_TYPE = 0x27,
|
||||
ASSET_MATERIAL = 0x28,
|
||||
ASSET_COMPUTE_SHADER_SET = 0x29,
|
||||
ASSET_LIGHT_DESCRIPTION = 0x30,
|
||||
ASSET_BIT_FIELD = 0x31,
|
||||
ASSET_STRUCTURED_TABLE = 0x32,
|
||||
ASSET_LEADERBOARD_DEF = 0x33,
|
||||
ASSET_DDL = 0x34,
|
||||
ASSET_KEY_VALUE_PAIRS = 0x35,
|
||||
ASSET_SCRIPT_BUNDLE = 0x36,
|
||||
ASSET_SCRIPT_BUNDLE_LIST = 0x37,
|
||||
ASSET_MAP_TABLE = 0x38,
|
||||
ASSET_MAP_TABLE_LOADING_IMAGES = 0x39,
|
||||
ASSET_SURFACE_SOUND_DEF = 0x40,
|
||||
ASSET_SURFACE_FX_TABLE = 0x41,
|
||||
ASSET_RUMBLE = 0x42,
|
||||
ASSET_AIM_TABLE = 0x43,
|
||||
ASSET_MEDAL = 0x44,
|
||||
ASSET_MEDAL_TABLE = 0x45,
|
||||
ASSET_OBJECTIVE = 0x46,
|
||||
ASSET_OBJECTIVE_LIST = 0x47,
|
||||
ASSET_LASER = 0x48,
|
||||
ASSET_BEAM = 0x49,
|
||||
ASSET_STREAMER_HINT = 0x50,
|
||||
ASSET_ANIM_SELECTOR_TABLE = 0x51,
|
||||
ASSET_ANIM_MAPPING_TABLE = 0x52,
|
||||
ASSET_ANIM_STATE_MACHINE = 0x53,
|
||||
ASSET_BEHAVIOR_TREE = 0x54,
|
||||
ASSET_BEHAVIOR_STATE_MACHINE = 0x55,
|
||||
ASSET_FOOTSTEP_TABLE = 0x56,
|
||||
ASSET_ENTITY_FX_IMPACTS = 0x57,
|
||||
ASSET_ENTITY_SOUND_IMPACTS = 0x58,
|
||||
ASSET_VEHICLE_FX_DEF = 0x59,
|
||||
ASSET_VEHICLE_SOUND_DEF = 0x60,
|
||||
ASSET_VEHICLE = 0x61,
|
||||
ASSET_VEHICLE_TRACER = 0x62,
|
||||
ASSET_PLAYER_SOUNDS_TABLE = 0x63,
|
||||
ASSET_PLAYER_FX_TABLE = 0x64,
|
||||
ASSET_SHARED_WEAPON_SOUNDS = 0x65,
|
||||
ASSET_ATTACHMENT = 0x66,
|
||||
ASSET_ATTACHMENT_UNIQUE = 0x67,
|
||||
ASSET_WEAPON_CAMO = 0x68,
|
||||
ASSET_CUSTOMIZATION_TABLE = 0x69,
|
||||
ASSET_CUSTOMIZATION_TABLE_FEIMAGES = 0x70,
|
||||
ASSET_CUSTOMIZATION_TABLE_COLOR = 0x71,
|
||||
ASSET_PHYS_CONSTRAINTS = 0x72,
|
||||
ASSET_DESTRUCTIBLE_DEF = 0x73,
|
||||
ASSET_MODEL_MESH = 0x74,
|
||||
ASSET_S_ANIM = 0x75,
|
||||
ASSET_FONT_ICON = 0x76,
|
||||
ASSET_CG_MEDIA_TABLE = 0x77
|
||||
};
|
||||
|
||||
struct LocalString {
|
||||
QString string;
|
||||
QString alias;
|
||||
@ -19,6 +100,12 @@ struct RawFile {
|
||||
QString contents;
|
||||
};
|
||||
|
||||
struct GscFile {
|
||||
quint64 length;
|
||||
QString path;
|
||||
QString contents;
|
||||
};
|
||||
|
||||
struct TechSet {
|
||||
QString name;
|
||||
bool hasShaders = false;
|
||||
@ -178,11 +265,11 @@ struct Image {
|
||||
};
|
||||
|
||||
struct Material {
|
||||
quint32 namePtr;
|
||||
qint32 namePtr;
|
||||
QString name;
|
||||
quint32 refNamePtr;
|
||||
QString refName;
|
||||
quint8 unknownA[12];
|
||||
QVector<quint32> pointers;
|
||||
quint32 stateBits[2];
|
||||
quint16 textureCount;
|
||||
quint16 constCount;
|
||||
@ -353,6 +440,7 @@ struct SoundAsset {
|
||||
struct AssetMap {
|
||||
QVector<LocalString> localStrings;
|
||||
QVector<RawFile> rawFiles;
|
||||
QVector<GscFile> gscFiles;
|
||||
//QVector<PhysPreset> phyPresets;
|
||||
QVector<Model> models;
|
||||
QVector<Material> materials;
|
||||
|
||||
@ -44,49 +44,201 @@ ZoneFile &ZoneFile::operator=(const ZoneFile &other) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
QIcon ZoneFile::AssetStrToIcon(const QString aAssetStr) {
|
||||
const QString cleanedType = aAssetStr.toUpper();
|
||||
if (cleanedType == "LOCAL STRING") { // localized string PARTIALLY VERIFIED
|
||||
QString ZoneFile::AssetEnumToStr(const AssetType aAssetType)
|
||||
{
|
||||
if (aAssetType == ASSET_LOCAL_STRING) {
|
||||
return "ASSET_LOCAL_STRING";
|
||||
} else if (aAssetType == ASSET_RAW_FILE) {
|
||||
return "ASSET_RAW_FILE";
|
||||
} else if (aAssetType == ASSET_SCRIPT_PARSE_TREE) {
|
||||
return "ASSET_GSC_FILE";
|
||||
} else if (aAssetType == ASSET_EFFECT) {
|
||||
return "ASSET_EFFECT";
|
||||
} else if (aAssetType == ASSET_SOUND) {
|
||||
return "ASSET_SOUND";
|
||||
} else if (aAssetType == ASSET_ANIMATION) {
|
||||
return "ASSET_ANIMATION";
|
||||
} else if (aAssetType == ASSET_COLLISION_MAP) {
|
||||
return "ASSET_COLLISION_MAP";
|
||||
} else if (aAssetType == ASSET_STRING_TABLE) {
|
||||
return "ASSET_STRING_TABLE";
|
||||
} else if (aAssetType == ASSET_MENU) {
|
||||
return "ASSET_MENU";
|
||||
} else if (aAssetType == ASSET_TECH_SET) {
|
||||
return "ASSET_TECH_SET";
|
||||
} else if (aAssetType == ASSET_WEAPON) {
|
||||
return "ASSET_WEAPON";
|
||||
} else if (aAssetType == ASSET_GFX_MAP) {
|
||||
return "ASSET_GFX_MAP";
|
||||
} else if (aAssetType == ASSET_LIGHT_DEF) {
|
||||
return "ASSET_LIGHT_DEF";
|
||||
} else if (aAssetType == ASSET_FONT) {
|
||||
return "ASSET_FONT";
|
||||
} else if (aAssetType == ASSET_MODEL) {
|
||||
return "ASSET_MODEL";
|
||||
} else if (aAssetType == ASSET_D3DBSP) {
|
||||
return "ASSET_D3DBSP";
|
||||
} else if (aAssetType == ASSET_IMAGE) {
|
||||
return "ASSET_IMAGE";
|
||||
} else if (aAssetType == ASSET_GAME_MAP_SP) {
|
||||
return "ASSET_GAME_MAP_SP";
|
||||
} else if (aAssetType == ASSET_COL_MAP_SP) {
|
||||
return "ASSET_COL_MAP_SP";
|
||||
} else if (aAssetType == ASSET_COL_MAP_SP) {
|
||||
return "ASSET_COL_MAP_SP";
|
||||
} else if (aAssetType == ASSET_DESTRUCTIBLE) {
|
||||
return "ASSET_DESTRUCTIBLE";
|
||||
} else if (aAssetType == ASSET_MATERIAL) {
|
||||
return "ASSET_MATERIAL";
|
||||
} else if (aAssetType == ASSET_PHYS_PRESET) {
|
||||
return "ASSET_PHYS_PRESET";
|
||||
} else if (aAssetType == ASSET_COMPUTE_SHADER_SET) {
|
||||
return "ASSET_COMPUTE_SHADER_SET";
|
||||
} else if (aAssetType == ASSET_STRUCTURED_TABLE) {
|
||||
return "ASSET_STRUCTURED_TABLE";
|
||||
} else if (aAssetType == ASSET_LEADERBOARD_DEF) {
|
||||
return "ASSET_LEADERBOARD_DEF";
|
||||
} else if (aAssetType == ASSET_DDL) {
|
||||
return "ASSET_DDL";
|
||||
} else if (aAssetType == ASSET_SCRIPT_PARSE_TREE) {
|
||||
return "ASSET_SCRIPT_PARSE_TREE";
|
||||
} else if (aAssetType == ASSET_KEY_VALUE_PAIRS) {
|
||||
return "ASSET_KEY_VALUE_PAIRS";
|
||||
} else if (aAssetType == ASSET_SCRIPT_BUNDLE) {
|
||||
return "ASSET_SCRIPT_BUNDLE";
|
||||
} else if (aAssetType == ASSET_SCRIPT_BUNDLE_LIST) {
|
||||
return "ASSET_SCRIPT_BUNDLE_LIST";
|
||||
} else if (aAssetType == ASSET_LIGHT_DEF) {
|
||||
return "ASSET_LIGHT_DEF";
|
||||
} else if (aAssetType == ASSET_BIT_FIELD) {
|
||||
return "ASSET_BIT_FIELD";
|
||||
} else if (aAssetType == ASSET_MAP_TABLE) {
|
||||
return "ASSET_MAP_TABLE";
|
||||
} else if (aAssetType == ASSET_MAP_TABLE_LOADING_IMAGES) {
|
||||
return "ASSET_MAP_TABLE_LOADING_IMAGES";
|
||||
} else if (aAssetType == ASSET_SURFACE_SOUND_DEF) {
|
||||
return "ASSET_SURFACE_SOUND_DEF";
|
||||
} else if (aAssetType == ASSET_SURFACE_FX_TABLE) {
|
||||
return "ASSET_SURFACE_FX_TABLE";
|
||||
} else if (aAssetType == ASSET_RUMBLE) {
|
||||
return "ASSET_RUMBLE";
|
||||
} else if (aAssetType == ASSET_AIM_TABLE) {
|
||||
return "ASSET_AIM_TABLE";
|
||||
} else if (aAssetType == ASSET_MEDAL) {
|
||||
return "ASSET_MEDAL";
|
||||
} else if (aAssetType == ASSET_MEDAL_TABLE) {
|
||||
return "ASSET_MEDAL_TABLE";
|
||||
} else if (aAssetType == ASSET_OBJECTIVE) {
|
||||
return "ASSET_OBJECTIVE";
|
||||
} else if (aAssetType == ASSET_OBJECTIVE_LIST) {
|
||||
return "ASSET_OBJECTIVE_LIST";
|
||||
} else if (aAssetType == ASSET_LASER) {
|
||||
return "ASSET_LASER";
|
||||
} else if (aAssetType == ASSET_BEAM) {
|
||||
return "ASSET_BEAM";
|
||||
} else if (aAssetType == ASSET_STREAMER_HINT) {
|
||||
return "ASSET_STREAMER_HINT";
|
||||
} else if (aAssetType == ASSET_ANIM_SELECTOR_TABLE) {
|
||||
return "ASSET_ANIM_SELECTOR_TABLE";
|
||||
} else if (aAssetType == ASSET_ANIM_MAPPING_TABLE) {
|
||||
return "ASSET_ANIM_MAPPING_TABLE";
|
||||
} else if (aAssetType == ASSET_ANIM_STATE_MACHINE) {
|
||||
return "ASSET_ANIM_STATE_MACHINE";
|
||||
} else if (aAssetType == ASSET_BEHAVIOR_TREE) {
|
||||
return "ASSET_BEHAVIOR_TREE";
|
||||
} else if (aAssetType == ASSET_BEHAVIOR_STATE_MACHINE) {
|
||||
return "ASSET_BEHAVIOR_STATE_MACHINE";
|
||||
} else if (aAssetType == ASSET_FOOTSTEP_TABLE) {
|
||||
return "ASSET_FOOTSTEP_TABLE";
|
||||
} else if (aAssetType == ASSET_ENTITY_FX_IMPACTS) {
|
||||
return "ASSET_ENTITY_FX_IMPACTS";
|
||||
} else if (aAssetType == ASSET_ENTITY_SOUND_IMPACTS) {
|
||||
return "ASSET_ENTITY_SOUND_IMPACTS";
|
||||
} else if (aAssetType == ASSET_VEHICLE_FX_DEF) {
|
||||
return "ASSET_VEHICLE_FX_DEF";
|
||||
} else if (aAssetType == ASSET_VEHICLE_SOUND_DEF) {
|
||||
return "ASSET_VEHICLE_SOUND_DEF";
|
||||
} else if (aAssetType == ASSET_VEHICLE) {
|
||||
return "ASSET_VEHICLE";
|
||||
} else if (aAssetType == ASSET_VEHICLE_TRACER) {
|
||||
return "ASSET_VEHICLE_TRACER";
|
||||
} else if (aAssetType == ASSET_PLAYER_SOUNDS_TABLE) {
|
||||
return "ASSET_PLAYER_SOUNDS_TABLE";
|
||||
} else if (aAssetType == ASSET_PLAYER_FX_TABLE) {
|
||||
return "ASSET_PLAYER_FX_TABLE";
|
||||
} else if (aAssetType == ASSET_SHARED_WEAPON_SOUNDS) {
|
||||
return "ASSET_SHARED_WEAPON_SOUNDS";
|
||||
} else if (aAssetType == ASSET_ATTACHMENT) {
|
||||
return "ASSET_ATTACHMENT";
|
||||
} else if (aAssetType == ASSET_ATTACHMENT_UNIQUE) {
|
||||
return "ASSET_ATTACHMENT_UNIQUE";
|
||||
} else if (aAssetType == ASSET_WEAPON_CAMO) {
|
||||
return "ASSET_WEAPON_CAMO";
|
||||
} else if (aAssetType == ASSET_CUSTOMIZATION_TABLE) {
|
||||
return "ASSET_CUSTOMIZATION_TABLE";
|
||||
} else if (aAssetType == ASSET_CUSTOMIZATION_TABLE_FEIMAGES) {
|
||||
return "ASSET_CUSTOMIZATION_TABLE_FEIMAGES";
|
||||
} else if (aAssetType == ASSET_CUSTOMIZATION_TABLE_COLOR) {
|
||||
return "ASSET_CUSTOMIZATION_TABLE_COLOR";
|
||||
} else if (aAssetType == ASSET_PHYS_CONSTRAINTS) {
|
||||
return "ASSET_PHYS_CONSTRAINTS";
|
||||
} else if (aAssetType == ASSET_DESTRUCTIBLE_DEF) {
|
||||
return "ASSET_DESTRUCTIBLE_DEF";
|
||||
} else if (aAssetType == ASSET_MODEL_MESH) {
|
||||
return "ASSET_MODEL_MESH";
|
||||
} else if (aAssetType == ASSET_S_ANIM) {
|
||||
return "ASSET_S_ANIM";
|
||||
} else if (aAssetType == ASSET_SOUND) {
|
||||
return "ASSET_SOUND";
|
||||
} else if (aAssetType == ASSET_FONT_ICON) {
|
||||
return "ASSET_FONT_ICON";
|
||||
}
|
||||
return "ASSET_UNKNOWN";
|
||||
}
|
||||
QIcon ZoneFile::AssetTypeToIcon(const AssetType aAssetType) {
|
||||
if (aAssetType == ASSET_LOCAL_STRING) { // localized string PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_StringFile.png");
|
||||
} else if (cleanedType == "RAW FILE") { // raw_file PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_RAW_FILE) { // raw_file PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_RawFile.png");
|
||||
} else if (cleanedType == "GSC FILE") { // raw_file PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_SCRIPT_PARSE_TREE) { // raw_file PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_GSCFile.png");
|
||||
} else if (cleanedType == "EFFECT") { // fx PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_EFFECT) { // fx PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_Effect.png");
|
||||
} else if (cleanedType == "SOUND") { // loaded_sound PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_SOUND) { // loaded_sound PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_Sound.png");
|
||||
} else if (cleanedType == "ANIMATION") { // x_anim PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_ANIMATION) { // x_anim PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_Animation.png");
|
||||
} else if (cleanedType == "COLLISION MAP") { // collision_map PARTIALLY VERIFIED
|
||||
//return "COLLISION MAP";
|
||||
} else if (cleanedType == "STRING TABLE") { // string_table PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_COLLISION_MAP) { // collision_map PARTIALLY VERIFIED
|
||||
//return ASSET_COLLISION_MAP;
|
||||
} else if (aAssetType == ASSET_STRING_TABLE) { // string_table PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_StringTable.png");
|
||||
} else if (cleanedType == "MENU") { // menu_file PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_MENU) { // menu_file PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_MenuFile.png");
|
||||
} else if (cleanedType == "TECH SET") { // tech set PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_TECH_SET) { // tech set PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_TechSetFile.png");
|
||||
} else if (cleanedType == "WEAPON") { // weapon PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_WEAPON) { // weapon PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_Weapon.png");
|
||||
} else if (cleanedType == "GFX MAP") { // gfx map PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_GFX_MAP) { // gfx map PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_FXMap.png");
|
||||
} else if (cleanedType == "LIGHT DEF") { // light_def PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_LIGHT_DEF) { // light_def PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_LightDef.png");
|
||||
} else if (cleanedType == "FONT") { // font PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_FONT) { // font PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_Font.png");
|
||||
} else if (cleanedType == "MODEL") { // xmodel PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_MODEL) { // xmodel PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_Model.png");
|
||||
} else if (cleanedType == "D3DBSP") { // d3dbsp PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_MATERIAL) { // xmodel PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_Material.png");
|
||||
} else if (aAssetType == ASSET_D3DBSP) { // d3dbsp PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_BSP.png");
|
||||
} else if (cleanedType == "IMAGE") { // image PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_IMAGE) { // image PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_Image.png");
|
||||
} else if (cleanedType == "GAME MAP SP") { // game map sp PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_GAME_MAP_SP) { // game map sp PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_GameMapSp.png");
|
||||
} else if (cleanedType == "COL MAP SP") { // col map sp PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_COL_MAP_SP) { // col map sp PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_ColMapSp.png");
|
||||
} else if (cleanedType == "PHYS PRESET") { // col map sp PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_PHYS_PRESET) { // col map sp PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_PhysPreset.png");
|
||||
} else if (cleanedType == "DESTRUCTIBLE") { // col map sp PARTIALLY VERIFIED
|
||||
} else if (aAssetType == ASSET_DESTRUCTIBLE) { // col map sp PARTIALLY VERIFIED
|
||||
return QIcon(":/icons/icons/Icon_Destructible.png");
|
||||
}
|
||||
return QIcon();
|
||||
|
||||
@ -14,10 +14,10 @@ public:
|
||||
ZoneFile(const ZoneFile &aZoneFile);
|
||||
ZoneFile &operator=(const ZoneFile &other);
|
||||
|
||||
virtual bool Load(const QByteArray aFileData, FF_PLATFORM platform = FF_PLATFORM_NONE) = 0;
|
||||
virtual QString AssetTypeToString(const QString aAssetType) = 0;
|
||||
|
||||
QIcon AssetStrToIcon(const QString aAssetStr);
|
||||
virtual bool Load(const QByteArray aFileData) = 0;
|
||||
virtual AssetType AssetStrToEnum(const QString aAssetType) = 0;
|
||||
virtual QString AssetEnumToStr(const AssetType aAssetType);
|
||||
virtual QIcon AssetTypeToIcon(const AssetType aAssetType);
|
||||
|
||||
virtual QByteArray GetBinaryData() = 0;
|
||||
virtual bool SaveZoneFile(const QString aZoneFilePath);
|
||||
@ -39,7 +39,7 @@ public:
|
||||
void SetAssetMap(const AssetMap aAssetMap);
|
||||
|
||||
private slots:
|
||||
virtual void pParseZoneHeader(QDataStream *aZoneFileStream, FF_PLATFORM aPlatform) = 0;
|
||||
virtual void pParseZoneHeader(QDataStream *aZoneFileStream) = 0;
|
||||
virtual quint32 pParseZoneSize(QDataStream *aZoneFileStream) = 0;
|
||||
virtual void pParseZoneUnknownsA(QDataStream *aZoneFileStream) = 0;
|
||||
virtual quint32 pParseZoneTagCount(QDataStream *aZoneFileStream) = 0;
|
||||
|
||||
@ -4,24 +4,42 @@ CONFIG += staticlib c++17
|
||||
|
||||
SOURCES += \
|
||||
zonefile.cpp \
|
||||
zonefile_cod2.cpp \
|
||||
zonefile_cod5.cpp \
|
||||
zonefile_cod7.cpp \
|
||||
zonefile_cod9.cpp
|
||||
360/zonefile_cod2_360.cpp \
|
||||
360/zonefile_cod5_360.cpp \
|
||||
360/zonefile_cod7_360.cpp \
|
||||
360/zonefile_cod9_360.cpp \
|
||||
PS3/zonefile_cod5_ps3.cpp \
|
||||
PS3/zonefile_cod7_ps3.cpp \
|
||||
PS3/zonefile_cod9_ps3.cpp \
|
||||
PC/zonefile_cod5_pc.cpp \
|
||||
PC/zonefile_cod7_pc.cpp \
|
||||
PC/zonefile_cod9_pc.cpp \
|
||||
PC/zonefile_cod12_pc.cpp \
|
||||
Wii/zonefile_cod7_wii.cpp \
|
||||
WiiU/zonefile_cod9_wiiu.cpp
|
||||
|
||||
HEADERS += \
|
||||
asset_structs.h \
|
||||
zonefile.h \
|
||||
zonefile_cod2.h \
|
||||
zonefile_cod5.h \
|
||||
zonefile_cod7.h \
|
||||
zonefile_cod9.h
|
||||
360/zonefile_cod2_360.h \
|
||||
360/zonefile_cod5_360.h \
|
||||
360/zonefile_cod7_360.h \
|
||||
360/zonefile_cod9_360.h \
|
||||
PS3/zonefile_cod5_ps3.h \
|
||||
PS3/zonefile_cod7_ps3.h \
|
||||
PS3/zonefile_cod9_ps3.h \
|
||||
PC/zonefile_cod5_pc.h \
|
||||
PC/zonefile_cod7_pc.h \
|
||||
PC/zonefile_cod9_pc.h \
|
||||
PC/zonefile_cod12_pc.h \
|
||||
Wii/zonefile_cod7_wii.h \
|
||||
WiiU/zonefile_cod9_wiiu.h \
|
||||
zonefile_factory.h
|
||||
|
||||
LIBS += \
|
||||
-L$$OUT_PWD/../libs/core -lcore
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/../core
|
||||
$$PWD/../core \
|
||||
|
||||
DEPENDPATH += \
|
||||
$$PWD/../core
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,52 +0,0 @@
|
||||
#ifndef ZONEFILE_COD2_H
|
||||
#define ZONEFILE_COD2_H
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD2 : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD2();
|
||||
~ZoneFile_COD2();
|
||||
|
||||
bool Load(const QByteArray aFileData, FF_PLATFORM aPlatform) override;
|
||||
QString AssetTypeToString(const QString aAssetType);
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
protected:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream, FF_PLATFORM aPlatform) 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_H
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,54 +0,0 @@
|
||||
#ifndef ZONEFILE_COD5_H
|
||||
#define ZONEFILE_COD5_H
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD5 : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD5();
|
||||
~ZoneFile_COD5();
|
||||
|
||||
bool Load(const QByteArray aFileData, FF_PLATFORM aPlatform) override;
|
||||
QString AssetTypeToString(const QString aAssetType) override;
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
private:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream, FF_PLATFORM aPlatform) 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_H
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,52 +0,0 @@
|
||||
#ifndef ZONEFILE_COD7_H
|
||||
#define ZONEFILE_COD7_H
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD7 : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD7();
|
||||
~ZoneFile_COD7();
|
||||
|
||||
bool Load(const QByteArray aFileData, FF_PLATFORM aPlatform) override;
|
||||
QString AssetTypeToString(const QString aAssetType);
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
protected:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream, FF_PLATFORM aPlatform) 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_H
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,52 +0,0 @@
|
||||
#ifndef ZONEFILE_COD9_H
|
||||
#define ZONEFILE_COD9_H
|
||||
|
||||
#include "zonefile.h"
|
||||
|
||||
class ZoneFile_COD9 : public ZoneFile
|
||||
{
|
||||
public:
|
||||
ZoneFile_COD9();
|
||||
~ZoneFile_COD9();
|
||||
|
||||
bool Load(const QByteArray aFileData, FF_PLATFORM aPlatform) override;
|
||||
QString AssetTypeToString(const QString aAssetType);
|
||||
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
protected:
|
||||
void pParseZoneHeader(QDataStream *aZoneFileStream, FF_PLATFORM aPlatform) 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_H
|
||||
18
libs/zonefile/zonefile_factory.h
Normal file
18
libs/zonefile/zonefile_factory.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef ZONEFILE_FACTORY_H
|
||||
#define ZONEFILE_FACTORY_H
|
||||
|
||||
#include <QByteArray>
|
||||
#include <memory>
|
||||
|
||||
class ZoneFile;
|
||||
|
||||
class ZoneFileFactory {
|
||||
public:
|
||||
static std::shared_ptr<ZoneFile> Create(const QByteArray& data) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif // ZONEFILE_FACTORY_H
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
#include "autotest_cod.h"
|
||||
#include "compression.h"
|
||||
#include "fastfile_factory.h"
|
||||
|
||||
class AutoTest_COD2_360 : public AutoTest_COD {
|
||||
Q_OBJECT
|
||||
@ -18,6 +19,10 @@ private slots:
|
||||
// Data-driven test for recompression (compression)
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -89,6 +94,7 @@ void AutoTest_COD2_360::testCompression_data() {
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,6 +150,51 @@ void AutoTest_COD2_360::testCompression() {
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD2_360::testFactory_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod2_360");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
}
|
||||
}
|
||||
|
||||
void AutoTest_COD2_360::testFactory() {
|
||||
QFETCH(QString, fastFilePath_cod2_360);
|
||||
|
||||
const QString testName = "Create w/ factory: " + fastFilePath_cod2_360;
|
||||
|
||||
// Open the original .ff file.
|
||||
QFile testFastFile(fastFilePath_cod2_360);
|
||||
bool fastFileOpened = testFastFile.open(QIODevice::ReadOnly);
|
||||
if (!fastFileOpened) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(fastFileOpened
|
||||
, qPrintable("Failed to open test fastfile: " + fastFilePath_cod2_360));
|
||||
const QByteArray testFFData = testFastFile.readAll();
|
||||
testFastFile.close();
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(testFFData);
|
||||
|
||||
bool correctPlatform = fastFile->GetPlatform() == "360";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory created fastfile for platform: " + fastFile->GetPlatform()));
|
||||
|
||||
bool correctGame = fastFile->GetGame() == "COD2";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory created fastfile for game: " + fastFile->GetGame()));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD2_360::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#include <QDirIterator>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "fastfile_factory.h"
|
||||
#include "autotest_cod.h"
|
||||
#include "compression.h"
|
||||
|
||||
@ -18,6 +19,10 @@ private slots:
|
||||
// Data-driven test for recompression (compression)
|
||||
void testCompression_data();
|
||||
void testCompression();
|
||||
|
||||
void testFactory_data();
|
||||
void testFactory();
|
||||
|
||||
void cleanupTestCase();
|
||||
};
|
||||
|
||||
@ -30,9 +35,13 @@ void AutoTest_COD5_360::testDecompression_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod5_360");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
int ffCount = 0;
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
ffCount++;
|
||||
|
||||
if (ffCount == FILE_MAX) { break; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,9 +90,13 @@ void AutoTest_COD5_360::testCompression_data() {
|
||||
QTest::addColumn<QString>("zoneFilePath_cod5_360");
|
||||
|
||||
QStringList zoneFiles = findZoneFiles(getZoneFileDirectory());
|
||||
int zoneCount = 0;
|
||||
for (const QString &filePath : zoneFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
zoneCount++;
|
||||
|
||||
if (zoneCount == FILE_MAX) { break; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,6 +138,44 @@ void AutoTest_COD5_360::testCompression() {
|
||||
QCOMPARE(recompressedData, originalFFData);
|
||||
}
|
||||
|
||||
void AutoTest_COD5_360::testFactory_data() {
|
||||
QTest::addColumn<QString>("fastFilePath_cod5_360");
|
||||
|
||||
QStringList ffFiles = findFastFiles(getFastFileDirectory());
|
||||
int ffCount = 0;
|
||||
for (const QString &filePath : ffFiles) {
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
QTest::newRow(qPrintable(fileName)) << filePath;
|
||||
ffCount++;
|
||||
|
||||
if (ffCount == FILE_MAX) { break; }
|
||||
}
|
||||
}
|
||||
|
||||
void AutoTest_COD5_360::testFactory() {
|
||||
QFETCH(QString, fastFilePath_cod5_360);
|
||||
|
||||
const QString testName = "Create w/ factory: " + fastFilePath_cod5_360;
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(fastFilePath_cod5_360);
|
||||
|
||||
bool correctPlatform = fastFile->GetPlatform() == "360";
|
||||
if (!correctPlatform) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctPlatform
|
||||
, qPrintable("Factory created fastfile for platform: " + fastFile->GetPlatform()));
|
||||
|
||||
bool correctGame = fastFile->GetGame() == "COD5";
|
||||
if (!correctGame) {
|
||||
recordResult(testName, false);
|
||||
}
|
||||
QVERIFY2(correctGame
|
||||
, qPrintable("Factory created fastfile for game: " + fastFile->GetGame()));
|
||||
|
||||
recordResult(testName, true);
|
||||
}
|
||||
|
||||
void AutoTest_COD5_360::cleanupTestCase() {
|
||||
// Any cleanup if necessary.
|
||||
}
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
#define FILE_MAX 1
|
||||
|
||||
class AutoTest_COD : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@ -47,10 +47,10 @@
|
||||
// individual games
|
||||
#define TEST_COD2 0
|
||||
#define TEST_COD4 0
|
||||
#define TEST_COD5 0
|
||||
#define TEST_COD5 1
|
||||
#define TEST_COD6 0
|
||||
#define TEST_COD7 0
|
||||
#define TEST_COD8 1
|
||||
#define TEST_COD8 0
|
||||
#define TEST_COD9 0
|
||||
#define TEST_COD10 0
|
||||
#define TEST_COD11 0
|
||||
|
||||
@ -67,10 +67,11 @@ app.depends += \
|
||||
libs/core \
|
||||
libs/compression \
|
||||
libs/encryption \
|
||||
libs/zonefile \
|
||||
libs/fastfile
|
||||
|
||||
LIBS += \
|
||||
-L$$OUT_PWD/../libs/ -lcore -lencryption -lcompression -lfastfile \
|
||||
-L$$OUT_PWD/../libs/ -lcore -lencryption -lcompression -lfastfile -lzonefile \
|
||||
-L$$PWD/../third_party/xbox_sdk/lib -lxcompress64
|
||||
|
||||
INCLUDEPATH += \
|
||||
@ -78,14 +79,16 @@ INCLUDEPATH += \
|
||||
$$PWD/../libs/core \
|
||||
$$PWD/../libs/encryption \
|
||||
$$PWD/../libs/compression \
|
||||
$$PWD/../libs/fastfile
|
||||
$$PWD/../libs/fastfile \
|
||||
$$PWD/../libs/zonefile
|
||||
|
||||
DEPENDPATH += \
|
||||
$$PWD/../third_party/xbox_sdk/include \
|
||||
$$PWD/../libs/core \
|
||||
$$PWD/../libs/encryption \
|
||||
$$PWD/../libs/compression \
|
||||
$$PWD/../libs/fastfile
|
||||
$$PWD/../libs/fastfile \
|
||||
$$PWD/../libs/zonefile
|
||||
|
||||
RESOURCES +=
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user