Bunch of fixes to get MP3 exports working on a basic level; lots of fixes still needed

This commit is contained in:
Aruki 2017-02-18 19:41:39 -07:00
parent 68840e69f9
commit 5485d42b56
30 changed files with 106 additions and 75 deletions

View File

@ -1,6 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<GameInfo ArchiveVer="0" FileVer="0" Game="DKCR"> <GameInfo ArchiveVer="0" FileVer="0" Game="DKCR">
<GameBuilds> <GameBuilds>
<Build>
<Version>74844</Version>
<Region>NTSC</Region>
<Name>Wii NTSC 0A-0</Name>
</Build>
<Build> <Build>
<Version>74887</Version> <Version>74887</Version>
<Region>PAL</Region> <Region>PAL</Region>

View File

@ -63,7 +63,7 @@ TString CAssetID::ToString() const
if (mLength == e32Bit) if (mLength == e32Bit)
return TString::HexString(ToLong(), 8, false, true); return TString::HexString(ToLong(), 8, false, true);
else else
return TString::FromInt64(ToLongLong(), 8, 16).ToUpper(); return TString::FromInt64(ToLongLong(), 16, 16).ToUpper();
} }
bool CAssetID::IsValid() const bool CAssetID::IsValid() const

View File

@ -227,7 +227,8 @@ HEADERS += \
GameProject/AssetNameGeneration.h \ GameProject/AssetNameGeneration.h \
GameProject/CGameInfo.h \ GameProject/CGameInfo.h \
Resource/CResTypeInfo.h \ Resource/CResTypeInfo.h \
Resource/Cooker/CResourceCooker.h Resource/Cooker/CResourceCooker.h \
Resource/CAudioMacro.h
# Source Files # Source Files
SOURCES += \ SOURCES += \

View File

