mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-16 08:27:01 +00:00
Changed EGame to an enum class. Created NGameList and NPropertyMap to change how templates are managed/saved/loaded. Added support for property map keeping track of ID/type pairs.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -292,7 +292,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
||||
|
||||
if (Name.StartsWith("POI_", false))
|
||||
{
|
||||
TIDString ScanIDString = (pProj->Game() <= ePrime ? "0x4:0x0" : "0xBDBEC295:0xB94E9BE7");
|
||||
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
|
||||
|
||||
@@ -327,7 +327,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
||||
|
||||
if (Name.EndsWith(".STRG", false))
|
||||
{
|
||||
u32 StringPropID = (pProj->Game() <= ePrime ? 0x4 : 0x9182250C);
|
||||
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
|
||||
|
||||
@@ -353,7 +353,7 @@ 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);
|
||||
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
|
||||
|
||||
@@ -415,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)
|
||||
{
|
||||
@@ -485,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)
|
||||
@@ -505,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 );
|
||||
|
||||
@@ -607,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);
|
||||
@@ -622,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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Core/Resource/Script/CGameTemplate.h"
|
||||
#include "Core/Resource/Script/CScriptLayer.h"
|
||||
#include "Core/Resource/Script/CScriptObject.h"
|
||||
#include "Core/Resource/Script/NGameList.h"
|
||||
|
||||
// ************ IDependencyNode ************
|
||||
IDependencyNode::~IDependencyNode()
|
||||
@@ -203,7 +204,7 @@ void CScriptInstanceDependency::ParseStructDependencies(CScriptInstanceDependenc
|
||||
if (ID.IsValid())
|
||||
{
|
||||
// Character sets are removed starting in MP3, so we only need char property dependencies in Echoes and earlier
|
||||
if (pStruct->Game() <= eEchoes)
|
||||
if (pStruct->Game() <= EGame::Echoes)
|
||||
{
|
||||
CCharPropertyDependency *pDep = new CCharPropertyDependency(pProp->IDString(true), ID, Params.CharacterIndex());
|
||||
pInst->mChildren.push_back(pDep);
|
||||
@@ -298,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());
|
||||
@@ -345,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);
|
||||
@@ -360,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
|
||||
{
|
||||
CGameTemplate *pGame = CGameTemplate::GetGameTemplate(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
|
||||
|
||||
@@ -29,7 +29,7 @@ CGameExporter::CGameExporter(EDiscType DiscType, EGame Game, bool FrontEnd, EReg
|
||||
, mFrontEnd(FrontEnd)
|
||||
, mpProgress(nullptr)
|
||||
{
|
||||
ASSERT(mGame != eUnknownGame);
|
||||
ASSERT(mGame != EGame::Invalid);
|
||||
ASSERT(mRegion != ERegion::Unknown);
|
||||
}
|
||||
|
||||
@@ -116,15 +116,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:
|
||||
@@ -144,15 +144,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:
|
||||
@@ -278,7 +278,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);
|
||||
@@ -396,7 +396,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")
|
||||
{
|
||||
@@ -438,9 +438,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);
|
||||
|
||||
@@ -686,14 +686,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;
|
||||
@@ -712,7 +712,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);
|
||||
@@ -722,7 +722,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('_');
|
||||
@@ -736,7 +736,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);
|
||||
@@ -746,7 +746,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('_');
|
||||
|
||||
@@ -755,7 +755,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);
|
||||
|
||||
@@ -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,7 +35,7 @@ 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());
|
||||
}
|
||||
@@ -43,7 +43,7 @@ void CGameInfo::Serialize(IArchive& rArc)
|
||||
// Serialize data
|
||||
rArc << SerialParameter("GameBuilds", mBuilds);
|
||||
|
||||
if (mGame <= ePrime)
|
||||
if (mGame <= EGame::Prime)
|
||||
rArc << SerialParameter("AreaNameMap", mAreaNameMap);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
@@ -36,7 +38,7 @@ class CGameInfo
|
||||
|
||||
public:
|
||||
CGameInfo()
|
||||
: mGame(eUnknownGame)
|
||||
: mGame(EGame::Invalid)
|
||||
{}
|
||||
|
||||
bool LoadGameInfo(EGame Game);
|
||||
|
||||
@@ -45,7 +45,7 @@ class CGameProject
|
||||
// Private Constructor
|
||||
CGameProject()
|
||||
: mProjectName("Unnamed Project")
|
||||
, mGame(eUnknownGame)
|
||||
, mGame(EGame::Invalid)
|
||||
, mRegion(ERegion::Unknown)
|
||||
, mGameID("000000")
|
||||
, mBuildVersion(0.f)
|
||||
@@ -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
|
||||
|
||||
@@ -29,7 +29,7 @@ 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();
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
@@ -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/");
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user