externals: Update LibCommon

This commit is contained in:
Lioncash 2020-06-11 11:10:04 -04:00
parent b5ddc20771
commit 61a6151afe
6 changed files with 33 additions and 33 deletions

2
externals/LibCommon vendored

@ -1 +1 @@
Subproject commit bf20ede2163667bb1f605c5add227d798093b09e Subproject commit 3e9c55ebcc5b51c693a4b2ee828ea82d6b479059

View File

@ -19,8 +19,8 @@ bool CAssetNameMap::LoadAssetNames(TString Path /*= ""*/)
else else
{ {
debugf("Failed to load asset names; expected %s IDs, got %s", debugf("Failed to load asset names; expected %s IDs, got %s",
mIDLength == k32Bit ? "32-bit" : "64-bit", mIDLength == EIDLength::k32Bit ? "32-bit" : "64-bit",
FileIDLength == k32Bit ? "32-bit" : "64-bit" ); FileIDLength == EIDLength::k32Bit ? "32-bit" : "64-bit" );
return false; return false;
} }
} }
@ -36,7 +36,7 @@ bool CAssetNameMap::SaveAssetNames(TString Path /*= ""*/)
if (Path.IsEmpty()) if (Path.IsEmpty())
Path = DefaultNameMapPath(mIDLength); Path = DefaultNameMapPath(mIDLength);
EGame Game = (mIDLength == k32Bit ? EGame::Prime : EGame::Corruption); EGame Game = (mIDLength == EIDLength::k32Bit ? EGame::Prime : EGame::Corruption);
CXMLWriter Writer(Path, "AssetNameMap", 0, Game); CXMLWriter Writer(Path, "AssetNameMap", 0, Game);
Serialize(Writer); Serialize(Writer);
return Writer.Save(); return Writer.Save();
@ -58,7 +58,7 @@ bool CAssetNameMap::GetNameInfo(CAssetID ID, TString& rOutDirectory, TString& rO
else else
{ {
EGame Game = (ID.Length() == k32Bit ? EGame::Prime : EGame::Corruption); EGame Game = (ID.Length() == EIDLength::k32Bit ? EGame::Prime : EGame::Corruption);
rOutDirectory = CResourceStore::StaticDefaultResourceDirPath(Game); rOutDirectory = CResourceStore::StaticDefaultResourceDirPath(Game);
rOutName = ID.ToString(); rOutName = ID.ToString();
rOutAutoGenDir = true; rOutAutoGenDir = true;
@ -194,7 +194,7 @@ void CAssetNameMap::PostLoadValidate()
TString CAssetNameMap::DefaultNameMapPath(EIDLength IDLength) TString CAssetNameMap::DefaultNameMapPath(EIDLength IDLength)
{ {
ASSERT(IDLength != kInvalidIDLength); ASSERT(IDLength != kInvalidIDLength);
TString Suffix = (IDLength == k32Bit ? "32" : "64"); TString Suffix = (IDLength == EIDLength::k32Bit ? "32" : "64");
return gDataDir + gkAssetMapPath + Suffix + "." + gkAssetMapExt; return gDataDir + gkAssetMapPath + Suffix + "." + gkAssetMapExt;
} }

View File

@ -387,7 +387,7 @@ void CPackage::CompareOriginalAssetList(const std::list<CAssetID>& rkNewList)
for (uint32 iRes = 0; iRes < NumResources; iRes++) for (uint32 iRes = 0; iRes < NumResources; iRes++)
{ {
Pak.Seek(0x8, SEEK_CUR); Pak.Seek(0x8, SEEK_CUR);
OldListSet.insert( CAssetID(Pak, k32Bit) ); OldListSet.insert(CAssetID(Pak, EIDLength::k32Bit));
Pak.Seek(0x8, SEEK_CUR); Pak.Seek(0x8, SEEK_CUR);
} }
} }
@ -411,7 +411,7 @@ void CPackage::CompareOriginalAssetList(const std::list<CAssetID>& rkNewList)
for (uint32 iRes = 0; iRes < NumResources; iRes++) for (uint32 iRes = 0; iRes < NumResources; iRes++)
{ {
Pak.Seek(0x8, SEEK_CUR); Pak.Seek(0x8, SEEK_CUR);
OldListSet.insert( CAssetID(Pak, k64Bit) ); OldListSet.insert(CAssetID(Pak, EIDLength::k64Bit));
Pak.Seek(0x8, SEEK_CUR); Pak.Seek(0x8, SEEK_CUR);
} }
} }