@ -41,6 +41,7 @@ void ApplyGeneratedName(CResourceEntry *pEntry, const TWideString& rkDir, const
TWideString MakeWorldName(EGame Game, TWideString RawName) TWideString MakeWorldName(EGame Game, TWideString RawName)
{ {
// The raw world names are basically formatted differently in every single game...
// MP1 demo - Remove ! from the beginning // MP1 demo - Remove ! from the beginning
if (Game == ePrimeDemo) if (Game == ePrimeDemo)
{ {
@ -75,18 +76,8 @@ TWideString MakeWorldName(EGame Game, TWideString RawName)
RawName = RawName.SubString(UnderscoreA + 1, UnderscoreB - UnderscoreA - 1); RawName = RawName.SubString(UnderscoreA + 1, UnderscoreB - UnderscoreA - 1);
} }
// MP3 proto - Remove ! from the beginning and all text after last underscore // MP2 - Remove text before first underscore and after last underscore, strip remaining underscores (except multiplayer maps, which have one underscore)
else if (Game == eCorruptionProto) else if (Game == eEchoes)
{
if (RawName.StartsWith(L'!'))
RawName = RawName.ChopFront(1);
u32 LastUnderscore = RawName.LastIndexOf(L"_");
RawName = RawName.ChopBack(RawName.Size() - LastUnderscore);
}
// MP2/3 - Remove text before first underscore and after last underscore, strip remaining underscores (except multiplayer maps, which have one underscore)
else if (Game == eEchoes || Game == eCorruption)
{ {
u32 FirstUnderscore = RawName.IndexOf(L'_'); u32 FirstUnderscore = RawName.IndexOf(L'_');
u32 LastUnderscore = RawName.LastIndexOf(L"_"); u32 LastUnderscore = RawName.LastIndexOf(L"_");
@ -99,6 +90,23 @@ TWideString MakeWorldName(EGame Game, TWideString RawName)
} }
} }
// MP3 proto - Remove ! from the beginning and all text after last underscore
else if (Game == eCorruptionProto)
{
if (RawName.StartsWith(L'!'))
RawName = RawName.ChopFront(1);
u32 LastUnderscore = RawName.LastIndexOf(L"_");
RawName = RawName.ChopBack(RawName.Size() - LastUnderscore);
}
// MP3 - Remove text after last underscore
else if (Game == eCorruption)
{
u32 LastUnderscore = RawName.LastIndexOf(L"_");
RawName = RawName.ChopBack(RawName.Size() - LastUnderscore);
}
// DKCR - Remove text after second-to-last underscore // DKCR - Remove text after second-to-last underscore
else if (Game == eReturns) else if (Game == eReturns)
{ {

View File

@ -100,12 +100,27 @@ void CGameProject::GetWorldList(std::list<CAssetID>& rOut) const
{ {
CPackage *pPkg = mPackages[iPkg]; CPackage *pPkg = mPackages[iPkg];
// Little workaround to fix some of Retro's paks having worlds listed in the wrong order...
// Construct a sorted list of worlds in this package
std::list<const SNamedResource*> PackageWorlds;
for (u32 iRes = 0; iRes < pPkg->NumNamedResources(); iRes++) for (u32 iRes = 0; iRes < pPkg->NumNamedResources(); iRes++)
{ {
const SNamedResource& rkRes = pPkg->NamedResourceByIndex(iRes); const SNamedResource& rkRes = pPkg->NamedResourceByIndex(iRes);
if (rkRes.Type == "MLVL" && !rkRes.Name.EndsWith("NODEPEND")) if (rkRes.Type == "MLVL" && !rkRes.Name.EndsWith("NODEPEND"))
rOut.push_back(rkRes.ID); PackageWorlds.push_back(&rkRes);
}
PackageWorlds.sort([](const SNamedResource *pkLeft, const SNamedResource *pkRight) -> bool {
return pkLeft->Name.ToUpper() < pkRight->Name.ToUpper();
});
// Add sorted worlds to the output world list
for (auto Iter = PackageWorlds.begin(); Iter != PackageWorlds.end(); Iter++)
{
const SNamedResource *pkRes = *Iter;
rOut.push_back(pkRes->ID);
} }
} }
} }

View File

@ -29,7 +29,6 @@ CResourceEntry::CResourceEntry(CResourceStore *pStore, const CAssetID& rkID,
mpDirectory = mpStore->GetVirtualDirectory(rkDir, Transient, true); mpDirectory = mpStore->GetVirtualDirectory(rkDir, Transient, true);
if (mpDirectory) mpDirectory->AddChild(L"", this); if (mpDirectory) mpDirectory->AddChild(L"", this);
mGame = ((Transient || !mpStore) ? eUnknownGame : mpStore->Game());
} }
CResourceEntry::~CResourceEntry() CResourceEntry::~CResourceEntry()
@ -74,6 +73,7 @@ void CResourceEntry::UpdateDependencies()
if (!mpResource) if (!mpResource)
{ {
Log::Error("Unable to update cached dependencies; failed to load resource"); Log::Error("Unable to update cached dependencies; failed to load resource");
mpDependencies = new CDependencyTree(ID());
return; return;
} }
@ -117,7 +117,7 @@ TString CResourceEntry::CookedAssetPath(bool Relative) const
CFourCC CResourceEntry::CookedExtension() const CFourCC CResourceEntry::CookedExtension() const
{ {
return mpTypeInfo->CookedExtension(mGame); return mpTypeInfo->CookedExtension(Game());
} }
bool CResourceEntry::IsInDirectory(CVirtualDirectory *pDir) const bool CResourceEntry::IsInDirectory(CVirtualDirectory *pDir) const
@ -157,17 +157,6 @@ bool CResourceEntry::NeedsRecook() const
return (FileUtil::LastModifiedTime(CookedAssetPath()) < FileUtil::LastModifiedTime(RawAssetPath())); return (FileUtil::LastModifiedTime(CookedAssetPath()) < FileUtil::LastModifiedTime(RawAssetPath()));
} }
void CResourceEntry::SetGame(EGame NewGame)
{
if (mGame != NewGame)
{
// todo: implement checks here. This needs work because we should trigger a recook and if the extension changes
// we should delete the old file. Also a lot of resources can't evaluate this correctly due to file version
// numbers being shared between games.
mGame = NewGame;
}
}
bool CResourceEntry::Save(bool SkipCacheSave /*= false*/) bool CResourceEntry::Save(bool SkipCacheSave /*= false*/)
{ {
// SkipCacheSave argument tells us not to save the resource cache file. This is generally not advised because we don't // SkipCacheSave argument tells us not to save the resource cache file. This is generally not advised because we don't
@ -196,7 +185,7 @@ bool CResourceEntry::Save(bool SkipCacheSave /*= false*/)
TString SerialName = mpTypeInfo->TypeName(); TString SerialName = mpTypeInfo->TypeName();
SerialName.RemoveWhitespace(); SerialName.RemoveWhitespace();
CXMLWriter Writer(Path, SerialName, 0, mGame); CXMLWriter Writer(Path, SerialName, 0, Game());
mpResource->Serialize(Writer); mpResource->Serialize(Writer);
if (!Writer.Save()) if (!Writer.Save())
@ -501,5 +490,10 @@ void CResourceEntry::RemoveFromProject()
CGameProject* CResourceEntry::Project() const CGameProject* CResourceEntry::Project() const
{ {
return mpStore->Project(); return mpStore ? mpStore->Project() : nullptr;
}
EGame CResourceEntry::Game() const
{
return mpStore ? mpStore->Game() : eUnknownGame;
} }

View File

@ -33,7 +33,6 @@ class CResourceEntry
CResourceStore *mpStore; CResourceStore *mpStore;
CDependencyTree *mpDependencies; CDependencyTree *mpDependencies;
CAssetID mID; CAssetID mID;
EGame mGame;
CVirtualDirectory *mpDirectory; CVirtualDirectory *mpDirectory;
TWideString mName; TWideString mName;
FResEntryFlags mFlags; FResEntryFlags mFlags;
@ -59,7 +58,6 @@ public:
bool IsInDirectory(CVirtualDirectory *pDir) const; bool IsInDirectory(CVirtualDirectory *pDir) const;
u64 Size() const; u64 Size() const;
bool NeedsRecook() const; bool NeedsRecook() const;
void SetGame(EGame NewGame);
bool Save(bool SkipCacheSave = false); bool Save(bool SkipCacheSave = false);
bool Cook(); bool Cook();
CResource* Load(); CResource* Load();
@ -70,6 +68,7 @@ public:
void AddToProject(const TWideString& rkDir, const TWideString& rkName); void AddToProject(const TWideString& rkDir, const TWideString& rkName);
void RemoveFromProject(); void RemoveFromProject();
CGameProject* Project() const; CGameProject* Project() const;
EGame Game() const;
// Accessors // Accessors
void SetDirty() { mFlags.SetFlag(eREF_NeedsRecook); } void SetDirty() { mFlags.SetFlag(eREF_NeedsRecook); }
@ -83,7 +82,6 @@ public:
inline CResourceStore* ResourceStore() const { return mpStore; } inline CResourceStore* ResourceStore() const { return mpStore; }
inline CDependencyTree* Dependencies() const { return mpDependencies; } inline CDependencyTree* Dependencies() const { return mpDependencies; }
inline CAssetID ID() const { return mID; } inline CAssetID ID() const { return mID; }
inline EGame Game() const { return mGame; }
inline CVirtualDirectory* Directory() const { return mpDirectory; } inline CVirtualDirectory* Directory() const { return mpDirectory; }
inline TWideString DirectoryPath() const { return mpDirectory->FullPath(); } inline TWideString DirectoryPath() const { return mpDirectory->FullPath(); }
inline TWideString Name() const { return mName; } inline TWideString Name() const { return mName; }

View File

@ -52,7 +52,6 @@ public:
inline CAssetID ID() const { return mpEntry ? mpEntry->ID() : CAssetID::skInvalidID64; } inline CAssetID ID() const { return mpEntry ? mpEntry->ID() : CAssetID::skInvalidID64; }
inline EGame Game() const { return mpEntry ? mpEntry->Game() : eUnknownGame; } inline EGame Game() const { return mpEntry ? mpEntry->Game() : eUnknownGame; }
inline bool IsReferenced() const { return mRefCount > 0; } inline bool IsReferenced() const { return mRefCount > 0; }
inline void SetGame(EGame Game) { if (mpEntry) mpEntry->SetGame(Game); }
inline void Lock() { mRefCount++; } inline void Lock() { mRefCount++; }
inline void Release() { mRefCount--; } inline void Release() { mRefCount--; }
}; };

