Merge pull request 'feature/test' (#9) from feature/test into main
Reviewed-on: #9
This commit is contained in:
commit
b80a11093a
7
.gitignore
vendored
7
.gitignore
vendored
@ -13,3 +13,10 @@
|
|||||||
*.creator.*
|
*.creator.*
|
||||||
*.ps1
|
*.ps1
|
||||||
version.txt
|
version.txt
|
||||||
|
*.autosave
|
||||||
|
*.XMODEL_EXPORT
|
||||||
|
data/obj/*
|
||||||
|
libs/*/release/*
|
||||||
|
libs/*/debug/*
|
||||||
|
.git.stash
|
||||||
|
*Makefile*
|
||||||
|
|||||||
23
.qmake.stash
Normal file
23
.qmake.stash
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
QMAKE_CXX.QT_COMPILER_STDCXX = 199711L
|
||||||
|
QMAKE_CXX.QMAKE_MSC_VER = 1943
|
||||||
|
QMAKE_CXX.QMAKE_MSC_FULL_VER = 194334810
|
||||||
|
QMAKE_CXX.COMPILER_MACROS = \
|
||||||
|
QT_COMPILER_STDCXX \
|
||||||
|
QMAKE_MSC_VER \
|
||||||
|
QMAKE_MSC_FULL_VER
|
||||||
|
QMAKE_CXX.INCDIRS = \
|
||||||
|
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.43.34808\\include" \
|
||||||
|
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.43.34808\\ATLMFC\\include" \
|
||||||
|
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\VS\\include" \
|
||||||
|
"C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.26100.0\\ucrt" \
|
||||||
|
"C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.26100.0\\\\um" \
|
||||||
|
"C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.26100.0\\\\shared" \
|
||||||
|
"C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.26100.0\\\\winrt" \
|
||||||
|
"C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.26100.0\\\\cppwinrt" \
|
||||||
|
"C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\include\\um"
|
||||||
|
QMAKE_CXX.LIBDIRS = \
|
||||||
|
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.43.34808\\ATLMFC\\lib\\x64" \
|
||||||
|
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.43.34808\\lib\\x64" \
|
||||||
|
"C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\lib\\um\\x64" \
|
||||||
|
"C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.26100.0\\ucrt\\x64" \
|
||||||
|
"C:\\Program Files (x86)\\Windows Kits\\10\\\\lib\\10.0.26100.0\\\\um\\x64"
|
||||||
4
.vscode/settings.json
vendored
Normal file
4
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"workbench.colorTheme": "Default Dark Modern",
|
||||||
|
"workbench.startupEditor": "none"
|
||||||
|
}
|
||||||
77
app/app.pro
77
app/app.pro
@ -6,63 +6,9 @@ SUBDIRS += app
|
|||||||
|
|
||||||
CONFIG += c++17
|
CONFIG += c++17
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += $$files($$PWD/*.cpp)
|
||||||
aboutdialog.cpp \
|
HEADERS += $$files($$PWD/*.h)
|
||||||
ddsviewer.cpp \
|
FORMS += $$files($$PWD/*.ui)
|
||||||
fastfileviewer.cpp \
|
|
||||||
imagewidget.cpp \
|
|
||||||
iwiviewer.cpp \
|
|
||||||
localstringviewer.cpp \
|
|
||||||
main.cpp \
|
|
||||||
mainwindow.cpp \
|
|
||||||
materialviewer.cpp \
|
|
||||||
preferenceeditor.cpp \
|
|
||||||
soundviewer.cpp \
|
|
||||||
stringtableviewer.cpp \
|
|
||||||
rumblegraphviewer.cpp \
|
|
||||||
rumblefileviewer.cpp \
|
|
||||||
techsetviewer.cpp \
|
|
||||||
xtreewidget.cpp \
|
|
||||||
xtreewidgetitem.cpp \
|
|
||||||
zonefileviewer.cpp
|
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
aboutdialog.h \
|
|
||||||
d3dbsp_structs.h \
|
|
||||||
ddsviewer.h \
|
|
||||||
fastfileviewer.h \
|
|
||||||
imagewidget.h \
|
|
||||||
iwiviewer.h \
|
|
||||||
localstringviewer.h \
|
|
||||||
mainwindow.h \
|
|
||||||
materialviewer.h \
|
|
||||||
preferenceeditor.h \
|
|
||||||
soundviewer.h \
|
|
||||||
stringtableviewer.h \
|
|
||||||
rumblegraphviewer.h \
|
|
||||||
rumblefileviewer.h \
|
|
||||||
techsetviewer.h \
|
|
||||||
xtreewidget.h \
|
|
||||||
xtreewidgetitem.h \
|
|
||||||
zonefileviewer.h
|
|
||||||
|
|
||||||
FORMS += \
|
|
||||||
aboutdialog.ui \
|
|
||||||
ddsviewer.ui \
|
|
||||||
fastfileviewer.ui \
|
|
||||||
imagewidget.ui \
|
|
||||||
iwiviewer.ui \
|
|
||||||
localstringviewer.ui \
|
|
||||||
mainwindow.ui \
|
|
||||||
materialviewer.ui \
|
|
||||||
modelviewer.ui \
|
|
||||||
preferenceeditor.ui \
|
|
||||||
soundviewer.ui \
|
|
||||||
stringtableviewer.ui \
|
|
||||||
rumblegraphviewer.ui \
|
|
||||||
rumblefileviewer.ui \
|
|
||||||
techsetviewer.ui \
|
|
||||||
zonefileviewer.ui
|
|
||||||
|
|
||||||
RESOURCES += ../data/data.qrc
|
RESOURCES += ../data/data.qrc
|
||||||
|
|
||||||
@ -71,6 +17,7 @@ LIBS += \
|
|||||||
-L$$PWD/../third_party/zlib/lib/ -lzlib \
|
-L$$PWD/../third_party/zlib/lib/ -lzlib \
|
||||||
-L$$PWD/../third_party/xbox_sdk/lib -lxcompress64 \
|
-L$$PWD/../third_party/xbox_sdk/lib -lxcompress64 \
|
||||||
-L$$OUT_PWD/../libs/ -lcore \
|
-L$$OUT_PWD/../libs/ -lcore \
|
||||||
|
-L$$OUT_PWD/../libs/ -lxassets\
|
||||||
-L$$OUT_PWD/../libs/ -lcompression \
|
-L$$OUT_PWD/../libs/ -lcompression \
|
||||||
-L$$OUT_PWD/../libs/ -lencryption \
|
-L$$OUT_PWD/../libs/ -lencryption \
|
||||||
-L$$OUT_PWD/../libs/ -lfastfile \
|
-L$$OUT_PWD/../libs/ -lfastfile \
|
||||||
@ -90,6 +37,7 @@ INCLUDEPATH += \
|
|||||||
$$PWD/../libs/ddsfile \
|
$$PWD/../libs/ddsfile \
|
||||||
$$PWD/../libs/ipakfile \
|
$$PWD/../libs/ipakfile \
|
||||||
$$PWD/../libs/iwifile \
|
$$PWD/../libs/iwifile \
|
||||||
|
$$PWD/../libs/xassets \
|
||||||
$$PWD/../libs/zonefile
|
$$PWD/../libs/zonefile
|
||||||
|
|
||||||
DEPENDPATH += \
|
DEPENDPATH += \
|
||||||
@ -103,16 +51,11 @@ DEPENDPATH += \
|
|||||||
$$PWD/../libs/ddsfile \
|
$$PWD/../libs/ddsfile \
|
||||||
$$PWD/../libs/ipakfile \
|
$$PWD/../libs/ipakfile \
|
||||||
$$PWD/../libs/iwifile \
|
$$PWD/../libs/iwifile \
|
||||||
|
$$PWD/../libs/xassets \
|
||||||
$$PWD/../libs/zonefile
|
$$PWD/../libs/zonefile
|
||||||
|
|
||||||
# Copy DLLs to Debug folder
|
|
||||||
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/devil_sdk/lib\\*.dll\" \"$$OUT_PWD/debug/\" $$escape_expand(\\n\\t)
|
|
||||||
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/zlib/lib\\*.dll\" \"$$OUT_PWD/debug/\" $$escape_expand(\\n\\t)
|
|
||||||
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/xna/lib\\*.dll\" \"$$OUT_PWD/debug/\" $$escape_expand(\\n\\t)
|
|
||||||
QMAKE_POST_LINK += xcopy /Y /E /I \"$$PWD/../third_party/xbox_sdk/lib\\*.dll\" \"$$OUT_PWD/debug/\" $$escape_expand(\\n\\t)
|
|
||||||
|
|
||||||
# Copy DLLs to Release folder
|
win32 {
|
||||||
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/devil_sdk/lib\\*.dll\" \"$$OUT_PWD/release/\" $$escape_expand(\\n\\t)
|
QMAKE_POST_LINK =
|
||||||
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/zlib/lib\\*.dll\" \"$$OUT_PWD/release/\" $$escape_expand(\\n\\t)
|
QMAKE_POST_LINK += for /D %%G in (\"$$PWD/../third_party/*/lib\") do copy /Y \"%%~G\*.dll\" \"$$OUT_PWD/$$DESTDIR/\" >NUL $$escape_expand(\\n\\t)
|
||||||
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/xna/lib\\*.dll\" \"$$OUT_PWD/release/\" $$escape_expand(\\n\\t)
|
}
|
||||||
QMAKE_POST_LINK += xcopy /Y /E /I \"$$PWD/../third_party/xbox_sdk/lib\\*.dll\" \"$$OUT_PWD/release/\" $$escape_expand(\\n\\t)
|
|
||||||
|
|||||||
@ -14,8 +14,8 @@ DDSViewer::~DDSViewer() {
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DDSViewer::SetDDSFile(std::shared_ptr<DDSFile> aDDSFile) {
|
void DDSViewer::SetDDSFile(const DDSFile* aDDSFile) {
|
||||||
mDDSFile.swap(aDDSFile);
|
mDDSFile = aDDSFile;
|
||||||
|
|
||||||
ui->label_Title->setText(mDDSFile->fileStem + ".dds");
|
ui->label_Title->setText(mDDSFile->fileStem + ".dds");
|
||||||
|
|
||||||
|
|||||||
@ -16,14 +16,14 @@ public:
|
|||||||
explicit DDSViewer(QWidget *parent = nullptr);
|
explicit DDSViewer(QWidget *parent = nullptr);
|
||||||
~DDSViewer();
|
~DDSViewer();
|
||||||
|
|
||||||
void SetDDSFile(std::shared_ptr<DDSFile> aDDSFile);
|
void SetDDSFile(const DDSFile *aDDSFile);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void MipmapIndexChanged(int aMipmapIndex);
|
void MipmapIndexChanged(int aMipmapIndex);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::DDSViewer *ui;
|
Ui::DDSViewer *ui;
|
||||||
std::shared_ptr<DDSFile> mDDSFile;
|
const DDSFile* mDDSFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DDSVIEWER_H
|
#endif // DDSVIEWER_H
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "fastfileviewer.h"
|
#include "fastfileviewer.h"
|
||||||
#include "asset_structs.h"
|
|
||||||
#include "ui_fastfileviewer.h"
|
#include "ui_fastfileviewer.h"
|
||||||
|
|
||||||
FastFileViewer::FastFileViewer(QWidget *parent)
|
FastFileViewer::FastFileViewer(QWidget *parent)
|
||||||
@ -15,8 +14,8 @@ FastFileViewer::~FastFileViewer()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FastFileViewer::SetFastFile(std::shared_ptr<FastFile> aFastFile) {
|
void FastFileViewer::SetFastFile(const FastFile* aFastFile) {
|
||||||
mFastFile.swap(aFastFile);
|
mFastFile = aFastFile;
|
||||||
|
|
||||||
ui->label_Title->setText(mFastFile->GetStem());
|
ui->label_Title->setText(mFastFile->GetStem());
|
||||||
ui->comboBox_Company->setCurrentIndex(mFastFile->GetCompany());
|
ui->comboBox_Company->setCurrentIndex(mFastFile->GetCompany());
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
#ifndef FASTFILEVIEWER_H
|
#ifndef FASTFILEVIEWER_H
|
||||||
#define FASTFILEVIEWER_H
|
#define FASTFILEVIEWER_H
|
||||||
|
|
||||||
#include "asset_structs.h"
|
|
||||||
#include "fastfile.h"
|
#include "fastfile.h"
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
@ -17,10 +16,10 @@ public:
|
|||||||
explicit FastFileViewer(QWidget *parent = nullptr);
|
explicit FastFileViewer(QWidget *parent = nullptr);
|
||||||
~FastFileViewer();
|
~FastFileViewer();
|
||||||
|
|
||||||
void SetFastFile(std::shared_ptr<FastFile> aFastFile);
|
void SetFastFile(const FastFile *aFastFile);
|
||||||
private:
|
private:
|
||||||
Ui::FFViewer *ui;
|
Ui::FFViewer *ui;
|
||||||
std::shared_ptr<FastFile> mFastFile;
|
const FastFile* mFastFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FASTFILEVIEWER_H
|
#endif // FASTFILEVIEWER_H
|
||||||
|
|||||||
@ -13,16 +13,16 @@ ImageWidget::~ImageWidget()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageWidget::SetImage(std::shared_ptr<Image> aImage)
|
void ImageWidget::SetImage(std::shared_ptr<QImage> aImage)
|
||||||
{
|
{
|
||||||
mImage = aImage;
|
mImage = aImage;
|
||||||
|
|
||||||
ui->lineEdit_Name->setText(aImage->name);
|
//ui->lineEdit_Name->setText(aImage->name);
|
||||||
ui->lineEdit_Role->setText(aImage->materialName);
|
//ui->lineEdit_Role->setText(aImage->materialName);
|
||||||
ui->comboBox_Compression->setCurrentIndex(aImage->compression);
|
//ui->comboBox_Compression->setCurrentIndex(aImage->compression);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Image> ImageWidget::GetImage()
|
std::shared_ptr<QImage> ImageWidget::GetImage()
|
||||||
{
|
{
|
||||||
return mImage;
|
return mImage;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
#include "enums.h"
|
#include "enums.h"
|
||||||
#include "dds_structs.h"
|
#include "dds_structs.h"
|
||||||
#include "d3dbsp_structs.h"
|
#include "d3dbsp_structs.h"
|
||||||
#include "asset_structs.h"
|
|
||||||
#include "ipak_structs.h"
|
#include "ipak_structs.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
@ -21,11 +20,11 @@ public:
|
|||||||
explicit ImageWidget(QWidget *parent = nullptr);
|
explicit ImageWidget(QWidget *parent = nullptr);
|
||||||
~ImageWidget();
|
~ImageWidget();
|
||||||
|
|
||||||
void SetImage(std::shared_ptr<Image> aImage);
|
void SetImage(std::shared_ptr<QImage> aImage);
|
||||||
std::shared_ptr<Image> GetImage();
|
std::shared_ptr<QImage> GetImage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<Image> mImage;
|
std::shared_ptr<QImage> mImage;
|
||||||
Ui::ImageWidget *ui;
|
Ui::ImageWidget *ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -14,8 +14,8 @@ IWIViewer::~IWIViewer()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IWIViewer::SetIWIFile(std::shared_ptr<IWIFile> aIWIFile) {
|
void IWIViewer::SetIWIFile(const IWIFile* aIWIFile) {
|
||||||
mIWIFile.swap(aIWIFile);
|
mIWIFile = aIWIFile;
|
||||||
|
|
||||||
ui->label_Title->setText(mIWIFile->fileStem + ".iwi");
|
ui->label_Title->setText(mIWIFile->fileStem + ".iwi");
|
||||||
|
|
||||||
|
|||||||
@ -18,10 +18,10 @@ public:
|
|||||||
|
|
||||||
void MipmapIndexChanged(int aMipmapIndex);
|
void MipmapIndexChanged(int aMipmapIndex);
|
||||||
|
|
||||||
void SetIWIFile(std::shared_ptr<IWIFile> aIWIFile);
|
void SetIWIFile(const IWIFile *aIWIFile);
|
||||||
private:
|
private:
|
||||||
Ui::IWIViewer *ui;
|
Ui::IWIViewer *ui;
|
||||||
std::shared_ptr<IWIFile> mIWIFile;
|
const IWIFile* mIWIFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // IWIVIEWER_H
|
#endif // IWIVIEWER_H
|
||||||
|
|||||||
@ -37,26 +37,22 @@ void LocalStringViewer::SetFileNotes(const QString aFileNotes) {
|
|||||||
ui->plainTextEdit_FileNotes->setPlainText(mFileNotes);
|
ui->plainTextEdit_FileNotes->setPlainText(mFileNotes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalStringViewer::AddLocalString(LocalString aLocalString) {
|
void LocalStringViewer::AddLocalString(XLocalizeEntry aLocalString) {
|
||||||
mLocalStrings.append(aLocalString);
|
mLocalStrings.append(aLocalString);
|
||||||
|
ui->tableWidget_Strings->setRowCount(mLocalStrings.size());
|
||||||
ui->tableWidget_Strings->setRowCount(mLocalStrings.size());
|
ui->groupBox_LocalStrViewer->setTitle(QString("Entries (%1)").arg(mLocalStrings.size()));
|
||||||
|
QTableWidgetItem *aliasItem = new QTableWidgetItem(aLocalString.GetValue()->GetString());
|
||||||
ui->groupBox_LocalStrViewer->setTitle(QString("Entries (%1)").arg(mLocalStrings.size()));
|
QTableWidgetItem *stringItem = new QTableWidgetItem(aLocalString.GetName()->GetString());
|
||||||
|
ui->tableWidget_Strings->setItem(mLocalStrings.size() - 1, 0, aliasItem);
|
||||||
QTableWidgetItem *aliasItem = new QTableWidgetItem(aLocalString.alias);
|
ui->tableWidget_Strings->setItem(mLocalStrings.size() - 1, 1, stringItem);
|
||||||
QTableWidgetItem *stringItem = new QTableWidgetItem(aLocalString.string);
|
|
||||||
|
|
||||||
ui->tableWidget_Strings->setItem(mLocalStrings.size() - 1, 0, aliasItem);
|
|
||||||
ui->tableWidget_Strings->setItem(mLocalStrings.size() - 1, 1, stringItem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalStringViewer::SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile) {
|
void LocalStringViewer::SetZoneFile(const ZoneFile* aZoneFile) {
|
||||||
mLocalStrings.clear();
|
mLocalStrings.clear();
|
||||||
ui->tableWidget_Strings->clear();
|
ui->tableWidget_Strings->clear();
|
||||||
|
|
||||||
ui->label_Title->setText(aZoneFile->GetStem().section('.', 0, 0) + ".str");
|
ui->label_Title->setText(aZoneFile->GetStem().section('.', 0, 0) + ".str");
|
||||||
for (const LocalString &localStr : aZoneFile->GetAssetMap().localStrings) {
|
// for (const LocalString &localStr : aZoneFile->GetAssetMap().localStrings) {
|
||||||
AddLocalString(localStr);
|
// AddLocalString(localStr);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#ifndef LOCALSTRINGVIEWER_H
|
#ifndef LOCALSTRINGVIEWER_H
|
||||||
#define LOCALSTRINGVIEWER_H
|
#define LOCALSTRINGVIEWER_H
|
||||||
|
|
||||||
#include "asset_structs.h"
|
#include "xlocalizeentry.h"
|
||||||
#include "zonefile.h"
|
#include "zonefile.h"
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
@ -20,15 +20,15 @@ public:
|
|||||||
void SetVersion(quint32 aVersion);
|
void SetVersion(quint32 aVersion);
|
||||||
void SetConfigPath(const QString aConfigPath);
|
void SetConfigPath(const QString aConfigPath);
|
||||||
void SetFileNotes(const QString aFileNotes);
|
void SetFileNotes(const QString aFileNotes);
|
||||||
void AddLocalString(LocalString aLocalString);
|
void AddLocalString(XLocalizeEntry aLocalString);
|
||||||
void SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile);
|
void SetZoneFile(const ZoneFile *aZoneFile);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::LocalStringViewer *ui;
|
Ui::LocalStringViewer *ui;
|
||||||
quint32 mVersion;
|
quint32 mVersion;
|
||||||
QString mConfigPath;
|
QString mConfigPath;
|
||||||
QString mFileNotes;
|
QString mFileNotes;
|
||||||
QVector<LocalString> mLocalStrings;
|
QVector<XLocalizeEntry> mLocalStrings;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LOCALSTRINGVIEWER_H
|
#endif // LOCALSTRINGVIEWER_H
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
#include "aboutdialog.h"
|
#include "aboutdialog.h"
|
||||||
#include "fastfile.h"
|
#include "fastfile.h"
|
||||||
#include "highlighter_gsc.h"
|
#include "highlighter_gsc.h"
|
||||||
@ -7,12 +9,12 @@
|
|||||||
#include "highlighter_rumble.h"
|
#include "highlighter_rumble.h"
|
||||||
#include "materialviewer.h"
|
#include "materialviewer.h"
|
||||||
#include "preferenceeditor.h"
|
#include "preferenceeditor.h"
|
||||||
|
#include "reportissuedialog.h"
|
||||||
#include "rumblefileviewer.h"
|
#include "rumblefileviewer.h"
|
||||||
#include "rumblegraphviewer.h"
|
#include "rumblegraphviewer.h"
|
||||||
#include "soundviewer.h"
|
#include "soundviewer.h"
|
||||||
#include "stringtableviewer.h"
|
#include "stringtableviewer.h"
|
||||||
#include "techsetviewer.h"
|
#include "techsetviewer.h"
|
||||||
#include "ui_mainwindow.h"
|
|
||||||
#include "fastfile_factory.h"
|
#include "fastfile_factory.h"
|
||||||
#include "iwifile.h"
|
#include "iwifile.h"
|
||||||
#include "ddsfile.h"
|
#include "ddsfile.h"
|
||||||
@ -23,7 +25,6 @@
|
|||||||
#include "iwiviewer.h"
|
#include "iwiviewer.h"
|
||||||
#include "localstringviewer.h"
|
#include "localstringviewer.h"
|
||||||
#include "imagewidget.h"
|
#include "imagewidget.h"
|
||||||
#include "xtreewidget.h"
|
|
||||||
#include "zonefileviewer.h"
|
#include "zonefileviewer.h"
|
||||||
#include "techsetviewer.h"
|
#include "techsetviewer.h"
|
||||||
#include "logmanager.h"
|
#include "logmanager.h"
|
||||||
@ -39,7 +40,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
mTypeMap = QMap<QString, int>();
|
mTypeMap = QMap<QString, int>();
|
||||||
mTypeOrder = QStringList();
|
mTypeOrder = QStringList();
|
||||||
mRawFileMap = QMap<QString, QString>();
|
mRawFileMap = QMap<QString, QString>();
|
||||||
mImageMap = QMap<QString, Image>();
|
//mImageMap = QMap<QString, Image>();
|
||||||
mTreeMap = QMap<QString, QTreeWidgetItem *>();
|
mTreeMap = QMap<QString, QTreeWidgetItem *>();
|
||||||
mStrTableMap = QMap<QString, QVector<QPair<QString, QString>>>();
|
mStrTableMap = QMap<QString, QVector<QPair<QString, QString>>>();
|
||||||
mBSPVersion = 0;
|
mBSPVersion = 0;
|
||||||
@ -49,13 +50,23 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
mTreeWidget = new XTreeWidget(this);
|
mTreeWidget = new XTreeWidget(this);
|
||||||
mLogWidget = new QPlainTextEdit(this);
|
mLogWidget = new QPlainTextEdit(this);
|
||||||
|
|
||||||
//ModelViewer *mModelViewer = new ModelViewer(container);
|
|
||||||
//mModelViewer->setAcceptDrops(false);
|
|
||||||
|
|
||||||
mProgressBar = new QProgressBar(this);
|
mProgressBar = new QProgressBar(this);
|
||||||
mProgressBar->setMaximum(100); // Default max value
|
mProgressBar->setMaximum(100); // Default max value
|
||||||
mProgressBar->setVisible(false); // Initially hidden
|
mProgressBar->setVisible(false); // Initially hidden
|
||||||
|
|
||||||
|
connect(ui->actionRun_Tests, &QAction::triggered, this, [](bool checked) {
|
||||||
|
Q_UNUSED(checked);
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->actionReport_Issue, &QAction::triggered, this, [this](bool checked) {
|
||||||
|
Q_UNUSED(checked);
|
||||||
|
|
||||||
|
ReportIssueDialog issueDialog("https://git.redline.llc", "njohnson", "XPlor", "4738c4d2efd123efac1506c68c59b285c646df9f", this);
|
||||||
|
if (issueDialog.exec() == QDialog::Accepted) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
connect(&StatusBarManager::instance(), &StatusBarManager::statusUpdated,
|
connect(&StatusBarManager::instance(), &StatusBarManager::statusUpdated,
|
||||||
this, &MainWindow::HandleStatusUpdate);
|
this, &MainWindow::HandleStatusUpdate);
|
||||||
|
|
||||||
@ -148,7 +159,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
ui->tabWidget->clear();
|
ui->tabWidget->clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(mTreeWidget, &XTreeWidget::RawFileSelected, this, [this](std::shared_ptr<RawFile> rawFile, const QString aParentName) {
|
connect(mTreeWidget, &XTreeWidget::RawFileSelected, this, [this](const XRawFile* rawFile, const QString aParentName) {
|
||||||
QTabWidget *rawTabWidget = new QTabWidget(this);
|
QTabWidget *rawTabWidget = new QTabWidget(this);
|
||||||
rawTabWidget->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
rawTabWidget->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||||
|
|
||||||
@ -157,13 +168,13 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
scriptEditor->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
scriptEditor->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||||
scriptEditor->setFont(QFont("Consolas"));
|
scriptEditor->setFont(QFont("Consolas"));
|
||||||
|
|
||||||
if (rawFile->contents.isEmpty()) {
|
// if (rawFile->contents.isEmpty()) {
|
||||||
scriptEditor->setPlainText("EMPTY");
|
// scriptEditor->setPlainText("EMPTY");
|
||||||
} else {
|
// } else {
|
||||||
scriptEditor->setPlainText(rawFile->contents);
|
// scriptEditor->setPlainText(rawFile->contents);
|
||||||
}
|
// }
|
||||||
|
|
||||||
QString fileStem = rawFile->path.split('/').last();
|
QString fileStem;// = rawFile->path.split('/').last();
|
||||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||||
if (ui->tabWidget->tabText(i) == fileStem) {
|
if (ui->tabWidget->tabText(i) == fileStem) {
|
||||||
delete scriptEditor;
|
delete scriptEditor;
|
||||||
@ -175,7 +186,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
QFontMetrics metrics(scriptEditor->font());
|
QFontMetrics metrics(scriptEditor->font());
|
||||||
scriptEditor->setTabStopDistance(tabStopSpaces * metrics.horizontalAdvance(' '));
|
scriptEditor->setTabStopDistance(tabStopSpaces * metrics.horizontalAdvance(' '));
|
||||||
|
|
||||||
QSyntaxHighlighter *highlighter;
|
QSyntaxHighlighter *highlighter = nullptr;
|
||||||
if (fileStem.contains(".gsc")) {
|
if (fileStem.contains(".gsc")) {
|
||||||
highlighter = new Highlighter_GSC(scriptEditor->document());
|
highlighter = new Highlighter_GSC(scriptEditor->document());
|
||||||
} else if (fileStem.contains(".cfg")) {
|
} else if (fileStem.contains(".cfg")) {
|
||||||
@ -191,12 +202,12 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
rawTabWidget->addTab(scriptEditor, "Text Editor");
|
rawTabWidget->addTab(scriptEditor, "Text Editor");
|
||||||
|
|
||||||
ui->tabWidget->addTab(rawTabWidget, fileStem);
|
ui->tabWidget->addTab(rawTabWidget, fileStem);
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_RUMBLE));
|
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(ASSET_TYPE_RUMBLE));
|
||||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||||
return;
|
return;
|
||||||
} else if (fileStem.contains(".shock")) {
|
} else if (fileStem.contains(".shock")) {
|
||||||
highlighter = new Highlighter_Shock(scriptEditor->document());
|
highlighter = new Highlighter_Shock(scriptEditor->document());
|
||||||
} else if (rawFile->contents.left(6) == "RUMBLE") {
|
} /*else if (rawFile->contents.left(6) == "RUMBLE") {
|
||||||
RumbleFileViewer *rmbFileViewer = new RumbleFileViewer(this);
|
RumbleFileViewer *rmbFileViewer = new RumbleFileViewer(this);
|
||||||
rmbFileViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
rmbFileViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||||
rmbFileViewer->SetRumbleFile(rawFile);
|
rmbFileViewer->SetRumbleFile(rawFile);
|
||||||
@ -205,59 +216,61 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
rawTabWidget->addTab(scriptEditor, "Text Editor");
|
rawTabWidget->addTab(scriptEditor, "Text Editor");
|
||||||
|
|
||||||
ui->tabWidget->addTab(rawTabWidget, fileStem);
|
ui->tabWidget->addTab(rawTabWidget, fileStem);
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_RUMBLE));
|
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(ASSET_TYPE_RUMBLE));
|
||||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||||
return;
|
return;
|
||||||
|
}*/ else {
|
||||||
|
delete highlighter;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->tabWidget->addTab(scriptEditor, fileStem);
|
ui->tabWidget->addTab(scriptEditor, fileStem);
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_RAW_FILE));
|
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(ASSET_TYPE_RAWFILE));
|
||||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(mTreeWidget, &XTreeWidget::ImageSelected, this, [this](std::shared_ptr<Image> image, const QString aParentName) {
|
// connect(mTreeWidget, &XTreeWidget::ImageSelected, this, [this](std::shared_ptr<Image> image, const QString aParentName) {
|
||||||
ImageWidget *mImageWidget = new ImageWidget(this);
|
// ImageWidget *mImageWidget = new ImageWidget(this);
|
||||||
mImageWidget->setAcceptDrops(false);
|
// mImageWidget->setAcceptDrops(false);
|
||||||
mImageWidget->SetImage(image);
|
// mImageWidget->SetImage(image);
|
||||||
mImageWidget->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
// mImageWidget->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||||
|
|
||||||
QString fileStem = image->materialName;
|
// QString fileStem = image->materialName;
|
||||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
// for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||||
if (ui->tabWidget->tabText(i) == fileStem) {
|
// if (ui->tabWidget->tabText(i) == fileStem) {
|
||||||
delete mImageWidget;
|
// delete mImageWidget;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
ui->tabWidget->addTab(mImageWidget, fileStem);
|
// ui->tabWidget->addTab(mImageWidget, fileStem);
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_IMAGE));
|
// ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(ASSET_TYPE_IMAGE));
|
||||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
// ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||||
});
|
// });
|
||||||
|
|
||||||
connect(mTreeWidget, &XTreeWidget::MenuSelected, this, [](std::shared_ptr<Menu> menu, const QString aParentName) {
|
// connect(mTreeWidget, &XTreeWidget::MenuSelected, this, [](std::shared_ptr<Menu> menu, const QString aParentName) {
|
||||||
Q_UNUSED(menu);
|
// Q_UNUSED(menu);
|
||||||
});
|
// });
|
||||||
|
|
||||||
connect(mTreeWidget, &XTreeWidget::MaterialSelected, this, [this](std::shared_ptr<Material> material, const QString aParentName) {
|
connect(mTreeWidget, &XTreeWidget::MaterialSelected, this, [this](const XMaterial* material, const QString aParentName) {
|
||||||
MaterialViewer *matViewer = new MaterialViewer(this);
|
MaterialViewer *matViewer = new MaterialViewer(this);
|
||||||
matViewer->setAcceptDrops(false);
|
matViewer->setAcceptDrops(false);
|
||||||
matViewer->SetMaterial(material);
|
matViewer->SetMaterial(material);
|
||||||
matViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
matViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||||
|
|
||||||
QString fileStem = material->name;
|
// QString fileStem = material->name;
|
||||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
// for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||||
if (ui->tabWidget->tabText(i) == fileStem) {
|
// if (ui->tabWidget->tabText(i) == fileStem) {
|
||||||
delete matViewer;
|
// delete matViewer;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
ui->tabWidget->addTab(matViewer, fileStem);
|
//ui->tabWidget->addTab(matViewer, fileStem);
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_MATERIAL));
|
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(ASSET_TYPE_MATERIAL));
|
||||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(mTreeWidget, &XTreeWidget::DDSFileSelected, this, [this](std::shared_ptr<DDSFile> ddsFile, const QString aParentName) {
|
connect(mTreeWidget, &XTreeWidget::DDSFileSelected, this, [this](const DDSFile* ddsFile, const QString aParentName) {
|
||||||
DDSViewer *ddsViewer = new DDSViewer(this);
|
DDSViewer *ddsViewer = new DDSViewer(this);
|
||||||
ddsViewer->setAcceptDrops(false);
|
ddsViewer->setAcceptDrops(false);
|
||||||
ddsViewer->SetDDSFile(ddsFile);
|
ddsViewer->SetDDSFile(ddsFile);
|
||||||
@ -272,11 +285,11 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui->tabWidget->addTab(ddsViewer, fileStem);
|
ui->tabWidget->addTab(ddsViewer, fileStem);
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_IMAGE));
|
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(ASSET_TYPE_IMAGE));
|
||||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(mTreeWidget, &XTreeWidget::IWIFileSelected, this, [this](std::shared_ptr<IWIFile> iwiFile, const QString aParentName) {
|
connect(mTreeWidget, &XTreeWidget::IWIFileSelected, this, [this](const IWIFile* iwiFile, const QString aParentName) {
|
||||||
IWIViewer *iwiViewer = new IWIViewer(this);
|
IWIViewer *iwiViewer = new IWIViewer(this);
|
||||||
iwiViewer->setAcceptDrops(false);
|
iwiViewer->setAcceptDrops(false);
|
||||||
iwiViewer->SetIWIFile(iwiFile);
|
iwiViewer->SetIWIFile(iwiFile);
|
||||||
@ -291,11 +304,11 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui->tabWidget->addTab(iwiViewer, fileStem);
|
ui->tabWidget->addTab(iwiViewer, fileStem);
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_IMAGE));
|
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(ASSET_TYPE_IMAGE));
|
||||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(mTreeWidget, &XTreeWidget::FastFileSelected, this, [this](std::shared_ptr<FastFile> aFastFile, const QString aParentName) {
|
connect(mTreeWidget, &XTreeWidget::FastFileSelected, this, [this](const FastFile* aFastFile, const QString aParentName) {
|
||||||
FastFileViewer *fastFileViewer = new FastFileViewer(this);
|
FastFileViewer *fastFileViewer = new FastFileViewer(this);
|
||||||
fastFileViewer->setAcceptDrops(false);
|
fastFileViewer->setAcceptDrops(false);
|
||||||
fastFileViewer->SetFastFile(aFastFile);
|
fastFileViewer->SetFastFile(aFastFile);
|
||||||
@ -310,11 +323,11 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui->tabWidget->addTab(fastFileViewer, fileStem);
|
ui->tabWidget->addTab(fastFileViewer, fileStem);
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_FAST_FILE));
|
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon("FF"));
|
||||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(mTreeWidget, &XTreeWidget::ZoneFileSelected, this, [this](std::shared_ptr<ZoneFile> aZoneFile, const QString aParentName) {
|
connect(mTreeWidget, &XTreeWidget::ZoneFileSelected, this, [this](const ZoneFile* aZoneFile, const QString aParentName) {
|
||||||
ZoneFileViewer *zoneFileViewer = new ZoneFileViewer(this);
|
ZoneFileViewer *zoneFileViewer = new ZoneFileViewer(this);
|
||||||
zoneFileViewer->setAcceptDrops(false);
|
zoneFileViewer->setAcceptDrops(false);
|
||||||
zoneFileViewer->SetZoneFile(aZoneFile);
|
zoneFileViewer->SetZoneFile(aZoneFile);
|
||||||
@ -341,11 +354,11 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
scrollArea->setWidget(containerWidget);
|
scrollArea->setWidget(containerWidget);
|
||||||
|
|
||||||
ui->tabWidget->addTab(scrollArea, fileStem);
|
ui->tabWidget->addTab(scrollArea, fileStem);
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_ZONE_FILE));
|
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon("ZF"));
|
||||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(mTreeWidget, &XTreeWidget::LocalStringSelected, this, [this](std::shared_ptr<ZoneFile> aZoneFile, const QString aParentName) {
|
connect(mTreeWidget, &XTreeWidget::LocalStringSelected, this, [this](const ZoneFile* aZoneFile, const QString aParentName) {
|
||||||
LocalStringViewer *localStrViewer = new LocalStringViewer(this);
|
LocalStringViewer *localStrViewer = new LocalStringViewer(this);
|
||||||
localStrViewer->setAcceptDrops(false);
|
localStrViewer->setAcceptDrops(false);
|
||||||
localStrViewer->SetZoneFile(aZoneFile);
|
localStrViewer->SetZoneFile(aZoneFile);
|
||||||
@ -360,17 +373,17 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui->tabWidget->addTab(localStrViewer, fileStem);
|
ui->tabWidget->addTab(localStrViewer, fileStem);
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_LOCAL_STRING));
|
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(ASSET_TYPE_LOCALIZE_ENTRY));
|
||||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(mTreeWidget, &XTreeWidget::TechSetSelected, this, [this](std::shared_ptr<TechSet> aTechSet, const QString aParentName) {
|
connect(mTreeWidget, &XTreeWidget::TechSetSelected, this, [this](const XMaterialTechniqueSet* aTechSet, const QString aParentName) {
|
||||||
TechSetViewer *techSetViewer = new TechSetViewer(this);
|
TechSetViewer *techSetViewer = new TechSetViewer(this);
|
||||||
techSetViewer->setAcceptDrops(false);
|
techSetViewer->setAcceptDrops(false);
|
||||||
techSetViewer->SetTechSet(aTechSet);
|
techSetViewer->SetTechSet(aTechSet);
|
||||||
techSetViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
techSetViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||||
|
|
||||||
QString fileStem = aTechSet->name;
|
QString fileStem = aTechSet->GetName();
|
||||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||||
if (ui->tabWidget->tabText(i) == fileStem) {
|
if (ui->tabWidget->tabText(i) == fileStem) {
|
||||||
delete techSetViewer;
|
delete techSetViewer;
|
||||||
@ -378,18 +391,18 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->tabWidget->addTab(techSetViewer, aTechSet->name);
|
ui->tabWidget->addTab(techSetViewer, aTechSet->GetName());
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_TECH_SET));
|
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(ASSET_TYPE_TECHNIQUE_SET));
|
||||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(mTreeWidget, &XTreeWidget::StrTableSelected, this, [this](std::shared_ptr<StringTable> aStrTable, const QString aParentName) {
|
connect(mTreeWidget, &XTreeWidget::StrTableSelected, this, [this](const XStringTable* aStrTable, const QString aParentName) {
|
||||||
StringTableViewer *strTableViewer = new StringTableViewer(this);
|
StringTableViewer *strTableViewer = new StringTableViewer(this);
|
||||||
strTableViewer->setAcceptDrops(false);
|
strTableViewer->setAcceptDrops(false);
|
||||||
strTableViewer->SetStringTable(aStrTable);
|
strTableViewer->SetStringTable(aStrTable);
|
||||||
strTableViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
strTableViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||||
|
|
||||||
QString fileStem = aStrTable->name;
|
QString fileStem = aStrTable->GetName()->GetString();
|
||||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||||
if (ui->tabWidget->tabText(i) == fileStem) {
|
if (ui->tabWidget->tabText(i) == fileStem) {
|
||||||
delete strTableViewer;
|
delete strTableViewer;
|
||||||
@ -398,28 +411,28 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui->tabWidget->addTab(strTableViewer, fileStem);
|
ui->tabWidget->addTab(strTableViewer, fileStem);
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_STRING_TABLE));
|
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(ASSET_TYPE_STRINGTABLE));
|
||||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(mTreeWidget, &XTreeWidget::SoundSelected, this, [this](std::shared_ptr<Sound> aSound, const QString aParentName) {
|
// connect(mTreeWidget, &XTreeWidget::SoundSelected, this, [this](std::shared_ptr<Sound> aSound, const QString aParentName) {
|
||||||
SoundViewer *soundViewer = new SoundViewer(this);
|
// SoundViewer *soundViewer = new SoundViewer(this);
|
||||||
soundViewer->setAcceptDrops(false);
|
// soundViewer->setAcceptDrops(false);
|
||||||
soundViewer->SetSound(aSound);
|
// soundViewer->SetSound(aSound);
|
||||||
soundViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
// soundViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||||
|
|
||||||
QString fileStem = aSound->path.split('/').last();
|
// QString fileStem = aSound->path.split('/').last();
|
||||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
// for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||||
if (ui->tabWidget->tabText(i) == fileStem) {
|
// if (ui->tabWidget->tabText(i) == fileStem) {
|
||||||
delete soundViewer;
|
// delete soundViewer;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
ui->tabWidget->addTab(soundViewer, fileStem);
|
// ui->tabWidget->addTab(soundViewer, fileStem);
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_SOUND));
|
// ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(ASSET_TYPE_SOUND));
|
||||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
// ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||||
});
|
// });
|
||||||
|
|
||||||
connect(mTreeWidget, &XTreeWidget::ItemSelected, this, [this](const QString itemText) {
|
connect(mTreeWidget, &XTreeWidget::ItemSelected, this, [this](const QString itemText) {
|
||||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||||
@ -520,7 +533,7 @@ bool MainWindow::OpenFastFile(const QString aFastFilePath) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<FastFile> fastFile = FastFileFactory::Create(aFastFilePath);
|
FastFile* fastFile = FastFileFactory::Create(aFastFilePath);
|
||||||
fastFile->SetStem(fastFileStem);
|
fastFile->SetStem(fastFileStem);
|
||||||
mTreeWidget->AddFastFile(fastFile);
|
mTreeWidget->AddFastFile(fastFile);
|
||||||
|
|
||||||
@ -535,8 +548,17 @@ bool MainWindow::OpenFastFile(const QString aFastFilePath) {
|
|||||||
and opens the selected file.
|
and opens the selected file.
|
||||||
*/
|
*/
|
||||||
bool MainWindow::OpenFastFile() {
|
bool MainWindow::OpenFastFile() {
|
||||||
const QString fastFileName = Utils::GetOpenFastFileName();
|
// Open file dialog to steam apps
|
||||||
if (!OpenFastFile(fastFileName)) {
|
const QString steamPath = "C:/Program Files (x86)/Steam/steamapps/common/Call of Duty World at War/zone/english/";
|
||||||
|
const QString fastFilePath = QFileDialog::getOpenFileName(this, "Open Fast File", steamPath, "Fast File (*.ff);;All Files (*.*)");
|
||||||
|
if (fastFilePath.isNull()) {
|
||||||
|
// User pressed cancel
|
||||||
|
return false;
|
||||||
|
} else if (!QFile::exists(fastFilePath)) {
|
||||||
|
QMessageBox::warning(this, "Warning!", QString("%1 does not exist!.").arg(fastFilePath));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!OpenFastFile(fastFilePath)) {
|
||||||
qDebug() << "Failed to open Fast file!";
|
qDebug() << "Failed to open Fast file!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -553,19 +575,25 @@ bool MainWindow::OpenZoneFile(const QString aZoneFilePath, bool fromFF) {
|
|||||||
Q_UNUSED(aZoneFilePath);
|
Q_UNUSED(aZoneFilePath);
|
||||||
Q_UNUSED(fromFF);
|
Q_UNUSED(fromFF);
|
||||||
|
|
||||||
//ZoneFile zoneFile;
|
// ZoneFile* zoneFile = ZoneFile::Create();
|
||||||
//if (!zoneFile.Load(aZoneFilePath)) {
|
// if (!zoneFile.Load(aZoneFilePath)) {
|
||||||
// qDebug() << "Error: Failed to load zone file!";
|
// qDebug() << "Error: Failed to load zone file!";
|
||||||
// return false;
|
// return false;
|
||||||
//}
|
// }
|
||||||
//mTreeWidget->AddZoneFile(std::make_shared<ZoneFile>(zoneFile));
|
// mTreeWidget->AddZoneFile(std::make_shared<ZoneFile>(zoneFile));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::OpenZoneFile() {
|
bool MainWindow::OpenZoneFile() {
|
||||||
const QString zoneFileName = Utils::GetOpenZoneFileName();
|
// Open file dialog to steam apps
|
||||||
if (!OpenZoneFile(zoneFileName)) {
|
const QString steamPath = "C:/Program Files (x86)/Steam/steamapps/common/Call of Duty World at War/zone/english/";
|
||||||
|
const QString zoneFilePath = QFileDialog::getOpenFileName(this, "Open Zone File", steamPath, "Zone File (*.zone);;All Files (*.*)");
|
||||||
|
if (zoneFilePath.isNull()) {
|
||||||
|
// User pressed cancel
|
||||||
|
return false;
|
||||||
|
} else if (!QFile::exists(zoneFilePath)) {
|
||||||
|
QMessageBox::warning(this, "Warning!", QString("%1 does not exist!.").arg(zoneFilePath));
|
||||||
qDebug() << "Failed to open Zone file!";
|
qDebug() << "Failed to open Zone file!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -637,7 +665,7 @@ quint32 DXT3 = 0x33545844; // 'DXT3'
|
|||||||
quint32 DXT5 = 0x35545844; // 'DXT5'
|
quint32 DXT5 = 0x35545844; // 'DXT5'
|
||||||
|
|
||||||
int MainWindow::LoadFile_IWI(const QString aFilePath) {
|
int MainWindow::LoadFile_IWI(const QString aFilePath) {
|
||||||
mTreeWidget->AddIWIFile(std::make_shared<IWIFile>(aFilePath));
|
mTreeWidget->AddIWIFile(new IWIFile(aFilePath));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -648,7 +676,7 @@ int MainWindow::LoadFile_DDSFiles(const QStringList aFilePaths) {
|
|||||||
qDebug() << "Error: Invalid filename " << filePath;
|
qDebug() << "Error: Invalid filename " << filePath;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
mTreeWidget->AddDDSFile(std::make_shared<DDSFile>(filePath));
|
mTreeWidget->AddDDSFile(new DDSFile(filePath));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -680,7 +708,7 @@ int MainWindow::LoadFile_DDS(const QString aFilePath) {
|
|||||||
qDebug() << "Error: Invalid filename " << aFilePath;
|
qDebug() << "Error: Invalid filename " << aFilePath;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
mTreeWidget->AddDDSFile(std::make_shared<DDSFile>(aFilePath));
|
mTreeWidget->AddDDSFile(new DDSFile(aFilePath));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
#include "d3dbsp_structs.h"
|
#include "d3dbsp_structs.h"
|
||||||
#include "asset_structs.h"
|
|
||||||
#include "xtreewidget.h"
|
#include "xtreewidget.h"
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
@ -64,7 +63,7 @@ private:
|
|||||||
quint32 mTagCount;
|
quint32 mTagCount;
|
||||||
quint32 mRecordCount;
|
quint32 mRecordCount;
|
||||||
QMap<QString, QString> mRawFileMap;
|
QMap<QString, QString> mRawFileMap;
|
||||||
QMap<QString, Image> mImageMap;
|
//QMap<QString, Image> mImageMap;
|
||||||
QMap<QString, QTreeWidgetItem*> mTreeMap;
|
QMap<QString, QTreeWidgetItem*> mTreeMap;
|
||||||
QMap<QString, QVector<QPair<QString, QString>>> mStrTableMap;
|
QMap<QString, QVector<QPair<QString, QString>>> mStrTableMap;
|
||||||
XTreeWidget *mTreeWidget;
|
XTreeWidget *mTreeWidget;
|
||||||
|
|||||||
@ -50,7 +50,7 @@
|
|||||||
<height>21</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="MenuDef">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>File</string>
|
<string>File</string>
|
||||||
</property>
|
</property>
|
||||||
@ -117,9 +117,17 @@
|
|||||||
</property>
|
</property>
|
||||||
<addaction name="actionAbout"/>
|
<addaction name="actionAbout"/>
|
||||||
<addaction name="actionCheck_for_Updates"/>
|
<addaction name="actionCheck_for_Updates"/>
|
||||||
|
<addaction name="actionReport_Issue"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<widget class="QMenu" name="menuTools">
|
||||||
|
<property name="title">
|
||||||
|
<string>Tools</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionRun_Tests"/>
|
||||||
|
</widget>
|
||||||
|
<addaction name="MenuDef"/>
|
||||||
<addaction name="menuEdit"/>
|
<addaction name="menuEdit"/>
|
||||||
|
<addaction name="menuTools"/>
|
||||||
<addaction name="menuHelp"/>
|
<addaction name="menuHelp"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="toolBar">
|
<widget class="QToolBar" name="toolBar">
|
||||||
@ -353,6 +361,16 @@
|
|||||||
<string>Preferences...</string>
|
<string>Preferences...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionReport_Issue">
|
||||||
|
<property name="text">
|
||||||
|
<string>Report Issue</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionRun_Tests">
|
||||||
|
<property name="text">
|
||||||
|
<string>Run Tests</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../data/data.qrc"/>
|
<include location="../data/data.qrc"/>
|
||||||
|
|||||||
@ -15,21 +15,21 @@ QString ToHexStr(quint32 in) {
|
|||||||
return QString("%1").arg(in, 8, 16, QChar('0')).toUpper();
|
return QString("%1").arg(in, 8, 16, QChar('0')).toUpper();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaterialViewer::SetMaterial(std::shared_ptr<Material> aMaterial) {
|
void MaterialViewer::SetMaterial(const XMaterial* aMaterial) {
|
||||||
ui->lineEdit_NamePtr->setText(ToHexStr(aMaterial->namePtr));
|
// ui->lineEdit_NamePtr->setText(ToHexStr(aMaterial->namePtr));
|
||||||
ui->lineEdit_Name->setText(aMaterial->name);
|
// ui->lineEdit_Name->setText(aMaterial->name);
|
||||||
ui->lineEdit_RefPtr->setText(ToHexStr(aMaterial->refNamePtr));
|
// ui->lineEdit_RefPtr->setText(ToHexStr(aMaterial->refNamePtr));
|
||||||
ui->lineEdit_RefName->setText(aMaterial->refName);
|
// ui->lineEdit_RefName->setText(aMaterial->refName);
|
||||||
QString unknownStr = "";
|
// QString unknownStr = "";
|
||||||
foreach (quint32 unknownPtr, aMaterial->pointers) {
|
// foreach (quint32 unknownPtr, aMaterial->pointers) {
|
||||||
unknownStr += ToHexStr(unknownPtr) + "\n";
|
// unknownStr += ToHexStr(unknownPtr) + "\n";
|
||||||
}
|
// }
|
||||||
ui->lineEdit_Unknowns->setText(unknownStr);
|
// ui->lineEdit_Unknowns->setText(unknownStr);
|
||||||
ui->lineEdit_StateA->setText(ToHexStr(aMaterial->stateBits[0]));
|
// ui->lineEdit_StateA->setText(ToHexStr(aMaterial->stateBits[0]));
|
||||||
ui->lineEdit_StateA->setText(ToHexStr(aMaterial->stateBits[1]));
|
// ui->lineEdit_StateA->setText(ToHexStr(aMaterial->stateBits[1]));
|
||||||
ui->spinBox_TextureCount->setValue(aMaterial->textureCount);
|
// ui->spinBox_TextureCount->setValue(aMaterial->textureCount);
|
||||||
ui->spinBox_ConstCount->setValue(aMaterial->constCount);
|
// ui->spinBox_ConstCount->setValue(aMaterial->constCount);
|
||||||
ui->lineEdit_TechSetPtr->setText(ToHexStr(aMaterial->techSetPtr));
|
// ui->lineEdit_TechSetPtr->setText(ToHexStr(aMaterial->techSetPtr));
|
||||||
ui->lineEdit_TexturePtr->setText(ToHexStr(aMaterial->texturePtr));
|
// ui->lineEdit_TexturePtr->setText(ToHexStr(aMaterial->texturePtr));
|
||||||
ui->lineEdit_ConstantPtr->setText(ToHexStr(aMaterial->constPtr));
|
// ui->lineEdit_ConstantPtr->setText(ToHexStr(aMaterial->constPtr));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#ifndef MATERIALVIEWER_H
|
#ifndef MATERIALVIEWER_H
|
||||||
#define MATERIALVIEWER_H
|
#define MATERIALVIEWER_H
|
||||||
|
|
||||||
#include "asset_structs.h"
|
#include "xmaterial.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
@ -18,7 +18,7 @@ public:
|
|||||||
explicit MaterialViewer(QWidget *parent = nullptr);
|
explicit MaterialViewer(QWidget *parent = nullptr);
|
||||||
~MaterialViewer();
|
~MaterialViewer();
|
||||||
|
|
||||||
void SetMaterial(std::shared_ptr<Material> aMaterial);
|
void SetMaterial(const XMaterial *aMaterial);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MaterialViewer *ui;
|
Ui::MaterialViewer *ui;
|
||||||
|
|||||||
@ -18,41 +18,41 @@ RumbleFileViewer::~RumbleFileViewer() {
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RumbleFileViewer::SetRumbleFile(std::shared_ptr<RawFile> aRumbleFile) {
|
void RumbleFileViewer::SetRumbleFile(XRawFile *aRumbleFile) {
|
||||||
mRumbleFile = aRumbleFile;
|
mRumbleFile = aRumbleFile;
|
||||||
|
|
||||||
ui->tableWidget_Properties->clear();
|
ui->tableWidget_Properties->clear();
|
||||||
|
|
||||||
const QString magic = aRumbleFile->contents.left(6);
|
// const QString magic = aRumbleFile->contents.left(6);
|
||||||
if (magic != "RUMBLE") {
|
// if (magic != "RUMBLE") {
|
||||||
qDebug() << "Rumble file has invalid magic: " << magic;
|
// qDebug() << "Rumble file has invalid magic: " << magic;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
int firstIndex = 0;
|
// int firstIndex = 0;
|
||||||
int secondIndex = 0;
|
// int secondIndex = 0;
|
||||||
int thirdIndex = 0;
|
// int thirdIndex = 0;
|
||||||
|
|
||||||
int startIndex = 0;
|
// int startIndex = 0;
|
||||||
for (int i = 0; i < aRumbleFile->contents.count("\\") / 2; i++) {
|
// for (int i = 0; i < aRumbleFile->contents.count("\\") / 2; i++) {
|
||||||
ui->tableWidget_Properties->setRowCount(i + 1);
|
// ui->tableWidget_Properties->setRowCount(i + 1);
|
||||||
ui->spinBox_Entries->setValue(i + 1);
|
// ui->spinBox_Entries->setValue(i + 1);
|
||||||
|
|
||||||
firstIndex = aRumbleFile->contents.indexOf("\\", startIndex);
|
// firstIndex = aRumbleFile->contents.indexOf("\\", startIndex);
|
||||||
secondIndex = aRumbleFile->contents.indexOf("\\", firstIndex + 1);
|
// secondIndex = aRumbleFile->contents.indexOf("\\", firstIndex + 1);
|
||||||
thirdIndex = aRumbleFile->contents.indexOf("\\", secondIndex + 1);
|
// thirdIndex = aRumbleFile->contents.indexOf("\\", secondIndex + 1);
|
||||||
if (thirdIndex == -1) {
|
// if (thirdIndex == -1) {
|
||||||
thirdIndex = aRumbleFile->contents.size();
|
// thirdIndex = aRumbleFile->contents.size();
|
||||||
}
|
// }
|
||||||
|
|
||||||
const QString keyStr = aRumbleFile->contents.mid(firstIndex + 1, secondIndex - firstIndex - 1);
|
// const QString keyStr = aRumbleFile->contents.mid(firstIndex + 1, secondIndex - firstIndex - 1);
|
||||||
QTableWidgetItem *keyItem = new QTableWidgetItem(keyStr);
|
// QTableWidgetItem *keyItem = new QTableWidgetItem(keyStr);
|
||||||
ui->tableWidget_Properties->setItem(i, 0, keyItem);
|
// ui->tableWidget_Properties->setItem(i, 0, keyItem);
|
||||||
|
|
||||||
const QString valStr = aRumbleFile->contents.mid(secondIndex + 1, thirdIndex - secondIndex - 1);
|
// const QString valStr = aRumbleFile->contents.mid(secondIndex + 1, thirdIndex - secondIndex - 1);
|
||||||
QTableWidgetItem *valueItem = new QTableWidgetItem(valStr);
|
// QTableWidgetItem *valueItem = new QTableWidgetItem(valStr);
|
||||||
ui->tableWidget_Properties->setItem(i, 1, valueItem);
|
// ui->tableWidget_Properties->setItem(i, 1, valueItem);
|
||||||
|
|
||||||
startIndex = thirdIndex;
|
// startIndex = thirdIndex;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#ifndef RUMBLEFILEVIEWER_H
|
#ifndef RUMBLEFILEVIEWER_H
|
||||||
#define RUMBLEFILEVIEWER_H
|
#define RUMBLEFILEVIEWER_H
|
||||||
|
|
||||||
#include "asset_structs.h"
|
#include "xrawfile.h"
|
||||||
#include "zonefile.h"
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@ -17,12 +17,12 @@ public:
|
|||||||
explicit RumbleFileViewer(QWidget *parent = nullptr);
|
explicit RumbleFileViewer(QWidget *parent = nullptr);
|
||||||
~RumbleFileViewer();
|
~RumbleFileViewer();
|
||||||
|
|
||||||
void SetRumbleFile(std::shared_ptr<RawFile> aRumbleFile);
|
void SetRumbleFile(XRawFile* aRumbleFile);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::RumbleFileViewer *ui;
|
Ui::RumbleFileViewer *ui;
|
||||||
quint32 mPropertyCount;
|
quint32 mPropertyCount;
|
||||||
std::shared_ptr<RawFile> mRumbleFile;
|
XRawFile* mRumbleFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RUMBLEFILEVIEWER_H
|
#endif // RUMBLEFILEVIEWER_H
|
||||||
|
|||||||
@ -19,10 +19,10 @@ RumbleGraphViewer::~RumbleGraphViewer() {
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RumbleGraphViewer::SetRumbleGraphFile(const std::shared_ptr<RawFile> aRawFile) {
|
void RumbleGraphViewer::SetRumbleGraphFile(const XRawFile* aRawFile) {
|
||||||
mRumbleGraphFile = aRawFile;
|
mRumbleGraphFile = aRawFile;
|
||||||
|
|
||||||
QDataStream rawFileStream(mRumbleGraphFile->contents.toLatin1());
|
QDataStream rawFileStream;//(mRumbleGraphFile->contents.toLatin1());
|
||||||
|
|
||||||
QByteArray magic(15, Qt::Uninitialized);
|
QByteArray magic(15, Qt::Uninitialized);
|
||||||
rawFileStream.readRawData(magic.data(), 15);
|
rawFileStream.readRawData(magic.data(), 15);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#ifndef RUMBLEGRAPHVIEWER_H
|
#ifndef RUMBLEGRAPHVIEWER_H
|
||||||
#define RUMBLEGRAPHVIEWER_H
|
#define RUMBLEGRAPHVIEWER_H
|
||||||
|
|
||||||
#include "asset_structs.h"
|
#include "xrawfile.h"
|
||||||
#include "zonefile.h"
|
#include "zonefile.h"
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
@ -18,13 +18,13 @@ public:
|
|||||||
~RumbleGraphViewer();
|
~RumbleGraphViewer();
|
||||||
|
|
||||||
void SetEntryCount(quint32 aCount);
|
void SetEntryCount(quint32 aCount);
|
||||||
void SetRumbleGraphFile(const std::shared_ptr<RawFile> aRawFile);
|
void SetRumbleGraphFile(const XRawFile *aRawFile);
|
||||||
void SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile);
|
void SetZoneFile(ZoneFile* aZoneFile);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::RumbleGraphViewer *ui;
|
Ui::RumbleGraphViewer *ui;
|
||||||
quint32 mEntryCount;
|
quint32 mEntryCount;
|
||||||
std::shared_ptr<RawFile> mRumbleGraphFile;
|
const XRawFile* mRumbleGraphFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RUMBLEGRAPHVIEWER_H
|
#endif // RUMBLEGRAPHVIEWER_H
|
||||||
|
|||||||
@ -61,17 +61,17 @@ SoundViewer::~SoundViewer()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundViewer::SetSound(std::shared_ptr<Sound> aSound)
|
// void SoundViewer::SetSound(std::shared_ptr<Sound> aSound)
|
||||||
{
|
// {
|
||||||
buffer->setData(aSound->data);
|
// buffer->setData(aSound->data);
|
||||||
if (!buffer->open(QIODevice::ReadOnly)) {
|
// if (!buffer->open(QIODevice::ReadOnly)) {
|
||||||
qWarning() << "Failed to open QBuffer.";
|
// qWarning() << "Failed to open QBuffer.";
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
ui->groupBox->setTitle(aSound->path);
|
// ui->groupBox->setTitle(aSound->path);
|
||||||
player->setSourceDevice(buffer);
|
// player->setSourceDevice(buffer);
|
||||||
}
|
// }
|
||||||
|
|
||||||
void SoundViewer::SetOutput(QAudioOutput *aOutput) {
|
void SoundViewer::SetOutput(QAudioOutput *aOutput) {
|
||||||
if (!aOutput) { return; }
|
if (!aOutput) { return; }
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
#ifndef SOUNDVIEWER_H
|
#ifndef SOUNDVIEWER_H
|
||||||
#define SOUNDVIEWER_H
|
#define SOUNDVIEWER_H
|
||||||
|
|
||||||
#include "asset_structs.h"
|
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QMediaPlayer>
|
#include <QMediaPlayer>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
@ -22,7 +20,7 @@ public:
|
|||||||
explicit SoundViewer(QWidget *parent = nullptr);
|
explicit SoundViewer(QWidget *parent = nullptr);
|
||||||
~SoundViewer();
|
~SoundViewer();
|
||||||
|
|
||||||
void SetSound(std::shared_ptr<Sound> aSound);
|
//void SetSound(std::shared_ptr<Sound> aSound);
|
||||||
|
|
||||||
void SetOutput(QAudioOutput *aOutput);
|
void SetOutput(QAudioOutput *aOutput);
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -13,22 +13,21 @@ StringTableViewer::~StringTableViewer()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringTableViewer::SetStringTable(std::shared_ptr<StringTable> aStringTable) {
|
void StringTableViewer::SetStringTable(const XStringTable *aStringTable) {
|
||||||
ui->tableWidget_Strings->clear();
|
ui->tableWidget_Strings->clear();
|
||||||
|
|
||||||
ui->tableWidget_Strings->setRowCount(aStringTable->rowCount);
|
ui->tableWidget_Strings->setRowCount(aStringTable->GetRowCount());
|
||||||
ui->tableWidget_Strings->setColumnCount(aStringTable->columnCount);
|
ui->tableWidget_Strings->setColumnCount(aStringTable->GetColumnCount());
|
||||||
|
|
||||||
int currentIndex = 0;
|
int currentIndex = 0;
|
||||||
for (const QString &key : aStringTable->content.keys()) {
|
for (auto value : *aStringTable->GetValues()) {
|
||||||
const QString value = aStringTable->content[key];
|
|
||||||
|
|
||||||
QTableWidgetItem *tableKeyItem = new QTableWidgetItem();
|
QTableWidgetItem *tableKeyItem = new QTableWidgetItem();
|
||||||
tableKeyItem->setText(key);
|
tableKeyItem->setText(value->GetName());
|
||||||
ui->tableWidget_Strings->setItem(currentIndex, 0, tableKeyItem);
|
ui->tableWidget_Strings->setItem(currentIndex, 0, tableKeyItem);
|
||||||
|
|
||||||
QTableWidgetItem *tableValItem = new QTableWidgetItem();
|
QTableWidgetItem *tableValItem = new QTableWidgetItem();
|
||||||
tableValItem->setText(value);
|
tableValItem->setText(value->GetString());
|
||||||
ui->tableWidget_Strings->setItem(currentIndex, 1, tableValItem);
|
ui->tableWidget_Strings->setItem(currentIndex, 1, tableValItem);
|
||||||
|
|
||||||
currentIndex++;
|
currentIndex++;
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
#ifndef STRINGTABLEVIEWER_H
|
#ifndef STRINGTABLEVIEWER_H
|
||||||
#define STRINGTABLEVIEWER_H
|
#define STRINGTABLEVIEWER_H
|
||||||
|
|
||||||
#include "asset_structs.h"
|
#include "xstringtable.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@ -16,7 +17,7 @@ public:
|
|||||||
explicit StringTableViewer(QWidget *parent = nullptr);
|
explicit StringTableViewer(QWidget *parent = nullptr);
|
||||||
~StringTableViewer();
|
~StringTableViewer();
|
||||||
|
|
||||||
void SetStringTable(std::shared_ptr<StringTable> aStringTable);
|
void SetStringTable(const XStringTable *aStringTable);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::StringTableViewer *ui;
|
Ui::StringTableViewer *ui;
|
||||||
|
|||||||
@ -13,13 +13,13 @@ TechSetViewer::~TechSetViewer()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TechSetViewer::SetTechSet(std::shared_ptr<TechSet> aTechSet) {
|
void TechSetViewer::SetTechSet(const XMaterialTechniqueSet* aTechSet) {
|
||||||
ui->listWidget_Ptrs->clear();
|
//ui->listWidget_Ptrs->clear();
|
||||||
ui->label_Title->setText(aTechSet->name);
|
ui->label_Title->setText(aTechSet->GetName());
|
||||||
|
|
||||||
int ptrIndex = 1;
|
// int ptrIndex = 1;
|
||||||
for (auto ptr : aTechSet->pointers) {
|
//for (auto ptr : aTechSet->pointers) {
|
||||||
ui->listWidget_Ptrs->addItem(QString("Pointer %1: %2").arg(ptrIndex).arg(ptr));
|
// ui->listWidget_Ptrs->addItem(QString("Pointer %1: %2").arg(ptrIndex).arg(ptr));
|
||||||
ptrIndex++;
|
// ptrIndex++;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
#ifndef TECHSETVIEWER_H
|
#ifndef TECHSETVIEWER_H
|
||||||
#define TECHSETVIEWER_H
|
#define TECHSETVIEWER_H
|
||||||
|
|
||||||
#include "asset_structs.h"
|
#include "xmaterialtechniqueset.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@ -16,7 +17,7 @@ public:
|
|||||||
explicit TechSetViewer(QWidget *parent = nullptr);
|
explicit TechSetViewer(QWidget *parent = nullptr);
|
||||||
~TechSetViewer();
|
~TechSetViewer();
|
||||||
|
|
||||||
void SetTechSet(std::shared_ptr<TechSet> aTechSet);
|
void SetTechSet(const XMaterialTechniqueSet *aTechSet);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::TechSetViewer *ui;
|
Ui::TechSetViewer *ui;
|
||||||
|
|||||||
@ -6,14 +6,14 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>961</width>
|
<width>880</width>
|
||||||
<height>756</height>
|
<height>559</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_Title">
|
<widget class="QLabel" name="label_Title">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@ -29,47 +29,121 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Unknown Pointers:</string>
|
<string>Set Parameters</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListWidget" name="listWidget_Ptrs"/>
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Name:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_Name">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Technique set name</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>World Vertex Format:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox_WorldVertFormat"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listWidget_Techniques"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="orientation">
|
<property name="title">
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
<string>Current Technique</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<size>
|
<item>
|
||||||
<width>40</width>
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<height>20</height>
|
<item>
|
||||||
</size>
|
<widget class="QLabel" name="label_4">
|
||||||
</property>
|
<property name="text">
|
||||||
</spacer>
|
<string>Name:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_TechniqueName">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Technique set name</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Flags:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox_Flags"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Pass Count:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox_PassCount"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Material Pass</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>363</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
|
|
||||||
XTreeWidget::XTreeWidget(QWidget *parent)
|
XTreeWidget::XTreeWidget(QWidget *parent)
|
||||||
: QTreeWidget(parent) {
|
: QTreeWidget(parent) {
|
||||||
mFastFiles = QMap<QString, std::shared_ptr<FastFile>>();
|
mFastFiles = QMap<QString, const FastFile*>();
|
||||||
mZoneFiles = QMap<QString, std::shared_ptr<ZoneFile>>();
|
mZoneFiles = QMap<QString, const ZoneFile*>();
|
||||||
mDDSFiles = QMap<QString, std::shared_ptr<DDSFile>>();
|
mDDSFiles = QMap<QString, const DDSFile*>();
|
||||||
mIWIFiles = QMap<QString, std::shared_ptr<IWIFile>>();
|
mIWIFiles = QMap<QString, const IWIFile*>();
|
||||||
|
|
||||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
setSelectionMode(QTreeWidget::SingleSelection);
|
setSelectionMode(QTreeWidget::SingleSelection);
|
||||||
@ -37,7 +37,7 @@ XTreeWidget::~XTreeWidget() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XTreeWidget::AddFastFile(std::shared_ptr<FastFile> aFastFile) {
|
void XTreeWidget::AddFastFile(FastFile* aFastFile) {
|
||||||
XTreeWidgetItem *fastFileItem = new XTreeWidgetItem(this);
|
XTreeWidgetItem *fastFileItem = new XTreeWidgetItem(this);
|
||||||
fastFileItem->setText(0, aFastFile->GetStem());
|
fastFileItem->setText(0, aFastFile->GetStem());
|
||||||
fastFileItem->setIcon(0, Utils::CreateAssetIcon("FF"));
|
fastFileItem->setIcon(0, Utils::CreateAssetIcon("FF"));
|
||||||
@ -83,211 +83,189 @@ void XTreeWidget::AddFastFile(std::shared_ptr<FastFile> aFastFile) {
|
|||||||
sortByColumn(0, Qt::AscendingOrder);
|
sortByColumn(0, Qt::AscendingOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XTreeWidget::AddZoneFile(std::shared_ptr<ZoneFile> aZoneFile, XTreeWidgetItem *aParentItem) {
|
void XTreeWidget::AddZoneFile(const ZoneFile* aZoneFile, XTreeWidgetItem *aParentItem) {
|
||||||
XTreeWidgetItem *zoneItem;
|
XTreeWidgetItem *zoneItem;
|
||||||
if (aParentItem != nullptr) {
|
if (aParentItem != nullptr) {
|
||||||
zoneItem = new XTreeWidgetItem(aParentItem);
|
zoneItem = new XTreeWidgetItem(aParentItem);
|
||||||
} else {
|
} else {
|
||||||
zoneItem = new XTreeWidgetItem(this);
|
zoneItem = new XTreeWidgetItem(this);
|
||||||
}
|
}
|
||||||
zoneItem->setIcon(0, ZoneFile::AssetTypeToIcon(ASSET_ZONE_FILE));
|
zoneItem->setIcon(0, Utils::CreateAssetIcon("ZF"));
|
||||||
zoneItem->setText(0, aZoneFile->GetBaseStem() + ".zone");
|
zoneItem->setText(0, aZoneFile->GetBaseStem() + ".zone");
|
||||||
|
|
||||||
auto assetMap = aZoneFile->GetAssetMap();
|
XAssetList assetList = aZoneFile->GetAssetList();
|
||||||
|
QVector<XAsset*> localizeEntries;
|
||||||
if (!assetMap.localStrings.isEmpty()) {
|
for (int i = 0; i < assetList.Size(); i++)
|
||||||
QIcon localStrIcon = ZoneFile::AssetTypeToIcon(ASSET_LOCAL_STRING);
|
{
|
||||||
|
XAsset *currentAsset = assetList.GetAsset(i);
|
||||||
XTreeWidgetItem *localStrRoot = new XTreeWidgetItem(zoneItem);
|
if (currentAsset->GetType() == ASSET_TYPE_LOCALIZE_ENTRY)
|
||||||
localStrRoot->setText(0, "String Files");
|
{
|
||||||
localStrRoot->setIcon(0, localStrIcon);
|
localizeEntries.append(currentAsset);
|
||||||
localStrRoot->SetCategory(CATEGORY_TYPE);
|
} else if (currentAsset->GetType() == ASSET_TYPE_LOCALIZE_ENTRY)
|
||||||
|
{
|
||||||
XTreeWidgetItem *localStrItem = new XTreeWidgetItem(localStrRoot);
|
localizeEntries.append(currentAsset);
|
||||||
localStrItem->setText(0, aZoneFile->GetStem().section('.', 0, 0) + ".str");
|
|
||||||
localStrItem->setIcon(0, localStrIcon);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!assetMap.techSets.isEmpty()) {
|
|
||||||
QIcon techSetIcon = ZoneFile::AssetTypeToIcon(ASSET_TECH_SET);
|
|
||||||
|
|
||||||
XTreeWidgetItem *techSetRoot = new XTreeWidgetItem(zoneItem);
|
|
||||||
techSetRoot->setText(0, "Tech Sets");
|
|
||||||
techSetRoot->setIcon(0, techSetIcon);
|
|
||||||
techSetRoot->SetCategory(CATEGORY_TYPE);
|
|
||||||
|
|
||||||
for (TechSet techSet : assetMap.techSets) {
|
|
||||||
XTreeWidgetItem *techSetItem = new XTreeWidgetItem(techSetRoot);
|
|
||||||
techSetItem->setText(0, techSet.name);
|
|
||||||
techSetItem->setIcon(0, techSetIcon);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!assetMap.rawFiles.isEmpty()) {
|
|
||||||
QIcon rawFileIcon = ZoneFile::AssetTypeToIcon(ASSET_RAW_FILE);
|
|
||||||
|
|
||||||
XTreeWidgetItem *rawFileRoot = new XTreeWidgetItem(zoneItem);
|
// if (!assetMap.localizeEntries.isEmpty()) {
|
||||||
rawFileRoot->setText(0, "Raw Files");
|
// QIcon localStrIcon = Utils::CreateAssetIcon(ASSET_TYPE_LOCALIZE_ENTRY);
|
||||||
rawFileRoot->setIcon(0, rawFileIcon);
|
|
||||||
rawFileRoot->SetCategory(CATEGORY_TYPE);
|
|
||||||
for (RawFile rawFile : assetMap.rawFiles) {
|
|
||||||
if (!rawFile.length) { continue; }
|
|
||||||
|
|
||||||
XTreeWidgetItem *tempItem = rawFileRoot;
|
// XTreeWidgetItem *localStrRoot = new XTreeWidgetItem(zoneItem);
|
||||||
const QStringList pathParts = rawFile.path.split('/');
|
// localStrRoot->setText(0, "String Files");
|
||||||
for (const QString &pathPart : pathParts) {
|
// localStrRoot->setIcon(0, localStrIcon);
|
||||||
bool childFound = false;
|
// localStrRoot->SetCategory(CATEGORY_TYPE);
|
||||||
for (int i = 0; i < tempItem->childCount(); i++) {
|
|
||||||
QTreeWidgetItem *rawChildItem = tempItem->child(i);
|
|
||||||
XTreeWidgetItem *childItem = dynamic_cast<XTreeWidgetItem*>(rawChildItem);
|
|
||||||
if (childItem->text(0) == pathPart) {
|
|
||||||
tempItem = childItem;
|
|
||||||
|
|
||||||
childFound = true;
|
// XTreeWidgetItem *localStrItem = new XTreeWidgetItem(localStrRoot);
|
||||||
break;
|
// localStrItem->setText(0, aZoneFile->GetStem().section('.', 0, 0) + ".str");
|
||||||
}
|
// localStrItem->setIcon(0, localStrIcon);
|
||||||
}
|
// }
|
||||||
|
|
||||||
const QString rawFileStr = QString("%1 [%2-%3]").arg(pathPart).arg(rawFile.startPos).arg(rawFile.endPos);
|
// if (!assetMap.techSets.isEmpty()) {
|
||||||
//rawFileStr = pathPart;
|
// QIcon techSetIcon = Utils::CreateAssetIcon(ASSET_TYPE_TECHNIQUE_SET);
|
||||||
if (pathPart == pathParts.last()) {
|
|
||||||
XTreeWidgetItem *rawFileItem = new XTreeWidgetItem(tempItem);
|
|
||||||
rawFileItem->setText(0, rawFileStr);
|
|
||||||
|
|
||||||
tempItem = rawFileItem;
|
// XTreeWidgetItem *techSetRoot = new XTreeWidgetItem(zoneItem);
|
||||||
} else if (!childFound) {
|
// techSetRoot->setText(0, "Tech Sets");
|
||||||
tempItem = new XTreeWidgetItem(tempItem);
|
// techSetRoot->setIcon(0, techSetIcon);
|
||||||
tempItem->setText(0, rawFileStr);
|
// techSetRoot->SetCategory(CATEGORY_TYPE);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
// for (auto techSet : assetMap.techSets) {
|
||||||
tempItem->setIcon(0, rawFileIcon);
|
// XTreeWidgetItem *techSetItem = new XTreeWidgetItem(techSetRoot);
|
||||||
}
|
// techSetItem->setText(0, techSet.name);
|
||||||
}
|
// techSetItem->setIcon(0, techSetIcon);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
if (!assetMap.menuFiles.isEmpty()) {
|
// if (!assetMap.rawFiles.isEmpty()) {
|
||||||
QIcon menuFileIcon = ZoneFile::AssetTypeToIcon(ASSET_MENU);
|
// QIcon rawFileIcon = Utils::CreateAssetIcon(ASSET_TYPE_RAWFILE);
|
||||||
|
|
||||||
XTreeWidgetItem *menuRoot = new XTreeWidgetItem(zoneItem);
|
// XTreeWidgetItem *rawFileRoot = new XTreeWidgetItem(zoneItem);
|
||||||
menuRoot->setText(0, "Menu Files");
|
// rawFileRoot->setText(0, "Raw Files");
|
||||||
menuRoot->setIcon(0, menuFileIcon);
|
// rawFileRoot->setIcon(0, rawFileIcon);
|
||||||
menuRoot->SetCategory(CATEGORY_TYPE);
|
// rawFileRoot->SetCategory(CATEGORY_TYPE);
|
||||||
|
// for (auto rawFile : assetMap.rawFiles) {
|
||||||
|
// if (!rawFile.length) { continue; }
|
||||||
|
|
||||||
int menuIndex = 1;
|
// XTreeWidgetItem *tempItem = rawFileRoot;
|
||||||
for (MenuFile menuFile : assetMap.menuFiles) {
|
// // const QStringList pathParts = rawFile->path.split('/');
|
||||||
XTreeWidgetItem *menuFileRoot = new XTreeWidgetItem(menuRoot);
|
// // for (const QString &pathPart : pathParts) {
|
||||||
menuFileRoot->setText(0, QString("Menu %1").arg(menuIndex));
|
// // bool childFound = false;
|
||||||
for (Menu menu : menuFile.menuDefs) {
|
// // for (int i = 0; i < tempItem->childCount(); i++) {
|
||||||
XTreeWidgetItem *menuItem = new XTreeWidgetItem(menuFileRoot);
|
// // QTreeWidgetItem *rawChildItem = tempItem->child(i);
|
||||||
menuItem->setText(0, menu.filePath);
|
// // XTreeWidgetItem *childItem = dynamic_cast<XTreeWidgetItem*>(rawChildItem);
|
||||||
menuItem->setIcon(0, menuFileIcon);
|
// // if (childItem->text(0) == pathPart) {
|
||||||
}
|
// // tempItem = childItem;
|
||||||
menuIndex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!assetMap.images.isEmpty()) {
|
// // childFound = true;
|
||||||
QIcon imageIcon = ZoneFile::AssetTypeToIcon(ASSET_IMAGE);
|
// // break;
|
||||||
|
// // }
|
||||||
|
// // }
|
||||||
|
|
||||||
XTreeWidgetItem *imageRoot = new XTreeWidgetItem(zoneItem);
|
// // const QString rawFileStr = pathPart;// = QString("%1 [%2-%3]").arg(pathPart).arg(rawFile.startPos).arg(rawFile.endPos);
|
||||||
imageRoot->setText(0, "Images");
|
// // if (pathPart == pathParts.last()) {
|
||||||
imageRoot->setIcon(0, imageIcon);
|
// // XTreeWidgetItem *rawFileItem = new XTreeWidgetItem(tempItem);
|
||||||
imageRoot->SetCategory(CATEGORY_TYPE);
|
// // rawFileItem->setText(0, rawFileStr);
|
||||||
|
|
||||||
for (Image image : assetMap.images) {
|
// // tempItem = rawFileItem;
|
||||||
XTreeWidgetItem *imageItem = new XTreeWidgetItem(imageRoot);
|
// // } else if (!childFound) {
|
||||||
imageItem->setText(0, image.materialName);
|
// // tempItem = new XTreeWidgetItem(tempItem);
|
||||||
imageItem->setIcon(0, imageIcon);
|
// // tempItem->setText(0, rawFileStr);
|
||||||
}
|
// // }
|
||||||
}
|
|
||||||
|
|
||||||
if (!assetMap.models.isEmpty()) {
|
// // }
|
||||||
QIcon modelIcon = ZoneFile::AssetTypeToIcon(ASSET_MODEL);
|
// tempItem->setIcon(0, rawFileIcon);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
XTreeWidgetItem *modelsRoot = new XTreeWidgetItem(zoneItem);
|
// if (!assetMap.menuDefinitions.isEmpty()) {
|
||||||
modelsRoot->setText(0, "Models");
|
// // QIcon MenuDefIcon = Utils::CreateAssetIcon(ASSET_TYPE_MENU);
|
||||||
modelsRoot->setIcon(0, modelIcon);
|
|
||||||
modelsRoot->SetCategory(CATEGORY_TYPE);
|
|
||||||
|
|
||||||
for (Model model: assetMap.models) {
|
// // XTreeWidgetItem *menuRoot = new XTreeWidgetItem(zoneItem);
|
||||||
XTreeWidgetItem *modelItem = new XTreeWidgetItem(modelsRoot);
|
// // menuRoot->setText(0, "Menu Files");
|
||||||
modelItem->setText(0, model.modelName);
|
// // menuRoot->setIcon(0, MenuDefIcon);
|
||||||
modelItem->setIcon(0, modelIcon);
|
// // menuRoot->SetCategory(CATEGORY_TYPE);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!assetMap.materials.isEmpty()) {
|
// // int menuIndex = 1;
|
||||||
QIcon materialIcon = ZoneFile::AssetTypeToIcon(ASSET_MATERIAL);
|
// // for (MenuDef menuDef : assetMap.menuDefinitions) {
|
||||||
|
// // XTreeWidgetItem *MenuDefRoot = new XTreeWidgetItem(menuRoot);
|
||||||
|
// // MenuDefRoot->setText(0, QString("Menu %1").arg(menuIndex));
|
||||||
|
// // for (Menu menu : menuDef.men) {
|
||||||
|
// // XTreeWidgetItem *menuItem = new XTreeWidgetItem(MenuDefRoot);
|
||||||
|
// // menuItem->setText(0, menu.filePath);
|
||||||
|
// // menuItem->setIcon(0, MenuDefIcon);
|
||||||
|
// // }
|
||||||
|
// // menuIndex++;
|
||||||
|
// // }
|
||||||
|
// }
|
||||||
|
|
||||||
XTreeWidgetItem *materialsRoot = new XTreeWidgetItem(zoneItem);
|
// if (!assetMap.images.isEmpty()) {
|
||||||
materialsRoot->setText(0, "Materials");
|
// // QIcon imageIcon = Utils::CreateAssetIcon(ASSET_TYPE_IMAGE);
|
||||||
materialsRoot->setIcon(0, materialIcon);
|
|
||||||
materialsRoot->SetCategory(CATEGORY_TYPE);
|
|
||||||
|
|
||||||
for (Material material: assetMap.materials) {
|
// // XTreeWidgetItem *imageRoot = new XTreeWidgetItem(zoneItem);
|
||||||
XTreeWidgetItem *materialItem = new XTreeWidgetItem(materialsRoot);
|
// // imageRoot->setText(0, "Images");
|
||||||
materialItem->setText(0, material.name);
|
// // imageRoot->setIcon(0, imageIcon);
|
||||||
materialItem->setIcon(0, materialIcon);
|
// // imageRoot->SetCategory(CATEGORY_TYPE);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!assetMap.stringTables.isEmpty()) {
|
// // for (Image image : assetMap.images) {
|
||||||
QIcon stringTableIcon = ZoneFile::AssetTypeToIcon(ASSET_STRING_TABLE);
|
// // XTreeWidgetItem *imageItem = new XTreeWidgetItem(imageRoot);
|
||||||
|
// // imageItem->setText(0, image.materialName);
|
||||||
|
// // imageItem->setIcon(0, imageIcon);
|
||||||
|
// // }
|
||||||
|
// }
|
||||||
|
|
||||||
XTreeWidgetItem *strTableRoot = new XTreeWidgetItem(zoneItem);
|
// if (!assetMap.models.isEmpty()) {
|
||||||
strTableRoot->setText(0, "String Tables");
|
// QIcon modelIcon = Utils::CreateAssetIcon(ASSET_TYPE_XMODEL);
|
||||||
strTableRoot->setIcon(0, stringTableIcon);
|
|
||||||
strTableRoot->SetCategory(CATEGORY_TYPE);
|
|
||||||
|
|
||||||
for (StringTable strTable: assetMap.stringTables) {
|
// XTreeWidgetItem *modelsRoot = new XTreeWidgetItem(zoneItem);
|
||||||
XTreeWidgetItem *modelItem = new XTreeWidgetItem(strTableRoot);
|
// modelsRoot->setText(0, "Models");
|
||||||
modelItem->setText(0, strTable.name);
|
// modelsRoot->setIcon(0, modelIcon);
|
||||||
modelItem->setIcon(0, stringTableIcon);
|
// modelsRoot->SetCategory(CATEGORY_TYPE);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!assetMap.sounds.isEmpty()) {
|
// for (auto model: assetMap.models) {
|
||||||
QIcon soundIcon = ZoneFile::AssetTypeToIcon(ASSET_SOUND);
|
// XTreeWidgetItem *modelItem = new XTreeWidgetItem(modelsRoot);
|
||||||
|
// modelItem->setText(0, model.name);
|
||||||
|
// modelItem->setIcon(0, modelIcon);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
XTreeWidgetItem *soundsRoot = new XTreeWidgetItem(zoneItem);
|
// if (!assetMap.materials.isEmpty()) {
|
||||||
soundsRoot->setText(0, "Sounds");
|
// QIcon materialIcon = Utils::CreateAssetIcon(ASSET_TYPE_MATERIAL);
|
||||||
soundsRoot->setIcon(0, soundIcon);
|
|
||||||
soundsRoot->SetCategory(CATEGORY_TYPE);
|
|
||||||
for (SoundAsset soundAsset : assetMap.sounds) {
|
|
||||||
for (Sound sound : soundAsset.sounds) {
|
|
||||||
XTreeWidgetItem *tempItem = soundsRoot;
|
|
||||||
|
|
||||||
if (!sound.dataLength) { continue; }
|
// XTreeWidgetItem *materialsRoot = new XTreeWidgetItem(zoneItem);
|
||||||
|
// materialsRoot->setText(0, "Materials");
|
||||||
|
// materialsRoot->setIcon(0, materialIcon);
|
||||||
|
// materialsRoot->SetCategory(CATEGORY_TYPE);
|
||||||
|
|
||||||
for (const QString &pathPart : sound.path.split('/')) {
|
// for (auto material: assetMap.materials) {
|
||||||
if (pathPart.isEmpty()) { continue; }
|
// XTreeWidgetItem *materialItem = new XTreeWidgetItem(materialsRoot);
|
||||||
|
// //materialItem->setText(0, material.name);
|
||||||
|
// materialItem->setIcon(0, materialIcon);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
bool childFound = false;
|
// if (!assetMap.stringTables.isEmpty()) {
|
||||||
for (int i = 0; i < tempItem->childCount(); i++) {
|
// QIcon stringTableIcon = Utils::CreateAssetIcon(ASSET_TYPE_STRINGTABLE);
|
||||||
XTreeWidgetItem *childItem = dynamic_cast<XTreeWidgetItem*>(tempItem->child(i));
|
|
||||||
if (childItem->text(0) == pathPart) {
|
|
||||||
tempItem = childItem;
|
|
||||||
|
|
||||||
childFound = true;
|
// XTreeWidgetItem *strTableRoot = new XTreeWidgetItem(zoneItem);
|
||||||
break;
|
// strTableRoot->setText(0, "String Tables");
|
||||||
}
|
// strTableRoot->setIcon(0, stringTableIcon);
|
||||||
}
|
// strTableRoot->SetCategory(CATEGORY_TYPE);
|
||||||
|
|
||||||
if (pathPart.contains(".wav")) {
|
// for (auto strTable: assetMap.stringTables) {
|
||||||
XTreeWidgetItem *soundItem = new XTreeWidgetItem(tempItem);
|
// XTreeWidgetItem *modelItem = new XTreeWidgetItem(strTableRoot);
|
||||||
soundItem->setText(0, pathPart);
|
// modelItem->setText(0, strTable.name);
|
||||||
|
// modelItem->setIcon(0, stringTableIcon);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
tempItem = soundItem;
|
// if (!assetMap.sounds.isEmpty()) {
|
||||||
} else if (!childFound) {
|
// QIcon soundIcon = Utils::CreateAssetIcon(ASSET_TYPE_SOUND);
|
||||||
tempItem = new XTreeWidgetItem(tempItem);
|
|
||||||
tempItem->setText(0, pathPart);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
// XTreeWidgetItem *soundsRoot = new XTreeWidgetItem(zoneItem);
|
||||||
tempItem->setIcon(0, soundIcon);
|
// soundsRoot->setText(0, "Sounds");
|
||||||
}
|
// soundsRoot->setIcon(0, soundIcon);
|
||||||
}
|
// soundsRoot->SetCategory(CATEGORY_TYPE);
|
||||||
}
|
// }
|
||||||
|
|
||||||
mZoneFiles[aZoneFile->GetBaseStem() + ".zone"] = aZoneFile;
|
mZoneFiles[aZoneFile->GetBaseStem() + ".zone"] = aZoneFile;
|
||||||
}
|
}
|
||||||
@ -324,7 +302,7 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
|||||||
QMenu *exportSubmenu = new QMenu("Export...", this);
|
QMenu *exportSubmenu = new QMenu("Export...", this);
|
||||||
contextMenu->addMenu(exportSubmenu);
|
contextMenu->addMenu(exportSubmenu);
|
||||||
|
|
||||||
std::shared_ptr<DDSFile> ddsFile = mDDSFiles[fileStem];
|
const DDSFile* ddsFile = mDDSFiles[fileStem];
|
||||||
|
|
||||||
QAction *exportIWIAction = new QAction("Export as IWI");
|
QAction *exportIWIAction = new QAction("Export as IWI");
|
||||||
exportSubmenu->addAction(exportIWIAction);
|
exportSubmenu->addAction(exportIWIAction);
|
||||||
@ -368,7 +346,7 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
|||||||
QMenu *exportSubmenu = new QMenu("Export...", this);
|
QMenu *exportSubmenu = new QMenu("Export...", this);
|
||||||
contextMenu->addMenu(exportSubmenu);
|
contextMenu->addMenu(exportSubmenu);
|
||||||
|
|
||||||
std::shared_ptr<IWIFile> iwiFile = mIWIFiles[fileStem];
|
const IWIFile* iwiFile = mIWIFiles[fileStem];
|
||||||
|
|
||||||
QAction *exportDDSAction = new QAction("Export as DDS");
|
QAction *exportDDSAction = new QAction("Export as DDS");
|
||||||
exportSubmenu->addAction(exportDDSAction);
|
exportSubmenu->addAction(exportDDSAction);
|
||||||
@ -497,7 +475,7 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
|||||||
QMenu *exportSubmenu = new QMenu("Export...", this);
|
QMenu *exportSubmenu = new QMenu("Export...", this);
|
||||||
contextMenu->addMenu(exportSubmenu);
|
contextMenu->addMenu(exportSubmenu);
|
||||||
|
|
||||||
std::shared_ptr<FastFile> fastFile = mFastFiles[fileStem];
|
const FastFile* fastFile = mFastFiles[fileStem];
|
||||||
|
|
||||||
QAction *exportFastFileAction = new QAction("Export Fast File");
|
QAction *exportFastFileAction = new QAction("Export Fast File");
|
||||||
exportSubmenu->addAction(exportFastFileAction);
|
exportSubmenu->addAction(exportFastFileAction);
|
||||||
@ -518,7 +496,7 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
|||||||
const QString zoneFilePath = QFileDialog::getSaveFileName(
|
const QString zoneFilePath = QFileDialog::getSaveFileName(
|
||||||
nullptr, "Export Zone File...", QDir::currentPath(),
|
nullptr, "Export Zone File...", QDir::currentPath(),
|
||||||
"Zone File (*.zone);;All Files(*.*)");
|
"Zone File (*.zone);;All Files(*.*)");
|
||||||
fastFile->GetZoneFile()->SaveZoneFile(zoneFilePath);
|
//fastFile->GetZoneFile()->SaveZoneFile(zoneFilePath);
|
||||||
});
|
});
|
||||||
} else if (activeText.contains(".zone")) {
|
} else if (activeText.contains(".zone")) {
|
||||||
const QString fileStem = activeText;
|
const QString fileStem = activeText;
|
||||||
@ -530,7 +508,7 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
|||||||
QMenu *exportSubmenu = new QMenu("Export...", this);
|
QMenu *exportSubmenu = new QMenu("Export...", this);
|
||||||
contextMenu->addMenu(exportSubmenu);
|
contextMenu->addMenu(exportSubmenu);
|
||||||
|
|
||||||
std::shared_ptr<ZoneFile> zoneFile = mZoneFiles[fileStem];
|
const ZoneFile* zoneFile = mZoneFiles[fileStem];
|
||||||
|
|
||||||
QAction *exportZoneFileAction = new QAction("Export Zone File");
|
QAction *exportZoneFileAction = new QAction("Export Zone File");
|
||||||
exportSubmenu->addAction(exportZoneFileAction);
|
exportSubmenu->addAction(exportZoneFileAction);
|
||||||
@ -553,40 +531,40 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
|||||||
}
|
}
|
||||||
if (parentItem && parentItem != invisibleRootItem() && parentItem->text(0).contains(".zone")) {
|
if (parentItem && parentItem != invisibleRootItem() && parentItem->text(0).contains(".zone")) {
|
||||||
const QString fileStem = parentItem->text(0).section('.', 0, 0);
|
const QString fileStem = parentItem->text(0).section('.', 0, 0);
|
||||||
QVector<SoundAsset> soundAssets = mZoneFiles[fileStem]->GetAssetMap().sounds;
|
// QVector<LoadedSound> LoadedSounds = mZoneFiles[fileStem]->GetAssetMap().sounds;
|
||||||
for (SoundAsset soundAsset : soundAssets) {
|
// for (LoadedSound LoadedSound : LoadedSounds) {
|
||||||
for (Sound sound : soundAsset.sounds) {
|
// for (Sound sound : LoadedSound.sounds) {
|
||||||
if (sound.path.contains(activeText)) {
|
// if (sound.path.contains(activeText)) {
|
||||||
QMenu *exportSubmenu = new QMenu("Export...", this);
|
// QMenu *exportSubmenu = new QMenu("Export...", this);
|
||||||
contextMenu->addMenu(exportSubmenu);
|
// contextMenu->addMenu(exportSubmenu);
|
||||||
|
|
||||||
QAction *exportWAVAction = new QAction("Export as WAV File");
|
// QAction *exportWAVAction = new QAction("Export as WAV File");
|
||||||
exportSubmenu->addAction(exportWAVAction);
|
// exportSubmenu->addAction(exportWAVAction);
|
||||||
connect(exportWAVAction, &QAction::triggered, this, [sound](bool checked) {
|
// connect(exportWAVAction, &QAction::triggered, this, [sound](bool checked) {
|
||||||
Q_UNUSED(checked);
|
// Q_UNUSED(checked);
|
||||||
|
|
||||||
QDir dir = QDir::currentPath();
|
// QDir dir = QDir::currentPath();
|
||||||
if (!dir.exists("exports/")) {
|
// if (!dir.exists("exports/")) {
|
||||||
dir.mkdir("exports/");
|
// dir.mkdir("exports/");
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (!dir.exists("exports/sounds/")) {
|
// if (!dir.exists("exports/sounds/")) {
|
||||||
dir.mkdir("exports/sounds/");
|
// dir.mkdir("exports/sounds/");
|
||||||
}
|
// }
|
||||||
|
|
||||||
const QString fileName = "exports/sounds/" + sound.path.split('/').last();
|
// const QString fileName = "exports/sounds/" + sound.path.split('/').last();
|
||||||
QFile wavFile(fileName);
|
// QFile wavFile(fileName);
|
||||||
if (!wavFile.open(QIODevice::WriteOnly)) {
|
// if (!wavFile.open(QIODevice::WriteOnly)) {
|
||||||
qDebug() << "Failed to write wav file!";
|
// qDebug() << "Failed to write wav file!";
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
wavFile.write(sound.data);
|
// wavFile.write(sound.data);
|
||||||
wavFile.close();
|
// wavFile.close();
|
||||||
});
|
// });
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
} else if (activeItem && activeText == "Sounds") {
|
} else if (activeItem && activeText == "Sounds") {
|
||||||
XTreeWidgetItem *parentItem = dynamic_cast<XTreeWidgetItem*>(activeItem->parent());
|
XTreeWidgetItem *parentItem = dynamic_cast<XTreeWidgetItem*>(activeItem->parent());
|
||||||
@ -609,29 +587,29 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
|||||||
connect(exportAllWAVAction, &QAction::triggered, this, [zoneFile](bool checked) {
|
connect(exportAllWAVAction, &QAction::triggered, this, [zoneFile](bool checked) {
|
||||||
Q_UNUSED(checked);
|
Q_UNUSED(checked);
|
||||||
|
|
||||||
for (SoundAsset soundAsset : zoneFile->GetAssetMap().sounds) {
|
// for (LoadedSound LoadedSound : zoneFile->GetAssetMap().sounds) {
|
||||||
for (Sound sound : soundAsset.sounds) {
|
// for (Sound sound : LoadedSound.sounds) {
|
||||||
if (!sound.dataLength) { continue; }
|
// if (!sound.dataLength) { continue; }
|
||||||
|
|
||||||
QDir dir = QDir::currentPath();
|
// QDir dir = QDir::currentPath();
|
||||||
if (!dir.exists("exports/")) {
|
// if (!dir.exists("exports/")) {
|
||||||
dir.mkdir("exports/");
|
// dir.mkdir("exports/");
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (!dir.exists("exports/sounds/")) {
|
// if (!dir.exists("exports/sounds/")) {
|
||||||
dir.mkdir("exports/sounds/");
|
// dir.mkdir("exports/sounds/");
|
||||||
}
|
// }
|
||||||
|
|
||||||
const QString fileName = "exports/sounds/" + sound.path.split('/').last();
|
// const QString fileName = "exports/sounds/" + sound.path.split('/').last();
|
||||||
QFile wavFile(fileName);
|
// QFile wavFile(fileName);
|
||||||
if (!wavFile.open(QIODevice::WriteOnly)) {
|
// if (!wavFile.open(QIODevice::WriteOnly)) {
|
||||||
qDebug() << "Failed to write wav file!";
|
// qDebug() << "Failed to write wav file!";
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
wavFile.write(sound.data);
|
// wavFile.write(sound.data);
|
||||||
wavFile.close();
|
// wavFile.close();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -653,20 +631,19 @@ void XTreeWidget::ItemSelectionChanged() {
|
|||||||
|
|
||||||
XTreeWidgetItem *parentItem = dynamic_cast<XTreeWidgetItem*>(selectedItem->parent());
|
XTreeWidgetItem *parentItem = dynamic_cast<XTreeWidgetItem*>(selectedItem->parent());
|
||||||
|
|
||||||
if (selectedText.contains(".dds")) {
|
/*if (selectedText.contains(".dds")) {
|
||||||
if (!mDDSFiles.contains(selectedText)) {
|
if (!mDDSFiles.contains(selectedText)) {
|
||||||
LogManager::instance().addError("Could not find " + selectedText + " in DDS map!");
|
LogManager::instance().addError("Could not find " + selectedText + " in DDS map!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::shared_ptr<DDSFile> ddsFile = mDDSFiles[selectedText];
|
emit DDSFileSelected(mDDSFiles[selectedText], selectedText);
|
||||||
emit DDSFileSelected(ddsFile, selectedText);
|
|
||||||
} else if (selectedText.contains(".iwi")) {
|
} else if (selectedText.contains(".iwi")) {
|
||||||
if (!mIWIFiles.contains(selectedText)) {
|
if (!mIWIFiles.contains(selectedText)) {
|
||||||
LogManager::instance().addError("Could not find " + selectedText + " in IWI map!");
|
LogManager::instance().addError("Could not find " + selectedText + " in IWI map!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emit IWIFileSelected(mIWIFiles[selectedText], selectedText);
|
emit IWIFileSelected(mIWIFiles[selectedText], selectedText);
|
||||||
} else if (selectedText.contains(".ff")) {
|
} else */if (selectedText.contains(".ff")) {
|
||||||
if (!mFastFiles.contains(selectedText)) {
|
if (!mFastFiles.contains(selectedText)) {
|
||||||
LogManager::instance().addError("Could not find " + selectedText + " in Fast File map!");
|
LogManager::instance().addError("Could not find " + selectedText + " in Fast File map!");
|
||||||
return;
|
return;
|
||||||
@ -688,34 +665,22 @@ void XTreeWidget::ItemSelectionChanged() {
|
|||||||
XTreeWidgetItem *grandpaItem = dynamic_cast<XTreeWidgetItem*>(parentItem->parent());
|
XTreeWidgetItem *grandpaItem = dynamic_cast<XTreeWidgetItem*>(parentItem->parent());
|
||||||
if (grandpaItem && grandpaItem->text(0).contains(".zone")) {
|
if (grandpaItem && grandpaItem->text(0).contains(".zone")) {
|
||||||
const QString fileStem = grandpaItem->text(0).section('.', 0, 0);
|
const QString fileStem = grandpaItem->text(0).section('.', 0, 0);
|
||||||
QVector<Image> images = mZoneFiles[fileStem]->GetAssetMap().images;
|
// QVector<Image> images = mZoneFiles[fileStem]->GetAssetMap().images;
|
||||||
for (Image image : images) {
|
// for (Image image : images) {
|
||||||
if (image.materialName == selectedText) {
|
// if (image.materialName == selectedText) {
|
||||||
emit ImageSelected(std::make_shared<Image>(image), fileStem);
|
// emit ImageSelected(std::make_shared<Image>(image), fileStem);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
} else if (parentItem && (parentItem->text(0) == "Tech Sets")) {
|
} /*else if (parentItem && (parentItem->text(0) == "Tech Sets")) {
|
||||||
XTreeWidgetItem *grandpaItem = dynamic_cast<XTreeWidgetItem*>(parentItem->parent());
|
XTreeWidgetItem *grandpaItem = dynamic_cast<XTreeWidgetItem*>(parentItem->parent());
|
||||||
if (grandpaItem && grandpaItem->text(0).contains(".zone")) {
|
if (grandpaItem && grandpaItem->text(0).contains(".zone")) {
|
||||||
const QString fileStem = grandpaItem->text(0).section('.', 0, 0);
|
const QString fileStem = grandpaItem->text(0).section('.', 0, 0);
|
||||||
auto techsets = mZoneFiles[fileStem]->GetAssetMap().techSets;
|
auto techsets = mZoneFiles[fileStem]->GetAssetList().techSets;
|
||||||
for (auto techset : techsets) {
|
for (auto techset : techsets) {
|
||||||
if (techset.name == selectedText) {
|
if (techset.name == selectedText) {
|
||||||
emit TechSetSelected(std::make_shared<TechSet>(techset), fileStem);
|
emit TechSetSelected(new MaterialTechSet(techset), fileStem);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (parentItem && (parentItem->text(0) == "Tech Sets")) {
|
|
||||||
XTreeWidgetItem *grandpaItem = dynamic_cast<XTreeWidgetItem*>(parentItem->parent());
|
|
||||||
if (grandpaItem && grandpaItem->text(0).contains(".zone")) {
|
|
||||||
const QString fileStem = grandpaItem->text(0).section('.', 0, 0);
|
|
||||||
auto techsets = mZoneFiles[fileStem]->GetAssetMap().techSets;
|
|
||||||
for (auto techset : techsets) {
|
|
||||||
if (techset.name == selectedText) {
|
|
||||||
emit TechSetSelected(std::make_shared<TechSet>(techset), fileStem);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -724,12 +689,12 @@ void XTreeWidget::ItemSelectionChanged() {
|
|||||||
XTreeWidgetItem *grandpaItem = dynamic_cast<XTreeWidgetItem*>(parentItem->parent());
|
XTreeWidgetItem *grandpaItem = dynamic_cast<XTreeWidgetItem*>(parentItem->parent());
|
||||||
if (grandpaItem && grandpaItem->text(0).contains(".zone")) {
|
if (grandpaItem && grandpaItem->text(0).contains(".zone")) {
|
||||||
const QString fileStem = grandpaItem->text(0).section('.', 0, 0);
|
const QString fileStem = grandpaItem->text(0).section('.', 0, 0);
|
||||||
QVector<Material> materials = mZoneFiles[fileStem]->GetAssetMap().materials;
|
auto materials = mZoneFiles[fileStem]->GetAssetMap().materials;
|
||||||
for (Material material : materials) {
|
for (auto material : materials) {
|
||||||
if (material.name == selectedText) {
|
// if (material.name == selectedText) {
|
||||||
emit MaterialSelected(std::make_shared<Material>(material), fileStem);
|
// emit MaterialSelected(std::make_shared<Material>(material), fileStem);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (parentItem && selectedText.contains(".wav")) {
|
} else if (parentItem && selectedText.contains(".wav")) {
|
||||||
@ -743,15 +708,15 @@ void XTreeWidget::ItemSelectionChanged() {
|
|||||||
}
|
}
|
||||||
if (grandpaItem && grandpaItem != invisibleRootItem() && grandpaItem->text(0).contains(".zone")) {
|
if (grandpaItem && grandpaItem != invisibleRootItem() && grandpaItem->text(0).contains(".zone")) {
|
||||||
const QString fileStem = grandpaItem->text(0).section('.', 0, 0);
|
const QString fileStem = grandpaItem->text(0).section('.', 0, 0);
|
||||||
QVector<SoundAsset> soundAssets = mZoneFiles[fileStem]->GetAssetMap().sounds;
|
// QVector<LoadedSound> LoadedSounds = mZoneFiles[fileStem]->GetAssetMap().sounds;
|
||||||
for (SoundAsset soundAsset : soundAssets) {
|
// for (LoadedSound LoadedSound : LoadedSounds) {
|
||||||
for (Sound sound : soundAsset.sounds) {
|
// for (Sound sound : LoadedSound.sounds) {
|
||||||
if (sound.path.contains(selectedText)) {
|
// if (sound.path.contains(selectedText)) {
|
||||||
emit SoundSelected(std::make_shared<Sound>(sound), fileStem);
|
// emit SoundSelected(std::make_shared<Sound>(sound), fileStem);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
} else if (selectedItem->GetCategory() != CATEGORY_TYPE) {
|
} else if (selectedItem->GetCategory() != CATEGORY_TYPE) {
|
||||||
XTreeWidgetItem *zoneRoot = selectedItem;
|
XTreeWidgetItem *zoneRoot = selectedItem;
|
||||||
@ -772,17 +737,17 @@ void XTreeWidget::ItemSelectionChanged() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<RawFile> rawFiles = mZoneFiles[fileStem]->GetAssetMap().rawFiles;
|
auto rawFiles = mZoneFiles[fileStem]->GetAssetMap().rawFiles;
|
||||||
for (RawFile rawFile : rawFiles) {
|
for (auto rawFile : rawFiles) {
|
||||||
if (rawFile.path.split('/').last() == selectedText) {
|
//if (rawFile->path.split('/').last() == selectedText) {
|
||||||
emit RawFileSelected(std::make_shared<RawFile>(rawFile), fileStem);
|
// emit RawFileSelected(std::make_shared<RawFile>(rawFile), fileStem);
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<ZoneFile> XTreeWidget::FindZoneFile(const QString aStem) {
|
const ZoneFile* XTreeWidget::FindZoneFile(const QString aStem) {
|
||||||
foreach (auto zoneFile, mZoneFiles) {
|
foreach (auto zoneFile, mZoneFiles) {
|
||||||
if (zoneFile->GetStem() == aStem) {
|
if (zoneFile->GetStem() == aStem) {
|
||||||
return zoneFile;
|
return zoneFile;
|
||||||
@ -791,7 +756,7 @@ std::shared_ptr<ZoneFile> XTreeWidget::FindZoneFile(const QString aStem) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<FastFile> XTreeWidget::FindFastFile(const QString aStem) {
|
const FastFile *XTreeWidget::FindFastFile(const QString aStem) {
|
||||||
foreach (auto fastFile, mFastFiles) {
|
foreach (auto fastFile, mFastFiles) {
|
||||||
if (fastFile->GetStem() == aStem) {
|
if (fastFile->GetStem() == aStem) {
|
||||||
return fastFile;
|
return fastFile;
|
||||||
@ -808,7 +773,7 @@ bool XTreeWidget::HasFastFile(const QString aStem) {
|
|||||||
return FindFastFile(aStem) != nullptr;
|
return FindFastFile(aStem) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XTreeWidget::AddIWIFile(std::shared_ptr<IWIFile> aIWIFile) {
|
void XTreeWidget::AddIWIFile(IWIFile* aIWIFile) {
|
||||||
const QString iwiFileName = QString(aIWIFile->fileStem + ".iwi");
|
const QString iwiFileName = QString(aIWIFile->fileStem + ".iwi");
|
||||||
|
|
||||||
for (int i = 0; i < invisibleRootItem()->childCount(); i++) {
|
for (int i = 0; i < invisibleRootItem()->childCount(); i++) {
|
||||||
@ -819,12 +784,12 @@ void XTreeWidget::AddIWIFile(std::shared_ptr<IWIFile> aIWIFile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
XTreeWidgetItem *iwiItem = new XTreeWidgetItem(this);
|
XTreeWidgetItem *iwiItem = new XTreeWidgetItem(this);
|
||||||
iwiItem->setIcon(0, ZoneFile::AssetTypeToIcon(ASSET_IMAGE));
|
iwiItem->setIcon(0, Utils::CreateAssetIcon(ASSET_TYPE_IMAGE));
|
||||||
iwiItem->setText(0, iwiFileName);
|
iwiItem->setText(0, iwiFileName);
|
||||||
mIWIFiles[aIWIFile->fileStem.section(".", 0, 0)] = aIWIFile;
|
mIWIFiles[aIWIFile->fileStem.section(".", 0, 0)] = aIWIFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XTreeWidget::AddDDSFile(std::shared_ptr<DDSFile> aDDSFile) {
|
void XTreeWidget::AddDDSFile(DDSFile* aDDSFile) {
|
||||||
const QString ddsFileName = QString(aDDSFile->fileStem + ".dds");
|
const QString ddsFileName = QString(aDDSFile->fileStem + ".dds");
|
||||||
|
|
||||||
for (int i = 0; i < invisibleRootItem()->childCount(); i++) {
|
for (int i = 0; i < invisibleRootItem()->childCount(); i++) {
|
||||||
@ -835,7 +800,7 @@ void XTreeWidget::AddDDSFile(std::shared_ptr<DDSFile> aDDSFile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
XTreeWidgetItem *ddsItem = new XTreeWidgetItem(this);
|
XTreeWidgetItem *ddsItem = new XTreeWidgetItem(this);
|
||||||
ddsItem->setIcon(0, ZoneFile::AssetTypeToIcon(ASSET_IMAGE));
|
ddsItem->setIcon(0, Utils::CreateAssetIcon(ASSET_TYPE_IMAGE));
|
||||||
ddsItem->setText(0, ddsFileName);
|
ddsItem->setText(0, ddsFileName);
|
||||||
mDDSFiles[aDDSFile->fileStem.section(".", 0, 0)] = aDDSFile;
|
mDDSFiles[aDDSFile->fileStem.section(".", 0, 0)] = aDDSFile;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,13 +2,16 @@
|
|||||||
#define XTREEWIDGET_H
|
#define XTREEWIDGET_H
|
||||||
|
|
||||||
#include "d3dbsp_structs.h"
|
#include "d3dbsp_structs.h"
|
||||||
#include "asset_structs.h"
|
|
||||||
#include "ddsfile.h"
|
#include "ddsfile.h"
|
||||||
#include "iwifile.h"
|
#include "iwifile.h"
|
||||||
#include "fastfile.h"
|
#include "fastfile.h"
|
||||||
|
#include "xloadedsound.h"
|
||||||
#include "xtreewidgetitem.h"
|
#include "xtreewidgetitem.h"
|
||||||
#include "zonefile.h"
|
#include "zonefile.h"
|
||||||
#include "utils.h"
|
#include "xrawfile.h"
|
||||||
|
#include "xgfximage.h"
|
||||||
|
#include "xstringtable.h"
|
||||||
|
#include "xmenudef.h"
|
||||||
|
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
@ -20,31 +23,31 @@ public:
|
|||||||
explicit XTreeWidget(QWidget *parent = nullptr);
|
explicit XTreeWidget(QWidget *parent = nullptr);
|
||||||
~XTreeWidget();
|
~XTreeWidget();
|
||||||
|
|
||||||
void AddFastFile(std::shared_ptr<FastFile> aFastFile);
|
void AddFastFile(FastFile* aFastFile);
|
||||||
void AddZoneFile(std::shared_ptr<ZoneFile> aZoneFile, XTreeWidgetItem *aParentItem = nullptr);
|
void AddZoneFile(const ZoneFile *aZoneFile, XTreeWidgetItem *aParentItem = nullptr);
|
||||||
void AddIWIFile(std::shared_ptr<IWIFile> aIWIFile);
|
void AddIWIFile(IWIFile* aIWIFile);
|
||||||
void AddDDSFile(std::shared_ptr<DDSFile> aDDSFile);
|
void AddDDSFile(DDSFile* aDDSFile);
|
||||||
|
|
||||||
std::shared_ptr<ZoneFile> FindZoneFile(const QString aStem);
|
const ZoneFile *FindZoneFile(const QString aStem);
|
||||||
std::shared_ptr<FastFile> FindFastFile(const QString aStem);
|
const FastFile* FindFastFile(const QString aStem);
|
||||||
|
|
||||||
bool HasZoneFile(const QString aStem);
|
bool HasZoneFile(const QString aStem);
|
||||||
bool HasFastFile(const QString aStem);
|
bool HasFastFile(const QString aStem);
|
||||||
|
|
||||||
void CloseFastFile(const QString aFFName);
|
void CloseFastFile(const QString aFFName);
|
||||||
signals:
|
signals:
|
||||||
void DDSFileSelected(std::shared_ptr<DDSFile> aDDSFile, const QString aParentName);
|
void DDSFileSelected(const DDSFile* aDDSFile, const QString aParentName);
|
||||||
void IWIFileSelected(std::shared_ptr<IWIFile> aIWIFile, const QString aParentName);
|
void IWIFileSelected(const IWIFile* aIWIFile, const QString aParentName);
|
||||||
void FastFileSelected(std::shared_ptr<FastFile> aFastFile, const QString aParentName);
|
void FastFileSelected(const FastFile* aFastFile, const QString aParentName);
|
||||||
void ZoneFileSelected(std::shared_ptr<ZoneFile> aZoneFile, const QString aParentName);
|
void ZoneFileSelected(const ZoneFile* aZoneFile, const QString aParentName);
|
||||||
void LocalStringSelected(std::shared_ptr<ZoneFile> aZoneFile, const QString aParentName);
|
void LocalStringSelected(const ZoneFile* aZoneFile, const QString aParentName);
|
||||||
void RawFileSelected(std::shared_ptr<RawFile> aRawFile, const QString aParentName);
|
void RawFileSelected(const XRawFile* aRawFile, const QString aParentName);
|
||||||
void ImageSelected(std::shared_ptr<Image> aImage, const QString aParentName);
|
void ImageSelected(const XGfxImage* aImage, const QString aParentName);
|
||||||
void TechSetSelected(std::shared_ptr<TechSet> aZoneFile, const QString aParentName);
|
void TechSetSelected(const XMaterialTechniqueSet* aZoneFile, const QString aParentName);
|
||||||
void StrTableSelected(std::shared_ptr<StringTable> aStrTable, const QString aParentName);
|
void StrTableSelected(const XStringTable* aStrTable, const QString aParentName);
|
||||||
void MenuSelected(std::shared_ptr<Menu> aMenu, const QString aParentName);
|
void MenuSelected(const XMenuDef* aMenu, const QString aParentName);
|
||||||
void SoundSelected(std::shared_ptr<Sound> aSound, const QString aParentName);
|
void SoundSelected(const XLoadedSound* aSound, const QString aParentName);
|
||||||
void MaterialSelected(std::shared_ptr<Material> aMaterial, const QString aParentName);
|
void MaterialSelected(const XMaterial* aMaterial, const QString aParentName);
|
||||||
void ItemSelected(const QString itemText);
|
void ItemSelected(const QString itemText);
|
||||||
|
|
||||||
void ItemClosed(const QString itemText);
|
void ItemClosed(const QString itemText);
|
||||||
@ -55,10 +58,10 @@ protected:
|
|||||||
void PrepareContextMenu(const QPoint &pos);
|
void PrepareContextMenu(const QPoint &pos);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<QString, std::shared_ptr<FastFile>> mFastFiles;
|
QMap<QString, const FastFile*> mFastFiles;
|
||||||
QMap<QString, std::shared_ptr<ZoneFile>> mZoneFiles;
|
QMap<QString, const ZoneFile*> mZoneFiles;
|
||||||
QMap<QString, std::shared_ptr<DDSFile>> mDDSFiles;
|
QMap<QString, const DDSFile*> mDDSFiles;
|
||||||
QMap<QString, std::shared_ptr<IWIFile>> mIWIFiles;
|
QMap<QString, const IWIFile*> mIWIFiles;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // XTREEWIDGET_H
|
#endif // XTREEWIDGET_H
|
||||||
|
|||||||
@ -69,7 +69,7 @@ void ZoneFileViewer::SortTags(const QString &aSearchText) {
|
|||||||
ui->listWidget_Tags->addItems(sortedTags);
|
ui->listWidget_Tags->addItems(sortedTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneFileViewer::SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile) {
|
void ZoneFileViewer::SetZoneFile(const ZoneFile* aZoneFile) {
|
||||||
mZoneFile = aZoneFile;
|
mZoneFile = aZoneFile;
|
||||||
|
|
||||||
ui->tableWidget_RecordCounts->clearContents();
|
ui->tableWidget_RecordCounts->clearContents();
|
||||||
@ -88,37 +88,36 @@ void ZoneFileViewer::SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile) {
|
|||||||
ui->groupBox_Tags->show();
|
ui->groupBox_Tags->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, int> recordCounts = QMap<QString, int>();
|
QMap<XAssetType, int> recordCounts = QMap<XAssetType, int>();
|
||||||
QVector<QPair<QString, int>> assetOccurances = QVector<QPair<QString, int>>();
|
QVector<QPair<XAssetType, int>> assetOccurances = QVector<QPair<XAssetType, int>>();
|
||||||
for (const QString &record : mZoneFile->GetRecords()) {
|
for (XAssetType type : mZoneFile->GetTypes()) {
|
||||||
if (!recordCounts.contains(record)) {
|
if (!recordCounts.contains(type)) {
|
||||||
recordCounts[record] = 0;
|
recordCounts[type] = 0;
|
||||||
}
|
}
|
||||||
recordCounts[record]++;
|
recordCounts[type]++;
|
||||||
|
|
||||||
if (!assetOccurances.isEmpty() && assetOccurances.last().first == record) {
|
if (!assetOccurances.isEmpty() && assetOccurances.last().first == type) {
|
||||||
assetOccurances.last().second++;
|
assetOccurances.last().second++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPair<QString, int> assetOccurance(record, 1);
|
QPair<XAssetType, int> assetOccurance(type, 1);
|
||||||
assetOccurances << assetOccurance;
|
assetOccurances << assetOccurance;
|
||||||
}
|
}
|
||||||
ui->tableWidget_RecordOrder->setRowCount(assetOccurances.size());
|
ui->tableWidget_RecordOrder->setRowCount(assetOccurances.size());
|
||||||
|
|
||||||
int assetIndex = 0;
|
int assetIndex = 0;
|
||||||
foreach (auto assetOccurance, assetOccurances) {
|
foreach (auto assetOccurance, assetOccurances) {
|
||||||
const QString record = assetOccurance.first;
|
XAssetType assetType = assetOccurance.first;
|
||||||
AssetType assetType = mZoneFile->AssetStrToEnum(record);
|
|
||||||
int assetCount = assetOccurance.second;
|
int assetCount = assetOccurance.second;
|
||||||
|
|
||||||
QIcon assetIcon = mZoneFile->AssetTypeToIcon(assetType);
|
QIcon assetIcon = Utils::CreateAssetIcon(assetType);
|
||||||
if (assetIcon.isNull()) {
|
if (assetIcon.isNull()) {
|
||||||
qDebug() << "Icon is null for record: " << record;
|
qDebug() << "Icon is null for record: " << assetType;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTableWidgetItem *recordItem = new QTableWidgetItem(record.toUpper());
|
QTableWidgetItem *recordItem = new QTableWidgetItem(QString::number(assetType, 16));
|
||||||
QTableWidgetItem *recordStrItem = new QTableWidgetItem(mZoneFile->AssetEnumToStr(assetType));
|
QTableWidgetItem *recordStrItem = new QTableWidgetItem(XAsset::XAssetTypeToString(assetType));
|
||||||
QTableWidgetItem *recordCountItem = new QTableWidgetItem(QString::number(assetCount));
|
QTableWidgetItem *recordCountItem = new QTableWidgetItem(QString::number(assetCount));
|
||||||
recordItem->setIcon(assetIcon);
|
recordItem->setIcon(assetIcon);
|
||||||
|
|
||||||
@ -130,19 +129,18 @@ void ZoneFileViewer::SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int recordIndex = 0;
|
int recordIndex = 0;
|
||||||
for (const QString &record : recordCounts.keys()) {
|
for (XAssetType assetType : recordCounts.keys()) {
|
||||||
int recordCount = recordCounts[record];
|
int recordCount = recordCounts[assetType];
|
||||||
|
|
||||||
AssetType assetType = mZoneFile->AssetStrToEnum(record);
|
QIcon assetIcon = Utils::CreateAssetIcon(assetType);
|
||||||
QIcon assetIcon = mZoneFile->AssetTypeToIcon(assetType);
|
|
||||||
if (assetIcon.isNull()) {
|
if (assetIcon.isNull()) {
|
||||||
qDebug() << "Icon is null for record: " << record;
|
qDebug() << "Icon is null for record: " << assetType;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->tableWidget_RecordCounts->setRowCount(recordIndex + 1);
|
ui->tableWidget_RecordCounts->setRowCount(recordIndex + 1);
|
||||||
|
|
||||||
QTableWidgetItem *recordItem = new QTableWidgetItem(record.toUpper());
|
QTableWidgetItem *recordItem = new QTableWidgetItem(QString::number(assetType, 16));
|
||||||
QTableWidgetItem *recordCountStrItem = new QTableWidgetItem(mZoneFile->AssetEnumToStr(assetType));
|
QTableWidgetItem *recordCountStrItem = new QTableWidgetItem(XAsset::XAssetTypeToString(assetType));
|
||||||
QTableWidgetItem *recordCountItem = new QTableWidgetItem(QString::number(recordCount));
|
QTableWidgetItem *recordCountItem = new QTableWidgetItem(QString::number(recordCount));
|
||||||
recordItem->setIcon(assetIcon);
|
recordItem->setIcon(assetIcon);
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ public:
|
|||||||
explicit ZoneFileViewer(QWidget *parent = nullptr);
|
explicit ZoneFileViewer(QWidget *parent = nullptr);
|
||||||
~ZoneFileViewer();
|
~ZoneFileViewer();
|
||||||
|
|
||||||
void SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile);
|
void SetZoneFile(const ZoneFile *aZoneFile);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void SortTags(const QString &aSearchText);
|
void SortTags(const QString &aSearchText);
|
||||||
@ -27,7 +27,7 @@ public slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ZoneFileViewer *ui;
|
Ui::ZoneFileViewer *ui;
|
||||||
std::shared_ptr<ZoneFile> mZoneFile;
|
const ZoneFile* mZoneFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ZONEFILEVIEWER_H
|
#endif // ZONEFILEVIEWER_H
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 316 B |
@ -1,5 +1,5 @@
|
|||||||
#include "compression.h"
|
#include "compression.h"
|
||||||
#include "minilzo.h"
|
//#include "minilzo.h"
|
||||||
|
|
||||||
#define XBOXAPI __declspec(dllimport)
|
#define XBOXAPI __declspec(dllimport)
|
||||||
#include "xcompress.h"
|
#include "xcompress.h"
|
||||||
@ -295,22 +295,23 @@ QByteArray Compression::CompressDeflateWithSettings(const QByteArray &aData, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Compression::DecompressLZO(const QByteArray &aCompressedData, quint32 aDestSize) {
|
QByteArray Compression::DecompressLZO(const QByteArray &aCompressedData, quint32 aDestSize) {
|
||||||
static bool ok = (lzo_init() == LZO_E_OK);
|
QByteArray dst;
|
||||||
if (!ok)
|
// static bool ok = (lzo_init() == LZO_E_OK);
|
||||||
throw std::runtime_error("lzo_init failed");
|
// if (!ok)
|
||||||
|
// throw std::runtime_error("lzo_init failed");
|
||||||
|
|
||||||
QByteArray dst(aDestSize, Qt::Uninitialized);
|
// dst = QByteArray(aDestSize, Qt::Uninitialized);
|
||||||
lzo_uint out = aDestSize;
|
// lzo_uint out = aDestSize;
|
||||||
|
|
||||||
int rc = lzo1x_decompress_safe(
|
// int rc = lzo1x_decompress_safe(
|
||||||
reinterpret_cast<const lzo_bytep>(aCompressedData.constData()),
|
// reinterpret_cast<const lzo_bytep>(aCompressedData.constData()),
|
||||||
static_cast<lzo_uint>(aCompressedData.size()),
|
// static_cast<lzo_uint>(aCompressedData.size()),
|
||||||
reinterpret_cast<lzo_bytep>(dst.data()),
|
// reinterpret_cast<lzo_bytep>(dst.data()),
|
||||||
&out,
|
// &out,
|
||||||
nullptr);
|
// nullptr);
|
||||||
|
|
||||||
if (rc != LZO_E_OK || out != aDestSize)
|
// if (rc != LZO_E_OK || out != aDestSize)
|
||||||
throw std::runtime_error("LZO decompression error");
|
// throw std::runtime_error("LZO decompression error");
|
||||||
|
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,15 +3,8 @@ TEMPLATE = lib
|
|||||||
CONFIG += staticlib c++17
|
CONFIG += staticlib c++17
|
||||||
DEFINES += MINILZO_USE_STATIC
|
DEFINES += MINILZO_USE_STATIC
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += $$files($$PWD/*.cpp, true)
|
||||||
compression.cpp \
|
HEADERS += $$files($$PWD/*.h, true)
|
||||||
minilzo.c \
|
|
||||||
lzoconf.h \
|
|
||||||
lzodefs.h
|
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
compression.h \
|
|
||||||
minilzo.h
|
|
||||||
|
|
||||||
LIBS += \
|
LIBS += \
|
||||||
-L$$PWD/../../third_party/xbox_sdk/lib -lxcompress64 \
|
-L$$PWD/../../third_party/xbox_sdk/lib -lxcompress64 \
|
||||||
|
|||||||
@ -2,23 +2,13 @@ QT += core widgets
|
|||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
CONFIG += staticlib c++17
|
CONFIG += staticlib c++17
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += $$files($$PWD/*.cpp, true)
|
||||||
highlighter_cfg.cpp \
|
HEADERS += $$files($$PWD/*.h, true)
|
||||||
highlighter_shock.cpp \
|
|
||||||
highlighter_rumble.cpp \
|
|
||||||
highlighter_gsc.cpp \
|
|
||||||
logmanager.cpp \
|
|
||||||
statusbarmanager.cpp
|
|
||||||
|
|
||||||
HEADERS += \
|
LIBS += -L$$OUT_PWD/../libs/xassets -lxassets
|
||||||
enums.h \
|
|
||||||
highlighter_cfg.h \
|
INCLUDEPATH += $$PWD/../xassets
|
||||||
highlighter_shock.h \
|
|
||||||
highlighter_rumble.h \
|
DEPENDPATH += $$PWD/../xassets
|
||||||
highlighter_gsc.h \
|
|
||||||
logmanager.h \
|
|
||||||
stringutils.h \
|
|
||||||
utils.h \
|
|
||||||
statusbarmanager.h
|
|
||||||
|
|
||||||
DESTDIR = $$OUT_PWD/../
|
DESTDIR = $$OUT_PWD/../
|
||||||
|
|||||||
@ -3,28 +3,6 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
enum FF_PLATFORM {
|
|
||||||
FF_PLATFORM_NONE = 0x00, // No platform
|
|
||||||
FF_PLATFORM_XBOX = 0x01, // Xbox 360
|
|
||||||
FF_PLATFORM_PS3 = 0x02, // Playstation 3
|
|
||||||
FF_PLATFORM_PC = 0x03, // PC
|
|
||||||
FF_PLATFORM_WII = 0x04, // WII
|
|
||||||
FF_PLATFORM_WIIU = 0x05 // WII U
|
|
||||||
};
|
|
||||||
|
|
||||||
enum FF_GAME {
|
|
||||||
FF_GAME_NONE = 0x00, // No game
|
|
||||||
FF_GAME_COD1 = 0x01, // Call of Duty
|
|
||||||
FF_GAME_COD2 = 0x02, // Call of Duty 2
|
|
||||||
FF_GAME_COD3 = 0x03, // Call of Duty 3
|
|
||||||
FF_GAME_COD4 = 0x04, // Modern Warware 1
|
|
||||||
FF_GAME_COD5 = 0x05, // World at War
|
|
||||||
FF_GAME_COD6 = 0x06, // Modern Warfare 2
|
|
||||||
FF_GAME_COD7 = 0x07, // Black Ops 1
|
|
||||||
FF_GAME_COD8 = 0x08, // Modern Warfare 3
|
|
||||||
FF_GAME_COD9 = 0x09, // Black Ops 2
|
|
||||||
};
|
|
||||||
|
|
||||||
enum IWI_VERSION {
|
enum IWI_VERSION {
|
||||||
IWI_VERSION_COD2 = 0x05, // 05 CoD2
|
IWI_VERSION_COD2 = 0x05, // 05 CoD2
|
||||||
IWI_VERSION_COD4 = 0x06, // 06 CoD4
|
IWI_VERSION_COD4 = 0x06, // 06 CoD4
|
||||||
@ -432,7 +410,7 @@ enum MENU_FONT_TYPE{
|
|||||||
UI_FONT_DEFAULT = 0, // auto-chose betwen big/reg/small
|
UI_FONT_DEFAULT = 0, // auto-chose betwen big/reg/small
|
||||||
UI_FONT_NORMAL = 1,
|
UI_FONT_NORMAL = 1,
|
||||||
UI_FONT_BIG = 2,
|
UI_FONT_BIG = 2,
|
||||||
UI_FONT_SMALL = 3,
|
UI_GameFontMALL = 3,
|
||||||
UI_FONT_BOLD = 4,
|
UI_FONT_BOLD = 4,
|
||||||
UI_FONT_CONSOLE = 5,
|
UI_FONT_CONSOLE = 5,
|
||||||
UI_FONT_OBJECTIVE = 6,
|
UI_FONT_OBJECTIVE = 6,
|
||||||
|
|||||||
@ -2,15 +2,19 @@
|
|||||||
#define UTILS_H
|
#define UTILS_H
|
||||||
|
|
||||||
#include "enums.h"
|
#include "enums.h"
|
||||||
|
#include "QtZlib/zlib.h"
|
||||||
|
#include "qdir.h"
|
||||||
|
#include "qicon.h"
|
||||||
|
#include "xasset.h"
|
||||||
|
#include "xassettype.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QMetaEnum>
|
||||||
#include <QtZlib/zlib.h>
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
|
|
||||||
class Utils {
|
class Utils : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static bool ExportData(const QString aFileName, const QByteArray aData) {
|
static bool ExportData(const QString aFileName, const QByteArray aData) {
|
||||||
QDir workingDir = QDir::currentPath();
|
QDir workingDir = QDir::currentPath();
|
||||||
@ -30,6 +34,29 @@ public:
|
|||||||
b = (b & 0xAA) >> 1 | (b & 0x55) << 1;
|
b = (b & 0xAA) >> 1 | (b & 0x55) << 1;
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
static QIcon CreateAssetIcon(XAssetType aAssetType, QColor color = QColor()) {
|
||||||
|
const QString assetTypeStr = XAsset::XAssetTypeToString(aAssetType);
|
||||||
|
|
||||||
|
QString assetAbbr;
|
||||||
|
for (int i = 0; i < assetTypeStr.length(); i++)
|
||||||
|
{
|
||||||
|
if (assetTypeStr[i].isUpper())
|
||||||
|
{
|
||||||
|
assetAbbr += assetTypeStr[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CreateAssetIcon(assetAbbr, color);
|
||||||
|
|
||||||
|
// QString name;
|
||||||
|
// const QStringList parts = assetTypeStr.split('_').mid(1);
|
||||||
|
// foreach (const QString part, parts) {
|
||||||
|
// name += part[0];
|
||||||
|
// }
|
||||||
|
// if (parts.size() == 1) {
|
||||||
|
// name += parts.first()[1];
|
||||||
|
// }
|
||||||
|
// return CreateAssetIcon(name, color);
|
||||||
|
}
|
||||||
static QIcon CreateAssetIcon(const QString& name, QColor color = QColor()) {
|
static QIcon CreateAssetIcon(const QString& name, QColor color = QColor()) {
|
||||||
constexpr int iconSize = 32;
|
constexpr int iconSize = 32;
|
||||||
constexpr int padding = 4;
|
constexpr int padding = 4;
|
||||||
@ -380,34 +407,6 @@ public:
|
|||||||
return PadInt4(size) - size;
|
return PadInt4(size) - size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString GetOpenFastFileName(QWidget *parent = nullptr) {
|
|
||||||
// Open file dialog to steam apps
|
|
||||||
const QString steamPath = "C:/Program Files (x86)/Steam/steamapps/common/Call of Duty World at War/zone/english/";
|
|
||||||
const QString fastFilePath = QFileDialog::getOpenFileName(parent, "Open Fast File", steamPath, "Fast File (*.ff);;All Files (*.*)");
|
|
||||||
if (fastFilePath.isNull()) {
|
|
||||||
// User pressed cancel
|
|
||||||
return "";
|
|
||||||
} else if (!QFile::exists(fastFilePath)) {
|
|
||||||
QMessageBox::warning(parent, "Warning!", QString("%1 does not exist!.").arg(fastFilePath));
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return fastFilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString GetOpenZoneFileName(QWidget *parent = nullptr) {
|
|
||||||
// Open file dialog to steam apps
|
|
||||||
const QString steamPath = "C:/Program Files (x86)/Steam/steamapps/common/Call of Duty World at War/zone/english/";
|
|
||||||
const QString zoneFilePath = QFileDialog::getOpenFileName(parent, "Open Zone File", steamPath, "Zone File (*.zone);;All Files (*.*)");
|
|
||||||
if (zoneFilePath.isNull()) {
|
|
||||||
// User pressed cancel
|
|
||||||
return "";
|
|
||||||
} else if (!QFile::exists(zoneFilePath)) {
|
|
||||||
QMessageBox::warning(parent, "Warning!", QString("%1 does not exist!.").arg(zoneFilePath));
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return zoneFilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString CompanyEnumToStr(FF_COMPANY aCompany) {
|
static QString CompanyEnumToStr(FF_COMPANY aCompany) {
|
||||||
switch (aCompany) {
|
switch (aCompany) {
|
||||||
case COMPANY_NONE:
|
case COMPANY_NONE:
|
||||||
|
|||||||
@ -35,7 +35,7 @@ DDSPixelFormat DDSFile::CalculatePixelFormat(quint8 aIWIFormat) {
|
|||||||
return ddsPixelFormat;
|
return ddsPixelFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DDSFile::SetupExportDirs() {
|
void DDSFile::SetupExportDirs() const {
|
||||||
QDir dir = QDir::currentPath();
|
QDir dir = QDir::currentPath();
|
||||||
if (!dir.exists("exports/")) {
|
if (!dir.exists("exports/")) {
|
||||||
dir.mkdir("exports/");
|
dir.mkdir("exports/");
|
||||||
@ -248,7 +248,7 @@ DDSFile &DDSFile::operator=(const DDSFile &other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write a DDS file from a DDSFile object
|
// Write a DDS file from a DDSFile object
|
||||||
bool DDSFile::SaveDDS() {
|
bool DDSFile::SaveDDS() const {
|
||||||
SetupExportDirs();
|
SetupExportDirs();
|
||||||
|
|
||||||
QFile file("exports/dds/" + fileStem + ".dds");
|
QFile file("exports/dds/" + fileStem + ".dds");
|
||||||
@ -268,7 +268,7 @@ bool DDSFile::SaveDDS() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DDSFile::SaveIWI() {
|
bool DDSFile::SaveIWI() const {
|
||||||
SetupExportDirs();
|
SetupExportDirs();
|
||||||
|
|
||||||
IWIFile iwiFile(*this);
|
IWIFile iwiFile(*this);
|
||||||
@ -279,7 +279,7 @@ bool DDSFile::SaveIWI() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DDSFile::SavePNG() {
|
bool DDSFile::SavePNG() const {
|
||||||
SetupExportDirs();
|
SetupExportDirs();
|
||||||
|
|
||||||
int mipmapIndex = 1;
|
int mipmapIndex = 1;
|
||||||
@ -311,7 +311,7 @@ bool DDSFile::SavePNG() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DDSFile::SaveJPG() {
|
bool DDSFile::SaveJPG() const {
|
||||||
SetupExportDirs();
|
SetupExportDirs();
|
||||||
|
|
||||||
int mipmapIndex = 1;
|
int mipmapIndex = 1;
|
||||||
|
|||||||
@ -68,12 +68,12 @@ public:
|
|||||||
DDSFile(const DDSFile &ddsFile);
|
DDSFile(const DDSFile &ddsFile);
|
||||||
DDSFile& operator=(const DDSFile& other);
|
DDSFile& operator=(const DDSFile& other);
|
||||||
|
|
||||||
bool SaveDDS();
|
bool SaveDDS() const;
|
||||||
bool SaveIWI();
|
bool SaveIWI() const;
|
||||||
bool SavePNG();
|
bool SavePNG() const;
|
||||||
bool SaveJPG();
|
bool SaveJPG() const;
|
||||||
|
|
||||||
void SetupExportDirs();
|
void SetupExportDirs() const;
|
||||||
static DDSPixelFormat CalculatePixelFormat(quint8 aIWIFormat);
|
static DDSPixelFormat CalculatePixelFormat(quint8 aIWIFormat);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -2,13 +2,8 @@ QT += core
|
|||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
CONFIG += staticlib c++17
|
CONFIG += staticlib c++17
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += $$files($$PWD/*.cpp, true)
|
||||||
ddsfile.cpp
|
HEADERS += $$files($$PWD/*.h, true)
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
dds_structs.h \
|
|
||||||
ddsfile.h \
|
|
||||||
enums.h
|
|
||||||
|
|
||||||
LIBS += \
|
LIBS += \
|
||||||
-L$$PWD/../../third_party/devil_sdk/lib/ -lDevIL \
|
-L$$PWD/../../third_party/devil_sdk/lib/ -lDevIL \
|
||||||
|
|||||||
@ -430,7 +430,7 @@ enum MENU_FONT_TYPE{
|
|||||||
UI_FONT_DEFAULT = 0, // auto-chose betwen big/reg/small
|
UI_FONT_DEFAULT = 0, // auto-chose betwen big/reg/small
|
||||||
UI_FONT_NORMAL = 1,
|
UI_FONT_NORMAL = 1,
|
||||||
UI_FONT_BIG = 2,
|
UI_FONT_BIG = 2,
|
||||||
UI_FONT_SMALL = 3,
|
UI_GameFontMALL = 3,
|
||||||
UI_FONT_BOLD = 4,
|
UI_FONT_BOLD = 4,
|
||||||
UI_FONT_CONSOLE = 5,
|
UI_FONT_CONSOLE = 5,
|
||||||
UI_FONT_OBJECTIVE = 6,
|
UI_FONT_OBJECTIVE = 6,
|
||||||
|
|||||||
@ -2,20 +2,8 @@ QT += core
|
|||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
CONFIG += staticlib c++17
|
CONFIG += staticlib c++17
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += $$files($$PWD/*.cpp, true)
|
||||||
salsa20.cpp \
|
HEADERS += $$files($$PWD/*.h, true)
|
||||||
sha1.cpp \
|
|
||||||
encryption.cpp
|
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
ecrypt-config.h \
|
|
||||||
ecrypt-machine.h \
|
|
||||||
ecrypt-portable.h \
|
|
||||||
ecrypt-sync.h \
|
|
||||||
encryption.h \
|
|
||||||
os_types.h \
|
|
||||||
config_win32.h \
|
|
||||||
sha1.h
|
|
||||||
|
|
||||||
app.depends += \
|
app.depends += \
|
||||||
compression
|
compression
|
||||||
|
|||||||
@ -36,7 +36,7 @@ FastFile_COD10_360::~FastFile_COD10_360() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD10_360::GetBinaryData() {
|
QByteArray FastFile_COD10_360::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,10 +106,13 @@ bool FastFile_COD10_360::Load(const QByteArray aData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||||
ZoneFile_COD10_360 zoneFile;
|
ZoneFile_COD10_360* zoneFile = new ZoneFile_COD10_360();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD10_360>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD10_360(const QString aFilePath);
|
FastFile_COD10_360(const QString aFilePath);
|
||||||
~FastFile_COD10_360();
|
~FastFile_COD10_360();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -38,7 +38,7 @@ FastFile_COD11_360::~FastFile_COD11_360() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD11_360::GetBinaryData() {
|
QByteArray FastFile_COD11_360::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,14 +94,13 @@ bool FastFile_COD11_360::Load(const QByteArray aData) {
|
|||||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||||
|
|
||||||
// Load the zone file with decompressed data
|
// Load the zone file with decompressed data
|
||||||
ZoneFile_COD11_360 zoneFile;
|
ZoneFile_COD11_360* zoneFile = new ZoneFile_COD11_360();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
if (!zoneFile.Load(decompressedData)) {
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
qWarning() << "Failed to load ZoneFile!";
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD11_360>(zoneFile));
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD11_360(const QString aFilePath);
|
FastFile_COD11_360(const QString aFilePath);
|
||||||
~FastFile_COD11_360();
|
~FastFile_COD11_360();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -38,7 +38,7 @@ FastFile_COD12_360::~FastFile_COD12_360() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD12_360::GetBinaryData() {
|
QByteArray FastFile_COD12_360::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,14 +94,13 @@ bool FastFile_COD12_360::Load(const QByteArray aData) {
|
|||||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||||
|
|
||||||
// Load the zone file with decompressed data
|
// Load the zone file with decompressed data
|
||||||
ZoneFile_COD12_360 zoneFile;
|
ZoneFile_COD12_360* zoneFile = new ZoneFile_COD12_360();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
if (!zoneFile.Load(decompressedData)) {
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
qWarning() << "Failed to load ZoneFile!";
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD12_360>(zoneFile));
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD12_360(const QString aFilePath);
|
FastFile_COD12_360(const QString aFilePath);
|
||||||
~FastFile_COD12_360();
|
~FastFile_COD12_360();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -38,7 +38,7 @@ FastFile_COD2_360::~FastFile_COD2_360() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD2_360::GetBinaryData() {
|
QByteArray FastFile_COD2_360::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,10 +79,13 @@ bool FastFile_COD2_360::Load(const QByteArray aData) {
|
|||||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||||
|
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||||
ZoneFile_COD2_360 zoneFile;
|
ZoneFile_COD2_360* zoneFile = new ZoneFile_COD2_360();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD2_360>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD2_360(const QString aFilePath);
|
FastFile_COD2_360(const QString aFilePath);
|
||||||
~FastFile_COD2_360();
|
~FastFile_COD2_360();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ FastFile_COD4_360::~FastFile_COD4_360() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD4_360::GetBinaryData() {
|
QByteArray FastFile_COD4_360::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,14 +126,15 @@ bool FastFile_COD4_360::Load(const QByteArray aData) {
|
|||||||
}
|
}
|
||||||
decompressedData = Compression::DecompressZLIB(compressedData);
|
decompressedData = Compression::DecompressZLIB(compressedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||||
|
|
||||||
ZoneFile_COD4_360 zoneFile;
|
ZoneFile_COD4_360* zoneFile = new ZoneFile_COD4_360();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD4_360>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD4_360(const QString aFilePath);
|
FastFile_COD4_360(const QString aFilePath);
|
||||||
~FastFile_COD4_360();
|
~FastFile_COD4_360();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ FastFile_COD5_360::~FastFile_COD5_360() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD5_360::GetBinaryData() {
|
QByteArray FastFile_COD5_360::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,10 +80,13 @@ bool FastFile_COD5_360::Load(const QByteArray aData) {
|
|||||||
|
|
||||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||||
|
|
||||||
ZoneFile_COD5_360 zoneFile;
|
ZoneFile_COD5_360* zoneFile = new ZoneFile_COD5_360();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD5_360>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD5_360(const QString aFilePath);
|
FastFile_COD5_360(const QString aFilePath);
|
||||||
~FastFile_COD5_360();
|
~FastFile_COD5_360();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ FastFile_COD6_360::~FastFile_COD6_360() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD6_360::GetBinaryData() {
|
QByteArray FastFile_COD6_360::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,31 +78,30 @@ bool FastFile_COD6_360::Load(const QByteArray aData) {
|
|||||||
}
|
}
|
||||||
QByteArray compressed = aData.mid(zlibOffset);
|
QByteArray compressed = aData.mid(zlibOffset);
|
||||||
|
|
||||||
// 2. Try plain decompression first ------------------------------
|
QByteArray decompressedData = Compression::DecompressZLIB(compressed);
|
||||||
QByteArray decompressed = Compression::DecompressZLIB(compressed);
|
|
||||||
|
|
||||||
// 3. If that failed or looks too small, try stripping hash blocks
|
if (decompressedData.isEmpty() || decompressedData.size() < 1024)
|
||||||
if (decompressed.isEmpty() || decompressed.size() < 1024)
|
|
||||||
{
|
{
|
||||||
QByteArray stripped = Compression::StripHashBlocks(compressed);
|
QByteArray stripped = Compression::StripHashBlocks(compressed);
|
||||||
QByteArray retry = Compression::DecompressZLIB(stripped);
|
QByteArray retry = Compression::DecompressZLIB(stripped);
|
||||||
if (!retry.isEmpty())
|
if (!retry.isEmpty())
|
||||||
decompressed.swap(retry);
|
decompressedData.swap(retry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decompressed.isEmpty())
|
if (decompressedData.isEmpty())
|
||||||
{
|
{
|
||||||
qWarning() << "Unable to decompress fast-file";
|
qWarning() << "Unable to decompress fast-file";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optional – keep a copy on disk for quick inspection
|
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||||
Utils::ExportData(GetBaseStem() + ".zone", decompressed);
|
|
||||||
|
|
||||||
// 4. Forward to zone-file loader --------------------------------
|
ZoneFile_COD6_360* zoneFile = new ZoneFile_COD6_360();
|
||||||
auto zoneFile = std::make_shared<ZoneFile_COD6_360>();
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile->SetStem(GetStem());
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
zoneFile->Load(decompressed);
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
SetZoneFile(zoneFile);
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD6_360(const QString aFilePath);
|
FastFile_COD6_360(const QString aFilePath);
|
||||||
~FastFile_COD6_360();
|
~FastFile_COD6_360();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -38,7 +38,7 @@ FastFile_COD7_360::~FastFile_COD7_360() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD7_360::GetBinaryData() {
|
QByteArray FastFile_COD7_360::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,10 +73,7 @@ bool FastFile_COD7_360::Load(const QByteArray aData) {
|
|||||||
|
|
||||||
// Create a QDataStream on the input data.
|
// Create a QDataStream on the input data.
|
||||||
QDataStream fastFileStream(aData);
|
QDataStream fastFileStream(aData);
|
||||||
|
fastFileStream.skipRawData(12);
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
|
||||||
ZoneFile_COD7_360 zoneFile;
|
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
|
||||||
|
|
||||||
// For COD7/COD9, use BigEndian.
|
// For COD7/COD9, use BigEndian.
|
||||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||||
@ -142,10 +139,15 @@ bool FastFile_COD7_360::Load(const QByteArray aData) {
|
|||||||
|
|
||||||
sectionIndex++;
|
sectionIndex++;
|
||||||
}
|
}
|
||||||
|
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||||
|
|
||||||
zoneFile.Load(decompressedData);
|
ZoneFile_COD7_360* zoneFile = new ZoneFile_COD7_360();
|
||||||
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD7_360>(zoneFile));
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD7_360(const QString aFilePath);
|
FastFile_COD7_360(const QString aFilePath);
|
||||||
~FastFile_COD7_360();
|
~FastFile_COD7_360();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ FastFile_COD8_360::~FastFile_COD8_360() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD8_360::GetBinaryData() {
|
QByteArray FastFile_COD8_360::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,10 +106,13 @@ bool FastFile_COD8_360::Load(const QByteArray aData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||||
ZoneFile_COD8_360 zoneFile;
|
ZoneFile_COD8_360* zoneFile = new ZoneFile_COD8_360();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD8_360>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD8_360(const QString aFilePath);
|
FastFile_COD8_360(const QString aFilePath);
|
||||||
~FastFile_COD8_360();
|
~FastFile_COD8_360();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ FastFile_COD9_360::~FastFile_COD9_360() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD9_360::GetBinaryData() {
|
QByteArray FastFile_COD9_360::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,10 +106,13 @@ bool FastFile_COD9_360::Load(const QByteArray aData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||||
ZoneFile_COD9_360 zoneFile;
|
ZoneFile_COD9_360* zoneFile = new ZoneFile_COD9_360();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD9_360>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD9_360(const QString aFilePath);
|
FastFile_COD9_360(const QString aFilePath);
|
||||||
~FastFile_COD9_360();
|
~FastFile_COD9_360();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ FastFile_COD10_PC::~FastFile_COD10_PC() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD10_PC::GetBinaryData() {
|
QByteArray FastFile_COD10_PC::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,10 +128,13 @@ bool FastFile_COD10_PC::Load(const QByteArray aData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||||
ZoneFile_COD10_PC zoneFile;
|
ZoneFile_COD10_PC* zoneFile = new ZoneFile_COD10_PC();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD10_PC>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD10_PC(const QString aFilePath);
|
FastFile_COD10_PC(const QString aFilePath);
|
||||||
~FastFile_COD10_PC();
|
~FastFile_COD10_PC();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ FastFile_COD11_PC::~FastFile_COD11_PC() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD11_PC::GetBinaryData() {
|
QByteArray FastFile_COD11_PC::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,10 +128,13 @@ bool FastFile_COD11_PC::Load(const QByteArray aData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||||
ZoneFile_COD11_PC zoneFile;
|
ZoneFile_COD11_PC* zoneFile = new ZoneFile_COD11_PC();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD11_PC>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD11_PC(const QString aFilePath);
|
FastFile_COD11_PC(const QString aFilePath);
|
||||||
~FastFile_COD11_PC();
|
~FastFile_COD11_PC();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ FastFile_COD12_PC::~FastFile_COD12_PC() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD12_PC::GetBinaryData() {
|
QByteArray FastFile_COD12_PC::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,10 +76,6 @@ bool FastFile_COD12_PC::Load(const QByteArray aData) {
|
|||||||
QDataStream fastFileStream(aData);
|
QDataStream fastFileStream(aData);
|
||||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||||
|
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
|
||||||
ZoneFile_COD12_PC zoneFile;
|
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
|
||||||
|
|
||||||
// Skip header magic
|
// Skip header magic
|
||||||
fastFileStream.skipRawData(8);
|
fastFileStream.skipRawData(8);
|
||||||
|
|
||||||
@ -143,9 +139,14 @@ bool FastFile_COD12_PC::Load(const QByteArray aData) {
|
|||||||
|
|
||||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||||
|
|
||||||
zoneFile.Load(decompressedData);
|
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||||
|
ZoneFile_COD12_PC* zoneFile = new ZoneFile_COD12_PC();
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD12_PC>(zoneFile));
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD12_PC(const QString aFilePath);
|
FastFile_COD12_PC(const QString aFilePath);
|
||||||
~FastFile_COD12_PC();
|
~FastFile_COD12_PC();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ FastFile_COD4_PC::~FastFile_COD4_PC() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD4_PC::GetBinaryData() {
|
QByteArray FastFile_COD4_PC::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,10 +84,13 @@ bool FastFile_COD4_PC::Load(const QByteArray aData) {
|
|||||||
|
|
||||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||||
|
|
||||||
ZoneFile_COD4_PC zoneFile;
|
ZoneFile_COD4_PC* zoneFile = new ZoneFile_COD4_PC();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD4_PC>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD4_PC(const QString aFilePath);
|
FastFile_COD4_PC(const QString aFilePath);
|
||||||
~FastFile_COD4_PC();
|
~FastFile_COD4_PC();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ FastFile_COD5_PC::~FastFile_COD5_PC() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD5_PC::GetBinaryData() {
|
QByteArray FastFile_COD5_PC::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,10 +84,13 @@ bool FastFile_COD5_PC::Load(const QByteArray aData) {
|
|||||||
|
|
||||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||||
|
|
||||||
ZoneFile_COD5_PC zoneFile;
|
ZoneFile_COD5_PC* zoneFile = new ZoneFile_COD5_PC();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD5_PC>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD5_PC(const QString aFilePath);
|
FastFile_COD5_PC(const QString aFilePath);
|
||||||
~FastFile_COD5_PC();
|
~FastFile_COD5_PC();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ FastFile_COD6_PC::~FastFile_COD6_PC() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD6_PC::GetBinaryData() {
|
QByteArray FastFile_COD6_PC::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,10 +81,13 @@ bool FastFile_COD6_PC::Load(const QByteArray aData) {
|
|||||||
|
|
||||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||||
|
|
||||||
ZoneFile_COD6_PC zoneFile;
|
ZoneFile_COD6_PC* zoneFile = new ZoneFile_COD6_PC();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD6_PC>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD6_PC(const QString aFilePath);
|
FastFile_COD6_PC(const QString aFilePath);
|
||||||
~FastFile_COD6_PC();
|
~FastFile_COD6_PC();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ FastFile_COD7_PC::~FastFile_COD7_PC() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD7_PC::GetBinaryData() {
|
QByteArray FastFile_COD7_PC::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,88 +83,22 @@ bool FastFile_COD7_PC::Load(const QByteArray aData) {
|
|||||||
SetMagic(pParseFFMagic(&fastFileStream));
|
SetMagic(pParseFFMagic(&fastFileStream));
|
||||||
quint32 version = pParseFFVersion(&fastFileStream);
|
quint32 version = pParseFFVersion(&fastFileStream);
|
||||||
SetVersion(version);
|
SetVersion(version);
|
||||||
SetPlatform(pCalculateFFPlatform(version));
|
SetPlatform("360");
|
||||||
SetGame("COD7");
|
SetGame("COD7");
|
||||||
|
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
// Assume the first 12 bytes are a header; the rest is zlib-compressed zone data.
|
||||||
ZoneFile_COD7_PC zoneFile;
|
const QByteArray compressedData = aData.mid(12);
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
decompressedData = Compression::DecompressZLIB(compressedData);
|
||||||
|
|
||||||
// For COD7/COD9, use BigEndian.
|
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
|
||||||
|
|
||||||
// Select key based on game.
|
ZoneFile_COD7_PC* zoneFile = new ZoneFile_COD7_PC();
|
||||||
QByteArray key;
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
fastFileStream.skipRawData(4);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
if (GetPlatform() == "360") {
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
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;
|
return false;
|
||||||
}
|
}
|
||||||
fastFileStream.skipRawData(4);
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
// Read IV table name (32 bytes).
|
|
||||||
QByteArray fileName(32, Qt::Uninitialized);
|
|
||||||
fastFileStream.readRawData(fileName.data(), 32);
|
|
||||||
|
|
||||||
// Build the IV table from the fileName.
|
|
||||||
QByteArray ivTable = Encryption::InitIVTable(fileName);
|
|
||||||
|
|
||||||
// Skip the RSA signature (256 bytes).
|
|
||||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
|
||||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
|
||||||
|
|
||||||
// Now the stream should be positioned at 0x13C, where sections begin.
|
|
||||||
int sectionIndex = 0;
|
|
||||||
while (true) {
|
|
||||||
qint32 sectionSize = 0;
|
|
||||||
fastFileStream >> sectionSize;
|
|
||||||
qDebug() << "Section index:" << sectionIndex << "Size:" << sectionSize
|
|
||||||
<< "Pos:" << fastFileStream.device()->pos();
|
|
||||||
if (sectionSize == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Read the section data.
|
|
||||||
QByteArray sectionData;
|
|
||||||
sectionData.resize(sectionSize);
|
|
||||||
fastFileStream.readRawData(sectionData.data(), sectionSize);
|
|
||||||
|
|
||||||
// Compute the IV for this section.
|
|
||||||
QByteArray iv = Encryption::GetIV(ivTable, sectionIndex);
|
|
||||||
|
|
||||||
// Decrypt the section using Salsa20.
|
|
||||||
QByteArray decData = Encryption::salsa20DecryptSection(sectionData, key, iv);
|
|
||||||
|
|
||||||
// Compute SHA1 hash of the decrypted data.
|
|
||||||
QByteArray sectionHash = QCryptographicHash::hash(decData, QCryptographicHash::Sha1);
|
|
||||||
|
|
||||||
// Update the IV table based on the section hash.
|
|
||||||
Encryption::UpdateIVTable(ivTable, sectionIndex, sectionHash);
|
|
||||||
|
|
||||||
// Build a compressed data buffer by prepending the two-byte zlib header.
|
|
||||||
QByteArray compressedData;
|
|
||||||
compressedData.append(char(0x78));
|
|
||||||
compressedData.append(char(0x01));
|
|
||||||
compressedData.append(decData);
|
|
||||||
|
|
||||||
decompressedData.append(Compression::DecompressZLIB(compressedData));
|
|
||||||
|
|
||||||
sectionIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
zoneFile.Load(decompressedData);
|
|
||||||
|
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD7_PC>(zoneFile));
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD7_PC(const QString aFilePath);
|
FastFile_COD7_PC(const QString aFilePath);
|
||||||
~FastFile_COD7_PC();
|
~FastFile_COD7_PC();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ FastFile_COD8_PC::~FastFile_COD8_PC() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD8_PC::GetBinaryData() {
|
QByteArray FastFile_COD8_PC::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,10 +86,6 @@ bool FastFile_COD8_PC::Load(const QByteArray aData) {
|
|||||||
SetPlatform(pCalculateFFPlatform(version));
|
SetPlatform(pCalculateFFPlatform(version));
|
||||||
SetGame("COD7");
|
SetGame("COD7");
|
||||||
|
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
|
||||||
ZoneFile_COD8_PC zoneFile;
|
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
|
||||||
|
|
||||||
// For COD7/COD9, use BigEndian.
|
// For COD7/COD9, use BigEndian.
|
||||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||||
|
|
||||||
@ -162,9 +158,13 @@ bool FastFile_COD8_PC::Load(const QByteArray aData) {
|
|||||||
sectionIndex++;
|
sectionIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
zoneFile.Load(decompressedData);
|
ZoneFile_COD8_PC* zoneFile = new ZoneFile_COD8_PC();
|
||||||
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD8_PC>(zoneFile));
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD8_PC(const QString aFilePath);
|
FastFile_COD8_PC(const QString aFilePath);
|
||||||
~FastFile_COD8_PC();
|
~FastFile_COD8_PC();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ FastFile_COD9_PC::~FastFile_COD9_PC() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD9_PC::GetBinaryData() {
|
QByteArray FastFile_COD9_PC::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,10 +128,13 @@ bool FastFile_COD9_PC::Load(const QByteArray aData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||||
ZoneFile_COD9_PC zoneFile;
|
ZoneFile_COD9_PC* zoneFile = new ZoneFile_COD9_PC();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD9_PC>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD9_PC(const QString aFilePath);
|
FastFile_COD9_PC(const QString aFilePath);
|
||||||
~FastFile_COD9_PC();
|
~FastFile_COD9_PC();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ FastFile_COD10_PS3::~FastFile_COD10_PS3() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD10_PS3::GetBinaryData() {
|
QByteArray FastFile_COD10_PS3::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,10 +128,13 @@ bool FastFile_COD10_PS3::Load(const QByteArray aData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||||
ZoneFile_COD10_PS3 zoneFile;
|
ZoneFile_COD10_PS3* zoneFile = new ZoneFile_COD10_PS3();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD10_PS3>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD10_PS3(const QString aFilePath);
|
FastFile_COD10_PS3(const QString aFilePath);
|
||||||
~FastFile_COD10_PS3();
|
~FastFile_COD10_PS3();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ FastFile_COD11_PS3::~FastFile_COD11_PS3() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD11_PS3::GetBinaryData() {
|
QByteArray FastFile_COD11_PS3::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,10 +128,13 @@ bool FastFile_COD11_PS3::Load(const QByteArray aData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||||
ZoneFile_COD11_PS3 zoneFile;
|
ZoneFile_COD11_PS3* zoneFile = new ZoneFile_COD11_PS3();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD11_PS3>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD11_PS3(const QString aFilePath);
|
FastFile_COD11_PS3(const QString aFilePath);
|
||||||
~FastFile_COD11_PS3();
|
~FastFile_COD11_PS3();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ FastFile_COD12_PS3::~FastFile_COD12_PS3() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD12_PS3::GetBinaryData() {
|
QByteArray FastFile_COD12_PS3::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,10 +128,13 @@ bool FastFile_COD12_PS3::Load(const QByteArray aData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||||
ZoneFile_COD12_PS3 zoneFile;
|
ZoneFile_COD12_PS3* zoneFile = new ZoneFile_COD12_PS3();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD12_PS3>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD12_PS3(const QString aFilePath);
|
FastFile_COD12_PS3(const QString aFilePath);
|
||||||
~FastFile_COD12_PS3();
|
~FastFile_COD12_PS3();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ FastFile_COD4_PS3::~FastFile_COD4_PS3() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD4_PS3::GetBinaryData() {
|
QByteArray FastFile_COD4_PS3::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,10 +111,13 @@ bool FastFile_COD4_PS3::Load(const QByteArray aData) {
|
|||||||
|
|
||||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||||
|
|
||||||
ZoneFile_COD4_PS3 zoneFile;
|
ZoneFile_COD4_PS3* zoneFile = new ZoneFile_COD4_PS3();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD4_PS3>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD4_PS3(const QString aFilePath);
|
FastFile_COD4_PS3(const QString aFilePath);
|
||||||
~FastFile_COD4_PS3();
|
~FastFile_COD4_PS3();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ FastFile_COD5_PS3::~FastFile_COD5_PS3() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD5_PS3::GetBinaryData() {
|
QByteArray FastFile_COD5_PS3::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,10 +111,13 @@ bool FastFile_COD5_PS3::Load(const QByteArray aData) {
|
|||||||
|
|
||||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||||
|
|
||||||
ZoneFile_COD5_PS3 zoneFile;
|
ZoneFile_COD5_PS3* zoneFile = new ZoneFile_COD5_PS3();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD5_PS3>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD5_PS3(const QString aFilePath);
|
FastFile_COD5_PS3(const QString aFilePath);
|
||||||
~FastFile_COD5_PS3();
|
~FastFile_COD5_PS3();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ FastFile_COD6_PS3::~FastFile_COD6_PS3() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD6_PS3::GetBinaryData() {
|
QByteArray FastFile_COD6_PS3::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,10 +95,13 @@ bool FastFile_COD6_PS3::Load(const QByteArray aData) {
|
|||||||
|
|
||||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||||
|
|
||||||
ZoneFile_COD6_PS3 zoneFile;
|
ZoneFile_COD6_PS3* zoneFile = new ZoneFile_COD6_PS3();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD6_PS3>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD6_PS3(const QString aFilePath);
|
FastFile_COD6_PS3(const QString aFilePath);
|
||||||
~FastFile_COD6_PS3();
|
~FastFile_COD6_PS3();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ FastFile_COD7_PS3::~FastFile_COD7_PS3() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD7_PS3::GetBinaryData() {
|
QByteArray FastFile_COD7_PS3::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,8 +87,8 @@ bool FastFile_COD7_PS3::Load(const QByteArray aData) {
|
|||||||
SetGame("COD7");
|
SetGame("COD7");
|
||||||
|
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||||
ZoneFile_COD7_PS3 zoneFile;
|
ZoneFile_COD7_PS3* zoneFile = new ZoneFile_COD7_PS3();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
|
|
||||||
// For COD7/COD9, use BigEndian.
|
// For COD7/COD9, use BigEndian.
|
||||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||||
@ -164,10 +164,12 @@ bool FastFile_COD7_PS3::Load(const QByteArray aData) {
|
|||||||
sectionIndex++;
|
sectionIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD7_PS3>(zoneFile));
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD7_PS3(const QString aFilePath);
|
FastFile_COD7_PS3(const QString aFilePath);
|
||||||
~FastFile_COD7_PS3();
|
~FastFile_COD7_PS3();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ FastFile_COD8_PS3::~FastFile_COD8_PS3() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD8_PS3::GetBinaryData() {
|
QByteArray FastFile_COD8_PS3::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,9 +86,8 @@ bool FastFile_COD8_PS3::Load(const QByteArray aData) {
|
|||||||
SetPlatform(pCalculateFFPlatform(version));
|
SetPlatform(pCalculateFFPlatform(version));
|
||||||
SetGame("COD7");
|
SetGame("COD7");
|
||||||
|
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
ZoneFile_COD8_PS3* zoneFile = new ZoneFile_COD8_PS3();
|
||||||
ZoneFile_COD8_PS3 zoneFile;
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
|
||||||
|
|
||||||
// For COD7/COD9, use BigEndian.
|
// For COD7/COD9, use BigEndian.
|
||||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||||
@ -164,10 +163,13 @@ bool FastFile_COD8_PS3::Load(const QByteArray aData) {
|
|||||||
sectionIndex++;
|
sectionIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD8_PS3>(zoneFile));
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public:
|
|||||||
FastFile_COD8_PS3(const QString aFilePath);
|
FastFile_COD8_PS3(const QString aFilePath);
|
||||||
~FastFile_COD8_PS3();
|
~FastFile_COD8_PS3();
|
||||||
|
|
||||||
QByteArray GetBinaryData() override;
|
QByteArray GetBinaryData() const override;
|
||||||
|
|
||||||
bool Load(const QString aFilePath) override;
|
bool Load(const QString aFilePath) override;
|
||||||
bool Load(const QByteArray aData) override;
|
bool Load(const QByteArray aData) override;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ FastFile_COD9_PS3::~FastFile_COD9_PS3() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray FastFile_COD9_PS3::GetBinaryData() {
|
QByteArray FastFile_COD9_PS3::GetBinaryData() const {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,10 +128,13 @@ bool FastFile_COD9_PS3::Load(const QByteArray aData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||||
ZoneFile_COD9_PS3 zoneFile;
|
ZoneFile_COD9_PS3* zoneFile = new ZoneFile_COD9_PS3();
|
||||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||||
zoneFile.Load(decompressedData);
|
if (!zoneFile->Load(decompressedData)) {
|
||||||
SetZoneFile(std::make_shared<ZoneFile_COD9_PS3>(zoneFile));
|
qWarning() << "Failed to load ZoneFile!";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SetZoneFile(zoneFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user