diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..63eeeb1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "workbench.colorTheme": "Default Dark Modern", + "workbench.startupEditor": "none" +} diff --git a/app/app.pro b/app/app.pro index c860478..1d80002 100644 --- a/app/app.pro +++ b/app/app.pro @@ -6,66 +6,9 @@ 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 \ - reportissuedialog.cpp \ - soundviewer.cpp \ - stringtableviewer.cpp \ - rumblegraphviewer.cpp \ - rumblefileviewer.cpp \ - techsetviewer.cpp \ - xtreewidget.cpp \ - xtreewidgetitem.cpp \ - zonefileviewer.cpp - -HEADERS += \ - aboutdialog.h \ - d3dbsp_structs.h \ - ddsviewer.h \ - fastfileviewer.h \ - imagewidget.h \ - iwiviewer.h \ - localstringviewer.h \ - mainwindow.h \ - materialviewer.h \ - preferenceeditor.h \ - reportissuedialog.h \ - soundviewer.h \ - stringtableviewer.h \ - rumblegraphviewer.h \ - rumblefileviewer.h \ - techsetviewer.h \ - xtreewidget.h \ - xtreewidgetitem.h \ - zonefileviewer.h - -FORMS += \ - aboutdialog.ui \ - ddsviewer.ui \ - fastfileviewer.ui \ - imagewidget.ui \ - iwiviewer.ui \ - localstringviewer.ui \ - mainwindow.ui \ - materialviewer.ui \ - modelviewer.ui \ - preferenceeditor.ui \ - soundviewer.ui \ - stringtableviewer.ui \ - rumblegraphviewer.ui \ - rumblefileviewer.ui \ - techsetviewer.ui \ - zonefileviewer.ui \ - reportissuedialog.ui +SOURCES += $$files($$PWD/*.cpp) +HEADERS += $$files($$PWD/*.h) +FORMS += $$files($$PWD/*.ui) RESOURCES += ../data/data.qrc diff --git a/app/rumblefileviewer.h b/app/rumblefileviewer.h index 9d46b3b..88e4e16 100644 --- a/app/rumblefileviewer.h +++ b/app/rumblefileviewer.h @@ -1,7 +1,7 @@ #ifndef RUMBLEFILEVIEWER_H #define RUMBLEFILEVIEWER_H -#include "rawfile.h" +#include "xrawfile.h" #include diff --git a/app/stringtableviewer.h b/app/stringtableviewer.h index c7f00b6..1893955 100644 --- a/app/stringtableviewer.h +++ b/app/stringtableviewer.h @@ -1,7 +1,7 @@ #ifndef STRINGTABLEVIEWER_H #define STRINGTABLEVIEWER_H -#include "stringtable.h" +#include "xstringtable.h" #include diff --git a/app/xtreewidget.h b/app/xtreewidget.h index ba8fdd7..0fe3968 100644 --- a/app/xtreewidget.h +++ b/app/xtreewidget.h @@ -7,9 +7,9 @@ #include "fastfile.h" #include "xtreewidgetitem.h" #include "zonefile.h" -#include "rawfile.h" +#include "xrawfile.h" #include "gfximage.h" -#include "stringtable.h" +#include "xstringtable.h" #include "menudef.h" #include diff --git a/libs/assets/asset.cpp b/libs/assets/asset.cpp deleted file mode 100644 index be5cbe3..0000000 --- a/libs/assets/asset.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "asset.h" diff --git a/libs/assets/asset.h b/libs/assets/asset.h deleted file mode 100644 index 977d602..0000000 --- a/libs/assets/asset.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef ASSET_H -#define ASSET_H - -#include "animparts.h" -#include "model.h" -#include "material.h" -#include "materialpixelshader.h" -#include "materialtechset.h" -#include "gfximage.h" -#include "soundalias.h" -#include "soundcurve.h" -#include "loadedsound.h" -#include "clipmap.h" -#include "comworld.h" -#include "gameworld.h" -#include "mapent.h" -#include "gfxworld.h" -#include "gfxlightdef.h" -#include "gfximage.h" -#include "font.h" -#include "menulist.h" -#include "menudef.h" -#include "localizeentry.h" -#include "weapondef.h" -#include "sounddriver.h" -#include "effectdef.h" -#include "effecttable.h" -#include "rawfile.h" -#include "stringtable.h" - -enum XAssetType : qint32 -{ - ASSET_TYPE_XMODELPIECES = 0x0, - ASSET_TYPE_PHYSPRESET = 0x1, - ASSET_TYPE_XANIMPARTS = 0x2, - ASSET_TYPE_XMODEL = 0x3, - ASSET_TYPE_MATERIAL = 0x4, - ASSET_TYPE_PIXELSHADER = 0x5, - ASSET_TYPE_TECHNIQUE_SET = 0x6, - ASSET_TYPE_IMAGE = 0x7, - ASSET_TYPE_SOUND = 0x8, - ASSET_TYPE_SOUND_CURVE = 0x9, - ASSET_TYPE_LOADED_SOUND = 0xA, - ASSET_TYPE_CLIPMAP = 0xB, - ASSET_TYPE_CLIPMAP_PVS = 0xC, - ASSET_TYPE_COMWORLD = 0xD, - ASSET_TYPE_GAMEWORLD_SP = 0xE, - ASSET_TYPE_GAMEWORLD_MP = 0xF, - ASSET_TYPE_MAP_ENTS = 0x10, - ASSET_TYPE_GFXWORLD = 0x11, - ASSET_TYPE_LIGHT_DEF = 0x12, - ASSET_TYPE_UI_MAP = 0x13, - ASSET_TYPE_FONT = 0x14, - ASSET_TYPE_MENULIST = 0x15, - ASSET_TYPE_MENU = 0x16, - ASSET_TYPE_LOCALIZE_ENTRY = 0x17, - ASSET_TYPE_WEAPON = 0x18, - ASSET_TYPE_SNDDRIVER_GLOBALS = 0x19, - ASSET_TYPE_FX = 0x1A, - ASSET_TYPE_IMPACT_FX = 0x1B, - ASSET_TYPE_AITYPE = 0x1C, - ASSET_TYPE_MPTYPE = 0x1D, - ASSET_TYPE_CHARACTER = 0x1E, - ASSET_TYPE_XMODELALIAS = 0x1F, - ASSET_TYPE_RAWFILE = 0x20, - ASSET_TYPE_STRINGTABLE = 0x21, - ASSET_TYPE_COUNT = 0x22, - ASSET_TYPE_STRING = 0x22, - ASSET_TYPE_ASSETLIST = 0x23, -}; - -union XAssetHeader -{ - XModelPieces *xmodelPieces; - PhysPreset *physPreset; - XAnimParts *parts; - Model *model; - Material *material; - MaterialPixelShader *pixelShader; - MaterialVertexShader *vertexShader; - MaterialTechSet *techniqueSet; - GfxImage *image; - SoundAliasList *sound; - SoundCurve *sndCurve; - LoadedSound *loadSnd; - ClipMap *clipMap; - ComWorld *comWorld; - GameWorldSp *gameWorldSp; - GameWorldMp *gameWorldMp; - MapEnts *mapEnts; - GfxWorld *gfxWorld; - GfxLightDef *lightDef; - GameFont *font; - MenuList *menuList; - MenuDef *menu; - LocalizeEntry *localize; - WeaponDef *weapon; - SoundDriver *sndDriverGlobals; - const EffectDef *fx; - ImpactTable *impactFx; - RawFile *rawfile; - StringTable *stringTable; - void *data; -}; - -struct XAsset -{ - XAssetType type; - XAssetHeader header; -}; - -#endif // ASSET_H diff --git a/libs/assets/assetlist.h b/libs/assets/assetlist.h index 4db3074..7f6da80 100644 --- a/libs/assets/assetlist.h +++ b/libs/assets/assetlist.h @@ -1,7 +1,7 @@ #ifndef ASSETLIST_H #define ASSETLIST_H -#include "asset.h" +#include "xasset.h" #include "scriptstringlist.h" struct XAssetList diff --git a/libs/assets/assetmap.h b/libs/assets/assetmap.h index f0c0fa3..4f3daee 100644 --- a/libs/assets/assetmap.h +++ b/libs/assets/assetmap.h @@ -2,7 +2,7 @@ #define ASSETMAP_H #include "animparts.h" -#include "model.h" +#include "xmodel.h" #include "material.h" #include "materialpixelshader.h" #include "materialtechset.h" @@ -20,13 +20,13 @@ #include "font.h" #include "menulist.h" #include "menudef.h" -#include "localizeentry.h" +#include "xlocalizeentry.h" #include "weapondef.h" -#include "sounddriver.h" +#include "xsounddriverglobals.h" #include "effectdef.h" #include "effecttable.h" -#include "rawfile.h" -#include "stringtable.h" +#include "xrawfile.h" +#include "xstringtable.h" struct AssetMap { QVector animations; diff --git a/libs/assets/assets.cpp b/libs/assets/assets.cpp index 62be21c..03a63b4 100644 --- a/libs/assets/assets.cpp +++ b/libs/assets/assets.cpp @@ -1065,14 +1065,14 @@ GfxVertexBuffer Assets::Load_GfxVertexBuffer(QDataStream *aStream) GfxVertexBuffer result; *aStream - >> result.Format.__s0.Type - >> result.Format.__s0.BaseAddress - >> result.Format.__s0.Endian - >> result.Format.__s0.Size - >> result.Format.__s0.AddressClamp - >> result.Format.__s0. - >> result.Format.__s0.RequestSize - >> result.Format.__s0.ClampDisable + >> result.Format.request.Type + >> result.Format.request.BaseAddress + >> result.Format.request.Endian + >> result.Format.request.Size + >> result.Format.request.AddressClamp + >> result.Format.request. + >> result.Format.request.RequestSize + >> result.Format.request.ClampDisable >> result.Format.dword[0] >> result.Format.dword[1] >> result.Common @@ -1110,11 +1110,6 @@ QVector Assets::Load_XSurfaceCollisionNodeArray(QDataStre return result; } -struct XSurfaceCollisionLeaf -{ - unsigned __int16 triangleBeginIndex; -}; - // ?Load_XSurfaceCollisionLeafArray@@YAX_NH@Z at 0x822a4fb8 QVector Assets::Load_XSurfaceCollisionLeafArray(QDataStream *aStream, int count) { @@ -1258,12 +1253,12 @@ StreamFileNamePacked Assets::Load_StreamFileNamePacked(QDataStream *aStream) // ?Load_XaReverbSettingsArray@@YAX_NH@Z at 0x822a5048 -QVector Assets::Load_XaReverbSettingsArray(QDataStream *aStream, int count) +QVector Assets::Load_XaReverbSettingsArray(QDataStream *aStream, int count) { - QVector result; + QVector result; for (int i = 0; i < count; i++) { - XaReverbSettings xaReverbSettings; + XAudioReverbSettings xaReverbSettings; *aStream >> xaReverbSettings.presetOverridden @@ -2497,9 +2492,9 @@ RawFile Assets::Load_RawFile(QDataStream *aStream) // ?Load_LocalizeEntry@@YAX_N@Z at 0x822a5ef0 -LocalizeEntry Assets::Load_LocalizeEntry(QDataStream *aStream) +XLocalizeEntry Assets::Load_LocalizeEntry(QDataStream *aStream) { - LocalizeEntry result; + XLocalizeEntry result; *aStream >> result.valuePtr @@ -3240,9 +3235,9 @@ StreamFileNameRaw Assets::Load_StreamFileNameRaw(QDataStream *aStream) // ?Load_SndDriverGlobals@@YAX_N@Z at 0x822a6f48 -SndDriverGlobals Assets::Load_SndDriverGlobals(QDataStream *aStream) +XSoundDriverGlobals Assets::Load_SndDriverGlobals(QDataStream *aStream) { - SndDriverGlobals result; + XSoundDriverGlobals result; *aStream >> result.reverbSettingsPtr @@ -3250,7 +3245,7 @@ SndDriverGlobals Assets::Load_SndDriverGlobals(QDataStream *aStream) if (result.reverbSettingsPtr) { - XaReverbSettings xaReverbSettings; + XAudioReverbSettings xaReverbSettings; *aStream >> xaReverbSettings.presetOverridden @@ -3555,9 +3550,9 @@ RawFile Assets::Load_RawFilePtr(QDataStream *aStream) // ?Load_LocalizeEntryPtr@@YAX_N@Z at 0x822a77d0 -LocalizeEntry Assets::Load_LocalizeEntryPtr(QDataStream *aStream) +XLocalizeEntry Assets::Load_LocalizeEntryPtr(QDataStream *aStream) { - LocalizeEntry result; + XLocalizeEntry result; qint32 localizeEntryPtr; *aStream >> localizeEntryPtr; @@ -4203,7 +4198,7 @@ void Assets::Load_StreamFileInfo(QDataStream *aStream) // ?Load_SndDriverGlobalsPtr@@YAX_N@Z at 0x822a8640 void Assets::Load_SndDriverGlobalsPtr(QDataStream *aStream) { - SndDriverGlobals result; + XSoundDriverGlobals result; qint32 sndDriverGlobalsPtr; *aStream >> sndDriverGlobalsPtr; @@ -9350,7 +9345,7 @@ clipMap_t Assets::Load_clipMap_t(QDataStream *aStream) if (result.planesPtr == -1) { for (int i = 0; i < result.planeCount; i++) { - result.planes << Asset::Load_cplane_s(aStream); + result.planes << XAsset::Load_cplane_s(aStream); } } else diff --git a/libs/assets/assets.h b/libs/assets/assets.h index 0c2a8b1..0afaaab 100644 --- a/libs/assets/assets.h +++ b/libs/assets/assets.h @@ -1,7 +1,7 @@ #ifndef ASSETS_H #define ASSETS_H -#include "model.h" +#include "xmodel.h" #include #include @@ -2089,7 +2089,7 @@ struct MenuList QVector menus; }; -struct LocalizeEntry +struct XLocalizeEntry { qint32 valuePtr; QString value; @@ -2817,7 +2817,7 @@ struct WeaponDef float adsDofEnd; }; -struct XAUDIOREVERBSETTINGS +struct XReverbSettings { uint ReflectionsDelay; quint8 ReverbDelay; @@ -2842,16 +2842,16 @@ struct XAUDIOREVERBSETTINGS float RoomSize; }; -struct XaReverbSettings +struct XAudioReverbSettings { int presetOverridden; - XAUDIOREVERBSETTINGS reverbSettings; + XReverbSettings reverbSettings; }; -struct SndDriverGlobals +struct XSoundDriverGlobals { qint32 reverbSettingsPtr; - XaReverbSettings reverbSettings; + XAudioReverbSettings reverbSettings; qint32 namePtr; QString name; }; @@ -2915,9 +2915,9 @@ union XAssetHeader Font_s *font; MenuList *menuList; menuDef_t *menu; - LocalizeEntry *localize; + XLocalizeEntry *localize; WeaponDef *weapon; - SndDriverGlobals *sndDriverGlobals; + XSoundDriverGlobals *sndDriverGlobals; const FxEffectDef *fx; FxImpactTable *impactFx; RawFile *rawfile; @@ -3000,7 +3000,7 @@ private: void Load_GfxWorldVertex0Array(QDataStream *aStream, int count); QVector Load_XAUDIOCHANNELMAPENTRYArray(QDataStream *aStream, int count); StreamFileNamePacked Load_StreamFileNamePacked(QDataStream *aStream); - QVector Load_XaReverbSettingsArray(QDataStream *aStream, int count); + QVector Load_XaReverbSettingsArray(QDataStream *aStream, int count); QVector Load_char2048Array(QDataStream *aStream, size_t count); QVector Load_DObjAnimMatArray(QDataStream *aStream, int count); QVector Load_XBoneInfoArray(QDataStream *aStream, int count); @@ -3049,7 +3049,7 @@ private: QString Load_XStringCustom(QDataStream *aStream); QString Load_XString(QDataStream *aStream); RawFile Load_RawFile(QDataStream *aStream); - LocalizeEntry Load_LocalizeEntry(QDataStream *aStream); + XLocalizeEntry Load_LocalizeEntry(QDataStream *aStream); void Load_operandInternalDataUnion(QDataStream *aStream); ComPrimaryLight Load_ComPrimaryLight(QDataStream *aStream); CollisionPartition Load_CollisionPartition(QDataStream *aStream); @@ -3075,7 +3075,7 @@ private: XAUDIOCHANNELMAP Load_XAUDIOCHANNELMAP(QDataStream *aStream); SndCurve Load_SndCurve(QDataStream *aStream); StreamFileNameRaw Load_StreamFileNameRaw(QDataStream *aStream); - SndDriverGlobals Load_SndDriverGlobals(QDataStream *aStream); + XSoundDriverGlobals Load_SndDriverGlobals(QDataStream *aStream); XaSeekTable Load_XaSeekTable(QDataStream *aStream); XAUDIOPACKET_ALIGNED Load_XAUDIOPACKET_ALIGNED(QDataStream *aStream); XAnimNotifyInfo Load_XAnimNotifyInfo(QDataStream *aStream); diff --git a/libs/assets/assets.pro b/libs/assets/assets.pro index 014c1d5..ee21e14 100644 --- a/libs/assets/assets.pro +++ b/libs/assets/assets.pro @@ -2,150 +2,8 @@ QT += core widgets TEMPLATE = lib CONFIG += staticlib c++17 -SOURCES += \ - # Base class - assets.cpp \ - animparts.cpp \ - asset.cpp \ - assetlist.cpp \ - clipmap.cpp \ - comworld.cpp \ - d3dresource.cpp \ - effectdef.cpp \ - effecttable.cpp \ - file.cpp \ - font.cpp \ - gameworld.cpp \ - gfximage.cpp \ - gfxlightdef.cpp \ - gfxworld.cpp \ - loadedsound.cpp \ - localizeentry.cpp \ - mapent.cpp \ - material.cpp \ - materialpixelshader.cpp \ - materialtechset.cpp \ - menudef.cpp \ - menulist.cpp \ - model.cpp \ - rawfile.cpp \ - scriptstringlist.cpp \ - soundalias.cpp \ - soundcurve.cpp \ - sounddriver.cpp \ - stringtable.cpp \ - weapondef.cpp \ - # 360 classes - 360/assets_cod2_360.cpp \ - 360/assets_cod4_360.cpp \ - 360/assets_cod5_360.cpp \ - 360/assets_cod6_360.cpp \ - 360/assets_cod7_360.cpp \ - 360/assets_cod8_360.cpp \ - 360/assets_cod9_360.cpp \ - 360/assets_cod10_360.cpp \ - 360/assets_cod11_360.cpp \ - 360/assets_cod12_360.cpp \ - # PS3 classes - PS3/assets_cod4_ps3.cpp \ - PS3/assets_cod5_ps3.cpp \ - PS3/assets_cod6_ps3.cpp \ - PS3/assets_cod7_ps3.cpp \ - PS3/assets_cod8_ps3.cpp \ - PS3/assets_cod9_ps3.cpp \ - PS3/assets_cod10_ps3.cpp \ - PS3/assets_cod11_ps3.cpp \ - PS3/assets_cod12_ps3.cpp \ - # PC classes - PC/assets_cod4_pc.cpp \ - PC/assets_cod5_pc.cpp \ - PC/assets_cod6_pc.cpp \ - PC/assets_cod7_pc.cpp \ - PC/assets_cod8_pc.cpp \ - PC/assets_cod9_pc.cpp \ - PC/assets_cod10_pc.cpp \ - PC/assets_cod11_pc.cpp \ - PC/assets_cod12_pc.cpp \ - # Wii classes - Wii/assets_cod4_wii.cpp \ - Wii/assets_cod7_wii.cpp \ - Wii/assets_cod8_wii.cpp \ - # WiiU classes - WiiU/assets_cod9_wiiu.cpp \ - WiiU/assets_cod10_wiiu.cpp - -HEADERS += \ - # Base class - animparts.h \ - asset.h \ - assetlist.h \ - assetmap.h \ - assets.h \ - # 360 classes - 360/assets_cod2_360.h \ - 360/assets_cod4_360.h \ - 360/assets_cod5_360.h \ - 360/assets_cod6_360.h \ - 360/assets_cod7_360.h \ - 360/assets_cod8_360.h \ - 360/assets_cod9_360.h \ - 360/assets_cod10_360.h \ - 360/assets_cod11_360.h \ - 360/assets_cod12_360.h \ - # PS3 classes - PS3/assets_cod4_ps3.h \ - PS3/assets_cod5_ps3.h \ - PS3/assets_cod6_ps3.h \ - PS3/assets_cod7_ps3.h \ - PS3/assets_cod8_ps3.h \ - PS3/assets_cod9_ps3.h \ - PS3/assets_cod10_ps3.h \ - PS3/assets_cod11_ps3.h \ - PS3/assets_cod12_ps3.h \ - # PC classes - PC/assets_cod4_pc.h \ - PC/assets_cod5_pc.h \ - PC/assets_cod6_pc.h \ - PC/assets_cod7_pc.h \ - PC/assets_cod8_pc.h \ - PC/assets_cod9_pc.h \ - PC/assets_cod10_pc.h \ - PC/assets_cod11_pc.h \ - PC/assets_cod12_pc.h \ - # Wii classes - Wii/assets_cod4_wii.h \ - Wii/assets_cod7_wii.h \ - Wii/assets_cod8_wii.h \ - # WiiU classes - WiiU/assets_cod9_wiiu.h \ - WiiU/assets_cod10_wiiu.h \ - clipmap.h \ - comworld.h \ - d3dresource.h \ - effectdef.h \ - effecttable.h \ - file.h \ - font.h \ - gameworld.h \ - gfximage.h \ - gfxlightdef.h \ - gfxworld.h \ - loadedsound.h \ - localizeentry.h \ - mapent.h \ - material.h \ - materialpixelshader.h \ - materialtechset.h \ - menudef.h \ - menulist.h \ - model.h \ - rawfile.h \ - scriptstringlist.h \ - soundalias.h \ - soundcurve.h \ - sounddriver.h \ - stringtable.h \ - weapondef.h +SOURCES += $$files($$PWD/*.cpp, true) +HEADERS += $$files($$PWD/*.h, true) LIBS += \ -L$$OUT_PWD/../libs/core -lcore diff --git a/libs/assets/clipmap.h b/libs/assets/clipmap.h index bd69643..d3e3c4c 100644 --- a/libs/assets/clipmap.h +++ b/libs/assets/clipmap.h @@ -1,7 +1,7 @@ #ifndef CLIPMAP_H #define CLIPMAP_H -#include "model.h" +#include "xmodel.h" #include "mapent.h" #include "effectdef.h" diff --git a/libs/assets/comprimarylight.cpp b/libs/assets/comprimarylight.cpp new file mode 100644 index 0000000..da46acb --- /dev/null +++ b/libs/assets/comprimarylight.cpp @@ -0,0 +1,208 @@ +#include "comprimarylight.h" + +ComPrimaryLight::ComPrimaryLight(QObject *aParent) + : XAsset(aParent) + , mType(-1) + , mCanUseShadowMap(-1) + , mExponent(-1) + , mUnused(-1) + , mColor(0, 0, 0) + , mDir(0, 0, 0) + , mOrigin(0, 0, 0) + , mRadius(0.0) + , mCosHalfFovOuter(0.0) + , mCosHalfFovInner(0.0) + , mCosHalfFovExpanded(0.0) + , mRotationLimit(0.0) + , mTranslationLimit(0.0) + , mDefName(new XString(this)) +{ + +} + +void ComPrimaryLight::Clear() +{ + delete mDefName; +} + +ComPrimaryLightArray *ComPrimaryLight::ParseArray(QDataStream *aStream, int aCount) +{ + ComPrimaryLightArray* result = new ComPrimaryLightArray(); + + for (int i = 0; i < aCount; i++) + { + ComPrimaryLight* comPrimaryLight = new ComPrimaryLight(); + comPrimaryLight->ParseData(aStream); + + result->append(comPrimaryLight); + } + + return result; +} + +void ComPrimaryLight::ParseData(QDataStream *aStream) +{ + *aStream + >> mType + >> mCanUseShadowMap + >> mExponent + >> mUnused + >> mColor + >> mDir + >> mOrigin + >> mRadius + >> mCosHalfFovOuter + >> mCosHalfFovInner + >> mCosHalfFovExpanded + >> mRotationLimit + >> mTranslationLimit; + + mDefName->ParseData(aStream); +} + +quint8 ComPrimaryLight::GetType() const +{ + return mType; +} + +quint8 ComPrimaryLight::GetCanUseShadowMap() const +{ + return mCanUseShadowMap; +} + +quint8 ComPrimaryLight::GetExponent() const +{ + return mExponent; +} + +quint8 ComPrimaryLight::GetUnused() const +{ + return mUnused; +} + +QColor ComPrimaryLight::GetColor() const +{ + return mColor; +} + +QVector3D ComPrimaryLight::GetDir() const +{ + return mDir; +} + +QVector3D ComPrimaryLight::GetOrigin() const +{ + return mOrigin; +} + +float ComPrimaryLight::GetRadius() const +{ + return mRadius; +} + +float ComPrimaryLight::GetCosHalfFovOuter() const +{ + return mCosHalfFovOuter; +} + +float ComPrimaryLight::GetCosHalfFovInner() const +{ + return mCosHalfFovInner; +} + +float ComPrimaryLight::GetCosHalfFovExpanded() const +{ + return mCosHalfFovExpanded; +} + +float ComPrimaryLight::GetRotationLimit() const +{ + return mRotationLimit; +} + +float ComPrimaryLight::GetTranslationLimit() const +{ + return mTranslationLimit; +} + +XString* ComPrimaryLight::GetDefName() const +{ + return mDefName; +} + +void ComPrimaryLight::SetType(quint8 aType) +{ + mType = aType; +} + +void ComPrimaryLight::SetCanUseShadowMap(quint8 aCanUseShadowMap) +{ + mCanUseShadowMap = aCanUseShadowMap; +} + +void ComPrimaryLight::SetExponent(quint8 aExponent) +{ + mExponent = aExponent; +} + +void ComPrimaryLight::SetUnused(quint8 aUnused) +{ + mUnused = aUnused; +} + +void ComPrimaryLight::SetColor(const QColor aColor) +{ + mColor = aColor; +} + +void ComPrimaryLight::SetDir(const QVector3D aDir) +{ + mDir = aDir; +} + +void ComPrimaryLight::SetOrigin(const QVector3D aOrigin) +{ + mOrigin = aOrigin; +} + +void ComPrimaryLight::SetRadius(float aRadius) +{ + mRadius = aRadius; +} + +void ComPrimaryLight::SetCosHalfFovOuter(float aCosHalfFovOuter) +{ + mCosHalfFovOuter = aCosHalfFovOuter; +} + +void ComPrimaryLight::SetCosHalfFovInner(float aCosHalfFovInner) +{ + mCosHalfFovInner = aCosHalfFovInner; +} + +void ComPrimaryLight::SetCosHalfFovExpanded(float aCosHalfFovExpanded) +{ + mCosHalfFovExpanded = aCosHalfFovExpanded; +} + +void ComPrimaryLight::SetRotationLimit(float aRotationLimit) +{ + mRotationLimit = aRotationLimit; +} + +void ComPrimaryLight::SetTranslationLimit(float aTranslationLimit) +{ + mTranslationLimit = aTranslationLimit; +} + +void ComPrimaryLight::SetDefName(XString* aDefName) +{ + mDefName = aDefName; +} + +void ComPrimaryLight::SetDefName(const QString aDefName) +{ + if (mDefName != nullptr) { + mDefName->SetString(aDefName); + } +} diff --git a/libs/assets/comprimarylight.h b/libs/assets/comprimarylight.h new file mode 100644 index 0000000..42668bb --- /dev/null +++ b/libs/assets/comprimarylight.h @@ -0,0 +1,74 @@ +#ifndef COMPRIMARYLIGHT_H +#define COMPRIMARYLIGHT_H + +#include "xasset.h" +#include "xstring.h" + +#include +#include + +class ComPrimaryLight; +typedef QVector ComPrimaryLightArray; + +class ComPrimaryLight : public XAsset +{ + Q_OBJECT + +public: + explicit ComPrimaryLight(QObject *aParent = nullptr); + + quint8 GetType() const; + quint8 GetCanUseShadowMap() const; + quint8 GetExponent() const; + quint8 GetUnused() const; + QColor GetColor() const; + QVector3D GetDir() const; + QVector3D GetOrigin() const; + float GetRadius() const; + float GetCosHalfFovOuter() const; + float GetCosHalfFovInner() const; + float GetCosHalfFovExpanded() const; + float GetRotationLimit() const; + float GetTranslationLimit() const; + XString* GetDefName() const; + + static ComPrimaryLightArray* ParseArray(QDataStream *aStream, int aCount); + + virtual void Clear() override; + virtual void ParseData(QDataStream *aStream) override; + +public slots: + void SetType(quint8 aType); + void SetCanUseShadowMap(quint8 aCanUseShadowMap); + void SetExponent(quint8 aExponent); + void SetUnused(quint8 aUnused); + void SetColor(const QColor aColor); + void SetDir(const QVector3D aDir); + void SetOrigin(const QVector3D aOrigin); + void SetRadius(float aRadius); + void SetCosHalfFovOuter(float aCosHalfFovOuter); + void SetCosHalfFovInner(float aCosHalfFovInner); + void SetCosHalfFovExpanded(float aCosHalfFovExpanded); + void SetRotationLimit(float aRotationLimit); + void SetTranslationLimit(float aTranslationLimit); + void SetDefName(XString* aDefName); + void SetDefName(const QString aDefName); + +private: + quint8 mType; + quint8 mCanUseShadowMap; + quint8 mExponent; + quint8 mUnused; + QColor mColor; + QVector3D mDir; + QVector3D mOrigin; + float mRadius; + float mCosHalfFovOuter; + float mCosHalfFovInner; + float mCosHalfFovExpanded; + float mRotationLimit; + float mTranslationLimit; + XString* mDefName; +}; + +#endif // COMPRIMARYLIGHT_H diff --git a/libs/assets/comworld.cpp b/libs/assets/comworld.cpp index 097c80e..649d1ee 100644 --- a/libs/assets/comworld.cpp +++ b/libs/assets/comworld.cpp @@ -1 +1,92 @@ #include "comworld.h" + +#include "comprimarylight.h" + +ComWorldAsset::ComWorldAsset(QObject *aParent) + : XAsset(aParent) + , mName(new XString(aParent)) + , mInUse(false) + , mPrimaryLightCount(-1) + , mPrimaryLights(new ComPrimaryLightArray()) +{ + +} + +void ComWorldAsset::Clear() +{ + for (int i = 0; i < mPrimaryLights->size(); i++) + { + delete mPrimaryLights->at(i); + } + + delete mPrimaryLights; + delete mName; +} + +void ComWorldAsset::ParseData(QDataStream *aStream) +{ + mName->ParsePtr(aStream, false); + + quint32 primaryLightPtr; + *aStream + >> mInUse + >> mPrimaryLightCount + >> primaryLightPtr; + + mName->ParseData(aStream); + + if (primaryLightPtr) + { + if (mPrimaryLights != nullptr) + { + delete mPrimaryLights; + } + mPrimaryLights = ComPrimaryLight::ParseArray(aStream, mPrimaryLightCount); + } +} + +QString ComWorldAsset::GetName() const +{ + return mName->GetString(); +} + +bool ComWorldAsset::IsInUse() const +{ + return mInUse; +} + +quint32 ComWorldAsset::GetPrimaryLightCount() const +{ + return mPrimaryLightCount; +} + +ComPrimaryLight *ComWorldAsset::GetPrimaryLight(quint32 aIndex) const +{ + return mPrimaryLights->at(aIndex); +} + +ComPrimaryLightArray *ComWorldAsset::GetPrimaryLights() const +{ + return mPrimaryLights; +} + +void ComWorldAsset::SetName(const QString &aName) +{ + if (aName != nullptr) + { + mName->SetString(aName); + } +} + +void ComWorldAsset::SetName(XString* aName) +{ + if (aName != nullptr) + { + mName = aName; + } +} + +void ComWorldAsset::SetInUse(bool aInUse) +{ + mInUse = aInUse; +} diff --git a/libs/assets/comworld.h b/libs/assets/comworld.h index 671f019..50f89de 100644 --- a/libs/assets/comworld.h +++ b/libs/assets/comworld.h @@ -1,30 +1,39 @@ #ifndef COMWORLD_H #define COMWORLD_H -struct ComPrimaryLight -{ - unsigned __int8 type; - unsigned __int8 canUseShadowMap; - unsigned __int8 exponent; - unsigned __int8 unused; - float color[3]; - float dir[3]; - float origin[3]; - float radius; - float cosHalfFovOuter; - float cosHalfFovInner; - float cosHalfFovExpanded; - float rotationLimit; - float translationLimit; - const char *defName; -}; +#include "xasset.h" +#include "xstring.h" +#include "comprimarylight.h" -struct ComWorld +#include +#include + +class ComWorldAsset : public XAsset { - const char *name; - int isInUse; - unsigned int primaryLightCount; - ComPrimaryLight *primaryLights; + Q_OBJECT + +public: + explicit ComWorldAsset(QObject *aParent = nullptr); + + virtual void Clear() override; + virtual void ParseData(QDataStream *aStream) override; + + QString GetName() const; + bool IsInUse() const; + quint32 GetPrimaryLightCount() const; + ComPrimaryLight* GetPrimaryLight(quint32 aIndex) const; + ComPrimaryLightArray* GetPrimaryLights() const; + +public slots: + void SetName(const QString &aName); + void SetName(XString* aName); + void SetInUse(bool aInUse); + +private: + XString* mName; + bool mInUse; + quint32 mPrimaryLightCount; + ComPrimaryLightArray* mPrimaryLights; }; #endif // COMWORLD_H diff --git a/libs/assets/effectdef.h b/libs/assets/effectdef.h index be05986..39bca4e 100644 --- a/libs/assets/effectdef.h +++ b/libs/assets/effectdef.h @@ -2,7 +2,7 @@ #define EFFECTDEF_H #include "material.h" -#include "model.h" +#include "xmodel.h" struct FxSpawnDefLooping { diff --git a/libs/assets/gfxworld.h b/libs/assets/gfxworld.h index 8427ddb..ec94fa3 100644 --- a/libs/assets/gfxworld.h +++ b/libs/assets/gfxworld.h @@ -3,7 +3,7 @@ #include "gfximage.h" #include "gfxlightdef.h" -#include "model.h" +#include "xmodel.h" struct GfxStreamingAabbTree { diff --git a/libs/assets/localizeentry.cpp b/libs/assets/localizeentry.cpp deleted file mode 100644 index 868eed5..0000000 --- a/libs/assets/localizeentry.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "localizeentry.h" diff --git a/libs/assets/localizeentry.h b/libs/assets/localizeentry.h deleted file mode 100644 index 22f4191..0000000 --- a/libs/assets/localizeentry.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef LOCALIZEENTRY_H -#define LOCALIZEENTRY_H - -#include - -struct p_LocalizeEntry -{ - const char *value; - const char *name; -}; - -struct LocalizeEntry : p_LocalizeEntry -{ - QString value; - QString name; -}; - -#endif // LOCALIZEENTRY_H diff --git a/libs/assets/model.cpp b/libs/assets/model.cpp deleted file mode 100644 index 0e1234c..0000000 --- a/libs/assets/model.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "model.h" diff --git a/libs/assets/rawfile.cpp b/libs/assets/rawfile.cpp deleted file mode 100644 index 24cee05..0000000 --- a/libs/assets/rawfile.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "rawfile.h" diff --git a/libs/assets/rawfile.h b/libs/assets/rawfile.h deleted file mode 100644 index 9ee915d..0000000 --- a/libs/assets/rawfile.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef RAWFILE_H -#define RAWFILE_H - -#include - -struct RawFile -{ - qint32 namePtr; - QString name; - - quint32 length; - - qint32 bufferPtr; - QByteArray buffer; -}; - -#endif // RAWFILE_H diff --git a/libs/assets/sounddriver.cpp b/libs/assets/sounddriver.cpp deleted file mode 100644 index 1366a91..0000000 --- a/libs/assets/sounddriver.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "sounddriver.h" diff --git a/libs/assets/sounddriver.h b/libs/assets/sounddriver.h deleted file mode 100644 index 46cb9d0..0000000 --- a/libs/assets/sounddriver.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef SoundDriver_H -#define SoundDriver_H - -#include - -struct XAUDIOREVERBSETTINGS -{ - unsigned int ReflectionsDelay; - unsigned __int8 ReverbDelay; - unsigned __int8 RearDelay; - unsigned __int8 PositionLeft; - unsigned __int8 PositionRight; - unsigned __int8 PositionMatrixLeft; - unsigned __int8 PositionMatrixRight; - unsigned __int8 EarlyDiffusion; - unsigned __int8 LateDiffusion; - unsigned __int8 LowEQGain; - unsigned __int8 LowEQCutoff; - unsigned __int8 HighEQGain; - unsigned __int8 HighEQCutoff; - float RoomFilterFreq; - float RoomFilterMain; - float RoomFilterHF; - float ReflectionsGain; - float ReverbGain; - float DecayTime; - float Density; - float RoomSize; -}; - -struct XaReverbSettings -{ - int presetOverridden; - XAUDIOREVERBSETTINGS reverbSettings; -}; - -struct SoundDriver -{ - qint32 namePtr; - QString name; - - qint32 reverbPtr; - XaReverbSettings *reverbSettings; -}; - -#endif // SoundDriver_H diff --git a/libs/assets/stringtable.cpp b/libs/assets/stringtable.cpp deleted file mode 100644 index 3e29574..0000000 --- a/libs/assets/stringtable.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "stringtable.h" diff --git a/libs/assets/stringtable.h b/libs/assets/stringtable.h deleted file mode 100644 index 0e1280e..0000000 --- a/libs/assets/stringtable.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef STRINGTABLESH_H -#define STRINGTABLESH_H - -#include -#include - -struct StringTable -{ - qint32 namePtr; - QString name; - - int columnCount; - int rowCount; - - qint32 valuesPtr; - QStringList values; -}; - -#endif // STRINGTABLESH_H diff --git a/libs/assets/weapondef.h b/libs/assets/weapondef.h index 59f8067..7dbeea4 100644 --- a/libs/assets/weapondef.h +++ b/libs/assets/weapondef.h @@ -3,7 +3,7 @@ #include "clipmap.h" #include "soundalias.h" -#include "model.h" +#include "xmodel.h" enum WeaponType : __int32 { diff --git a/libs/assets/xasset.cpp b/libs/assets/xasset.cpp new file mode 100644 index 0000000..fe92e39 --- /dev/null +++ b/libs/assets/xasset.cpp @@ -0,0 +1,28 @@ +#include "xasset.h" + +XAsset::XAsset() + : mPtr(0) { + +} + +XAsset::~XAsset() +{ + +} + +void XAsset::SetPtr(qint32 aPtr) { + mPtr = aPtr; +} + +qint32 XAsset::GetPtr() { + return mPtr; +} + +void XAsset::ParsePtr(QDataStream *aStream, bool aDataFlag) { + *aStream >> mPtr; + + if (aDataFlag && mPtr == -1) + { + ParseData(aStream); + } +} diff --git a/libs/assets/xasset.h b/libs/assets/xasset.h new file mode 100644 index 0000000..7e2c550 --- /dev/null +++ b/libs/assets/xasset.h @@ -0,0 +1,24 @@ +#ifndef XASSET_H +#define XASSET_H + +#include + +class XAsset +{ + +public: + XAsset(); + virtual ~XAsset(); + + void SetPtr(qint32 aPtr); + qint32 GetPtr(); + + virtual void Clear(); + virtual void ParsePtr(QDataStream *aStream, bool aDataFlag = true); + virtual void ParseData(QDataStream *aStream) = 0; + +private: + qint32 mPtr; +}; + +#endif // XASSET_H diff --git a/libs/assets/xaudioformatinfo.cpp b/libs/assets/xaudioformatinfo.cpp new file mode 100644 index 0000000..93dbcce --- /dev/null +++ b/libs/assets/xaudioformatinfo.cpp @@ -0,0 +1,21 @@ +#include "xaudioformatinfo.h" + +XAudioFormatInfo::XAudioFormatInfo() +{ + +} + +XAudioFormatInfo::~XAudioFormatInfo() +{ + +} + +void XAudioFormatInfo::ParseData(QDataStream *aStream) +{ + +} + +void XAudioFormatInfo::Clear() +{ + +} diff --git a/libs/assets/xaudioformatinfo.h b/libs/assets/xaudioformatinfo.h new file mode 100644 index 0000000..c5ba96e --- /dev/null +++ b/libs/assets/xaudioformatinfo.h @@ -0,0 +1,21 @@ +#ifndef XAUDIOFORMATINFO_H +#define XAUDIOFORMATINFO_H + +#include "xasset.h" + +class XAudioXmaFormat; + +class XAudioFormatInfo : public XAsset +{ +public: + XAudioFormatInfo(); + ~XAudioFormatInfo(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + QVector mStream; +}; + +#endif // XAUDIOFORMATINFO_H diff --git a/libs/assets/xaudiopacketaligned.cpp b/libs/assets/xaudiopacketaligned.cpp new file mode 100644 index 0000000..a8426d1 --- /dev/null +++ b/libs/assets/xaudiopacketaligned.cpp @@ -0,0 +1,21 @@ +#include "xsoundfile.h" + +XSoundFile::XSoundFile() +{ + +} + +XSoundFile::~XSoundFile() +{ + +} + +void XSoundFile::ParseData(QDataStream *aStream) +{ + +} + +void XSoundFile::Clear() +{ + +} diff --git a/libs/assets/xaudiopacketaligned.h b/libs/assets/xaudiopacketaligned.h new file mode 100644 index 0000000..b401d97 --- /dev/null +++ b/libs/assets/xaudiopacketaligned.h @@ -0,0 +1,25 @@ +#ifndef XAUDIOPACKETALIGNED_H +#define XAUDIOPACKETALIGNED_H + +#include "xasset.h" + +class XAudioXmaLoopRegion; + +class XAudioPacketAligned : public XAsset +{ +public: + XAudioPacketAligned(); + ~XAudioPacketAligned(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + QByteArray mBuffer; + quint32 mBufferSize; + quint32 mLoopCount; + QVector aXmaLoop; + char* mContext; +}; + +#endif // XAUDIOPACKETALIGNED_H diff --git a/libs/assets/xaudioreverbsettings.cpp b/libs/assets/xaudioreverbsettings.cpp new file mode 100644 index 0000000..a317a1d --- /dev/null +++ b/libs/assets/xaudioreverbsettings.cpp @@ -0,0 +1,49 @@ +#include "xaudioreverbsettings.h" + +XAudioReverbSettings::XAudioReverbSettings() + : XAsset() + , mPresetOverridden(0) + , mReverbSettings(new XReverbSettings()) +{ + +} + +void XAudioReverbSettings::Clear() +{ + mPresetOverridden = 0; + mReverbSettings->Clear(); +} + +int XAudioReverbSettings::GetPresetOverridden() const +{ + return mPresetOverridden; +} + +XReverbSettings* XAudioReverbSettings::GetReverbSettings() const +{ + return mReverbSettings; +} + +void XAudioReverbSettings::ParseData(QDataStream *aStream) +{ + if (GetPtr()) + { + *aStream + >> mPresetOverridden; + + if (mReverbSettings != nullptr) + { + mReverbSettings->ParseData(aStream); + } + } +} + +void XAudioReverbSettings::SetPresetOverridden(int aPresetOveridden) +{ + mPresetOverridden = aPresetOveridden; +} + +void XAudioReverbSettings::SetReverbSettings(XReverbSettings* aReverbSettings) +{ + mReverbSettings = aReverbSettings; +} diff --git a/libs/assets/xaudioreverbsettings.h b/libs/assets/xaudioreverbsettings.h new file mode 100644 index 0000000..f73ecb6 --- /dev/null +++ b/libs/assets/xaudioreverbsettings.h @@ -0,0 +1,26 @@ +#ifndef XAUDIOREVERBSETTINGS_H +#define XAUDIOREVERBSETTINGS_H + +#include "xasset.h" +#include "xreverbsettings.h" + +class XAudioReverbSettings : public XAsset +{ +public: + XAudioReverbSettings(); + + int GetPresetOverridden() const; + void SetPresetOverridden(int aPresetOveridden); + + XReverbSettings* GetReverbSettings() const; + void SetReverbSettings(XReverbSettings* aReverbSettings); + + virtual void Clear() override; + virtual void ParseData(QDataStream *aStream) override; + +private: + int mPresetOverridden; + XReverbSettings* mReverbSettings; +}; + +#endif // XAUDIOREVERBSETTINGS_H diff --git a/libs/assets/xaudioseektable.cpp b/libs/assets/xaudioseektable.cpp new file mode 100644 index 0000000..13c82e2 --- /dev/null +++ b/libs/assets/xaudioseektable.cpp @@ -0,0 +1,21 @@ +#include "xaudioseektable.h" + +XAudioSeekTable::XAudioSeekTable() +{ + +} + +XAudioSeekTable::~XAudioSeekTable() +{ + +} + +void XAudioSeekTable::ParseData(QDataStream *aStream) +{ + +} + +void XAudioSeekTable::Clear() +{ + +} diff --git a/libs/assets/xaudioseektable.h b/libs/assets/xaudioseektable.h new file mode 100644 index 0000000..16e2b3d --- /dev/null +++ b/libs/assets/xaudioseektable.h @@ -0,0 +1,22 @@ +#ifndef XAUDIOSEEKTABLE_H +#define XAUDIOSEEKTABLE_H + +#include "xasset.h" + +class XSoundFileRef; + +class XAudioSeekTable : public XAsset +{ +public: + XAudioSeekTable(); + ~XAudioSeekTable(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + int mSize; + QByteArray mData; +}; + +#endif // XAUDIOSEEKTABLE_H diff --git a/libs/assets/xaudiosound.cpp b/libs/assets/xaudiosound.cpp new file mode 100644 index 0000000..3a0da6c --- /dev/null +++ b/libs/assets/xaudiosound.cpp @@ -0,0 +1,21 @@ +#include "xaudiosound.h" + +XAudioSound::XAudioSound() +{ + +} + +XAudioSound::~XAudioSound() +{ + +} + +void XAudioSound::ParseData(QDataStream *aStream) +{ + +} + +void XAudioSound::Clear() +{ + +} diff --git a/libs/assets/xaudiosound.h b/libs/assets/xaudiosound.h new file mode 100644 index 0000000..230e1b5 --- /dev/null +++ b/libs/assets/xaudiosound.h @@ -0,0 +1,27 @@ +#ifndef XAUDIOSOUND_H +#define XAUDIOSOUND_H + +#include "xasset.h" +#include "xaudiopacketaligned.h" +#include "xaudioseektable.h" + +class XAudioSourceFormat; +class XAudioXmaDataInfo; + +class XAudioSound : public XAsset +{ +public: + XAudioSound(); + ~XAudioSound(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + XAudioPacketAligned* mPacket; + XAudioSourceFormat* mFormat; + XAudioXmaDataInfo* mXmaDataInfo; + XAudioSeekTable *mSeekTable; +}; + +#endif // XAUDIOSOUND_H diff --git a/libs/assets/xaudiosourceformat.cpp b/libs/assets/xaudiosourceformat.cpp new file mode 100644 index 0000000..d61b89f --- /dev/null +++ b/libs/assets/xaudiosourceformat.cpp @@ -0,0 +1,21 @@ +#include "xaudiosourceformat.h" + +XAudioSourceFormat::XAudioSourceFormat() +{ + +} + +XAudioSourceFormat::~XAudioSourceFormat() +{ + +} + +void XAudioSourceFormat::ParseData(QDataStream *aStream) +{ + +} + +void XAudioSourceFormat::Clear() +{ + +} diff --git a/libs/assets/xaudiosourceformat.h b/libs/assets/xaudiosourceformat.h new file mode 100644 index 0000000..3ba8223 --- /dev/null +++ b/libs/assets/xaudiosourceformat.h @@ -0,0 +1,24 @@ +#ifndef XAUDIOSOURCEFORMAT_H +#define XAUDIOSOURCEFORMAT_H + +#include "xasset.h" +#include "xaudioformatinfo.h" + +class XAudioStreamInfo; + +class XAudioSourceFormat : public XAsset +{ +public: + XAudioSourceFormat(); + ~XAudioSourceFormat(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + quint8 mSampleType; + XAudioStreamInfo* mStreamInfo; + XAudioFormatInfo* mAudioFormatInfo; +}; + +#endif // XAUDIOSOURCEFORMAT_H diff --git a/libs/assets/xaudiostreaminfo.cpp b/libs/assets/xaudiostreaminfo.cpp new file mode 100644 index 0000000..46bf5ec --- /dev/null +++ b/libs/assets/xaudiostreaminfo.cpp @@ -0,0 +1,21 @@ +#include "xaudiostreaminfo.h" + +XAudioStreamInfo::XAudioStreamInfo() +{ + +} + +XAudioStreamInfo::~XAudioStreamInfo() +{ + +} + +void XAudioStreamInfo::ParseData(QDataStream *aStream) +{ + +} + +void XAudioStreamInfo::Clear() +{ + +} diff --git a/libs/assets/xaudiostreaminfo.h b/libs/assets/xaudiostreaminfo.h new file mode 100644 index 0000000..856d12d --- /dev/null +++ b/libs/assets/xaudiostreaminfo.h @@ -0,0 +1,22 @@ +#ifndef XAUDIOSTREAMINFO_H +#define XAUDIOSTREAMINFO_H + +#include "xasset.h" + +class XSoundFileRef; + +class XAudioStreamInfo : public XAsset +{ +public: + XAudioStreamInfo(); + ~XAudioStreamInfo(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + quint8 mNumStreams; + quint8 mChannelCount; +}; + +#endif // XAUDIOSTREAMINFO_H diff --git a/libs/assets/xaudioxmadatainfo.cpp b/libs/assets/xaudioxmadatainfo.cpp new file mode 100644 index 0000000..056b772 --- /dev/null +++ b/libs/assets/xaudioxmadatainfo.cpp @@ -0,0 +1,21 @@ +#include "xaudioxmadatainfo.h" + +XAudioXmaDataInfo::XAudioXmaDataInfo() +{ + +} + +XAudioXmaDataInfo::~XAudioXmaDataInfo() +{ + +} + +void XAudioXmaDataInfo::ParseData(QDataStream *aStream) +{ + +} + +void XAudioXmaDataInfo::Clear() +{ + +} diff --git a/libs/assets/xaudioxmadatainfo.h b/libs/assets/xaudioxmadatainfo.h new file mode 100644 index 0000000..24b8e57 --- /dev/null +++ b/libs/assets/xaudioxmadatainfo.h @@ -0,0 +1,21 @@ +#ifndef XAUDIOXMADATAINFO_H +#define XAUDIOXMADATAINFO_H + +#include "xasset.h" + +class XSoundFileRef; + +class XAudioXmaDataInfo : public XAsset +{ +public: + XAudioXmaDataInfo(); + ~XAudioXmaDataInfo(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + int mTotalMsec; +}; + +#endif // XAUDIOXMADATAINFO_H diff --git a/libs/assets/xaudioxmaformat.cpp b/libs/assets/xaudioxmaformat.cpp new file mode 100644 index 0000000..2fcfdb0 --- /dev/null +++ b/libs/assets/xaudioxmaformat.cpp @@ -0,0 +1,21 @@ +#include "xaudioxmaformat.h" + +XAudioXmaFormat::XAudioXmaFormat() +{ + +} + +XAudioXmaFormat::~XAudioXmaFormat() +{ + +} + +void XAudioXmaFormat::ParseData(QDataStream *aStream) +{ + +} + +void XAudioXmaFormat::Clear() +{ + +} diff --git a/libs/assets/xaudioxmaformat.h b/libs/assets/xaudioxmaformat.h new file mode 100644 index 0000000..ec6b145 --- /dev/null +++ b/libs/assets/xaudioxmaformat.h @@ -0,0 +1,21 @@ +#ifndef XAUDIOXMAFORMAT_H +#define XAUDIOXMAFORMAT_H + +#include "xasset.h" + +class XAudioXmaFormat : public XAsset +{ +public: + XAudioXmaFormat(); + ~XAudioXmaFormat(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + unsigned int mSampleRate; + quint8 mChannelCount; + quint8 mDecodeBufferSize; +}; + +#endif // XAUDIOXMAFORMAT_H diff --git a/libs/assets/xaudioxmaloopregion.cpp b/libs/assets/xaudioxmaloopregion.cpp new file mode 100644 index 0000000..a8426d1 --- /dev/null +++ b/libs/assets/xaudioxmaloopregion.cpp @@ -0,0 +1,21 @@ +#include "xsoundfile.h" + +XSoundFile::XSoundFile() +{ + +} + +XSoundFile::~XSoundFile() +{ + +} + +void XSoundFile::ParseData(QDataStream *aStream) +{ + +} + +void XSoundFile::Clear() +{ + +} diff --git a/libs/assets/xaudioxmaloopregion.h b/libs/assets/xaudioxmaloopregion.h new file mode 100644 index 0000000..5616abd --- /dev/null +++ b/libs/assets/xaudioxmaloopregion.h @@ -0,0 +1,23 @@ +#ifndef XSOUNDFILE_H +#define XSOUNDFILE_H + +#include "xasset.h" + +class XSoundFileRef; + +class XSoundFile : public XAsset +{ +public: + XSoundFile(); + ~XSoundFile(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + quint8 mType; + quint8 mExists; + XSoundFileRef* mRef; +}; + +#endif // XSOUNDFILE_H diff --git a/libs/assets/xeditfielddefinition.cpp b/libs/assets/xeditfielddefinition.cpp new file mode 100644 index 0000000..989300e --- /dev/null +++ b/libs/assets/xeditfielddefinition.cpp @@ -0,0 +1,118 @@ +#include "xeditfielddefinition.h" + +XEditFieldDefinition::XEditFieldDefinition() + : XAsset() + , mMinVal(0) + , mMaxVal(0) + , mDefVal(0) + , mRange(0) + , mMaxChars(0) + , mMaxCharsGotoNext(0) + , mMaxPaintChars(0) + , mPaintOffset(0) +{} + +float XEditFieldDefinition::GetMinVal() const +{ + return mMinVal; +} + +float XEditFieldDefinition::GetMaxVal() const +{ + return mMaxVal; +} + +float XEditFieldDefinition::GetDefVal() const +{ + return mDefVal; +} + +float XEditFieldDefinition::GetRange() const +{ + return mRange; +} + +int XEditFieldDefinition::GetMaxChars() const +{ + return mMaxChars; +} + +int XEditFieldDefinition::GetMaxCharsGotoNext() const +{ + return mMaxCharsGotoNext; +} + +int XEditFieldDefinition::GetMaxPaintChars() const +{ + return mMaxPaintChars; +} + +int XEditFieldDefinition::GetPaintOffset() const +{ + return mPaintOffset; +} + +void XEditFieldDefinition::ParseData(QDataStream *aStream) +{ + *aStream + >> mMinVal + >> mMaxVal + >> mDefVal + >> mRange + >> mMaxChars + >> mMaxCharsGotoNext + >> mMaxPaintChars + >> mPaintOffset; +} + +void XEditFieldDefinition::Clear() +{ + mMinVal = 0; + mMaxVal = 0; + mDefVal = 0; + mRange = 0; + mMaxChars = 0; + mMaxCharsGotoNext = 0; + mMaxPaintChars = 0; + mPaintOffset = 0; +} + +void XEditFieldDefinition::SetMinVal(float aMinVal) +{ + mMinVal = aMinVal; +} + +void XEditFieldDefinition::SetMaxVal(float aMaxVal) +{ + mMaxVal = aMaxVal; +} + +void XEditFieldDefinition::SetDefVal(float aDefVal) +{ + mDefVal = aDefVal; +} + +void XEditFieldDefinition::SetRange(float aRange) +{ + mRange = aRange; +} + +void XEditFieldDefinition::SetMaxChars(int aMaxChars) +{ + mMaxChars = aMaxChars; +} + +void XEditFieldDefinition::SetMaxCharsGotoNext(int aMaxCharsGotoNext) +{ + mMaxCharsGotoNext = aMaxCharsGotoNext; +} + +void XEditFieldDefinition::SetMaxPaintChars(int aMaxPaintChars) +{ + mMaxPaintChars = aMaxPaintChars; +} + +void XEditFieldDefinition::SetPaintOffset(int aPaintOffset) +{ + mPaintOffset = aPaintOffset; +} diff --git a/libs/assets/xeditfielddefinition.h b/libs/assets/xeditfielddefinition.h new file mode 100644 index 0000000..0cc6029 --- /dev/null +++ b/libs/assets/xeditfielddefinition.h @@ -0,0 +1,49 @@ +#ifndef XEDITFIELDDEFINITION_H +#define XEDITFIELDDEFINITION_H + +#include "xasset.h" + +class XEditFieldDefinition : public XAsset +{ +public: + XEditFieldDefinition(); + + float GetMinVal() const; + void SetMinVal(float aMinVal); + + float GetMaxVal() const; + void SetMaxVal(float aMaxVal); + + float GetDefVal() const; + void SetDefVal(float aDefVal); + + float GetRange() const; + void SetRange(float aRange); + + int GetMaxChars() const; + void SetMaxChars(int aMaxChars); + + int GetMaxCharsGotoNext() const; + void SetMaxCharsGotoNext(int aMaxCharsGotoNext); + + int GetMaxPaintChars() const; + void SetMaxPaintChars(int aMaxPaintChars); + + int GetPaintOffset() const; + void SetPaintOffset(int aPaintOffset); + + virtual void ParseData(QDataStream* aStream); + virtual void Clear(); + +private: + float mMinVal; + float mMaxVal; + float mDefVal; + float mRange; + int mMaxChars; + int mMaxCharsGotoNext; + int mMaxPaintChars; + int mPaintOffset; +}; + +#endif // XEDITFIELDDEFINITION_H diff --git a/libs/assets/xloadedsound.cpp b/libs/assets/xloadedsound.cpp new file mode 100644 index 0000000..a8426d1 --- /dev/null +++ b/libs/assets/xloadedsound.cpp @@ -0,0 +1,21 @@ +#include "xsoundfile.h" + +XSoundFile::XSoundFile() +{ + +} + +XSoundFile::~XSoundFile() +{ + +} + +void XSoundFile::ParseData(QDataStream *aStream) +{ + +} + +void XSoundFile::Clear() +{ + +} diff --git a/libs/assets/xloadedsound.h b/libs/assets/xloadedsound.h new file mode 100644 index 0000000..f62c4db --- /dev/null +++ b/libs/assets/xloadedsound.h @@ -0,0 +1,24 @@ +#ifndef XLOADEDSOUND_H +#define XLOADEDSOUND_H + +#include "xasset.h" +#include "xaudiosound.h" +#include "xstring.h" + +class XSoundFileRef; + +class XLoadedSound : public XAsset +{ +public: + XLoadedSound(); + ~XLoadedSound(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + XString* mName; + XAudioSound* mSound; +}; + +#endif // XLOADEDSOUND_H diff --git a/libs/assets/xlocalizeentry.cpp b/libs/assets/xlocalizeentry.cpp new file mode 100644 index 0000000..2cf6294 --- /dev/null +++ b/libs/assets/xlocalizeentry.cpp @@ -0,0 +1,60 @@ +#include "xlocalizeentry.h" + +XLocalizeEntry::XLocalizeEntry() + : XAsset() + , mValue(new XString()) + , mName(new XString()) +{ + +} + +XLocalizeEntry::~XLocalizeEntry() +{ + delete mValue; + delete mName; +} + +XString* XLocalizeEntry::GetValue() const +{ + return mValue; +} + +XString* XLocalizeEntry::GetName() const +{ + return mName; +} + +void XLocalizeEntry::Clear() +{ + mValue->Clear(); + mName->Clear(); +} + +void XLocalizeEntry::ParseData(QDataStream *aStream) +{ + mValue->ParsePtr(aStream, false); + mName->ParsePtr(aStream, false); + + mValue->ParseData(aStream); + mName->ParseData(aStream); +} + +void XLocalizeEntry::SetValue(XString* aValue) +{ + mValue = aValue; +} + +void XLocalizeEntry::SetValue(QString aValue) +{ + mValue->SetString(aValue); +} + +void XLocalizeEntry::SetName(XString* aName) +{ + mName = aName; +} + +void XLocalizeEntry::SetName(QString aName) +{ + mName->SetString(aName); +} diff --git a/libs/assets/xlocalizeentry.h b/libs/assets/xlocalizeentry.h new file mode 100644 index 0000000..3d28fb7 --- /dev/null +++ b/libs/assets/xlocalizeentry.h @@ -0,0 +1,30 @@ +#ifndef XLOCALIZEENTRY_H +#define XLOCALIZEENTRY_H + +#include "xasset.h" +#include "xstring.h" + +class XLocalizeEntry : public XAsset +{ + +public: + XLocalizeEntry(); + ~XLocalizeEntry(); + + void SetValue(XString* aValue); + void SetValue(QString aValue); + XString* GetValue() const; + + void SetName(XString* aName); + void SetName(QString aName); + XString* GetName() const; + + virtual void Clear() override; + virtual void ParseData(QDataStream *aStream) override; + +private: + XString* mValue; + XString* mName; +}; + +#endif // XLOCALIZEENTRY_H diff --git a/libs/assets/xmapents.cpp b/libs/assets/xmapents.cpp new file mode 100644 index 0000000..026fcc7 --- /dev/null +++ b/libs/assets/xmapents.cpp @@ -0,0 +1,7 @@ +#include "xmapents.h" + +XMapEnts::XMapEnts() + : XAsset() +{ + +} diff --git a/libs/assets/xmapents.h b/libs/assets/xmapents.h new file mode 100644 index 0000000..e894a1b --- /dev/null +++ b/libs/assets/xmapents.h @@ -0,0 +1,15 @@ +#ifndef XMAPENTS_H +#define XMAPENTS_H + +#include "xasset.h" + +class XMapEnts : public XAsset +{ +public: + XMapEnts(); + +private: + +}; + +#endif // XMAPENTS_H diff --git a/libs/assets/xmodel.cpp b/libs/assets/xmodel.cpp new file mode 100644 index 0000000..bff897d --- /dev/null +++ b/libs/assets/xmodel.cpp @@ -0,0 +1,207 @@ +#include "xmodel.h" + +XModel::XModel() + : XAsset() { + +} + +void XModel::ParseData(QDataStream *aStream) { + qint32 namePtr, boneNamesPtr; + + const char *name; + unsigned __int8 numBones; + unsigned __int8 numRootBones; + unsigned __int8 numsurfs; + unsigned __int8 lodRampType; + unsigned __int16 *boneNames; + unsigned __int8 *parentList; + __int16 *quats; + float *trans; + unsigned __int8 *partClassification; + DObjAnimMat *baseMat; + XSurface *surfs; + Material **materialHandles; + XModelLodInfo lodInfo[4]; + XModelCollSurf_s *collSurfs; + int numCollSurfs; + int contents; + XBoneInfo *boneInfo; + float radius; + float mins[3]; + float maxs[3]; + __int16 numLods; + __int16 collLod; + XModelStreamInfo streamInfo; + int memUsage; + unsigned __int8 flags; + PhysPreset *physPreset; + PhysGeomList *physGeoms; + + *aStream + >> namePtr; + + mName = Load_XString(aStream); + if (boneNamesPtr == -1) + { + Load_ScriptStringArray(1, numBones); + } + if ( parentList ) + { + if ( parentList == (unsigned __int8 *)-1 ) + { + v5 = g_streamPos; + v6 = v1->numBones - v1->numRootBones; + varbyte = g_streamPos; + v1->parentList = g_streamPos; + Load_Stream(1, v5, v6); + v1 = varXModel; + } + else + { + v1->parentList = &(*(unsigned __int8 **)((char *)&g_streamBlocks->data + + (((unsigned int)(v1->parentList - 1) >> 26) & 0x38)))[(int)(v1->parentList - 1) & 0x1FFFFFFF]; + } + } + quats = v1->quats; + if ( quats ) + { + if ( quats == (__int16 *)-1 ) + { + v8 = (unsigned __int8 *)((unsigned int)(g_streamPos + 1) & 0xFFFFFFFE); + v9 = 8 * (v1->numBones - v1->numRootBones); + g_streamPos = v8; + v1->quats = (__int16 *)v8; + varshort = (__int16 *)v8; + Load_Stream(1, v8, v9); + v1 = varXModel; + } + else + { + v1->quats = (__int16 *)&(*(unsigned __int8 **)((char *)&g_streamBlocks->data + + ((((unsigned int)v1->quats - 1) >> 26) & 0x38)))[((int)v1->quats - 1) & 0x1FFFFFFF]; + } + } + trans = v1->trans; + if ( trans ) + { + if ( trans == (float *)-1 ) + { + v11 = (unsigned __int8 *)((unsigned int)(g_streamPos + 3) & 0xFFFFFFFC); + v12 = 16 * (v1->numBones - v1->numRootBones); + g_streamPos = v11; + v1->trans = (float *)v11; + varfloat = (float *)v11; + Load_Stream(1, v11, v12); + v1 = varXModel; + } + else + { + v1->trans = (float *)&(*(unsigned __int8 **)((char *)&g_streamBlocks->data + + ((((unsigned int)v1->trans - 1) >> 26) & 0x38)))[((int)v1->trans - 1) & 0x1FFFFFFF]; + } + } + partClassification = v1->partClassification; + if ( partClassification ) + { + if ( partClassification == (unsigned __int8 *)-1 ) + { + v14 = g_streamPos; + v15 = v1->numBones; + varbyte = g_streamPos; + v1->partClassification = g_streamPos; + Load_Stream(1, v14, v15); + v1 = varXModel; + } + else + { + v1->partClassification = &(*(unsigned __int8 **)((char *)&g_streamBlocks->data + + (((unsigned int)(v1->partClassification - 1) >> 26) & 0x38)))[(int)(v1->partClassification - 1) & 0x1FFFFFFF]; + } + } + baseMat = v1->baseMat; + if ( baseMat ) + { + if ( baseMat == (DObjAnimMat *)-1 ) + { + v17 = __ROL4__(v1->numBones, 5); + v18 = (unsigned __int8 *)((unsigned int)(g_streamPos + 3) & 0xFFFFFFFC); + g_streamPos = v18; + varDObjAnimMat = (DObjAnimMat *)v18; + v1->baseMat = (DObjAnimMat *)v18; + Load_Stream(1, v18, v17); + v1 = varXModel; + } + else + { + v1->baseMat = (DObjAnimMat *)&(*(unsigned __int8 **)((char *)&g_streamBlocks->data + + ((((unsigned int)&v1->baseMat[-1].transWeight + 3) >> 26) & 0x38)))[((int)&v1->baseMat[-1].transWeight + 3) & 0x1FFFFFFF]; + } + } + if ( v1->surfs ) + { + numsurfs = v1->numsurfs; + g_streamPos = (unsigned __int8 *)((unsigned int)(g_streamPos + 3) & 0xFFFFFFFC); + varXSurface = (XSurface *)g_streamPos; + v1->surfs = (XSurface *)g_streamPos; + Load_XSurfaceArray(1, numsurfs); + v1 = varXModel; + } + if ( v1->materialHandles ) + { + v20 = v1->numsurfs; + g_streamPos = (unsigned __int8 *)((unsigned int)(g_streamPos + 3) & 0xFFFFFFFC); + varMaterialHandle = (Material **)g_streamPos; + v1->materialHandles = (Material **)g_streamPos; + Load_MaterialHandleArray(1, v20); + v1 = varXModel; + } + if ( v1->collSurfs ) + { + numCollSurfs = v1->numCollSurfs; + g_streamPos = (unsigned __int8 *)((unsigned int)(g_streamPos + 3) & 0xFFFFFFFC); + varXModelCollSurf = (XModelCollSurf_s *)g_streamPos; + v1->collSurfs = (XModelCollSurf_s *)g_streamPos; + Load_XModelCollSurfArray(1, numCollSurfs); + v1 = varXModel; + } + if ( v1->boneInfo ) + { + v22 = v1->numBones; + v23 = (unsigned __int8 *)((unsigned int)(g_streamPos + 3) & 0xFFFFFFFC); + v1->boneInfo = (XBoneInfo *)v23; + g_streamPos = v23; + varXBoneInfo = (XBoneInfo *)v23; + Load_Stream(1, v23, 8 * (v22 + __ROL4__(v22, 2))); + v1 = varXModel; + } + varXModelStreamInfo = &v1->streamInfo; + Load_Stream(0, &v1->streamInfo, 4u); + if ( varXModelStreamInfo->highMipBounds ) + { + v24 = (XModelHighMipBounds *)((unsigned int)(g_streamPos + 3) & 0xFFFFFFFC); + varXModelStreamInfo->highMipBounds = v24; + varXModelHighMipBounds = v24; + g_streamPos = (unsigned __int8 *)v24; + Load_Stream(1, v24, 8 * (varXModel->lodInfo[0].numsurfs + __ROL4__(varXModel->lodInfo[0].numsurfs, 1))); + } + varPhysPresetPtr = &varXModel->physPreset; + Load_PhysPresetPtr(0); + physGeoms = varXModel->physGeoms; + if ( physGeoms ) + { + if ( physGeoms == (PhysGeomList *)-1 ) + { + g_streamPos = (unsigned __int8 *)((unsigned int)(g_streamPos + 3) & 0xFFFFFFFC); + varPhysGeomList = (PhysGeomList *)g_streamPos; + varXModel->physGeoms = (PhysGeomList *)g_streamPos; + Load_PhysGeomList(1); + DB_PopStreamPos(); + return; + } + varXModel->physGeoms = (PhysGeomList *)&(*(unsigned __int8 **)((char *)&g_streamBlocks->data + + ((((unsigned int)&varXModel->physGeoms[-1].mass.productsOfInertia[2] + + 3) >> 26) & 0x38)))[((int)&varXModel->physGeoms[-1].mass.productsOfInertia[2] + + 3) & 0x1FFFFFFF]; + } + DB_PopStreamPos(); +} diff --git a/libs/assets/model.h b/libs/assets/xmodel.h similarity index 92% rename from libs/assets/model.h rename to libs/assets/xmodel.h index 956b846..69ccb13 100644 --- a/libs/assets/model.h +++ b/libs/assets/xmodel.h @@ -1,5 +1,5 @@ -#ifndef MODEL_H -#define MODEL_H +#ifndef XMODEL_H +#define XMODEL_H #include "material.h" #include "scriptstringlist.h" @@ -239,64 +239,44 @@ struct PhysGeomList PhysMass mass; }; -struct Model +#include "xasset.h" + +class XModel : public XAsset { - QString name; - qint32 namePtr; +public: + explicit XModel(); + + void ParseData(QDataStream *aStream) override; + +private: + QString mName; quint8 numBones; quint8 numRootBones; quint8 numsurfs; quint8 lodRampType; - - quint32 boneNamesPtr; ScriptStringList boneNames; - - quint32 parentListPtr; quint8 *parentList; - - qint32 quatsPtr; qint16 *quats; - - qint32 transPtr; float *trans; - - qint32 partClassPtr; quint8 *partClassification; - - qint32 baseMatPtr; DObjAnimMat *baseMat; - - qint32 surfsPtr; XSurface *surfs; - - qint32 matHandlesPtr; Material **materialHandles; - XModelLodInfo lodInfo[4]; - - qint32 collSurfsPtr; XModelCollSurf *collSurfs; - int numCollSurfs; int contents; - - qint32 boneInfoPtr; XBoneInfo *boneInfo; - float radius; float mins[3]; float maxs[3]; - qint16 numLods; qint16 collLod; - XModelStreamInfo streamInfo; int memUsage; quint8 flags; std::shared_ptr physPreset; - - qint32 physGeomsPtr; PhysGeomList *physGeoms; }; -#endif // MODEL_H +#endif // XMODEL_H diff --git a/libs/assets/xrawfile.cpp b/libs/assets/xrawfile.cpp new file mode 100644 index 0000000..7b70215 --- /dev/null +++ b/libs/assets/xrawfile.cpp @@ -0,0 +1,92 @@ +#include "xrawfile.h" + +XRawFile::XRawFile() + : XAsset() + , mName(new XString()) + , mLength(0) + , mBuffer() +{ + +} + +XRawFile::~XRawFile() +{ + delete mName; +} + +void XRawFile::SetName(XString* aName) +{ + if (aName == nullptr) + { + return; + } + + mName = aName; +} +void XRawFile::SetName(const QString& aName) +{ + if (mName == nullptr) + { + mName = new XString(); + } + + mName->SetString(aName); +} + +XString* XRawFile::Name() const +{ + return mName; +} + +void XRawFile::SetLength(int aLength) +{ + mBuffer = mBuffer.chopped(aLength); + mLength = aLength; +} + +int XRawFile::Length() const +{ + return mLength; +} + +void XRawFile::SetBuffer(const QByteArray& aBuffer) +{ + mBuffer = aBuffer; + mLength = mBuffer.length(); +} + +QByteArray XRawFile::Buffer() const +{ + return mBuffer; +} + +void XRawFile::Clear() +{ + mName->Clear(); + mLength = 0; + mBuffer = QByteArray(); + + XAsset::Clear(); +} + +void XRawFile::ParseData(QDataStream *aStream) +{ + mName->ParsePtr(aStream, false); + + qint32 bufferPtr; + *aStream + >> mLength + >> bufferPtr; + + if (mName == nullptr) + { + mName = new XString(); + } + mName->ParseData(aStream); + + if (bufferPtr) + { + mBuffer = QByteArray(mLength + 1, Qt::Uninitialized); + aStream->readRawData(mBuffer.data(), mLength + 1); + } +} diff --git a/libs/assets/xrawfile.h b/libs/assets/xrawfile.h new file mode 100644 index 0000000..938b5c6 --- /dev/null +++ b/libs/assets/xrawfile.h @@ -0,0 +1,32 @@ +#ifndef XRAWFILE_H +#define XRAWFILE_H + +#include "xasset.h" +#include "xstring.h" + +class XRawFile : public XAsset +{ +public: + XRawFile(); + ~XRawFile(); + + void SetName(XString* aName = nullptr); + void SetName(const QString& aName); + XString* Name() const; + + void SetLength(int aLength); + int Length() const; + + void SetBuffer(const QByteArray& aBuffer); + QByteArray Buffer() const; + + virtual void Clear() override; + virtual void ParseData(QDataStream *aStream) override; + +private: + XString* mName; + quint32 mLength; + QByteArray mBuffer; +}; + +#endif // XRAWFILE_H diff --git a/libs/assets/xreverbsettings.cpp b/libs/assets/xreverbsettings.cpp new file mode 100644 index 0000000..1885893 --- /dev/null +++ b/libs/assets/xreverbsettings.cpp @@ -0,0 +1,292 @@ +#include "xreverbsettings.h" + +XReverbSettings::XReverbSettings() + : XAsset() + , mReflectionsDelay(0) + , mReverbDelay(0) + , mRearDelay(0) + , mPositionLeft(0) + , mPositionRight(0) + , mPositionMatrixLeft(0) + , mPositionMatrixRight(0) + , mEarlyDiffusion(0) + , mLateDiffusion(0) + , mLowEQGain(0) + , mLowEQCutoff(0) + , mHighEQGain(0) + , mHighEQCutoff(0) + , mRoomFilterFreq(0.0) + , mRoomFilterMain(0.0) + , mRoomFilterHF(0.0) + , mReflectionsGain(0.0) + , mReverbGain(0.0) + , mDecayTime(0.0) + , mDensity(0.0) + , mRoomSize(0.0) +{ + +} + +quint32 XReverbSettings::GetReflectionsDelay() const +{ + return mReflectionsDelay; +} + +quint8 XReverbSettings::GetReverbDelay() const +{ + return mReverbDelay; +} + +quint8 XReverbSettings::GetRearDelay() const +{ + return mRearDelay; +} + +quint8 XReverbSettings::GetPositionLeft() const +{ + return mPositionLeft; +} + +quint8 XReverbSettings::GetPositionRight() const +{ + return mPositionRight; +} + +quint8 XReverbSettings::GetPositionMatrixLeft() const +{ + return mPositionMatrixLeft; +} + +quint8 XReverbSettings::GetPositionMatrixRight() const +{ + return mPositionMatrixRight; +} + +quint8 XReverbSettings::GetEarlyDiffusion() const +{ + return mEarlyDiffusion; +} + +quint8 XReverbSettings::GetLateDiffusion() const +{ + return mLateDiffusion; +} + +quint8 XReverbSettings::GetLowEQGain() const +{ + return mLowEQGain; +} + +quint8 XReverbSettings::GetLowEQCutoff() const +{ + return mLowEQCutoff; +} + +quint8 XReverbSettings::GetHighEQGain() const +{ + return mHighEQGain; +} + +quint8 XReverbSettings::GetHighEQCutoff() const +{ + return mHighEQCutoff; +} + +float XReverbSettings::GetRoomFilterFreq() const +{ + return mRoomFilterFreq; +} + +float XReverbSettings::GetRoomFilterMain() const +{ + return mRoomFilterMain; +} + +float XReverbSettings::GetRoomFilterHF() const +{ + return mRoomFilterHF; +} + +float XReverbSettings::GetReflectionsGain() const +{ + return mReflectionsGain; +} + +float XReverbSettings::GetReverbGain() const +{ + return mReverbGain; +} + +float XReverbSettings::GetDecayTime() const +{ + return mDecayTime; +} + +float XReverbSettings::GetDensity() const +{ + return mDensity; +} + +float XReverbSettings::GetRoomSize() const +{ + return mRoomSize; +} + +void XReverbSettings::Clear() +{ + mReflectionsDelay = 0; + mReverbDelay = 0; + mRearDelay = 0; + mPositionLeft = 0; + mPositionRight = 0; + mPositionMatrixLeft = 0; + mPositionMatrixRight = 0; + mEarlyDiffusion = 0; + mLateDiffusion = 0; + mLowEQGain = 0; + mLowEQCutoff = 0; + mHighEQGain = 0; + mHighEQCutoff = 0; + mRoomFilterFreq = 0.0; + mRoomFilterMain = 0.0; + mRoomFilterHF = 0.0; + mReflectionsGain = 0.0; + mReverbGain = 0.0; + mDecayTime = 0.0; + mDensity = 0.0; + mRoomSize = 0.0; + + XAsset::Clear(); +} + +void XReverbSettings::ParseData(QDataStream* aStream) +{ + *aStream + >> mReflectionsDelay + >> mReverbDelay + >> mRearDelay + >> mPositionLeft + >> mPositionRight + >> mPositionMatrixLeft + >> mPositionMatrixRight + >> mEarlyDiffusion + >> mLateDiffusion + >> mLowEQGain + >> mLowEQCutoff + >> mHighEQGain + >> mHighEQCutoff + >> mRoomFilterFreq + >> mRoomFilterMain + >> mRoomFilterHF + >> mReflectionsGain + >> mReverbGain + >> mDecayTime + >> mDensity + >> mRoomSize; +} + +void XReverbSettings::SetReflectionsDelay(quint32 aReflectionsDelay) +{ + mReflectionsDelay = aReflectionsDelay; +} + +void XReverbSettings::SetReverbDelay(quint8 aReverbDelay) +{ + mReverbDelay = aReverbDelay; +} + +void XReverbSettings::SetRearDelay(quint8 aRearDelay) +{ + mRearDelay = aRearDelay; +} + +void XReverbSettings::SetPositionLeft(quint8 aPositionLeft) +{ + mPositionLeft = aPositionLeft; +} + +void XReverbSettings::SetPositionRight(quint8 aPositionRight) +{ + mPositionRight = aPositionRight; +} + +void XReverbSettings::SetPositionMatrixLeft(quint8 aPositionMatrixLeft) +{ + mPositionMatrixLeft = aPositionMatrixLeft; +} + +void XReverbSettings::SetPositionMatrixRight(quint8 aPositionMatrixRight) +{ + mPositionMatrixRight = aPositionMatrixRight; +} + +void XReverbSettings::SetEarlyDiffusion(quint8 aEarlyDiffusion) +{ + mEarlyDiffusion = aEarlyDiffusion; +} + +void XReverbSettings::SetLateDiffusion(quint8 aLateDiffusion) +{ + mLateDiffusion = aLateDiffusion; +} + +void XReverbSettings::SetLowEQGain(quint8 aLowEQGain) +{ + mLowEQGain = aLowEQGain; +} + +void XReverbSettings::SetLowEQCutoff(quint8 aLowEQCutoff) +{ + mLowEQCutoff = aLowEQCutoff; +} + +void XReverbSettings::SetHighEQGain(quint8 aHighEQGain) +{ + mHighEQGain = aHighEQGain; +} + +void XReverbSettings::SetHighEQCutoff(quint8 aHighEQCutoff) +{ + mHighEQCutoff = aHighEQCutoff; +} + +void XReverbSettings::SetRoomFilterFreq(float aRoomFilterFreq) +{ + mRoomFilterFreq = aRoomFilterFreq; +} + +void XReverbSettings::SetRoomFilterMain(float aRoomFilterMain) +{ + mRoomFilterMain = aRoomFilterMain; +} + +void XReverbSettings::SetRoomFilterHF(float aRoomFilterHF) +{ + mRoomFilterHF = aRoomFilterHF; +} + +void XReverbSettings::SetReflectionsGain(float aReflectionsGain) +{ + mReflectionsGain = aReflectionsGain; +} + +void XReverbSettings::SetReverbGain(float aReverbGain) +{ + mReverbGain = aReverbGain; +} + +void XReverbSettings::SetDecayTime(float aDecayTime) +{ + mDecayTime = aDecayTime; +} + +void XReverbSettings::SetDensity(float aDensity) +{ + mDensity = aDensity; +} + +void XReverbSettings::SetRoomSize(float aRoomSize) +{ + mRoomSize = aRoomSize; +} + diff --git a/libs/assets/xreverbsettings.h b/libs/assets/xreverbsettings.h new file mode 100644 index 0000000..e6d0921 --- /dev/null +++ b/libs/assets/xreverbsettings.h @@ -0,0 +1,83 @@ +#ifndef XREVERBSETTINGS_H +#define XREVERBSETTINGS_H + +#include "xasset.h" + +class XReverbSettings : public XAsset +{ +public: + explicit XReverbSettings(); + + quint32 GetReflectionsDelay() const; + quint8 GetReverbDelay() const; + quint8 GetRearDelay() const; + quint8 GetPositionLeft() const; + quint8 GetPositionRight() const; + quint8 GetPositionMatrixLeft() const; + quint8 GetPositionMatrixRight() const; + quint8 GetEarlyDiffusion() const; + quint8 GetLateDiffusion() const; + quint8 GetLowEQGain() const; + quint8 GetLowEQCutoff() const; + quint8 GetHighEQGain() const; + quint8 GetHighEQCutoff() const; + float GetRoomFilterFreq() const; + float GetRoomFilterMain() const; + float GetRoomFilterHF() const; + float GetReflectionsGain() const; + float GetReverbGain() const; + float GetDecayTime() const; + float GetDensity() const; + float GetRoomSize() const; + + virtual void Clear() override; + virtual void ParseData(QDataStream* aStream) override; + +public slots: + void SetReflectionsDelay(quint32 aReflectionsDelay); + void SetReverbDelay(quint8 aReverbDelay); + void SetRearDelay(quint8 aRearDelay); + void SetPositionLeft(quint8 aPositionLeft); + void SetPositionRight(quint8 aPositionRight); + void SetPositionMatrixLeft(quint8 aPositionMatrixLeft); + void SetPositionMatrixRight(quint8 aPositionMatrixRight); + void SetEarlyDiffusion(quint8 aEarlyDiffusion); + void SetLateDiffusion(quint8 aLateDiffusion); + void SetLowEQGain(quint8 aLowEQGain); + void SetLowEQCutoff(quint8 aLowEQCutoff); + void SetHighEQGain(quint8 aHighEQGain); + void SetHighEQCutoff(quint8 aHighEQCutoff); + void SetRoomFilterFreq(float aRoomFilterFreq); + void SetRoomFilterMain(float aRoomFilterMain); + void SetRoomFilterHF(float aRoomFilterHF); + void SetReflectionsGain(float aReflectionsGain); + void SetReverbGain(float aReverbGain); + void SetDecayTime(float aDecayTime); + void SetDensity(float aDensity); + void SetRoomSize(float aRoomSize); + +private: + quint32 mReflectionsDelay; + quint8 mReverbDelay; + quint8 mRearDelay; + quint8 mPositionLeft; + quint8 mPositionRight; + quint8 mPositionMatrixLeft; + quint8 mPositionMatrixRight; + quint8 mEarlyDiffusion; + quint8 mLateDiffusion; + quint8 mLowEQGain; + quint8 mLowEQCutoff; + quint8 mHighEQGain; + quint8 mHighEQCutoff; + float mRoomFilterFreq; + float mRoomFilterMain; + float mRoomFilterHF; + float mReflectionsGain; + float mReverbGain; + float mDecayTime; + float mDensity; + float mRoomSize; +}; + +#endif // XREVERBSETTINGS_H diff --git a/libs/assets/xsoundalias.cpp b/libs/assets/xsoundalias.cpp new file mode 100644 index 0000000..bbdff35 --- /dev/null +++ b/libs/assets/xsoundalias.cpp @@ -0,0 +1,16 @@ +#include "xsoundalias.h" + +XSoundAlias::XSoundAlias() +{ + +} + +void XSoundAlias::Clear() +{ + +} + +void XSoundAlias::ParseData(QDataStream *aStream) +{ + +} diff --git a/libs/assets/xsoundalias.h b/libs/assets/xsoundalias.h new file mode 100644 index 0000000..82ea1d7 --- /dev/null +++ b/libs/assets/xsoundalias.h @@ -0,0 +1,42 @@ +#ifndef XSOUNDALIAS_H +#define XSOUNDALIAS_H + +#include "xasset.h" +#include "xstring.h" + +class XSoundAlias : public XAsset +{ +public: + XSoundAlias(); + + virtual void Clear() override; + virtual void ParseData(QDataStream* aStream) override; + +private: + XString* mAliasName; + XString* mSubtitle; + XString* mSecondaryAliasName; + XString* mChainAliasName; + XSoundFile* mSoundFile; + int mSequence; + float mVolMin; + float mVolMax; + float mPitchMin; + float mPitchMax; + float mDistMin; + float mDistMax; + int mFlags; + float mSlavePercentage; + float mProbability; + float mLfePercentage; + float mCenterPercentage; + int mStartDelay; + XSoundCurve* mVolumeFalloffCurve; + float mEnvelopMin; + float mEnvelopMax; + float mEnvelopPercentage; + XSpeakerMap* mSpeakerMap; + +}; + +#endif // XSOUNDALIAS_H diff --git a/libs/assets/xsounddriverglobals.cpp b/libs/assets/xsounddriverglobals.cpp new file mode 100644 index 0000000..5db6de8 --- /dev/null +++ b/libs/assets/xsounddriverglobals.cpp @@ -0,0 +1,33 @@ +#include "xsounddriverglobals.h" + +XSoundDriverGlobals::XSoundDriverGlobals() + : XAsset() + , mAudioReverbSettings(new XAudioReverbSettings()) + , mName(new XString()) +{ + +} + +XSoundDriverGlobals::~XSoundDriverGlobals() +{ + delete mAudioReverbSettings; + delete mName; +} + +void XSoundDriverGlobals::Clear() +{ + mAudioReverbSettings->Clear(); + mName->Clear(); +} + +void XSoundDriverGlobals::ParseData(QDataStream* aStream) +{ + if (GetPtr()) + { + mAudioReverbSettings->ParsePtr(aStream, false); + mName->ParsePtr(aStream, false); + + mAudioReverbSettings->ParseData(aStream); + mName->ParseData(aStream); + } +} diff --git a/libs/assets/xsounddriverglobals.h b/libs/assets/xsounddriverglobals.h new file mode 100644 index 0000000..c09ff85 --- /dev/null +++ b/libs/assets/xsounddriverglobals.h @@ -0,0 +1,22 @@ +#ifndef SoundDriver_H +#define SoundDriver_H + +#include "xasset.h" +#include "xaudioreverbsettings.h" +#include "xstring.h" + +class XSoundDriverGlobals : public XAsset +{ +public: + XSoundDriverGlobals(); + ~XSoundDriverGlobals(); + + virtual void Clear() override; + virtual void ParseData(QDataStream* aStream) override; + +private: + XAudioReverbSettings *mAudioReverbSettings; + XString *mName; +}; + +#endif // SoundDriver_H diff --git a/libs/assets/xsoundfile.cpp b/libs/assets/xsoundfile.cpp new file mode 100644 index 0000000..a8426d1 --- /dev/null +++ b/libs/assets/xsoundfile.cpp @@ -0,0 +1,21 @@ +#include "xsoundfile.h" + +XSoundFile::XSoundFile() +{ + +} + +XSoundFile::~XSoundFile() +{ + +} + +void XSoundFile::ParseData(QDataStream *aStream) +{ + +} + +void XSoundFile::Clear() +{ + +} diff --git a/libs/assets/xsoundfile.h b/libs/assets/xsoundfile.h new file mode 100644 index 0000000..5616abd --- /dev/null +++ b/libs/assets/xsoundfile.h @@ -0,0 +1,23 @@ +#ifndef XSOUNDFILE_H +#define XSOUNDFILE_H + +#include "xasset.h" + +class XSoundFileRef; + +class XSoundFile : public XAsset +{ +public: + XSoundFile(); + ~XSoundFile(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + quint8 mType; + quint8 mExists; + XSoundFileRef* mRef; +}; + +#endif // XSOUNDFILE_H diff --git a/libs/assets/xsoundfileref.cpp b/libs/assets/xsoundfileref.cpp new file mode 100644 index 0000000..3492026 --- /dev/null +++ b/libs/assets/xsoundfileref.cpp @@ -0,0 +1,3 @@ +#include "xsoundfileref.h" + +XSoundFileRef::XSoundFileRef() {} diff --git a/libs/assets/xsoundfileref.h b/libs/assets/xsoundfileref.h new file mode 100644 index 0000000..04895ea --- /dev/null +++ b/libs/assets/xsoundfileref.h @@ -0,0 +1,12 @@ +#ifndef XSOUNDFILEREF_H +#define XSOUNDFILEREF_H + +#include "xasset.h" + +class XSoundFileRef : public XAsset +{ +public: + XSoundFileRef(); +}; + +#endif // XSOUNDFILEREF_H diff --git a/libs/assets/xstreamedsound.cpp b/libs/assets/xstreamedsound.cpp new file mode 100644 index 0000000..a1631c5 --- /dev/null +++ b/libs/assets/xstreamedsound.cpp @@ -0,0 +1,21 @@ +#include "xstreamedsound.h" + +XStreamedSound::XStreamedSound() +{ + +} + +XStreamedSound::~XStreamedSound() +{ + +} + +void XStreamedSound::ParseData(QDataStream *aStream) +{ + +} + +void XStreamedSound::Clear() +{ + +} diff --git a/libs/assets/xstreamedsound.h b/libs/assets/xstreamedsound.h new file mode 100644 index 0000000..1e13010 --- /dev/null +++ b/libs/assets/xstreamedsound.h @@ -0,0 +1,21 @@ +#ifndef XSTREAMEDSOUND_H +#define XSTREAMEDSOUND_H + +#include "xasset.h" + +class XStreamedFileName; + +class XStreamedSound : public XAsset +{ +public: + XStreamedSound(); + ~XStreamedSound(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + XStreamedFileName* mStreamed; +}; + +#endif // XSTREAMEDSOUND_H diff --git a/libs/assets/xstreamfileinfo.cpp b/libs/assets/xstreamfileinfo.cpp new file mode 100644 index 0000000..ffff9ac --- /dev/null +++ b/libs/assets/xstreamfileinfo.cpp @@ -0,0 +1,21 @@ +#include "xstreamfileinfo.h" + +XStreamFileInfo::XStreamFileInfo() +{ + +} + +XStreamFileInfo::~XStreamFileInfo() +{ + +} + +void XStreamFileInfo::Clear() +{ + +} + +void XStreamFileInfo::ParseData(QDataStream *aStream) +{ + +} diff --git a/libs/assets/xstreamfileinfo.h b/libs/assets/xstreamfileinfo.h new file mode 100644 index 0000000..a835fc4 --- /dev/null +++ b/libs/assets/xstreamfileinfo.h @@ -0,0 +1,21 @@ +#ifndef XSTREAMFILEINFO_H +#define XSTREAMFILEINFO_H + +#include "xasset.h" + +class XStreamFileName; + +class XStreamFileInfo : public XAsset +{ +public: + XStreamFileInfo(); + ~XStreamFileInfo(); + + virtual void Clear() override; + virtual void ParseData(QDataStream* aStream) override; + +private: + XStreamFileName* mStream; +}; + +#endif // XSTREAMFILEINFO_H diff --git a/libs/assets/xstreamfilename.cpp b/libs/assets/xstreamfilename.cpp new file mode 100644 index 0000000..e64d637 --- /dev/null +++ b/libs/assets/xstreamfilename.cpp @@ -0,0 +1,21 @@ +#include "xstreamfileinfo.h" + +XStreamFileInfo::XStreamFileInfo() +{ + +} + +XStreamFileInfo::~XStreamFileInfo() +{ + +} + +void XStreamFileInfo::ParseData(QDataStream *aStream) +{ + +} + +void XStreamFileInfo::Clear() +{ + +} diff --git a/libs/assets/xstreamfilename.h b/libs/assets/xstreamfilename.h new file mode 100644 index 0000000..7e3d02e --- /dev/null +++ b/libs/assets/xstreamfilename.h @@ -0,0 +1,23 @@ +#ifndef XSTREAMFILEINFO_H +#define XSTREAMFILEINFO_H + +#include "xasset.h" + +class XStreamFileNameRaw; +class XStreamFileNamePacked; + +class XStreamFileInfo : public XAsset +{ +public: + XStreamFileInfo(); + ~XStreamFileInfo(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + XStreamFileNameRaw *mRaw; + XStreamFileNamePacked *mPacked; +}; + +#endif // XSTREAMFILEINFO_H diff --git a/libs/assets/xstreamfilenamepacked.cpp b/libs/assets/xstreamfilenamepacked.cpp new file mode 100644 index 0000000..1dcfdc3 --- /dev/null +++ b/libs/assets/xstreamfilenamepacked.cpp @@ -0,0 +1,21 @@ +#include "xstreamfilenamepacked.h" + +XStreamFileNamePacked::XStreamFileNamePacked() +{ + +} + +XStreamFileNamePacked::~XStreamFileNamePacked() +{ + +} + +void XStreamFileNamePacked::ParseData(QDataStream *aStream) +{ + +} + +void XStreamFileNamePacked::Clear() +{ + +} diff --git a/libs/assets/xstreamfilenamepacked.h b/libs/assets/xstreamfilenamepacked.h new file mode 100644 index 0000000..1a3d4f4 --- /dev/null +++ b/libs/assets/xstreamfilenamepacked.h @@ -0,0 +1,22 @@ +#ifndef XSTREAMFILENAMEPACKED_H +#define XSTREAMFILENAMEPACKED_H + +#include "xasset.h" + +class XSoundFileRef; + +class XStreamFileNamePacked : public XAsset +{ +public: + XStreamFileNamePacked(); + ~XStreamFileNamePacked(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + unsigned int mOffset; + unsigned int mLength; +}; + +#endif // XSTREAMFILENAMEPACKED_H diff --git a/libs/assets/xstreamfilenameraw.cpp b/libs/assets/xstreamfilenameraw.cpp new file mode 100644 index 0000000..0a2c246 --- /dev/null +++ b/libs/assets/xstreamfilenameraw.cpp @@ -0,0 +1,21 @@ +#include "xstreamfilenameraw.h" + +XStreamFileNameRaw::XStreamFileNameRaw() +{ + +} + +XStreamFileNameRaw::~XStreamFileNameRaw() +{ + +} + +void XStreamFileNameRaw::ParseData(QDataStream *aStream) +{ + +} + +void XStreamFileNameRaw::Clear() +{ + +} diff --git a/libs/assets/xstreamfilenameraw.h b/libs/assets/xstreamfilenameraw.h new file mode 100644 index 0000000..8bddd7f --- /dev/null +++ b/libs/assets/xstreamfilenameraw.h @@ -0,0 +1,21 @@ +#ifndef XSTREAMFILENAMERAW_H +#define XSTREAMFILENAMERAW_H + +#include "xasset.h" +#include "xstring.h" + +class XStreamFileNameRaw : public XAsset +{ +public: + XStreamFileNameRaw(); + ~XStreamFileNameRaw(); + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +private: + XString* mDir; + XString* mName; +}; + +#endif // XSTREAMFILENAMERAW_H diff --git a/libs/assets/xstring.cpp b/libs/assets/xstring.cpp new file mode 100644 index 0000000..9ab0093 --- /dev/null +++ b/libs/assets/xstring.cpp @@ -0,0 +1,67 @@ +#include "xstring.h" + +XString::XString() + : XAsset() + , mString("") +{ + +} + +XString::~XString() +{ + +} + +QString XString::GetString() const +{ + return mString; +} + +void XString::SetString(const QString& aString) +{ + mString = aString; +} + +QString XString::ParseCustom(QDataStream *aStream) +{ + QString result; + char currentChar; + + *aStream >> currentChar; + while (currentChar != '\0') + { + result += currentChar; + + *aStream >> currentChar; + } + return result; +} + +XStringArray* XString::ParseArray(QDataStream *aStream, int aCount) +{ + XStringArray* result = new XStringArray(); + + for (int i = 0; i < aCount; i++) + { + XString* string = new XString(); + string->ParseCustom(aStream); + + result->append(string); + } + + return result; +} + +void XString::Clear() +{ + mString = ""; +} + +void XString::ParseData(QDataStream *aStream) +{ + if (GetPtr() == -1) + { + mString = ParseCustom(aStream); + } +} + diff --git a/libs/assets/xstring.h b/libs/assets/xstring.h new file mode 100644 index 0000000..1bd1b07 --- /dev/null +++ b/libs/assets/xstring.h @@ -0,0 +1,29 @@ +#ifndef XSTRING_H +#define XSTRING_H + +#include +#include "xasset.h" + +class XString; +typedef QVector XStringArray; + +class XString : public XAsset +{ +public: + XString(); + virtual ~XString() override; + + void SetString(const QString& aString); + QString GetString() const; + + static QString ParseCustom(QDataStream* aStream); + static XStringArray* ParseArray(QDataStream* aStream, int aCount); + + virtual void Clear() override; + virtual void ParseData(QDataStream* aStream) override; + +private: + QString mString; +}; + +#endif // XSTRING_H diff --git a/libs/assets/xstringtable.cpp b/libs/assets/xstringtable.cpp new file mode 100644 index 0000000..1b5abc4 --- /dev/null +++ b/libs/assets/xstringtable.cpp @@ -0,0 +1,95 @@ +#include "xstringtable.h" +#include "xstring.h" + +XStringTable::XStringTable() + : XAsset() + , mName(new XString()) + , mValues(new XStringArray()) + , mColumnCount(0) + , mRowCount(0) { + +} + +XStringTable::~XStringTable() +{ + delete mName; + + for (int i = 0; i < mValues->size(); i++) + { + delete mValues->at(i); + } +} + +void XStringTable::SetName(XString *aName) { + if (aName == nullptr) + { + return; + } + + mName = aName; +} + +void XStringTable::SetName(const QString aName) { + mName->SetString(aName); +} + +XString *XStringTable::GetName() const { + return mName; +} + +void XStringTable::SetValues(XStringArray* aValues) { + mValues = aValues; +} + +XStringArray* XStringTable::GetValues() const { + return mValues; +} + +void XStringTable::SetColumnCount(int aColumnCount) { + mColumnCount = aColumnCount; +} + +int XStringTable::GetColumnCount() const { + return mColumnCount; +} + +void XStringTable::SetRowCount(int aRowCount) { + mRowCount = aRowCount; +} + +int XStringTable::GetRowCount() const { + return mRowCount; +} + +void XStringTable::Clear() +{ + mName->Clear(); + + for (int i = 0; i < mValues->size(); i++) + { + delete mValues->at(i); + } + mValues->clear(); + + mColumnCount = 0; + mRowCount = 0; + + XAsset::Clear(); +} + +void XStringTable::ParseData(QDataStream *aStream) { + qint32 valuesPtr; + + mName->ParsePtr(aStream, false); + + *aStream + >> mColumnCount + >> mRowCount + >> valuesPtr; + + mName->ParseData(aStream); + if (valuesPtr) + { + mValues = XString::ParseArray(aStream, mRowCount * mColumnCount); + } +} diff --git a/libs/assets/xstringtable.h b/libs/assets/xstringtable.h new file mode 100644 index 0000000..3682026 --- /dev/null +++ b/libs/assets/xstringtable.h @@ -0,0 +1,35 @@ +#ifndef STRINGTABLESH_H +#define STRINGTABLESH_H + +#include "xasset.h" +#include "xstring.h" + +class XStringTable : public XAsset +{ +public: + XStringTable(); + ~XStringTable(); + + XString* GetName() const; + XStringArray* GetValues() const; + int GetColumnCount() const; + int GetRowCount() const; + + virtual void ParseData(QDataStream* aStream) override; + virtual void Clear() override; + +public slots: + void SetName(QString aName); + void SetName(XString* aName); + void SetValues(XStringArray *aValues); + void SetColumnCount(int aColumnCount); + void SetRowCount(int aRowCount); + +private: + XString* mName; + XStringArray* mValues; + int mColumnCount; + int mRowCount; +}; + +#endif // STRINGTABLESH_H diff --git a/libs/compression/compression.pro b/libs/compression/compression.pro index 3bb3af9..47b337a 100644 --- a/libs/compression/compression.pro +++ b/libs/compression/compression.pro @@ -3,15 +3,8 @@ TEMPLATE = lib CONFIG += staticlib c++17 DEFINES += MINILZO_USE_STATIC -SOURCES += \ - compression.cpp \ - minilzo.c \ - lzoconf.h \ - lzodefs.h - -HEADERS += \ - compression.h \ - minilzo.h +SOURCES += $$files($$PWD/*.cpp, true) +HEADERS += $$files($$PWD/*.h, true) LIBS += \ -L$$PWD/../../third_party/xbox_sdk/lib -lxcompress64 \ diff --git a/libs/core/core.pro b/libs/core/core.pro index 16bc396..21730ec 100644 --- a/libs/core/core.pro +++ b/libs/core/core.pro @@ -2,23 +2,7 @@ QT += core widgets TEMPLATE = lib CONFIG += staticlib c++17 -SOURCES += \ - highlighter_cfg.cpp \ - highlighter_shock.cpp \ - highlighter_rumble.cpp \ - highlighter_gsc.cpp \ - logmanager.cpp \ - statusbarmanager.cpp - -HEADERS += \ - enums.h \ - highlighter_cfg.h \ - highlighter_shock.h \ - highlighter_rumble.h \ - highlighter_gsc.h \ - logmanager.h \ - stringutils.h \ - utils.h \ - statusbarmanager.h +SOURCES += $$files($$PWD/*.cpp, true) +HEADERS += $$files($$PWD/*.h, true) DESTDIR = $$OUT_PWD/../ diff --git a/libs/ddsfile/ddsfile.pro b/libs/ddsfile/ddsfile.pro index 10fbb3c..98a74fc 100644 --- a/libs/ddsfile/ddsfile.pro +++ b/libs/ddsfile/ddsfile.pro @@ -2,13 +2,8 @@ QT += core TEMPLATE = lib CONFIG += staticlib c++17 -SOURCES += \ - ddsfile.cpp - -HEADERS += \ - dds_structs.h \ - ddsfile.h \ - enums.h +SOURCES += $$files($$PWD/*.cpp, true) +HEADERS += $$files($$PWD/*.h, true) LIBS += \ -L$$PWD/../../third_party/devil_sdk/lib/ -lDevIL \ diff --git a/libs/encryption/encryption.pro b/libs/encryption/encryption.pro index d923b34..0610081 100644 --- a/libs/encryption/encryption.pro +++ b/libs/encryption/encryption.pro @@ -2,20 +2,8 @@ QT += core TEMPLATE = lib CONFIG += staticlib c++17 -SOURCES += \ - salsa20.cpp \ - sha1.cpp \ - encryption.cpp - -HEADERS += \ - ecrypt-config.h \ - ecrypt-machine.h \ - ecrypt-portable.h \ - ecrypt-sync.h \ - encryption.h \ - os_types.h \ - config_win32.h \ - sha1.h +SOURCES += $$files($$PWD/*.cpp, true) +HEADERS += $$files($$PWD/*.h, true) app.depends += \ compression diff --git a/libs/fastfile/fastfile.pro b/libs/fastfile/fastfile.pro index 65e2fe8..2a49b54 100644 --- a/libs/fastfile/fastfile.pro +++ b/libs/fastfile/fastfile.pro @@ -2,90 +2,8 @@ QT += core widgets TEMPLATE = lib CONFIG += staticlib c++17 -SOURCES += \ - # Base class & factory - fastfile.cpp \ - # 360 classes - 360/fastfile_cod2_360.cpp \ - 360/fastfile_cod4_360.cpp \ - 360/fastfile_cod5_360.cpp \ - 360/fastfile_cod6_360.cpp \ - 360/fastfile_cod7_360.cpp \ - 360/fastfile_cod8_360.cpp \ - 360/fastfile_cod9_360.cpp \ - 360/fastfile_cod10_360.cpp \ - 360/fastfile_cod11_360.cpp \ - 360/fastfile_cod12_360.cpp \ - # PS3 classes - PS3/fastfile_cod4_ps3.cpp \ - PS3/fastfile_cod5_ps3.cpp \ - PS3/fastfile_cod6_ps3.cpp \ - PS3/fastfile_cod7_ps3.cpp \ - PS3/fastfile_cod8_ps3.cpp \ - PS3/fastfile_cod9_ps3.cpp \ - PS3/fastfile_cod10_ps3.cpp \ - PS3/fastfile_cod11_ps3.cpp \ - PS3/fastfile_cod12_ps3.cpp \ - # PC classes - PC/fastfile_cod4_pc.cpp \ - PC/fastfile_cod5_pc.cpp \ - PC/fastfile_cod6_pc.cpp \ - PC/fastfile_cod7_pc.cpp \ - PC/fastfile_cod8_pc.cpp \ - PC/fastfile_cod9_pc.cpp \ - PC/fastfile_cod10_pc.cpp \ - PC/fastfile_cod11_pc.cpp \ - PC/fastfile_cod12_pc.cpp \ - # Wii Classes - Wii/fastfile_cod4_wii.cpp \ - Wii/fastfile_cod7_wii.cpp \ - Wii/fastfile_cod8_wii.cpp \ - # WiiU Classes - WiiU/fastfile_cod9_wiiu.cpp \ - WiiU/fastfile_cod10_wiiu.cpp - -HEADERS += \ - # Base class & factory - fastfile.h \ - fastfile_factory.h \ - # 360 classes - 360/fastfile_cod2_360.h \ - 360/fastfile_cod4_360.h \ - 360/fastfile_cod5_360.h \ - 360/fastfile_cod6_360.h \ - 360/fastfile_cod7_360.h \ - 360/fastfile_cod8_360.h \ - 360/fastfile_cod9_360.h \ - 360/fastfile_cod10_360.h \ - 360/fastfile_cod11_360.h \ - 360/fastfile_cod12_360.h \ - # PS3 classes - PS3/fastfile_cod4_ps3.h \ - PS3/fastfile_cod5_ps3.h \ - PS3/fastfile_cod6_ps3.h \ - PS3/fastfile_cod7_ps3.h \ - PS3/fastfile_cod8_ps3.h \ - PS3/fastfile_cod9_ps3.h \ - PS3/fastfile_cod10_ps3.h \ - PS3/fastfile_cod11_ps3.h \ - PS3/fastfile_cod12_ps3.h \ - # PC classes - PC/fastfile_cod4_pc.h \ - PC/fastfile_cod5_pc.h \ - PC/fastfile_cod6_pc.h \ - PC/fastfile_cod7_pc.h \ - PC/fastfile_cod8_pc.h \ - PC/fastfile_cod9_pc.h \ - PC/fastfile_cod10_pc.h \ - PC/fastfile_cod11_pc.h \ - PC/fastfile_cod12_pc.h \ - # Wii Classes - Wii/fastfile_cod4_wii.h \ - Wii/fastfile_cod7_wii.h \ - Wii/fastfile_cod8_wii.h \ - # WiiU classes - WiiU/fastfile_cod9_wiiu.h \ - WiiU/fastfile_cod10_wiiu.h +SOURCES += $$files($$PWD/*.cpp, true) +HEADERS += $$files($$PWD/*.h, true) LIBS += \ -L$$OUT_PWD/../libs/core -lcore \ diff --git a/libs/ipakfile/ipakfile.pro b/libs/ipakfile/ipakfile.pro index 73422b6..bdbd2c6 100644 --- a/libs/ipakfile/ipakfile.pro +++ b/libs/ipakfile/ipakfile.pro @@ -2,10 +2,7 @@ QT += core TEMPLATE = lib CONFIG += staticlib c++17 -SOURCES += \ - ipakfile.cpp - -HEADERS += \ - ipak_structs.h +SOURCES += $$files($$PWD/*.cpp, true) +HEADERS += $$files($$PWD/*.h, true) DESTDIR = $$OUT_PWD/../ diff --git a/libs/iwifile/iwifile.pro b/libs/iwifile/iwifile.pro index 9c972c3..800219c 100644 --- a/libs/iwifile/iwifile.pro +++ b/libs/iwifile/iwifile.pro @@ -2,11 +2,8 @@ QT += core TEMPLATE = lib CONFIG += staticlib c++17 -SOURCES += \ - iwifile.cpp - -HEADERS += \ - iwifile.h +SOURCES += $$files($$PWD/*.cpp, true) +HEADERS += $$files($$PWD/*.h, true) LIBS += \ -L$$PWD/../../third_party/devil_sdk/lib/ -lDevIL \ diff --git a/libs/zonefile/zonefile.pro b/libs/zonefile/zonefile.pro index 208f5a1..18394fd 100644 --- a/libs/zonefile/zonefile.pro +++ b/libs/zonefile/zonefile.pro @@ -2,89 +2,8 @@ QT += core widgets TEMPLATE = lib CONFIG += staticlib c++17 -SOURCES += \ - # Base class - zonefile.cpp \ - # 360 classes - 360/zonefile_cod2_360.cpp \ - 360/zonefile_cod4_360.cpp \ - 360/zonefile_cod5_360.cpp \ - 360/zonefile_cod6_360.cpp \ - 360/zonefile_cod7_360.cpp \ - 360/zonefile_cod8_360.cpp \ - 360/zonefile_cod9_360.cpp \ - 360/zonefile_cod10_360.cpp \ - 360/zonefile_cod11_360.cpp \ - 360/zonefile_cod12_360.cpp \ - # PS3 classes - PS3/zonefile_cod4_ps3.cpp \ - PS3/zonefile_cod5_ps3.cpp \ - PS3/zonefile_cod6_ps3.cpp \ - PS3/zonefile_cod7_ps3.cpp \ - PS3/zonefile_cod8_ps3.cpp \ - PS3/zonefile_cod9_ps3.cpp \ - PS3/zonefile_cod10_ps3.cpp \ - PS3/zonefile_cod11_ps3.cpp \ - PS3/zonefile_cod12_ps3.cpp \ - # PC classes - PC/zonefile_cod4_pc.cpp \ - PC/zonefile_cod5_pc.cpp \ - PC/zonefile_cod6_pc.cpp \ - PC/zonefile_cod7_pc.cpp \ - PC/zonefile_cod8_pc.cpp \ - PC/zonefile_cod9_pc.cpp \ - PC/zonefile_cod10_pc.cpp \ - PC/zonefile_cod11_pc.cpp \ - PC/zonefile_cod12_pc.cpp \ - # Wii classes - Wii/zonefile_cod4_wii.cpp \ - Wii/zonefile_cod7_wii.cpp \ - Wii/zonefile_cod8_wii.cpp \ - # WiiU classes - WiiU/zonefile_cod9_wiiu.cpp \ - WiiU/zonefile_cod10_wiiu.cpp - -HEADERS += \ - # Base class - zonefile.h \ - # 360 classes - 360/zonefile_cod2_360.h \ - 360/zonefile_cod4_360.h \ - 360/zonefile_cod5_360.h \ - 360/zonefile_cod6_360.h \ - 360/zonefile_cod7_360.h \ - 360/zonefile_cod8_360.h \ - 360/zonefile_cod9_360.h \ - 360/zonefile_cod10_360.h \ - 360/zonefile_cod11_360.h \ - 360/zonefile_cod12_360.h \ - # PS3 classes - PS3/zonefile_cod4_ps3.h \ - PS3/zonefile_cod5_ps3.h \ - PS3/zonefile_cod6_ps3.h \ - PS3/zonefile_cod7_ps3.h \ - PS3/zonefile_cod8_ps3.h \ - PS3/zonefile_cod9_ps3.h \ - PS3/zonefile_cod10_ps3.h \ - PS3/zonefile_cod11_ps3.h \ - PS3/zonefile_cod12_ps3.h \ - # PC classes - PC/zonefile_cod4_pc.h \ - PC/zonefile_cod5_pc.h \ - PC/zonefile_cod6_pc.h \ - PC/zonefile_cod7_pc.h \ - PC/zonefile_cod8_pc.h \ - PC/zonefile_cod9_pc.h \ - PC/zonefile_cod10_pc.h \ - PC/zonefile_cod11_pc.h \ - PC/zonefile_cod12_pc.h \ - # Wii classes - Wii/zonefile_cod4_wii.h \ - Wii/zonefile_cod7_wii.h \ - Wii/zonefile_cod8_wii.h \ - # WiiU classes - WiiU/zonefile_cod9_wiiu.h \ - WiiU/zonefile_cod10_wiiu.h +SOURCES += $$files($$PWD/*.cpp, true) +HEADERS += $$files($$PWD/*.h, true) LIBS += \ -L$$OUT_PWD/../ -lcore -lassets diff --git a/tests/tests.pro b/tests/tests.pro index aeafd7f..7afd677 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -2,63 +2,15 @@ TEMPLATE = app CONFIG += no_main # Enable the testlib module -QT += testlib concurrent core-private +QT += testlib core-private # Define a test-specific flag DEFINES += QT_TESTS TARGET = tests -# List all test source files -SOURCES += \ - # 360 autotests - 360/autotest_cod2_360.cpp \ - 360/autotest_cod4_360.cpp \ - 360/autotest_cod5_360.cpp \ - 360/autotest_cod6_360.cpp \ - 360/autotest_cod7_360.cpp \ - 360/autotest_cod8_360.cpp \ - 360/autotest_cod9_360.cpp \ - 360/autotest_cod10_360.cpp \ - 360/autotest_cod11_360.cpp \ - 360/autotest_cod12_360.cpp \ - # PC autotests - PC/autotest_cod4_pc.cpp \ - PC/autotest_cod5_pc.cpp \ - PC/autotest_cod6_pc.cpp \ - PC/autotest_cod7_pc.cpp \ - PC/autotest_cod8_pc.cpp \ - PC/autotest_cod9_pc.cpp \ - PC/autotest_cod10_pc.cpp \ - PC/autotest_cod11_pc.cpp \ - PC/autotest_cod12_pc.cpp \ - # PS3 autotests - PS3/autotest_cod4_ps3.cpp \ - PS3/autotest_cod5_ps3.cpp \ - PS3/autotest_cod6_ps3.cpp \ - PS3/autotest_cod7_ps3.cpp \ - PS3/autotest_cod8_ps3.cpp \ - PS3/autotest_cod9_ps3.cpp \ - PS3/autotest_cod10_ps3.cpp \ - PS3/autotest_cod11_ps3.cpp \ - PS3/autotest_cod12_ps3.cpp \ - # Wii autotests - Wii/autotest_cod4_wii.cpp \ - Wii/autotest_cod7_wii.cpp \ - Wii/autotest_cod8_wii.cpp \ - # WiiU autotests - WiiU/autotest_cod9_wiiu.cpp \ - WiiU/autotest_cod10_wiiu.cpp \ - # XPlor autotests - autotest_cod.cpp \ - autotest_xplor.cpp \ - # Main test function - test_main.cpp - -HEADERS += \ - autotest_cod.h \ - autotest_xplor.h - +SOURCES += $$files($$PWD/*.cpp, true) +HEADERS += $$files($$PWD/*.h, true) # Prevent tests from being built in release mode (optional) # CONFIG(debug, debug|release) { diff --git a/tools/asset_assess/asset_assess.pro b/tools/asset_assess/asset_assess.pro index cb80a65..9f2a614 100644 --- a/tools/asset_assess/asset_assess.pro +++ b/tools/asset_assess/asset_assess.pro @@ -4,12 +4,8 @@ RC_ICONS = asset_assess.ico CONFIG += c++17 -SOURCES += \ - main.cpp \ - mainwindow.cpp - -HEADERS += \ - mainwindow.h +SOURCES += $$files($$PWD/*.cpp, true) +HEADERS += $$files($$PWD/*.h, true) LIBS += \ -L$$OUT_PWD/../../libs -lassets diff --git a/tools/compro/compro.pro b/tools/compro/compro.pro index cff7cd2..b29ada2 100644 --- a/tools/compro/compro.pro +++ b/tools/compro/compro.pro @@ -2,15 +2,9 @@ QT += core widgets gui multimedia CONFIG += c++17 -SOURCES += \ - main.cpp \ - mainwindow.cpp - -HEADERS += \ - mainwindow.h - -FORMS += \ - mainwindow.ui +SOURCES += $$files($$PWD/*.cpp, true) +HEADERS += $$files($$PWD/*.h, true) +FORMS += $$files($$PWD/*.ui, true) LIBS += \ -L$$OUT_PWD/../../libs/ -lcompression \ diff --git a/tools/zentry/zentry.pro b/tools/zentry/zentry.pro index aaee86d..d14aae2 100644 --- a/tools/zentry/zentry.pro +++ b/tools/zentry/zentry.pro @@ -4,15 +4,9 @@ RC_ICONS = zentry.ico CONFIG += c++17 -SOURCES += \ - main.cpp \ - mainwindow.cpp - -HEADERS += \ - mainwindow.h - -FORMS += \ - mainwindow.ui +SOURCES += $$files($$PWD/*.cpp, true) +HEADERS += $$files($$PWD/*.h, true) +FORMS += $$files($$PWD/*.ui, true) LIBS += \ -L$$OUT_PWD/../../libs/ -lcore \