View File

@ -76,6 +76,12 @@ public:
// Font // Font
if (TagName == L"font") if (TagName == L"font")
{ {
if (Game() >= eCorruptionProto)
{
ASSERT(ParamString.StartsWith(L"0x"));
ParamString = ParamString.ChopFront(2);
}
ASSERT(ParamString.Size() == IDLength * 2); ASSERT(ParamString.Size() == IDLength * 2);
pTree->AddDependency( CAssetID::FromString(ParamString) ); pTree->AddDependency( CAssetID::FromString(ParamString) );
} }
@ -115,6 +121,13 @@ public:
if (iParam >= TexturesStart) if (iParam >= TexturesStart)
{ {
TWideString Param = *Iter; TWideString Param = *Iter;
if (Game() >= eCorruptionProto)
{
ASSERT(Param.StartsWith(L"0x"));
Param = Param.ChopFront(2);
}
ASSERT(Param.Size() == IDLength * 2); ASSERT(Param.Size() == IDLength * 2);
pTree->AddDependency( CAssetID::FromString(Param) ); pTree->AddDependency( CAssetID::FromString(Param) );
} }

View File

@ -301,7 +301,6 @@ CAnimSet* CAnimSetLoader::LoadANCS(IInputStream& rANCS, CResourceEntry *pEntry)
if (iNode == 0 && Loader.mVersion == eUnknownGame) if (iNode == 0 && Loader.mVersion == eUnknownGame)
{ {
Loader.mVersion = (Unknown1 == 0xA) ? eEchoes : ePrime; // Best version indicator we know of unfortunately Loader.mVersion = (Unknown1 == 0xA) ? eEchoes : ePrime; // Best version indicator we know of unfortunately
Loader.pSet->SetGame(Loader.mVersion);
} }
pChar->Name = rANCS.ReadString(); pChar->Name = rANCS.ReadString();
pChar->pModel = gpResourceStore->LoadResource(rANCS.ReadLong(), "CMDL"); pChar->pModel = gpResourceStore->LoadResource(rANCS.ReadLong(), "CMDL");
@ -419,7 +418,6 @@ CAnimSet* CAnimSetLoader::LoadCHAR(IInputStream& rCHAR, CResourceEntry *pEntry)
{ {
Loader.mVersion = eCorruption; Loader.mVersion = eCorruption;
Loader.pSet = new CAnimSet(pEntry); Loader.pSet = new CAnimSet(pEntry);
Loader.pSet->SetGame(eCorruption);
return Loader.LoadCorruptionCHAR(rCHAR); return Loader.LoadCorruptionCHAR(rCHAR);
} }
@ -427,7 +425,6 @@ CAnimSet* CAnimSetLoader::LoadCHAR(IInputStream& rCHAR, CResourceEntry *pEntry)
{ {
Loader.mVersion = eReturns; Loader.mVersion = eReturns;
Loader.pSet = new CAnimSet(pEntry); Loader.pSet = new CAnimSet(pEntry);
Loader.pSet->SetGame(eReturns);
return Loader.LoadReturnsCHAR(rCHAR); return Loader.LoadReturnsCHAR(rCHAR);
} }