View File

@ -24,13 +24,13 @@ CAnimSet* CAnimSetLoader::LoadCorruptionCHAR(IInputStream& rCHAR)
{ {
SOverlayModel Overlay; SOverlayModel Overlay;
Overlay.Type = (EOverlayType) rCHAR.ReadLong(); Overlay.Type = (EOverlayType) rCHAR.ReadLong();
Overlay.ModelID = CAssetID(rCHAR, k64Bit); Overlay.ModelID = CAssetID(rCHAR, EIDLength::k64Bit);
Overlay.SkinID = CAssetID(rCHAR, k64Bit); Overlay.SkinID = CAssetID(rCHAR, EIDLength::k64Bit);
rChar.OverlayModels.push_back(Overlay); rChar.OverlayModels.push_back(Overlay);
} }
rChar.pSkeleton = gpResourceStore->LoadResource<CSkeleton>(rCHAR.ReadLongLong()); rChar.pSkeleton = gpResourceStore->LoadResource<CSkeleton>(rCHAR.ReadLongLong());
rChar.AnimDataID = CAssetID(rCHAR, k64Bit); rChar.AnimDataID = CAssetID(rCHAR, EIDLength::k64Bit);
// PAS Database // PAS Database
LoadPASDatabase(rCHAR); LoadPASDatabase(rCHAR);
@ -88,7 +88,7 @@ CAnimSet* CAnimSetLoader::LoadCorruptionCHAR(IInputStream& rCHAR)
for (uint32 SoundIdx = 0; SoundIdx < NumSounds; SoundIdx++) for (uint32 SoundIdx = 0; SoundIdx < NumSounds; SoundIdx++)
{ {
CAssetID SoundID(rCHAR, k64Bit); const CAssetID SoundID(rCHAR, EIDLength::k64Bit);
rChar.SoundEffects.push_back(SoundID); rChar.SoundEffects.push_back(SoundID);
} }
@ -581,7 +581,7 @@ CAnimSet* CAnimSetLoader::LoadANCS(IInputStream& rANCS, CResourceEntry *pEntry)
{ {
rANCS.ReadString(); rANCS.ReadString();
rANCS.Seek(0x4, SEEK_CUR); rANCS.Seek(0x4, SEEK_CUR);
CAssetID ParticleID(rANCS, k32Bit); CAssetID ParticleID(rANCS, EIDLength::k32Bit);
if (ParticleID.IsValid()) pChar->EffectParticles.push_back(ParticleID); if (ParticleID.IsValid()) pChar->EffectParticles.push_back(ParticleID);
if (Loader.mGame == EGame::Prime) rANCS.ReadString(); if (Loader.mGame == EGame::Prime) rANCS.ReadString();
@ -592,8 +592,8 @@ CAnimSet* CAnimSetLoader::LoadANCS(IInputStream& rANCS, CResourceEntry *pEntry)
SOverlayModel Overlay; SOverlayModel Overlay;
Overlay.Type = EOverlayType::Frozen; Overlay.Type = EOverlayType::Frozen;
Overlay.ModelID = CAssetID(rANCS, k32Bit); Overlay.ModelID = CAssetID(rANCS, EIDLength::k32Bit);
Overlay.SkinID = CAssetID(rANCS, k32Bit); Overlay.SkinID = CAssetID(rANCS, EIDLength::k32Bit);
pChar->OverlayModels.push_back(Overlay); pChar->OverlayModels.push_back(Overlay);
uint32 AnimIndexCount = rANCS.ReadLong(); uint32 AnimIndexCount = rANCS.ReadLong();
@ -664,8 +664,8 @@ CSourceAnimData* CAnimSetLoader::LoadSAND(IInputStream& rSAND, CResourceEntry *p
ASSERT(UnkByte == 0); ASSERT(UnkByte == 0);
CSourceAnimData::STransition Transition; CSourceAnimData::STransition Transition;
Transition.AnimA = CAssetID(rSAND, k64Bit); Transition.AnimA = CAssetID(rSAND, EIDLength::k64Bit);
Transition.AnimB = CAssetID(rSAND, k64Bit); Transition.AnimB = CAssetID(rSAND, EIDLength::k64Bit);
Transition.pTransition = gMetaTransFactory.LoadFromStream(rSAND, pEntry->Game()); Transition.pTransition = gMetaTransFactory.LoadFromStream(rSAND, pEntry->Game());
pData->mTransitions.push_back(Transition); pData->mTransitions.push_back(Transition);
} }
@ -679,7 +679,7 @@ CSourceAnimData* CAnimSetLoader::LoadSAND(IInputStream& rSAND, CResourceEntry *p
ASSERT(UnkByte == 0); ASSERT(UnkByte == 0);
CSourceAnimData::SHalfTransition HalfTrans; CSourceAnimData::SHalfTransition HalfTrans;
HalfTrans.Anim = CAssetID(rSAND, k64Bit); HalfTrans.Anim = CAssetID(rSAND, EIDLength::k64Bit);
HalfTrans.pTransition = gMetaTransFactory.LoadFromStream(rSAND, pEntry->Game()); HalfTrans.pTransition = gMetaTransFactory.LoadFromStream(rSAND, pEntry->Game());
pData->mHalfTransitions.push_back(HalfTrans); pData->mHalfTransitions.push_back(HalfTrans);
} }

