diff --git a/libs/core/enums.h b/libs/core/enums.h index 77713ab..698fdbe 100644 --- a/libs/core/enums.h +++ b/libs/core/enums.h @@ -432,7 +432,7 @@ enum MENU_FONT_TYPE{ UI_FONT_DEFAULT = 0, // auto-chose betwen big/reg/small UI_FONT_NORMAL = 1, UI_FONT_BIG = 2, - UI_FONT_SMALL = 3, + UI_GameFontMALL = 3, UI_FONT_BOLD = 4, UI_FONT_CONSOLE = 5, UI_FONT_OBJECTIVE = 6, diff --git a/libs/core/utils.h b/libs/core/utils.h index ed50b2f..161c2af 100644 --- a/libs/core/utils.h +++ b/libs/core/utils.h @@ -2,16 +2,168 @@ #define UTILS_H #include "enums.h" +#include "QtZlib/zlib.h" +#include "qdir.h" +#include "qicon.h" -#include -#include -#include -#include +#include #include #include -class Utils { +class Utils : public QObject { + Q_OBJECT public: + enum AssetType { + ASSET_NONE = 0x00, + ASSET_RAWFILE = 0x01, + ASSET_SCRIPT_PARSE_TREE = 0x02, + ASSET_FX = 0x03, + ASSET_SOUND_CURVE = 0x04, + ASSET_Animation = 0x05, + ASSET_COLLISION_MAP = 0x06, + ASSET_STRINGTABLE = 0x07, + ASSET_XMODEL_SURFS = 0x08, + ASSET_TECHNIQUE_SET = 0x09, + ASSET_GFX_MAP = 0x11, + ASSET_D3DBSP = 0x15, + ASSET_GAME_MAP_SP = 0x17, + ASSET_COL_MAP_SP = 0x18, + ASSET_PHYSPRESET = 0x19, + ASSET_DESTRUCTIBLE = 0x20, + ASSET_LOCALIZE_ENTRY = 0x21, + ASSET_SHADER = 0x22, + ASSET_MP_MAP = 0x23, + ASSET_SP_MAP = 0x24, + ASSET_SNDDRIVER_GLOBALS = 0x26, + ASSET_AI_TYPE = 0x27, + ASSET_COMPUTE_SHADER_SET = 0x29, + ASSET_LIGHT_DESCRIPTION = 0x30, + ASSET_BIT_FIELD = 0x31, + ASSET_STRUCTURED_TABLE = 0x32, + ASSET_LEADERBOARD_DEF = 0x33, + ASSET_DDL = 0x34, + ASSET_KEY_VALUE_PAIRS = 0x35, + ASSET_SCRIPT_BUNDLE = 0x36, + ASSET_SCRIPT_BUNDLE_LIST = 0x37, + ASSET_MAP_TABLE = 0x38, + ASSET_MAP_TABLE_LOADING_IMAGES = 0x39, + ASSET_SURFACE_SOUND_DEF = 0x40, + ASSET_SURFACE_FX_TABLE = 0x41, + ASSET_RUMBLE = 0x42, + ASSET_AIM_TABLE = 0x43, + ASSET_MEDAL = 0x44, + ASSET_MEDAL_TABLE = 0x45, + ASSET_OBJECTIVE = 0x46, + ASSET_OBJECTIVE_LIST = 0x47, + ASSET_LASER = 0x48, + ASSET_BEAM = 0x49, + ASSET_STREAMER_HINT = 0x50, + ASSET_ANIM_SELECTOR_TABLE = 0x51, + ASSET_ANIM_MAPPING_TABLE = 0x52, + ASSET_ANIM_STATE_MACHINE = 0x53, + ASSET_BEHAVIOR_TREE = 0x54, + ASSET_BEHAVIOR_STATE_MACHINE = 0x55, + ASSET_FOOTSTEP_TABLE = 0x56, + ASSET_ENTITY_FX_IMPACTS = 0x57, + ASSET_ENTITY_SOUND_IMPACTS = 0x58, + ASSET_VEHICLE_FX_DEF = 0x59, + ASSET_VEHICLE_SOUND_DEF = 0x60, + ASSET_VEHICLE = 0x61, + ASSET_VEHICLE_TRACER = 0x62, + ASSET_PLAYER_SOUNDS_TABLE = 0x63, + ASSET_PLAYER_FX_TABLE = 0x64, + ASSET_SHARED_WEAPON_SOUNDS = 0x65, + ASSET_ATTACHMENT = 0x66, + ASSET_ATTACHMENT_UNIQUE = 0x67, + ASSET_WEAPON_CAMO = 0x68, + ASSET_CUSTOMIZATION_TABLE = 0x69, + ASSET_CUSTOMIZATION_TABLE_FEIMAGES = 0x70, + ASSET_CUSTOMIZATION_TABLE_COLOR = 0x71, + ASSET_PHYS_CONSTRAINTS = 0x72, + ASSET_DESTRUCTIBLE_DEF = 0x73, + ASSET_XMODEL_MESH = 0x74, + ASSET_S_ANIM = 0x75, + ASSET_FONT_ICON = 0x76, + ASSET_CG_MEDIA_TABLE = 0x77, + ASSET_SHOCK_FILE = 0x78, + ASSET_ZONE_FILE = 0x79, + ASSET_FAST_FILE = 0x80, + ASSET_SOUND_DRIVER_GLOBALS = 0x81, + ASSET_XMODELPIECES = 0x82, + ASSET_XMODEL = 0x85, + ASSET_MATERIAL = 0x86, + ASSET_PIXELSHADER = 0x87, + ASSET_IMAGE = 0x89, + ASSET_SOUND = 0x90, + ASSET_LOADED_SOUND = 0x92, + ASSET_CLIPMAP = 0x93, + ASSET_CLIPMAP_PVS = 0x94, + ASSET_COMWORLD = 0x95, + ASSET_GAMEWORLD_SP = 0x96, + ASSET_GAMEWORLD_MP = 0x97, + ASSET_MAP_ENTS = 0x98, + ASSET_GFXWORLD = 0x99, + ASSET_LIGHT_DEF = 0x100, + ASSET_UI_MAP = 0x101, + ASSET_FONT = 0x102, + ASSET_MENULIST = 0x103, + ASSET_MENU = 0x104, + ASSET_WEAPON = 0x106, + ASSET_IMPACT_FX = 0x109, + ASSET_AITYPE = 0x110, + ASSET_MPTYPE = 0x111, + ASSET_CHARACTER = 0x112, + ASSET_XMODELALIAS = 0x113, + ASSET_COUNT = 0x116, + ASSET_STRING = 0x117, + ASSET_ASSETLIST = 0x118, + ASSET_PHYSCOLLMAP = 0x119, + ASSET_CLIPMAP_SP = 0x120, + ASSET_CLIPMAP_MP = 0x121, + ASSET_FXWORLD = 0x122, + ASSET_LEADERBOARD = 0x123, + ASSET_STRUCTURED_DATA_DEF = 0x124, + ASSET_TRACER = 0x125, + ASSET_ADDON_MAP_ENTS = 0x126, + ASSET_GLASSWORLD = 0x127, + ASSET_PATHDATA = 0x128, + ASSET_VEHICLE_TRACK = 0x129, + ASSET_SURFACE_FX = 0x130, + ASSET_SCRIPTFILE = 0x131, + ASSET_SOUND_SUBMIX = 0x132, + ASSET_SOUND_EVENT = 0x133, + ASSET_LPF_CURVE = 0x134, + ASSET_REVERB_CURVE = 0x135, + ASSET_GFXWORLD_TRANSIENT_ZONE = 0x136, + ASSET_ANIMCLASS = 0x137, + ASSET_NET_CONST_STRINGS = 0x138, + ASSET_REVERB_PRESET = 0x139, + ASSET_LUA_FILE = 0x140, + ASSET_SCRIPTABLE = 0x141, + ASSET_EQUIPMENT_SND_TABLE = 0x142, + ASSET_DOPPLER_PRESET = 0x143, + ASSET_SKELETON_SCRIPT = 0x144, + ASSET_PHYSCONSTRAINTS = 0x145, + ASSET_DESTRUCTIBLEDEF = 0x146, + ASSET_SOUND_PATCH = 0x147, + ASSET_WEAPONDEF = 0x148, + ASSET_WEAPON_VARIANT = 0x149, + ASSET_MPBODY = 0x150, + ASSET_MPHEAD = 0x151, + ASSET_PACK_INDEX = 0x152, + ASSET_XGLOBALS = 0x153, + ASSET_GLASSES = 0x154, + ASSET_EMBLEMSET = 0x155 + }; + Q_ENUM(AssetType) + + static QString AssetTypeToStr(Utils::AssetType aAssetType) { + const QMetaObject &mo = Utils::staticMetaObject; + int index = mo.indexOfEnumerator("AssetType"); + QMetaEnum metaEnum = mo.enumerator(index); + return QString::fromLatin1(metaEnum.valueToKey(aAssetType)); + } + static bool ExportData(const QString aFileName, const QByteArray aData) { QDir workingDir = QDir::currentPath(); workingDir.mkdir("exports"); @@ -30,6 +182,19 @@ public: b = (b & 0xAA) >> 1 | (b & 0x55) << 1; return b; } + static QIcon CreateAssetIcon(Utils::AssetType aAssetType, QColor color = QColor()) { + const QString assetTypeStr = AssetTypeToStr(aAssetType); + + QString name; + const QStringList parts = assetTypeStr.split('_').mid(1); + foreach (const QString part, parts) { + name += part[0]; + } + if (parts.size() == 1) { + name += parts.first()[1]; + } + return CreateAssetIcon(name, color); + } static QIcon CreateAssetIcon(const QString& name, QColor color = QColor()) { constexpr int iconSize = 32; constexpr int padding = 4; @@ -380,34 +545,6 @@ public: return PadInt4(size) - size; } - static QString GetOpenFastFileName(QWidget *parent = nullptr) { - // Open file dialog to steam apps - const QString steamPath = "C:/Program Files (x86)/Steam/steamapps/common/Call of Duty World at War/zone/english/"; - const QString fastFilePath = QFileDialog::getOpenFileName(parent, "Open Fast File", steamPath, "Fast File (*.ff);;All Files (*.*)"); - if (fastFilePath.isNull()) { - // User pressed cancel - return ""; - } else if (!QFile::exists(fastFilePath)) { - QMessageBox::warning(parent, "Warning!", QString("%1 does not exist!.").arg(fastFilePath)); - return ""; - } - return fastFilePath; - } - - static QString GetOpenZoneFileName(QWidget *parent = nullptr) { - // Open file dialog to steam apps - const QString steamPath = "C:/Program Files (x86)/Steam/steamapps/common/Call of Duty World at War/zone/english/"; - const QString zoneFilePath = QFileDialog::getOpenFileName(parent, "Open Zone File", steamPath, "Zone File (*.zone);;All Files (*.*)"); - if (zoneFilePath.isNull()) { - // User pressed cancel - return ""; - } else if (!QFile::exists(zoneFilePath)) { - QMessageBox::warning(parent, "Warning!", QString("%1 does not exist!.").arg(zoneFilePath)); - return nullptr; - } - return zoneFilePath; - } - static QString CompanyEnumToStr(FF_COMPANY aCompany) { switch (aCompany) { case COMPANY_NONE: diff --git a/libs/ddsfile/enums.h b/libs/ddsfile/enums.h index 7d5f5c0..e8df426 100644 --- a/libs/ddsfile/enums.h +++ b/libs/ddsfile/enums.h @@ -430,7 +430,7 @@ enum MENU_FONT_TYPE{ UI_FONT_DEFAULT = 0, // auto-chose betwen big/reg/small UI_FONT_NORMAL = 1, UI_FONT_BIG = 2, - UI_FONT_SMALL = 3, + UI_GameFontMALL = 3, UI_FONT_BOLD = 4, UI_FONT_CONSOLE = 5, UI_FONT_OBJECTIVE = 6, diff --git a/libs/fastfile/360/fastfile_cod4_360.cpp b/libs/fastfile/360/fastfile_cod4_360.cpp index a6e9899..c191177 100644 --- a/libs/fastfile/360/fastfile_cod4_360.cpp +++ b/libs/fastfile/360/fastfile_cod4_360.cpp @@ -126,8 +126,6 @@ bool FastFile_COD4_360::Load(const QByteArray aData) { } decompressedData = Compression::DecompressZLIB(compressedData); } - - Utils::ExportData(GetBaseStem() + ".zone", decompressedData); ZoneFile_COD4_360 zoneFile; diff --git a/libs/fastfile/360/fastfile_cod7_360.cpp b/libs/fastfile/360/fastfile_cod7_360.cpp index 90d645e..3998536 100644 --- a/libs/fastfile/360/fastfile_cod7_360.cpp +++ b/libs/fastfile/360/fastfile_cod7_360.cpp @@ -73,6 +73,7 @@ bool FastFile_COD7_360::Load(const QByteArray aData) { // Create a QDataStream on the input data. QDataStream fastFileStream(aData); + fastFileStream.skipRawData(12); // Load the zone file with the decompressed data (using an Xbox platform flag). ZoneFile_COD7_360 zoneFile; @@ -142,6 +143,7 @@ bool FastFile_COD7_360::Load(const QByteArray aData) { sectionIndex++; } + Utils::ExportData(GetBaseStem() + ".zone", decompressedData); zoneFile.Load(decompressedData); diff --git a/libs/fastfile/PC/fastfile_cod7_pc.cpp b/libs/fastfile/PC/fastfile_cod7_pc.cpp index 59f10b9..1bebcd9 100644 --- a/libs/fastfile/PC/fastfile_cod7_pc.cpp +++ b/libs/fastfile/PC/fastfile_cod7_pc.cpp @@ -83,84 +83,18 @@ bool FastFile_COD7_PC::Load(const QByteArray aData) { SetMagic(pParseFFMagic(&fastFileStream)); quint32 version = pParseFFVersion(&fastFileStream); SetVersion(version); - SetPlatform(pCalculateFFPlatform(version)); + SetPlatform("360"); SetGame("COD7"); // Load the zone file with the decompressed data (using an Xbox platform flag). ZoneFile_COD7_PC zoneFile; zoneFile.SetStem(GetBaseStem() + ".zone"); - // For COD7/COD9, use BigEndian. - fastFileStream.setByteOrder(QDataStream::LittleEndian); + // Assume the first 12 bytes are a header; the rest is zlib-compressed zone data. + const QByteArray compressedData = aData.mid(12); + decompressedData = Compression::DecompressZLIB(compressedData); - // Select key based on game. - QByteArray key; - fastFileStream.skipRawData(4); - if (GetPlatform() == "360") { - key = QByteArray::fromHex("1ac1d12d527c59b40eca619120ff8217ccff09cd16896f81b829c7f52793405d"); - } else if (GetPlatform() == "PS3") { - key = QByteArray::fromHex("46D3F997F29C9ACE175B0DAE3AB8C0C1B8E423E2E3BF7E3C311EA35245BF193A"); - // or - // key = QByteArray::fromHex("0C99B3DDB8D6D0845D1147E470F28A8BF2AE69A8A9F534767B54E9180FF55370"); - } - - // Read the 8-byte magic. - QByteArray fileMagic(8, Qt::Uninitialized); - fastFileStream.readRawData(fileMagic.data(), 8); - if (fileMagic != "PHEEBs71") { - qWarning() << "Invalid fast file magic!"; - return false; - } - fastFileStream.skipRawData(4); - - // Read IV table name (32 bytes). - QByteArray fileName(32, Qt::Uninitialized); - fastFileStream.readRawData(fileName.data(), 32); - - // Build the IV table from the fileName. - QByteArray ivTable = Encryption::InitIVTable(fileName); - - // Skip the RSA signature (256 bytes). - QByteArray rsaSignature(256, Qt::Uninitialized); - fastFileStream.readRawData(rsaSignature.data(), 256); - - // Now the stream should be positioned at 0x13C, where sections begin. - int sectionIndex = 0; - while (true) { - qint32 sectionSize = 0; - fastFileStream >> sectionSize; - qDebug() << "Section index:" << sectionIndex << "Size:" << sectionSize - << "Pos:" << fastFileStream.device()->pos(); - if (sectionSize == 0) - break; - - // Read the section data. - QByteArray sectionData; - sectionData.resize(sectionSize); - fastFileStream.readRawData(sectionData.data(), sectionSize); - - // Compute the IV for this section. - QByteArray iv = Encryption::GetIV(ivTable, sectionIndex); - - // Decrypt the section using Salsa20. - QByteArray decData = Encryption::salsa20DecryptSection(sectionData, key, iv); - - // Compute SHA1 hash of the decrypted data. - QByteArray sectionHash = QCryptographicHash::hash(decData, QCryptographicHash::Sha1); - - // Update the IV table based on the section hash. - Encryption::UpdateIVTable(ivTable, sectionIndex, sectionHash); - - // Build a compressed data buffer by prepending the two-byte zlib header. - QByteArray compressedData; - compressedData.append(char(0x78)); - compressedData.append(char(0x01)); - compressedData.append(decData); - - decompressedData.append(Compression::DecompressZLIB(compressedData)); - - sectionIndex++; - } + Utils::ExportData(GetBaseStem() + ".zone", decompressedData); zoneFile.Load(decompressedData); diff --git a/libs/fastfile/fastfile.pro b/libs/fastfile/fastfile.pro index 756d37b..65e2fe8 100644 --- a/libs/fastfile/fastfile.pro +++ b/libs/fastfile/fastfile.pro @@ -89,6 +89,7 @@ HEADERS += \ LIBS += \ -L$$OUT_PWD/../libs/core -lcore \ + -L$$OUT_PWD/../libs/core -lassets \ -L$$OUT_PWD/../libs/compression -lcompression \ -L$$OUT_PWD/../libs/encryption -lencryption \ -L$$OUT_PWD/../libs/zonefile -lzonefile @@ -97,17 +98,26 @@ INCLUDEPATH += \ $$PWD/../core \ $$PWD/../compression \ $$PWD/../encryption \ + $$PWD/../assets \ $$PWD/../zonefile \ $$PWD/../zonefile/360 \ $$PWD/../zonefile/PC \ $$PWD/../zonefile/PS3 \ $$PWD/../zonefile/Wii \ + $$PWD/../zonefile/PS3 \ $$PWD/../zonefile/WiiU DEPENDPATH += \ $$PWD/../core \ $$PWD/../compression \ $$PWD/../encryption \ - $$PWD/../zonefile + $$PWD/../assets \ + $$PWD/../zonefile \ + $$PWD/../zonefile/360 \ + $$PWD/../zonefile/PC \ + $$PWD/../zonefile/PS3 \ + $$PWD/../zonefile/Wii \ + $$PWD/../zonefile/PS3 \ + $$PWD/../zonefile/WiiU DESTDIR = $$OUT_PWD/../ diff --git a/libs/fastfile/fastfile_factory.h b/libs/fastfile/fastfile_factory.h index 2eb04b6..a2488e2 100644 --- a/libs/fastfile/fastfile_factory.h +++ b/libs/fastfile/fastfile_factory.h @@ -75,7 +75,7 @@ enum FastFile_Game { class FastFileFactory { public: - static std::shared_ptr Create(const QString& aFilePath, bool aEmpty = false) { + static std::shared_ptr Create(const QString& aFilePath, FastFile_Platform aPlatform = PLATFORM_NONE, FastFile_Game aGame = GAME_NONE) { QFile fastFile(aFilePath); if (!fastFile.open(QIODevice::ReadOnly)) { qDebug() << "Factory failed to open fast file: " << aFilePath; @@ -84,172 +84,179 @@ public: const QString stem = aFilePath.split('/').last().split('.').first(); - const QString newPath = (aEmpty ? "" : aFilePath); - const QByteArray data = fastFile.readAll(); std::shared_ptr resultFF = nullptr; - const FastFile_Platform platform = pGetPlatform(data); - const FastFile_Game game = pGetGame(data); + if (aPlatform == PLATFORM_NONE) { + aPlatform = pGetPlatform(data); + } + if (aGame == GAME_NONE) { + aGame = pGetGame(data); + } - if (platform == PLATFORM_360) { - if (game == GAME_COD2) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD4) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD5) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD6) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD7) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD8) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD9) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD10) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD11) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD12) { - resultFF = std::make_shared(newPath); + if (aPlatform == PLATFORM_360) { + if (aGame == GAME_COD2) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD4) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD5) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD6) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD7) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD8) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD9) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD10) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD11) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD12) { + resultFF = std::make_shared(aFilePath); } - } else if (platform == PLATFORM_PC) { - if (game == GAME_COD4) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD5) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD6) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD7) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD8) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD9) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD10) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD11) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD12) { - resultFF = std::make_shared(newPath); + } else if (aPlatform == PLATFORM_PC) { + if (aGame == GAME_COD4) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD5) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD6) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD7) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD8) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD9) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD10) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD11) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD12) { + resultFF = std::make_shared(aFilePath); } - } else if (platform == PLATFORM_PS3) { - if (game == GAME_COD4) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD5) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD6) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD7) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD8) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD9) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD10) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD11) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD12) { - resultFF = std::make_shared(newPath); + } else if (aPlatform == PLATFORM_PS3) { + if (aGame == GAME_COD4) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD5) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD6) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD7) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD8) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD9) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD10) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD11) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD12) { + resultFF = std::make_shared(aFilePath); } - } else if (platform == PLATFORM_WII) { - if (game == GAME_COD4) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD7) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD8) { - resultFF = std::make_shared(newPath); + } else if (aPlatform == PLATFORM_WII) { + if (aGame == GAME_COD4) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD7) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD8) { + resultFF = std::make_shared(aFilePath); } - } else if (platform == PLATFORM_WIIU) { - if (game == GAME_COD9) { - resultFF = std::make_shared(newPath); - } else if (game == GAME_COD10) { - resultFF = std::make_shared(newPath); + } else if (aPlatform == PLATFORM_WIIU) { + if (aGame == GAME_COD9) { + resultFF = std::make_shared(aFilePath); + } else if (aGame == GAME_COD10) { + resultFF = std::make_shared(aFilePath); } } return resultFF; } - static std::shared_ptr Create(const QByteArray& aData, const QString aStem = "no_name") { + static std::shared_ptr Create(const QByteArray& aData, const QString aStem = "no_name", FastFile_Platform aPlatform = PLATFORM_NONE, FastFile_Game aGame = GAME_NONE) { std::shared_ptr resultFF = nullptr; - const FastFile_Platform platform = pGetPlatform(aData); - const FastFile_Game game = pGetGame(aData); - if (platform == PLATFORM_360) { - if (game == GAME_COD2) { + if (aPlatform == PLATFORM_NONE) { + aPlatform = pGetPlatform(aData); + } + if (aGame == GAME_NONE) { + aGame = pGetGame(aData); + } + + if (aPlatform == PLATFORM_360) { + if (aGame == GAME_COD2) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD4) { + } else if (aGame == GAME_COD4) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD5) { + } else if (aGame == GAME_COD5) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD6) { + } else if (aGame == GAME_COD6) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD7) { + } else if (aGame == GAME_COD7) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD8) { + } else if (aGame == GAME_COD8) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD9) { + } else if (aGame == GAME_COD9) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD10) { + } else if (aGame == GAME_COD10) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD11) { + } else if (aGame == GAME_COD11) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD12) { + } else if (aGame == GAME_COD12) { resultFF = std::make_shared(aData); } - } else if (platform == PLATFORM_PC) { - if (game == GAME_COD4) { + } else if (aPlatform == PLATFORM_PC) { + if (aGame == GAME_COD4) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD5) { + } else if (aGame == GAME_COD5) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD6) { + } else if (aGame == GAME_COD6) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD7) { + } else if (aGame == GAME_COD7) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD8) { + } else if (aGame == GAME_COD8) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD9) { + } else if (aGame == GAME_COD9) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD10) { + } else if (aGame == GAME_COD10) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD11) { + } else if (aGame == GAME_COD11) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD12) { + } else if (aGame == GAME_COD12) { resultFF = std::make_shared(aData); } - } else if (platform == PLATFORM_PS3) { - if (game == GAME_COD4) { + } else if (aPlatform == PLATFORM_PS3) { + if (aGame == GAME_COD4) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD5) { + } else if (aGame == GAME_COD5) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD6) { + } else if (aGame == GAME_COD6) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD7) { + } else if (aGame == GAME_COD7) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD8) { + } else if (aGame == GAME_COD8) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD9) { + } else if (aGame == GAME_COD9) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD10) { + } else if (aGame == GAME_COD10) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD11) { + } else if (aGame == GAME_COD11) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD12) { + } else if (aGame == GAME_COD12) { resultFF = std::make_shared(aData); } - } else if (platform == PLATFORM_WII) { - if (game == GAME_COD4) { + } else if (aPlatform == PLATFORM_WII) { + if (aGame == GAME_COD4) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD7) { + } else if (aGame == GAME_COD7) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD8) { + } else if (aGame == GAME_COD8) { resultFF = std::make_shared(aData); } - } else if (platform == PLATFORM_WIIU) { - if (game == GAME_COD9) { + } else if (aPlatform == PLATFORM_WIIU) { + if (aGame == GAME_COD9) { resultFF = std::make_shared(aData); - } else if (game == GAME_COD10) { + } else if (aGame == GAME_COD10) { resultFF = std::make_shared(aData); } } diff --git a/libs/libs.pro b/libs/libs.pro index 65de95e..af03ec5 100644 --- a/libs/libs.pro +++ b/libs/libs.pro @@ -4,6 +4,7 @@ SUBDIRS += core \ compression \ encryption \ fastfile \ + assets \ zonefile \ ddsfile \ iwifile \