Merge branch 'master' into release

This commit is contained in:
Aruki
2018-10-21 19:58:19 -06:00
2433 changed files with 179954 additions and 108025 deletions

View File

@@ -43,7 +43,7 @@ void ApplyGeneratedName(CResourceEntry *pEntry, const TString& rkDir, const TStr
// trying to keep these as consistent with Retro's naming scheme as possible, and
// for some reason in MP3 they started using all lowercase folder names...
if (pEntry->Game() >= eCorruptionProto)
if (pEntry->Game() >= EGame::CorruptionProto)
SanitizedDir = SanitizedDir.ToLower();
pNewDir = pEntry->ResourceStore()->GetVirtualDirectory(SanitizedDir, true);
@@ -245,9 +245,9 @@ void GenerateAssetNames(CGameProject *pProj)
{
CMaterialPass *pPass = pMat->Pass(iPass);
bool IsLightmap = ( (pArea->Game() <= eEchoes && pMat->Options().HasFlag(CMaterial::eLightmap) && iPass == 0) ||
(pArea->Game() >= eCorruptionProto && pPass->Type() == "DIFF") );
bool IsBloomLightmap = (pArea->Game() >= eCorruptionProto && pPass->Type() == "BLOL");
bool IsLightmap = ( (pArea->Game() <= EGame::Echoes && pMat->Options().HasFlag(CMaterial::eLightmap) && iPass == 0) ||
(pArea->Game() >= EGame::CorruptionProto && pPass->Type() == "DIFF") );
bool IsBloomLightmap = (pArea->Game() >= EGame::CorruptionProto && pPass->Type() == "BLOL");
TString TexName;
@@ -283,7 +283,8 @@ void GenerateAssetNames(CGameProject *pProj)
for (u32 iInst = 0; iInst < pLayer->NumInstances(); iInst++)
{
CScriptObject *pInst = pLayer->InstanceByIndex(iInst);
CScriptObject* pInst = pLayer->InstanceByIndex(iInst);
CStructProperty* pProperties = pInst->Template()->Properties();
if (pInst->ObjectTypeID() == 0x42 || pInst->ObjectTypeID() == FOURCC('POIN'))
{
@@ -291,13 +292,13 @@ void GenerateAssetNames(CGameProject *pProj)
if (Name.StartsWith("POI_", false))
{
TIDString ScanIDString = (pProj->Game() <= ePrime ? "0x4:0x0" : "0xBDBEC295:0xB94E9BE7");
TAssetProperty *pScanProperty = TPropCast<TAssetProperty>(pInst->PropertyByIDString(ScanIDString));
TIDString ScanIDString = (pProj->Game() <= EGame::Prime ? "0x4:0x0" : "0xBDBEC295:0xB94E9BE7");
CAssetProperty *pScanProperty = TPropCast<CAssetProperty>(pProperties->ChildByIDString(ScanIDString));
ASSERT(pScanProperty); // Temporary assert to remind myself later to update this code when uncooked properties are added to the template
if (pScanProperty)
{
CAssetID ScanID = pScanProperty->Get();
CAssetID ScanID = pScanProperty->Value(pInst->PropertyData());
CResourceEntry *pEntry = pStore->FindEntry(ScanID);
if (pEntry && !pEntry->IsNamed())
@@ -326,13 +327,13 @@ void GenerateAssetNames(CGameProject *pProj)
if (Name.EndsWith(".STRG", false))
{
u32 StringPropID = (pProj->Game() <= ePrime ? 0x4 : 0x9182250C);
TAssetProperty *pStringProperty = TPropCast<TAssetProperty>(pInst->Properties()->PropertyByID(StringPropID));
u32 StringPropID = (pProj->Game() <= EGame::Prime ? 0x4 : 0x9182250C);
CAssetProperty *pStringProperty = TPropCast<CAssetProperty>(pProperties->ChildByID(StringPropID));
ASSERT(pStringProperty); // Temporary assert to remind myself later to update this code when uncooked properties are added to the template
if (pStringProperty)
{
CAssetID StringID = pStringProperty->Get();
CAssetID StringID = pStringProperty->Value(pInst->PropertyData());
CResourceEntry *pEntry = pStore->FindEntry(StringID);
if (pEntry && !pEntry->IsNamed())
@@ -352,13 +353,13 @@ void GenerateAssetNames(CGameProject *pProj)
else if (pInst->ObjectTypeID() == 0x0 || pInst->ObjectTypeID() == FOURCC('ACTR') ||
pInst->ObjectTypeID() == 0x8 || pInst->ObjectTypeID() == FOURCC('PLAT'))
{
u32 ModelPropID = (pProj->Game() <= ePrime ? (pInst->ObjectTypeID() == 0x0 ? 0xA : 0x6) : 0xC27FFA8F);
TAssetProperty *pModelProperty = TPropCast<TAssetProperty>(pInst->Properties()->PropertyByID(ModelPropID));
u32 ModelPropID = (pProj->Game() <= EGame::Prime ? (pInst->ObjectTypeID() == 0x0 ? 0xA : 0x6) : 0xC27FFA8F);
CAssetProperty *pModelProperty = TPropCast<CAssetProperty>(pProperties->ChildByID(ModelPropID));
ASSERT(pModelProperty); // Temporary assert to remind myself later to update this code when uncooked properties are added to the template
if (pModelProperty)
{
CAssetID ModelID = pModelProperty->Get();
CAssetID ModelID = pModelProperty->Value(pInst->PropertyData());
CResourceEntry *pEntry = pStore->FindEntry(ModelID);
if (pEntry && !pEntry->IsCategorized())
@@ -414,8 +415,8 @@ void GenerateAssetNames(CGameProject *pProj)
{
CMaterialPass *pPass = pMat->Pass(iPass);
bool IsLightmap = ( (pMat->Version() <= eEchoes && pMat->Options().HasFlag(CMaterial::eLightmap) && iPass == 0) ||
(pMat->Version() >= eCorruptionProto && pPass->Type() == "DIFF") );
bool IsLightmap = ( (pMat->Version() <= EGame::Echoes && pMat->Options().HasFlag(CMaterial::eLightmap) && iPass == 0) ||
(pMat->Version() >= EGame::CorruptionProto && pPass->Type() == "DIFF") );
if (IsLightmap)
{
@@ -484,7 +485,7 @@ void GenerateAssetNames(CGameProject *pProj)
// Generate animation format names
// Hacky syntax because animsets are under eAnimSet in MP1/2 and eCharacter in MP3/DKCR
Log::Write("Processing animation data");
CResourceIterator *pIter = (pProj->Game() <= eEchoes ? (CResourceIterator*) new TResourceIterator<eAnimSet> : (CResourceIterator*) new TResourceIterator<eCharacter>);
CResourceIterator *pIter = (pProj->Game() <= EGame::Echoes ? (CResourceIterator*) new TResourceIterator<eAnimSet> : (CResourceIterator*) new TResourceIterator<eCharacter>);
CResourceIterator& It = *pIter;
for (; It; ++It)
@@ -504,7 +505,7 @@ void GenerateAssetNames(CGameProject *pProj)
if (pkChar->pSkeleton) ApplyGeneratedName(pkChar->pSkeleton->Entry(), SetDir, CharName);
if (pkChar->pSkin) ApplyGeneratedName(pkChar->pSkin->Entry(), SetDir, CharName);
if (pProj->Game() >= eCorruptionProto && pProj->Game() <= eCorruption && pkChar->ID == 0)
if (pProj->Game() >= EGame::CorruptionProto && pProj->Game() <= EGame::Corruption && pkChar->ID == 0)
{
CResourceEntry *pAnimDataEntry = gpResourceStore->FindEntry( pkChar->AnimDataID );
@@ -606,7 +607,7 @@ void GenerateAssetNames(CGameProject *pProj)
CScan *pScan = (CScan*) It->Load();
TString ScanName;
if (pProj->Game() >= eEchoesDemo)
if (pProj->Game() >= EGame::EchoesDemo)
{
CAssetID DisplayAsset = pScan->LogbookDisplayAssetID();
CResourceEntry *pEntry = pStore->FindEntry(DisplayAsset);
@@ -621,7 +622,7 @@ void GenerateAssetNames(CGameProject *pProj)
ApplyGeneratedName(pScan->Entry(), It->DirectoryPath(), ScanName);
if (!ScanName.IsEmpty() && pProj->Game() <= ePrime)
if (!ScanName.IsEmpty() && pProj->Game() <= EGame::Prime)
{
CAssetID FrameID = pScan->GuiFrame();
CResourceEntry *pEntry = pStore->FindEntry(FrameID);

View File

@@ -36,7 +36,7 @@ bool CAssetNameMap::SaveAssetNames(TString Path /*= ""*/)
if (Path.IsEmpty())
Path = DefaultNameMapPath(mIDLength);
EGame Game = (mIDLength == e32Bit ? ePrime : eCorruption);
EGame Game = (mIDLength == e32Bit ? EGame::Prime : EGame::Corruption);
CXMLWriter Writer(Path, "AssetNameMap", 0, Game);
Serialize(Writer);
return Writer.Save();
@@ -58,7 +58,7 @@ bool CAssetNameMap::GetNameInfo(CAssetID ID, TString& rOutDirectory, TString& rO
else
{
EGame Game = (ID.Length() == e32Bit ? ePrime : eCorruption);
EGame Game = (ID.Length() == e32Bit ? EGame::Prime : EGame::Corruption);
rOutDirectory = CResourceStore::StaticDefaultResourceDirPath(Game);
rOutName = ID.ToString();
rOutAutoGenDir = true;
@@ -133,7 +133,7 @@ void CAssetNameMap::CopyFromStore(CResourceStore *pStore /*= gpResourceStore*/)
// ************ PRIVATE ************
void CAssetNameMap::Serialize(IArchive& rArc)
{
rArc << SERIAL_CONTAINER("AssetNameMap", mMap, "Asset");
rArc << SerialParameter("AssetNameMap", mMap);
if (rArc.IsReader())
PostLoadValidate();

View File

@@ -28,7 +28,11 @@ class CAssetNameMap
void Serialize(IArchive& rArc)
{
rArc << SERIAL_AUTO(Name) << SERIAL_AUTO(Directory) << SERIAL_AUTO(Type) << SERIAL_AUTO(AutoGenName) << SERIAL_AUTO(AutoGenDir);
rArc << SerialParameter("Name", Name)
<< SerialParameter("Directory", Directory)
<< SerialParameter("Type", Type)
<< SerialParameter("AutoGenName", AutoGenName)
<< SerialParameter("AutoGenDir", AutoGenDir);
}
bool operator<(const SAssetNameInfo& rkOther) const

View File

@@ -1,11 +1,10 @@
#include "CDependencyTree.h"
#include "Core/GameProject/CGameProject.h"
#include "Core/Resource/Animation/CAnimSet.h"
#include "Core/Resource/Script/CMasterTemplate.h"
#include "Core/Resource/Script/CGameTemplate.h"
#include "Core/Resource/Script/CScriptLayer.h"
#include "Core/Resource/Script/CScriptObject.h"
CDependencyNodeFactory gDependencyNodeFactory;
#include "Core/Resource/Script/NGameList.h"
// ************ IDependencyNode ************
IDependencyNode::~IDependencyNode()
@@ -31,6 +30,24 @@ void IDependencyNode::GetAllResourceReferences(std::set<CAssetID>& rOutSet) cons
mChildren[iChild]->GetAllResourceReferences(rOutSet);
}
// Serialization constructor
IDependencyNode* IDependencyNode::ArchiveConstructor(EDependencyNodeType Type)
{
switch (Type)
{
case eDNT_DependencyTree: return new CDependencyTree;
case eDNT_ResourceDependency: return new CResourceDependency;
case eDNT_ScriptInstance: return new CScriptInstanceDependency;
case eDNT_ScriptProperty: return new CPropertyDependency;
case eDNT_CharacterProperty: return new CCharPropertyDependency;
case eDNT_SetCharacter: return new CSetCharacterDependency;
case eDNT_SetAnimation: return new CSetAnimationDependency;
case eDNT_AnimEvent: return new CAnimEventDependency;
case eDNT_Area: return new CAreaDependencyTree;
default: ASSERT(false); return nullptr;
}
}
// ************ CDependencyTree ************
EDependencyNodeType CDependencyTree::Type() const
{
@@ -39,7 +56,7 @@ EDependencyNodeType CDependencyTree::Type() const
void CDependencyTree::Serialize(IArchive& rArc)
{
rArc << SERIAL_ABSTRACT_CONTAINER("Children", mChildren, "Child", &gDependencyNodeFactory);
rArc << SerialParameter("Children", mChildren);
}
void CDependencyTree::AddChild(IDependencyNode *pNode)
@@ -78,7 +95,7 @@ EDependencyNodeType CResourceDependency::Type() const
void CResourceDependency::Serialize(IArchive& rArc)
{
rArc << SERIAL("ID", mID);
rArc << SerialParameter("ID", mID);
}
void CResourceDependency::GetAllResourceReferences(std::set<CAssetID>& rOutSet) const
@@ -99,7 +116,7 @@ EDependencyNodeType CPropertyDependency::Type() const
void CPropertyDependency::Serialize(IArchive& rArc)
{
rArc << SERIAL("PropertyID", mIDString);
rArc << SerialParameter("PropertyID", mIDString);
CResourceDependency::Serialize(rArc);
}
@@ -112,7 +129,7 @@ EDependencyNodeType CCharPropertyDependency::Type() const
void CCharPropertyDependency::Serialize(IArchive& rArc)
{
CPropertyDependency::Serialize(rArc);
rArc << SERIAL("CharIndex", mUsedChar);
rArc << SerialParameter("CharIndex", mUsedChar);
}
// ************ CScriptInstanceDependency ************
@@ -123,8 +140,8 @@ EDependencyNodeType CScriptInstanceDependency::Type() const
void CScriptInstanceDependency::Serialize(IArchive& rArc)
{
rArc << SERIAL("ObjectType", mObjectType)
<< SERIAL_ABSTRACT_CONTAINER("Properties", mChildren, "Property", &gDependencyNodeFactory);
rArc << SerialParameter("ObjectType", mObjectType)
<< SerialParameter("Properties", mChildren);
}
// Static
@@ -132,28 +149,32 @@ CScriptInstanceDependency* CScriptInstanceDependency::BuildTree(CScriptObject *p
{
CScriptInstanceDependency *pInst = new CScriptInstanceDependency();
pInst->mObjectType = pInstance->ObjectTypeID();
ParseStructDependencies(pInst, pInstance->Properties());
ParseStructDependencies(pInst, pInstance, pInstance->Template()->Properties());
return pInst;
}
void CScriptInstanceDependency::ParseStructDependencies(CScriptInstanceDependency *pInst, CPropertyStruct *pStruct)
void CScriptInstanceDependency::ParseStructDependencies(CScriptInstanceDependency* pInst, CScriptObject* pInstance, CStructProperty *pStruct)
{
// Recursive function for parsing script dependencies and loading them into the script instance dependency
for (u32 iProp = 0; iProp < pStruct->Count(); iProp++)
void* pPropertyData = pInstance->PropertyData();
for (u32 PropertyIdx = 0; PropertyIdx < pStruct->NumChildren(); PropertyIdx++)
{
IProperty *pProp = pStruct->PropertyByIndex(iProp);
IProperty *pProp = pStruct->ChildByIndex(PropertyIdx);
EPropertyType Type = pProp->Type();
if (Type == eStructProperty || Type == eArrayProperty)
ParseStructDependencies(pInst, static_cast<CPropertyStruct*>(pProp));
// Technically we aren't parsing array children, but it's not really worth refactoring this function
// to support it when there aren't any array properties that contain any asset references anyway...
if (Type == EPropertyType::Struct)
ParseStructDependencies(pInst, pInstance, TPropCast<CStructProperty>(pProp));
else if (Type == eSoundProperty)
else if (Type == EPropertyType::Sound)
{
u32 SoundID = static_cast<TSoundProperty*>(pProp)->Get();
u32 SoundID = TPropCast<CSoundProperty>(pProp)->Value(pPropertyData);
if (SoundID != -1)
{
CGameProject *pProj = pStruct->Instance()->Area()->Entry()->Project();
CGameProject *pProj = pInstance->Area()->Entry()->Project();
SSoundInfo Info = pProj->AudioManager()->GetSoundInfo(SoundID);
if (Info.pAudioGroup)
@@ -164,9 +185,9 @@ void CScriptInstanceDependency::ParseStructDependencies(CScriptInstanceDependenc
}
}
else if (Type == eAssetProperty)
else if (Type == EPropertyType::Asset)
{
CAssetID ID = static_cast<TAssetProperty*>(pProp)->Get();
CAssetID ID = TPropCast<CAssetProperty>(pProp)->Value(pPropertyData);
if (ID.IsValid())
{
@@ -175,16 +196,15 @@ void CScriptInstanceDependency::ParseStructDependencies(CScriptInstanceDependenc
}
}
else if (Type == eCharacterProperty)
else if (Type == EPropertyType::AnimationSet)
{
TCharacterProperty *pChar = static_cast<TCharacterProperty*>(pProp);
CAnimationParameters Params = pChar->Get();
CAnimationParameters Params = TPropCast<CAnimationSetProperty>(pProp)->Value(pPropertyData);
CAssetID ID = Params.ID();
if (ID.IsValid())
{
// Character sets are removed starting in MP3, so we only need char property dependencies in Echoes and earlier
if (pStruct->Instance()->Area()->Game() <= eEchoes)
if (pStruct->Game() <= EGame::Echoes)
{
CCharPropertyDependency *pDep = new CCharPropertyDependency(pProp->IDString(true), ID, Params.CharacterIndex());
pInst->mChildren.push_back(pDep);
@@ -207,8 +227,8 @@ EDependencyNodeType CSetCharacterDependency::Type() const
void CSetCharacterDependency::Serialize(IArchive& rArc)
{
rArc << SERIAL("CharSetIndex", mCharSetIndex)
<< SERIAL_ABSTRACT_CONTAINER("Children", mChildren, "Child", &gDependencyNodeFactory);
rArc << SerialParameter("CharSetIndex", mCharSetIndex)
<< SerialParameter("Children", mChildren);
}
CSetCharacterDependency* CSetCharacterDependency::BuildTree(const SSetCharacter& rkChar)
@@ -252,8 +272,8 @@ EDependencyNodeType CSetAnimationDependency::Type() const
void CSetAnimationDependency::Serialize(IArchive& rArc)
{
rArc << SERIAL_CONTAINER("CharacterIndices", mCharacterIndices, "Index")
<< SERIAL_ABSTRACT_CONTAINER("Children", mChildren, "Child", &gDependencyNodeFactory);
rArc << SerialParameter("CharacterIndices", mCharacterIndices)
<< SerialParameter("Children", mChildren);
}
CSetAnimationDependency* CSetAnimationDependency::BuildTree(const CAnimSet *pkOwnerSet, u32 AnimIndex)
@@ -279,7 +299,7 @@ CSetAnimationDependency* CSetAnimationDependency::BuildTree(const CAnimSet *pkOw
const CAnimPrimitive& rkPrim = *Iter;
pTree->AddDependency(rkPrim.Animation());
if (pkOwnerSet->Game() >= eEchoesDemo)
if (pkOwnerSet->Game() >= EGame::EchoesDemo)
{
CAnimEventData *pEvents = pkOwnerSet->AnimationEventData(rkPrim.ID());
ASSERT(pEvents && !pEvents->Entry());
@@ -299,7 +319,7 @@ EDependencyNodeType CAnimEventDependency::Type() const
void CAnimEventDependency::Serialize(IArchive& rArc)
{
CResourceDependency::Serialize(rArc);
rArc << SERIAL("CharacterIndex", mCharIndex);
rArc << SerialParameter("CharacterIndex", mCharIndex);
}
// ************ CAreaDependencyTree ************
@@ -311,7 +331,7 @@ EDependencyNodeType CAreaDependencyTree::Type() const
void CAreaDependencyTree::Serialize(IArchive& rArc)
{
CDependencyTree::Serialize(rArc);
rArc << SERIAL_CONTAINER("LayerOffsets", mLayerOffsets, "Offset");
rArc << SerialParameter("LayerOffsets", mLayerOffsets);
}
void CAreaDependencyTree::AddScriptLayer(CScriptLayer *pLayer, const std::vector<CAssetID>& rkExtraDeps)
@@ -326,7 +346,7 @@ void CAreaDependencyTree::AddScriptLayer(CScriptLayer *pLayer, const std::vector
ASSERT(pTree != nullptr);
// Note: MP2+ need to track all instances (not just instances with dependencies) to be able to build the layer module list
if (pTree->NumChildren() > 0 || pLayer->Area()->Game() >= eEchoesDemo)
if (pTree->NumChildren() > 0 || pLayer->Area()->Game() >= EGame::EchoesDemo)
{
mChildren.push_back(pTree);
pTree->GetAllResourceReferences(UsedIDs);
@@ -341,7 +361,7 @@ void CAreaDependencyTree::AddScriptLayer(CScriptLayer *pLayer, const std::vector
void CAreaDependencyTree::GetModuleDependencies(EGame Game, std::vector<TString>& rModuleDepsOut, std::vector<u32>& rModuleLayerOffsetsOut) const
{
CMasterTemplate *pMaster = CMasterTemplate::MasterForGame(Game);
CGameTemplate *pGame = NGameList::GetGameTemplate(Game);
// Output module list will be split per-script layer
// The output offset list contains two offsets per layer - start index and end index
@@ -367,7 +387,7 @@ void CAreaDependencyTree::GetModuleDependencies(EGame Game, std::vector<TString>
if (UsedObjectTypes.find(ObjType) == UsedObjectTypes.end())
{
// Get the module list for this object type and check whether any of them are new before adding them to the output list
CScriptTemplate *pTemplate = pMaster->TemplateByID(ObjType);
CScriptTemplate *pTemplate = pGame->TemplateByID(ObjType);
const std::vector<TString>& rkModules = pTemplate->RequiredModules();
for (u32 iMod = 0; iMod < rkModules.size(); iMod++)

View File

@@ -8,7 +8,7 @@
class CScriptLayer;
class CScriptObject;
class CPropertyStruct;
class CStructProperty;
class CAnimSet;
class CAnimationParameters;
struct SSetCharacter;
@@ -40,6 +40,9 @@ public:
virtual void GetAllResourceReferences(std::set<CAssetID>& rOutSet) const;
virtual bool HasDependency(const CAssetID& rkID) const;
// Serialization constructor
static IDependencyNode* ArchiveConstructor(EDependencyNodeType Type);
// Accessors
inline u32 NumChildren() const { return mChildren.size(); }
inline IDependencyNode* ChildByIndex(u32 Index) const { return mChildren[Index]; }
@@ -142,7 +145,7 @@ public:
// Static
static CScriptInstanceDependency* BuildTree(CScriptObject *pInstance);
protected:
static void ParseStructDependencies(CScriptInstanceDependency *pTree, CPropertyStruct *pStruct);
static void ParseStructDependencies(CScriptInstanceDependency *pTree, CScriptObject* pInstance, CStructProperty *pStruct);
};
// Node representing an animset character. Indicates what index the character is within the animset.
@@ -223,28 +226,5 @@ public:
inline u32 ScriptLayerOffset(u32 LayerIdx) const { return mLayerOffsets[LayerIdx]; }
};
// Dependency node factory for serialization
class CDependencyNodeFactory
{
public:
IDependencyNode* SpawnObject(u32 NodeID)
{
switch (NodeID)
{
case eDNT_DependencyTree: return new CDependencyTree;
case eDNT_ResourceDependency: return new CResourceDependency;
case eDNT_ScriptInstance: return new CScriptInstanceDependency;
case eDNT_ScriptProperty: return new CPropertyDependency;
case eDNT_CharacterProperty: return new CCharPropertyDependency;
case eDNT_SetCharacter: return new CSetCharacterDependency;
case eDNT_SetAnimation: return new CSetAnimationDependency;
case eDNT_AnimEvent: return new CAnimEventDependency;
case eDNT_Area: return new CAreaDependencyTree;
default: ASSERT(false); return nullptr;
}
}
};
extern CDependencyNodeFactory gDependencyNodeFactory;
#endif // CDEPENDENCYTREE

View File

@@ -4,12 +4,14 @@
#include "CResourceStore.h"
#include "Core/CompressionUtil.h"
#include "Core/Resource/CWorld.h"
#include "Core/Resource/Script/CMasterTemplate.h"
#include "Core/Resource/Script/CGameTemplate.h"
#include <Common/AssertMacro.h>
#include <Common/CScopedTimer.h>
#include <Common/FileIO.h>
#include <Common/FileUtil.h>
#include <Common/Serialization/CXMLWriter.h>
#include <nod/nod.hpp>
#include <tinyxml2.h>
#define LOAD_PAKS 1
@@ -27,8 +29,8 @@ CGameExporter::CGameExporter(EDiscType DiscType, EGame Game, bool FrontEnd, EReg
, mFrontEnd(FrontEnd)
, mpProgress(nullptr)
{
ASSERT(mGame != eUnknownGame);
ASSERT(mRegion != eRegion_Unknown);
ASSERT(mGame != EGame::Invalid);
ASSERT(mRegion != ERegion::Unknown);
}
bool CGameExporter::Export(nod::DiscBase *pDisc, const TString& rkOutputDir, CAssetNameMap *pNameMap, CGameInfo *pGameInfo, IProgressNotifier *pProgress)
@@ -112,15 +114,15 @@ bool CGameExporter::ShouldExportDiscNode(const nod::Node *pkNode, bool IsInRoot)
switch (mGame)
{
case ePrime:
case EGame::Prime:
return ( (mDiscType == eDT_WiiDeAsobu && pkNode->getName() == "MP1JPN") ||
(mDiscType == eDT_Trilogy && pkNode->getName() == "MP1") );
case eEchoes:
case EGame::Echoes:
return ( (mDiscType == eDT_WiiDeAsobu && pkNode->getName() == "MP2JPN") ||
(mDiscType == eDT_Trilogy && pkNode->getName() == "MP2") );
case eCorruption:
case EGame::Corruption:
return (mDiscType == eDT_Trilogy && pkNode->getName() == "MP3");
default:
@@ -140,15 +142,15 @@ bool CGameExporter::ShouldExportDiscNode(const nod::Node *pkNode, bool IsInRoot)
switch (mGame)
{
case ePrime:
case EGame::Prime:
return ( (mDiscType == eDT_WiiDeAsobu && pkNode->getName() == "rs5mp1jpn_p.dol") ||
(mDiscType == eDT_Trilogy && pkNode->getName() == "rs5mp1_p.dol") );
case eEchoes:
case EGame::Echoes:
return ( (mDiscType == eDT_WiiDeAsobu && pkNode->getName() == "rs5mp2jpn_p.dol") ||
(mDiscType == eDT_Trilogy && pkNode->getName() == "rs5mp2_p.dol") );
case eCorruption:
case EGame::Corruption:
return (mDiscType == eDT_Trilogy && pkNode->getName() == "rs5mp3_p.dol");
default:
@@ -176,11 +178,11 @@ bool CGameExporter::ExtractDiscData()
FileUtil::MakeDirectory(AbsDiscDir);
// Extract disc filesystem
nod::Partition *pDataPartition = mpDisc->getDataPartition();
nod::IPartition *pDataPartition = mpDisc->getDataPartition();
nod::ExtractionContext Context;
Context.force = false;
Context.progressCB = [&](const std::string& rkDesc, float ProgressPercent) {
mpProgress->Report((int) (ProgressPercent * 10000), 10000, rkDesc);
Context.progressCB = [&](const std::string_view rkDesc, float ProgressPercent) {
mpProgress->Report((int) (ProgressPercent * 10000), 10000, rkDesc.data());
};
TString FilesDir = AbsDiscDir + "files/";
@@ -223,7 +225,7 @@ bool CGameExporter::ExtractDiscNodeRecursive(const nod::Node *pkNode, const TStr
if (Iter->getKind() == nod::Node::Kind::File)
{
TString FilePath = rkDir + Iter->getName();
TString FilePath = rkDir + Iter->getName().data();
bool Success = Iter->extractToDirectory(*rkDir.ToUTF16(), rkContext);
if (!Success) return false;
@@ -237,7 +239,7 @@ bool CGameExporter::ExtractDiscNodeRecursive(const nod::Node *pkNode, const TStr
else
{
TString Subdir = rkDir + Iter->getName() + "/";
TString Subdir = rkDir + Iter->getName().data() + "/";
bool Success = FileUtil::MakeDirectory(Subdir);
if (!Success) return false;
@@ -274,7 +276,7 @@ void CGameExporter::LoadPaks()
CPackage *pPackage = new CPackage(mpProject, PakPath.GetFileName(false), RelPakPath);
// MP1-MP3Proto
if (mGame < eCorruption)
if (mGame < EGame::Corruption)
{
u32 PakVersion = Pak.ReadLong();
Pak.Seek(0x4, SEEK_CUR);
@@ -392,7 +394,7 @@ void CGameExporter::LoadPaks()
mResourceMap[ResID] = SResourceInstance { PakPath, ResID, Type, Offset, Size, Compressed, false };
// Check for duplicate resources (unnecessary for DKCR)
if (mGame != eReturns)
if (mGame != EGame::DKCReturns)
{
if (Type == "MREA")
{
@@ -434,9 +436,9 @@ void CGameExporter::LoadResource(const SResourceInstance& rkResource, std::vecto
// Handle compression
if (rkResource.Compressed)
{
bool ZlibCompressed = (mGame <= eEchoesDemo || mGame == eReturns);
bool ZlibCompressed = (mGame <= EGame::EchoesDemo || mGame == EGame::DKCReturns);
if (mGame <= eCorruptionProto)
if (mGame <= EGame::CorruptionProto)
{
std::vector<u8> CompressedData(rkResource.PakSize);
@@ -682,14 +684,14 @@ TString CGameExporter::MakeWorldName(CAssetID WorldID)
{
// World names are basically formatted differently in every game...
// MP1 demo - Remove ! from the beginning
if (mGame == ePrimeDemo)
if (mGame == EGame::PrimeDemo)
{
if (WorldName.StartsWith('!'))
WorldName = WorldName.ChopFront(1);
}
// MP1 - Remove prefix characters and ending date
else if (mGame == ePrime)
else if (mGame == EGame::Prime)
{
WorldName = WorldName.ChopFront(2);
bool StartedDate = false;
@@ -708,7 +710,7 @@ TString CGameExporter::MakeWorldName(CAssetID WorldID)
}
// MP2 demo - Use text between the first and second underscores
else if (mGame == eEchoesDemo)
else if (mGame == EGame::EchoesDemo)
{
u32 UnderscoreA = WorldName.IndexOf('_');
u32 UnderscoreB = WorldName.IndexOf('_', UnderscoreA + 1);
@@ -718,7 +720,7 @@ TString CGameExporter::MakeWorldName(CAssetID WorldID)
}
// MP2 - Remove text before first underscore and after last underscore, strip remaining underscores (except multiplayer maps, which have one underscore)
else if (mGame == eEchoes)
else if (mGame == EGame::Echoes)
{
u32 FirstUnderscore = WorldName.IndexOf('_');
u32 LastUnderscore = WorldName.LastIndexOf('_');
@@ -732,7 +734,7 @@ TString CGameExporter::MakeWorldName(CAssetID WorldID)
}
// MP3 proto - Remove ! from the beginning and all text after last underscore
else if (mGame == eCorruptionProto)
else if (mGame == EGame::CorruptionProto)
{
if (WorldName.StartsWith('!'))
WorldName = WorldName.ChopFront(1);
@@ -742,7 +744,7 @@ TString CGameExporter::MakeWorldName(CAssetID WorldID)
}
// MP3 - Remove text after last underscore
else if (mGame == eCorruption)
else if (mGame == EGame::Corruption)
{
u32 LastUnderscore = WorldName.LastIndexOf('_');
@@ -751,7 +753,7 @@ TString CGameExporter::MakeWorldName(CAssetID WorldID)
}
// DKCR - Remove text prior to first underscore
else if (mGame == eReturns)
else if (mGame == EGame::DKCReturns)
{
u32 Underscore = WorldName.IndexOf('_');
WorldName = WorldName.ChopFront(Underscore + 1);

View File

@@ -24,7 +24,7 @@ bool CGameInfo::LoadGameInfo(TString Path)
bool CGameInfo::SaveGameInfo(TString Path /*= ""*/)
{
ASSERT(mGame != eUnknownGame); // can't save game info that was never loaded
ASSERT(mGame != EGame::Invalid); // can't save game info that was never loaded
if (Path.IsEmpty()) Path = GetDefaultGameInfoPath(mGame);
CXMLWriter Writer(Path, "GameInfo", 0, mGame);
@@ -35,16 +35,16 @@ bool CGameInfo::SaveGameInfo(TString Path /*= ""*/)
void CGameInfo::Serialize(IArchive& rArc)
{
// Validate game
if (rArc.IsReader() && mGame != eUnknownGame)
if (rArc.IsReader() && mGame != EGame::Invalid)
{
ASSERT(mGame == rArc.Game());
}
// Serialize data
rArc << SERIAL_CONTAINER("GameBuilds", mBuilds, "Build");
rArc << SerialParameter("GameBuilds", mBuilds);
if (mGame <= ePrime)
rArc << SERIAL_CONTAINER("AreaNameMap", mAreaNameMap, "AreaName");
if (mGame <= EGame::Prime)
rArc << SerialParameter("AreaNameMap", mAreaNameMap);
}
TString CGameInfo::GetBuildName(float BuildVer, ERegion Region) const
@@ -69,9 +69,9 @@ TString CGameInfo::GetAreaName(const CAssetID &rkID) const
// ************ STATIC ************
EGame CGameInfo::RoundGame(EGame Game)
{
if (Game == ePrimeDemo) return ePrime;
if (Game == eEchoesDemo) return eEchoes;
if (Game == eCorruptionProto) return eCorruption;
if (Game == EGame::PrimeDemo) return EGame::Prime;
if (Game == EGame::EchoesDemo) return EGame::Echoes;
if (Game == EGame::CorruptionProto) return EGame::Corruption;
return Game;
}
@@ -79,7 +79,7 @@ TString CGameInfo::GetDefaultGameInfoPath(EGame Game)
{
Game = RoundGame(Game);
if (Game == eUnknownGame)
if (Game == EGame::Invalid)
return "";
TString GameName = GetGameShortName(Game);

View File

@@ -11,6 +11,8 @@
const TString gkGameInfoDir = "../resources/gameinfo";
const TString gkGameInfoExt = "xml";
//@todo merge this class into CGameTemplate
// they serve similar purposes, no real reason for them to be different classes
class CGameInfo
{
EGame mGame;
@@ -24,7 +26,9 @@ class CGameInfo
void Serialize(IArchive& rArc)
{
rArc << SERIAL_AUTO(Version) << SERIAL_AUTO(Region) << SERIAL_AUTO(Name);
rArc << SerialParameter("Version", Version)
<< SerialParameter("Region", Region)
<< SerialParameter("Name", Name);
}
};
std::vector<SBuildInfo> mBuilds;
@@ -34,7 +38,7 @@ class CGameInfo
public:
CGameInfo()
: mGame(eUnknownGame)
: mGame(EGame::Invalid)
{}
bool LoadGameInfo(EGame Game);

View File

@@ -1,7 +1,6 @@
#include "CGameProject.h"
#include "IUIRelay.h"
#include "Core/Resource/Factory/CTemplateLoader.h"
#include "Core/Resource/Script/CMasterTemplate.h"
#include "Core/Resource/Script/CGameTemplate.h"
#include <Common/Serialization/XML.h>
#include <nod/nod.hpp>
@@ -36,10 +35,10 @@ bool CGameProject::Save()
bool CGameProject::Serialize(IArchive& rArc)
{
rArc << SERIAL("Name", mProjectName)
<< SERIAL("Region", mRegion)
<< SERIAL("GameID", mGameID)
<< SERIAL("BuildVersion", mBuildVersion);
rArc << SerialParameter("Name", mProjectName)
<< SerialParameter("Region", mRegion)
<< SerialParameter("GameID", mGameID)
<< SerialParameter("BuildVersion", mBuildVersion);
// Serialize package list
std::vector<TString> PackageList;
@@ -50,7 +49,7 @@ bool CGameProject::Serialize(IArchive& rArc)
PackageList.push_back( mPackages[iPkg]->DefinitionPath(true) );
}
rArc << SERIAL_CONTAINER("Packages", PackageList, "Package");
rArc << SerialParameter("Packages", PackageList);
// Load packages
if (rArc.IsReader())
@@ -82,9 +81,9 @@ bool CGameProject::BuildISO(const TString& rkIsoPath, IProgressNotifier *pProgre
ASSERT( FileUtil::IsValidPath(rkIsoPath, false) );
ASSERT( !IsWiiDeAsobu() && !IsTrilogy() );
auto ProgressCallback = [&](float ProgressPercent, const nod::SystemString& rkInfoString, size_t)
auto ProgressCallback = [&](float ProgressPercent, const nod::SystemStringView& rkInfoString, size_t)
{
pProgress->Report((int) (ProgressPercent * 10000), 10000, TWideString(rkInfoString).ToUTF8());
pProgress->Report((int) (ProgressPercent * 10000), 10000, TWideString(rkInfoString.data()).ToUTF8());
};
pProgress->SetTask(0, "Building " + rkIsoPath.GetFileName());
@@ -108,9 +107,9 @@ bool CGameProject::MergeISO(const TString& rkIsoPath, nod::DiscWii *pOriginalIso
ASSERT( IsWiiDeAsobu() || IsTrilogy() );
ASSERT( pOriginalIso != nullptr );
auto ProgressCallback = [&](float ProgressPercent, const nod::SystemString& rkInfoString, size_t)
auto ProgressCallback = [&](float ProgressPercent, const nod::SystemStringView& rkInfoString, size_t)
{
pProgress->Report((int) (ProgressPercent * 10000), 10000, TWideString(rkInfoString).ToUTF8());
pProgress->Report((int) (ProgressPercent * 10000), 10000, TWideString(rkInfoString.data()).ToUTF8());
};
pProgress->SetTask(0, "Building " + rkIsoPath.GetFileName());
@@ -266,7 +265,6 @@ CGameProject* CGameProject::LoadProject(const TString& rkProjPath, IProgressNoti
return nullptr;
}
CTemplateLoader::LoadGameTemplates(pProj->mGame);
pProj->mProjFileLock.Lock(ProjPath);
pProj->mpGameInfo->LoadGameInfo(pProj->mGame);
pProj->mpAudioManager->LoadAssets();

View File

@@ -6,7 +6,7 @@
#include "CResourceStore.h"
#include "Core/CAudioManager.h"
#include "Core/IProgressNotifier.h"
#include "Core/Resource/Script/CMasterTemplate.h"
#include "Core/Resource/Script/CGameTemplate.h"
#include <Common/CAssetID.h>
#include <Common/EGame.h>
#include <Common/FileUtil.h>
@@ -45,8 +45,8 @@ class CGameProject
// Private Constructor
CGameProject()
: mProjectName("Unnamed Project")
, mGame(eUnknownGame)
, mRegion(eRegion_Unknown)
, mGame(EGame::Invalid)
, mRegion(ERegion::Unknown)
, mGameID("000000")
, mBuildVersion(0.f)
, mpResourceStore(nullptr)
@@ -103,8 +103,8 @@ public:
inline TString GameID() const { return mGameID; }
inline float BuildVersion() const { return mBuildVersion; }
inline bool IsWiiBuild() const { return mBuildVersion >= 3.f; }
inline bool IsTrilogy() const { return mGame <= eCorruption && mBuildVersion >= 3.593f; }
inline bool IsWiiDeAsobu() const { return mGame <= eCorruption && mBuildVersion >= 3.570f && mBuildVersion < 3.593f; }
inline bool IsTrilogy() const { return mGame <= EGame::Corruption && mBuildVersion >= 3.593f; }
inline bool IsWiiDeAsobu() const { return mGame <= EGame::Corruption && mBuildVersion >= 3.570f && mBuildVersion < 3.593f; }
};
#endif // CGAMEPROJECT_H

View File

@@ -29,15 +29,15 @@ bool CPackage::Save()
TString DefPath = DefinitionPath(false);
FileUtil::MakeDirectory(DefPath.GetFileDirectory());
CXMLWriter Writer(DefPath, "PackageDefinition", 0, mpProject ? mpProject->Game() : eUnknownGame);
CXMLWriter Writer(DefPath, "PackageDefinition", 0, mpProject ? mpProject->Game() : EGame::Invalid);
Serialize(Writer);
return Writer.Save();
}
void CPackage::Serialize(IArchive& rArc)
{
rArc << SERIAL("NeedsRecook", mNeedsRecook)
<< SERIAL_CONTAINER("NamedResources", mResources, "Resource");
rArc << SerialParameter("NeedsRecook", mNeedsRecook)
<< SerialParameter("NamedResources", mResources);
}
void CPackage::AddResource(const TString& rkName, const CAssetID& rkID, const CFourCC& rkType)
@@ -82,7 +82,7 @@ void CPackage::Cook(IProgressNotifier *pProgress)
}
EGame Game = mpProject->Game();
u32 Alignment = (Game <= eCorruptionProto ? 0x20 : 0x40);
u32 Alignment = (Game <= EGame::CorruptionProto ? 0x20 : 0x40);
u32 AlignmentMinusOne = Alignment - 1;
u32 TocOffset = 0;
@@ -92,7 +92,7 @@ void CPackage::Cook(IProgressNotifier *pProgress)
u32 ResDataSize = 0;
// Write MP1 pak header
if (Game <= eCorruptionProto)
if (Game <= EGame::CorruptionProto)
{
Pak.WriteLong(0x00030005); // Major/Minor Version
Pak.WriteLong(0); // Unknown
@@ -188,7 +188,7 @@ void CPackage::Cook(IProgressNotifier *pProgress)
// Update table info
SResourceTableInfo& rTableInfo = ResourceTableData[ResIdx];
rTableInfo.pEntry = pEntry;
rTableInfo.Offset = (Game <= eEchoes ? AssetOffset : AssetOffset - ResDataOffset);
rTableInfo.Offset = (Game <= EGame::Echoes ? AssetOffset : AssetOffset - ResDataOffset);
// Load resource data
CFileInStream CookedAsset(pEntry->CookedAssetPath(), IOUtil::eBigEndian);
@@ -201,12 +201,12 @@ void CPackage::Cook(IProgressNotifier *pProgress)
// Check if this asset should be compressed; there are a few resource types that are
// always compressed, and some types that are compressed if they're over a certain size
EResType Type = pEntry->ResourceType();
u32 CompressThreshold = (Game <= eCorruptionProto ? 0x400 : 0x80);
u32 CompressThreshold = (Game <= EGame::CorruptionProto ? 0x400 : 0x80);
bool ShouldAlwaysCompress = (Type == eTexture || Type == eModel || Type == eSkin ||
Type == eAnimSet || Type == eAnimation || Type == eFont);
if (Game >= eCorruption)
if (Game >= EGame::Corruption)
{
ShouldAlwaysCompress = ShouldAlwaysCompress ||
(Type == eCharacter || Type == eSourceAnimData || Type == eScan ||
@@ -234,7 +234,7 @@ void CPackage::Cook(IProgressNotifier *pProgress)
std::vector<u8> CompressedData(ResourceData.size() * 2);
bool Success = false;
if (Game <= eEchoesDemo || Game == eReturns)
if (Game <= EGame::EchoesDemo || Game == EGame::DKCReturns)
Success = CompressionUtil::CompressZlib(ResourceData.data(), ResourceData.size(), CompressedData.data(), CompressedData.size(), CompressedSize);
else
Success = CompressionUtil::CompressLZOSegmented(ResourceData.data(), ResourceData.size(), CompressedData.data(), CompressedSize, false);
@@ -242,7 +242,7 @@ void CPackage::Cook(IProgressNotifier *pProgress)
// Make sure that the compressed data is actually smaller, accounting for padding + uncompressed size value
if (Success)
{
u32 CompressionHeaderSize = (Game <= eCorruptionProto ? 4 : 0x10);
u32 CompressionHeaderSize = (Game <= EGame::CorruptionProto ? 4 : 0x10);
u32 PaddedUncompressedSize = (ResourceSize + AlignmentMinusOne) & ~AlignmentMinusOne;
u32 PaddedCompressedSize = (CompressedSize + CompressionHeaderSize + AlignmentMinusOne) & ~AlignmentMinusOne;
Success = (PaddedCompressedSize < PaddedUncompressedSize);
@@ -252,7 +252,7 @@ void CPackage::Cook(IProgressNotifier *pProgress)
if (Success)
{
// Write MP1/2 compressed asset
if (Game <= eCorruptionProto)
if (Game <= EGame::CorruptionProto)
{
Pak.WriteLong(ResourceSize);
}
@@ -292,7 +292,7 @@ void CPackage::Cook(IProgressNotifier *pProgress)
else
{
// Write table of contents for real
if (Game >= eCorruption)
if (Game >= EGame::Corruption)
{
Pak.Seek(TocOffset, SEEK_SET);
Pak.WriteLong(3); // Always 3 pak sections

View File

@@ -17,7 +17,9 @@ struct SNamedResource
void Serialize(IArchive& rArc)
{
rArc << SERIAL_AUTO(Name) << SERIAL_AUTO(ID) << SERIAL_AUTO(Type);
rArc << SerialParameter("Name", Name)
<< SerialParameter("ID", ID)
<< SerialParameter("Type", Type);
}
};

View File

@@ -127,9 +127,9 @@ void CResourceEntry::SerializeEntryInfo(IArchive& rArc, bool MetadataOnly)
{
CAssetID ID = mID;
rArc << SERIAL("AssetID", ID)
<< SERIAL("Type", mpTypeInfo)
<< SERIAL("Flags", mFlags);
rArc << SerialParameter("AssetID", ID)
<< SerialParameter("Type", mpTypeInfo)
<< SerialParameter("Flags", mFlags);
// Don't allow the file to override our asset ID if we already have a valid one.
if (rArc.IsReader() && !mID.IsValid())
@@ -140,9 +140,9 @@ void CResourceEntry::SerializeEntryInfo(IArchive& rArc, bool MetadataOnly)
{
TString Dir = (mpDirectory ? mpDirectory->FullPath() : "");
rArc << SERIAL("Name", mName)
<< SERIAL("Directory", Dir)
<< SERIAL_ABSTRACT("Dependencies", mpDependencies, &gDependencyNodeFactory);
rArc << SerialParameter("Name", mName)
<< SerialParameter("Directory", Dir)
<< SerialParameter("Dependencies", mpDependencies);
if (rArc.IsReader())
{
@@ -618,7 +618,7 @@ CGameProject* CResourceEntry::Project() const
EGame CResourceEntry::Game() const
{
return mpStore ? mpStore->Game() : eUnknownGame;
return mpStore ? mpStore->Game() : EGame::Invalid;
}
void CResourceEntry::SetFlag(EResEntryFlag Flag)

View File

@@ -18,7 +18,7 @@ CResourceStore *gpEditorStore = nullptr;
// Constructor for editor store
CResourceStore::CResourceStore(const TString& rkDatabasePath)
: mpProj(nullptr)
, mGame(ePrime)
, mGame(EGame::Prime)
, mDatabaseCacheDirty(false)
{
mpDatabaseRoot = new CVirtualDirectory(this);
@@ -29,7 +29,7 @@ CResourceStore::CResourceStore(const TString& rkDatabasePath)
// Main constructor for game projects and game exporter
CResourceStore::CResourceStore(CGameProject *pProject)
: mpProj(nullptr)
, mGame(eUnknownGame)
, mGame(EGame::Invalid)
, mpDatabaseRoot(nullptr)
, mDatabaseCacheDirty(false)
{
@@ -62,17 +62,17 @@ void RecursiveGetListOfEmptyDirectories(CVirtualDirectory *pDir, TStringList& rO
bool CResourceStore::SerializeDatabaseCache(IArchive& rArc)
{
// Serialize resources
if (rArc.ParamBegin("Resources"))
if (rArc.ParamBegin("Resources", 0))
{
// Serialize resources
u32 ResourceCount = mResourceEntries.size();
rArc << SERIAL_AUTO(ResourceCount);
rArc << SerialParameter("ResourceCount", ResourceCount);
if (rArc.IsReader())
{
for (u32 ResIdx = 0; ResIdx < ResourceCount; ResIdx++)
{
if (rArc.ParamBegin("Resource"))
if (rArc.ParamBegin("Resource", 0))
{
CResourceEntry *pEntry = CResourceEntry::BuildFromArchive(this, rArc);
ASSERT( FindEntry(pEntry->ID()) == nullptr );
@@ -85,7 +85,7 @@ bool CResourceStore::SerializeDatabaseCache(IArchive& rArc)
{
for (CResourceIterator It(this); It; ++It)
{
if (rArc.ParamBegin("Resource"))
if (rArc.ParamBegin("Resource", 0))
{
It->SerializeEntryInfo(rArc, false);
rArc.ParamEnd();
@@ -101,7 +101,7 @@ bool CResourceStore::SerializeDatabaseCache(IArchive& rArc)
if (!rArc.IsReader())
RecursiveGetListOfEmptyDirectories(mpDatabaseRoot, EmptyDirectories);
rArc << SERIAL_CONTAINER_AUTO(EmptyDirectories, "Directory");
rArc << SerialParameter("EmptyDirectories", EmptyDirectories);
if (rArc.IsReader())
{
@@ -218,7 +218,7 @@ void CResourceStore::CloseProject()
delete mpDatabaseRoot;
mpDatabaseRoot = nullptr;
mpProj = nullptr;
mGame = eUnknownGame;
mGame = EGame::Invalid;
}
CVirtualDirectory* CResourceStore::GetVirtualDirectory(const TString& rkPath, bool AllowCreate)
@@ -622,5 +622,5 @@ bool CResourceStore::IsValidResourcePath(const TString& rkPath, const TString& r
TString CResourceStore::StaticDefaultResourceDirPath(EGame Game)
{
return (Game < eCorruptionProto ? "Uncategorized/" : "uncategorized/");
return (Game < EGame::CorruptionProto ? "Uncategorized/" : "uncategorized/");
}

View File

@@ -3,7 +3,7 @@
// ************ CCharacterUsageMap ************
bool CCharacterUsageMap::IsCharacterUsed(const CAssetID& rkID, u32 CharacterIndex) const
{
if (mpStore->Game() >= eCorruptionProto) return true;
if (mpStore->Game() >= EGame::CorruptionProto) return true;
auto Find = mUsageMap.find(rkID);
if (Find == mUsageMap.end()) return false;
@@ -214,7 +214,7 @@ void CPackageDependencyListBuilder::AddDependency(CResourceEntry *pCurEntry, con
// Is this entry valid?
bool IsValid = ResType != eMidi &&
(ResType != eAudioGroup || mGame >= eEchoesDemo) &&
(ResType != eAudioGroup || mGame >= EGame::EchoesDemo) &&
(ResType != eWorld || !pCurEntry) &&
(ResType != eArea || !pCurEntry || pCurEntry->ResourceType() == eWorld);
@@ -232,7 +232,7 @@ void CPackageDependencyListBuilder::AddDependency(CResourceEntry *pCurEntry, con
// New area - toggle duplicates and find character usages
if (ResType == eArea)
{
if (mGame <= eEchoes)
if (mGame <= EGame::Echoes)
mCharacterUsageMap.FindUsagesForArea(mpWorld, pEntry);
mAreaUsedAssets.clear();
@@ -417,7 +417,7 @@ void CAreaDependencyListBuilder::BuildDependencyList(std::list<CAssetID>& rAsset
CPropertyDependency *pDep = static_cast<CPropertyDependency*>(pInst->ChildByIndex(iDep));
// For MP3, exclude the CMDL/CSKR properties for the suit assets - only include default character assets
if (mGame == eCorruption && mIsPlayerActor)
if (mGame == EGame::Corruption && mIsPlayerActor)
{
TString PropID = pDep->PropertyID();
@@ -467,7 +467,7 @@ void CAreaDependencyListBuilder::AddDependency(const CAssetID& rkID, std::list<C
EResType ResType = pEntry->ResourceType();
// If this is an audio group, for MP1, save it in the output set. For MP2, treat audio groups as a normal dependency.
if (mGame <= ePrime && ResType == eAudioGroup)
if (mGame <= EGame::Prime && ResType == eAudioGroup)
{
if (pAudioGroupsOut)
pAudioGroupsOut->insert(rkID);
@@ -534,7 +534,7 @@ void CAreaDependencyListBuilder::EvaluateDependencyNode(CResourceEntry *pCurEntr
else if (Type == eDNT_SetCharacter)
{
// Note: For MP1/2 PlayerActor, always treat as if Empty Suit is the only used one
const u32 kEmptySuitIndex = (mGame >= eEchoesDemo ? 3 : 5);
const u32 kEmptySuitIndex = (mGame >= EGame::EchoesDemo ? 3 : 5);
CSetCharacterDependency *pChar = static_cast<CSetCharacterDependency*>(pNode);
u32 SetIndex = pChar->CharSetIndex();