View File

@ -76,10 +76,7 @@ void CAnimationLoader::ReadUncompressedANIM()
} }
if (mGame == eUnknownGame) if (mGame == eUnknownGame)
{
mGame = UncompressedCheckVersion(); mGame = UncompressedCheckVersion();
mpAnim->SetGame(mGame);
}
// Echoes only - rotation channel indices // Echoes only - rotation channel indices
std::vector<u8> RotationIndices; std::vector<u8> RotationIndices;
@ -212,10 +209,7 @@ void CAnimationLoader::ReadCompressedANIM()
mpInput->Seek(0x4, SEEK_CUR); // Skip alloc size mpInput->Seek(0x4, SEEK_CUR); // Skip alloc size
if (mGame == eUnknownGame) if (mGame == eUnknownGame)
{
mGame = (mpInput->PeekShort() == 0x0101 ? eEchoes : ePrime); mGame = (mpInput->PeekShort() == 0x0101 ? eEchoes : ePrime);
mpAnim->SetGame(mGame);
}
if (mGame == ePrime) if (mGame == ePrime)
{ {
@ -470,6 +464,10 @@ CQuaternion CAnimationLoader::DequantizeRotation(bool Sign, s16 X, s16 Y, s16 Z)
// ************ STATIC ************ // ************ STATIC ************
CAnimation* CAnimationLoader::LoadANIM(IInputStream& rANIM, CResourceEntry *pEntry) CAnimation* CAnimationLoader::LoadANIM(IInputStream& rANIM, CResourceEntry *pEntry)
{ {
// MP3/DKCR unsupported
if (pEntry->Game() > eEchoes)
return nullptr;
u32 CompressionType = rANIM.ReadLong(); u32 CompressionType = rANIM.ReadLong();
if (CompressionType != 0 && CompressionType != 2) if (CompressionType != 0 && CompressionType != 2)

View File

@ -686,7 +686,6 @@ CGameArea* CAreaLoader::LoadMREA(IInputStream& MREA, CResourceEntry *pEntry)
Loader.mpArea = new CGameArea(pEntry); Loader.mpArea = new CGameArea(pEntry);
u32 Version = MREA.ReadLong(); u32 Version = MREA.ReadLong();
Loader.mVersion = GetFormatVersion(Version); Loader.mVersion = GetFormatVersion(Version);
Loader.mpArea->SetGame(Loader.mVersion);
Loader.mpMREA = &MREA; Loader.mpMREA = &MREA;
switch (Loader.mVersion) switch (Loader.mVersion)

View File

@ -235,7 +235,6 @@ CCollisionMeshGroup* CCollisionLoader::LoadDCLN(IInputStream& rDCLN, CResourceEn
Loader.mpMesh = new CCollisionMesh; Loader.mpMesh = new CCollisionMesh;
Loader.mpMesh->mOctreeLoaded = false; Loader.mpMesh->mOctreeLoaded = false;
Loader.mpGroup->SetGame(Loader.mVersion);
if (Loader.mVersion == eReturns) if (Loader.mVersion == eReturns)
Loader.mpMesh->mAABox = CAABox(rDCLN); Loader.mpMesh->mAABox = CAABox(rDCLN);

View File

@ -8,20 +8,24 @@ EGame CDependencyGroupLoader::VersionTest(IInputStream& rDGRP, u32 DepCount)
rDGRP.Seek(DepCount * 8, SEEK_CUR); rDGRP.Seek(DepCount * 8, SEEK_CUR);
u32 Remaining = rDGRP.Size() - rDGRP.Tell(); u32 Remaining = rDGRP.Size() - rDGRP.Tell();
EGame Game = ePrimeDemo; EGame Game = eCorruptionProto;
if (Remaining < 32) if (Remaining < 32)
{ {
bool IsEOF = true;
for (u32 iRem = 0; iRem < Remaining; iRem++) for (u32 iRem = 0; iRem < Remaining; iRem++)
{ {
u8 Byte = rDGRP.ReadByte(); u8 Byte = rDGRP.ReadByte();
if (Byte != 0xFF) if (Byte != 0xFF)
{ {
Game = eCorruptionProto; IsEOF = false;
break; break;
} }
} }
if (IsEOF) Game = ePrimeDemo;
} }
rDGRP.Seek(Start, SEEK_SET); rDGRP.Seek(Start, SEEK_SET);
@ -36,7 +40,6 @@ CDependencyGroup* CDependencyGroupLoader::LoadDGRP(IInputStream& rDGRP, CResourc
EGame Game = VersionTest(rDGRP, NumDependencies); EGame Game = VersionTest(rDGRP, NumDependencies);
CDependencyGroup *pGroup = new CDependencyGroup(pEntry); CDependencyGroup *pGroup = new CDependencyGroup(pEntry);
pGroup->SetGame(Game);
for (u32 iDep = 0; iDep < NumDependencies; iDep++) for (u32 iDep = 0; iDep < NumDependencies; iDep++)
{ {

View File

@ -100,7 +100,6 @@ CFont* CFontLoader::LoadFONT(IInputStream& rFONT, CResourceEntry *pEntry)
CFontLoader Loader; CFontLoader Loader;
Loader.mpFont = new CFont(pEntry); Loader.mpFont = new CFont(pEntry);
Loader.mpFont->SetGame(Version);
Loader.mVersion = Version; Loader.mVersion = Version;
return Loader.LoadFont(rFONT); return Loader.LoadFont(rFONT);
} }

View File

@ -396,6 +396,8 @@ CMaterial* CMaterialLoader::ReadCorruptionMaterial()
case 6: // Model Matrix case 6: // Model Matrix
case 10: // Yet-to-be-named case 10: // Yet-to-be-named
break; break;
case 8: // Unknown/unsupported animation type
break;
default: default:
Log::FileError(mpFile->GetSourceString(), mpFile->Tell() - 8, "Unsupported animation mode encountered: " + TString::HexString((u32) pPass->mAnimMode)); Log::FileError(mpFile->GetSourceString(), mpFile->Tell() - 8, "Unsupported animation mode encountered: " + TString::HexString((u32) pPass->mAnimMode));
break; break;

View File

@ -453,7 +453,6 @@ CModel* CModelLoader::LoadCMDL(IInputStream& rCMDL, CResourceEntry *pEntry)
} }
CModel *pModel = new CModel(pEntry); CModel *pModel = new CModel(pEntry);
pModel->SetGame(Loader.mVersion);
Loader.mpModel = pModel; Loader.mpModel = pModel;
Loader.mpSectionMgr = new CSectionMgrIn(BlockCount, &rCMDL); Loader.mpSectionMgr = new CSectionMgrIn(BlockCount, &rCMDL);
rCMDL.SeekToBoundary(32); rCMDL.SeekToBoundary(32);

View File

@ -40,6 +40,7 @@ public:
case eArea: return new CGameArea(pEntry); case eArea: return new CGameArea(pEntry);
case eAudioGroup: return new CAudioGroup(pEntry); case eAudioGroup: return new CAudioGroup(pEntry);
case eAudioLookupTable: return new CAudioLookupTable(pEntry); case eAudioLookupTable: return new CAudioLookupTable(pEntry);
case eCharacter: return new CAnimSet(pEntry);
case eDynamicCollision: return new CCollisionMeshGroup(pEntry); case eDynamicCollision: return new CCollisionMeshGroup(pEntry);
case eDependencyGroup: return new CDependencyGroup(pEntry); case eDependencyGroup: return new CDependencyGroup(pEntry);
case eFont: return new CFont(pEntry); case eFont: return new CFont(pEntry);
@ -66,11 +67,12 @@ public:
{ {
case eAnimation: pRes = CAnimationLoader::LoadANIM(rInput, pEntry); break; case eAnimation: pRes = CAnimationLoader::LoadANIM(rInput, pEntry); break;
case eAnimEventData: pRes = CAnimEventLoader::LoadEVNT(rInput, pEntry); break; case eAnimEventData: pRes = CAnimEventLoader::LoadEVNT(rInput, pEntry); break;
case eAnimSet: pRes = CAnimSetLoader::LoadANCSOrCHAR(rInput, pEntry); break; case eAnimSet: pRes = CAnimSetLoader::LoadANCS(rInput, pEntry); break;
case eArea: pRes = CAreaLoader::LoadMREA(rInput, pEntry); break; case eArea: pRes = CAreaLoader::LoadMREA(rInput, pEntry); break;
case eAudioGroup: pRes = CAudioGroupLoader::LoadAGSC(rInput, pEntry); break; case eAudioGroup: pRes = CAudioGroupLoader::LoadAGSC(rInput, pEntry); break;
case eAudioLookupTable: pRes = CAudioGroupLoader::LoadATBL(rInput, pEntry); break; case eAudioLookupTable: pRes = CAudioGroupLoader::LoadATBL(rInput, pEntry); break;
case eBinaryData: pRes = CUnsupportedFormatLoader::LoadDUMB(rInput, pEntry); break; case eBinaryData: pRes = CUnsupportedFormatLoader::LoadDUMB(rInput, pEntry); break;
case eCharacter: pRes = CAnimSetLoader::LoadCHAR(rInput, pEntry); break;
case eDependencyGroup: pRes = CDependencyGroupLoader::LoadDGRP(rInput, pEntry); break; case eDependencyGroup: pRes = CDependencyGroupLoader::LoadDGRP(rInput, pEntry); break;
case eDynamicCollision: pRes = CCollisionLoader::LoadDCLN(rInput, pEntry); break; case eDynamicCollision: pRes = CCollisionLoader::LoadDCLN(rInput, pEntry); break;
case eFont: pRes = CFontLoader::LoadFONT(rInput, pEntry); break; case eFont: pRes = CFontLoader::LoadFONT(rInput, pEntry); break;

View File

@ -21,7 +21,6 @@ CScan* CScanLoader::LoadScanMP1(IInputStream& rSCAN)
rSCAN.Seek(0x18, SEEK_CUR); rSCAN.Seek(0x18, SEEK_CUR);
} }
mpScan->SetGame(ePrime);
return mpScan; return mpScan;
} }
@ -66,13 +65,11 @@ CScan* CScanLoader::LoadScanMP2(IInputStream& rSCAN)
case 0x14: case 0x14:
case 0xB: case 0xB:
mpScan = new CScan(mpEntry); mpScan = new CScan(mpEntry);
mpScan->SetGame(eEchoes);
LoadParamsMP2(rSCAN, NumProperties); LoadParamsMP2(rSCAN, NumProperties);
break; break;
case 0x12: case 0x12:
case 0x16: case 0x16:
mpScan = new CScan(mpEntry); mpScan = new CScan(mpEntry);
mpScan->SetGame(eCorruption);
LoadParamsMP3(rSCAN, NumProperties); LoadParamsMP3(rSCAN, NumProperties);
break; break;
default: default:
@ -80,7 +77,6 @@ CScan* CScanLoader::LoadScanMP2(IInputStream& rSCAN)
return nullptr; return nullptr;
} }
mpScan->SetGame(eEchoes);
return mpScan; return mpScan;
} }
@ -283,7 +279,6 @@ CScan* CScanLoader::LoadSCAN(IInputStream& rSCAN, CResourceEntry *pEntry)
CScanLoader Loader; CScanLoader Loader;
Loader.mVersion = ePrime; Loader.mVersion = ePrime;
Loader.mpScan = new CScan(pEntry); Loader.mpScan = new CScan(pEntry);
Loader.mpScan->SetGame(ePrime);
Loader.mpEntry = pEntry; Loader.mpEntry = pEntry;
return Loader.LoadScanMP1(rSCAN); return Loader.LoadScanMP1(rSCAN);
} }

