Compare commits
2 Commits
b80a11093a
...
365aac8cfa
| Author | SHA1 | Date | |
|---|---|---|---|
| 365aac8cfa | |||
|
|
abd1a6a051 |
18
app/app.pro
18
app/app.pro
@ -13,9 +13,9 @@ FORMS += $$files($$PWD/*.ui)
|
||||
RESOURCES += ../data/data.qrc
|
||||
|
||||
LIBS += \
|
||||
-L$$PWD/../third_party/devil_sdk/lib/ -lDevIL -lILU -lILUT \
|
||||
-L$$PWD/../third_party/zlib/lib/ -lzlib \
|
||||
-L$$PWD/../third_party/xbox_sdk/lib -lxcompress64 \
|
||||
#-L$$PWD/../third_party/devil_sdk/lib/ -lDevIL -lILU -lILUT \
|
||||
#-L$$PWD/../third_party/zlib/lib/ -lzlib \
|
||||
#-L$$PWD/../third_party/xbox_sdk/lib -lxcompress64 \
|
||||
-L$$OUT_PWD/../libs/ -lcore \
|
||||
-L$$OUT_PWD/../libs/ -lxassets\
|
||||
-L$$OUT_PWD/../libs/ -lcompression \
|
||||
@ -27,9 +27,9 @@ LIBS += \
|
||||
-L$$OUT_PWD/../libs/ -lzonefile
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/../third_party/devil_sdk/include/ \
|
||||
$$PWD/../third_party/zlib/include \
|
||||
$$PWD/../third_party/xbox_sdk/include \
|
||||
#$$PWD/../third_party/devil_sdk/include/ \
|
||||
#$$PWD/../third_party/zlib/include \
|
||||
#$$PWD/../third_party/xbox_sdk/include \
|
||||
$$PWD/../libs/core \
|
||||
$$PWD/../libs/compression \
|
||||
$$PWD/../libs/encryption \
|
||||
@ -41,9 +41,9 @@ INCLUDEPATH += \
|
||||
$$PWD/../libs/zonefile
|
||||
|
||||
DEPENDPATH += \
|
||||
$$PWD/../third_party/devil_sdk/include/ \
|
||||
$$PWD/../third_party/zlib/include \
|
||||
$$PWD/../third_party/xbox_sdk/include \
|
||||
#$$PWD/../third_party/devil_sdk/include/ \
|
||||
#$$PWD/../third_party/zlib/include \
|
||||
#$$PWD/../third_party/xbox_sdk/include \
|
||||
$$PWD/../libs/core \
|
||||
$$PWD/../libs/compression \
|
||||
$$PWD/../libs/encryption \
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include "mainwindow.h"
|
||||
#include "qtimer.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include "aboutdialog.h"
|
||||
@ -10,9 +11,7 @@
|
||||
#include "materialviewer.h"
|
||||
#include "preferenceeditor.h"
|
||||
#include "reportissuedialog.h"
|
||||
#include "rumblefileviewer.h"
|
||||
#include "rumblegraphviewer.h"
|
||||
#include "soundviewer.h"
|
||||
#include "stringtableviewer.h"
|
||||
#include "techsetviewer.h"
|
||||
#include "fastfile_factory.h"
|
||||
@ -24,12 +23,11 @@
|
||||
#include "ipak_structs.h"
|
||||
#include "iwiviewer.h"
|
||||
#include "localstringviewer.h"
|
||||
#include "imagewidget.h"
|
||||
#include "zonefileviewer.h"
|
||||
#include "techsetviewer.h"
|
||||
#include "logmanager.h"
|
||||
|
||||
#include <qmath.h>
|
||||
#include <QtMath>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent), ui(new Ui::MainWindow) {
|
||||
@ -37,6 +35,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
setAcceptDrops(true);
|
||||
|
||||
XAsset::SetDebug(true);
|
||||
|
||||
mTypeMap = QMap<QString, int>();
|
||||
mTypeOrder = QStringList();
|
||||
mRawFileMap = QMap<QString, QString>();
|
||||
@ -541,6 +541,21 @@ bool MainWindow::OpenFastFile(const QString aFastFilePath) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MainWindow::OpenFastFile(const QByteArray& aFastFileData, const QString aFastFilePath) {
|
||||
const QString fastFileStem = aFastFilePath.section("/", -1, -1);
|
||||
if (mTreeWidget->HasFastFile(fastFileStem)) {
|
||||
LogManager::instance().addError("Can't add duplicate file!");
|
||||
return false;
|
||||
}
|
||||
|
||||
FastFile* fastFile = FastFileFactory::Create(aFastFileData);
|
||||
fastFile->SetStem(fastFileStem);
|
||||
mTreeWidget->AddFastFile(fastFile);
|
||||
|
||||
// Open zone file after decompressing ff and writing
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
OpenFastFile()
|
||||
|
||||
@ -550,18 +565,11 @@ bool MainWindow::OpenFastFile(const QString aFastFilePath) {
|
||||
bool MainWindow::OpenFastFile() {
|
||||
// Open file dialog to steam apps
|
||||
const QString steamPath = "C:/Program Files (x86)/Steam/steamapps/common/Call of Duty World at War/zone/english/";
|
||||
const QString fastFilePath = QFileDialog::getOpenFileName(this, "Open Fast File", steamPath, "Fast File (*.ff);;All Files (*.*)");
|
||||
if (fastFilePath.isNull()) {
|
||||
// User pressed cancel
|
||||
return false;
|
||||
} else if (!QFile::exists(fastFilePath)) {
|
||||
QMessageBox::warning(this, "Warning!", QString("%1 does not exist!.").arg(fastFilePath));
|
||||
return false;
|
||||
}
|
||||
if (!OpenFastFile(fastFilePath)) {
|
||||
qDebug() << "Failed to open Fast file!";
|
||||
return false;
|
||||
}
|
||||
|
||||
QFileDialog::getOpenFileContent(tr("Fast File (*.ff);;All Files (*.*)"), [this](const QString &fileName, const QByteArray &data){
|
||||
OpenFastFile(data, fileName);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
#include <QPlainTextEdit>
|
||||
#include <QMimeData>
|
||||
#include <QProgressBar>
|
||||
#include <windows.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui {
|
||||
@ -34,6 +33,7 @@ public:
|
||||
|
||||
private slots:
|
||||
bool OpenFastFile(const QString aFastFilePath);
|
||||
bool OpenFastFile(const QByteArray& aFastFileData, const QString aFastFilePath);
|
||||
bool OpenFastFile();
|
||||
|
||||
bool OpenZoneFile(const QString aZoneFilePath, bool fromFF = false);
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
<file>icons/Icon_Editor.png</file>
|
||||
<file>icons/Icon_Views.png</file>
|
||||
<file>icons/Icon_Tree.png</file>
|
||||
<file>icons/Icon_Copy.png</file>
|
||||
<file>icons/Icon_Cut.png</file>
|
||||
<file>icons/Icon_Find.png</file>
|
||||
<file>icons/Icon_NewFile.png</file>
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#include "compression.h"
|
||||
//#include "minilzo.h"
|
||||
|
||||
#define XBOXAPI __declspec(dllimport)
|
||||
#include "xcompress.h"
|
||||
//#define XBOXAPI __declspec(dllimport)
|
||||
//#include "xcompress.h"
|
||||
|
||||
#include <QLibrary>
|
||||
#include <QDebug>
|
||||
@ -11,61 +11,63 @@
|
||||
|
||||
QByteArray Compression::CompressXMem(const QByteArray &data)
|
||||
{
|
||||
XMEMCODEC_PARAMETERS_LZX lzxParams = {};
|
||||
lzxParams.Flags = 0;
|
||||
lzxParams.WindowSize = 0x20000;
|
||||
lzxParams.CompressionPartitionSize = 0x80000;
|
||||
// XMEMCODEC_PARAMETERS_LZX lzxParams = {};
|
||||
// lzxParams.Flags = 0;
|
||||
// lzxParams.WindowSize = 0x20000;
|
||||
// lzxParams.CompressionPartitionSize = 0x80000;
|
||||
|
||||
XMEMCOMPRESSION_CONTEXT ctx = nullptr;
|
||||
if (FAILED(XMemCreateCompressionContext(XMEMCODEC_LZX, &lzxParams, 0, &ctx)) || !ctx)
|
||||
// XMEMCOMPRESSION_CONTEXT ctx = nullptr;
|
||||
// if (FAILED(XMemCreateCompressionContext(XMEMCODEC_LZX, &lzxParams, 0, &ctx)) || !ctx)
|
||||
// return QByteArray();
|
||||
|
||||
// SIZE_T estimatedSize = data.size() + XCOMPRESS_LZX_BLOCK_GROWTH_SIZE_MAX;
|
||||
// QByteArray output(static_cast<int>(estimatedSize), 0);
|
||||
// SIZE_T actualSize = estimatedSize;
|
||||
|
||||
// HRESULT hr = XMemCompress(ctx, output.data(), &actualSize, data.constData(), data.size());
|
||||
// XMemDestroyCompressionContext(ctx);
|
||||
|
||||
// if (FAILED(hr))
|
||||
// return QByteArray();
|
||||
|
||||
// output.resize(static_cast<int>(actualSize));
|
||||
// return output;
|
||||
return QByteArray();
|
||||
|
||||
SIZE_T estimatedSize = data.size() + XCOMPRESS_LZX_BLOCK_GROWTH_SIZE_MAX;
|
||||
QByteArray output(static_cast<int>(estimatedSize), 0);
|
||||
SIZE_T actualSize = estimatedSize;
|
||||
|
||||
HRESULT hr = XMemCompress(ctx, output.data(), &actualSize, data.constData(), data.size());
|
||||
XMemDestroyCompressionContext(ctx);
|
||||
|
||||
if (FAILED(hr))
|
||||
return QByteArray();
|
||||
|
||||
output.resize(static_cast<int>(actualSize));
|
||||
return output;
|
||||
}
|
||||
|
||||
QByteArray Compression::DecompressXMem(const QByteArray &data, int flags, int windowSize, int partSize)
|
||||
{
|
||||
if (data.isEmpty())
|
||||
return {};
|
||||
// if (data.isEmpty())
|
||||
// return {};
|
||||
|
||||
XMEMCODEC_PARAMETERS_LZX lzxParams = {};
|
||||
lzxParams.Flags = flags;
|
||||
lzxParams.WindowSize = windowSize;
|
||||
lzxParams.CompressionPartitionSize = partSize;
|
||||
// XMEMCODEC_PARAMETERS_LZX lzxParams = {};
|
||||
// lzxParams.Flags = flags;
|
||||
// lzxParams.WindowSize = windowSize;
|
||||
// lzxParams.CompressionPartitionSize = partSize;
|
||||
|
||||
XMEMDECOMPRESSION_CONTEXT ctx = nullptr;
|
||||
if (FAILED(XMemCreateDecompressionContext(XMEMCODEC_LZX, &lzxParams, 0, &ctx)) || !ctx)
|
||||
return {};
|
||||
// XMEMDECOMPRESSION_CONTEXT ctx = nullptr;
|
||||
// if (FAILED(XMemCreateDecompressionContext(XMEMCODEC_LZX, &lzxParams, 0, &ctx)) || !ctx)
|
||||
// return {};
|
||||
|
||||
// Allocate large enough buffer for decompression (16 MB is a safe upper bound)
|
||||
const SIZE_T kMaxOutSize = 16 * 1024 * 1024;
|
||||
QByteArray output(static_cast<int>(kMaxOutSize), Qt::Uninitialized);
|
||||
SIZE_T actualSize = kMaxOutSize;
|
||||
// // Allocate large enough buffer for decompression (16 MB is a safe upper bound)
|
||||
// const SIZE_T kMaxOutSize = 16 * 1024 * 1024;
|
||||
// QByteArray output(static_cast<int>(kMaxOutSize), Qt::Uninitialized);
|
||||
// SIZE_T actualSize = kMaxOutSize;
|
||||
|
||||
HRESULT hr = XMemDecompress(ctx,
|
||||
output.data(), &actualSize,
|
||||
data.constData(), data.size() + 16);
|
||||
// HRESULT hr = XMemDecompress(ctx,
|
||||
// output.data(), &actualSize,
|
||||
// data.constData(), data.size() + 16);
|
||||
|
||||
XMemDestroyDecompressionContext(ctx);
|
||||
// XMemDestroyDecompressionContext(ctx);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
qWarning() << "XMemDecompress failed with HRESULT:" << hr;
|
||||
return {};
|
||||
}
|
||||
// if (FAILED(hr)) {
|
||||
// qWarning() << "XMemDecompress failed with HRESULT:" << hr;
|
||||
// return {};
|
||||
// }
|
||||
|
||||
output.resize(static_cast<int>(actualSize));
|
||||
return output;
|
||||
// output.resize(static_cast<int>(actualSize));
|
||||
// return output;
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
quint32 Compression::CalculateAdler32Checksum(const QByteArray &data) {
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
#include "QtZlib/zlib.h"
|
||||
|
||||
#include <windows.h>
|
||||
//#include <windows.h>
|
||||
#include <QtGlobal>
|
||||
#include <stddef.h>
|
||||
#include <QByteArray>
|
||||
|
||||
@ -105,7 +105,7 @@ extern "C" {
|
||||
# define LZO_INT_MAX 9223372036854775807LL
|
||||
# define LZO_INT_MIN (-1LL - LZO_INT_MAX)
|
||||
# elif (LZO_ABI_IP32L64) /* MIPS R5900 */
|
||||
typedef unsigned int lzo_uint;
|
||||
typedef quint32 lzo_uint;
|
||||
typedef int lzo_int;
|
||||
# define LZO_SIZEOF_LZO_INT LZO_SIZEOF_INT
|
||||
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_INT
|
||||
|
||||
@ -2847,7 +2847,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_LONG
|
||||
#elif (LZO_SIZEOF_INT == 2) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT)
|
||||
# define lzo_int16e_t int
|
||||
# define lzo_uint16e_t unsigned int
|
||||
# define lzo_uint16e_t quint32
|
||||
# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_INT
|
||||
#elif (LZO_SIZEOF_SHORT == 2)
|
||||
# define lzo_int16e_t short int
|
||||
@ -2856,14 +2856,14 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
#elif 1 && !(LZO_CFG_TYPE_NO_MODE_HI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM)
|
||||
# if !(LZO_LANG_ASSEMBLER)
|
||||
typedef int lzo_int16e_hi_t__ __attribute__((__mode__(__HI__)));
|
||||
typedef unsigned int lzo_uint16e_hi_t__ __attribute__((__mode__(__HI__)));
|
||||
typedef quint32 lzo_uint16e_hi_t__ __attribute__((__mode__(__HI__)));
|
||||
# endif
|
||||
# define lzo_int16e_t lzo_int16e_hi_t__
|
||||
# define lzo_uint16e_t lzo_uint16e_hi_t__
|
||||
# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___MODE_HI
|
||||
#elif (LZO_SIZEOF___INT16 == 2)
|
||||
# define lzo_int16e_t __int16
|
||||
# define lzo_uint16e_t unsigned __int16
|
||||
# define lzo_uint16e_t quint32
|
||||
# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___INT16
|
||||
#else
|
||||
#endif
|
||||
@ -2883,7 +2883,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_LONG
|
||||
#elif (LZO_SIZEOF_INT == 4)
|
||||
# define lzo_int32e_t int
|
||||
# define lzo_uint32e_t unsigned int
|
||||
# define lzo_uint32e_t quint32
|
||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_INT
|
||||
#elif (LZO_SIZEOF_SHORT == 4)
|
||||
# define lzo_int32e_t short int
|
||||
@ -2896,7 +2896,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) && (__INT_MAX__+0 > 2147483647L)
|
||||
# if !(LZO_LANG_ASSEMBLER)
|
||||
typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
typedef quint32 lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
# endif
|
||||
# define lzo_int32e_t lzo_int32e_si_t__
|
||||
# define lzo_uint32e_t lzo_uint32e_si_t__
|
||||
@ -2904,7 +2904,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_GNUC >= 0x025f00ul) && defined(__AVR__) && (__LONG_MAX__+0 == 32767L)
|
||||
# if !(LZO_LANG_ASSEMBLER)
|
||||
typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
typedef quint32 lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
# endif
|
||||
# define lzo_int32e_t lzo_int32e_si_t__
|
||||
# define lzo_uint32e_t lzo_uint32e_si_t__
|
||||
@ -2913,7 +2913,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___MODE_SI
|
||||
#elif (LZO_SIZEOF___INT32 == 4)
|
||||
# define lzo_int32e_t __int32
|
||||
# define lzo_uint32e_t unsigned __int32
|
||||
# define lzo_uint32e_t quint32
|
||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___INT32
|
||||
#else
|
||||
#endif
|
||||
@ -2937,7 +2937,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
#endif
|
||||
#if (LZO_SIZEOF_INT == 8) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
|
||||
# define lzo_int64e_t int
|
||||
# define lzo_uint64e_t unsigned int
|
||||
# define lzo_uint64e_t quint32
|
||||
# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_INT
|
||||
#elif (LZO_SIZEOF_LONG == 8) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF_LONG_LONG) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64)
|
||||
# define lzo_int64e_t long int
|
||||
@ -2984,7 +2984,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
# define LZO_TYPEOF_LZO_INT32L_T LZO_TYPEOF_LZO_INT32E_T
|
||||
#elif (LZO_SIZEOF_INT >= 4) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
|
||||
# define lzo_int32l_t int
|
||||
# define lzo_uint32l_t unsigned int
|
||||
# define lzo_uint32l_t quint32
|
||||
# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_INT
|
||||
# define LZO_TYPEOF_LZO_INT32L_T LZO_SIZEOF_INT
|
||||
#elif (LZO_SIZEOF_LONG >= 4)
|
||||
@ -3057,7 +3057,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
#elif (LZO_CC_MSC && (_MSC_VER >= 1300) && (LZO_SIZEOF_VOID_P == 4) && (LZO_SIZEOF_INT == 4))
|
||||
# if !(LZO_LANG_ASSEMBLER)
|
||||
typedef __w64 int lzo_intptr_t;
|
||||
typedef __w64 unsigned int lzo_uintptr_t;
|
||||
typedef __w64 quint32 lzo_uintptr_t;
|
||||
# endif
|
||||
# define lzo_intptr_t lzo_intptr_t
|
||||
# define lzo_uintptr_t lzo_uintptr_t
|
||||
@ -3070,7 +3070,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_SHORT
|
||||
#elif (LZO_SIZEOF_INT >= LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
|
||||
# define lzo_intptr_t int
|
||||
# define lzo_uintptr_t unsigned int
|
||||
# define lzo_uintptr_t quint32
|
||||
# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT
|
||||
# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_INT
|
||||
#elif (LZO_SIZEOF_LONG >= LZO_SIZEOF_VOID_P)
|
||||
@ -3104,7 +3104,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LONG
|
||||
# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_LONG
|
||||
#elif (LZO_WORDSIZE == LZO_SIZEOF_INT)
|
||||
# define lzo_word_t unsigned int
|
||||
# define lzo_word_t quint32
|
||||
# define lzo_sword_t int
|
||||
# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_INT
|
||||
# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_INT
|
||||
|
||||
@ -89,92 +89,92 @@ DDSFile::DDSFile(const QString &aFilePath)
|
||||
}
|
||||
|
||||
DDSFile::DDSFile(const QByteArray aDDSData, const QString aFileStem) {
|
||||
QDataStream ddsIn(aDDSData);
|
||||
ddsIn.setByteOrder(QDataStream::LittleEndian);
|
||||
// QDataStream ddsIn(aDDSData);
|
||||
// ddsIn.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
DDSHeader ddsHeader;
|
||||
if (ddsIn.readRawData(reinterpret_cast<char*>(&ddsHeader), sizeof(DDSHeader)) != sizeof(DDSHeader)) {
|
||||
qDebug() << "Error: Failed to read DDSHeader from QByteArray!";
|
||||
return;
|
||||
}
|
||||
// DDSHeader ddsHeader;
|
||||
// if (ddsIn.readRawData(reinterpret_cast<char*>(&ddsHeader), sizeof(DDSHeader)) != sizeof(DDSHeader)) {
|
||||
// qDebug() << "Error: Failed to read DDSHeader from QByteArray!";
|
||||
// return;
|
||||
// }
|
||||
|
||||
fileStem = aFileStem;
|
||||
header = ddsHeader;
|
||||
// fileStem = aFileStem;
|
||||
// header = ddsHeader;
|
||||
|
||||
// Ensure DevIL is initialized once globally
|
||||
static bool devilInitialized = false;
|
||||
if (!devilInitialized) {
|
||||
ilInit();
|
||||
devilInitialized = true;
|
||||
}
|
||||
// // Ensure DevIL is initialized once globally
|
||||
// static bool devilInitialized = false;
|
||||
// if (!devilInitialized) {
|
||||
// ilInit();
|
||||
// devilInitialized = true;
|
||||
// }
|
||||
|
||||
// Generate and bind an image
|
||||
ILuint imageID;
|
||||
ilGenImages(1, &imageID);
|
||||
ilBindImage(imageID);
|
||||
// // Generate and bind an image
|
||||
// ILuint imageID;
|
||||
// ilGenImages(1, &imageID);
|
||||
// ilBindImage(imageID);
|
||||
|
||||
ilEnable(IL_ORIGIN_SET);
|
||||
ilOriginFunc(IL_ORIGIN_UPPER_LEFT);
|
||||
// ilEnable(IL_ORIGIN_SET);
|
||||
// ilOriginFunc(IL_ORIGIN_UPPER_LEFT);
|
||||
|
||||
// Load DDS file
|
||||
if (!ilLoadL(IL_DDS, aDDSData.constData(), aDDSData.size())) {
|
||||
ILuint devilError = ilGetError();
|
||||
qDebug() << "DevIL Error while loading DDS: " << devilError;
|
||||
ilDeleteImages(1, &imageID);
|
||||
return;
|
||||
}
|
||||
// // Load DDS file
|
||||
// if (!ilLoadL(IL_DDS, aDDSData.constData(), aDDSData.size())) {
|
||||
// ILuint devilError = ilGetError();
|
||||
// qDebug() << "DevIL Error while loading DDS: " << devilError;
|
||||
// ilDeleteImages(1, &imageID);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Get mipmap count
|
||||
ILint numMipmaps = ilGetInteger(IL_NUM_MIPMAPS);
|
||||
qDebug() << "Number of mipmaps: " << numMipmaps;
|
||||
// // Get mipmap count
|
||||
// ILint numMipmaps = ilGetInteger(IL_NUM_MIPMAPS);
|
||||
// qDebug() << "Number of mipmaps: " << numMipmaps;
|
||||
|
||||
// Loop over all mipmap levels (0 is the base image)
|
||||
for (ILint level = 0; level <= numMipmaps; ++level) {
|
||||
ilBindImage(imageID);
|
||||
if (!ilActiveMipmap(level)) {
|
||||
qDebug() << "DevIL failed to activate mipmap level" << level;
|
||||
continue;
|
||||
}
|
||||
// // Loop over all mipmap levels (0 is the base image)
|
||||
// for (ILint level = 0; level <= numMipmaps; ++level) {
|
||||
// ilBindImage(imageID);
|
||||
// if (!ilActiveMipmap(level)) {
|
||||
// qDebug() << "DevIL failed to activate mipmap level" << level;
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// Get mipmap properties
|
||||
int width = ilGetInteger(IL_IMAGE_WIDTH);
|
||||
int height = ilGetInteger(IL_IMAGE_HEIGHT);
|
||||
int depth = ilGetInteger(IL_IMAGE_DEPTH);
|
||||
int format = ilGetInteger(IL_IMAGE_FORMAT);
|
||||
int bpp = 0;
|
||||
// // Get mipmap properties
|
||||
// int width = ilGetInteger(IL_IMAGE_WIDTH);
|
||||
// int height = ilGetInteger(IL_IMAGE_HEIGHT);
|
||||
// int depth = ilGetInteger(IL_IMAGE_DEPTH);
|
||||
// int format = ilGetInteger(IL_IMAGE_FORMAT);
|
||||
// int bpp = 0;
|
||||
|
||||
switch (format) {
|
||||
case IL_RGB:
|
||||
bpp = 3;
|
||||
break;
|
||||
case IL_RGBA:
|
||||
bpp = 4;
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Unsupported image format.";
|
||||
continue;
|
||||
}
|
||||
// switch (format) {
|
||||
// case IL_RGB:
|
||||
// bpp = 3;
|
||||
// break;
|
||||
// case IL_RGBA:
|
||||
// bpp = 4;
|
||||
// break;
|
||||
// default:
|
||||
// qDebug() << "Unsupported image format.";
|
||||
// continue;
|
||||
// }
|
||||
|
||||
int dataSize = width * height * depth * bpp;
|
||||
// int dataSize = width * height * depth * bpp;
|
||||
|
||||
ILubyte *data = ilGetData();
|
||||
if (!data) {
|
||||
qDebug() << "Error: DevIL returned null data for mipmap level" << level;
|
||||
continue;
|
||||
}
|
||||
// ILubyte *data = ilGetData();
|
||||
// if (!data) {
|
||||
// qDebug() << "Error: DevIL returned null data for mipmap level" << level;
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// Create a mipmap structure
|
||||
DDSMipmap mipmap;
|
||||
mipmap.width = width;
|
||||
mipmap.height = height;
|
||||
mipmap.data = QByteArray(reinterpret_cast<const char*>(data), dataSize);
|
||||
mipmap.size = dataSize;
|
||||
// // Create a mipmap structure
|
||||
// DDSMipmap mipmap;
|
||||
// mipmap.width = width;
|
||||
// mipmap.height = height;
|
||||
// mipmap.data = QByteArray(reinterpret_cast<const char*>(data), dataSize);
|
||||
// mipmap.size = dataSize;
|
||||
|
||||
// Store in DDS file
|
||||
mipmaps.append(mipmap);
|
||||
}
|
||||
// // Store in DDS file
|
||||
// mipmaps.append(mipmap);
|
||||
// }
|
||||
|
||||
ilDeleteImages(1, &imageID);
|
||||
// ilDeleteImages(1, &imageID);
|
||||
}
|
||||
|
||||
DDSFile::DDSFile(const DDSFile &ddsFile) :
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#include <QVector>
|
||||
#include <QDebug>
|
||||
#include <QImage>
|
||||
#include <IL/il.h>
|
||||
//#include <IL/il.h>
|
||||
|
||||
struct DDSPixelFormat {
|
||||
quint32 size;
|
||||
|
||||
@ -6,17 +6,17 @@ SOURCES += $$files($$PWD/*.cpp, true)
|
||||
HEADERS += $$files($$PWD/*.h, true)
|
||||
|
||||
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/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/
|
||||
#$$PWD/../../third_party/devil_sdk/include/
|
||||
|
||||
DEPENDPATH += \
|
||||
$$PWD/../iwifile/ \
|
||||
$$PWD/../../third_party/devil_sdk/include/
|
||||
#$$PWD/../../third_party/devil_sdk/include/
|
||||
|
||||
DESTDIR = $$OUT_PWD/../
|
||||
|
||||
@ -27,10 +27,10 @@
|
||||
/*
|
||||
* 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
|
||||
* u8: quint32eger type, at least 8 bits
|
||||
* u16: quint32eger type, at least 16 bits
|
||||
* u32: quint32eger type, at least 32 bits
|
||||
* u64: quint32eger type, at least 64 bits
|
||||
*
|
||||
* s8, s16, s32, s64 -> signed counterparts of u8, u16, u32, u64
|
||||
*
|
||||
|
||||
@ -87,7 +87,7 @@ void Encryption::UpdateIVTable(QByteArray &table, int index, const QByteArray &s
|
||||
}
|
||||
|
||||
quint32 Encryption::ToUInt32(const QByteArray &data, int offset) {
|
||||
// Converts 4 bytes (starting at offset) from data into a 32-bit unsigned integer (little-endian)
|
||||
// Converts 4 bytes (starting at offset) from data into a 32-bit quint32eger (little-endian)
|
||||
return ((static_cast<quint32>(static_cast<uchar>(data[offset])) ) |
|
||||
(static_cast<quint32>(static_cast<uchar>(data[offset+1])) << 8 ) |
|
||||
(static_cast<quint32>(static_cast<uchar>(data[offset+2])) << 16) |
|
||||
|
||||
@ -59,7 +59,7 @@ void ECRYPT_encrypt_bytes(ECRYPT_ctx *x,const u8 *m,u8 *c,u32 bytes)
|
||||
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;
|
||||
int i;
|
||||
|
||||
if (!bytes) return;
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ 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
|
||||
void SHA1Update(SHA1_CTX* context, unsigned char* data, quint32
|
||||
len)
|
||||
to
|
||||
void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned
|
||||
@ -27,7 +27,7 @@ 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.
|
||||
unsigned long from quint32 for the same reason.
|
||||
|
||||
These changes should make no difference to any 32 bit implementations since
|
||||
an
|
||||
|
||||
@ -90,7 +90,7 @@ bool FastFile_COD4_PS3::Load(const QByteArray aData) {
|
||||
// Loop until EOF or invalid chunk
|
||||
while (pos <= aData.size()) {
|
||||
// Read 2-byte BIG-ENDIAN chunk size
|
||||
quint16 chunkSize;
|
||||
quint32 chunkSize;
|
||||
QDataStream chunkStream(aData.mid(pos, 2));
|
||||
chunkStream.setByteOrder(QDataStream::BigEndian);
|
||||
chunkStream >> chunkSize;
|
||||
|
||||
@ -90,7 +90,7 @@ bool FastFile_COD5_PS3::Load(const QByteArray aData) {
|
||||
// Loop until EOF or invalid chunk
|
||||
while (pos <= aData.size()) {
|
||||
// Read 2-byte BIG-ENDIAN chunk size
|
||||
quint16 chunkSize;
|
||||
quint32 chunkSize;
|
||||
QDataStream chunkStream(aData.mid(pos, 2));
|
||||
chunkStream.setByteOrder(QDataStream::BigEndian);
|
||||
chunkStream >> chunkSize;
|
||||
|
||||
@ -30,9 +30,9 @@ struct IWIHeader {
|
||||
struct IWIInfo {
|
||||
quint8 Format;
|
||||
quint8 Usage;
|
||||
quint16 Width;
|
||||
quint16 Height;
|
||||
quint16 Depth;
|
||||
quint32 Width;
|
||||
quint32 Height;
|
||||
quint32 Depth;
|
||||
};
|
||||
|
||||
struct IWIMipmap {
|
||||
|
||||
@ -13,11 +13,11 @@ void XAnimDeltaPartQuat::ParseData(QDataStream *aStream) {
|
||||
}
|
||||
}
|
||||
|
||||
quint16 XAnimDeltaPartQuat::GetSize() const {
|
||||
quint32 XAnimDeltaPartQuat::GetSize() const {
|
||||
return mSize;
|
||||
}
|
||||
|
||||
void XAnimDeltaPartQuat::SetSize(quint16 size) {
|
||||
void XAnimDeltaPartQuat::SetSize(quint32 size) {
|
||||
mSize = size;
|
||||
}
|
||||
|
||||
|
||||
@ -17,14 +17,14 @@ public:
|
||||
|
||||
void ParseData(QDataStream *aStream) override;
|
||||
|
||||
quint16 GetSize() const;
|
||||
void SetSize(quint16 size);
|
||||
quint32 GetSize() const;
|
||||
void SetSize(quint32 size);
|
||||
|
||||
const XAnimDeltaPartQuatData& GetData() const;
|
||||
void SetData(const XAnimDeltaPartQuatData& data);
|
||||
|
||||
private:
|
||||
quint16 mSize = 0;
|
||||
quint32 mSize = 0;
|
||||
XAnimDeltaPartQuatData mData;
|
||||
};
|
||||
|
||||
|
||||
@ -28,10 +28,10 @@ void XAnimIndices::Clear()
|
||||
mIndex = 0;
|
||||
}
|
||||
|
||||
quint16 XAnimIndices::GetIndex() const {
|
||||
quint32 XAnimIndices::GetIndex() const {
|
||||
return mIndex;
|
||||
}
|
||||
|
||||
void XAnimIndices::SetIndex(quint16 index) {
|
||||
void XAnimIndices::SetIndex(quint32 index) {
|
||||
mIndex = index;
|
||||
}
|
||||
|
||||
@ -12,11 +12,11 @@ public:
|
||||
void ParseData(QDataStream *aStream) override;
|
||||
void Clear() override;
|
||||
|
||||
quint16 GetIndex() const;
|
||||
void SetIndex(quint16 index);
|
||||
quint32 GetIndex() const;
|
||||
void SetIndex(quint32 index);
|
||||
|
||||
private:
|
||||
quint16 mIndex = 0;
|
||||
quint32 mIndex = 0;
|
||||
};
|
||||
|
||||
#endif // XANIMINDICES_H
|
||||
|
||||
@ -27,11 +27,11 @@ void XAnimNotifyInfo::Clear()
|
||||
mTime = 0.0f;
|
||||
}
|
||||
|
||||
quint16 XAnimNotifyInfo::GetName() const {
|
||||
quint32 XAnimNotifyInfo::GetName() const {
|
||||
return mName;
|
||||
}
|
||||
|
||||
void XAnimNotifyInfo::SetName(quint16 name) {
|
||||
void XAnimNotifyInfo::SetName(quint32 name) {
|
||||
mName = name;
|
||||
}
|
||||
|
||||
|
||||
@ -12,14 +12,14 @@ public:
|
||||
void ParseData(QDataStream *aStream) override;
|
||||
void Clear() override;
|
||||
|
||||
quint16 GetName() const;
|
||||
void SetName(quint16 name);
|
||||
quint32 GetName() const;
|
||||
void SetName(quint32 name);
|
||||
|
||||
float GetTime() const;
|
||||
void SetTime(float time);
|
||||
|
||||
private:
|
||||
quint16 mName;
|
||||
quint32 mName;
|
||||
float mTime;
|
||||
};
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ void XAnimParts::ParseData(QDataStream *aStream) {
|
||||
>> mNotifyCount
|
||||
>> mAssetType;
|
||||
|
||||
quint16 pad;
|
||||
quint32 pad;
|
||||
*aStream >> pad;
|
||||
mPad = (pad != 0);
|
||||
|
||||
|
||||
@ -21,12 +21,12 @@ public:
|
||||
private:
|
||||
XString mName;
|
||||
|
||||
quint16 mDataByteCount = 0;
|
||||
quint16 mDataShortCount = 0;
|
||||
quint16 mDataIntCount = 0;
|
||||
quint16 mRandomDataByteCount = 0;
|
||||
quint16 mRandomDataIntCount = 0;
|
||||
quint16 mNumFrames = 0;
|
||||
quint32 mDataByteCount = 0;
|
||||
quint32 mDataShortCount = 0;
|
||||
quint32 mDataIntCount = 0;
|
||||
quint32 mRandomDataByteCount = 0;
|
||||
quint32 mRandomDataIntCount = 0;
|
||||
quint32 mNumFrames = 0;
|
||||
|
||||
bool mIsLoop = false;
|
||||
bool mIsDelta = false;
|
||||
@ -37,13 +37,13 @@ private:
|
||||
|
||||
bool mPad = false;
|
||||
|
||||
quint16 mRandomDataShortCount = 0;
|
||||
quint16 mIndexCount = 0;
|
||||
quint32 mRandomDataShortCount = 0;
|
||||
quint32 mIndexCount = 0;
|
||||
|
||||
float mFramerate = 0.0f;
|
||||
float mFrequency = 0.0f;
|
||||
|
||||
quint16 mNames = 0;
|
||||
quint32 mNames = 0;
|
||||
quint8 mDataByte = 0;
|
||||
qint16 mDataShort = 0;
|
||||
int mDataInt = 0;
|
||||
|
||||
@ -15,7 +15,7 @@ public:
|
||||
void Clear() override;
|
||||
|
||||
private:
|
||||
quint16 mSize;
|
||||
quint32 mSize;
|
||||
bool mIsSmallTrans;
|
||||
XAnimPartTransData mData;
|
||||
};
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
#include "xstringtable.h"
|
||||
#include "xweapondef.h"
|
||||
|
||||
XAsset::
|
||||
|
||||
XAsset::XAsset()
|
||||
: mPtr(0)
|
||||
, mType(ASSET_TYPE_NONE)
|
||||
@ -61,14 +63,39 @@ QString XAsset::GetName() const
|
||||
return mName;
|
||||
}
|
||||
|
||||
void XAsset::SetDebug(bool aDebug)
|
||||
{
|
||||
XAsset::mDebug = aDebug;
|
||||
}
|
||||
|
||||
bool XAsset::IsDebug() const
|
||||
{
|
||||
return mDebug;
|
||||
}
|
||||
|
||||
void XAsset::Clear()
|
||||
{
|
||||
if (mDebug)
|
||||
{
|
||||
qDebug() << QString("Clearing XAsset of type %1").arg(GetName());
|
||||
}
|
||||
mPtr = 0;
|
||||
mType = ASSET_TYPE_NONE;
|
||||
}
|
||||
|
||||
void XAsset::ParsePtr(QDataStream *aStream, bool aDataFlag) {
|
||||
*aStream >> mPtr;
|
||||
if (mDebug)
|
||||
{
|
||||
// Always treat as unsigned when displaying in hex
|
||||
quint64 raw = static_cast<quint64>(static_cast<quint32>(mPtr));
|
||||
|
||||
QString hexPtr = QString("0x%1")
|
||||
.arg(raw, 8, 16, QLatin1Char('0'))
|
||||
.toUpper();
|
||||
|
||||
qDebug() << QString("[%1] Parsed %2 ptr %3 (%4)").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(GetName()).arg(mPtr).arg(hexPtr);
|
||||
}
|
||||
|
||||
if (aDataFlag && mPtr == -1)
|
||||
{
|
||||
@ -78,6 +105,10 @@ void XAsset::ParsePtr(QDataStream *aStream, bool aDataFlag) {
|
||||
|
||||
XAsset* XAsset::Create(XAssetType aAssetType)
|
||||
{
|
||||
if (mDebug)
|
||||
{
|
||||
qDebug() << QString("Creating XAsset with type %1").arg(XAssetTypeToString(aAssetType));
|
||||
}
|
||||
switch (aAssetType)
|
||||
{
|
||||
case ASSET_TYPE_XANIMPARTS:
|
||||
@ -417,6 +448,8 @@ QString XAsset::XAssetTypeToString(XAssetType type) {
|
||||
case ASSET_TYPE_CG_MEDIA_TABLE:
|
||||
return "CgMediaTable";
|
||||
default:
|
||||
return "";
|
||||
return "UnknownAsset";
|
||||
}
|
||||
}
|
||||
|
||||
bool XAsset::mDebug = true;
|
||||
|
||||
@ -5,6 +5,8 @@
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QString>
|
||||
#include <QDebug>
|
||||
#include <QIODevice>
|
||||
|
||||
class XAsset
|
||||
{
|
||||
@ -21,6 +23,9 @@ public:
|
||||
void SetName(QString aName);
|
||||
QString GetName() const;
|
||||
|
||||
static void SetDebug(bool aDebug);
|
||||
bool IsDebug() const;
|
||||
|
||||
virtual void Clear();
|
||||
virtual void ParsePtr(QDataStream *aStream, bool aDataFlag = true);
|
||||
virtual void ParseData(QDataStream *aStream) = 0;
|
||||
@ -28,6 +33,8 @@ public:
|
||||
static XAsset* Create(XAssetType aAssetType);
|
||||
static QString XAssetTypeToString(XAssetType type);
|
||||
|
||||
static bool mDebug;
|
||||
|
||||
private:
|
||||
qint32 mPtr;
|
||||
XAssetType mType;
|
||||
|
||||
@ -20,6 +20,8 @@ XAssetList::XAssetList(ZoneFile* aZoneFile)
|
||||
, mAssetHeaders()
|
||||
, mZoneFile(aZoneFile)
|
||||
{
|
||||
SetType(ASSET_TYPE_ASSETLIST);
|
||||
SetName("Asset List");
|
||||
}
|
||||
|
||||
XAssetList::~XAssetList()
|
||||
@ -29,7 +31,10 @@ XAssetList::~XAssetList()
|
||||
|
||||
void XAssetList::ParseData(QDataStream *aStream) {
|
||||
// Parse string list
|
||||
qDebug() << aStream->device()->pos();
|
||||
if (IsDebug())
|
||||
{
|
||||
qDebug() << QString("[%1] Parsing data for %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(GetName());
|
||||
}
|
||||
mStringList.ParsePtr(aStream);
|
||||
|
||||
// Parse asset count and assets
|
||||
@ -37,6 +42,11 @@ void XAssetList::ParseData(QDataStream *aStream) {
|
||||
*aStream
|
||||
>> mAssetCount
|
||||
>> assetsPtr;
|
||||
if (IsDebug())
|
||||
{
|
||||
qDebug() << QString("[%1] mAssetCount = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mAssetCount);
|
||||
qDebug() << QString("[%1] assetsPtr = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(assetsPtr);
|
||||
}
|
||||
|
||||
mStringList.ParseData(aStream);
|
||||
|
||||
|
||||
@ -1,21 +1,53 @@
|
||||
#include "xsoundfile.h"
|
||||
#include "xaudiopacketaligned.h"
|
||||
|
||||
XSoundFile::XSoundFile()
|
||||
XAudioPacketAligned::XAudioPacketAligned()
|
||||
: XAsset()
|
||||
, mBuffer()
|
||||
, mBufferSize(0)
|
||||
, mLoopCount(0)
|
||||
, aXmaLoop()
|
||||
, mContext()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
XSoundFile::~XSoundFile()
|
||||
XAudioPacketAligned::~XAudioPacketAligned()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void XSoundFile::ParseData(QDataStream *aStream)
|
||||
void XAudioPacketAligned::ParseData(QDataStream *aStream)
|
||||
{
|
||||
qint32 bufferPtr, contextPtr;
|
||||
|
||||
*aStream
|
||||
>> bufferPtr
|
||||
>> mBufferSize
|
||||
>> mLoopCount;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
XAudioXmaLoopRegion loop;
|
||||
loop.ParseData(aStream);
|
||||
}
|
||||
|
||||
*aStream >> contextPtr;
|
||||
|
||||
if (bufferPtr)
|
||||
{
|
||||
aStream->readRawData(mBuffer.data(), mBufferSize);
|
||||
}
|
||||
if (contextPtr)
|
||||
{
|
||||
*aStream >> mContext;
|
||||
}
|
||||
}
|
||||
|
||||
void XSoundFile::Clear()
|
||||
void XAudioPacketAligned::Clear()
|
||||
{
|
||||
|
||||
mBuffer.clear();
|
||||
mBufferSize = 0;
|
||||
mLoopCount = 0;
|
||||
aXmaLoop.clear();
|
||||
mContext = '\0';
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ private:
|
||||
quint32 mBufferSize;
|
||||
quint32 mLoopCount;
|
||||
QVector<XAudioXmaLoopRegion> aXmaLoop;
|
||||
char* mContext;
|
||||
char mContext;
|
||||
};
|
||||
|
||||
#endif // XAUDIOPACKETALIGNED_H
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
#include "xaudioseektable.h"
|
||||
|
||||
XAudioSeekTable::XAudioSeekTable()
|
||||
: XAsset()
|
||||
, mSize(0)
|
||||
, mData()
|
||||
{
|
||||
|
||||
}
|
||||
@ -12,10 +15,19 @@ XAudioSeekTable::~XAudioSeekTable()
|
||||
|
||||
void XAudioSeekTable::ParseData(QDataStream *aStream)
|
||||
{
|
||||
qint32 dataPtr;
|
||||
*aStream
|
||||
>> mSize
|
||||
>> dataPtr;
|
||||
|
||||
if (dataPtr)
|
||||
{
|
||||
aStream->readRawData(mData.data(), 4 * mSize);
|
||||
}
|
||||
}
|
||||
|
||||
void XAudioSeekTable::Clear()
|
||||
{
|
||||
|
||||
mSize = 0;
|
||||
mData.clear();
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ public:
|
||||
virtual void Clear() override;
|
||||
|
||||
private:
|
||||
int mSize;
|
||||
quint32 mSize;
|
||||
QByteArray mData;
|
||||
};
|
||||
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
#include "xaudiosound.h"
|
||||
|
||||
XAudioSound::XAudioSound()
|
||||
: XAsset()
|
||||
, mPacket()
|
||||
, mFormat()
|
||||
, mXmaDataInfo()
|
||||
, mSeekTable()
|
||||
{
|
||||
|
||||
}
|
||||
@ -12,10 +17,16 @@ XAudioSound::~XAudioSound()
|
||||
|
||||
void XAudioSound::ParseData(QDataStream *aStream)
|
||||
{
|
||||
|
||||
mPacket.ParseData(aStream);
|
||||
mFormat.ParseData(aStream);
|
||||
mXmaDataInfo.ParseData(aStream);
|
||||
mSeekTable.ParseData(aStream);
|
||||
}
|
||||
|
||||
void XAudioSound::Clear()
|
||||
{
|
||||
|
||||
mPacket.Clear();
|
||||
mFormat.Clear();
|
||||
mXmaDataInfo.Clear();
|
||||
mSeekTable.Clear();
|
||||
}
|
||||
|
||||
@ -17,10 +17,10 @@ public:
|
||||
virtual void Clear() override;
|
||||
|
||||
private:
|
||||
XAudioPacketAligned* mPacket;
|
||||
XAudioSourceFormat* mFormat;
|
||||
XAudioXmaDataInfo* mXmaDataInfo;
|
||||
XAudioSeekTable *mSeekTable;
|
||||
XAudioPacketAligned mPacket;
|
||||
XAudioSourceFormat mFormat;
|
||||
XAudioXmaDataInfo mXmaDataInfo;
|
||||
XAudioSeekTable mSeekTable;
|
||||
};
|
||||
|
||||
#endif // XAUDIOSOUND_H
|
||||
|
||||
@ -13,7 +13,7 @@ public:
|
||||
virtual void Clear() override;
|
||||
|
||||
private:
|
||||
unsigned int mSampleRate;
|
||||
quint32 mSampleRate;
|
||||
quint8 mChannelCount;
|
||||
quint8 mDecodeBufferSize;
|
||||
};
|
||||
|
||||
@ -13,8 +13,8 @@ public:
|
||||
virtual void Clear() override;
|
||||
|
||||
private:
|
||||
unsigned int mLoopStart;
|
||||
unsigned int mLoopEnd;
|
||||
quint32 mLoopStart;
|
||||
quint32 mLoopEnd;
|
||||
quint8 mLoopSubframeEnd;
|
||||
quint8 mLoopSubframeSkip;
|
||||
};
|
||||
|
||||
@ -15,7 +15,7 @@ public:
|
||||
virtual void Clear() override;
|
||||
|
||||
private:
|
||||
quint16 mSurfId;
|
||||
quint32 mSurfId;
|
||||
};
|
||||
|
||||
#endif // XBMODELDRAWINFO_H
|
||||
|
||||
@ -19,7 +19,7 @@ private:
|
||||
QVector3D mMins;
|
||||
int mContents;
|
||||
QVector3D mMaxs;
|
||||
unsigned int mNumSides;
|
||||
quint32 mNumSides;
|
||||
QVector<XCBrushSide> mSides;
|
||||
QVector<QVector3D> mAxialMaterialNum;
|
||||
quint8 *mBaseAdjacentSide;
|
||||
|
||||
@ -12,6 +12,11 @@ XCardMemory::~XCardMemory()
|
||||
|
||||
}
|
||||
|
||||
quint32 XCardMemory::GetPlatform() const
|
||||
{
|
||||
return mPlatform;
|
||||
}
|
||||
|
||||
void XCardMemory::ParseData(QDataStream *aStream)
|
||||
{
|
||||
*aStream >> mPlatform;
|
||||
|
||||
@ -9,11 +9,13 @@ public:
|
||||
XCardMemory();
|
||||
~XCardMemory();
|
||||
|
||||
quint32 GetPlatform() const;
|
||||
|
||||
virtual void ParseData(QDataStream* aStream) override;
|
||||
virtual void Clear() override;
|
||||
|
||||
private:
|
||||
int mPlatform;
|
||||
quint32 mPlatform;
|
||||
};
|
||||
|
||||
#endif // XCARDMEMORY_H
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
|
||||
XCBrushSide::XCBrushSide()
|
||||
: XAsset()
|
||||
, mPlanePtr(0)
|
||||
, mPlane()
|
||||
, mMaterialNum(0)
|
||||
, mFirstAdjacentSideOffset(0)
|
||||
@ -18,13 +17,24 @@ XCBrushSide::~XCBrushSide()
|
||||
|
||||
void XCBrushSide::ParseData(QDataStream *aStream)
|
||||
{
|
||||
mPlane.ParsePtr(aStream, false);
|
||||
|
||||
*aStream
|
||||
>> mMaterialNum
|
||||
>> mFirstAdjacentSideOffset
|
||||
>> mEdgeCount;
|
||||
|
||||
aStream->skipRawData(1);
|
||||
|
||||
if (mPlane.GetPtr() == -1)
|
||||
{
|
||||
mPlane.ParseData(aStream);
|
||||
}
|
||||
}
|
||||
|
||||
void XCBrushSide::Clear()
|
||||
{
|
||||
mPlanePtr = 0;
|
||||
mPlane = XCPlane();
|
||||
mPlane.Clear();
|
||||
mMaterialNum = 0;
|
||||
mFirstAdjacentSideOffset = 0;
|
||||
mEdgeCount = 0;
|
||||
|
||||
@ -14,7 +14,6 @@ public:
|
||||
virtual void Clear() override;
|
||||
|
||||
private:
|
||||
qint32 mPlanePtr;
|
||||
XCPlane mPlane;
|
||||
uint mMaterialNum;
|
||||
qint16 mFirstAdjacentSideOffset;
|
||||
|
||||
@ -28,22 +28,24 @@ void XCLeaf::ParseData(QDataStream *aStream) {
|
||||
>> mMaxs[2]
|
||||
>> mLeafBrushNode
|
||||
>> mCluster;
|
||||
|
||||
aStream->skipRawData(2);
|
||||
}
|
||||
}
|
||||
|
||||
quint16 XCLeaf::GetFirstCollAabbIndex() const {
|
||||
quint32 XCLeaf::GetFirstCollAabbIndex() const {
|
||||
return mFirstCollAabbIndex;
|
||||
}
|
||||
|
||||
void XCLeaf::SetFirstCollAabbIndex(quint16 index) {
|
||||
void XCLeaf::SetFirstCollAabbIndex(quint32 index) {
|
||||
mFirstCollAabbIndex = index;
|
||||
}
|
||||
|
||||
quint16 XCLeaf::GetCollAabbCount() const {
|
||||
quint32 XCLeaf::GetCollAabbCount() const {
|
||||
return mCollAabbCount;
|
||||
}
|
||||
|
||||
void XCLeaf::SetCollAabbCount(quint16 count) {
|
||||
void XCLeaf::SetCollAabbCount(quint32 count) {
|
||||
mCollAabbCount = count;
|
||||
}
|
||||
|
||||
|
||||
@ -12,11 +12,11 @@ public:
|
||||
|
||||
void ParseData(QDataStream *aStream) override;
|
||||
|
||||
quint16 GetFirstCollAabbIndex() const;
|
||||
void SetFirstCollAabbIndex(quint16 index);
|
||||
quint32 GetFirstCollAabbIndex() const;
|
||||
void SetFirstCollAabbIndex(quint32 index);
|
||||
|
||||
quint16 GetCollAabbCount() const;
|
||||
void SetCollAabbCount(quint16 count);
|
||||
quint32 GetCollAabbCount() const;
|
||||
void SetCollAabbCount(quint32 count);
|
||||
|
||||
int GetBrushContents() const;
|
||||
void SetBrushContents(int contents);
|
||||
@ -37,8 +37,8 @@ public:
|
||||
void SetCluster(qint16 cluster);
|
||||
|
||||
private:
|
||||
quint16 mFirstCollAabbIndex;
|
||||
quint16 mCollAabbCount;
|
||||
quint32 mFirstCollAabbIndex;
|
||||
quint32 mCollAabbCount;
|
||||
int mBrushContents;
|
||||
int mTerrainContents;
|
||||
QVector<float> mMins;
|
||||
|
||||
@ -27,5 +27,5 @@ void XCLeafBrushNodeChildren::Clear()
|
||||
{
|
||||
mDist = 0.0f;
|
||||
mRange = 0.0f;
|
||||
mChildOffset = QVector<quint16>();
|
||||
mChildOffset = QVector<quint32>();
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ public:
|
||||
private:
|
||||
float mDist;
|
||||
float mRange;
|
||||
QVector<quint16> mChildOffset;
|
||||
QVector<quint32> mChildOffset;
|
||||
};
|
||||
|
||||
#endif // XCLEAFBRUSHNODECHILDREN_H
|
||||
|
||||
@ -13,7 +13,7 @@ public:
|
||||
void Clear() override;
|
||||
|
||||
private:
|
||||
QVector<quint16> mBrushes;
|
||||
QVector<quint32> mBrushes;
|
||||
};
|
||||
|
||||
#endif // XCLEAFBRUSHNODELEAF_H
|
||||
|
||||
@ -1,7 +1,58 @@
|
||||
#include "xclipmap.h"
|
||||
|
||||
XClipMap::XClipMap()
|
||||
: XAsset() {
|
||||
: XAsset()
|
||||
, mName()
|
||||
, mIsInUse(false)
|
||||
, mPlaneCount(0)
|
||||
, mPlanes()
|
||||
, mNumStaticModels(0)
|
||||
, mStaticModelList()
|
||||
, mNumMaterials(0)
|
||||
, mMaterials()
|
||||
, mNumBrushSides(0)
|
||||
, mBrushsides()
|
||||
, mNumBrushEdges(0)
|
||||
, mBrushEdges()
|
||||
, mNumNodes(0)
|
||||
, mNodes()
|
||||
, mNumLeafs(0)
|
||||
, mLeafs()
|
||||
, mLeafBrushNodesCount(0)
|
||||
, mLeafBrushNodes()
|
||||
, mNumLeafBrushes(0)
|
||||
, mLeafBrushes()
|
||||
, mNumLeafSurfaces(0)
|
||||
, mLeafSurfaces()
|
||||
, mVertCount(0)
|
||||
, mVerts()
|
||||
, mTriCount(0)
|
||||
, mTriIndices()
|
||||
, mTriEdgeIsWalkable()
|
||||
, mBorderCount(0)
|
||||
, mBorders()
|
||||
, mPartitionCount(0)
|
||||
, mPartitions()
|
||||
, mAabbTreeCount(0)
|
||||
, mAabbTrees()
|
||||
, mNumSubModels(0)
|
||||
, mCModels()
|
||||
, mNumBrushes(0)
|
||||
, mBrushes()
|
||||
, mNumClusters(0)
|
||||
, mClusterBytes(0)
|
||||
, mVisibility()
|
||||
, mVised(0)
|
||||
, mMapEnts()
|
||||
, mBoxBrush()
|
||||
, mBoxModel()
|
||||
, mDynEntCounts(0)
|
||||
, mDynEntDefList(2)
|
||||
, mDynEntPoseList(2)
|
||||
, mDynEntClientList(2)
|
||||
, mDynEntCollList(2)
|
||||
, mChecksum(0)
|
||||
{
|
||||
SetType(ASSET_TYPE_CLIPMAP);
|
||||
SetName("ClipMap");
|
||||
}
|
||||
@ -11,12 +62,201 @@ XClipMap::~XClipMap()
|
||||
|
||||
}
|
||||
|
||||
void XClipMap::ParseData(QDataStream *aStream) {
|
||||
mName = XString::ParseCustom(aStream);
|
||||
void XClipMap::ParseData(QDataStream *aStream)
|
||||
{
|
||||
if (GetPtr() == -1)
|
||||
{
|
||||
mName.ParsePtr(aStream, false);
|
||||
|
||||
qint32 planePtr, staticModelPtr, materialsPtr, brushSidesPtr,
|
||||
brushEdgesPtr, nodesPtr, leafsPtr, leafsBrushNodesPtr,
|
||||
leafBrushesPtr, leafSurfacesPtr, vertPtr1, vertPtr2, vertPtr3,
|
||||
triIndicesPtr, triEdgeWalkablePtr, bordersPtr, partitionsPtr, aabbTreesPtr,
|
||||
cModelsPtr;
|
||||
*aStream
|
||||
>> mIsInUse
|
||||
>> mPlaneCount
|
||||
>> planePtr
|
||||
>> mNumStaticModels
|
||||
>> staticModelPtr
|
||||
>> mNumMaterials
|
||||
>> materialsPtr
|
||||
>> mNumBrushSides
|
||||
>> brushSidesPtr
|
||||
>> mNumBrushEdges
|
||||
>> brushEdgesPtr
|
||||
>> mNumNodes
|
||||
>> nodesPtr
|
||||
>> mNumLeafs
|
||||
>> leafsPtr
|
||||
>> mLeafBrushNodesCount
|
||||
>> leafsBrushNodesPtr
|
||||
>> mNumLeafBrushes
|
||||
>> leafBrushesPtr
|
||||
>> mNumLeafSurfaces
|
||||
>> leafSurfacesPtr
|
||||
>> mVertCount
|
||||
>> vertPtr1
|
||||
>> vertPtr2
|
||||
>> vertPtr3
|
||||
>> mTriCount
|
||||
>> triIndicesPtr
|
||||
>> triEdgeWalkablePtr
|
||||
>> mBorderCount
|
||||
>> bordersPtr
|
||||
>> mPartitionCount
|
||||
>> partitionsPtr
|
||||
>> mAabbTreeCount
|
||||
>> aabbTreesPtr
|
||||
>> mNumSubModels
|
||||
>> cModelsPtr
|
||||
>> mNumBrushes;
|
||||
|
||||
aStream->skipRawData(2);
|
||||
|
||||
qint32 brushesPtr, visibilityPtr, mapEntsPtr, boxBrushPtr;
|
||||
*aStream
|
||||
>> brushesPtr
|
||||
>> mNumClusters
|
||||
>> mClusterBytes
|
||||
>> visibilityPtr
|
||||
>> mVised
|
||||
>> mapEntsPtr
|
||||
>> boxBrushPtr;
|
||||
|
||||
mBoxModel.ParseData(aStream);
|
||||
|
||||
quint16 dynEntCount;
|
||||
*aStream >> dynEntCount;
|
||||
mDynEntCounts.append(dynEntCount);
|
||||
*aStream >> dynEntCount;
|
||||
mDynEntCounts.append(dynEntCount);
|
||||
|
||||
mDynEntDefList[0].ParsePtr(aStream, false);
|
||||
mDynEntDefList[0].ParsePtr(aStream, false);
|
||||
|
||||
mDynEntPoseList[0].ParsePtr(aStream, false);
|
||||
mDynEntPoseList[0].ParsePtr(aStream, false);
|
||||
|
||||
mDynEntClientList[0].ParsePtr(aStream, false);
|
||||
mDynEntClientList[0].ParsePtr(aStream, false);
|
||||
|
||||
mDynEntCollList[0].ParsePtr(aStream, false);
|
||||
mDynEntCollList[0].ParsePtr(aStream, false);
|
||||
|
||||
*aStream >> mChecksum;
|
||||
|
||||
// We would parse arrays here, but we're using placeholders
|
||||
if (planePtr)
|
||||
{
|
||||
for (int i = 0; i < mPlaneCount; i++)
|
||||
{
|
||||
XCPlane newCPlane;
|
||||
newCPlane.ParseData(aStream);
|
||||
mPlanes.append(newCPlane);
|
||||
}
|
||||
}
|
||||
|
||||
if (staticModelPtr)
|
||||
{
|
||||
for (int i = 0; i < mNumStaticModels; i++)
|
||||
{
|
||||
XCStaticModel newModel;
|
||||
newModel.ParseData(aStream);
|
||||
mStaticModelList.append(newModel);
|
||||
}
|
||||
}
|
||||
|
||||
if (materialsPtr)
|
||||
{
|
||||
for (int i = 0; i < mNumMaterials; i++)
|
||||
{
|
||||
XDMaterial newDMaterial;
|
||||
newDMaterial.ParseData(aStream);
|
||||
mMaterials.append(newDMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
if (brushSidesPtr)
|
||||
{
|
||||
for (int i = 0; i < mNumBrushSides; i++)
|
||||
{
|
||||
XCBrushSide newBrushSide;
|
||||
newBrushSide.ParseData(aStream);
|
||||
mBrushsides.append(newBrushSide);
|
||||
}
|
||||
}
|
||||
|
||||
if (brushEdgesPtr)
|
||||
{
|
||||
for (int i = 0; i < mNumBrushEdges; i++)
|
||||
{
|
||||
quint8 newBrushEdge;
|
||||
*aStream >> newBrushEdge;
|
||||
mBrushEdges.append(newBrushEdge);
|
||||
}
|
||||
}
|
||||
|
||||
if (nodesPtr)
|
||||
{
|
||||
for (int i = 0; i < mNumNodes; i++)
|
||||
{
|
||||
XCNode newNode;
|
||||
newNode.ParseData(aStream);
|
||||
mNodes.append(newNode);
|
||||
}
|
||||
}
|
||||
|
||||
if (leafsPtr)
|
||||
{
|
||||
for (int i = 0; i < mNumLeafs; i++)
|
||||
{
|
||||
XCLeaf newLeaf;
|
||||
newLeaf.ParseData(aStream);
|
||||
mLeafs.append(newLeaf);
|
||||
}
|
||||
}
|
||||
|
||||
if (leafBrushesPtr)
|
||||
{
|
||||
for (int i = 0; i < mNumLeafBrushes; i++)
|
||||
{
|
||||
quint32 newBrush;
|
||||
*aStream >> newBrush;
|
||||
mLeafBrushes.append(newBrush);
|
||||
}
|
||||
}
|
||||
|
||||
if (leafsBrushNodesPtr)
|
||||
{
|
||||
for (int i = 0; i < mNumLeafBrushes; i++)
|
||||
{
|
||||
XCLeafBrushNode newBrushNode;
|
||||
newBrushNode.ParseData(aStream);
|
||||
mLeafBrushNodes.append(newBrushNode);
|
||||
}
|
||||
}
|
||||
|
||||
mLeafbrushNodes()
|
||||
mLeafsurfaces()
|
||||
mVerts()
|
||||
mTriIndices()
|
||||
mTriEdgeIsWalkable()
|
||||
mBorders()
|
||||
mPartitions()
|
||||
mAabbTrees()
|
||||
mCodels()
|
||||
mBrushes()
|
||||
mVisibility()
|
||||
mMapEnts()
|
||||
mBoxBrush()
|
||||
mBoxModel()
|
||||
mDynEntCount(0)
|
||||
mDynEntDefList()
|
||||
mDynEntPoseList()
|
||||
mDynEntClientList()
|
||||
mDynEntCollList()
|
||||
(0)
|
||||
}
|
||||
}
|
||||
|
||||
void XClipMap::Clear()
|
||||
|
||||
@ -29,45 +29,45 @@ public:
|
||||
void Clear() override;
|
||||
|
||||
private:
|
||||
QString mName;
|
||||
XString mName;
|
||||
|
||||
bool mIsInUse;
|
||||
quint32 mIsInUse;
|
||||
|
||||
int mPlaneCount;
|
||||
QVector<XCPlane> mPlanes;
|
||||
|
||||
uint mNumStaticModels;
|
||||
quint32 mNumStaticModels;
|
||||
QVector<XCStaticModel> mStaticModelList;
|
||||
|
||||
uint mNumMaterials;
|
||||
quint32 mNumMaterials;
|
||||
QVector<XDMaterial> mMaterials;
|
||||
|
||||
uint mNumBrushSides;
|
||||
quint32 mNumBrushSides;
|
||||
QVector<XCBrushSide> mBrushsides;
|
||||
|
||||
uint mNumBrushEdges;
|
||||
quint32 mNumBrushEdges;
|
||||
QVector<quint8> mBrushEdges;
|
||||
|
||||
uint mNumNodes;
|
||||
quint32 mNumNodes;
|
||||
QVector<XCNode> mNodes;
|
||||
|
||||
uint mNumLeafs;
|
||||
quint32 mNumLeafs;
|
||||
QVector<XCLeaf> mLeafs;
|
||||
|
||||
uint mLeafbrushNodesCount;
|
||||
QVector<XCLeafBrushNode> mLeafbrushNodes;
|
||||
quint32 mLeafBrushNodesCount;
|
||||
QVector<XCLeafBrushNode> mLeafBrushNodes;
|
||||
|
||||
uint mNumLeafBrushes;
|
||||
QVector<quint16> mLeafbrushes;
|
||||
quint32 mNumLeafBrushes;
|
||||
QVector<quint32> mLeafBrushes;
|
||||
|
||||
uint mNumLeafSurfaces;
|
||||
QVector<uint> mLeafsurfaces;
|
||||
quint32 mNumLeafSurfaces;
|
||||
QVector<uint> mLeafSurfaces;
|
||||
|
||||
uint mVertCount;
|
||||
quint32 mVertCount;
|
||||
QVector<float> mVerts;
|
||||
|
||||
int mTriCount;
|
||||
QVector<quint16> mTriIndices;
|
||||
QVector<quint32> mTriIndices;
|
||||
QVector<quint8> mTriEdgeIsWalkable;
|
||||
|
||||
int mBorderCount;
|
||||
@ -80,9 +80,9 @@ private:
|
||||
QVector<XCollisionAabbTree> mAabbTrees;
|
||||
|
||||
uint mNumSubModels;
|
||||
QVector<XCModel> mCodels;
|
||||
QVector<XCModel> mCModels;
|
||||
|
||||
quint16 mNumBrushes;
|
||||
quint32 mNumBrushes;
|
||||
QVector<XCBrush> mBrushes;
|
||||
|
||||
int mNumClusters;
|
||||
@ -92,14 +92,14 @@ private:
|
||||
QVector<quint8> mVisibility;
|
||||
int mVised;
|
||||
QVector<XMapEnts> mMapEnts;
|
||||
XCBrush *mBoxBrush;
|
||||
XCBrush mBoxBrush;
|
||||
XCModel mBoxModel;
|
||||
quint16 mDynEntCount[2];
|
||||
XDynEntityDef *mDynEntDefList[2];
|
||||
XDynEntityPose *mDynEntPoseList[2];
|
||||
XDynEntityClient *mDynEntClientList[2];
|
||||
XDynEntityColl *mDynEntCollList[2];
|
||||
uint mChecksum;
|
||||
QVector<quint32> mDynEntCounts;
|
||||
QVector<XDynEntityDef> mDynEntDefList;
|
||||
QVector<XDynEntityPose> mDynEntPoseList;
|
||||
QVector<XDynEntityClient> mDynEntClientList;
|
||||
QVector<XDynEntityColl> mDynEntCollList;
|
||||
quint32 mChecksum;
|
||||
};
|
||||
|
||||
#endif // XCLIPMAP_H
|
||||
|
||||
@ -2,31 +2,32 @@
|
||||
|
||||
XCNode::XCNode()
|
||||
: XAsset()
|
||||
, mPlane(new XCPlane())
|
||||
, mPlane()
|
||||
, mChildren()
|
||||
{
|
||||
}
|
||||
|
||||
XCNode::~XCNode()
|
||||
{
|
||||
delete mPlane;
|
||||
|
||||
}
|
||||
|
||||
void XCNode::ParseData(QDataStream *aStream) {
|
||||
if (GetPtr() == -1) {
|
||||
// We would parse plane here, but we're using a placeholder
|
||||
mPlane->ParseData(aStream);
|
||||
mPlane.ParsePtr(aStream);
|
||||
|
||||
// Parse children
|
||||
*aStream
|
||||
>> mChildren[0]
|
||||
>> mChildren[1];
|
||||
|
||||
mPlane.ParseData(aStream);
|
||||
}
|
||||
}
|
||||
|
||||
void XCNode::Clear()
|
||||
{
|
||||
mPlane->Clear();
|
||||
mPlane.Clear();
|
||||
mChildren.clear();
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ public:
|
||||
void Clear() override;
|
||||
|
||||
private:
|
||||
XCPlane* mPlane;
|
||||
XCPlane mPlane;
|
||||
QVector<qint16> mChildren;
|
||||
};
|
||||
|
||||
|
||||
@ -48,19 +48,19 @@ void XCollisionAabbTree::SetHalfSize(QVector3D aHalfSize) {
|
||||
mHalfSize = aHalfSize;
|
||||
}
|
||||
|
||||
quint16 XCollisionAabbTree::GetMaterialIndex() const {
|
||||
quint32 XCollisionAabbTree::GetMaterialIndex() const {
|
||||
return mMaterialIndex;
|
||||
}
|
||||
|
||||
void XCollisionAabbTree::SetMaterialIndex(quint16 aIndex) {
|
||||
void XCollisionAabbTree::SetMaterialIndex(quint32 aIndex) {
|
||||
mMaterialIndex = aIndex;
|
||||
}
|
||||
|
||||
quint16 XCollisionAabbTree::GetChildCount() const {
|
||||
quint32 XCollisionAabbTree::GetChildCount() const {
|
||||
return mChildCount;
|
||||
}
|
||||
|
||||
void XCollisionAabbTree::SetChildCount(quint16 count) {
|
||||
void XCollisionAabbTree::SetChildCount(quint32 count) {
|
||||
mChildCount = count;
|
||||
}
|
||||
|
||||
|
||||
@ -20,11 +20,11 @@ public:
|
||||
QVector3D GetHalfSize() const;
|
||||
void SetHalfSize(QVector3D aHalfSize);
|
||||
|
||||
quint16 GetMaterialIndex() const;
|
||||
void SetMaterialIndex(quint16 aIndex);
|
||||
quint32 GetMaterialIndex() const;
|
||||
void SetMaterialIndex(quint32 aIndex);
|
||||
|
||||
quint16 GetChildCount() const;
|
||||
void SetChildCount(quint16 aCount);
|
||||
quint32 GetChildCount() const;
|
||||
void SetChildCount(quint32 aCount);
|
||||
|
||||
XCollisionAabbTreeIndex& GetTreeIndex();
|
||||
void SetTreeIndex(const XCollisionAabbTreeIndex& aTreeIndex);
|
||||
@ -32,8 +32,8 @@ public:
|
||||
private:
|
||||
QVector3D mOrigin;
|
||||
QVector3D mHalfSize;
|
||||
quint16 mMaterialIndex = 0;
|
||||
quint16 mChildCount = 0;
|
||||
quint32 mMaterialIndex = 0;
|
||||
quint32 mChildCount = 0;
|
||||
XCollisionAabbTreeIndex mTreeIndex;
|
||||
};
|
||||
|
||||
|
||||
@ -18,7 +18,18 @@ XCPlane::~XCPlane()
|
||||
|
||||
void XCPlane::ParseData(QDataStream *aStream)
|
||||
{
|
||||
|
||||
if (GetPtr() == -1)
|
||||
{
|
||||
*aStream
|
||||
>> mNormal[0]
|
||||
>> mNormal[1]
|
||||
>> mNormal[2]
|
||||
>> mDist
|
||||
>> mType
|
||||
>> mSignbits
|
||||
>> mPad[0]
|
||||
>> mPad[1];
|
||||
}
|
||||
}
|
||||
|
||||
void XCPlane::Clear()
|
||||
|
||||
@ -16,9 +16,11 @@ void XCStaticModel::ParseData(QDataStream *aStream) {
|
||||
// Parse writable
|
||||
mWritable.ParseData(aStream);
|
||||
|
||||
// We would parse xmodel here, but we're using a placeholder
|
||||
aStream->skipRawData(2);
|
||||
|
||||
qint32 xModelPtr;
|
||||
*aStream
|
||||
>> xModelPtr
|
||||
>> mOrigin[0]
|
||||
>> mOrigin[1]
|
||||
>> mOrigin[2];
|
||||
|
||||
@ -16,7 +16,7 @@ public:
|
||||
|
||||
private:
|
||||
XCStaticModelWritable mWritable;
|
||||
const XModel* mModel;
|
||||
XModel mModel;
|
||||
QVector3D mOrigin;
|
||||
QVector<QVector3D> mInvScaledAxis;
|
||||
QVector3D mAbsmin;
|
||||
|
||||
@ -17,11 +17,11 @@ void XCStaticModelWritable::ParseData(QDataStream *aStream) {
|
||||
}
|
||||
}
|
||||
|
||||
quint16 XCStaticModelWritable::GetNextModelInWorldSector() const {
|
||||
quint32 XCStaticModelWritable::GetNextModelInWorldSector() const {
|
||||
return mNextModelInWorldSector;
|
||||
}
|
||||
|
||||
void XCStaticModelWritable::SetNextModelInWorldSector(quint16 nextModel) {
|
||||
void XCStaticModelWritable::SetNextModelInWorldSector(quint32 nextModel) {
|
||||
mNextModelInWorldSector = nextModel;
|
||||
}
|
||||
|
||||
|
||||
@ -11,11 +11,11 @@ public:
|
||||
|
||||
void ParseData(QDataStream *aStream) override;
|
||||
|
||||
quint16 GetNextModelInWorldSector() const;
|
||||
void SetNextModelInWorldSector(quint16 nextModel);
|
||||
quint32 GetNextModelInWorldSector() const;
|
||||
void SetNextModelInWorldSector(quint32 nextModel);
|
||||
|
||||
private:
|
||||
quint16 mNextModelInWorldSector;
|
||||
quint32 mNextModelInWorldSector;
|
||||
};
|
||||
|
||||
#endif // XCSTATICMODELWRITABLE_H
|
||||
|
||||
@ -15,7 +15,7 @@ public:
|
||||
virtual void Clear() override;
|
||||
|
||||
private:
|
||||
unsigned int mMipFlush;
|
||||
quint32 mMipFlush;
|
||||
XGpuTextureFetchConstant mFormat;
|
||||
XD3DResource mResource;
|
||||
};
|
||||
|
||||
@ -13,12 +13,12 @@ public:
|
||||
virtual void Clear() override;
|
||||
|
||||
private:
|
||||
unsigned int mCommon;
|
||||
unsigned int mReferenceCount;
|
||||
unsigned int mFence;
|
||||
unsigned int mReadFence;
|
||||
unsigned int mIdentifier;
|
||||
unsigned int mBaseFlush;
|
||||
quint32 mCommon;
|
||||
quint32 mReferenceCount;
|
||||
quint32 mFence;
|
||||
quint32 mReadFence;
|
||||
quint32 mIdentifier;
|
||||
quint32 mBaseFlush;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -14,8 +14,8 @@ public:
|
||||
|
||||
private:
|
||||
int mPhysObjId;
|
||||
quint16 mFlags;
|
||||
quint16 mLightingHandle;
|
||||
quint32 mFlags;
|
||||
quint32 mLightingHandle;
|
||||
int mHealth;
|
||||
};
|
||||
|
||||
|
||||
@ -15,8 +15,8 @@ public:
|
||||
void Clear() override;
|
||||
|
||||
private:
|
||||
quint16 mSector;
|
||||
quint16 mNextEntInSector;
|
||||
quint32 mSector;
|
||||
quint32 mNextEntInSector;
|
||||
QVector<float> mLinkMins;
|
||||
QVector<float> mLinkMaxs;
|
||||
};
|
||||
|
||||
@ -29,8 +29,8 @@ private:
|
||||
XGfxPlacement mPose;
|
||||
qint32 mModelPtr;
|
||||
XModel mModel;
|
||||
quint16 mBrushModel;
|
||||
quint16 mPhysicsBrushModel;
|
||||
quint32 mBrushModel;
|
||||
quint32 mPhysicsBrushModel;
|
||||
qint32 mBestroyFxPtr;
|
||||
XFxEffectDef mDestroyFx;
|
||||
qint32 mDestroyPiecesPtr;
|
||||
|
||||
@ -26,7 +26,7 @@ void XFxTrailDef::Clear()
|
||||
mVertCount = 0;
|
||||
mVerts = QVector<XFxTrailVertex>();
|
||||
mIndCount = 0;
|
||||
mIndices = QVector<quint16>();
|
||||
mIndices = QVector<quint32>();
|
||||
}
|
||||
|
||||
void XFxTrailDef::ParseData(QDataStream *aStream)
|
||||
|
||||
@ -22,7 +22,7 @@ private:
|
||||
int mVertCount;
|
||||
QVector<XFxTrailVertex> mVerts;
|
||||
int mIndCount;
|
||||
QVector<quint16> mIndices;
|
||||
QVector<quint32> mIndices;
|
||||
};
|
||||
|
||||
#endif // XFXTRAILDEF_H
|
||||
|
||||
@ -18,13 +18,13 @@ public:
|
||||
private:
|
||||
QVector3D mMins;
|
||||
QVector3D mMaxs;
|
||||
quint16 mChildCount;
|
||||
quint16 mSurfaceCount;
|
||||
quint16 mStartSurfIndex;
|
||||
quint32 mChildCount;
|
||||
quint32 mSurfaceCount;
|
||||
quint32 mStartSurfIndex;
|
||||
|
||||
quint16 mModelIndexCount;
|
||||
quint32 mModelIndexCount;
|
||||
qint32 mModelIndexesPtr;
|
||||
QVector<quint16> mModelIndexes;
|
||||
QVector<quint32> mModelIndexes;
|
||||
|
||||
int mChildrenOffset;
|
||||
};
|
||||
|
||||
@ -14,7 +14,7 @@ public:
|
||||
void SetColor(quint8 r, quint8 g, quint8 b, quint8 a);
|
||||
|
||||
private:
|
||||
unsigned int mPacked;
|
||||
quint32 mPacked;
|
||||
quint8 mArray[4];
|
||||
};
|
||||
|
||||
|
||||
@ -28,7 +28,44 @@ XGfxImage::~XGfxImage()
|
||||
|
||||
void XGfxImage::ParseData(QDataStream *aStream)
|
||||
{
|
||||
*aStream >> mMapType;
|
||||
|
||||
mTexture.ParseData(aStream);
|
||||
|
||||
*aStream >> mSemantic;
|
||||
|
||||
aStream->skipRawData(3);
|
||||
|
||||
mCardMemory.ParseData(aStream);
|
||||
|
||||
qint32 pixelsPtr;
|
||||
*aStream
|
||||
>> mWidth
|
||||
>> mHeight
|
||||
>> mDepth
|
||||
>> mCategory
|
||||
>> mDelayLoadPixels
|
||||
>> pixelsPtr
|
||||
>> mBaseSize
|
||||
>> mStreamSlot
|
||||
>> mStreaming;
|
||||
|
||||
aStream->skipRawData(1);
|
||||
|
||||
mName.ParsePtr(aStream);
|
||||
|
||||
int variableSkip = 5;
|
||||
if (mDelayLoadPixels)
|
||||
{
|
||||
variableSkip = 2;
|
||||
}
|
||||
aStream->skipRawData(variableSkip);
|
||||
if (pixelsPtr)
|
||||
{
|
||||
aStream->readRawData(mPixels.data(), mCardMemory.GetPlatform());
|
||||
}
|
||||
// TODO: This is wrong
|
||||
mTexture.ParseData(aStream);
|
||||
}
|
||||
|
||||
void XGfxImage::Clear()
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#include "xcardmemory.h"
|
||||
#include "xgfxtexture.h"
|
||||
#include "xmaptype.h"
|
||||
#include "xstring.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
@ -28,11 +29,11 @@ private:
|
||||
quint16 mDepth;
|
||||
quint8 mCategory;
|
||||
bool mDelayLoadPixels;
|
||||
QVector<quint8> mPixels;
|
||||
unsigned int mBaseSize;
|
||||
QByteArray mPixels;
|
||||
quint32 mBaseSize;
|
||||
quint16 mStreamSlot;
|
||||
bool mStreaming;
|
||||
QString mName;
|
||||
XString mName;
|
||||
};
|
||||
|
||||
#endif // XGFXIMAGE_H
|
||||
|
||||
@ -20,17 +20,17 @@ public:
|
||||
|
||||
private:
|
||||
bool mHasLightRegions;
|
||||
unsigned int mSunPrimaryLightIndex;
|
||||
quint32 mSunPrimaryLightIndex;
|
||||
QVector3D mMins;
|
||||
QVector3D mMaxs;
|
||||
unsigned int mRowAxis;
|
||||
unsigned int mColAxis;
|
||||
unsigned __int16 *mRowDataStart;
|
||||
unsigned int mRawRowDataSize;
|
||||
unsigned __int8 *mRawRowData;
|
||||
unsigned int mEntryCount;
|
||||
quint32 mRowAxis;
|
||||
quint32 mColAxis;
|
||||
quint16 *mRowDataStart;
|
||||
quint32 mRawRowDataSize;
|
||||
quint8 *mRawRowData;
|
||||
quint32 mEntryCount;
|
||||
QVector<XGfxLightGridEntry> mEntries;
|
||||
unsigned int mColorCount;
|
||||
quint32 mColorCount;
|
||||
QVector<XGfxLightGridColors> mColors;
|
||||
};
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ public:
|
||||
virtual void Clear() override;
|
||||
virtual void ParseData(QDataStream *aStream) override;
|
||||
|
||||
quint16 colorsIndex;
|
||||
quint32 colorsIndex;
|
||||
quint8 primaryLightIndex;
|
||||
quint8 needsTrace;
|
||||
};
|
||||
|
||||
@ -2,9 +2,7 @@
|
||||
|
||||
XGfxPixelShaderLoadDef::XGfxPixelShaderLoadDef()
|
||||
: XAsset()
|
||||
, mCachedPartPtr(0)
|
||||
, mCachedPart()
|
||||
, mPhysicalPartPtr(0)
|
||||
, mPhysicalPart()
|
||||
, mCachedPartSize(0)
|
||||
, mPhysicalPartSize(0)
|
||||
@ -17,17 +15,39 @@ XGfxPixelShaderLoadDef::~XGfxPixelShaderLoadDef()
|
||||
|
||||
}
|
||||
|
||||
void XGfxPixelShaderLoadDef::ParseData(QDataStream *aStream)
|
||||
quint16 XGfxPixelShaderLoadDef::GetPhysicalPartSize() const
|
||||
{
|
||||
return mPhysicalPartSize;
|
||||
}
|
||||
|
||||
quint16 XGfxPixelShaderLoadDef::GetCachedPartSize() const
|
||||
{
|
||||
return mCachedPartSize;
|
||||
}
|
||||
|
||||
void XGfxPixelShaderLoadDef::Clear()
|
||||
{
|
||||
mCachedPartPtr = 0;
|
||||
mCachedPart.clear();
|
||||
mPhysicalPartPtr = 0;
|
||||
mPhysicalPart.clear();
|
||||
mCachedPartSize = 0;
|
||||
mPhysicalPartSize = 0;
|
||||
}
|
||||
|
||||
void XGfxPixelShaderLoadDef::ParseData(QDataStream *aStream)
|
||||
{
|
||||
qint32 cachedPartPtr, physicalPartPtr;
|
||||
*aStream
|
||||
>> cachedPartPtr
|
||||
>> physicalPartPtr
|
||||
>> mCachedPartSize
|
||||
>> mPhysicalPartSize;
|
||||
|
||||
if (physicalPartPtr)
|
||||
{
|
||||
aStream->readRawData(mPhysicalPart.data(), mPhysicalPartSize);
|
||||
}
|
||||
if (cachedPartPtr)
|
||||
{
|
||||
aStream->readRawData(mCachedPart.data(), mCachedPartSize);
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,14 +11,15 @@ public:
|
||||
explicit XGfxPixelShaderLoadDef();
|
||||
~XGfxPixelShaderLoadDef();
|
||||
|
||||
quint16 GetPhysicalPartSize() const;
|
||||
quint16 GetCachedPartSize() const;
|
||||
|
||||
void ParseData(QDataStream *aStream) override;
|
||||
void Clear() override;
|
||||
|
||||
private:
|
||||
quint16 mCachedPartPtr;
|
||||
QVector<quint8> mCachedPart;
|
||||
quint16 mPhysicalPartPtr;
|
||||
QVector<quint8> mPhysicalPart;
|
||||
QByteArray mCachedPart;
|
||||
QByteArray mPhysicalPart;
|
||||
quint16 mCachedPartSize;
|
||||
quint16 mPhysicalPartSize;
|
||||
};
|
||||
|
||||
@ -17,7 +17,7 @@ public:
|
||||
|
||||
private:
|
||||
XBModelDrawInfo mInfo;
|
||||
quint16 mDynEntId;
|
||||
quint32 mDynEntId;
|
||||
};
|
||||
|
||||
#endif // XGFXSCENEDYNBRUSH_H
|
||||
|
||||
@ -17,7 +17,7 @@ public:
|
||||
|
||||
private:
|
||||
XModelDrawInfo mInfo;
|
||||
quint16 mDynEntId;
|
||||
quint32 mDynEntId;
|
||||
};
|
||||
|
||||
#endif // XGFXSCENEDYNMODEL_H
|
||||
|
||||
@ -15,12 +15,12 @@ public:
|
||||
virtual void Clear() override;
|
||||
|
||||
private:
|
||||
quint16 mSurfaceCount;
|
||||
quint16 mModelCount;
|
||||
quint32 mSurfaceCount;
|
||||
quint32 mModelCount;
|
||||
qint32 mSortedSurfIndexPtr;
|
||||
QVector<quint16> mSortedSurfIndex;
|
||||
QVector<quint32> mSortedSurfIndex;
|
||||
qint32 mModelIndexPtr;
|
||||
QVector<quint16> mModelIndex;
|
||||
QVector<quint32> mModelIndex;
|
||||
};
|
||||
|
||||
#endif // XGFXSHADOWGEOMETRY_H
|
||||
|
||||
@ -22,7 +22,7 @@ private:
|
||||
XModel *mModel;
|
||||
quint8 mReflectionProbeIndex;
|
||||
quint8 mPrimaryLightIndex;
|
||||
quint16 mLightingHandle;
|
||||
quint32 mLightingHandle;
|
||||
quint8 mFlags;
|
||||
};
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ XGfxVertexShaderLoadDef::XGfxVertexShaderLoadDef()
|
||||
, mCachedPartSize(0)
|
||||
, mPhysicalPartSize(0)
|
||||
{
|
||||
|
||||
SetName("Vertex Shader Definition");
|
||||
}
|
||||
|
||||
XGfxVertexShaderLoadDef::~XGfxVertexShaderLoadDef()
|
||||
@ -25,6 +25,10 @@ void XGfxVertexShaderLoadDef::Clear()
|
||||
|
||||
void XGfxVertexShaderLoadDef::ParseData(QDataStream *aStream)
|
||||
{
|
||||
if (IsDebug())
|
||||
{
|
||||
qDebug() << QString("[%1] Parsing data for %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(GetName());
|
||||
}
|
||||
qint32 cachedPartPtr, physicalPartPtr;
|
||||
*aStream
|
||||
>> cachedPartPtr
|
||||
@ -32,12 +36,28 @@ void XGfxVertexShaderLoadDef::ParseData(QDataStream *aStream)
|
||||
>> mCachedPartSize
|
||||
>> mPhysicalPartSize;
|
||||
|
||||
if (IsDebug())
|
||||
{
|
||||
qDebug() << QString("[%1] cachedPartPtr = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(cachedPartPtr);
|
||||
qDebug() << QString("[%1] physicalPartPtr = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(physicalPartPtr);
|
||||
qDebug() << QString("[%1] mCachedPartSize = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mCachedPartSize);
|
||||
qDebug() << QString("[%1] mPerPrimArgCount %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mPhysicalPartSize);
|
||||
}
|
||||
|
||||
if (physicalPartPtr)
|
||||
{
|
||||
aStream->readRawData(mPhysicalPart.data(), mPhysicalPartSize);
|
||||
if (IsDebug())
|
||||
{
|
||||
qDebug() << QString("[%1] mPhysicalPart = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mPhysicalPart);
|
||||
}
|
||||
}
|
||||
if (cachedPartPtr)
|
||||
{
|
||||
aStream->readRawData(mCachedPart.data(), mCachedPartSize);
|
||||
if (IsDebug())
|
||||
{
|
||||
qDebug() << QString("[%1] mCachedPart = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mCachedPart);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ private:
|
||||
qint32 aPlanesPtr;
|
||||
QVector<XCPlane> aPlanes;
|
||||
qint32 aNodesPtr;
|
||||
QVector<quint16> aNodes;
|
||||
QVector<quint32> aNodes;
|
||||
qint32 aSceneEntCellBitsPtr;
|
||||
QVector<uint> aSceneEntCellBits;
|
||||
};
|
||||
|
||||
@ -32,7 +32,7 @@ private:
|
||||
QVector<quint8*> mSmodelVisData;
|
||||
QVector<quint8*> mSurfaceVisData;
|
||||
uint *mLodData;
|
||||
quint16 *mSortedSurfIndex;
|
||||
quint32 *mSortedSurfIndex;
|
||||
QVector<XGfxStaticModelInst> *mModelInsts;
|
||||
QVector<XGfxSurface> *mSurfaces;
|
||||
QVector<XGfxCullGroup> *mCullGroups;
|
||||
|
||||
@ -13,7 +13,7 @@ public:
|
||||
void ParseData(QDataStream *aStream) override;
|
||||
|
||||
private:
|
||||
quint16 mLetter;
|
||||
quint32 mLetter;
|
||||
char mX0;
|
||||
char mY0;
|
||||
quint8 mDx;
|
||||
|
||||
@ -14,7 +14,7 @@ public:
|
||||
|
||||
private:
|
||||
XGpuVertexRawRequest mRequest;
|
||||
unsigned int mDword[2];
|
||||
quint32 mDword[2];
|
||||
};
|
||||
|
||||
#endif // XGPUVERTEXFETCHCONSTANT_H
|
||||
|
||||
@ -15,10 +15,15 @@ XLoadedSound::~XLoadedSound()
|
||||
|
||||
void XLoadedSound::ParseData(QDataStream *aStream)
|
||||
{
|
||||
|
||||
if (GetPtr() == -1)
|
||||
{
|
||||
mName.ParsePtr(aStream, false);
|
||||
mSound.ParseData(aStream);
|
||||
}
|
||||
}
|
||||
|
||||
void XLoadedSound::Clear()
|
||||
{
|
||||
|
||||
mName.Clear();
|
||||
mSound.Clear();
|
||||
}
|
||||
|
||||
@ -15,8 +15,8 @@ public:
|
||||
virtual void Clear() override;
|
||||
|
||||
private:
|
||||
XString* mName;
|
||||
XAudioSound* mSound;
|
||||
XString mName;
|
||||
XAudioSound mSound;
|
||||
};
|
||||
|
||||
#endif // XLOADEDSOUND_H
|
||||
|
||||
@ -1,11 +1,23 @@
|
||||
#include "xmaterialargumentdef.h"
|
||||
#include "xmaterialshaderargument.h"
|
||||
|
||||
XMaterialArgumentDef::XMaterialArgumentDef()
|
||||
: XAsset()
|
||||
, mLiteralConst(nullptr)
|
||||
, mCodeConst()
|
||||
, mCodeSampler(0)
|
||||
, mNameHash(0)
|
||||
, mParent(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
XMaterialArgumentDef::XMaterialArgumentDef(XMaterialShaderArgument &aParent)
|
||||
: XAsset()
|
||||
, mCodeSampler(0)
|
||||
, mParent(&aParent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
XMaterialArgumentDef::~XMaterialArgumentDef()
|
||||
{
|
||||
|
||||
}
|
||||
@ -17,5 +29,19 @@ void XMaterialArgumentDef::Clear()
|
||||
|
||||
void XMaterialArgumentDef::ParseData(QDataStream *aStream)
|
||||
{
|
||||
if (!mParent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
*aStream >> mCodeSampler;
|
||||
|
||||
if (mParent->GetType() == 1 || mParent->GetType() == 7)
|
||||
{
|
||||
if (mCodeSampler == -1)
|
||||
{
|
||||
// TODO: Figure out wtf this parses...
|
||||
aStream->skipRawData(16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,21 +2,22 @@
|
||||
#define XMATERIALARGUMENTDEF_H
|
||||
|
||||
#include "xasset.h"
|
||||
#include "xmaterialargumentcodeconst.h"
|
||||
|
||||
class XMaterialShaderArgument;
|
||||
|
||||
class XMaterialArgumentDef : public XAsset
|
||||
{
|
||||
public:
|
||||
XMaterialArgumentDef();
|
||||
explicit XMaterialArgumentDef();
|
||||
XMaterialArgumentDef(XMaterialShaderArgument &aParent);
|
||||
~XMaterialArgumentDef();
|
||||
|
||||
virtual void Clear() override;
|
||||
virtual void ParseData(QDataStream *aStream) override;
|
||||
|
||||
private:
|
||||
const float *mLiteralConst;
|
||||
XMaterialArgumentCodeConst mCodeConst;
|
||||
unsigned int mCodeSampler;
|
||||
unsigned int mNameHash;
|
||||
qint32 mCodeSampler;
|
||||
XMaterialShaderArgument* mParent;
|
||||
};
|
||||
|
||||
#endif // XMATERIALARGUMENTDEF_H
|
||||
|
||||
@ -15,7 +15,7 @@ public:
|
||||
virtual void Clear() override;
|
||||
|
||||
private:
|
||||
unsigned int mNameHash;
|
||||
quint32 mNameHash;
|
||||
QString mName;
|
||||
QVector<float> mLiteral;
|
||||
};
|
||||
|
||||
@ -22,7 +22,7 @@ private:
|
||||
quint8 mTextureAtlasRowCount;
|
||||
quint8 mTextureAtlasColumnCount;
|
||||
XGfxDrawSurf mDrawSurf;
|
||||
unsigned int mSurfaceTypeBits;
|
||||
quint32 mSurfaceTypeBits;
|
||||
};
|
||||
|
||||
#endif // XMATERIALINFO_H
|
||||
|
||||
@ -3,10 +3,13 @@
|
||||
#include "xmaterialvertexshader.h"
|
||||
#include "xmaterialpixelshader.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QIODevice>
|
||||
|
||||
XMaterialPass::XMaterialPass()
|
||||
: XAsset()
|
||||
, mVertexDecl()
|
||||
, mVertexShaderArray()
|
||||
, mVertexShaderArray(15)
|
||||
, mVertexShader()
|
||||
, mPixelShader()
|
||||
, mPerPrimArgCount(0)
|
||||
@ -16,7 +19,7 @@ XMaterialPass::XMaterialPass()
|
||||
, mPrecompiledIndex(0)
|
||||
, mArgs()
|
||||
{
|
||||
|
||||
SetName("Material Pass");
|
||||
}
|
||||
|
||||
void XMaterialPass::Clear()
|
||||
@ -26,6 +29,11 @@ void XMaterialPass::Clear()
|
||||
|
||||
void XMaterialPass::ParseData(QDataStream *aStream)
|
||||
{
|
||||
if (IsDebug())
|
||||
{
|
||||
qDebug() << QString("[%1] Parsing data for %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(GetName());
|
||||
}
|
||||
|
||||
mVertexDecl.ParsePtr(aStream, false);
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
@ -34,20 +42,45 @@ void XMaterialPass::ParseData(QDataStream *aStream)
|
||||
mVertexShader.ParsePtr(aStream, false);
|
||||
mPixelShader.ParsePtr(aStream, false);
|
||||
|
||||
qint32 argPtr;
|
||||
qint32 argsPtr;
|
||||
*aStream
|
||||
>> mPerPrimArgCount
|
||||
>> mPerObjArgCount
|
||||
>> mStableArgCount
|
||||
>> mCustomSamplerFlags
|
||||
>> mPrecompiledIndex
|
||||
>> argPtr;
|
||||
>> mPrecompiledIndex;
|
||||
|
||||
aStream->skipRawData(3);
|
||||
|
||||
*aStream >> argsPtr;
|
||||
|
||||
if (IsDebug())
|
||||
{
|
||||
qDebug() << QString("[%1] mPerPrimArgCount = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mPerPrimArgCount);
|
||||
qDebug() << QString("[%1] mPerObjArgCount = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mPerObjArgCount);
|
||||
qDebug() << QString("[%1] mStableArgCount = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mStableArgCount);
|
||||
qDebug() << QString("[%1] mCustomSamplerFlags = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mCustomSamplerFlags);
|
||||
qDebug() << QString("[%1] mPrecompiledIndex = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mPrecompiledIndex);
|
||||
qDebug() << QString("[%1] argsPtr = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(argsPtr);
|
||||
}
|
||||
|
||||
mVertexDecl.ParseData(aStream);
|
||||
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
mVertexShaderArray[i].ParseData(aStream);
|
||||
}
|
||||
mVertexShader.ParseData(aStream);
|
||||
mPixelShader.ParseData(aStream);
|
||||
|
||||
if (argsPtr)
|
||||
{
|
||||
int argCount = mStableArgCount + mPerObjArgCount + mPerPrimArgCount;
|
||||
for (int i = 0; i < argCount; i++)
|
||||
{
|
||||
XMaterialShaderArgument arg;
|
||||
arg.ParseData(aStream);
|
||||
mArgs.append(arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ private:
|
||||
int mStableArgCount;
|
||||
int mCustomSamplerFlags;
|
||||
int mPrecompiledIndex;
|
||||
XMaterialShaderArgument mArgs;
|
||||
QVector<XMaterialShaderArgument> mArgs;
|
||||
};
|
||||
|
||||
#endif // XMATERIALPASS_H
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
XMaterialPixelShader::XMaterialPixelShader()
|
||||
: XAsset()
|
||||
, mName("")
|
||||
, mName()
|
||||
, mShaderProgram()
|
||||
{
|
||||
SetType(ASSET_TYPE_PIXELSHADER);
|
||||
@ -16,11 +16,15 @@ XMaterialPixelShader::~XMaterialPixelShader()
|
||||
|
||||
void XMaterialPixelShader::Clear()
|
||||
{
|
||||
mName.clear();
|
||||
mName.Clear();
|
||||
mShaderProgram.Clear();
|
||||
}
|
||||
|
||||
void XMaterialPixelShader::ParseData(QDataStream *aStream)
|
||||
{
|
||||
|
||||
if (GetPtr() == -1)
|
||||
{
|
||||
mName.ParsePtr(aStream);
|
||||
mShaderProgram.ParseData(aStream);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#define XMATERIALPIXERHSHADER_H
|
||||
|
||||
#include "xasset.h"
|
||||
#include "xstring.h"
|
||||
#include "xmaterialpixelshaderprogram.h"
|
||||
|
||||
class XMaterialPixelShader : public XAsset
|
||||
@ -14,7 +15,7 @@ public:
|
||||
void ParseData(QDataStream *aStream) override;
|
||||
|
||||
private:
|
||||
QString mName;
|
||||
XString mName;
|
||||
XMaterialPixelShaderProgram mShaderProgram;
|
||||
};
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
XMaterialPixelShaderProgram::XMaterialPixelShaderProgram()
|
||||
: XAsset()
|
||||
, mPixelShader(nullptr)
|
||||
, mPixelShader()
|
||||
, mLoadDef()
|
||||
{
|
||||
|
||||
@ -10,16 +10,26 @@ XMaterialPixelShaderProgram::XMaterialPixelShaderProgram()
|
||||
|
||||
XMaterialPixelShaderProgram::~XMaterialPixelShaderProgram()
|
||||
{
|
||||
delete mPixelShader;
|
||||
|
||||
}
|
||||
|
||||
void XMaterialPixelShaderProgram::Clear()
|
||||
{
|
||||
mPixelShader->Clear();
|
||||
mPixelShader.Clear();
|
||||
mLoadDef.Clear();
|
||||
}
|
||||
|
||||
void XMaterialPixelShaderProgram::ParseData(QDataStream *aStream)
|
||||
{
|
||||
mLoadDef.ParseData(aStream);
|
||||
mPixelShader.ParseData(aStream);
|
||||
|
||||
if (mLoadDef.GetPhysicalPartSize())
|
||||
{
|
||||
//mPixelShader.
|
||||
}
|
||||
else
|
||||
{
|
||||
//mLoadDef
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ public:
|
||||
void ParseData(QDataStream *aStream) override;
|
||||
|
||||
private:
|
||||
XD3DPixelShader *mPixelShader;
|
||||
XD3DPixelShader mPixelShader;
|
||||
XGfxPixelShaderLoadDef mLoadDef;
|
||||
};
|
||||
|
||||
|
||||
@ -6,15 +6,31 @@ XMaterialShaderArgument::XMaterialShaderArgument()
|
||||
, mDest(0)
|
||||
, mDef()
|
||||
{
|
||||
|
||||
SetName("Material Shader Argument");
|
||||
}
|
||||
|
||||
void XMaterialShaderArgument::Clear()
|
||||
{
|
||||
|
||||
mType = 0;
|
||||
mDest = 0;
|
||||
mDef.Clear();
|
||||
}
|
||||
|
||||
void XMaterialShaderArgument::ParseData(QDataStream *aStream)
|
||||
{
|
||||
*aStream
|
||||
>> mType
|
||||
>> mDest;
|
||||
|
||||
mDef.ParseData(aStream, mType);
|
||||
}
|
||||
|
||||
quint16 XMaterialShaderArgument::GetType() const
|
||||
{
|
||||
return mType;
|
||||
}
|
||||
|
||||
quint16 XMaterialShaderArgument::GetDest() const
|
||||
{
|
||||
return mDest;
|
||||
}
|
||||
|
||||
@ -12,9 +12,12 @@ public:
|
||||
virtual void Clear() override;
|
||||
virtual void ParseData(QDataStream *aStream) override;
|
||||
|
||||
quint16 GetType() const;
|
||||
quint16 GetDest() const;
|
||||
|
||||
private:
|
||||
int mType;
|
||||
int mDest;
|
||||
quint16 mType;
|
||||
quint16 mDest;
|
||||
XMaterialArgumentDef mDef;
|
||||
};
|
||||
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
#include "xmaterialtechnique.h"
|
||||
#include "qdebug.h"
|
||||
#include "qfiledevice.h"
|
||||
|
||||
XMaterialTechnique::XMaterialTechnique()
|
||||
: XAsset()
|
||||
@ -9,7 +7,7 @@ XMaterialTechnique::XMaterialTechnique()
|
||||
, mPassCount(0)
|
||||
, mPassArray()
|
||||
{
|
||||
|
||||
SetName("Material Technique");
|
||||
}
|
||||
|
||||
XMaterialTechnique::~XMaterialTechnique()
|
||||
@ -19,15 +17,23 @@ XMaterialTechnique::~XMaterialTechnique()
|
||||
|
||||
void XMaterialTechnique::ParseData(QDataStream *aStream)
|
||||
{
|
||||
mName.ParsePtr(aStream);
|
||||
|
||||
qDebug() << aStream->device()->pos();
|
||||
if (IsDebug())
|
||||
{
|
||||
qDebug() << QString("[%1] Parsing data for %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(GetName());
|
||||
}
|
||||
mName.ParsePtr(aStream, false);
|
||||
|
||||
*aStream
|
||||
>> mFlags
|
||||
>> mPassCount;
|
||||
|
||||
mPassArray = QVector<XMaterialPass>(mPassArray);
|
||||
if (IsDebug())
|
||||
{
|
||||
qDebug() << QString("[%1] mFlags = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mFlags);
|
||||
qDebug() << QString("[%1] mPassCount = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mPassCount);
|
||||
}
|
||||
|
||||
mPassArray = QVector<XMaterialPass>(mPassCount);
|
||||
|
||||
for (int i = 0; i < mPassCount; i++)
|
||||
{
|
||||
|
||||
@ -18,8 +18,8 @@ public:
|
||||
|
||||
private:
|
||||
XString mName;
|
||||
int mFlags;
|
||||
int mPassCount;
|
||||
quint16 mFlags;
|
||||
quint16 mPassCount;
|
||||
QVector<XMaterialPass> mPassArray;
|
||||
};
|
||||
|
||||
|
||||
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