View File

@ -176,7 +176,7 @@ CDependencyGroup* CUnsupportedFormatLoader::LoadFRME(IInputStream& rFRME, CResou
// Model // Model
else if (WidgetType == FOURCC('MODL')) else if (WidgetType == FOURCC('MODL'))
{ {
pGroup->AddDependency( CAssetID(rFRME, k32Bit) ); // CMDL pGroup->AddDependency(CAssetID(rFRME, EIDLength::k32Bit)); // CMDL
rFRME.Seek(0x8, SEEK_CUR); rFRME.Seek(0x8, SEEK_CUR);
} }
@ -184,12 +184,12 @@ CDependencyGroup* CUnsupportedFormatLoader::LoadFRME(IInputStream& rFRME, CResou
else if (WidgetType == FOURCC('TXPN')) else if (WidgetType == FOURCC('TXPN'))
{ {
rFRME.Seek(0x14, SEEK_CUR); rFRME.Seek(0x14, SEEK_CUR);
pGroup->AddDependency( CAssetID(rFRME, k32Bit) ); // FONT pGroup->AddDependency(CAssetID(rFRME, EIDLength::k32Bit)); // FONT
rFRME.Seek(0x32, SEEK_CUR); rFRME.Seek(0x32, SEEK_CUR);
if (Version == 1) if (Version == 1)
{ {
pGroup->AddDependency( CAssetID(rFRME, k32Bit) ); // FONT pGroup->AddDependency(CAssetID(rFRME, EIDLength::k32Bit)); // FONT
rFRME.Seek(0x8, SEEK_CUR); rFRME.Seek(0x8, SEEK_CUR);
} }
} }
@ -197,7 +197,7 @@ CDependencyGroup* CUnsupportedFormatLoader::LoadFRME(IInputStream& rFRME, CResou
// Image Pane // Image Pane
else if (WidgetType == FOURCC('IMGP')) else if (WidgetType == FOURCC('IMGP'))
{ {
pGroup->AddDependency( CAssetID(rFRME, k32Bit) ); // TXTR pGroup->AddDependency(CAssetID(rFRME, EIDLength::k32Bit)); // TXTR
if (rFRME.ReadLong() != 0xFFFFFFFF) DEBUG_BREAK; if (rFRME.ReadLong() != 0xFFFFFFFF) DEBUG_BREAK;
rFRME.Seek(0x4, SEEK_CUR); rFRME.Seek(0x4, SEEK_CUR);
@ -210,7 +210,7 @@ CDependencyGroup* CUnsupportedFormatLoader::LoadFRME(IInputStream& rFRME, CResou
// Energy Bar // Energy Bar
else if (WidgetType == FOURCC('ENRG')) else if (WidgetType == FOURCC('ENRG'))
{ {
pGroup->AddDependency( CAssetID(rFRME, k32Bit) ); // TXTR pGroup->AddDependency(CAssetID(rFRME, EIDLength::k32Bit)); // TXTR
} }
// Slider Group // Slider Group
@ -490,14 +490,14 @@ CDependencyGroup* CUnsupportedFormatLoader::LoadMAPW(IInputStream& rMAPW, CResou
// Version check // Version check
uint32 AreasStart = rMAPW.Tell(); uint32 AreasStart = rMAPW.Tell();
rMAPW.Seek(NumAreas * 4, SEEK_CUR); rMAPW.Seek(NumAreas * 4, SEEK_CUR);
EIDLength IDLength = (rMAPW.EoF() || rMAPW.ReadLong() == 0xFFFFFFFF ? k32Bit : k64Bit); const auto IDLength = (rMAPW.EoF() || rMAPW.ReadLong() == 0xFFFFFFFF ? EIDLength::k32Bit : EIDLength::k64Bit);
rMAPW.Seek(AreasStart, SEEK_SET); rMAPW.Seek(AreasStart, SEEK_SET);
// Read MAPA IDs // Read MAPA IDs
CDependencyGroup *pGroup = new CDependencyGroup(pEntry); CDependencyGroup *pGroup = new CDependencyGroup(pEntry);
for (uint32 iArea = 0; iArea < NumAreas; iArea++) for (uint32 iArea = 0; iArea < NumAreas; iArea++)
pGroup->AddDependency( CAssetID(rMAPW, IDLength) ); pGroup->AddDependency(CAssetID(rMAPW, IDLength));
return pGroup; return pGroup;
} }
@ -532,21 +532,21 @@ CDependencyGroup* CUnsupportedFormatLoader::LoadMAPU(IInputStream& rMAPU, CResou
CDependencyGroup* CUnsupportedFormatLoader::LoadRULE(IInputStream& rRULE, CResourceEntry *pEntry) CDependencyGroup* CUnsupportedFormatLoader::LoadRULE(IInputStream& rRULE, CResourceEntry *pEntry)
{ {
// RULE files can contain a reference to another RULE file, but has no other dependencies. // RULE files can contain a reference to another RULE file, but has no other dependencies.
uint32 Magic = rRULE.ReadLong(); const uint32 Magic = rRULE.ReadLong();
ASSERT(Magic == FOURCC('RULE')); ASSERT(Magic == FOURCC('RULE'));
CDependencyGroup *pGroup = new CDependencyGroup(pEntry); CDependencyGroup *pGroup = new CDependencyGroup(pEntry);
rRULE.Seek(0x1, SEEK_CUR); rRULE.Seek(0x1, SEEK_CUR);
// Version test // Version test
uint32 IDOffset = rRULE.Tell(); const uint32 IDOffset = rRULE.Tell();
rRULE.Seek(0x4, SEEK_CUR); rRULE.Seek(0x4, SEEK_CUR);
uint32 RuleSetCount = rRULE.ReadShort(); const uint32 RuleSetCount = rRULE.ReadShort();
EIDLength IDLength = (RuleSetCount > 0xFF ? k64Bit : k32Bit); const auto IDLength = (RuleSetCount > 0xFF ? EIDLength::k64Bit : EIDLength::k32Bit);
rRULE.Seek(IDOffset, SEEK_SET); rRULE.Seek(IDOffset, SEEK_SET);
// Read rule ID // Read rule ID
CAssetID RuleID(rRULE, IDLength); const CAssetID RuleID(rRULE, IDLength);
pGroup->AddDependency(RuleID); pGroup->AddDependency(RuleID);
return pGroup; return pGroup;
} }

View File

@ -849,10 +849,10 @@ void CResourceBrowser::FindAssetByID()
StringAssetID = StringAssetID.ChopFront(2); StringAssetID = StringAssetID.ChopFront(2);
// Find the resource entry // Find the resource entry
if ( (IDLength == k32Bit && StringAssetID.Length() == 8) || if ((IDLength == EIDLength::k32Bit && StringAssetID.Length() == 8) ||
(IDLength == k64Bit && StringAssetID.Length() == 16) ) (IDLength == EIDLength::k64Bit && StringAssetID.Length() == 16))
{ {
CAssetID ID = (IDLength == k32Bit ? StringAssetID.ToInt32(16) : StringAssetID.ToInt64(16)); CAssetID ID = (IDLength == EIDLength::k32Bit ? StringAssetID.ToInt32(16) : StringAssetID.ToInt64(16));
CResourceEntry *pEntry = mpStore->FindEntry(ID); CResourceEntry *pEntry = mpStore->FindEntry(ID);
WasValid = true; WasValid = true;