Woah lotta new stuff
This commit is contained in:
parent
009a99418f
commit
bba00a1c3f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
109
XPlor.pro
109
XPlor.pro
@ -1,99 +1,12 @@
|
||||
QT += core gui multimedia
|
||||
TEMPLATE = subdirs
|
||||
|
||||
RC_ICONS = XPlor.ico
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
CONFIG += c++17
|
||||
|
||||
SOURCES += \
|
||||
aboutdialog.cpp \
|
||||
ddsfile.cpp \
|
||||
ddsviewer.cpp \
|
||||
fastfile.cpp \
|
||||
fastfile_cod2.cpp \
|
||||
fastfile_cod5.cpp \
|
||||
fastfile_cod7.cpp \
|
||||
fastfile_cod9.cpp \
|
||||
fastfileviewer.cpp \
|
||||
imagewidget.cpp \
|
||||
iwifile.cpp \
|
||||
iwiviewer.cpp \
|
||||
localstringviewer.cpp \
|
||||
lzokay.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
iwifile.cpp \
|
||||
preferenceeditor.cpp \
|
||||
soundviewer.cpp \
|
||||
statusbarmanager.cpp \
|
||||
stringtableviewer.cpp \
|
||||
techsetviewer.cpp \
|
||||
xtreewidget.cpp \
|
||||
xtreewidgetitem.cpp \
|
||||
zonefile.cpp \
|
||||
zonefile_cod2.cpp \
|
||||
zonefile_cod5.cpp \
|
||||
zonefile_cod7.cpp \
|
||||
zonefile_cod9.cpp \
|
||||
zonefileviewer.cpp
|
||||
|
||||
HEADERS += \
|
||||
aboutdialog.h \
|
||||
asset_structs.h \
|
||||
compressor.h \
|
||||
d3dbsp_structs.h \
|
||||
dds_structs.h \
|
||||
ddsfile.h \
|
||||
ddsviewer.h \
|
||||
enums.h \
|
||||
fastfile.h \
|
||||
fastfile_cod2.h \
|
||||
fastfile_cod5.h \
|
||||
fastfile_cod7.h \
|
||||
fastfile_cod9.h \
|
||||
fastfileviewer.h \
|
||||
imagewidget.h \
|
||||
ipak_structs.h \
|
||||
iwifile.h \
|
||||
iwiviewer.h \
|
||||
localstringviewer.h \
|
||||
lzokay.hpp \
|
||||
lzx.h \
|
||||
mainwindow.h \
|
||||
preferenceeditor.h \
|
||||
soundviewer.h \
|
||||
statusbarmanager.h \
|
||||
stringtableviewer.h \
|
||||
techsetviewer.h \
|
||||
utils.h \
|
||||
xtreewidget.h \
|
||||
iwifile.h \
|
||||
xtreewidgetitem.h \
|
||||
zonefile.h \
|
||||
zonefile_cod2.h \
|
||||
zonefile_cod5.h \
|
||||
zonefile_cod7.h \
|
||||
zonefile_cod9.h \
|
||||
zonefileviewer.h
|
||||
|
||||
FORMS += \
|
||||
aboutdialog.ui \
|
||||
ddsviewer.ui \
|
||||
fastfileviewer.ui \
|
||||
imagewidget.ui \
|
||||
iwiviewer.ui \
|
||||
localstringviewer.ui \
|
||||
mainwindow.ui \
|
||||
modelviewer.ui \
|
||||
preferenceeditor.ui \
|
||||
soundviewer.ui \
|
||||
stringtableviewer.ui \
|
||||
techsetviewer.ui \
|
||||
zonefileviewer.ui
|
||||
|
||||
RESOURCES += data/data.qrc
|
||||
|
||||
LIBS += -L$$PWD/DevILSDK/lib/x64/Unicode/Release -lDevIL
|
||||
LIBS += -L$$PWD/DevILSDK/lib/x64/Unicode/Release -lILU
|
||||
LIBS += -L$$PWD/DevILSDK/lib/x64/Unicode/Release -lILUT
|
||||
SUBDIRS += libs/core \
|
||||
libs/compression \
|
||||
libs/encryption \
|
||||
libs/fastfile \
|
||||
libs/zonefile \
|
||||
libs/ddsfile \
|
||||
libs/iwifile \
|
||||
libs/ipakfile \
|
||||
app \
|
||||
tests
|
||||
|
||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
111
app/app.pro
Normal file
111
app/app.pro
Normal file
@ -0,0 +1,111 @@
|
||||
QT += core widgets gui multimedia
|
||||
|
||||
RC_ICONS = app.ico
|
||||
|
||||
SUBDIRS += app
|
||||
|
||||
CONFIG += c++17
|
||||
|
||||
SOURCES += \
|
||||
aboutdialog.cpp \
|
||||
ddsviewer.cpp \
|
||||
fastfileviewer.cpp \
|
||||
imagewidget.cpp \
|
||||
iwiviewer.cpp \
|
||||
localstringviewer.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
materialviewer.cpp \
|
||||
preferenceeditor.cpp \
|
||||
soundviewer.cpp \
|
||||
stringtableviewer.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 \
|
||||
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 \
|
||||
techsetviewer.ui \
|
||||
zonefileviewer.ui
|
||||
|
||||
RESOURCES += ../data/data.qrc
|
||||
|
||||
app.depends += \
|
||||
libs/core \
|
||||
libs/compression \
|
||||
libs/encryption \
|
||||
libs/fastfile \
|
||||
libs/ddsfile \
|
||||
libs/ipakfile \
|
||||
libs/iwifile \
|
||||
libs/zonefile
|
||||
|
||||
LIBS += \
|
||||
-L$$PWD/../third_party/devil_sdk/lib/ -lDevIL \
|
||||
-L$$PWD/../third_party/devil_sdk/lib/ -lILU \
|
||||
-L$$PWD/../third_party/devil_sdk/lib/ -lILUT \
|
||||
-L$$PWD/../third_party/zlib/lib/ -lzlib \
|
||||
-L$$OUT_PWD/../libs/ -lcore \
|
||||
-L$$OUT_PWD/../libs/ -lcompression \
|
||||
# -L$$OUT_PWD/../libs/ -lencryption \
|
||||
-L$$OUT_PWD/../libs/ -lfastfile \
|
||||
-L$$OUT_PWD/../libs/ -lddsfile \
|
||||
# -L$$OUT_PWD/../libs/ -lipakfile \
|
||||
-L$$OUT_PWD/../libs/ -liwifile \
|
||||
-L$$OUT_PWD/../libs/ -lzonefile
|
||||
|
||||
message($$OUT_PWD/../libs/core)
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/../third_party/devil_sdk/include/ \
|
||||
$$PWD/../third_party/zlib/include \
|
||||
$$PWD/../libs/core \
|
||||
$$PWD/../libs/compression \
|
||||
$$PWD/../libs/encryption \
|
||||
$$PWD/../libs/fastfile \
|
||||
$$PWD/../libs/ddsfile \
|
||||
$$PWD/../libs/ipakfile \
|
||||
$$PWD/../libs/iwifile \
|
||||
$$PWD/../libs/zonefile
|
||||
|
||||
DEPENDPATH += \
|
||||
$$PWD/../third_party/devil_sdk/include/ \
|
||||
$$PWD/../third_party/zlib_lib/include \
|
||||
$$PWD/../libs/core \
|
||||
$$PWD/../libs/compression \
|
||||
$$PWD/../libs/encryption \
|
||||
$$PWD/../libs/fastfile \
|
||||
$$PWD/../libs/ddsfile \
|
||||
$$PWD/../libs/ipakfile \
|
||||
$$PWD/../libs/iwifile \
|
||||
$$PWD/../libs/zonefile
|
||||
@ -1,22 +1,29 @@
|
||||
#include "mainwindow.h"
|
||||
#include "aboutdialog.h"
|
||||
#include "fastfile.h"
|
||||
#include "materialviewer.h"
|
||||
#include "preferenceeditor.h"
|
||||
#include "qheaderview.h"
|
||||
#include "soundviewer.h"
|
||||
#include "stringtableviewer.h"
|
||||
#include "techsetviewer.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "compressor.h"
|
||||
#include "dds_structs.h"
|
||||
#include "iwifile.h"
|
||||
#include "ddsfile.h"
|
||||
#include "statusbarmanager.h"
|
||||
#include "ddsviewer.h"
|
||||
#include "fastfileviewer.h"
|
||||
#include "ipak_structs.h"
|
||||
#include "iwiviewer.h"
|
||||
#include "localstringviewer.h"
|
||||
#include "imagewidget.h"
|
||||
#include "xtreewidget.h"
|
||||
#include "zonefileviewer.h"
|
||||
#include "techsetviewer.h"
|
||||
#include "logmanager.h"
|
||||
|
||||
#include <qmath.h>
|
||||
|
||||
#include "DevILSDK/include/IL/il.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent), ui(new Ui::MainWindow) {
|
||||
ui->setupUi(this);
|
||||
@ -34,6 +41,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
mDiskLumpOrder = QVector<quint32>();
|
||||
mLumps = QMap<quint32, Lump>();
|
||||
mTreeWidget = new XTreeWidget(this);
|
||||
mLogWidget = new QPlainTextEdit(this);
|
||||
|
||||
//ModelViewer *mModelViewer = new ModelViewer(container);
|
||||
//mModelViewer->setAcceptDrops(false);
|
||||
@ -48,6 +56,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
connect(&StatusBarManager::instance(), &StatusBarManager::progressUpdated,
|
||||
this, &MainWindow::HandleProgressUpdate);
|
||||
|
||||
connect(&LogManager::instance(), &LogManager::entryAdded,
|
||||
this, &MainWindow::HandleLogEntry);
|
||||
|
||||
statusBar()->addPermanentWidget(mProgressBar);
|
||||
|
||||
connect(ui->actionPreferences, &QAction::triggered, this, [this](bool checked) {
|
||||
@ -131,9 +142,10 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->tabWidget->clear();
|
||||
});
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::RawFileSelected, this, [this](std::shared_ptr<RawFile> rawFile) {
|
||||
connect(mTreeWidget, &XTreeWidget::RawFileSelected, this, [this](std::shared_ptr<RawFile> rawFile, const QString aParentName) {
|
||||
QPlainTextEdit *scriptEditor = new QPlainTextEdit(this);
|
||||
scriptEditor->setAcceptDrops(false);
|
||||
scriptEditor->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||
|
||||
if (rawFile->contents.isEmpty()) {
|
||||
scriptEditor->setPlainText("EMPTY");
|
||||
@ -153,10 +165,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||
});
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::ImageSelected, this, [this](std::shared_ptr<Image> image) {
|
||||
connect(mTreeWidget, &XTreeWidget::ImageSelected, this, [this](std::shared_ptr<Image> image, const QString aParentName) {
|
||||
ImageWidget *mImageWidget = new ImageWidget(this);
|
||||
mImageWidget->setAcceptDrops(false);
|
||||
mImageWidget->SetImage(image);
|
||||
mImageWidget->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||
|
||||
QString fileStem = image->materialName;
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
@ -170,14 +183,15 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||
});
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::MenuSelected, this, [this](std::shared_ptr<Menu> menu) {
|
||||
connect(mTreeWidget, &XTreeWidget::MenuSelected, this, [](std::shared_ptr<Menu> menu, const QString aParentName) {
|
||||
Q_UNUSED(menu);
|
||||
});
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::DDSFileSelected, this, [this](std::shared_ptr<DDSFile> ddsFile) {
|
||||
connect(mTreeWidget, &XTreeWidget::DDSFileSelected, this, [this](std::shared_ptr<DDSFile> ddsFile, const QString aParentName) {
|
||||
DDSViewer *ddsViewer = new DDSViewer(this);
|
||||
ddsViewer->setAcceptDrops(false);
|
||||
ddsViewer->SetDDSFile(ddsFile);
|
||||
ddsViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||
|
||||
QString fileStem = ddsFile->fileStem + ".dds";
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
@ -191,10 +205,47 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||
});
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::IWIFileSelected, this, [this](std::shared_ptr<IWIFile> iwiFile) {
|
||||
connect(mTreeWidget, &XTreeWidget::MaterialSelected, this, [this](std::shared_ptr<Material> material, const QString aParentName) {
|
||||
MaterialViewer *matViewer = new MaterialViewer(this);
|
||||
matViewer->setAcceptDrops(false);
|
||||
matViewer->SetMaterial(material);
|
||||
matViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||
|
||||
QString fileStem = material->name;
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
if (ui->tabWidget->tabText(i) == fileStem) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ui->tabWidget->addTab(matViewer, fileStem);
|
||||
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, QIcon(":/icons/icons/Icon_Material.png"));
|
||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||
});
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::DDSFileSelected, this, [this](std::shared_ptr<DDSFile> ddsFile, const QString aParentName) {
|
||||
DDSViewer *ddsViewer = new DDSViewer(this);
|
||||
ddsViewer->setAcceptDrops(false);
|
||||
ddsViewer->SetDDSFile(ddsFile);
|
||||
ddsViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||
|
||||
QString fileStem = ddsFile->fileStem + ".dds";
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
if (ui->tabWidget->tabText(i) == fileStem) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ui->tabWidget->addTab(ddsViewer, fileStem);
|
||||
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, QIcon(":/icons/icons/Icon_DDSFile.png"));
|
||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||
});
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::IWIFileSelected, this, [this](std::shared_ptr<IWIFile> iwiFile, const QString aParentName) {
|
||||
IWIViewer *iwiViewer = new IWIViewer(this);
|
||||
iwiViewer->setAcceptDrops(false);
|
||||
iwiViewer->SetIWIFile(iwiFile);
|
||||
iwiViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||
|
||||
QString fileStem = iwiFile->fileStem + ".iwi";
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
@ -208,12 +259,13 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||
});
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::FastFileSelected, this, [this](std::shared_ptr<FastFile> aFastFile) {
|
||||
connect(mTreeWidget, &XTreeWidget::FastFileSelected, this, [this](std::shared_ptr<FastFile> aFastFile, const QString aParentName) {
|
||||
FastFileViewer *fastFileViewer = new FastFileViewer(this);
|
||||
fastFileViewer->setAcceptDrops(false);
|
||||
fastFileViewer->SetFastFile(aFastFile);
|
||||
fastFileViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||
|
||||
QString fileStem = aFastFile->GetStem();
|
||||
QString fileStem = aFastFile->GetStem() + ".ff";
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
if (ui->tabWidget->tabText(i) == fileStem) {
|
||||
return;
|
||||
@ -225,12 +277,13 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||
});
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::ZoneFileSelected, this, [this](std::shared_ptr<ZoneFile> aZoneFile) {
|
||||
connect(mTreeWidget, &XTreeWidget::ZoneFileSelected, this, [this](std::shared_ptr<ZoneFile> aZoneFile, const QString aParentName) {
|
||||
ZoneFileViewer *zoneFileViewer = new ZoneFileViewer(this);
|
||||
zoneFileViewer->setAcceptDrops(false);
|
||||
zoneFileViewer->SetZoneFile(aZoneFile);
|
||||
zoneFileViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||
|
||||
QString fileStem = aZoneFile->GetStem();
|
||||
QString fileStem = aZoneFile->GetStem() + ".zone";
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
if (ui->tabWidget->tabText(i) == fileStem) {
|
||||
return;
|
||||
@ -242,10 +295,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||
});
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::LocalStringSelected, this, [this](std::shared_ptr<ZoneFile> aZoneFile) {
|
||||
connect(mTreeWidget, &XTreeWidget::LocalStringSelected, this, [this](std::shared_ptr<ZoneFile> aZoneFile, const QString aParentName) {
|
||||
LocalStringViewer *localStrViewer = new LocalStringViewer(this);
|
||||
localStrViewer->setAcceptDrops(false);
|
||||
localStrViewer->SetZoneFile(aZoneFile);
|
||||
localStrViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||
|
||||
QString fileStem = aZoneFile->GetStem() + ".str";
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
@ -259,11 +313,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||
});
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::TechSetSelected, this, [this](std::shared_ptr<TechSet> aTechSet) {
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::TechSetSelected, this, [this](std::shared_ptr<TechSet> aTechSet, const QString aParentName) {
|
||||
TechSetViewer *techSetViewer = new TechSetViewer(this);
|
||||
techSetViewer->setAcceptDrops(false);
|
||||
techSetViewer->SetTechSet(aTechSet);
|
||||
techSetViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||
|
||||
QString fileStem = aTechSet->name;
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
@ -277,11 +331,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||
});
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::StrTableSelected, this, [this](std::shared_ptr<StringTable> aStrTable) {
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::StrTableSelected, this, [this](std::shared_ptr<StringTable> aStrTable, const QString aParentName) {
|
||||
StringTableViewer *strTableViewer = new StringTableViewer(this);
|
||||
strTableViewer->setAcceptDrops(false);
|
||||
strTableViewer->SetStringTable(aStrTable);
|
||||
strTableViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||
|
||||
QString fileStem = aStrTable->name;
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
@ -295,11 +349,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||
});
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::SoundSelected, this, [this](std::shared_ptr<Sound> aSound) {
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::SoundSelected, this, [this](std::shared_ptr<Sound> aSound, const QString aParentName) {
|
||||
SoundViewer *soundViewer = new SoundViewer(this);
|
||||
soundViewer->setAcceptDrops(false);
|
||||
soundViewer->SetSound(aSound);
|
||||
soundViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
|
||||
|
||||
QString fileStem = aSound->path.split('/').last();
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
@ -313,15 +367,25 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||
});
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::TabSelected, this, [this](QString tabName) {
|
||||
connect(mTreeWidget, &XTreeWidget::ItemSelected, this, [this](const QString itemText) {
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
if (ui->tabWidget->tabText(i) == tabName) {
|
||||
if (ui->tabWidget->tabText(i) == itemText) {
|
||||
ui->tabWidget->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
connect(mTreeWidget, &XTreeWidget::ItemClosed, this, [this](const QString itemText) {
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
const QString parentName = ui->tabWidget->widget(i)->property("PARENT_NAME").toString();
|
||||
if (parentName == itemText) {
|
||||
ui->tabWidget->removeTab(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Connect Help > About dialog
|
||||
connect(ui->actionAbout, &QAction::triggered, this, [this](bool checked) {
|
||||
Q_UNUSED(checked);
|
||||
@ -345,8 +409,14 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
QDockWidget *treeDockWidget = new QDockWidget(this);
|
||||
treeDockWidget->setWidget(mTreeWidget);
|
||||
treeDockWidget->setWindowTitle("Tree Browser");
|
||||
addDockWidget(Qt::LeftDockWidgetArea, treeDockWidget);
|
||||
|
||||
QDockWidget *logDockWidget = new QDockWidget(this);
|
||||
logDockWidget->setWidget(mLogWidget);
|
||||
logDockWidget->setWindowTitle("Logs");
|
||||
addDockWidget(Qt::RightDockWidgetArea, logDockWidget);
|
||||
|
||||
ui->toolBar->addAction(ui->actionNew_Fast_File);
|
||||
ui->toolBar->addAction(ui->actionNew_Zone_File);
|
||||
ui->toolBar->addAction(ui->actionOpen_Fast_File);
|
||||
@ -390,7 +460,13 @@ void MainWindow::Reset() {
|
||||
and opens the selected file.
|
||||
*/
|
||||
bool MainWindow::OpenFastFile(const QString aFastFilePath) {
|
||||
std::shared_ptr<FastFile> fastFile = FastFile::Create(aFastFilePath);
|
||||
const QString fastFileStem = aFastFilePath.section("/", -1, -1).section('.', 0, 0);
|
||||
if (mTreeWidget->HasFastFile(fastFileStem)) {
|
||||
LogManager::instance().addError("Can't add duplicate file!");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = FastFile::Open(aFastFilePath);
|
||||
mTreeWidget->AddFastFile(fastFile);
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
@ -522,6 +598,14 @@ int MainWindow::LoadFile_DDSFiles(const QStringList aFilePaths) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MainWindow::HandleLogEntry(const QString &entry) {
|
||||
QString logContents = mLogWidget->toPlainText() + "\n" + entry;
|
||||
if (mLogWidget->toPlainText().isEmpty()) {
|
||||
logContents = entry;
|
||||
}
|
||||
mLogWidget->setPlainText(logContents);
|
||||
}
|
||||
|
||||
void MainWindow::HandleStatusUpdate(const QString &message, int timeout) {
|
||||
statusBar()->showMessage(message, timeout);
|
||||
mProgressBar->setVisible(false); // Hide progress bar if just a message
|
||||
@ -3,16 +3,7 @@
|
||||
|
||||
#include "d3dbsp_structs.h"
|
||||
#include "asset_structs.h"
|
||||
#include "ddsviewer.h"
|
||||
#include "fastfileviewer.h"
|
||||
#include "ipak_structs.h"
|
||||
#include "iwiviewer.h"
|
||||
#include "localstringviewer.h"
|
||||
#include "modelviewer.h"
|
||||
#include "imagewidget.h"
|
||||
#include "xtreewidget.h"
|
||||
#include "zonefileviewer.h"
|
||||
#include "techsetviewer.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QFileDialog>
|
||||
@ -56,6 +47,7 @@ private slots:
|
||||
int LoadFile_DDS(const QString aFilePath);
|
||||
int LoadFile_DDSFiles(const QStringList aFilePaths);
|
||||
|
||||
void HandleLogEntry(const QString &entry);
|
||||
void HandleStatusUpdate(const QString &message, int timeout);
|
||||
void HandleProgressUpdate(const QString &message, int progress, int max);
|
||||
|
||||
@ -76,6 +68,7 @@ private:
|
||||
QMap<QString, QTreeWidgetItem*> mTreeMap;
|
||||
QMap<QString, QVector<QPair<QString, QString>>> mStrTableMap;
|
||||
XTreeWidget *mTreeWidget;
|
||||
QPlainTextEdit *mLogWidget;
|
||||
QProgressBar *mProgressBar;
|
||||
|
||||
quint32 mBSPVersion;
|
||||
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>986</width>
|
||||
<height>692</height>
|
||||
<width>1579</width>
|
||||
<height>857</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
@ -46,7 +46,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>986</width>
|
||||
<width>1579</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
42
app/materialviewer.cpp
Normal file
42
app/materialviewer.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include "materialviewer.h"
|
||||
#include "ui_materialviewer.h"
|
||||
|
||||
MaterialViewer::MaterialViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::MaterialViewer) {
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
MaterialViewer::~MaterialViewer() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QString ToHexStr(quint32 in) {
|
||||
return QString("%1").arg(in, 8, 16, QChar('0')).toUpper();
|
||||
}
|
||||
|
||||
void MaterialViewer::SetMaterial(std::shared_ptr<Material> aMaterial) {
|
||||
ui->lineEdit_NamePtr->setText(ToHexStr(aMaterial->namePtr));
|
||||
ui->lineEdit_Name->setText(aMaterial->name);
|
||||
ui->lineEdit_RefPtr->setText(ToHexStr(aMaterial->refNamePtr));
|
||||
ui->lineEdit_RefName->setText(aMaterial->refName);
|
||||
ui->lineEdit_Unknowns->setText(ToHexStr(aMaterial->unknownA[0])
|
||||
+ ToHexStr(aMaterial->unknownA[1])
|
||||
+ ToHexStr(aMaterial->unknownA[2])
|
||||
+ ToHexStr(aMaterial->unknownA[3])
|
||||
+ ToHexStr(aMaterial->unknownA[4])
|
||||
+ ToHexStr(aMaterial->unknownA[5])
|
||||
+ ToHexStr(aMaterial->unknownA[6])
|
||||
+ ToHexStr(aMaterial->unknownA[7])
|
||||
+ ToHexStr(aMaterial->unknownA[8])
|
||||
+ ToHexStr(aMaterial->unknownA[9])
|
||||
+ ToHexStr(aMaterial->unknownA[10])
|
||||
+ ToHexStr(aMaterial->unknownA[11]));
|
||||
ui->lineEdit_StateA->setText(ToHexStr(aMaterial->stateBits[0]));
|
||||
ui->lineEdit_StateA->setText(ToHexStr(aMaterial->stateBits[1]));
|
||||
ui->spinBox_TextureCount->setValue(aMaterial->textureCount);
|
||||
ui->spinBox_ConstCount->setValue(aMaterial->constCount);
|
||||
ui->lineEdit_TechSetPtr->setText(ToHexStr(aMaterial->techSetPtr));
|
||||
ui->lineEdit_TexturePtr->setText(ToHexStr(aMaterial->texturePtr));
|
||||
ui->lineEdit_ConstantPtr->setText(ToHexStr(aMaterial->constPtr));
|
||||
}
|
||||
25
app/materialviewer.h
Normal file
25
app/materialviewer.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef MATERIALVIEWER_H
|
||||
#define MATERIALVIEWER_H
|
||||
|
||||
#include "asset_structs.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class MaterialViewer;
|
||||
}
|
||||
|
||||
class MaterialViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MaterialViewer(QWidget *parent = nullptr);
|
||||
~MaterialViewer();
|
||||
|
||||
void SetMaterial(std::shared_ptr<Material> aMaterial);
|
||||
|
||||
private:
|
||||
Ui::MaterialViewer *ui;
|
||||
};
|
||||
|
||||
#endif // MATERIALVIEWER_H
|
||||
236
app/materialviewer.ui
Normal file
236
app/materialviewer.ui
Normal file
@ -0,0 +1,236 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MaterialViewer</class>
|
||||
<widget class="QWidget" name="MaterialViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1001</width>
|
||||
<height>650</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Material 0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>398</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Header</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name Ptr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_NamePtr"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Ref Ptr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Ref Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Unknowns:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>State A:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>State B:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Texture Count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Name"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_RefPtr"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_RefName"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Unknowns"/>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_StateA"/>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_StateB"/>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_TextureCount"/>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_ConstCount"/>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_TechSetPtr"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Constant Count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Tech Set Ptr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Texture Ptr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Constant Ptr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_TexturePtr"/>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_ConstantPtr"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Data</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>143</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,7 +1,7 @@
|
||||
#include "xtreewidget.h"
|
||||
#include "qheaderview.h"
|
||||
#include "qmenu.h"
|
||||
#include "utils.h"
|
||||
#include "logmanager.h"
|
||||
|
||||
XTreeWidget::XTreeWidget(QWidget *parent)
|
||||
: QTreeWidget(parent) {
|
||||
@ -28,7 +28,7 @@ XTreeWidget::XTreeWidget(QWidget *parent)
|
||||
//header()->resizeSection(1, 32);
|
||||
//header()->resizeSection(2, 32);
|
||||
|
||||
connect(this, &QTreeWidget::itemSelectionChanged, this, &XTreeWidget::ItemSelectionChanged);
|
||||
connect(this, &XTreeWidget::itemSelectionChanged, this, &XTreeWidget::ItemSelectionChanged);
|
||||
connect(this, &XTreeWidget::customContextMenuRequested, this, &XTreeWidget::PrepareContextMenu);
|
||||
}
|
||||
|
||||
@ -45,7 +45,9 @@ void XTreeWidget::AddFastFile(std::shared_ptr<FastFile> aFastFile) {
|
||||
} else if (aFastFile->GetPlatform() == "360") {
|
||||
fastFileItem->setIcon(1, QIcon(":/icons/icons/Icon_Xbox.png"));
|
||||
}
|
||||
if (aFastFile->GetGame() == "COD4") {
|
||||
if (aFastFile->GetGame() == "COD2") {
|
||||
fastFileItem->setIcon(2, QIcon(":/icons/icons/Icon_COD2.png"));
|
||||
} if (aFastFile->GetGame() == "COD4") {
|
||||
fastFileItem->setIcon(2, QIcon(":/icons/icons/Icon_COD4.png"));
|
||||
} else if (aFastFile->GetGame() == "COD5") {
|
||||
fastFileItem->setIcon(2, QIcon(":/icons/icons/Icon_COD5.png"));
|
||||
@ -179,6 +181,18 @@ void XTreeWidget::AddZoneFile(std::shared_ptr<ZoneFile> aZoneFile, XTreeWidgetIt
|
||||
}
|
||||
}
|
||||
|
||||
if (!assetMap.materials.isEmpty()) {
|
||||
XTreeWidgetItem *materialsRoot = new XTreeWidgetItem(zoneItem);
|
||||
materialsRoot->setText(0, "Materials");
|
||||
materialsRoot->setIcon(0, QIcon(":/icons/icons/Icon_Material.png"));
|
||||
|
||||
for (Material material: assetMap.materials) {
|
||||
XTreeWidgetItem *materialItem = new XTreeWidgetItem(materialsRoot);
|
||||
materialItem->setText(0, material.name);
|
||||
materialItem->setIcon(0, QIcon(":/icons/icons/Icon_Material.png"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!assetMap.stringTables.isEmpty()) {
|
||||
XTreeWidgetItem *strTableRoot = new XTreeWidgetItem(zoneItem);
|
||||
strTableRoot->setText(0, "String Tables");
|
||||
@ -197,7 +211,7 @@ void XTreeWidget::AddZoneFile(std::shared_ptr<ZoneFile> aZoneFile, XTreeWidgetIt
|
||||
soundsRoot->setIcon(0, QIcon(":/icons/icons/Icon_Sound.png"));
|
||||
for (SoundAsset soundAsset : assetMap.sounds) {
|
||||
for (Sound sound : soundAsset.sounds) {
|
||||
XTreeWidgetItem *tempItem = soundsRoot;
|
||||
XTreeWidgetItem *tempItem = soundsRoot;
|
||||
|
||||
if (!sound.dataLength) { continue; }
|
||||
|
||||
@ -234,6 +248,11 @@ void XTreeWidget::AddZoneFile(std::shared_ptr<ZoneFile> aZoneFile, XTreeWidgetIt
|
||||
mZoneFiles[aZoneFile->GetStem().section(".", 0, 0)] = aZoneFile;
|
||||
}
|
||||
|
||||
void XTreeWidget::CloseFastFile(const QString aFFName) {
|
||||
const QString fileStem = aFFName.section(".", 0, 0);
|
||||
emit ItemClosed(fileStem);
|
||||
}
|
||||
|
||||
void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
||||
auto activeItem = itemAt(pos);
|
||||
if (!activeItem) { return; }
|
||||
@ -333,11 +352,13 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
||||
} else if (activeText.contains(".ff")) {
|
||||
QMenu *closeMultipleAction = new QMenu("Close Multiple Tabs");
|
||||
|
||||
|
||||
QAction *closeAllAction = new QAction("Close All");
|
||||
closeMultipleAction->addAction(closeAllAction);
|
||||
connect(closeAllAction, &QAction::triggered, this, [this](bool checked) {
|
||||
Q_UNUSED(checked);
|
||||
|
||||
mFastFiles.clear();
|
||||
clear();
|
||||
|
||||
emit Cleared();
|
||||
@ -351,6 +372,15 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
||||
for (int i = 0; i < invisibleRootItem()->childCount(); i++) {
|
||||
auto childItem = invisibleRootItem()->child(i);
|
||||
if (childItem == activeItem) { continue; }
|
||||
|
||||
const QString fileStem = childItem->text(0).replace(".ff", "");
|
||||
if (!mFastFiles.contains(fileStem)) {
|
||||
qDebug() << "Error: Could not find " << fileStem << " in Fast File map!";
|
||||
return;
|
||||
}
|
||||
|
||||
mFastFiles.remove(fileStem);
|
||||
CloseFastFile(fileStem);
|
||||
invisibleRootItem()->removeChild(childItem);
|
||||
i--;
|
||||
}
|
||||
@ -364,6 +394,15 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
||||
for (int i = 0; i < invisibleRootItem()->childCount(); i++) {
|
||||
auto childItem = invisibleRootItem()->child(i);
|
||||
if (childItem == activeItem) { return; }
|
||||
|
||||
const QString fileStem = childItem->text(0).replace(".ff", "");
|
||||
if (!mFastFiles.contains(fileStem)) {
|
||||
qDebug() << "Error: Could not find " << fileStem << " in Fast File map!";
|
||||
return;
|
||||
}
|
||||
|
||||
mFastFiles.remove(fileStem);
|
||||
CloseFastFile(fileStem);
|
||||
invisibleRootItem()->removeChild(childItem);
|
||||
i--;
|
||||
}
|
||||
@ -382,38 +421,41 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
||||
ready = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
const QString fileStem = childItem->text(0).replace(".ff", "");
|
||||
if (!mFastFiles.contains(fileStem)) {
|
||||
qDebug() << "Error: Could not find " << fileStem << " in Fast File map!";
|
||||
return;
|
||||
}
|
||||
|
||||
mFastFiles.remove(fileStem);
|
||||
CloseFastFile(fileStem);
|
||||
invisibleRootItem()->removeChild(childItem);
|
||||
i--;
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu->addMenu(closeMultipleAction);
|
||||
const QString fileStem = activeText.replace(".ff", "");
|
||||
if (!mFastFiles.contains(fileStem)) {
|
||||
qDebug() << "Error: Could not find " << fileStem << " in Fast File map!";
|
||||
return;
|
||||
}
|
||||
|
||||
QAction *closeAction = new QAction("Close File");
|
||||
contextMenu->addAction(closeAction);
|
||||
connect(closeAction, &QAction::triggered, this, [this, &fileStem, &activeItem](bool checked) {
|
||||
connect(closeAction, &QAction::triggered, this, [this, &activeItem, &activeText](bool checked) {
|
||||
Q_UNUSED(checked);
|
||||
|
||||
const QString fileStem = activeItem->text(0).replace(".ff", "");
|
||||
|
||||
mFastFiles.remove(fileStem);
|
||||
CloseFastFile(activeText);
|
||||
invisibleRootItem()->removeChild(activeItem);
|
||||
});
|
||||
|
||||
QMenu *exportSubmenu = new QMenu("Export...", this);
|
||||
contextMenu->addMenu(exportSubmenu);
|
||||
|
||||
std::shared_ptr<FastFile> fastFile = mFastFiles[fileStem];
|
||||
|
||||
QAction *exportDDSAction = new QAction("Export as Zone File");
|
||||
exportSubmenu->addAction(exportDDSAction);
|
||||
connect(exportDDSAction, &QAction::triggered, this, [fastFile](bool checked) {
|
||||
connect(exportDDSAction, &QAction::triggered, this, [](bool checked) {
|
||||
Q_UNUSED(checked);
|
||||
|
||||
//fastFile->SaveZone();
|
||||
});
|
||||
} else if (activeText.contains(".zone")) {
|
||||
const QString fileStem = activeText.replace(".zone", "");
|
||||
@ -431,8 +473,6 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
|
||||
exportSubmenu->addAction(exportDDSAction);
|
||||
connect(exportDDSAction, &QAction::triggered, this, [zoneFile](bool checked) {
|
||||
Q_UNUSED(checked);
|
||||
|
||||
//zoneFile->SaveFastFile();
|
||||
});
|
||||
} else if (activeItem && activeText.contains(".wav")) {
|
||||
XTreeWidgetItem *parentItem = dynamic_cast<XTreeWidgetItem*>(activeItem->parent());
|
||||
@ -541,7 +581,7 @@ void XTreeWidget::ItemSelectionChanged() {
|
||||
if (!selectedItem) { return; }
|
||||
if (selectedItem->text(0).isEmpty()) { return; }
|
||||
QString selectedText = selectedItem->text(0);
|
||||
emit TabSelected(selectedText);
|
||||
emit ItemSelected(selectedText);
|
||||
|
||||
const QString fileStem = selectedText.section(".", 0, 0);
|
||||
|
||||
@ -549,35 +589,35 @@ void XTreeWidget::ItemSelectionChanged() {
|
||||
|
||||
if (selectedText.contains(".dds")) {
|
||||
if (!mDDSFiles.contains(fileStem)) {
|
||||
qDebug() << "Error: Could not find " << fileStem << " in DDS map!";
|
||||
LogManager::instance().addError("Could not find " + fileStem + " in DDS map!");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<DDSFile> ddsFile = mDDSFiles[fileStem];
|
||||
emit DDSFileSelected(ddsFile);
|
||||
emit DDSFileSelected(ddsFile, fileStem);
|
||||
} else if (selectedText.contains(".iwi")) {
|
||||
if (!mIWIFiles.contains(fileStem)) {
|
||||
qDebug() << "Error: Could not find " << fileStem << " in IWI map!";
|
||||
LogManager::instance().addError("Could not find " + fileStem + " in IWI map!");
|
||||
return;
|
||||
}
|
||||
emit IWIFileSelected(mIWIFiles[fileStem]);
|
||||
emit IWIFileSelected(mIWIFiles[fileStem], fileStem);
|
||||
} else if (selectedText.contains(".ff")) {
|
||||
if (!mFastFiles.contains(fileStem)) {
|
||||
qDebug() << "Error: Could not find " << fileStem << " in Fast File map!";
|
||||
LogManager::instance().addError("Could not find " + fileStem + " in Fast File map!");
|
||||
return;
|
||||
}
|
||||
emit FastFileSelected(mFastFiles[fileStem]);
|
||||
emit FastFileSelected(mFastFiles[fileStem], fileStem);
|
||||
} else if (selectedText.contains(".zone")) {
|
||||
if (!mZoneFiles.contains(fileStem)) {
|
||||
qDebug() << "Error: Could not find " << fileStem << " in Zone File map!";
|
||||
LogManager::instance().addError("Could not find " + fileStem + " in Zone File map!");
|
||||
return;
|
||||
}
|
||||
emit ZoneFileSelected(mZoneFiles[fileStem]);
|
||||
emit ZoneFileSelected(mZoneFiles[fileStem], fileStem);
|
||||
} else if (selectedText.contains(".str")) {
|
||||
if (!mZoneFiles.contains(fileStem)) {
|
||||
qDebug() << "Error: Could not find " << fileStem << " in Zone File map!";
|
||||
LogManager::instance().addError("Could not find " + fileStem + " in Zone File map!");
|
||||
return;
|
||||
}
|
||||
emit LocalStringSelected(mZoneFiles[fileStem]);
|
||||
emit LocalStringSelected(mZoneFiles[fileStem], fileStem);
|
||||
} else if (selectedText.contains(".gsc")) {
|
||||
XTreeWidgetItem *zoneRoot = selectedItem;
|
||||
if (!zoneRoot) { return; }
|
||||
@ -589,14 +629,14 @@ void XTreeWidget::ItemSelectionChanged() {
|
||||
|
||||
const QString fileStem = zoneRoot->text(0).section('.', 0, 0);
|
||||
if (!mZoneFiles.contains(fileStem)) {
|
||||
qDebug() << "Error: Could not find " << fileStem << " in Zone File map!";
|
||||
LogManager::instance().addError("Could not find " + fileStem + " in Zone File map!");
|
||||
return;
|
||||
}
|
||||
|
||||
QVector<RawFile> rawFiles = mZoneFiles[fileStem]->GetAssetMap().rawFiles;
|
||||
for (RawFile rawFile : rawFiles) {
|
||||
if (rawFile.path.contains(selectedText)) {
|
||||
emit RawFileSelected(std::make_shared<RawFile>(rawFile));
|
||||
emit RawFileSelected(std::make_shared<RawFile>(rawFile), fileStem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -607,7 +647,7 @@ void XTreeWidget::ItemSelectionChanged() {
|
||||
QVector<Image> images = mZoneFiles[fileStem]->GetAssetMap().images;
|
||||
for (Image image : images) {
|
||||
if (image.materialName == selectedText) {
|
||||
emit ImageSelected(std::make_shared<Image>(image));
|
||||
emit ImageSelected(std::make_shared<Image>(image), fileStem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -619,19 +659,31 @@ void XTreeWidget::ItemSelectionChanged() {
|
||||
auto techsets = mZoneFiles[fileStem]->GetAssetMap().techSets;
|
||||
for (auto techset : techsets) {
|
||||
if (techset.name == selectedText) {
|
||||
emit TechSetSelected(std::make_shared<TechSet>(techset));
|
||||
emit TechSetSelected(std::make_shared<TechSet>(techset), fileStem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (parentItem && (parentItem->text(0) == "String Tables")) {
|
||||
} 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);
|
||||
QVector<StringTable> strTables = mZoneFiles[fileStem]->GetAssetMap().stringTables;
|
||||
for (StringTable strTable : strTables) {
|
||||
if (strTable.name == selectedText) {
|
||||
emit StrTableSelected(std::make_shared<StringTable>(strTable));
|
||||
auto techsets = mZoneFiles[fileStem]->GetAssetMap().techSets;
|
||||
for (auto techset : techsets) {
|
||||
if (techset.name == selectedText) {
|
||||
emit TechSetSelected(std::make_shared<TechSet>(techset), fileStem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (parentItem && (parentItem->text(0) == "Materials")) {
|
||||
XTreeWidgetItem *grandpaItem = dynamic_cast<XTreeWidgetItem*>(parentItem->parent());
|
||||
if (grandpaItem && grandpaItem->text(0).contains(".zone")) {
|
||||
const QString fileStem = grandpaItem->text(0).section('.', 0, 0);
|
||||
QVector<Material> materials = mZoneFiles[fileStem]->GetAssetMap().materials;
|
||||
for (Material material : materials) {
|
||||
if (material.name == selectedText) {
|
||||
emit MaterialSelected(std::make_shared<Material>(material), fileStem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -651,7 +703,7 @@ void XTreeWidget::ItemSelectionChanged() {
|
||||
for (SoundAsset soundAsset : soundAssets) {
|
||||
for (Sound sound : soundAsset.sounds) {
|
||||
if (sound.path.contains(selectedText)) {
|
||||
emit SoundSelected(std::make_shared<Sound>(sound));
|
||||
emit SoundSelected(std::make_shared<Sound>(sound), fileStem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -660,24 +712,32 @@ void XTreeWidget::ItemSelectionChanged() {
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<ZoneFile> XTreeWidget::pFindZoneFile(const QString aFilePart) {
|
||||
std::shared_ptr<ZoneFile> XTreeWidget::FindZoneFile(const QString aStem) {
|
||||
foreach (auto zoneFile, mZoneFiles) {
|
||||
if (zoneFile->GetStem() == aFilePart) {
|
||||
if (zoneFile->GetStem() == aStem) {
|
||||
return zoneFile;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<FastFile> XTreeWidget::pFindFastFile(const QString aFilePart) {
|
||||
std::shared_ptr<FastFile> XTreeWidget::FindFastFile(const QString aStem) {
|
||||
foreach (auto fastFile, mFastFiles) {
|
||||
if (fastFile->GetStem() == aFilePart) {
|
||||
if (fastFile->GetStem() == aStem) {
|
||||
return fastFile;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool XTreeWidget::HasZoneFile(const QString aStem) {
|
||||
return FindZoneFile(aStem) != nullptr;
|
||||
}
|
||||
|
||||
bool XTreeWidget::HasFastFile(const QString aStem) {
|
||||
return FindFastFile(aStem) != nullptr;
|
||||
}
|
||||
|
||||
void XTreeWidget::AddIWIFile(std::shared_ptr<IWIFile> aIWIFile) {
|
||||
const QString iwiFileName = QString(aIWIFile->fileStem + ".iwi");
|
||||
|
||||
62
app/xtreewidget.h
Normal file
62
app/xtreewidget.h
Normal file
@ -0,0 +1,62 @@
|
||||
#ifndef XTREEWIDGET_H
|
||||
#define XTREEWIDGET_H
|
||||
|
||||
#include "d3dbsp_structs.h"
|
||||
#include "asset_structs.h"
|
||||
#include "ddsfile.h"
|
||||
#include "iwifile.h"
|
||||
#include "fastfile.h"
|
||||
#include "xtreewidgetitem.h"
|
||||
#include "zonefile.h"
|
||||
|
||||
#include <QTreeWidget>
|
||||
|
||||
class XTreeWidget : public QTreeWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit XTreeWidget(QWidget *parent = nullptr);
|
||||
~XTreeWidget();
|
||||
|
||||
void AddFastFile(std::shared_ptr<FastFile> aFastFile);
|
||||
void AddZoneFile(std::shared_ptr<ZoneFile> aZoneFile, XTreeWidgetItem *aParentItem = nullptr);
|
||||
void AddIWIFile(std::shared_ptr<IWIFile> aIWIFile);
|
||||
void AddDDSFile(std::shared_ptr<DDSFile> aDDSFile);
|
||||
|
||||
std::shared_ptr<ZoneFile> FindZoneFile(const QString aStem);
|
||||
std::shared_ptr<FastFile> FindFastFile(const QString aStem);
|
||||
|
||||
bool HasZoneFile(const QString aStem);
|
||||
bool HasFastFile(const QString aStem);
|
||||
|
||||
void CloseFastFile(const QString aFFName);
|
||||
signals:
|
||||
void DDSFileSelected(std::shared_ptr<DDSFile> aDDSFile, const QString aParentName);
|
||||
void IWIFileSelected(std::shared_ptr<IWIFile> aIWIFile, const QString aParentName);
|
||||
void FastFileSelected(std::shared_ptr<FastFile> aFastFile, const QString aParentName);
|
||||
void ZoneFileSelected(std::shared_ptr<ZoneFile> aZoneFile, const QString aParentName);
|
||||
void LocalStringSelected(std::shared_ptr<ZoneFile> aZoneFile, const QString aParentName);
|
||||
void RawFileSelected(std::shared_ptr<RawFile> aRawFile, const QString aParentName);
|
||||
void ImageSelected(std::shared_ptr<Image> aImage, const QString aParentName);
|
||||
void TechSetSelected(std::shared_ptr<TechSet> aZoneFile, const QString aParentName);
|
||||
void StrTableSelected(std::shared_ptr<StringTable> aStrTable, const QString aParentName);
|
||||
void MenuSelected(std::shared_ptr<Menu> aMenu, const QString aParentName);
|
||||
void SoundSelected(std::shared_ptr<Sound> aSound, const QString aParentName);
|
||||
void MaterialSelected(std::shared_ptr<Material> aMaterial, const QString aParentName);
|
||||
void ItemSelected(const QString itemText);
|
||||
|
||||
void ItemClosed(const QString itemText);
|
||||
void Cleared();
|
||||
|
||||
protected:
|
||||
void ItemSelectionChanged();
|
||||
void PrepareContextMenu(const QPoint &pos);
|
||||
|
||||
private:
|
||||
QMap<QString, std::shared_ptr<FastFile>> mFastFiles;
|
||||
QMap<QString, std::shared_ptr<ZoneFile>> mZoneFiles;
|
||||
QMap<QString, std::shared_ptr<DDSFile>> mDDSFiles;
|
||||
QMap<QString, std::shared_ptr<IWIFile>> mIWIFiles;
|
||||
};
|
||||
|
||||
#endif // XTREEWIDGET_H
|
||||
@ -71,5 +71,7 @@
|
||||
<file>icons/Icon_Paste.png</file>
|
||||
<file>icons/Icon_Save.png</file>
|
||||
<file>icons/Icon_OpenFile.png</file>
|
||||
<file>icons/Icon_COD2.png</file>
|
||||
<file>icons/Icon_Material.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
BIN
data/icons/Icon_COD2.png
Normal file
BIN
data/icons/Icon_COD2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
data/icons/Icon_Material.png
Normal file
BIN
data/icons/Icon_Material.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
@ -1,168 +0,0 @@
|
||||
#include "fastfile_cod9.h"
|
||||
#include "zonefile_cod9.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "compressor.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
FastFile_COD9::FastFile_COD9() {
|
||||
|
||||
}
|
||||
|
||||
FastFile_COD9::~FastFile_COD9() {
|
||||
|
||||
}
|
||||
|
||||
bool FastFile_COD9::Load(const QString aFilePath) {
|
||||
if (aFilePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check fastfile can be read
|
||||
QFile *file = new QFile(aFilePath);
|
||||
if (!file->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << QString("Error: Failed to open FastFile: %1!").arg(aFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decompress fastfile and close
|
||||
const QString fastFileStem = aFilePath.section("/", -1, -1);
|
||||
SetStem(fastFileStem);
|
||||
if (!Load(file->readAll())) {
|
||||
qDebug() << "Error: Failed to load fastfile: " << fastFileStem;
|
||||
return false;
|
||||
}
|
||||
|
||||
file->close();
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FastFile_COD9::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Parse header values.
|
||||
SetCompany(pParseFFCompany(&fastFileStream));
|
||||
SetType(pParseFFFileType(&fastFileStream));
|
||||
SetSignage(pParseFFSignage(&fastFileStream));
|
||||
SetMagic(pParseFFMagic(&fastFileStream));
|
||||
quint32 version = pParseFFVersion(&fastFileStream);
|
||||
SetVersion(version);
|
||||
SetPlatform(pCalculateFFPlatform(version));
|
||||
SetGame("COD9");
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
if (GetPlatform() == "PC") {
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
}
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key;
|
||||
if (GetGame() == "COD7") {
|
||||
fastFileStream.skipRawData(4);
|
||||
if (GetPlatform() == "360") {
|
||||
key = QByteArray::fromHex("1ac1d12d527c59b40eca619120ff8217ccff09cd16896f81b829c7f52793405d");
|
||||
} else if (GetPlatform() == "PS3") {
|
||||
key = QByteArray::fromHex("46D3F997F29C9ACE175B0DAE3AB8C0C1B8E423E2E3BF7E3C311EA35245BF193A");
|
||||
// or
|
||||
// key = QByteArray::fromHex("0C99B3DDB8D6D0845D1147E470F28A8BF2AE69A8A9F534767B54E9180FF55370");
|
||||
}
|
||||
} else if (GetGame() == "COD9") {
|
||||
if (GetPlatform() == "360") {
|
||||
key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
} else if (GetPlatform() == "PC") {
|
||||
key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
}
|
||||
}
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "PHEEBs71") {
|
||||
qWarning() << "Invalid fast file magic!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(4);
|
||||
|
||||
// Read IV table name (32 bytes).
|
||||
QByteArray fileName(32, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileName.data(), 32);
|
||||
|
||||
// Build the IV table from the fileName.
|
||||
QByteArray ivTable = Compressor::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 = Compressor::GetIV(ivTable, sectionIndex);
|
||||
|
||||
// Decrypt the section using Salsa20.
|
||||
QByteArray decData = Compressor::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.
|
||||
Compressor::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);
|
||||
|
||||
if (GetPlatform() == "PC") {
|
||||
decompressedData.append(Compressor::DecompressZLIB(compressedData));
|
||||
} else if (GetPlatform() == "360") {
|
||||
decompressedData.append(LZX::DecompressLZX(decData, decData.size()));
|
||||
}
|
||||
|
||||
// Optionally write out test files for COD9.
|
||||
QFile testFile("exports/" + QString("%1.out").arg(sectionIndex));
|
||||
if(testFile.open(QIODevice::WriteOnly)) {
|
||||
testFile.write(decompressedData);
|
||||
testFile.close();
|
||||
}
|
||||
|
||||
sectionIndex++;
|
||||
}
|
||||
|
||||
// For COD9, write out the complete decompressed zone for testing.
|
||||
QFile testFile("exports/test.zone");
|
||||
if(testFile.open(QIODevice::WriteOnly)) {
|
||||
testFile.write(decompressedData);
|
||||
testFile.close();
|
||||
}
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD9 zoneFile;
|
||||
zoneFile.Load(decompressedData, GetStem().section('.', 0, 0) + ".zone", FF_PLATFORM_XBOX);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD9>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
27
libs/compression/compression.pro
Normal file
27
libs/compression/compression.pro
Normal file
@ -0,0 +1,27 @@
|
||||
QT += core
|
||||
TEMPLATE = lib
|
||||
CONFIG += staticlib c++17 debug
|
||||
|
||||
SOURCES += \
|
||||
lzokay.cpp \
|
||||
salsa20.cpp \
|
||||
sha1.cpp
|
||||
|
||||
HEADERS += \
|
||||
lzx.h \
|
||||
lzokay.hpp \
|
||||
sha1.h \
|
||||
os_types.h \
|
||||
config_win32.h \
|
||||
compressor.h
|
||||
|
||||
LIBS += \
|
||||
-L$$OUT_PWD/../libs/encryption -lencryption
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/../encryption
|
||||
|
||||
DEPENDPATH += \
|
||||
$$PWD/../encryption
|
||||
|
||||
DESTDIR = $$OUT_PWD/../
|
||||
@ -1,11 +1,10 @@
|
||||
#ifndef COMPRESSOR_H
|
||||
#define COMPRESSOR_H
|
||||
|
||||
#include "utils.h"
|
||||
#include "QtZlib/zlib.h"
|
||||
#include "lzokay.hpp"
|
||||
#include "lzx.h"
|
||||
#include "statusbarmanager.h"
|
||||
#include "ecrypt-sync.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
@ -13,7 +12,8 @@
|
||||
#include <QDebug>
|
||||
#include <QDataStream>
|
||||
#include <QVector>
|
||||
#include <algorithm>
|
||||
#include <QCryptographicHash>
|
||||
#include <QFile>
|
||||
|
||||
typedef enum {
|
||||
EResult_LookbehindOverrun = -4,
|
||||
@ -37,14 +37,11 @@ public:
|
||||
if (compressedData.isEmpty())
|
||||
return QByteArray();
|
||||
|
||||
// Set up the inflate stream.
|
||||
z_stream strm;
|
||||
memset(&strm, 0, sizeof(strm));
|
||||
// The inflate() function needs a non-const pointer; this is safe as we never modify the input.
|
||||
strm.next_in = reinterpret_cast<Bytef*>(const_cast<char*>(compressedData.data()));
|
||||
strm.avail_in = static_cast<uInt>(compressedData.size());
|
||||
|
||||
// Use inflateInit(); if you want to support gzip streams, see note below.
|
||||
int ret = inflateInit(&strm);
|
||||
if (ret != Z_OK) {
|
||||
qWarning() << "inflateInit failed:" << zError(ret);
|
||||
@ -54,17 +51,18 @@ public:
|
||||
QByteArray outArray;
|
||||
char buffer[4096];
|
||||
|
||||
// Decompress until we reach the stream end.
|
||||
int compressedBytesConsumed = 0;
|
||||
int index = 0;
|
||||
do {
|
||||
StatusBarManager::instance().updateProgressStatus("Processing Decompressing ZLib Data", index++, index++);
|
||||
int totalCompressedSize = compressedData.size(); // n in x/n progress
|
||||
|
||||
do {
|
||||
strm.next_out = reinterpret_cast<Bytef*>(buffer);
|
||||
strm.avail_out = sizeof(buffer);
|
||||
|
||||
int compressedBefore = strm.avail_in; // Track before calling inflate
|
||||
ret = inflate(&strm, Z_NO_FLUSH);
|
||||
// Handle a special case: if inflate() returns Z_BUF_ERROR without
|
||||
// having produced any output and with no further input, then we break out.
|
||||
int compressedAfter = strm.avail_in; // Track after calling inflate
|
||||
|
||||
if (ret == Z_BUF_ERROR && strm.avail_in == 0) {
|
||||
break;
|
||||
}
|
||||
@ -74,17 +72,29 @@ public:
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
// Calculate number of bytes produced in this iteration.
|
||||
int bytesProduced = sizeof(buffer) - strm.avail_out;
|
||||
if (bytesProduced > 0)
|
||||
int bytesConsumed = compressedBefore - compressedAfter; // Track consumed compressed bytes
|
||||
compressedBytesConsumed += bytesConsumed;
|
||||
|
||||
if (bytesProduced > 0) {
|
||||
outArray.append(buffer, bytesProduced);
|
||||
|
||||
index++;
|
||||
|
||||
StatusBarManager::instance().updateProgressStatus(
|
||||
QString("Processing Decompressing ZLib Data (%1/%2 bytes)").arg(compressedBytesConsumed).arg(totalCompressedSize),
|
||||
compressedBytesConsumed, totalCompressedSize);
|
||||
}
|
||||
|
||||
} while (ret != Z_STREAM_END);
|
||||
|
||||
StatusBarManager::instance().updateStatus("Finished decompression!");
|
||||
|
||||
inflateEnd(&strm);
|
||||
return outArray;
|
||||
}
|
||||
|
||||
|
||||
static QByteArray DecompressLZO(const QByteArray& input) {
|
||||
lzokay::EResult error;
|
||||
|
||||
@ -408,6 +418,169 @@ public:
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
static void fillIVTable(QByteArray fastFileData, QByteArray& ivTable, quint32 ivTableLength)
|
||||
{
|
||||
QDataStream stream(fastFileData);
|
||||
stream.skipRawData(24);
|
||||
|
||||
quint32 nameKeyLength = 0;
|
||||
for (int i = 0; i < 32 && !stream.atEnd(); i++) {
|
||||
if (!stream.atEnd() && stream.device()->peek(1).toHex() != "00") {
|
||||
nameKeyLength++;
|
||||
stream.skipRawData(1);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nameKeyLength < 32) {
|
||||
stream.skipRawData(32 - nameKeyLength);
|
||||
}
|
||||
|
||||
if (ivTableLength < 16) {
|
||||
qWarning() << "IV table length too small!";
|
||||
return;
|
||||
}
|
||||
|
||||
for (quint32 i = 0; i < ivTableLength - 16; i++) {
|
||||
if (stream.atEnd()) {
|
||||
qWarning() << "Stream ended while filling IV table!";
|
||||
return;
|
||||
}
|
||||
quint8 ivVal;
|
||||
stream >> ivVal;
|
||||
ivTable[i] = ivVal;
|
||||
}
|
||||
}
|
||||
|
||||
static void fillIV(int index, QByteArray& ivPtr, const QByteArray& ivTable, const QVector<quint32>& ivCounter)
|
||||
{
|
||||
if (index < 0 || index >= ivCounter.size()) {
|
||||
qWarning() << "Invalid IV index: " << index;
|
||||
return;
|
||||
}
|
||||
|
||||
int ivOffset = ((index + 4 * (ivCounter[index] - 1)) % 800) * 20;
|
||||
|
||||
if (ivOffset + 8 > ivTable.size()) {
|
||||
qWarning() << "IV offset out of bounds! Offset: " << ivOffset;
|
||||
return;
|
||||
}
|
||||
|
||||
ivPtr = ivTable.mid(ivOffset, 8);
|
||||
}
|
||||
|
||||
|
||||
static void generateNewIV(int index, const QByteArray& hash, QByteArray& ivTable, QVector<quint32>& ivCounter)
|
||||
{
|
||||
if (index < 0 || index >= ivCounter.size()) {
|
||||
qWarning() << "Invalid index: " << index;
|
||||
return;
|
||||
}
|
||||
|
||||
quint32 safeCounter = fmin(ivCounter[index], 800u - 1);
|
||||
int ivOffset = (index + 4 * safeCounter) % 800 * 5;
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
if (ivOffset + i >= ivTable.size()) {
|
||||
qWarning() << "Index out of bounds for IV table!";
|
||||
return;
|
||||
}
|
||||
ivTable[ivOffset + i] ^= hash[i];
|
||||
}
|
||||
|
||||
ivCounter[index]++;
|
||||
}
|
||||
|
||||
static QByteArray decryptFastFile(const QByteArray& fastFileData)
|
||||
{
|
||||
const QByteArray bo2_salsa20_key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
|
||||
QByteArray fileData = fastFileData;
|
||||
QByteArray finalFastFile;
|
||||
|
||||
QByteArray ivTable(16000, 0);
|
||||
fillIVTable(fileData, ivTable, 16000 - 1);
|
||||
|
||||
QVector<quint32> ivCounter(4, 1);
|
||||
QDataStream stream(fileData);
|
||||
stream.setByteOrder(QDataStream::LittleEndian);
|
||||
stream.skipRawData(0x138);
|
||||
|
||||
QByteArray sha1Hash(20, 0);
|
||||
QByteArray ivPtr(8, 0);
|
||||
int chunkIndex = 0;
|
||||
|
||||
while (!stream.atEnd()) {
|
||||
quint32 dataLength;
|
||||
stream >> dataLength;
|
||||
|
||||
if (dataLength == 0 || dataLength > fileData.size() - stream.device()->pos()) {
|
||||
qWarning() << "Invalid data length at offset: " << stream.device()->pos();
|
||||
break;
|
||||
}
|
||||
|
||||
fillIV(chunkIndex % 4, ivPtr, ivTable, ivCounter);
|
||||
|
||||
ECRYPT_ctx x;
|
||||
ECRYPT_keysetup(&x, reinterpret_cast<const u8*>(bo2_salsa20_key.constData()), 256, 0);
|
||||
ECRYPT_ivsetup(&x, reinterpret_cast<const u8*>(ivPtr.constData()));
|
||||
|
||||
QByteArray encryptedBlock = fileData.mid(stream.device()->pos(), dataLength);
|
||||
QByteArray decryptedBlock;
|
||||
decryptedBlock.resize(dataLength);
|
||||
|
||||
ECRYPT_decrypt_bytes(&x, reinterpret_cast<const u8*>(encryptedBlock.constData()),
|
||||
reinterpret_cast<u8*>(decryptedBlock.data()), dataLength);
|
||||
|
||||
QCryptographicHash sha1(QCryptographicHash::Sha1);
|
||||
sha1.addData(decryptedBlock);
|
||||
sha1Hash = sha1.result();
|
||||
|
||||
z_stream strm = {};
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
strm.avail_in = static_cast<uInt>(decryptedBlock.size());
|
||||
strm.next_in = reinterpret_cast<Bytef*>(decryptedBlock.data());
|
||||
|
||||
QByteArray decompressedData;
|
||||
decompressedData.resize(fmax(dataLength * 2, 4096));
|
||||
strm.avail_out = decompressedData.size();
|
||||
strm.next_out = reinterpret_cast<Bytef*>(decompressedData.data());
|
||||
|
||||
int zReturn = inflateInit2(&strm, -15);
|
||||
if (zReturn != Z_OK) {
|
||||
qWarning() << "inflateInit2 failed with error code" << zReturn;
|
||||
break;
|
||||
}
|
||||
|
||||
zReturn = inflate(&strm, Z_FINISH);
|
||||
inflateEnd(&strm);
|
||||
|
||||
if (zReturn != Z_STREAM_END) {
|
||||
qDebug() << "Error decompressing at offset: " << stream.device()->pos() << " : " << zReturn;
|
||||
decompressedData.clear();
|
||||
} else {
|
||||
decompressedData.resize(strm.total_out);
|
||||
}
|
||||
|
||||
finalFastFile.append(decompressedData);
|
||||
|
||||
generateNewIV(chunkIndex % 4, sha1Hash, ivTable, ivCounter);
|
||||
|
||||
if (stream.device()->pos() + static_cast<qint64>(dataLength) > fileData.size()) {
|
||||
qWarning() << "Skipping past file size!";
|
||||
break;
|
||||
}
|
||||
|
||||
stream.skipRawData(dataLength);
|
||||
chunkIndex++;
|
||||
}
|
||||
|
||||
return finalFastFile;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
28
libs/compression/config_win32.h
Normal file
28
libs/compression/config_win32.h
Normal file
@ -0,0 +1,28 @@
|
||||
/* configuration header file for compiling under Microsoft Windows */
|
||||
|
||||
/* update package version here */
|
||||
|
||||
#pragma once
|
||||
|
||||
#define PACKAGE "jbig2dec"
|
||||
#define VERSION "0.2"
|
||||
|
||||
/* define this iff you are linking to/compiling in libpng */
|
||||
#define HAVE_LIBPNG
|
||||
|
||||
#ifdef _MSC_VER /* Microsoft Visual C+*/
|
||||
|
||||
typedef signed char int8_t;
|
||||
typedef short int int16_t;
|
||||
typedef int int32_t;
|
||||
typedef __int64 int64_t;
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short int uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
/* no uint64_t */
|
||||
|
||||
# define vsnprintf _vsnprintf
|
||||
# define snprintf _snprintf
|
||||
|
||||
#endif /* _MSC_VER */
|
||||
30
libs/compression/os_types.h
Normal file
30
libs/compression/os_types.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
jbig2dec
|
||||
|
||||
Copyright (c) 2002 artofcode LLC.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
$Id: os_types.h,v 1.1 2002/07/20 17:23:15 giles Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
indirection layer for build and platform-specific definitions
|
||||
|
||||
in general, this header should insure that the stdint types are
|
||||
available, and that any optional compile flags are defined if
|
||||
the build system doesn't pass them directly.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config_types.h"
|
||||
#elif defined(_WIN32)
|
||||
#include "config_win32.h"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_STDINT_H) || defined(__MACOS__)
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
219
libs/compression/salsa20.cpp
Normal file
219
libs/compression/salsa20.cpp
Normal file
@ -0,0 +1,219 @@
|
||||
/*
|
||||
salsa20-merged.c version 20051118
|
||||
D. J. Bernstein
|
||||
Public domain.
|
||||
*/
|
||||
|
||||
#include "ecrypt-sync.h"
|
||||
|
||||
#define ROTATE(v,c) (ROTL32(v,c))
|
||||
#define XOR(v,w) ((v) ^ (w))
|
||||
#define PLUS(v,w) (U32V((v) + (w)))
|
||||
#define PLUSONE(v) (PLUS((v),1))
|
||||
|
||||
void ECRYPT_init(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static const char sigma[17] = "expand 32-byte k";
|
||||
static const char tau[17] = "expand 16-byte k";
|
||||
|
||||
void ECRYPT_keysetup(ECRYPT_ctx *x,const u8 *k,u32 kbits,u32 ivbits)
|
||||
{
|
||||
const char *constants;
|
||||
|
||||
x->input[1] = U8TO32_LITTLE(k + 0);
|
||||
x->input[2] = U8TO32_LITTLE(k + 4);
|
||||
x->input[3] = U8TO32_LITTLE(k + 8);
|
||||
x->input[4] = U8TO32_LITTLE(k + 12);
|
||||
if (kbits == 256) { /* recommended */
|
||||
k += 16;
|
||||
constants = sigma;
|
||||
} else { /* kbits == 128 */
|
||||
constants = tau;
|
||||
}
|
||||
x->input[11] = U8TO32_LITTLE(k + 0);
|
||||
x->input[12] = U8TO32_LITTLE(k + 4);
|
||||
x->input[13] = U8TO32_LITTLE(k + 8);
|
||||
x->input[14] = U8TO32_LITTLE(k + 12);
|
||||
x->input[0] = U8TO32_LITTLE(constants + 0);
|
||||
x->input[5] = U8TO32_LITTLE(constants + 4);
|
||||
x->input[10] = U8TO32_LITTLE(constants + 8);
|
||||
x->input[15] = U8TO32_LITTLE(constants + 12);
|
||||
}
|
||||
|
||||
void ECRYPT_ivsetup(ECRYPT_ctx *x,const u8 *iv)
|
||||
{
|
||||
x->input[6] = U8TO32_LITTLE(iv + 0);
|
||||
x->input[7] = U8TO32_LITTLE(iv + 4);
|
||||
x->input[8] = 0;
|
||||
x->input[9] = 0;
|
||||
}
|
||||
|
||||
void ECRYPT_encrypt_bytes(ECRYPT_ctx *x,const u8 *m,u8 *c,u32 bytes)
|
||||
{
|
||||
u32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
|
||||
u32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
|
||||
u8 *ctarget;
|
||||
u8 tmp[64];
|
||||
unsigned int i;
|
||||
|
||||
if (!bytes) return;
|
||||
|
||||
j0 = x->input[0];
|
||||
j1 = x->input[1];
|
||||
j2 = x->input[2];
|
||||
j3 = x->input[3];
|
||||
j4 = x->input[4];
|
||||
j5 = x->input[5];
|
||||
j6 = x->input[6];
|
||||
j7 = x->input[7];
|
||||
j8 = x->input[8];
|
||||
j9 = x->input[9];
|
||||
j10 = x->input[10];
|
||||
j11 = x->input[11];
|
||||
j12 = x->input[12];
|
||||
j13 = x->input[13];
|
||||
j14 = x->input[14];
|
||||
j15 = x->input[15];
|
||||
|
||||
for (;;) {
|
||||
if (bytes < 64) {
|
||||
for (i = 0;i < bytes;++i) tmp[i] = m[i];
|
||||
m = tmp;
|
||||
ctarget = c;
|
||||
c = tmp;
|
||||
}
|
||||
x0 = j0;
|
||||
x1 = j1;
|
||||
x2 = j2;
|
||||
x3 = j3;
|
||||
x4 = j4;
|
||||
x5 = j5;
|
||||
x6 = j6;
|
||||
x7 = j7;
|
||||
x8 = j8;
|
||||
x9 = j9;
|
||||
x10 = j10;
|
||||
x11 = j11;
|
||||
x12 = j12;
|
||||
x13 = j13;
|
||||
x14 = j14;
|
||||
x15 = j15;
|
||||
for (i = 20;i > 0;i -= 2) {
|
||||
x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7));
|
||||
x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9));
|
||||
x12 = XOR(x12,ROTATE(PLUS( x8, x4),13));
|
||||
x0 = XOR( x0,ROTATE(PLUS(x12, x8),18));
|
||||
x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7));
|
||||
x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9));
|
||||
x1 = XOR( x1,ROTATE(PLUS(x13, x9),13));
|
||||
x5 = XOR( x5,ROTATE(PLUS( x1,x13),18));
|
||||
x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7));
|
||||
x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9));
|
||||
x6 = XOR( x6,ROTATE(PLUS( x2,x14),13));
|
||||
x10 = XOR(x10,ROTATE(PLUS( x6, x2),18));
|
||||
x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7));
|
||||
x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9));
|
||||
x11 = XOR(x11,ROTATE(PLUS( x7, x3),13));
|
||||
x15 = XOR(x15,ROTATE(PLUS(x11, x7),18));
|
||||
x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7));
|
||||
x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9));
|
||||
x3 = XOR( x3,ROTATE(PLUS( x2, x1),13));
|
||||
x0 = XOR( x0,ROTATE(PLUS( x3, x2),18));
|
||||
x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7));
|
||||
x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9));
|
||||
x4 = XOR( x4,ROTATE(PLUS( x7, x6),13));
|
||||
x5 = XOR( x5,ROTATE(PLUS( x4, x7),18));
|
||||
x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7));
|
||||
x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9));
|
||||
x9 = XOR( x9,ROTATE(PLUS( x8,x11),13));
|
||||
x10 = XOR(x10,ROTATE(PLUS( x9, x8),18));
|
||||
x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7));
|
||||
x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9));
|
||||
x14 = XOR(x14,ROTATE(PLUS(x13,x12),13));
|
||||
x15 = XOR(x15,ROTATE(PLUS(x14,x13),18));
|
||||
}
|
||||
x0 = PLUS(x0,j0);
|
||||
x1 = PLUS(x1,j1);
|
||||
x2 = PLUS(x2,j2);
|
||||
x3 = PLUS(x3,j3);
|
||||
x4 = PLUS(x4,j4);
|
||||
x5 = PLUS(x5,j5);
|
||||
x6 = PLUS(x6,j6);
|
||||
x7 = PLUS(x7,j7);
|
||||
x8 = PLUS(x8,j8);
|
||||
x9 = PLUS(x9,j9);
|
||||
x10 = PLUS(x10,j10);
|
||||
x11 = PLUS(x11,j11);
|
||||
x12 = PLUS(x12,j12);
|
||||
x13 = PLUS(x13,j13);
|
||||
x14 = PLUS(x14,j14);
|
||||
x15 = PLUS(x15,j15);
|
||||
|
||||
x0 = XOR(x0,U8TO32_LITTLE(m + 0));
|
||||
x1 = XOR(x1,U8TO32_LITTLE(m + 4));
|
||||
x2 = XOR(x2,U8TO32_LITTLE(m + 8));
|
||||
x3 = XOR(x3,U8TO32_LITTLE(m + 12));
|
||||
x4 = XOR(x4,U8TO32_LITTLE(m + 16));
|
||||
x5 = XOR(x5,U8TO32_LITTLE(m + 20));
|
||||
x6 = XOR(x6,U8TO32_LITTLE(m + 24));
|
||||
x7 = XOR(x7,U8TO32_LITTLE(m + 28));
|
||||
x8 = XOR(x8,U8TO32_LITTLE(m + 32));
|
||||
x9 = XOR(x9,U8TO32_LITTLE(m + 36));
|
||||
x10 = XOR(x10,U8TO32_LITTLE(m + 40));
|
||||
x11 = XOR(x11,U8TO32_LITTLE(m + 44));
|
||||
x12 = XOR(x12,U8TO32_LITTLE(m + 48));
|
||||
x13 = XOR(x13,U8TO32_LITTLE(m + 52));
|
||||
x14 = XOR(x14,U8TO32_LITTLE(m + 56));
|
||||
x15 = XOR(x15,U8TO32_LITTLE(m + 60));
|
||||
|
||||
j8 = PLUSONE(j8);
|
||||
if (!j8) {
|
||||
j9 = PLUSONE(j9);
|
||||
/* stopping at 2^70 bytes per nonce is user's responsibility */
|
||||
}
|
||||
|
||||
U32TO8_LITTLE(c + 0,x0);
|
||||
U32TO8_LITTLE(c + 4,x1);
|
||||
U32TO8_LITTLE(c + 8,x2);
|
||||
U32TO8_LITTLE(c + 12,x3);
|
||||
U32TO8_LITTLE(c + 16,x4);
|
||||
U32TO8_LITTLE(c + 20,x5);
|
||||
U32TO8_LITTLE(c + 24,x6);
|
||||
U32TO8_LITTLE(c + 28,x7);
|
||||
U32TO8_LITTLE(c + 32,x8);
|
||||
U32TO8_LITTLE(c + 36,x9);
|
||||
U32TO8_LITTLE(c + 40,x10);
|
||||
U32TO8_LITTLE(c + 44,x11);
|
||||
U32TO8_LITTLE(c + 48,x12);
|
||||
U32TO8_LITTLE(c + 52,x13);
|
||||
U32TO8_LITTLE(c + 56,x14);
|
||||
U32TO8_LITTLE(c + 60,x15);
|
||||
|
||||
if (bytes <= 64) {
|
||||
if (bytes < 64) {
|
||||
for (i = 0;i < bytes;++i) ctarget[i] = c[i];
|
||||
}
|
||||
x->input[8] = j8;
|
||||
x->input[9] = j9;
|
||||
return;
|
||||
}
|
||||
bytes -= 64;
|
||||
c += 64;
|
||||
m += 64;
|
||||
}
|
||||
}
|
||||
|
||||
void ECRYPT_decrypt_bytes(ECRYPT_ctx *x,const u8 *c,u8 *m,u32 bytes)
|
||||
{
|
||||
ECRYPT_encrypt_bytes(x,c,m,bytes);
|
||||
}
|
||||
|
||||
void ECRYPT_keystream_bytes(ECRYPT_ctx *x,u8 *stream,u32 bytes)
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0;i < bytes;++i) stream[i] = 0;
|
||||
ECRYPT_encrypt_bytes(x,stream,stream,bytes);
|
||||
}
|
||||
259
libs/compression/sha1.cpp
Normal file
259
libs/compression/sha1.cpp
Normal file
@ -0,0 +1,259 @@
|
||||
/*
|
||||
SHA-1 in C
|
||||
By Steve Reid <sreid@sea-to-sky.net>
|
||||
100% Public Domain
|
||||
|
||||
-----------------
|
||||
Modified 7/98
|
||||
By James H. Brown <jbrown@burgoyne.com>
|
||||
Still 100% Public Domain
|
||||
|
||||
Corrected a problem which generated improper hash values on 16 bit machines
|
||||
Routine SHA1Update changed from
|
||||
void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int
|
||||
len)
|
||||
to
|
||||
void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned
|
||||
long len)
|
||||
|
||||
The 'len' parameter was declared an int which works fine on 32 bit machines.
|
||||
However, on 16 bit machines an int is too small for the shifts being done
|
||||
against
|
||||
it. This caused the hash function to generate incorrect values if len was
|
||||
greater than 8191 (8K - 1) due to the 'len << 3' on line 3 of SHA1Update().
|
||||
|
||||
Since the file IO in main() reads 16K at a time, any file 8K or larger would
|
||||
be guaranteed to generate the wrong hash (e.g. Test Vector #3, a million
|
||||
"a"s).
|
||||
|
||||
I also changed the declaration of variables i & j in SHA1Update to
|
||||
unsigned long from unsigned int for the same reason.
|
||||
|
||||
These changes should make no difference to any 32 bit implementations since
|
||||
an
|
||||
int and a long are the same size in those environments.
|
||||
|
||||
--
|
||||
I also corrected a few compiler warnings generated by Borland C.
|
||||
1. Added #include <process.h> for exit() prototype
|
||||
2. Removed unused variable 'j' in SHA1Final
|
||||
3. Changed exit(0) to return(0) at end of main.
|
||||
|
||||
ALL changes I made can be located by searching for comments containing 'JHB'
|
||||
-----------------
|
||||
Modified 8/98
|
||||
By Steve Reid <sreid@sea-to-sky.net>
|
||||
Still 100% public domain
|
||||
|
||||
1- Removed #include <process.h> and used return() instead of exit()
|
||||
2- Fixed overwriting of finalcount in SHA1Final() (discovered by Chris Hall)
|
||||
3- Changed email address from steve@edmweb.com to sreid@sea-to-sky.net
|
||||
|
||||
-----------------
|
||||
Modified 4/01
|
||||
By Saul Kravitz <Saul.Kravitz@celera.com>
|
||||
Still 100% PD
|
||||
Modified to run on Compaq Alpha hardware.
|
||||
|
||||
-----------------
|
||||
Modified 07/2002
|
||||
By Ralph Giles <giles@artofcode.com>
|
||||
Still 100% public domain
|
||||
modified for use with stdint types, autoconf
|
||||
code cleanup, removed attribution comments
|
||||
switched SHA1Final() argument order for consistency
|
||||
use SHA1_ prefix for public api
|
||||
move public api to sha1.h
|
||||
*/
|
||||
|
||||
/*
|
||||
Test Vectors (from FIPS PUB 180-1)
|
||||
"abc"
|
||||
A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
|
||||
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
|
||||
84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
|
||||
A million repetitions of "a"
|
||||
34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
|
||||
*/
|
||||
|
||||
#define SHA1HANDSOFF
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "os_types.h"
|
||||
#include "sha1.h"
|
||||
|
||||
void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]);
|
||||
|
||||
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
|
||||
|
||||
/* blk0() and blk() perform the initial expand. */
|
||||
/* I got the idea of expanding during the round function from SSLeay */
|
||||
/* FIXME: can we do this in an endian-proof way? */
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#define blk0(i) block->l[i]
|
||||
#else
|
||||
#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
|
||||
|(rol(block->l[i],8)&0x00FF00FF))
|
||||
#endif
|
||||
#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
|
||||
^block->l[(i+2)&15]^block->l[i&15],1))
|
||||
|
||||
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
|
||||
#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);
|
||||
#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
|
||||
#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
|
||||
#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
|
||||
#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
|
||||
|
||||
|
||||
#ifdef VERBOSE /* SAK */
|
||||
void SHAPrintContext(SHA1_CTX *context, char *msg){
|
||||
printf("%s (%d,%d) %x %x %x %x %x\n",
|
||||
msg,
|
||||
context->count[0], context->count[1],
|
||||
context->state[0],
|
||||
context->state[1],
|
||||
context->state[2],
|
||||
context->state[3],
|
||||
context->state[4]);
|
||||
}
|
||||
#endif /* VERBOSE */
|
||||
|
||||
/* Hash a single 512-bit block. This is the core of the algorithm. */
|
||||
void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64])
|
||||
{
|
||||
uint32_t a, b, c, d, e;
|
||||
typedef union {
|
||||
uint8_t c[64];
|
||||
uint32_t l[16];
|
||||
} CHAR64LONG16;
|
||||
CHAR64LONG16* block;
|
||||
|
||||
#ifdef SHA1HANDSOFF
|
||||
static uint8_t workspace[64];
|
||||
block = (CHAR64LONG16*)workspace;
|
||||
memcpy(block, buffer, 64);
|
||||
#else
|
||||
block = (CHAR64LONG16*)buffer;
|
||||
#endif
|
||||
|
||||
/* Copy context->state[] to working vars */
|
||||
a = state[0];
|
||||
b = state[1];
|
||||
c = state[2];
|
||||
d = state[3];
|
||||
e = state[4];
|
||||
|
||||
/* 4 rounds of 20 operations each. Loop unrolled. */
|
||||
R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
|
||||
R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
|
||||
R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
|
||||
R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
|
||||
R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
|
||||
R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
|
||||
R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
|
||||
R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
|
||||
R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
|
||||
R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
|
||||
R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
|
||||
R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
|
||||
R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
|
||||
R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
|
||||
R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
|
||||
R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
|
||||
R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
|
||||
R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
|
||||
R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
|
||||
R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
|
||||
|
||||
/* Add the working vars back into context.state[] */
|
||||
state[0] += a;
|
||||
state[1] += b;
|
||||
state[2] += c;
|
||||
state[3] += d;
|
||||
state[4] += e;
|
||||
|
||||
/* Wipe variables */
|
||||
a = b = c = d = e = 0;
|
||||
}
|
||||
|
||||
|
||||
/* SHA1Init - Initialize new context */
|
||||
void SHA1_Init(SHA1_CTX* context)
|
||||
{
|
||||
/* SHA1 initialization constants */
|
||||
context->state[0] = 0x67452301;
|
||||
context->state[1] = 0xEFCDAB89;
|
||||
context->state[2] = 0x98BADCFE;
|
||||
context->state[3] = 0x10325476;
|
||||
context->state[4] = 0xC3D2E1F0;
|
||||
context->count[0] = context->count[1] = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Run your data through this. */
|
||||
void SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len)
|
||||
{
|
||||
size_t i, j;
|
||||
|
||||
#ifdef VERBOSE
|
||||
SHAPrintContext(context, "before");
|
||||
#endif
|
||||
|
||||
j = (context->count[0] >> 3) & 63;
|
||||
if ((context->count[0] += len << 3) < (len << 3)) context->count[1]++;
|
||||
context->count[1] += (len >> 29);
|
||||
if ((j + len) > 63) {
|
||||
memcpy(&context->buffer[j], data, (i = 64-j));
|
||||
SHA1_Transform(context->state, context->buffer);
|
||||
for ( ; i + 63 < len; i += 64) {
|
||||
SHA1_Transform(context->state, data + i);
|
||||
}
|
||||
j = 0;
|
||||
}
|
||||
else i = 0;
|
||||
memcpy(&context->buffer[j], &data[i], len - i);
|
||||
|
||||
#ifdef VERBOSE
|
||||
SHAPrintContext(context, "after ");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Add padding and return the message digest. */
|
||||
void SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE])
|
||||
{
|
||||
uint32_t i;
|
||||
uint8_t finalcount[8];
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)]
|
||||
>> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
|
||||
}
|
||||
SHA1_Update(context, (uint8_t *)"\200", 1);
|
||||
while ((context->count[0] & 504) != 448) {
|
||||
SHA1_Update(context, (uint8_t *)"\0", 1);
|
||||
}
|
||||
SHA1_Update(context, finalcount, 8); /* Should cause a SHA1_Transform() */
|
||||
for (i = 0; i < SHA1_DIGEST_SIZE; i++) {
|
||||
digest[i] = (uint8_t)
|
||||
((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
|
||||
}
|
||||
|
||||
/* Wipe variables */
|
||||
i = 0;
|
||||
memset(context->buffer, 0, 64);
|
||||
memset(context->state, 0, 20);
|
||||
memset(context->count, 0, 8);
|
||||
memset(finalcount, 0, 8); /* SWR */
|
||||
|
||||
#ifdef SHA1HANDSOFF /* make SHA1Transform overwrite its own static vars */
|
||||
SHA1_Transform(context->state, context->buffer);
|
||||
#endif
|
||||
}
|
||||
29
libs/compression/sha1.h
Normal file
29
libs/compression/sha1.h
Normal file
@ -0,0 +1,29 @@
|
||||
/* public api for steve reid's public domain SHA-1 implementation */
|
||||
/* this file is in the public domain */
|
||||
|
||||
#include "config_win32.h"
|
||||
|
||||
#ifndef __SHA1_H
|
||||
#define __SHA1_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
uint32_t state[5];
|
||||
uint32_t count[2];
|
||||
uint8_t buffer[64];
|
||||
} SHA1_CTX;
|
||||
|
||||
#define SHA1_DIGEST_SIZE 20
|
||||
|
||||
void SHA1_Init(SHA1_CTX* context);
|
||||
void SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len);
|
||||
void SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SHA1_H */
|
||||
16
libs/core/core.pro
Normal file
16
libs/core/core.pro
Normal file
@ -0,0 +1,16 @@
|
||||
QT += core widgets
|
||||
TEMPLATE = lib
|
||||
CONFIG += staticlib c++17 debug
|
||||
|
||||
SOURCES += \
|
||||
logmanager.cpp \
|
||||
statusbarmanager.cpp
|
||||
|
||||
HEADERS += \
|
||||
enums.h \
|
||||
logmanager.h \
|
||||
stringutils.h \
|
||||
utils.h \
|
||||
statusbarmanager.h
|
||||
|
||||
DESTDIR = $$OUT_PWD/../
|
||||
13
libs/core/logmanager.cpp
Normal file
13
libs/core/logmanager.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include "logmanager.h"
|
||||
|
||||
void LogManager::addEntry(const QString &entry) {
|
||||
emit entryAdded(entry);
|
||||
}
|
||||
|
||||
void LogManager::addError(const QString &error) {
|
||||
emit entryAdded(QString("ERROR: " + error));
|
||||
}
|
||||
|
||||
void LogManager::addLine() {
|
||||
emit entryAdded("");
|
||||
}
|
||||
31
libs/core/logmanager.h
Normal file
31
libs/core/logmanager.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef LOGMANAGER_H
|
||||
#define LOGMANAGER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
class LogManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static LogManager &instance() {
|
||||
static LogManager instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void addEntry(const QString &entry);
|
||||
void addError(const QString &error);
|
||||
void addLine();
|
||||
|
||||
signals:
|
||||
void entryAdded(const QString &entry);
|
||||
|
||||
private:
|
||||
LogManager() {} // Private constructor for singleton
|
||||
~LogManager() {}
|
||||
|
||||
Q_DISABLE_COPY(LogManager)
|
||||
};
|
||||
|
||||
#endif // LOGMANAGER_H
|
||||
0
libs/core/stringutils.h
Normal file
0
libs/core/stringutils.h
Normal file
@ -1,6 +1,6 @@
|
||||
#include "ddsfile.h"
|
||||
#include "enums.h"
|
||||
#include "iwifile.h"
|
||||
#include "qdir.h"
|
||||
|
||||
DDSPixelFormat DDSFile::CalculatePixelFormat(quint8 aIWIFormat) {
|
||||
DDSPixelFormat ddsPixelFormat = {};
|
||||
@ -9,7 +9,7 @@
|
||||
#include <QVector>
|
||||
#include <QDebug>
|
||||
#include <QImage>
|
||||
#include <DevILSDK/include/IL/il.h>
|
||||
#include <IL/il.h>
|
||||
|
||||
struct DDSPixelFormat {
|
||||
quint32 size;
|
||||
27
libs/ddsfile/ddsfile.pro
Normal file
27
libs/ddsfile/ddsfile.pro
Normal file
@ -0,0 +1,27 @@
|
||||
QT += core
|
||||
TEMPLATE = lib
|
||||
CONFIG += staticlib c++17 debug
|
||||
|
||||
SOURCES += \
|
||||
ddsfile.cpp
|
||||
|
||||
HEADERS += \
|
||||
dds_structs.h \
|
||||
ddsfile.h \
|
||||
enums.h
|
||||
|
||||
LIBS += \
|
||||
-L$$PWD/../../third_party/devil_sdk/lib/ -lDevIL \
|
||||
-L$$PWD/../../third_party/devil_sdk/lib/ -lILU \
|
||||
-L$$PWD/../../third_party/devil_sdk/lib/ -lILUT \
|
||||
-L$$OUT_PWD/../libs/iwifile -liwifile
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/../iwifile/ \
|
||||
$$PWD/../../third_party/devil_sdk/include/
|
||||
|
||||
DEPENDPATH += \
|
||||
$$PWD/../iwifile/ \
|
||||
$$PWD/../../third_party/devil_sdk/include/
|
||||
|
||||
DESTDIR = $$OUT_PWD/../
|
||||
876
libs/ddsfile/enums.h
Normal file
876
libs/ddsfile/enums.h
Normal file
@ -0,0 +1,876 @@
|
||||
#ifndef ENUMS_H
|
||||
#define ENUMS_H
|
||||
|
||||
#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
|
||||
};
|
||||
|
||||
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 {
|
||||
IWI_VERSION_COD2 = 0x05, // 05 CoD2
|
||||
IWI_VERSION_COD4 = 0x06, // 06 CoD4
|
||||
IWI_VERSION_COD5 = 0x06, // 06 CoD5
|
||||
IWI_VERSION_CODMW2 = 0x08, // 08 CoDMW2
|
||||
IWI_VERSION_CODMW3 = 0x08, // 08 CoDMW3
|
||||
IWI_VERSION_CODBO1 = 0x0D, // 13 CoDBO1
|
||||
IWI_VERSION_CODBO2 = 0x1B, // 27 CoDBO2
|
||||
};
|
||||
|
||||
enum IWI_FORMAT {
|
||||
// IWI Format
|
||||
IWI_FORMAT_ARGB32 = 0x01, // 01 ARGB32
|
||||
IWI_FORMAT_RGB24 = 0x02, // 02 RGB24
|
||||
IWI_FORMAT_GA16 = 0x03, // 03 GA16
|
||||
IWI_FORMAT_A8 = 0x04, // 04 A8
|
||||
IWI_FORMAT_DXT1 = 0x0B, // 11 DXT1
|
||||
IWI_FORMAT_DXT3 = 0x0C, // 12 DXT3
|
||||
IWI_FORMAT_DXT5 = 0x0D // 13 DXT5
|
||||
};
|
||||
|
||||
enum DDS_FLAGS {
|
||||
DDSD_CAPS = 0x1,
|
||||
DDSD_HEIGHT = 0x2,
|
||||
DDSD_WIDTH = 0x4,
|
||||
DDSD_PITCH = 0x8,
|
||||
DDSD_PIXELFORMAT = 0x1000,
|
||||
DDSD_MIPMAPCOUNT = 0x20000,
|
||||
DDSD_LINEARSIZE = 0x80000,
|
||||
DDSD_DEPTH = 0x800000
|
||||
};
|
||||
|
||||
enum DDS_PIXELFORMAT_FLAGS {
|
||||
DDPF_ALPHAPIXELS = 0x1,
|
||||
DDPF_ALPHA = 0x2,
|
||||
DDPF_FOURCC = 0x4,
|
||||
DDPF_RGB = 0x40,
|
||||
DDPF_YUV = 0x200,
|
||||
DDPF_LUMINANCE = 0x20000
|
||||
};
|
||||
|
||||
enum DDS_CAPS_FLAGS {
|
||||
DDSCAPS_COMPLEX = 0x8,
|
||||
DDSCAPS_MIPMAP = 0x400000,
|
||||
DDSCAPS_TEXTURE = 0x1000
|
||||
};
|
||||
|
||||
enum DDS_CAPS2_FLAGS {
|
||||
DDSCAPS2_CUBEMAP = 0x200, // Indicates a cubemap.
|
||||
DDSCAPS2_CUBEMAP_POSITIVEX = 0x400,
|
||||
DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800,
|
||||
DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000,
|
||||
DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000,
|
||||
DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000,
|
||||
DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000,
|
||||
DDSCAPS2_VOLUME = 0x200000 // Indicates that the texture is a volume texture.
|
||||
};
|
||||
|
||||
enum LUMP_TYPE
|
||||
{
|
||||
LUMP_MATERIALS = 0x0,
|
||||
LUMP_LIGHTBYTES = 0x1,
|
||||
LUMP_LIGHTGRIDENTRIES = 0x2,
|
||||
LUMP_LIGHTGRIDCOLORS = 0x3,
|
||||
LUMP_PLANES = 0x4,
|
||||
LUMP_BRUSHSIDES = 0x5,
|
||||
LUMP_BRUSHSIDEEDGECOUNTS = 0x6,
|
||||
LUMP_BRUSHEDGES = 0x7,
|
||||
LUMP_BRUSHES = 0x8,
|
||||
LUMP_TRIANGLES = 0x9,
|
||||
LUMP_DRAWVERTS = 0xA,
|
||||
LUMP_DRAWINDICES = 0xB,
|
||||
LUMP_CULLGROUPS = 0xC,
|
||||
LUMP_CULLGROUPINDICES = 0xD,
|
||||
LUMP_OBSOLETE_1 = 0xE,
|
||||
LUMP_OBSOLETE_2 = 0xF,
|
||||
LUMP_OBSOLETE_3 = 0x10,
|
||||
LUMP_OBSOLETE_4 = 0x11,
|
||||
LUMP_OBSOLETE_5 = 0x12,
|
||||
LUMP_PORTALVERTS = 0x13,
|
||||
LUMP_OBSOLETE_6 = 0x14,
|
||||
LUMP_UINDS = 0x15,
|
||||
LUMP_BRUSHVERTSCOUNTS = 0x16,
|
||||
LUMP_BRUSHVERTS = 0x17,
|
||||
LUMP_AABBTREES = 0x18,
|
||||
LUMP_CELLS = 0x19,
|
||||
LUMP_PORTALS = 0x1A,
|
||||
LUMP_NODES = 0x1B,
|
||||
LUMP_LEAFS = 0x1C,
|
||||
LUMP_LEAFBRUSHES = 0x1D,
|
||||
LUMP_LEAFSURFACES = 0x1E,
|
||||
LUMP_COLLISIONVERTS = 0x1F,
|
||||
LUMP_COLLISIONTRIS = 0x20,
|
||||
LUMP_COLLISIONEDGEWALKABLE = 0x21,
|
||||
LUMP_COLLISIONBORDERS = 0x22,
|
||||
LUMP_COLLISIONPARTITIONS = 0x23,
|
||||
LUMP_COLLISIONAABBS = 0x24,
|
||||
LUMP_MODELS = 0x25,
|
||||
LUMP_VISIBILITY = 0x26,
|
||||
LUMP_ENTITIES = 0x27,
|
||||
LUMP_PATHCONNECTIONS = 0x28,
|
||||
LUMP_REFLECTION_PROBES = 0x29,
|
||||
LUMP_VERTEX_LAYER_DATA = 0x2A,
|
||||
LUMP_PRIMARY_LIGHTS = 0x2B,
|
||||
LUMP_LIGHTGRIDHEADER = 0x2C,
|
||||
LUMP_LIGHTGRIDROWS = 0x2D,
|
||||
LUMP_OBSOLETE_10 = 0x2E,
|
||||
|
||||
//Obsolete in BO1/////////////////
|
||||
LUMP_UNLAYERED_TRIANGLES = 0x2F,
|
||||
LUMP_UNLAYERED_DRAWVERTS = 0x30,
|
||||
LUMP_UNLAYERED_DRAWINDICES = 0x31,
|
||||
LUMP_UNLAYERED_CULLGROUPS = 0x32,
|
||||
LUMP_UNLAYERED_AABBTREES = 0x33,
|
||||
//////////////////////////////////
|
||||
|
||||
LUMP_WATERHEADER = 0x34,
|
||||
LUMP_WATERCELLS = 0x35,
|
||||
LUMP_WATERCELLDATA = 0x36,
|
||||
LUMP_BURNABLEHEADER = 0x37,
|
||||
LUMP_BURNABLECELLS = 0x38,
|
||||
LUMP_BURNABLECELLDATA = 0x39,
|
||||
LUMP_SIMPLELIGHTMAPBYTES = 0x3A,
|
||||
LUMP_LODCHAINS = 0x3B,
|
||||
LUMP_LODINFOS = 0x3C,
|
||||
LUMP_LODSURFACES = 0x3D,
|
||||
LUMP_LIGHTREGIONS = 0x3E,
|
||||
LUMP_LIGHTREGION_HULLS = 0x3F,
|
||||
LUMP_LIGHTREGION_AXES = 0x40,
|
||||
LUMP_WIILIGHTGRID = 0x41,
|
||||
LUMP_LIGHTGRID2D_LIGHTS = 0x42,
|
||||
LUMP_LIGHTGRID2D_INDICES = 0x43,
|
||||
LUMP_LIGHTGRID2D_POINTS = 0x44,
|
||||
LUMP_LIGHTGRID2D_CELLS = 0x45,
|
||||
LUMP_LIGHT_CORONAS = 0x46,
|
||||
|
||||
//BO Specific/////////////////////////
|
||||
LUMP_SHADOWMAP_VOLUMES = 0x47,
|
||||
LUMP_SHADOWMAP_VOLUME_PLANES = 0x48,
|
||||
LUMP_EXPOSURE_VOLUMES = 0x49,
|
||||
LUMP_EXPOSURE_VOLUME_PLANES = 0x4A,
|
||||
LUMP_OCCLUDERS = 0x4B,
|
||||
LUMP_OUTDOORBOUNDS = 0x4C,
|
||||
LUMP_HERO_ONLY_LIGHTS = 0x4D,
|
||||
//////////////////////////////////////
|
||||
|
||||
INFO_LUMP_TYPE_COUNT
|
||||
};
|
||||
|
||||
enum BSPVERSION_TYPE
|
||||
{
|
||||
BSPVERSION_COD_WAW = 31,
|
||||
BSPVERSION_COD_BO = 45
|
||||
};
|
||||
|
||||
enum FF_COMPANY {
|
||||
COMPANY_NONE = 0x00,
|
||||
COMPANY_INFINITY_WARD = 0x01,
|
||||
COMPANY_TREYARCH = 0x02,
|
||||
COMPANY_SLEDGEHAMMER = 0x03,
|
||||
COMPANY_NEVERSOFT = 0x04
|
||||
};
|
||||
|
||||
enum FF_FILETYPE {
|
||||
FILETYPE_NONE = 0x00,
|
||||
FILETYPE_FAST_FILE = 0x01
|
||||
};
|
||||
|
||||
enum FF_SIGNAGE {
|
||||
SIGNAGE_NONE = 0x00,
|
||||
SIGNAGE_SIGNED = 0x01,
|
||||
SIGNAGE_UNSIGNED = 0x02
|
||||
};
|
||||
|
||||
enum IMAGE_COMPRESSION {
|
||||
COMPRESSION_NONE = 0x00,
|
||||
COMPRESSION_DXT1 = 0x01,
|
||||
COMPRESSION_DXT3 = 0x02,
|
||||
COMPRESSION_DXT5 = 0x03
|
||||
};
|
||||
enum MENU_ITEM_TYPE {
|
||||
ITEM_TYPE_TEXT = 0, // simple text
|
||||
ITEM_TYPE_BUTTON = 1, // button, basically text with a border
|
||||
ITEM_TYPE_RADIOBUTTON = 2, // toggle button, may be grouped
|
||||
ITEM_TYPE_CHECKBOX = 3, // check box
|
||||
ITEM_TYPE_EDITFIELD = 4, // editable text, associated with a dvar
|
||||
ITEM_TYPE_COMBO = 5, // drop down list
|
||||
ITEM_TYPE_LISTBOX = 6, // scrollable list
|
||||
ITEM_TYPE_MODEL = 7, // model
|
||||
ITEM_TYPE_OWNERDRAW = 8, // owner draw, name specs what it is
|
||||
ITEM_TYPE_NUMERICFIELD = 9, // editable text, associated with a dvar
|
||||
ITEM_TYPE_SLIDER = 10, // mouse speed, volume, etc.
|
||||
ITEM_TYPE_YESNO = 11, // yes no dvar setting
|
||||
ITEM_TYPE_MULTI = 12, // multiple list setting, enumerated
|
||||
ITEM_TYPE_DVARENUM = 13, // multiple list setting, enumerated from a dvar
|
||||
ITEM_TYPE_BIND = 14, // bind
|
||||
ITEM_TYPE_MENUMODEL = 15, // special menu model
|
||||
ITEM_TYPE_VALIDFILEFIELD = 16, // text must be valid for use in a dos filename
|
||||
ITEM_TYPE_DECIMALFIELD = 17, // editable text, associated with a dvar, which allows decimal input
|
||||
ITEM_TYPE_UPREDITFIELD = 18, // editable text, associated with a dvar
|
||||
ITEM_TYPE_GAME_MESSAGE_WINDOW = 19, // game message window
|
||||
ITEM_TYPE_SCALEFORM = 20, // Flash movie for Scaleform GFx
|
||||
ITEM_TYPE_BIND2 = 21, // bind2
|
||||
};
|
||||
|
||||
enum MENU_ITEM_H_ALIGN {
|
||||
ITEM_ALIGN_LEFT = 0, // aligns left of text to left of containing rectangle
|
||||
ITEM_ALIGN_CENTER = 1, // aligns center of text to center of containing rectangle
|
||||
ITEM_ALIGN_RIGHT = 2, // aligns right of text to right of containing rectangle
|
||||
ITEM_ALIGN_X_MASK = 3,
|
||||
};
|
||||
|
||||
enum MENU_ITEM_V_ALIGN {
|
||||
ITEM_ALIGN_LEGACY = 0, // aligns bottom of text to top of containing rectangle
|
||||
ITEM_ALIGN_TOP = 4, // aligns top of text to top of containing rectangle
|
||||
ITEM_ALIGN_MIDDLE = 8, // aligns middle of text to middle of containing rectangle
|
||||
ITEM_ALIGN_BOTTOM = 12, // aligns bottom of text to bottom of containing rectangle
|
||||
ITEM_ALIGN_Y_MASK = 12,
|
||||
};
|
||||
|
||||
enum MENU_ITEM_ALIGN {
|
||||
ITEM_ALIGN_LEGACY_LEFT = 0,
|
||||
ITEM_ALIGN_LEGACY_CENTER = 1,
|
||||
ITEM_ALIGN_LEGACY_RIGHT = 2,
|
||||
ITEM_ALIGN_TOP_LEFT = 4,
|
||||
ITEM_ALIGN_TOP_CENTER = 5,
|
||||
ITEM_ALIGN_TOP_RIGHT = 6,
|
||||
ITEM_ALIGN_MIDDLE_LEFT = 8,
|
||||
ITEM_ALIGN_MIDDLE_CENTER = 9,
|
||||
ITEM_ALIGN_MIDDLE_RIGHT = 10,
|
||||
ITEM_ALIGN_BOTTOM_LEFT = 12,
|
||||
ITEM_ALIGN_BOTTOM_CENTER = 13,
|
||||
ITEM_ALIGN_BOTTOM_RIGHT = 14
|
||||
};
|
||||
|
||||
enum MENU_ITEM_TEXTSTYLE {
|
||||
ITEM_TEXTSTYLE_NORMAL = 0, // normal text
|
||||
ITEM_TEXTSTYLE_BLINK = 1, // fast blinking
|
||||
ITEM_TEXTSTYLE_SHADOWED = 3, // drop shadow ( need a color for this )
|
||||
ITEM_TEXTSTYLE_SHADOWEDMORE = 6, // drop shadow ( need a color for this )
|
||||
ITEM_TEXTSTYLE_MONOSPACE = 128
|
||||
};
|
||||
|
||||
enum MENU_WINDOW_BORDER {
|
||||
WINDOW_BORDER_NONE = 0, // no border
|
||||
WINDOW_BORDER_FULL = 1, // full border based on border color ( single pixel )
|
||||
WINDOW_BORDER_HORZ = 2, // horizontal borders only
|
||||
WINDOW_BORDER_VERT = 3, // vertical borders only
|
||||
WINDOW_BORDER_KCGRADIENT = 4, // horizontal border using the gradient bars
|
||||
WINDOW_BORDER_RAISED = 5, // darken the bottom and right sides of the border
|
||||
WINDOW_BORDER_SUNKEN = 6 // darken the top and left sides of the border
|
||||
};
|
||||
|
||||
enum MENU_WINDOW_STYLE {
|
||||
WINDOW_STYLE_EMPTY = 0, // no background
|
||||
WINDOW_STYLE_FILLED = 1, // filled with background color
|
||||
WINDOW_STYLE_GRADIENT = 2, // gradient bar based on background color
|
||||
WINDOW_STYLE_SHADER = 3, // shader based on background color
|
||||
WINDOW_STYLE_TEAMCOLOR = 4, // team color
|
||||
WINDOW_STYLE_DVAR_SHADER = 5, // draws the shader specified by the dvar
|
||||
WINDOW_STYLE_LOADBAR = 6, // shader based on background color
|
||||
};
|
||||
|
||||
enum MENU_MODE {
|
||||
MODE_BOTTOMUP_ALIGN_TOP = 0, // text appears on bottom of list and moves up to specified Y coordinate as old text fades out
|
||||
MODE_BOTTOMUP_ALIGN_BOTTOM = 1, // text appears on bottom of list and moves away from specified Y coordinate as new text pushes it up
|
||||
MODE_TOPDOWN_ALIGN_TOP = 2, // text appears on top of list and moves away from specified Y coordinate as new text pushes it down
|
||||
MODE_TOPDOWN_ALIGN_BOTTOM = 3 // text appears on top of list and moves down to specified Y coordinate as old text fades out
|
||||
};
|
||||
|
||||
enum MENU_BOOL {
|
||||
MENU_TRUE = 1,
|
||||
MENU_FALSE = 0
|
||||
};
|
||||
|
||||
enum MENU_ORIENTATION {
|
||||
HUD_VERTICAL = 0x00,
|
||||
HUD_HORIZONTAL = 0x01
|
||||
};
|
||||
|
||||
enum MENU_RANGETYPE {
|
||||
RANGETYPE_ABSOLUTE = 0,
|
||||
RANGETYPE_RELATIVE = 1
|
||||
};
|
||||
|
||||
// list box element types
|
||||
enum MENU_LIST_BOX {
|
||||
LISTBOX_TEXT = 0x00,
|
||||
LISTBOX_IMAGE = 0x01
|
||||
};
|
||||
|
||||
// list feeders
|
||||
enum MENU_FEEDERS {
|
||||
FEEDER_HEADS = 0x00, // model heads
|
||||
FEEDER_MAPS = 0x01, // text maps based on game type
|
||||
FEEDER_SERVERS = 0x02, // servers
|
||||
FEEDER_CLAN_MEMBERS = 0x03, // clan names
|
||||
FEEDER_ALLMAPS = 0x04, // all maps available, in graphic format
|
||||
FEEDER_REDTEAM_LIST = 0x05, // red team members
|
||||
FEEDER_BLUETEAM_LIST = 0x06, // blue team members
|
||||
FEEDER_PLAYER_LIST = 0x07, // players
|
||||
FEEDER_TEAM_LIST = 0x08, // team members for team voting
|
||||
FEEDER_MODS = 0x09, // team members for team voting
|
||||
FEEDER_DEMOS = 0x0a, // team members for team voting
|
||||
FEEDER_SCOREBOARD = 0x0b, // team members for team voting
|
||||
FEEDER_Q3HEADS = 0x0c, // model heads
|
||||
FEEDER_SERVERSTATUS = 0x0d, // server status
|
||||
FEEDER_FINDPLAYER = 0x0e, // find player
|
||||
FEEDER_CINEMATICS = 0x0f, // cinematics
|
||||
FEEDER_SAVEGAMES = 0x10, // savegames
|
||||
FEEDER_PICKSPAWN = 0x11, // pickspawn
|
||||
FEEDER_LOBBY_MEMBERS = 0x12, // list of players in your party
|
||||
FEEDER_LOBBY_MEMBERS_TALK = 0x13, // icon for whether they are speaking or not
|
||||
FEEDER_MUTELIST = 0x14, // list of musted players
|
||||
FEEDER_PLAYERSTALKING = 0x15, // list of players who are currently talking
|
||||
FEEDER_SPLITSCREENPLAYERS = 0x16, // list of all players who are playing splitscreen
|
||||
FEEDER_LOBBY_MEMBERS_READY = 0x17, // icon for whether they are ready or not
|
||||
FEEDER_PLAYER_PROFILES = 0x18, // player profiles
|
||||
FEEDER_PARTY_MEMBERS = 0x19, // list of players in your party
|
||||
FEEDER_PARTY_MEMBERS_TALK = 0x1a, // icon for whether they are speaking or not
|
||||
FEEDER_PARTY_MEMBERS_READY = 0x1b, // icon for whether they are ready or not
|
||||
FEEDER_PLAYLISTS = 0x1c, // list of all playlists
|
||||
FEEDER_GAMEMODES = 0x1d, // list of all game type modes, including any player custom modes
|
||||
FEEDER_CATEGORIES = 0x1e, // list of all categories
|
||||
FEEDER_LEADERBOARD = 0x1f, // list of rows for a leaderboard
|
||||
FEEDER_MYTEAM_MEMBERS = 0x20, // list of marine team members
|
||||
FEEDER_MYTEAM_MEMBERS_TALK = 0x21, // icon for whether they are speaking
|
||||
FEEDER_ENEMY_MEMBERS = 0x22, // list of opfor team members
|
||||
FEEDER_ENEMY_MEMBERS_TALK = 0x23, // icon for whether they are speaking
|
||||
FEEDER_LOBBY_MEMBERS_STAT = 0x24, // last round stats for lobby members
|
||||
FEEDER_MYTEAM_MEMBERS_STAT = 0x25, // last round stats for marine team members
|
||||
FEEDER_ENEMY_MEMBERS_STAT = 0x26, // last round stats for opfor team members
|
||||
FEEDER_ONLINEFRIENDS = 0x27, // list of your online friends
|
||||
FEEDER_LOBBY_MEMBERS_RANK = 0x28, // rank icon
|
||||
FEEDER_PARTY_MEMBERS_RANK = 0x29, // rank icon
|
||||
FEEDER_ENEMY_MEMBERS_RANK = 0x2a, // rank icon
|
||||
FEEDER_MYTEAM_MEMBERS_RANK = 0x2b, // rank icon
|
||||
FEEDER_TESTMAPS = 0x2c, // department test maps
|
||||
FEEDER_SYSTEMLINK_LOBBY_MEMBERS = 0x2d, // list of players in a system link lobby
|
||||
FEEDER_LOBBY_MEMBERS_CONTROLLER = 0x2e, // icon for controller quadrant for splitscreen
|
||||
FEEDER_PARTY_MEMBERS_CONTROLLER = 0x2f, // icon for controller quadrant for splitscreen
|
||||
FEEDER_MYTEAM_MEMBERS_SQUAD = 0x30, // squad icon
|
||||
FEEDER_ENEMY_MEMBERS_SQUAD = 0x31, // squad icon
|
||||
FEEDER_INGAME_SQUAD_MEMBERS = 0x32, // Squad members displayed in MP 'Pause' menu
|
||||
FEEDER_INGAME_SQUAD_MEMBERS_FULL = 0x33, // Squad members' name, rank, talk, leader displayed in PC MP 'Pause' menu
|
||||
FEEDER_INGAME_SQUAD_NAMES = 0x34, // Squad names displayed in MP 'Join Squad' menu
|
||||
FEEDER_INGAME_SQUAD_NAMES2 = 0x35, // Squad names displayed in MP 'Pause' menu
|
||||
FEEDER_INGAME_SQUAD_NAMES_FULL = 0x36, // Squad names, lock, invite displayed in PC MP 'Pause' menu
|
||||
FEEDER_CUSTOM_GAMETYPES = 0x37, // list of all the gametypes for custom matches
|
||||
FEEDER_INGAME_SQUAD_MEMBER_RANK = 0x38, // Squad members' rank displayed in MP 'Pause' menu
|
||||
FEEDER_INGAME_SQUAD_MEMBER_TALK = 0x39, // Squad members' talk icon displayed in MP 'Pause' menu
|
||||
FEEDER_INGAME_SQUAD_LOCKED = 0x3a, // Squad lock icon displayed in MP 'Pause' menu
|
||||
FEEDER_INGAME_SQUAD_MEMBER_INVITED = 0x3b, // Squad invite icon displayed in MP 'Pause' menu
|
||||
FEEDER_INGAME_SQUAD_INVITE = 0x3c, // Squad invite icon displayed in MP 'Join Squad' menu
|
||||
FEEDER_INGAME_SQUAD_LEADER = 0x3d, // Squad leader icon displayled in MP 'Pause' menu
|
||||
FEEDER_FRIENDS = 0x3e, // list of your friends
|
||||
FEEDER_PENDINGFRIENDS = 0x3f, // list of your pending friends
|
||||
FEEDER_INVITES = 0x40, // list of the game invites from your friends
|
||||
};
|
||||
|
||||
// display flags
|
||||
enum MENU_DISPLAY_FLAG {
|
||||
CG_SHOW_BLUE_TEAM_HAS_REDFLAG = 0x00000001,
|
||||
CG_SHOW_RED_TEAM_HAS_BLUEFLAG = 0x00000002,
|
||||
CG_SHOW_ANYTEAMGAME = 0x00000004,
|
||||
CG_SHOW_CTF = 0x00000020,
|
||||
CG_SHOW_OBELISK = 0x00000040,
|
||||
CG_SHOW_HEALTHCRITICAL = 0x00000080,
|
||||
CG_SHOW_SINGLEPLAYER = 0x00000100,
|
||||
CG_SHOW_TOURNAMENT = 0x00000200,
|
||||
CG_SHOW_DURINGINCOMINGVOICE = 0x00000400,
|
||||
CG_SHOW_IF_PLAYER_HAS_FLAG = 0x00000800,
|
||||
CG_SHOW_LANPLAYONLY = 0x00001000,
|
||||
CG_SHOW_MINED = 0x00002000,
|
||||
CG_SHOW_HEALTHOK = 0x00004000,
|
||||
CG_SHOW_TEAMINFO = 0x00008000,
|
||||
CG_SHOW_NOTEAMINFO = 0x00010000,
|
||||
CG_SHOW_OTHERTEAMHASFLAG = 0x00020000,
|
||||
CG_SHOW_YOURTEAMHASENEMYFLAG = 0x00040000,
|
||||
CG_SHOW_ANYNONTEAMGAME = 0x00080000,
|
||||
CG_SHOW_TEXTASINT = 0x00200000,
|
||||
CG_SHOW_HIGHLIGHTED = 0x00100000,
|
||||
CG_SHOW_NOT_V_CLEAR = 0x02000000,
|
||||
CG_SHOW_2DONLY = 0x10000000
|
||||
};
|
||||
|
||||
enum MENU_UI_FLAG{
|
||||
UI_SHOW_LEADER = 0x00000001,
|
||||
UI_SHOW_NOTLEADER = 0x00000002,
|
||||
UI_SHOW_FAVORITESERVERS = 0x00000004,
|
||||
UI_SHOW_ANYNONTEAMGAME = 0x00000008,
|
||||
UI_SHOW_ANYTEAMGAME = 0x00000010,
|
||||
UI_SHOW_NEWHIGHSCORE = 0x00000020,
|
||||
UI_SHOW_DEMOAVAILABLE = 0x00000040,
|
||||
UI_SHOW_NEWBESTTIME = 0x00000080,
|
||||
UI_SHOW_FFA = 0x00000100,
|
||||
UI_SHOW_NOTFFA = 0x00000200,
|
||||
UI_SHOW_NETANYNONTEAMGAME = 0x00000400,
|
||||
UI_SHOW_NETANYTEAMGAME = 0x00000800,
|
||||
UI_SHOW_NOTFAVORITESERVERS = 0x00001000
|
||||
};
|
||||
|
||||
// font types
|
||||
enum MENU_FONT_TYPE{
|
||||
UI_FONT_DEFAULT = 0, // auto-chose betwen big/reg/small
|
||||
UI_FONT_NORMAL = 1,
|
||||
UI_FONT_BIG = 2,
|
||||
UI_FONT_SMALL = 3,
|
||||
UI_FONT_BOLD = 4,
|
||||
UI_FONT_CONSOLE = 5,
|
||||
UI_FONT_OBJECTIVE = 6,
|
||||
UI_FONT_MAX = 6,
|
||||
};
|
||||
|
||||
// owner draw types
|
||||
// ideally these should be done outside of this file but
|
||||
// this makes it much easier for the macro expansion to
|
||||
// convert them for the designers ( from the .menu files )
|
||||
enum MENU_OWNER_DRAW_TYPE {
|
||||
CG_OWNERDRAW_BASE = 1,
|
||||
CG_PLAYER_AMMO_VALUE = 5,
|
||||
CG_PLAYER_AMMO_BACKDROP = 6,
|
||||
CG_PLAYER_HEAT_VALUE = 7,
|
||||
CG_PLAYER_STANCE = 20,
|
||||
CG_SPECTATORS = 60,
|
||||
CG_HOLD_BREATH_HINT = 71,
|
||||
CG_CURSORHINT = 72,
|
||||
CG_PLAYER_POWERUP = 73,
|
||||
CG_PLAYER_HOLDABLE = 74,
|
||||
CG_PLAYER_INVENTORY = 75,
|
||||
CG_CURSORHINT_STATUS = 78, // like 'health' bar when pointing at a func_explosive
|
||||
CG_PLAYER_BAR_HEALTH = 79,
|
||||
CG_MANTLE_HINT = 80,
|
||||
CG_PLAYER_WEAPON_NAME = 81,
|
||||
CG_PLAYER_WEAPON_NAME_BACK = 82,
|
||||
CG_CENTER_MESSAGE = 90, // for things like "You were killed by ..."
|
||||
CG_TANK_BODY_DIR = 95,
|
||||
CG_TANK_BARREL_DIR = 96,
|
||||
CG_DEADQUOTE = 97,
|
||||
CG_PLAYER_BAR_HEALTH_BACK = 98,
|
||||
CG_MISSION_OBJECTIVE_HEADER = 99,
|
||||
CG_MISSION_OBJECTIVE_LIST = 100,
|
||||
CG_MISSION_OBJECTIVE_BACKDROP = 101,
|
||||
CG_PAUSED_MENU_LINE = 102,
|
||||
CG_OFFHAND_WEAPON_ICON_FRAG = 103,
|
||||
CG_OFFHAND_WEAPON_ICON_SMOKEFLASH = 104,
|
||||
CG_OFFHAND_WEAPON_AMMO_FRAG = 105,
|
||||
CG_OFFHAND_WEAPON_AMMO_SMOKEFLASH = 106,
|
||||
CG_OFFHAND_WEAPON_NAME_FRAG = 107,
|
||||
CG_OFFHAND_WEAPON_NAME_SMOKEFLASH = 108,
|
||||
CG_OFFHAND_WEAPON_SELECT_FRAG = 109,
|
||||
CG_OFFHAND_WEAPON_SELECT_SMOKEFLASH = 110,
|
||||
CG_SAVING = 111,
|
||||
CG_PLAYER_LOW_HEALTH_OVERLAY = 112,
|
||||
CG_INVALID_CMD_HINT = 113,
|
||||
CG_PLAYER_SPRINT_METER = 114,
|
||||
CG_PLAYER_SPRINT_BACK = 115,
|
||||
CG_PLAYER_WEAPON_BACKGROUND = 116,
|
||||
CG_PLAYER_WEAPON_AMMO_CLIP_GRAPHIC = 117,
|
||||
CG_PLAYER_WEAPON_PRIMARY_ICON = 118,
|
||||
CG_PLAYER_WEAPON_AMMO_STOCK = 119,
|
||||
CG_PLAYER_WEAPON_LOW_AMMO_WARNING = 120,
|
||||
CG_BATTLE_COMPASS_MARKERS = 122,
|
||||
CG_BATTLE_FULLMAP_MARKERS = 123,
|
||||
CG_SUCCESSFUL_CMD_HINT = 130,
|
||||
CG_WAR_TEXT = 135,
|
||||
CG_PLAYER_COMPASS_TICKERTAPE = 145,
|
||||
CG_PLAYER_COMPASS_TICKERTAPE_NO_OBJ = 146,
|
||||
CG_PLAYER_COMPASS_DOGS = 147,
|
||||
CG_PLAYER_COMPASS_ARTILLERY_ICON = 148,
|
||||
CG_PLAYER_COMPASS_SQUAD_OBJECTIVE = 149,
|
||||
CG_PLAYER_COMPASS_PLAYER = 150,
|
||||
CG_PLAYER_COMPASS_BACK = 151,
|
||||
CG_PLAYER_COMPASS_POINTERS = 152,
|
||||
CG_PLAYER_COMPASS_ACTORS = 153,
|
||||
CG_PLAYER_COMPASS_TANKS = 154,
|
||||
CG_PLAYER_COMPASS_HELICOPTERS = 155,
|
||||
CG_PLAYER_COMPASS_PLANES = 156,
|
||||
CG_PLAYER_COMPASS_AUTOMOBILES = 157,
|
||||
CG_PLAYER_COMPASS_FRIENDS = 158,
|
||||
CG_PLAYER_COMPASS_MAP = 159,
|
||||
CG_PLAYER_COMPASS_NORTHCOORD = 160,
|
||||
CG_PLAYER_COMPASS_EASTCOORD = 161,
|
||||
CG_PLAYER_COMPASS_NCOORD_SCROLL = 162,
|
||||
CG_PLAYER_COMPASS_ECOORD_SCROLL = 163,
|
||||
CG_PLAYER_COMPASS_GOALDISTANCE = 164,
|
||||
CG_PLAYER_ACTIONSLOT_DPAD = 165,
|
||||
CG_PLAYER_ACTIONSLOT_1 = 166,
|
||||
CG_PLAYER_ACTIONSLOT_2 = 167,
|
||||
CG_PLAYER_ACTIONSLOT_3 = 168,
|
||||
CG_PLAYER_ACTIONSLOT_4 = 169,
|
||||
CG_PLAYER_COMPASS_ENEMIES = 170,
|
||||
CG_PLAYER_FULLMAP_DOGS = 176,
|
||||
CG_PLAYER_FULLMAP_VEHICLES = 177,
|
||||
CG_PLAYER_FULLMAP_ARTILLERY_ICON = 178,
|
||||
CG_PLAYER_FULLMAP_SQUAD_OBJECTIVE = 179,
|
||||
CG_PLAYER_FULLMAP_BACK = 180,
|
||||
CG_PLAYER_FULLMAP_MAP = 181,
|
||||
CG_PLAYER_FULLMAP_POINTERS = 182,
|
||||
CG_PLAYER_FULLMAP_PLAYER = 183,
|
||||
CG_PLAYER_FULLMAP_ACTORS = 184,
|
||||
CG_PLAYER_FULLMAP_FRIENDS = 185,
|
||||
CG_PLAYER_FULLMAP_LOCATION_SELECTOR = 186,
|
||||
CG_PLAYER_FULLMAP_BORDER = 187,
|
||||
CG_PLAYER_FULLMAP_ENEMIES = 188,
|
||||
CG_PLAYER_COMPASS = 189,
|
||||
CG_VEHICLE_RETICLE = 190,
|
||||
CG_HUD_TARGETS_VEHICLE = 191,
|
||||
CG_HUD_TARGETS_JAVELIN = 192,
|
||||
CG_TALKER1 = 193,
|
||||
CG_TALKER2 = 194,
|
||||
CG_TALKER3 = 195,
|
||||
CG_TALKER4 = 196,
|
||||
CG_FRIENDLYARROWS = 197,
|
||||
CG_FRIENDLYNAMES = 198,
|
||||
UI_OWNERDRAW_BASE = 200,
|
||||
UI_HANDICAP = 200,
|
||||
UI_EFFECTS = 201,
|
||||
UI_PLAYERMODEL = 202,
|
||||
UI_GAMETYPE = 205,
|
||||
UI_SKILL = 207,
|
||||
UI_NETSOURCE = 220,
|
||||
UI_NETFILTER = 222,
|
||||
UI_VOTE_KICK = 238,
|
||||
UI_NETGAMETYPE = 245,
|
||||
UI_SERVERREFRESHDATE = 247,
|
||||
UI_SERVERMOTD = 248,
|
||||
UI_GLINFO = 249,
|
||||
UI_KEYBINDSTATUS = 250,
|
||||
UI_JOINGAMETYPE = 253,
|
||||
UI_MAPPREVIEW = 254,
|
||||
UI_MENUMODEL = 257,
|
||||
UI_SAVEGAME_SHOT = 258,
|
||||
UI_SAVEGAMENAME = 262,
|
||||
UI_SAVEGAMEINFO = 263,
|
||||
UI_LOADPROFILING = 264,
|
||||
UI_RECORDLEVEL = 265,
|
||||
UI_AMITALKING = 266,
|
||||
UI_TALKER1 = 267,
|
||||
UI_TALKER2 = 268,
|
||||
UI_TALKER3 = 269,
|
||||
UI_TALKER4 = 270,
|
||||
UI_PARTYSTATUS = 271,
|
||||
UI_LOGGEDINUSER = 272,
|
||||
UI_RESERVEDSLOTS = 273,
|
||||
UI_PLAYLISTNAME = 274,
|
||||
UI_PLAYLISTDESCRIPTION = 275,
|
||||
UI_USERNAME = 276,
|
||||
UI_CINEMATIC = 277,
|
||||
UI_TOTALONLINE = 278,
|
||||
UI_CATEGORYNAME = 279,
|
||||
UI_CATEGORYDESCRIPTION = 280,
|
||||
UI_PLAYLISTICON = 281,
|
||||
UI_CATEGORYICON = 282,
|
||||
UI_GAMETYPE_MAPNAME = 283,
|
||||
CG_HUD_WAR_MOMENTUM_PROGRESS = 284,
|
||||
CG_HUD_WAR_MOMENTUM_MULTIPLIER = 285,
|
||||
CG_HUD_WAR_MOMENTUM_MULTIPLIER_DETAIL = 286,
|
||||
CG_HUD_WAR_MOMENTUM_MULTIPLIER_BLITZKRIEG = 287,
|
||||
CG_COMPETITIVE_MODE_SCORES = 288,
|
||||
UI_LOAD_STATUS_SCREEN = 289,
|
||||
UI_LEADERBOARD_GAMEMODE = 290,
|
||||
CG_PLAYER_ACTIONSLOT_BACK_1 = 290,
|
||||
CG_PLAYER_ACTIONSLOT_BACK_2 = 291,
|
||||
CG_PLAYER_ACTIONSLOT_BACK_3 = 292,
|
||||
CG_PLAYER_ACTIONSLOT_BACK_4 = 293,
|
||||
CG_PLAYER_ACTIONSLOT_ARROW_1 = 294,
|
||||
CG_PLAYER_ACTIONSLOT_ARROW_2 = 295,
|
||||
CG_PLAYER_ACTIONSLOT_ARROW_3 = 296,
|
||||
CG_PLAYER_ACTIONSLOT_ARROW_4 = 297,
|
||||
UI_DIFFICULTY_INFO = 298,
|
||||
UI_DIFFICULTY_ICON = 299,
|
||||
UI_LOBBY_CHAT = 300
|
||||
};
|
||||
|
||||
// Edge relative placement values for rect->h_align and rect->v_align
|
||||
enum MENU_H_ALIGNMENT {
|
||||
HORIZONTAL_ALIGN_SUBLEFT = 0, // left edge of a 4:3 screen (safe area not included)
|
||||
HORIZONTAL_ALIGN_LEFT = 1, // left viewable (safe area) edge
|
||||
HORIZONTAL_ALIGN_CENTER = 2, // center of the screen (reticle)
|
||||
HORIZONTAL_ALIGN_RIGHT = 3, // right viewable (safe area) edge
|
||||
HORIZONTAL_ALIGN_FULLSCREEN = 4, // disregards safe area
|
||||
HORIZONTAL_ALIGN_NOSCALE = 5, // uses exact parameters - neither adjusts for safe area nor scales for screen size
|
||||
HORIZONTAL_ALIGN_TO640 = 6, // scales a real-screen resolution x down into the 0 - 640 range
|
||||
HORIZONTAL_ALIGN_CENTER_SAFEAREA = 7, // center of the safearea
|
||||
HORIZONTAL_ALIGN_MAX = HORIZONTAL_ALIGN_CENTER_SAFEAREA,
|
||||
HORIZONTAL_ALIGN_DEFAULT = HORIZONTAL_ALIGN_SUBLEFT
|
||||
};
|
||||
|
||||
enum MENU_V_ALIGNMENT {
|
||||
VERTICAL_ALIGN_SUBTOP = 0, // top edge of the 4:3 screen (safe area not included)
|
||||
VERTICAL_ALIGN_TOP = 1, // top viewable (safe area) edge
|
||||
VERTICAL_ALIGN_CENTER = 2, // center of the screen (reticle)
|
||||
VERTICAL_ALIGN_BOTTOM = 3, // bottom viewable (safe area) edge
|
||||
VERTICAL_ALIGN_FULLSCREEN = 4, // disregards safe area
|
||||
VERTICAL_ALIGN_NOSCALE = 5, // uses exact parameters - neither adjusts for safe area nor scales for screen size
|
||||
VERTICAL_ALIGN_TO480 = 6, // scales a real-screen resolution y down into the 0 - 480 range
|
||||
VERTICAL_ALIGN_CENTER_SAFEAREA = 7, // center of the save area
|
||||
VERTICAL_ALIGN_MAX = VERTICAL_ALIGN_CENTER_SAFEAREA,
|
||||
VERTICAL_ALIGN_DEFAULT = VERTICAL_ALIGN_SUBTOP
|
||||
};
|
||||
|
||||
enum MENU_BUTTON {
|
||||
BUTTON_A = 1,
|
||||
BUTTON_B = 2,
|
||||
BUTTON_X = 3,
|
||||
BUTTON_Y = 4,
|
||||
BUTTON_LSHLDR = 5,
|
||||
BUTTON_RSHLDR = 6,
|
||||
BUTTON_START = 14,
|
||||
BUTTON_BACK = 15,
|
||||
BUTTON_LSTICK = 16,
|
||||
BUTTON_RSTICK = 17,
|
||||
BUTTON_LTRIG = 18,
|
||||
BUTTON_RTRIG = 19,
|
||||
DPAD_UP = 20,
|
||||
DPAD_DOWN = 21,
|
||||
DPAD_LEFT = 22,
|
||||
DPAD_RIGHT = 23,
|
||||
APAD_UP = 28,
|
||||
APAD_DOWN = 29,
|
||||
APAD_LEFT = 30,
|
||||
APAD_RIGHT = 31
|
||||
};
|
||||
|
||||
enum ASSET_TYPE {
|
||||
ASSET_UNKNOWN = 0,
|
||||
ASSET_ANIMATION = 4, // x_anim PARTIALLY VERIFIED
|
||||
ASSET_MODEL = 5, // xmodel PARTIALLY VERIFIED
|
||||
ASSET_MATERIAL = 6, // material VERIFIED
|
||||
ASSET_BIK_FILE = 7, // .bik file PARTIALLY VERIFIED
|
||||
ASSET_SOUND = 9, // loaded_sound VERIFIED
|
||||
ASSET_COLLISION_MAP = 12, // collision_map PARTIALLY VERIFIED
|
||||
ASSET_SHADER = 13, // shader PARTIALLY VERIFIED
|
||||
ASSET_D3DBSP_DUMP = 17, // d3dbsp dump VERIFIED
|
||||
ASSET_FONT = 20, // font PARTIALLY VERIFIED
|
||||
ASSET_MENU = 21, // menu_file VERIFIED
|
||||
ASSET_LOCAL_STRING = 23, // localized string VERIFIED
|
||||
ASSET_WEAPON = 24, // weapon VERIFIED
|
||||
ASSET_EFFECT = 26, // fx VERIFIED
|
||||
ASSET_RAW_FILE = 32, // raw_file VERIFIED
|
||||
ASSET_STRING_TABLE = 33 // string_table PARTIALLY VERIFIED
|
||||
};
|
||||
|
||||
enum SHADER_TYPE {
|
||||
SHADER_NONE = 0x00,
|
||||
SHADER_PIXEL = 0x01,
|
||||
SHADER_VERTEX = 0x02
|
||||
};
|
||||
|
||||
enum SHADER_OPCODE {
|
||||
OPCODE_Nop,
|
||||
OPCODE_Mov,
|
||||
OPCODE_Add,
|
||||
OPCODE_Sub,
|
||||
OPCODE_Mad,
|
||||
OPCODE_Mul,
|
||||
OPCODE_Rcp,
|
||||
OPCODE_Rsq,
|
||||
OPCODE_Dp3,
|
||||
OPCODE_Dp4,
|
||||
OPCODE_Min,
|
||||
OPCODE_Max,
|
||||
OPCODE_Slt,
|
||||
OPCODE_Sge,
|
||||
OPCODE_Exp,
|
||||
OPCODE_Log,
|
||||
OPCODE_Lit,
|
||||
OPCODE_Dst,
|
||||
OPCODE_Lrp,
|
||||
OPCODE_Frc,
|
||||
OPCODE_M4x4,
|
||||
OPCODE_M4x3,
|
||||
OPCODE_M3x4,
|
||||
OPCODE_M3x3,
|
||||
OPCODE_M3x2,
|
||||
OPCODE_Call,
|
||||
OPCODE_CallNZ,
|
||||
OPCODE_Loop,
|
||||
OPCODE_Ret,
|
||||
OPCODE_EndLoop,
|
||||
OPCODE_Label,
|
||||
OPCODE_Dcl,
|
||||
OPCODE_Pow,
|
||||
OPCODE_Crs,
|
||||
OPCODE_Sgn,
|
||||
OPCODE_Abs,
|
||||
OPCODE_Nrm,
|
||||
OPCODE_SinCos,
|
||||
OPCODE_Rep,
|
||||
OPCODE_EndRep,
|
||||
OPCODE_If,
|
||||
OPCODE_IfC,
|
||||
OPCODE_Else,
|
||||
OPCODE_Endif,
|
||||
OPCODE_Break,
|
||||
OPCODE_BreakC,
|
||||
OPCODE_MovA,
|
||||
OPCODE_DefB,
|
||||
OPCODE_DefI,
|
||||
OPCODE_TexCoord = 64,
|
||||
OPCODE_TexKill,
|
||||
OPCODE_Tex,
|
||||
OPCODE_TexBem,
|
||||
OPCODE_TexBeml,
|
||||
OPCODE_TexReg2AR,
|
||||
OPCODE_TexReg2GB,
|
||||
OPCODE_TeXM3x2Pad,
|
||||
OPCODE_TexM3x2Tex,
|
||||
OPCODE_TeXM3x3Pad,
|
||||
OPCODE_TexM3x3Tex,
|
||||
OPCODE_TexM3x3Diff,
|
||||
OPCODE_TexM3x3Spec,
|
||||
OPCODE_TexM3x3VSpec,
|
||||
OPCODE_ExpP,
|
||||
OPCODE_LogP,
|
||||
OPCODE_Cnd,
|
||||
OPCODE_Def,
|
||||
OPCODE_TexReg2RGB,
|
||||
OPCODE_TexDP3Tex,
|
||||
OPCODE_TexM3x2Depth,
|
||||
OPCODE_TexDP3,
|
||||
OPCODE_TexM3x3,
|
||||
OPCODE_TexDepth,
|
||||
OPCODE_Cmp,
|
||||
OPCODE_Bem,
|
||||
OPCODE_DP2Add,
|
||||
OPCODE_DSX,
|
||||
OPCODE_DSY,
|
||||
OPCODE_TexLDD,
|
||||
OPCODE_SetP,
|
||||
OPCODE_TexLDL,
|
||||
OPCODE_Breakp,
|
||||
OPCODE_Phase = 0xFFFD,
|
||||
OPCODE_Comment = 0xFFFE,
|
||||
OPCODE_End = 0xFFFF
|
||||
};
|
||||
|
||||
#define SECTION_TYPE_INFO 1
|
||||
#define SECTION_TYPE_DATA 2
|
||||
|
||||
#define IPAK_SECTION_ENTRY 1
|
||||
#define IPAK_SECTION_DATA 2
|
||||
#define IPAK_SECTION_METADATA 3
|
||||
|
||||
#define FORMAT_DXT1 0
|
||||
#define FORMAT_DXT3 1
|
||||
#define FORMAT_DXT5 2
|
||||
#define FORMAT_A8R8G8B8 3
|
||||
|
||||
// Change this depending on the platform
|
||||
// PC
|
||||
#define DEVMAP_LEVEL_FIRST "devmap intro_pac"
|
||||
#define DEVMAP "devmap"
|
||||
// Not PC
|
||||
// #define DEVMAP_LEVEL_FIRST "map intro_pac"
|
||||
// #define DEVMAP "map"
|
||||
|
||||
// Remove this to restore full frontend instead of limited EPD frontend
|
||||
#define COOP_EPD 0
|
||||
|
||||
// LDS - This enables a German SKU with Nazi Zombies enabled *SHOULD BE SET TO 0 IF NOT APPROVED*
|
||||
#define GERMAN_ZOMBIE_BUILD 0
|
||||
|
||||
#define DEVMAP_LEVEL_TRAINING "devmap training"
|
||||
#define LEVEL_FIRST "intro_pac"
|
||||
#define LEVEL_TRAINING "training"
|
||||
#define FIRST_PLAYABLE_CAMPAIGN_LEVEL "mak"
|
||||
#define FIRST_PLAYABLE_ZOMBIE_LEVEL "nazi_zombie_prototype"
|
||||
|
||||
// Size define for the hud compass
|
||||
// These are used for both the dynamic & non-dynamic compass drawing
|
||||
// If these are changed, the cgame should be recompiled
|
||||
#define COMPASS_SIZE 160
|
||||
#define MINIMAP_X 11.5
|
||||
#define MINIMAP_Y 5
|
||||
#define MINIMAP_W 89.5
|
||||
#define MINIMAP_H 89.5
|
||||
|
||||
#define COMPASS_SIZE_MP 125
|
||||
#define MINIMAP_X_MP 0
|
||||
#define MINIMAP_Y_MP 12
|
||||
#define MINIMAP_W_MP 102
|
||||
#define MINIMAP_H_MP 102
|
||||
|
||||
#define FULLSCREEN 0 0 640 480
|
||||
#define FULLSCREEN_WIDE -107 0 854 480
|
||||
|
||||
// PC
|
||||
#define ORIGIN_TITLE 30 34
|
||||
// Not PC
|
||||
// #define ORIGIN_TITLE 0 0
|
||||
|
||||
#define ORIGIN_TITLE_SS 104 120
|
||||
|
||||
#define FONTSCALE_SMALL 0.3095 //0.3750 // <-- COD4 // COD5 --> 0.30952//0.35897//0.24138 //14 pt //0.2900 //0.2750 // 18
|
||||
#define FONTSCALE_LOBBY 0.26 // <--Slate // 0.3010 <-- Slate Compressed // 0.3750 // <-- COD4 CONDUIT ITC small
|
||||
#define FONTSCALE_NORMAL 0.3810 //0.35897//0.4583
|
||||
#define FONTSCALE_BOLD 0.5476 //0.4583
|
||||
#define FONTSCALE_BIG 0.5476 //0.5833
|
||||
#define FONTSCALE_EXTRABIG 1 //1.0000
|
||||
|
||||
// new settings
|
||||
#define TEXTSIZE_SMALL FONTSCALE_SMALL
|
||||
#define TEXTSIZE_SMALL_SS (FONTSCALE_SMALL*2)
|
||||
#define TEXTSIZE_DEFAULT FONTSCALE_NORMAL
|
||||
#define TEXTSIZE_DEFAULT_SS (FONTSCALE_NORMAL*2)
|
||||
#define TEXTSIZE_TITLE FONTSCALE_BIG
|
||||
#define TEXTSIZE_TITLE_SS 1
|
||||
|
||||
#define TEXTSIZE_BOLD TEXTSIZE_DEFAULT
|
||||
#define TEXTSIZE_BIG TEXTSIZE_TITLE
|
||||
|
||||
//#define COLOR_TITLE 1 0.8 0.4 1
|
||||
#define COLOR_TITLE 1 1 1 1
|
||||
#define COLOR_HEADER 0.69 0.69 0.69 1
|
||||
#define COLOR_FOCUSED 0.95294 0.72156 0.21176 1 //1 0.788 0.129 1
|
||||
//#define COLOR_FOCUS_YELLOW 0.95294 0.72156 0.21176 1
|
||||
#define COLOR_UNFOCUSED 0.4823 0.4823 0.4823 1
|
||||
//#define COLOR_DISABLED 0.35 0.35 0.35 1
|
||||
#define COLOR_SAFEAREA 0 0 1 1
|
||||
|
||||
#define COLOR_INFO_YELLOW COLOR_FOCUSED//1 0.84706 0 1
|
||||
#define COLOR_TEXT 0.84313 0.84313 0.84313 1
|
||||
#define COLOR_DISABLED 0.34118 0.36863 0.37647 1
|
||||
#define COLOR_TITLEBAR 0.14510 0.16078 0.16862 0.3//1
|
||||
#define COLOR_RED_TEXT 0.69020 0.00784 0.00784 1
|
||||
|
||||
#define COLOR_FADEOUT 0.09412 0.09412 0.04912 0.65
|
||||
|
||||
#define COLOR_BODY_TEXT 0.62745 0.66667 0.67451 1
|
||||
|
||||
#define COLOR_USMC 0 0.0196 0.41
|
||||
#define COLOR_JPN 0.53 0.027 0.027
|
||||
#define COLOR_USSR 0.368 0.035 0.035
|
||||
#define COLOR_GER 0.937 0.9 0.607
|
||||
|
||||
#define DEFAULT_MP_CFG "default_mp.cfg"
|
||||
#define SPLITSCREEN_MP_CFG "default_splitscreen.cfg"
|
||||
#define SYSTEMLINK_MP_CFG "default_systemlink.cfg"
|
||||
#define XBOXLIVE_MP_CFG "default_xboxlive.cfg"
|
||||
|
||||
#define MAX_RANK int(tableLookup( "mp/rankTable.csv", 0, "maxrank", 1))
|
||||
#define MAX_PRESTIGE int(tableLookup( "mp/rankIconTable.csv", 0, "maxprestige", 1))
|
||||
|
||||
#define PRESTIGE_AVAIL (stat(2326) < MAX_PRESTIGE && stat(2301) == int(tableLookup("mp/rankTable.csv",0,MAX_RANK,7)))
|
||||
#define PRESTIGE_NEXT (stat(2326) < MAX_PRESTIGE && stat(252) == MAX_RANK)
|
||||
#define PRESTIGE_FINISH (stat(2326) == MAX_PRESTIGE)
|
||||
|
||||
#define CAN_RANK_UP (stat(252) < MAX_RANK || stat(2326) < MAX_PRESTIGE)
|
||||
#endif // ENUMS_H
|
||||
272
libs/encryption/ecrypt-config.h
Normal file
272
libs/encryption/ecrypt-config.h
Normal file
@ -0,0 +1,272 @@
|
||||
/* ecrypt-config.h */
|
||||
|
||||
/* *** Normally, it should not be necessary to edit this file. *** */
|
||||
|
||||
#ifndef ECRYPT_CONFIG
|
||||
#define ECRYPT_CONFIG
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* Guess the endianness of the target architecture. */
|
||||
|
||||
/*
|
||||
* The LITTLE endian machines:
|
||||
*/
|
||||
#if defined(__ultrix) /* Older MIPS */
|
||||
#define ECRYPT_LITTLE_ENDIAN
|
||||
#elif defined(__alpha) /* Alpha */
|
||||
#define ECRYPT_LITTLE_ENDIAN
|
||||
#elif defined(i386) /* x86 (gcc) */
|
||||
#define ECRYPT_LITTLE_ENDIAN
|
||||
#elif defined(__i386) /* x86 (gcc) */
|
||||
#define ECRYPT_LITTLE_ENDIAN
|
||||
#elif defined(_M_IX86) /* x86 (MSC, Borland) */
|
||||
#define ECRYPT_LITTLE_ENDIAN
|
||||
#elif defined(_MSC_VER) /* x86 (surely MSC) */
|
||||
#define ECRYPT_LITTLE_ENDIAN
|
||||
#elif defined(__INTEL_COMPILER) /* x86 (surely Intel compiler icl.exe) */
|
||||
#define ECRYPT_LITTLE_ENDIAN
|
||||
|
||||
/*
|
||||
* The BIG endian machines:
|
||||
*/
|
||||
#elif defined(sun) /* Newer Sparc's */
|
||||
#define ECRYPT_BIG_ENDIAN
|
||||
#elif defined(__ppc__) /* PowerPC */
|
||||
#define ECRYPT_BIG_ENDIAN
|
||||
|
||||
/*
|
||||
* Finally machines with UNKNOWN endianness:
|
||||
*/
|
||||
#elif defined (_AIX) /* RS6000 */
|
||||
#define ECRYPT_UNKNOWN
|
||||
#elif defined(__hpux) /* HP-PA */
|
||||
#define ECRYPT_UNKNOWN
|
||||
#elif defined(__aux) /* 68K */
|
||||
#define ECRYPT_UNKNOWN
|
||||
#elif defined(__dgux) /* 88K (but P6 in latest boxes) */
|
||||
#define ECRYPT_UNKNOWN
|
||||
#elif defined(__sgi) /* Newer MIPS */
|
||||
#define ECRYPT_UNKNOWN
|
||||
#else /* Any other processor */
|
||||
#define ECRYPT_UNKNOWN
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Find minimal-width types to store 8-bit, 16-bit, 32-bit, and 64-bit
|
||||
* integers.
|
||||
*
|
||||
* Note: to enable 64-bit types on 32-bit compilers, it might be
|
||||
* necessary to switch from ISO C90 mode to ISO C99 mode (e.g., gcc
|
||||
* -std=c99).
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
/* --- check char --- */
|
||||
|
||||
#if (UCHAR_MAX / 0xFU > 0xFU)
|
||||
#ifndef I8T
|
||||
#define I8T char
|
||||
#define U8C(v) (v##U)
|
||||
|
||||
#if (UCHAR_MAX == 0xFFU)
|
||||
#define ECRYPT_I8T_IS_BYTE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if (UCHAR_MAX / 0xFFU > 0xFFU)
|
||||
#ifndef I16T
|
||||
#define I16T char
|
||||
#define U16C(v) (v##U)
|
||||
#endif
|
||||
|
||||
#if (UCHAR_MAX / 0xFFFFU > 0xFFFFU)
|
||||
#ifndef I32T
|
||||
#define I32T char
|
||||
#define U32C(v) (v##U)
|
||||
#endif
|
||||
|
||||
#if (UCHAR_MAX / 0xFFFFFFFFU > 0xFFFFFFFFU)
|
||||
#ifndef I64T
|
||||
#define I64T char
|
||||
#define U64C(v) (v##U)
|
||||
#define ECRYPT_NATIVE64
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* --- check short --- */
|
||||
|
||||
#if (USHRT_MAX / 0xFU > 0xFU)
|
||||
#ifndef I8T
|
||||
#define I8T short
|
||||
#define U8C(v) (v##U)
|
||||
|
||||
#if (USHRT_MAX == 0xFFU)
|
||||
#define ECRYPT_I8T_IS_BYTE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if (USHRT_MAX / 0xFFU > 0xFFU)
|
||||
#ifndef I16T
|
||||
#define I16T short
|
||||
#define U16C(v) (v##U)
|
||||
#endif
|
||||
|
||||
#if (USHRT_MAX / 0xFFFFU > 0xFFFFU)
|
||||
#ifndef I32T
|
||||
#define I32T short
|
||||
#define U32C(v) (v##U)
|
||||
#endif
|
||||
|
||||
#if (USHRT_MAX / 0xFFFFFFFFU > 0xFFFFFFFFU)
|
||||
#ifndef I64T
|
||||
#define I64T short
|
||||
#define U64C(v) (v##U)
|
||||
#define ECRYPT_NATIVE64
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* --- check int --- */
|
||||
|
||||
#if (UINT_MAX / 0xFU > 0xFU)
|
||||
#ifndef I8T
|
||||
#define I8T int
|
||||
#define U8C(v) (v##U)
|
||||
|
||||
#if (ULONG_MAX == 0xFFU)
|
||||
#define ECRYPT_I8T_IS_BYTE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if (UINT_MAX / 0xFFU > 0xFFU)
|
||||
#ifndef I16T
|
||||
#define I16T int
|
||||
#define U16C(v) (v##U)
|
||||
#endif
|
||||
|
||||
#if (UINT_MAX / 0xFFFFU > 0xFFFFU)
|
||||
#ifndef I32T
|
||||
#define I32T int
|
||||
#define U32C(v) (v##U)
|
||||
#endif
|
||||
|
||||
#if (UINT_MAX / 0xFFFFFFFFU > 0xFFFFFFFFU)
|
||||
#ifndef I64T
|
||||
#define I64T int
|
||||
#define U64C(v) (v##U)
|
||||
#define ECRYPT_NATIVE64
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* --- check long --- */
|
||||
|
||||
#if (ULONG_MAX / 0xFUL > 0xFUL)
|
||||
#ifndef I8T
|
||||
#define I8T long
|
||||
#define U8C(v) (v##UL)
|
||||
|
||||
#if (ULONG_MAX == 0xFFUL)
|
||||
#define ECRYPT_I8T_IS_BYTE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if (ULONG_MAX / 0xFFUL > 0xFFUL)
|
||||
#ifndef I16T
|
||||
#define I16T long
|
||||
#define U16C(v) (v##UL)
|
||||
#endif
|
||||
|
||||
#if (ULONG_MAX / 0xFFFFUL > 0xFFFFUL)
|
||||
#ifndef I32T
|
||||
#define I32T long
|
||||
#define U32C(v) (v##UL)
|
||||
#endif
|
||||
|
||||
#if (ULONG_MAX / 0xFFFFFFFFUL > 0xFFFFFFFFUL)
|
||||
#ifndef I64T
|
||||
#define I64T long
|
||||
#define U64C(v) (v##UL)
|
||||
#define ECRYPT_NATIVE64
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* --- check long long --- */
|
||||
|
||||
#ifdef ULLONG_MAX
|
||||
|
||||
#if (ULLONG_MAX / 0xFULL > 0xFULL)
|
||||
#ifndef I8T
|
||||
#define I8T long long
|
||||
#define U8C(v) (v##ULL)
|
||||
|
||||
#if (ULLONG_MAX == 0xFFULL)
|
||||
#define ECRYPT_I8T_IS_BYTE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if (ULLONG_MAX / 0xFFULL > 0xFFULL)
|
||||
#ifndef I16T
|
||||
#define I16T long long
|
||||
#define U16C(v) (v##ULL)
|
||||
#endif
|
||||
|
||||
#if (ULLONG_MAX / 0xFFFFULL > 0xFFFFULL)
|
||||
#ifndef I32T
|
||||
#define I32T long long
|
||||
#define U32C(v) (v##ULL)
|
||||
#endif
|
||||
|
||||
#if (ULLONG_MAX / 0xFFFFFFFFULL > 0xFFFFFFFFULL)
|
||||
#ifndef I64T
|
||||
#define I64T long long
|
||||
#define U64C(v) (v##ULL)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* --- check __int64 --- */
|
||||
|
||||
#ifdef _UI64_MAX
|
||||
|
||||
#if (_UI64_MAX / 0xFFFFFFFFui64 > 0xFFFFFFFFui64)
|
||||
#ifndef I64T
|
||||
#define I64T __int64
|
||||
#define U64C(v) (v##ui64)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#endif
|
||||
46
libs/encryption/ecrypt-machine.h
Normal file
46
libs/encryption/ecrypt-machine.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* ecrypt-machine.h */
|
||||
|
||||
/*
|
||||
* This file is included by 'ecrypt-portable.h'. It allows to override
|
||||
* the default macros for specific platforms. Please carefully check
|
||||
* the machine code generated by your compiler (with optimisations
|
||||
* turned on) before deciding to edit this file.
|
||||
*/
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#if (defined(ECRYPT_DEFAULT_ROT) && !defined(ECRYPT_MACHINE_ROT))
|
||||
|
||||
#define ECRYPT_MACHINE_ROT
|
||||
|
||||
#if (defined(WIN32) && defined(_MSC_VER))
|
||||
|
||||
#undef ROTL32
|
||||
#undef ROTR32
|
||||
#undef ROTL64
|
||||
#undef ROTR64
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ROTL32(v, n) _lrotl(v, n)
|
||||
#define ROTR32(v, n) _lrotr(v, n)
|
||||
#define ROTL64(v, n) _rotl64(v, n)
|
||||
#define ROTR64(v, n) _rotr64(v, n)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#if (defined(ECRYPT_DEFAULT_SWAP) && !defined(ECRYPT_MACHINE_SWAP))
|
||||
|
||||
#define ECRYPT_MACHINE_SWAP
|
||||
|
||||
/*
|
||||
* If you want to overwrite the default swap macros, put it here. And so on.
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
303
libs/encryption/ecrypt-portable.h
Normal file
303
libs/encryption/ecrypt-portable.h
Normal file
@ -0,0 +1,303 @@
|
||||
/* ecrypt-portable.h */
|
||||
|
||||
/*
|
||||
* WARNING: the conversions defined below are implemented as macros,
|
||||
* and should be used carefully. They should NOT be used with
|
||||
* parameters which perform some action. E.g., the following two lines
|
||||
* are not equivalent:
|
||||
*
|
||||
* 1) ++x; y = ROTL32(x, n);
|
||||
* 2) y = ROTL32(++x, n);
|
||||
*/
|
||||
|
||||
/*
|
||||
* *** Please do not edit this file. ***
|
||||
*
|
||||
* The default macros can be overridden for specific architectures by
|
||||
* editing 'ecrypt-machine.h'.
|
||||
*/
|
||||
|
||||
#ifndef ECRYPT_PORTABLE
|
||||
#define ECRYPT_PORTABLE
|
||||
|
||||
#include "ecrypt-config.h"
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* The following types are defined (if available):
|
||||
*
|
||||
* u8: unsigned integer type, at least 8 bits
|
||||
* u16: unsigned integer type, at least 16 bits
|
||||
* u32: unsigned integer type, at least 32 bits
|
||||
* u64: unsigned integer type, at least 64 bits
|
||||
*
|
||||
* s8, s16, s32, s64 -> signed counterparts of u8, u16, u32, u64
|
||||
*
|
||||
* The selection of minimum-width integer types is taken care of by
|
||||
* 'ecrypt-config.h'. Note: to enable 64-bit types on 32-bit
|
||||
* compilers, it might be necessary to switch from ISO C90 mode to ISO
|
||||
* C99 mode (e.g., gcc -std=c99).
|
||||
*/
|
||||
|
||||
#ifdef I8T
|
||||
typedef signed I8T s8;
|
||||
typedef unsigned I8T u8;
|
||||
#endif
|
||||
|
||||
#ifdef I16T
|
||||
typedef signed I16T s16;
|
||||
typedef unsigned I16T u16;
|
||||
#endif
|
||||
|
||||
#ifdef I32T
|
||||
typedef signed I32T s32;
|
||||
typedef unsigned I32T u32;
|
||||
#endif
|
||||
|
||||
#ifdef I64T
|
||||
typedef signed I64T s64;
|
||||
typedef unsigned I64T u64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following macros are used to obtain exact-width results.
|
||||
*/
|
||||
|
||||
#define U8V(v) ((u8)(v) & U8C(0xFF))
|
||||
#define U16V(v) ((u16)(v) & U16C(0xFFFF))
|
||||
#define U32V(v) ((u32)(v) & U32C(0xFFFFFFFF))
|
||||
#define U64V(v) ((u64)(v) & U64C(0xFFFFFFFFFFFFFFFF))
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* The following macros return words with their bits rotated over n
|
||||
* positions to the left/right.
|
||||
*/
|
||||
|
||||
#define ECRYPT_DEFAULT_ROT
|
||||
|
||||
#define ROTL8(v, n) \
|
||||
(U8V((v) << (n)) | ((v) >> (8 - (n))))
|
||||
|
||||
#define ROTL16(v, n) \
|
||||
(U16V((v) << (n)) | ((v) >> (16 - (n))))
|
||||
|
||||
#define ROTL32(v, n) \
|
||||
(U32V((v) << (n)) | ((v) >> (32 - (n))))
|
||||
|
||||
#define ROTL64(v, n) \
|
||||
(U64V((v) << (n)) | ((v) >> (64 - (n))))
|
||||
|
||||
#define ROTR8(v, n) ROTL8(v, 8 - (n))
|
||||
#define ROTR16(v, n) ROTL16(v, 16 - (n))
|
||||
#define ROTR32(v, n) ROTL32(v, 32 - (n))
|
||||
#define ROTR64(v, n) ROTL64(v, 64 - (n))
|
||||
|
||||
#include "ecrypt-machine.h"
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* The following macros return a word with bytes in reverse order.
|
||||
*/
|
||||
|
||||
#define ECRYPT_DEFAULT_SWAP
|
||||
|
||||
#define SWAP16(v) \
|
||||
ROTL16(v, 8)
|
||||
|
||||
#define SWAP32(v) \
|
||||
((ROTL32(v, 8) & U32C(0x00FF00FF)) | \
|
||||
(ROTL32(v, 24) & U32C(0xFF00FF00)))
|
||||
|
||||
#ifdef ECRYPT_NATIVE64
|
||||
#define SWAP64(v) \
|
||||
((ROTL64(v, 8) & U64C(0x000000FF000000FF)) | \
|
||||
(ROTL64(v, 24) & U64C(0x0000FF000000FF00)) | \
|
||||
(ROTL64(v, 40) & U64C(0x00FF000000FF0000)) | \
|
||||
(ROTL64(v, 56) & U64C(0xFF000000FF000000)))
|
||||
#else
|
||||
#define SWAP64(v) \
|
||||
(((u64)SWAP32(U32V(v)) << 32) | (u64)SWAP32(U32V(v >> 32)))
|
||||
#endif
|
||||
|
||||
#include "ecrypt-machine.h"
|
||||
|
||||
#define ECRYPT_DEFAULT_WTOW
|
||||
|
||||
#ifdef ECRYPT_LITTLE_ENDIAN
|
||||
#define U16TO16_LITTLE(v) (v)
|
||||
#define U32TO32_LITTLE(v) (v)
|
||||
#define U64TO64_LITTLE(v) (v)
|
||||
|
||||
#define U16TO16_BIG(v) SWAP16(v)
|
||||
#define U32TO32_BIG(v) SWAP32(v)
|
||||
#define U64TO64_BIG(v) SWAP64(v)
|
||||
#endif
|
||||
|
||||
#ifdef ECRYPT_BIG_ENDIAN
|
||||
#define U16TO16_LITTLE(v) SWAP16(v)
|
||||
#define U32TO32_LITTLE(v) SWAP32(v)
|
||||
#define U64TO64_LITTLE(v) SWAP64(v)
|
||||
|
||||
#define U16TO16_BIG(v) (v)
|
||||
#define U32TO32_BIG(v) (v)
|
||||
#define U64TO64_BIG(v) (v)
|
||||
#endif
|
||||
|
||||
#include "ecrypt-machine.h"
|
||||
|
||||
/*
|
||||
* The following macros load words from an array of bytes with
|
||||
* different types of endianness, and vice versa.
|
||||
*/
|
||||
|
||||
#define ECRYPT_DEFAULT_BTOW
|
||||
|
||||
#if (!defined(ECRYPT_UNKNOWN) && defined(ECRYPT_I8T_IS_BYTE))
|
||||
|
||||
#define U8TO16_LITTLE(p) U16TO16_LITTLE(((u16*)(p))[0])
|
||||
#define U8TO32_LITTLE(p) U32TO32_LITTLE(((u32*)(p))[0])
|
||||
#define U8TO64_LITTLE(p) U64TO64_LITTLE(((u64*)(p))[0])
|
||||
|
||||
#define U8TO16_BIG(p) U16TO16_BIG(((u16*)(p))[0])
|
||||
#define U8TO32_BIG(p) U32TO32_BIG(((u32*)(p))[0])
|
||||
#define U8TO64_BIG(p) U64TO64_BIG(((u64*)(p))[0])
|
||||
|
||||
#define U16TO8_LITTLE(p, v) (((u16*)(p))[0] = U16TO16_LITTLE(v))
|
||||
#define U32TO8_LITTLE(p, v) (((u32*)(p))[0] = U32TO32_LITTLE(v))
|
||||
#define U64TO8_LITTLE(p, v) (((u64*)(p))[0] = U64TO64_LITTLE(v))
|
||||
|
||||
#define U16TO8_BIG(p, v) (((u16*)(p))[0] = U16TO16_BIG(v))
|
||||
#define U32TO8_BIG(p, v) (((u32*)(p))[0] = U32TO32_BIG(v))
|
||||
#define U64TO8_BIG(p, v) (((u64*)(p))[0] = U64TO64_BIG(v))
|
||||
|
||||
#else
|
||||
|
||||
#define U8TO16_LITTLE(p) \
|
||||
(((u16)((p)[0]) ) | \
|
||||
((u16)((p)[1]) << 8))
|
||||
|
||||
#define U8TO32_LITTLE(p) \
|
||||
(((u32)((p)[0]) ) | \
|
||||
((u32)((p)[1]) << 8) | \
|
||||
((u32)((p)[2]) << 16) | \
|
||||
((u32)((p)[3]) << 24))
|
||||
|
||||
#ifdef ECRYPT_NATIVE64
|
||||
#define U8TO64_LITTLE(p) \
|
||||
(((u64)((p)[0]) ) | \
|
||||
((u64)((p)[1]) << 8) | \
|
||||
((u64)((p)[2]) << 16) | \
|
||||
((u64)((p)[3]) << 24) | \
|
||||
((u64)((p)[4]) << 32) | \
|
||||
((u64)((p)[5]) << 40) | \
|
||||
((u64)((p)[6]) << 48) | \
|
||||
((u64)((p)[7]) << 56))
|
||||
#else
|
||||
#define U8TO64_LITTLE(p) \
|
||||
((u64)U8TO32_LITTLE(p) | ((u64)U8TO32_LITTLE((p) + 4) << 32))
|
||||
#endif
|
||||
|
||||
#define U8TO16_BIG(p) \
|
||||
(((u16)((p)[0]) << 8) | \
|
||||
((u16)((p)[1]) ))
|
||||
|
||||
#define U8TO32_BIG(p) \
|
||||
(((u32)((p)[0]) << 24) | \
|
||||
((u32)((p)[1]) << 16) | \
|
||||
((u32)((p)[2]) << 8) | \
|
||||
((u32)((p)[3]) ))
|
||||
|
||||
#ifdef ECRYPT_NATIVE64
|
||||
#define U8TO64_BIG(p) \
|
||||
(((u64)((p)[0]) << 56) | \
|
||||
((u64)((p)[1]) << 48) | \
|
||||
((u64)((p)[2]) << 40) | \
|
||||
((u64)((p)[3]) << 32) | \
|
||||
((u64)((p)[4]) << 24) | \
|
||||
((u64)((p)[5]) << 16) | \
|
||||
((u64)((p)[6]) << 8) | \
|
||||
((u64)((p)[7]) ))
|
||||
#else
|
||||
#define U8TO64_BIG(p) \
|
||||
(((u64)U8TO32_BIG(p) << 32) | (u64)U8TO32_BIG((p) + 4))
|
||||
#endif
|
||||
|
||||
#define U16TO8_LITTLE(p, v) \
|
||||
do { \
|
||||
(p)[0] = U8V((v) ); \
|
||||
(p)[1] = U8V((v) >> 8); \
|
||||
} while (0)
|
||||
|
||||
#define U32TO8_LITTLE(p, v) \
|
||||
do { \
|
||||
(p)[0] = U8V((v) ); \
|
||||
(p)[1] = U8V((v) >> 8); \
|
||||
(p)[2] = U8V((v) >> 16); \
|
||||
(p)[3] = U8V((v) >> 24); \
|
||||
} while (0)
|
||||
|
||||
#ifdef ECRYPT_NATIVE64
|
||||
#define U64TO8_LITTLE(p, v) \
|
||||
do { \
|
||||
(p)[0] = U8V((v) ); \
|
||||
(p)[1] = U8V((v) >> 8); \
|
||||
(p)[2] = U8V((v) >> 16); \
|
||||
(p)[3] = U8V((v) >> 24); \
|
||||
(p)[4] = U8V((v) >> 32); \
|
||||
(p)[5] = U8V((v) >> 40); \
|
||||
(p)[6] = U8V((v) >> 48); \
|
||||
(p)[7] = U8V((v) >> 56); \
|
||||
} while (0)
|
||||
#else
|
||||
#define U64TO8_LITTLE(p, v) \
|
||||
do { \
|
||||
U32TO8_LITTLE((p), U32V((v) )); \
|
||||
U32TO8_LITTLE((p) + 4, U32V((v) >> 32)); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#define U16TO8_BIG(p, v) \
|
||||
do { \
|
||||
(p)[0] = U8V((v) ); \
|
||||
(p)[1] = U8V((v) >> 8); \
|
||||
} while (0)
|
||||
|
||||
#define U32TO8_BIG(p, v) \
|
||||
do { \
|
||||
(p)[0] = U8V((v) >> 24); \
|
||||
(p)[1] = U8V((v) >> 16); \
|
||||
(p)[2] = U8V((v) >> 8); \
|
||||
(p)[3] = U8V((v) ); \
|
||||
} while (0)
|
||||
|
||||
#ifdef ECRYPT_NATIVE64
|
||||
#define U64TO8_BIG(p, v) \
|
||||
do { \
|
||||
(p)[0] = U8V((v) >> 56); \
|
||||
(p)[1] = U8V((v) >> 48); \
|
||||
(p)[2] = U8V((v) >> 40); \
|
||||
(p)[3] = U8V((v) >> 32); \
|
||||
(p)[4] = U8V((v) >> 24); \
|
||||
(p)[5] = U8V((v) >> 16); \
|
||||
(p)[6] = U8V((v) >> 8); \
|
||||
(p)[7] = U8V((v) ); \
|
||||
} while (0)
|
||||
#else
|
||||
#define U64TO8_BIG(p, v) \
|
||||
do { \
|
||||
U32TO8_BIG((p), U32V((v) >> 32)); \
|
||||
U32TO8_BIG((p) + 4, U32V((v) )); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include "ecrypt-machine.h"
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#endif
|
||||
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