Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ It currently offers support for the PC versions of:
- [IW3 (COD4: Modern Warfare - 2007)](https://en.wikipedia.org/wiki/Call_of_Duty_4:_Modern_Warfare)
- [IW4 (Modern Warfare 2 - 2009)](https://en.wikipedia.org/wiki/Call_of_Duty:_Modern_Warfare_2)
- [IW5 (Modern Warfare 3 - 2011)](https://en.wikipedia.org/wiki/Call_of_Duty:_Modern_Warfare_3)
- [QOS (007: Quantum of Solace - 2008)](https://en.wikipedia.org/wiki/007:_Quantum_of_Solace)
- [T4 (World at War - 2008)](https://en.wikipedia.org/wiki/Call_of_Duty:_World_at_War)
- [T5 (Black Ops - 2010)](https://en.wikipedia.org/wiki/Call_of_Duty:_Black_Ops)
- [T6 (Black Ops II - 2012)](https://en.wikipedia.org/wiki/Call_of_Duty:_Black_Ops_II)
Expand Down
36 changes: 36 additions & 0 deletions docs/SupportedAssetTypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,42 @@ using `Linker`):
| VehicleDef | ✅ | ✅ | |
| AddonMapEnts | ⁉️ | ❌ | MapEnts String can be exported. Binary data currently not. |

## QOS (007: Quantum of Solace)

| Asset Type | Dumping Support | Loading Support | Notes |
|----------------------|-----------------|-----------------|------------------------------------------------------------------------------|
| PhysPreset | ❌ | ❌ | |
| PhysConstraints | ❌ | ❌ | |
| DestructibleDef | ❌ | ❌ | |
| XAnimParts | ❌ | ❌ | |
| XModel | ✅ | ❌ | Model data can be exported to `XMODEL_EXPORT/XMODEL_BIN`, `OBJ`, `GLB/GLTF`. |
| Material | ❌ | ❌ | |
| MaterialTechniqueSet | ❌ | ❌ | |
| GfxImage | ✅ | ❌ | |
| snd_alias_list_t | ❌ | ❌ | |
| SndCurve | ❌ | ❌ | |
| clipMap_t | ❌ | ❌ | |
| ComWorld | ❌ | ❌ | |
| GameWorldSp | ❌ | ❌ | |
| GameWorldMp | ❌ | ❌ | |
| MapEnts | ✅ | ❌ | |
| GfxWorld | ❌ | ❌ | |
| GfxLightDef | ❌ | ❌ | |
| Font_s | ✅ | ❌ | |
| MenuList | ❌ | ❌ | |
| menuDef_t | ❌ | ❌ | |
| LocalizeEntry | ✅ | ✅ | |
| WeaponDef | ❌ | ❌ | |
| SndDriverGlobals | ❌ | ❌ | |
| FxEffectDef | ❌ | ❌ | |
| FxImpactTable | ❌ | ❌ | |
| RawFile | ✅ | ✅ | |
| StringTable | ✅ | ✅ | |
| XmlTree | ❌ | ❌ | |
| SceneAnimation | ❌ | ❌ | |
| Cutscene | ❌ | ❌ | |
| CustomCamera | ❌ | ❌ | |

## T4 (Call of Duty: World at War)

| Asset Type | Dumping Support | Loading Support | Notes |
Expand Down
2 changes: 2 additions & 0 deletions src/Common/Game/CommonAsset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "IW3/CommonAssetIW3.h"
#include "IW4/CommonAssetIW4.h"
#include "IW5/CommonAssetIW5.h"
#include "QOS/CommonAssetQOS.h"
#include "T4/CommonAssetT4.h"
#include "T5/CommonAssetT5.h"
#include "T6/CommonAssetT6.h"
Expand All @@ -15,6 +16,7 @@ ICommonAssetTypeMapper* ICommonAssetTypeMapper::GetCommonAssetMapperByGame(GameI
new IW3::CommonAssetTypeMapper(),
new IW4::CommonAssetTypeMapper(),
new IW5::CommonAssetTypeMapper(),
new QOS::CommonAssetTypeMapper(),
new T4::CommonAssetTypeMapper(),
new T5::CommonAssetTypeMapper(),
new T6::CommonAssetTypeMapper(),
Expand Down
6 changes: 6 additions & 0 deletions src/Common/Game/CommonAsset.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ enum class CommonAssetType : std::uint8_t
// T6
ZBARRIER,

// QOS
XML_TREE,
SCENE_ANIMATION,
CUTSCENE,
CUSTOM_CAMERA,

COUNT,
};

Expand Down
2 changes: 2 additions & 0 deletions src/Common/Game/IGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "IW3/GameIW3.h"
#include "IW4/GameIW4.h"
#include "IW5/GameIW5.h"
#include "QOS/GameQOS.h"
#include "T4/GameT4.h"
#include "T5/GameT5.h"
#include "T6/GameT6.h"
Expand All @@ -16,6 +17,7 @@ IGame* IGame::GetGameById(GameId gameId)
new IW3::Game(),
new IW4::Game(),
new IW5::Game(),
new QOS::Game(),
new T4::Game(),
new T5::Game(),
new T6::Game(),
Expand Down
2 changes: 2 additions & 0 deletions src/Common/Game/IGame.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ enum class GameId : std::uint8_t
IW3,
IW4,
IW5,
QOS,
T4,
T5,
T6,
Expand Down Expand Up @@ -50,6 +51,7 @@ static constexpr const char* GameId_Names[]{
"IW3",
"IW4",
"IW5",
"QOS",
"T4",
"T5",
"T6",
Expand Down
110 changes: 110 additions & 0 deletions src/Common/Game/QOS/CommonAssetQOS.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#include "CommonAssetQOS.h"

#include "QOS.h"

#include <cassert>

namespace QOS
{
CommonAssetTypeMapper::CommonAssetTypeMapper() = default;

CommonAssetType CommonAssetTypeMapper::GameToCommonAssetType(const asset_type_t gameAssetType) const
{
static CommonAssetType lookupTable[static_cast<unsigned>(ASSET_TYPE_COUNT)]{
CommonAssetType::XMODEL_PIECES, // ASSET_TYPE_XMODELPIECES
CommonAssetType::PHYS_PRESET, // ASSET_TYPE_PHYSPRESET
CommonAssetType::PHYS_CONSTRAINTS, // ASSET_TYPE_PHYSCONSTRAINTS
CommonAssetType::DESTRUCTIBLE_DEF, // ASSET_TYPE_DESTRUCTIBLEDEF
CommonAssetType::XANIM, // ASSET_TYPE_XANIMPARTS
CommonAssetType::XMODEL, // ASSET_TYPE_XMODEL
CommonAssetType::MATERIAL, // ASSET_TYPE_MATERIAL
CommonAssetType::TECHNIQUE_SET, // ASSET_TYPE_TECHNIQUE_SET
CommonAssetType::IMAGE, // ASSET_TYPE_IMAGE
CommonAssetType::SOUND, // ASSET_TYPE_SOUND
CommonAssetType::SOUND_CURVE, // ASSET_TYPE_SND_CURVE
CommonAssetType::CLIP_MAP, // ASSET_TYPE_CLIPMAP_SP
CommonAssetType::CLIP_MAP, // ASSET_TYPE_CLIPMAP_MP
CommonAssetType::COM_WORLD, // ASSET_TYPE_COMWORLD
CommonAssetType::GAME_WORLD_SP, // ASSET_TYPE_GAMEWORLD_SP
CommonAssetType::GAME_WORLD_MP, // ASSET_TYPE_GAMEWORLD_MP
CommonAssetType::MAP_ENTS, // ASSET_TYPE_MAP_ENTS
CommonAssetType::GFX_WORLD, // ASSET_TYPE_GFXWORLD
CommonAssetType::LIGHT_DEF, // ASSET_TYPE_LIGHT_DEF
CommonAssetType::UI_MAP, // ASSET_TYPE_UI_MAP
CommonAssetType::FONT, // ASSET_TYPE_FONT
CommonAssetType::MENU_LIST, // ASSET_TYPE_MENUFILE
CommonAssetType::MENU, // ASSET_TYPE_MENU
CommonAssetType::LOCALIZE_ENTRY, // ASSET_TYPE_LOCALIZE_ENTRY
CommonAssetType::WEAPON, // ASSET_TYPE_WEAPON
CommonAssetType::SOUND_DRIVER_GLOBALS, // ASSET_TYPE_SNDDRIVER_GLOBALS
CommonAssetType::FX, // ASSET_TYPE_FX
CommonAssetType::IMPACT_FX, // ASSET_TYPE_IMPACT_FX
CommonAssetType::AI_TYPE, // ASSET_TYPE_AITYPE
CommonAssetType::MP_TYPE, // ASSET_TYPE_MPTYPE
CommonAssetType::CHARACTER, // ASSET_TYPE_CHARACTER
CommonAssetType::XMODEL_ALIAS, // ASSET_TYPE_XMODELALIAS
CommonAssetType::RAW_FILE, // ASSET_TYPE_RAWFILE
CommonAssetType::STRING_TABLE, // ASSET_TYPE_STRINGTABLE
CommonAssetType::XML_TREE, // ASSET_TYPE_XMLTREE
CommonAssetType::SCENE_ANIMATION, // ASSET_TYPE_SCENE_ANIMATION
CommonAssetType::CUTSCENE, // ASSET_TYPE_CUTSCENE
CommonAssetType::CUSTOM_CAMERA, // ASSET_TYPE_CUSTOM_CAMERA
};

assert(gameAssetType < ASSET_TYPE_COUNT);
return lookupTable[gameAssetType];
}

std::optional<asset_type_t> CommonAssetTypeMapper::CommonToGameAssetType(const CommonAssetType commonAssetType) const
{
#define MAP_COMMON(common, game) \
case common: \
return game;

switch (commonAssetType)
{
MAP_COMMON(CommonAssetType::XMODEL_PIECES, ASSET_TYPE_XMODELPIECES)
MAP_COMMON(CommonAssetType::PHYS_PRESET, ASSET_TYPE_PHYSPRESET)
MAP_COMMON(CommonAssetType::PHYS_CONSTRAINTS, ASSET_TYPE_PHYSCONSTRAINTS)
MAP_COMMON(CommonAssetType::DESTRUCTIBLE_DEF, ASSET_TYPE_DESTRUCTIBLEDEF)
MAP_COMMON(CommonAssetType::XANIM, ASSET_TYPE_XANIMPARTS)
MAP_COMMON(CommonAssetType::XMODEL, ASSET_TYPE_XMODEL)
MAP_COMMON(CommonAssetType::MATERIAL, ASSET_TYPE_MATERIAL)
MAP_COMMON(CommonAssetType::TECHNIQUE_SET, ASSET_TYPE_TECHNIQUE_SET)
MAP_COMMON(CommonAssetType::IMAGE, ASSET_TYPE_IMAGE)
MAP_COMMON(CommonAssetType::SOUND, ASSET_TYPE_SOUND)
MAP_COMMON(CommonAssetType::SOUND_CURVE, ASSET_TYPE_SND_CURVE)
MAP_COMMON(CommonAssetType::CLIP_MAP, ASSET_TYPE_CLIPMAP_MP)
MAP_COMMON(CommonAssetType::COM_WORLD, ASSET_TYPE_COMWORLD)
MAP_COMMON(CommonAssetType::GAME_WORLD_SP, ASSET_TYPE_GAMEWORLD_SP)
MAP_COMMON(CommonAssetType::GAME_WORLD_MP, ASSET_TYPE_GAMEWORLD_MP)
MAP_COMMON(CommonAssetType::MAP_ENTS, ASSET_TYPE_MAP_ENTS)
MAP_COMMON(CommonAssetType::GFX_WORLD, ASSET_TYPE_GFXWORLD)
MAP_COMMON(CommonAssetType::LIGHT_DEF, ASSET_TYPE_LIGHT_DEF)
MAP_COMMON(CommonAssetType::UI_MAP, ASSET_TYPE_UI_MAP)
MAP_COMMON(CommonAssetType::FONT, ASSET_TYPE_FONT)
MAP_COMMON(CommonAssetType::MENU_LIST, ASSET_TYPE_MENUFILE)
MAP_COMMON(CommonAssetType::MENU, ASSET_TYPE_MENU)
MAP_COMMON(CommonAssetType::LOCALIZE_ENTRY, ASSET_TYPE_LOCALIZE_ENTRY)
MAP_COMMON(CommonAssetType::WEAPON, ASSET_TYPE_WEAPON)
MAP_COMMON(CommonAssetType::SOUND_DRIVER_GLOBALS, ASSET_TYPE_SNDDRIVER_GLOBALS)
MAP_COMMON(CommonAssetType::FX, ASSET_TYPE_FX)
MAP_COMMON(CommonAssetType::IMPACT_FX, ASSET_TYPE_IMPACT_FX)
MAP_COMMON(CommonAssetType::AI_TYPE, ASSET_TYPE_AITYPE)
MAP_COMMON(CommonAssetType::MP_TYPE, ASSET_TYPE_MPTYPE)
MAP_COMMON(CommonAssetType::CHARACTER, ASSET_TYPE_CHARACTER)
MAP_COMMON(CommonAssetType::XMODEL_ALIAS, ASSET_TYPE_XMODELALIAS)
MAP_COMMON(CommonAssetType::RAW_FILE, ASSET_TYPE_RAWFILE)
MAP_COMMON(CommonAssetType::STRING_TABLE, ASSET_TYPE_STRINGTABLE)
MAP_COMMON(CommonAssetType::XML_TREE, ASSET_TYPE_XMLTREE)
MAP_COMMON(CommonAssetType::SCENE_ANIMATION, ASSET_TYPE_SCENE_ANIMATION)
MAP_COMMON(CommonAssetType::CUTSCENE, ASSET_TYPE_CUTSCENE)
MAP_COMMON(CommonAssetType::CUSTOM_CAMERA, ASSET_TYPE_CUSTOM_CAMERA)

default:
return std::nullopt;
}

#undef MAP_COMMON
}
} // namespace QOS
15 changes: 15 additions & 0 deletions src/Common/Game/QOS/CommonAssetQOS.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#include "Game/CommonAsset.h"

namespace QOS
{
class CommonAssetTypeMapper final : public ICommonAssetTypeMapper
{
public:
CommonAssetTypeMapper();

[[nodiscard]] CommonAssetType GameToCommonAssetType(asset_type_t gameAssetType) const override;
[[nodiscard]] std::optional<asset_type_t> CommonToGameAssetType(CommonAssetType commonAssetType) const override;
};
} // namespace QOS
37 changes: 37 additions & 0 deletions src/Common/Game/QOS/CommonQOS.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "CommonQOS.h"

#include "Utils/Pack.h"

#include <cmath>

using namespace QOS;

PackedTexCoords Common::Vec2PackTexCoords(const float (&in)[2])
{
return PackedTexCoords{pack32::Vec2PackTexCoordsVU(in)};
}

PackedUnitVec Common::Vec3PackUnitVec(const float (&in)[3])
{
return PackedUnitVec{pack32::Vec3PackUnitVecScaleBased(in)};
}

GfxColor Common::Vec4PackGfxColor(const float (&in)[4])
{
return GfxColor{pack32::Vec4PackGfxColor(in)};
}

void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, float (&out)[2])
{
pack32::Vec2UnpackTexCoordsVU(in.packed, out);
}

void Common::Vec3UnpackUnitVec(const PackedUnitVec& in, float (&out)[3])
{
pack32::Vec3UnpackUnitVecScaleBased(in.packed, out);
}

void Common::Vec4UnpackGfxColor(const GfxColor& in, float (&out)[4])
{
pack32::Vec4UnpackGfxColor(in.packed, out);
}
30 changes: 30 additions & 0 deletions src/Common/Game/QOS/CommonQOS.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

#include "QOS.h"
#include "Utils/Djb2.h"

#include <cstdint>

namespace QOS
{
class Common
{
public:
static constexpr uint32_t R_HashString(const char* str, const uint32_t hash)
{
return djb2_xor_nocase(str, hash);
}

static constexpr uint32_t R_HashString(const char* string)
{
return R_HashString(string, 0u);
}

static PackedTexCoords Vec2PackTexCoords(const float (&in)[2]);
static PackedUnitVec Vec3PackUnitVec(const float (&in)[3]);
static GfxColor Vec4PackGfxColor(const float (&in)[4]);
static void Vec2UnpackTexCoords(const PackedTexCoords& in, float (&out)[2]);
static void Vec3UnpackUnitVec(const PackedUnitVec& in, float (&out)[3]);
static void Vec4UnpackGfxColor(const GfxColor& in, float (&out)[4]);
};
} // namespace QOS
Loading
Loading