mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-17 08:57:09 +00:00
Added support for tracking AGSC dependencies
This commit is contained in:
@@ -49,6 +49,7 @@ bool CWorldCooker::CookMLVL(CWorld *pWorld, IOutputStream& rMLVL)
|
||||
// Areas
|
||||
rMLVL.WriteLong(pWorld->mAreas.size());
|
||||
if (Game <= ePrime) rMLVL.WriteLong(1); // Unknown
|
||||
std::set<CAssetID> AudioGroups;
|
||||
|
||||
for (u32 iArea = 0; iArea < pWorld->mAreas.size(); iArea++)
|
||||
{
|
||||
@@ -79,7 +80,7 @@ bool CWorldCooker::CookMLVL(CWorld *pWorld, IOutputStream& rMLVL)
|
||||
std::list<CAssetID> Dependencies;
|
||||
std::list<u32> LayerDependsOffsets;
|
||||
CAreaDependencyListBuilder Builder(pAreaEntry);
|
||||
Builder.BuildDependencyList(Dependencies, LayerDependsOffsets);
|
||||
Builder.BuildDependencyList(Dependencies, LayerDependsOffsets, &AudioGroups);
|
||||
|
||||
rMLVL.WriteLong(0);
|
||||
rMLVL.WriteLong( Dependencies.size() );
|
||||
@@ -156,6 +157,59 @@ bool CWorldCooker::CookMLVL(CWorld *pWorld, IOutputStream& rMLVL)
|
||||
// Audio Groups
|
||||
if (Game <= ePrime)
|
||||
{
|
||||
#if 0
|
||||
// Debug: make sure our generated list matches the original, no missing or extra audio groups
|
||||
std::set<CAssetID> OriginalGroups;
|
||||
|
||||
for (u32 iGrp = 0; iGrp < pWorld->mAudioGrps.size(); iGrp++)
|
||||
{
|
||||
CWorld::SAudioGrp& rAudioGroup = pWorld->mAudioGrps[iGrp];
|
||||
OriginalGroups.insert(rAudioGroup.ResID);
|
||||
|
||||
if (AudioGroups.find(rAudioGroup.ResID) == AudioGroups.end())
|
||||
{
|
||||
CResourceEntry *pEntry = gpResourceStore->FindEntry(rAudioGroup.ResID);
|
||||
Log::Error("Missing audio group: " + pEntry->Name().ToUTF8());
|
||||
}
|
||||
}
|
||||
|
||||
for (auto It = AudioGroups.begin(); It != AudioGroups.end(); It++)
|
||||
{
|
||||
if (OriginalGroups.find(*It) == OriginalGroups.end())
|
||||
{
|
||||
CResourceEntry *pEntry = gpResourceStore->FindEntry(*It);
|
||||
Log::Error("Extra audio group: " + pEntry->Name().ToUTF8());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// Create sorted list of audio groups (sort by group ID)
|
||||
std::vector<CAudioGroup*> SortedAudioGroups;
|
||||
|
||||
for (auto It = AudioGroups.begin(); It != AudioGroups.end(); It++)
|
||||
{
|
||||
CAudioGroup *pGroup = (CAudioGroup*) gpResourceStore->LoadResource(*It, "AGSC");
|
||||
ASSERT(pGroup);
|
||||
SortedAudioGroups.push_back(pGroup);
|
||||
}
|
||||
|
||||
std::sort(SortedAudioGroups.begin(), SortedAudioGroups.end(), [](CAudioGroup *pLeft, CAudioGroup *pRight) -> bool {
|
||||
return pLeft->GroupID() < pRight->GroupID();
|
||||
});
|
||||
|
||||
// Write sorted audio group list to file
|
||||
rMLVL.WriteLong(SortedAudioGroups.size());
|
||||
|
||||
for (u32 iGrp = 0; iGrp < pWorld->mAudioGrps.size(); iGrp++)
|
||||
{
|
||||
CAudioGroup *pGroup = SortedAudioGroups[iGroup];
|
||||
rMLVL.WriteLong(pGroup->GroupID());
|
||||
pGroup->ID().Write(rMLVL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
rMLVL.WriteLong(pWorld->mAudioGrps.size());
|
||||
|
||||
for (u32 iGrp = 0; iGrp < pWorld->mAudioGrps.size(); iGrp++)
|
||||
@@ -164,6 +218,7 @@ bool CWorldCooker::CookMLVL(CWorld *pWorld, IOutputStream& rMLVL)
|
||||
rMLVL.WriteLong(rAudioGroup.GroupID);
|
||||
rAudioGroup.ResID.Write(rMLVL);
|
||||
}
|
||||
#endif
|
||||
|
||||
rMLVL.WriteByte(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user