View File

@ -60,7 +60,6 @@ CSkeleton* CSkeletonLoader::LoadCINF(IInputStream& rCINF, CResourceEntry *pEntry
{ {
u32 Check = rCINF.PeekLong(); u32 Check = rCINF.PeekLong();
Game = ((Check > 100 || Check == 0) ? eEchoes : ePrime); Game = ((Check > 100 || Check == 0) ? eEchoes : ePrime);
Loader.mpSkeleton->SetGame(Game);
} }
if (Game == eEchoes) if (Game == eEchoes)
{ {

View File

@ -195,7 +195,6 @@ CStringTable* CStringLoader::LoadSTRG(IInputStream& rSTRG, CResourceEntry *pEntr
// Valid; now we create the loader and call the function that reads the rest of the file // Valid; now we create the loader and call the function that reads the rest of the file
CStringLoader Loader; CStringLoader Loader;
Loader.mpStringTable = new CStringTable(pEntry); Loader.mpStringTable = new CStringTable(pEntry);
Loader.mpStringTable->SetGame(Version);
Loader.mVersion = Version; Loader.mVersion = Version;
if (Version == ePrimeDemo) Loader.LoadPrimeDemoSTRG(rSTRG); if (Version == ePrimeDemo) Loader.LoadPrimeDemoSTRG(rSTRG);

View File

@ -272,6 +272,11 @@ CDependencyGroup* CUnsupportedFormatLoader::LoadHIER(IInputStream& rHIER, CResou
u32 NumNodes = rHIER.ReadLong(); u32 NumNodes = rHIER.ReadLong();
CDependencyGroup *pOut = new CDependencyGroup(pEntry); CDependencyGroup *pOut = new CDependencyGroup(pEntry);
// Note: For some reason this file still exists in MP3 and it's identical to MP2, including with 32-bit asset IDs.
// Obviously we can't read 32-bit asset IDs in MP3, so this file should just be ignored.
if (pEntry->Game() > eEchoes)
return pOut;
for (u32 iNode = 0; iNode < NumNodes; iNode++) for (u32 iNode = 0; iNode < NumNodes; iNode++)
{ {
// NOTE: The SCAN ID isn't considered a real dependency! // NOTE: The SCAN ID isn't considered a real dependency!

View File

@ -1389,20 +1389,23 @@ CDependencyGroup* CUnsupportedParticleLoader::LoadParticle(IInputStream& rFile,
CUnsupportedParticleLoader Loader; CUnsupportedParticleLoader Loader;
Loader.mpGroup = new CDependencyGroup(pEntry); Loader.mpGroup = new CDependencyGroup(pEntry);
if (pEntry->Game() >= eCorruptionProto)
return Loader.mpGroup;
while (true) while (true)
{ {
bool ShouldContinue = false; bool ShouldContinue = false;
switch (Magic.ToLong()) switch (Magic.ToLong())
{ {
case kGPSM: ShouldContinue = Loader.ParseParticleParameter(rFile); break; case FOURCC('GPSM'): ShouldContinue = Loader.ParseParticleParameter(rFile); break;
case kELSM: ShouldContinue = Loader.ParseElectricParameter(rFile); break; case FOURCC('ELSM'): ShouldContinue = Loader.ParseElectricParameter(rFile); break;
case kSRSM: ShouldContinue = Loader.ParseSortedParameter(rFile); break; case FOURCC('SRSM'): ShouldContinue = Loader.ParseSortedParameter(rFile); break;
case kSPSM: ShouldContinue = Loader.ParseSpawnParameter(rFile); break; case FOURCC('SPSM'): ShouldContinue = Loader.ParseSpawnParameter(rFile); break;
case kSWSH: ShouldContinue = Loader.ParseSwooshParameter(rFile); break; case FOURCC('SWSH'): ShouldContinue = Loader.ParseSwooshParameter(rFile); break;
case kDPSM: ShouldContinue = Loader.ParseDecalParameter(rFile); break; case FOURCC('DPSM'): ShouldContinue = Loader.ParseDecalParameter(rFile); break;
case kWPSM: ShouldContinue = Loader.ParseWeaponParameter(rFile); break; case FOURCC('WPSM'): ShouldContinue = Loader.ParseWeaponParameter(rFile); break;
case kCRSM: ShouldContinue = Loader.ParseCollisionResponseParameter(rFile); break; case FOURCC('CRSM'): ShouldContinue = Loader.ParseCollisionResponseParameter(rFile); break;
default: default:
Log::Error("Unrecognized particle system magic: " + Magic.ToString()); Log::Error("Unrecognized particle system magic: " + Magic.ToString());

View File

@ -270,7 +270,6 @@ CWorld* CWorldLoader::LoadMLVL(IInputStream& rMLVL, CResourceEntry *pEntry)
// Filestream is valid, magic+version are valid; everything seems good! // Filestream is valid, magic+version are valid; everything seems good!
CWorldLoader Loader; CWorldLoader Loader;
Loader.mpWorld = new CWorld(pEntry); Loader.mpWorld = new CWorld(pEntry);
Loader.mpWorld->SetGame(Version);
Loader.mVersion = Version; Loader.mVersion = Version;
if (Version != eReturns) if (Version != eReturns)

View File

@ -70,8 +70,8 @@
</property> </property>
</properties> </properties>
</struct> </struct>
<property ID="0x8F1DED1B" type="asset" extensions="UNKN"/> <property ID="0x8F1DED1B" type="asset" extensions="PART"/>
<property ID="0x0B339FAC" type="asset" extensions="UNKN"/> <property ID="0x0B339FAC" type="asset" extensions="CAUD"/>
<property ID="0xF10EE8E2" type="float"> <property ID="0xF10EE8E2" type="float">
<default>-1.0</default> <default>-1.0</default>
</property> </property>

View File

@ -9,7 +9,7 @@
<struct ID="0x7E397FED" template="Structs/ActorParameters.xml"/> <struct ID="0x7E397FED" template="Structs/ActorParameters.xml"/>
<struct ID="0x6F3BB625" type="multi"> <struct ID="0x6F3BB625" type="multi">
<properties> <properties>
<property ID="0x55744160" type="asset" extensions="AFSM"/> <property ID="0x55744160" type="asset" extensions="FSM2"/>
<struct ID="0xCF90D15E" template="Structs/HealthInfo.xml"> <struct ID="0xCF90D15E" template="Structs/HealthInfo.xml">
<properties> <properties>
<property ID="0xF0668919"> <property ID="0xF0668919">

View File

@ -97,7 +97,7 @@
<property ID="0x2ED25F50" type="float"> <property ID="0x2ED25F50" type="float">
<default>5.0</default> <default>5.0</default>
</property> </property>
<property ID="0xE9C8E2BD" type="asset" extensions="PART"/> <property ID="0xE9C8E2BD" type="asset" extensions="PART,ELSC"/>
<property ID="0x7E192395" type="float"> <property ID="0x7E192395" type="float">
<default>1.0</default> <default>1.0</default>
</property> </property>
@ -148,7 +148,7 @@
<property ID="0x7C269EBC" type="float"> <property ID="0x7C269EBC" type="float">
<default>0.5</default> <default>0.5</default>
</property> </property>
<property ID="0xE9C8E2BD" type="asset" extensions="PART"/> <property ID="0xE9C8E2BD" type="asset" extensions="PART,ELSC"/>
<property ID="0x7E192395" type="float"> <property ID="0x7E192395" type="float">
<default>1.0</default> <default>1.0</default>
</property> </property>

View File

@ -167,7 +167,7 @@
<struct ID="0xCF90D15E" template="Structs/HealthInfo.xml"/> <struct ID="0xCF90D15E" template="Structs/HealthInfo.xml"/>
<struct ID="0x7B71AE90" template="Structs/DamageVulnerability.xml"/> <struct ID="0x7B71AE90" template="Structs/DamageVulnerability.xml"/>
<property ID="0x71A5A198" type="character"/> <property ID="0x71A5A198" type="character"/>
<property ID="0x55744160" type="asset" extensions="AFSM"/> <property ID="0x55744160" type="asset" extensions="FSM2"/>
<struct ID="0xA30EE999" template="Structs/ActorParameters.xml"/> <struct ID="0xA30EE999" template="Structs/ActorParameters.xml"/>
<property ID="0xD8C6D15C" type="asset" extensions="PART"/> <property ID="0xD8C6D15C" type="asset" extensions="PART"/>
<property ID="0x9A094814" type="asset" extensions="CAUD"/> <property ID="0x9A094814" type="asset" extensions="CAUD"/>

View File

@ -6,7 +6,7 @@
<struct ID="0x7E397FED" template="Structs/ActorParameters.xml"/> <struct ID="0x7E397FED" template="Structs/ActorParameters.xml"/>
<struct ID="0x6F3BB625" type="multi"> <struct ID="0x6F3BB625" type="multi">
<properties> <properties>
<property ID="0x55744160" type="asset" extensions="AFSM"/> <property ID="0x55744160" type="asset" extensions="FSM2"/>
<struct ID="0xCF90D15E" template="Structs/HealthInfo.xml"> <struct ID="0xCF90D15E" template="Structs/HealthInfo.xml">
<properties> <properties>
<property ID="0xF0668919"> <property ID="0xF0668919">

View File

@ -52,7 +52,7 @@
<struct ID="0xCF90D15E" template="Structs/HealthInfo.xml"/> <struct ID="0xCF90D15E" template="Structs/HealthInfo.xml"/>
<struct ID="0x7B71AE90" template="Structs/DamageVulnerability.xml"/> <struct ID="0x7B71AE90" template="Structs/DamageVulnerability.xml"/>
<property ID="0x71A5A198" type="character"/> <property ID="0x71A5A198" type="character"/>
<property ID="0x55744160" type="asset" extensions="AFSM"/> <property ID="0x55744160" type="asset" extensions="FSM2"/>
<struct ID="0xA30EE999" template="Structs/ActorParameters.xml"/> <struct ID="0xA30EE999" template="Structs/ActorParameters.xml"/>
<property ID="0xD8C6D15C" type="asset" extensions="PART"/> <property ID="0xD8C6D15C" type="asset" extensions="PART"/>
<struct ID="0x337F9524" template="Structs/DamageInfo.xml"/> <struct ID="0x337F9524" template="Structs/DamageInfo.xml"/>