Dropped support for transient resources; I am not using this functionality at all whatsoever and likely won't for a while, so why do I have it?
This commit is contained in:
parent
283444cea4
commit
f72f82d519
|
@ -33,11 +33,6 @@ CAssetID::CAssetID(u64 ID, EIDLength Length)
|
|||
mID &= 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
CAssetID::CAssetID(const char* pkID)
|
||||
{
|
||||
*this = CAssetID::FromString(pkID);
|
||||
}
|
||||
|
||||
void CAssetID::Write(IOutputStream& rOutput) const
|
||||
{
|
||||
if (mLength == e32Bit)
|
||||
|
|
|
@ -22,7 +22,6 @@ public:
|
|||
CAssetID();
|
||||
CAssetID(u64 ID);
|
||||
CAssetID(u64 ID, EIDLength Length);
|
||||
CAssetID(const char* pkID);
|
||||
CAssetID(IInputStream& rInput, EIDLength Length);
|
||||
CAssetID(IInputStream& rInput, EGame Game);
|
||||
void Write(IOutputStream& rOutput) const;
|
||||
|
@ -31,7 +30,6 @@ public:
|
|||
|
||||
// Operators
|
||||
inline void operator= (const u64& rkInput) { *this = CAssetID(rkInput); }
|
||||
inline void operator= (const char *pkInput) { *this = CAssetID(pkInput); }
|
||||
inline bool operator==(const CAssetID& rkOther) const { return mLength == rkOther.mLength && mID == rkOther.mID; }
|
||||
inline bool operator!=(const CAssetID& rkOther) const { return mLength != rkOther.mLength || mID != rkOther.mID; }
|
||||
inline bool operator> (const CAssetID& rkOther) const { return mLength >= rkOther.mLength && mID > rkOther.mID; }
|
||||
|
|
|
@ -47,13 +47,13 @@ CModel* CAreaAttributes::SkyModel() const
|
|||
switch (mGame)
|
||||
{
|
||||
case ePrime:
|
||||
return (CModel*) gpResourceStore->LoadResource( static_cast<TAssetProperty*>(pBaseStruct->PropertyByIndex(7))->Get(), "CMDL" );
|
||||
return gpResourceStore->LoadResource<CModel>( static_cast<TAssetProperty*>(pBaseStruct->PropertyByIndex(7))->Get() );
|
||||
case eEchoesDemo:
|
||||
case eEchoes:
|
||||
case eCorruptionProto:
|
||||
case eCorruption:
|
||||
case eReturns:
|
||||
return (CModel*) gpResourceStore->LoadResource( static_cast<TAssetProperty*>(pBaseStruct->PropertyByID(0xD208C9FA))->Get(), "CMDL" );
|
||||
return gpResourceStore->LoadResource<CModel>( static_cast<TAssetProperty*>(pBaseStruct->PropertyByID(0xD208C9FA))->Get() );
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -45,14 +45,14 @@ void CAudioManager::LoadAssets()
|
|||
CAssetID AudioLookupID = mpProject->FindNamedResource(AudioLookupName);
|
||||
|
||||
if (AudioLookupID.IsValid())
|
||||
mpAudioLookupTable = mpProject->ResourceStore()->LoadResource(AudioLookupID, "ATBL");
|
||||
mpAudioLookupTable = mpProject->ResourceStore()->LoadResource<CAudioLookupTable>(AudioLookupID);
|
||||
|
||||
if (mpProject->Game() >= eEchoesDemo)
|
||||
{
|
||||
CAssetID SfxNameListID = mpProject->FindNamedResource("audio_name_lookup_STLC");
|
||||
|
||||
if (SfxNameListID.IsValid())
|
||||
mpSfxNameList = mpProject->ResourceStore()->LoadResource(SfxNameListID, "STLC");
|
||||
mpSfxNameList = mpProject->ResourceStore()->LoadResource<CStringList>(SfxNameListID);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ void ApplyGeneratedName(CResourceEntry *pEntry, const TString& rkDir, const TStr
|
|||
if (pEntry->Game() >= eCorruptionProto)
|
||||
SanitizedDir = SanitizedDir.ToLower();
|
||||
|
||||
CVirtualDirectory *pNewDir = pEntry->ResourceStore()->GetVirtualDirectory(SanitizedDir, false, true);
|
||||
CVirtualDirectory *pNewDir = pEntry->ResourceStore()->GetVirtualDirectory(SanitizedDir, true);
|
||||
if (pEntry->Directory() == pNewDir && pEntry->Name() == SanitizedName) return;
|
||||
|
||||
TString Name = SanitizedName;
|
||||
|
|
|
@ -467,8 +467,6 @@ void CGameExporter::ExportResourceEditorData()
|
|||
// load all their dependencies and then we just clear it out from memory even though we'll need it again later. we
|
||||
// should really be doing this by dependency order instead of by ID order.
|
||||
for (CResourceIterator It(mpStore); It; ++It)
|
||||
{
|
||||
if (!It->IsTransient())
|
||||
{
|
||||
// Worlds need some info we can only get from the pak at export time; namely, which areas can
|
||||
// have duplicates, as well as the world's internal name.
|
||||
|
@ -498,7 +496,6 @@ void CGameExporter::ExportResourceEditorData()
|
|||
It->UpdateDependencies();
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
// All resources should have dependencies generated, so save the project files
|
||||
SCOPED_TIMER(SaveResourceDatabase);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
CResourceEntry::CResourceEntry(CResourceStore *pStore, const CAssetID& rkID,
|
||||
const TString& rkDir, const TString& rkFilename,
|
||||
EResType Type, bool Transient /*= false*/)
|
||||
EResType Type)
|
||||
: mpResource(nullptr)
|
||||
, mpStore(pStore)
|
||||
, mpDependencies(nullptr)
|
||||
|
@ -25,9 +25,7 @@ CResourceEntry::CResourceEntry(CResourceStore *pStore, const CAssetID& rkID,
|
|||
mpTypeInfo = CResTypeInfo::FindTypeInfo(Type);
|
||||
ASSERT(mpTypeInfo);
|
||||
|
||||
if (Transient) mFlags |= eREF_Transient;
|
||||
|
||||
mpDirectory = mpStore->GetVirtualDirectory(rkDir, Transient, true);
|
||||
mpDirectory = mpStore->GetVirtualDirectory(rkDir, true);
|
||||
if (mpDirectory) mpDirectory->AddChild("", this);
|
||||
}
|
||||
|
||||
|
@ -39,8 +37,6 @@ CResourceEntry::~CResourceEntry()
|
|||
|
||||
void CResourceEntry::SerializeCacheData(IArchive& rArc)
|
||||
{
|
||||
ASSERT(!IsTransient());
|
||||
|
||||
u32 Flags = mFlags & eREF_SavedFlags;
|
||||
rArc << SERIAL_AUTO(Flags);
|
||||
if (rArc.IsReader()) mFlags = Flags & eREF_SavedFlags;
|
||||
|
@ -99,7 +95,7 @@ TString CResourceEntry::RawAssetPath(bool Relative) const
|
|||
TString Ext = RawExtension();
|
||||
TString Path = mpDirectory ? mpDirectory->FullPath() : "";
|
||||
TString Name = mName + "." + Ext;
|
||||
return ((IsTransient() || Relative) ? Path + Name : mpStore->RawDir(false) + Path + Name);
|
||||
return Relative ? Path + Name : mpStore->RawDir(false) + Path + Name;
|
||||
}
|
||||
|
||||
TString CResourceEntry::RawExtension() const
|
||||
|
@ -112,7 +108,7 @@ TString CResourceEntry::CookedAssetPath(bool Relative) const
|
|||
TString Ext = CookedExtension().ToString();
|
||||
TString Path = mpDirectory ? mpDirectory->FullPath() : "";
|
||||
TString Name = mName + "." + Ext;
|
||||
return ((IsTransient() || Relative) ? Path + Name : mpStore->CookedDir(false) + Path + Name);
|
||||
return Relative ? Path + Name : mpStore->CookedDir(false) + Path + Name;
|
||||
}
|
||||
|
||||
CFourCC CResourceEntry::CookedExtension() const
|
||||
|
@ -267,11 +263,12 @@ bool CResourceEntry::Cook()
|
|||
|
||||
CResource* CResourceEntry::Load()
|
||||
{
|
||||
// If the asset is already loaded then just return it immediately
|
||||
if (mpResource) return mpResource;
|
||||
|
||||
// Always try to load raw version as the raw version contains extra editor-only data.
|
||||
// If there is no raw version (which will be the case for resource types that don't
|
||||
// support serialization yet) then load the cooked version as a backup.
|
||||
if (mpResource) return mpResource;
|
||||
|
||||
if (HasRawVersion())
|
||||
{
|
||||
mpResource = CResourceFactory::SpawnResource(this);
|
||||
|
@ -353,14 +350,11 @@ bool CResourceEntry::Unload()
|
|||
|
||||
bool CResourceEntry::CanMoveTo(const TString& rkDir, const TString& rkName)
|
||||
{
|
||||
// Transient resources can't be moved
|
||||
if (IsTransient()) return false;
|
||||
|
||||
// Validate that the path/name are valid
|
||||
if (!mpStore->IsValidResourcePath(rkDir, rkName)) return false;
|
||||
|
||||
// We need to validate the path isn't taken already - either the directory doesn't exist, or doesn't have a resource by this name
|
||||
CVirtualDirectory *pDir = mpStore->GetVirtualDirectory(rkDir, false, false);
|
||||
CVirtualDirectory *pDir = mpStore->GetVirtualDirectory(rkDir, false);
|
||||
if (pDir && pDir->FindChildResource(rkName, ResourceType())) return false;
|
||||
|
||||
// All checks are true
|
||||
|
@ -378,7 +372,7 @@ bool CResourceEntry::Move(const TString& rkDir, const TString& rkName)
|
|||
TString OldRawPath = RawAssetPath();
|
||||
|
||||
// Set new directory and name
|
||||
CVirtualDirectory *pNewDir = mpStore->GetVirtualDirectory(rkDir, IsTransient(), true);
|
||||
CVirtualDirectory *pNewDir = mpStore->GetVirtualDirectory(rkDir, true);
|
||||
if (pNewDir == mpDirectory && rkName == mName) return false;
|
||||
|
||||
// Check if we can legally move to this spot
|
||||
|
@ -459,35 +453,6 @@ bool CResourceEntry::Move(const TString& rkDir, const TString& rkName)
|
|||
}
|
||||
}
|
||||
|
||||
void CResourceEntry::AddToProject(const TString& rkDir, const TString& rkName)
|
||||
{
|
||||
if (mFlags.HasFlag(eREF_Transient))
|
||||
{
|
||||
mFlags.ClearFlag(eREF_Transient);
|
||||
Move(rkDir, rkName);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Log::Error("AddToProject called on non-transient resource entry: " + CookedAssetPath(true));
|
||||
}
|
||||
}
|
||||
|
||||
void CResourceEntry::RemoveFromProject()
|
||||
{
|
||||
if (!mFlags.HasFlag(eREF_Transient))
|
||||
{
|
||||
TString Dir = CookedAssetPath().GetFileDirectory();
|
||||
mFlags.SetFlag(eREF_Transient);
|
||||
Move(Dir, mName);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Log::Error("RemoveFromProject called on transient resource entry: " + CookedAssetPath(true));
|
||||
}
|
||||
}
|
||||
|
||||
CGameProject* CResourceEntry::Project() const
|
||||
{
|
||||
return mpStore ? mpStore->Project() : nullptr;
|
||||
|
|
|
@ -17,7 +17,7 @@ class CDependencyTree;
|
|||
enum EResEntryFlag
|
||||
{
|
||||
eREF_NeedsRecook = 0x00000001, // Resource has been updated but not recooked
|
||||
eREF_Transient = 0x00000002, // Resource is transient (not part of a game project resource DB)
|
||||
// UNUSED = 0x00000002,
|
||||
eREF_Hidden = 0x00000004, // Resource is hidden, doesn't show up in resource browser
|
||||
eREF_HasBeenModified = 0x00000008, // Resource has been modified and resaved by the user
|
||||
eREF_IsUserResource = 0x00000010, // Resource was created by the user (i.e. isn't a Retro Studios asset)
|
||||
|
@ -43,7 +43,7 @@ class CResourceEntry
|
|||
public:
|
||||
CResourceEntry(CResourceStore *pStore, const CAssetID& rkID,
|
||||
const TString& rkDir, const TString& rkFilename,
|
||||
EResType Type, bool Transient = false);
|
||||
EResType Type);
|
||||
~CResourceEntry();
|
||||
|
||||
void SerializeCacheData(IArchive& rArc);
|
||||
|
@ -65,8 +65,6 @@ public:
|
|||
bool Unload();
|
||||
bool CanMoveTo(const TString& rkDir, const TString& rkName);
|
||||
bool Move(const TString& rkDir, const TString& rkName);
|
||||
void AddToProject(const TString& rkDir, const TString& rkName);
|
||||
void RemoveFromProject();
|
||||
CGameProject* Project() const;
|
||||
EGame Game() const;
|
||||
|
||||
|
@ -87,7 +85,6 @@ public:
|
|||
inline TString Name() const { return mName; }
|
||||
inline const TString& UppercaseName() const { return mCachedUppercaseName; }
|
||||
inline EResType ResourceType() const { return mpTypeInfo->Type(); }
|
||||
inline bool IsTransient() const { return mFlags.HasFlag(eREF_Transient); }
|
||||
inline bool IsHidden() const { return mFlags.HasFlag(eREF_Hidden); }
|
||||
|
||||
protected:
|
||||
|
|
|
@ -56,9 +56,6 @@ CResourceStore::~CResourceStore()
|
|||
|
||||
for (auto It = mResourceEntries.begin(); It != mResourceEntries.end(); It++)
|
||||
delete It->second;
|
||||
|
||||
for (auto It = mTransientRoots.begin(); It != mTransientRoots.end(); It++)
|
||||
delete *It;
|
||||
}
|
||||
|
||||
void CResourceStore::SerializeResourceDatabase(IArchive& rArc)
|
||||
|
@ -83,11 +80,8 @@ void CResourceStore::SerializeResourceDatabase(IArchive& rArc)
|
|||
Resources.reserve(mResourceEntries.size());
|
||||
|
||||
for (CResourceIterator It(this); It; ++It)
|
||||
{
|
||||
if (!It->IsTransient())
|
||||
Resources.push_back( SDatabaseResource { It->ID(), It->TypeInfo(), It->Directory()->FullPath(), It->Name() } );
|
||||
}
|
||||
}
|
||||
|
||||
// Serialize
|
||||
rArc << SERIAL("RawDir", mRawDir)
|
||||
|
@ -175,7 +169,7 @@ bool CResourceStore::LoadCacheFile()
|
|||
|
||||
CResourceEntry *pEntry = FindEntry(ID);
|
||||
|
||||
if (pEntry && !pEntry->IsTransient())
|
||||
if (pEntry)
|
||||
{
|
||||
CBasicBinaryReader Reader(&CacheFile, Version);
|
||||
|
||||
|
@ -214,8 +208,6 @@ bool CResourceStore::SaveCacheFile()
|
|||
// Save entry cache data
|
||||
// Structure: Entry Asset ID -> Entry Cache Size -> Serialized Entry Cache Data
|
||||
for (CResourceIterator It(this); It; ++It)
|
||||
{
|
||||
if (!It->IsTransient())
|
||||
{
|
||||
ResCount++;
|
||||
It->ID().Write(CacheFile);
|
||||
|
@ -235,7 +227,6 @@ bool CResourceStore::SaveCacheFile()
|
|||
CacheFile.WriteLong(EntryCacheEnd - SizeOffset - 4);
|
||||
CacheFile.Seek(EntryCacheEnd, SEEK_SET);
|
||||
}
|
||||
}
|
||||
|
||||
CacheFile.Seek(ResCountOffset, SEEK_SET);
|
||||
CacheFile.WriteLong(ResCount);
|
||||
|
@ -294,52 +285,24 @@ void CResourceStore::CloseProject()
|
|||
|
||||
while (It != mResourceEntries.end())
|
||||
{
|
||||
CResourceEntry *pEntry = It->second;
|
||||
|
||||
if (!pEntry->IsTransient())
|
||||
{
|
||||
delete pEntry;
|
||||
delete It->second;
|
||||
It = mResourceEntries.erase(It);
|
||||
}
|
||||
|
||||
else
|
||||
It++;
|
||||
}
|
||||
|
||||
delete mpDatabaseRoot;
|
||||
mpDatabaseRoot = nullptr;
|
||||
mpProj = nullptr;
|
||||
mGame = eUnknownGame;
|
||||
}
|
||||
|
||||
CVirtualDirectory* CResourceStore::GetVirtualDirectory(const TString& rkPath, bool Transient, bool AllowCreate)
|
||||
CVirtualDirectory* CResourceStore::GetVirtualDirectory(const TString& rkPath, bool AllowCreate)
|
||||
{
|
||||
if (rkPath.IsEmpty()) return mpDatabaseRoot;
|
||||
|
||||
else if (Transient)
|
||||
{
|
||||
for (u32 iTrans = 0; iTrans < mTransientRoots.size(); iTrans++)
|
||||
{
|
||||
if (mTransientRoots[iTrans]->Name() == rkPath)
|
||||
return mTransientRoots[iTrans];
|
||||
}
|
||||
|
||||
if (AllowCreate)
|
||||
{
|
||||
CVirtualDirectory *pDir = new CVirtualDirectory(rkPath, this);
|
||||
mTransientRoots.push_back(pDir);
|
||||
return pDir;
|
||||
}
|
||||
|
||||
else return nullptr;
|
||||
}
|
||||
|
||||
if (rkPath.IsEmpty())
|
||||
return mpDatabaseRoot;
|
||||
else if (mpDatabaseRoot)
|
||||
{
|
||||
return mpDatabaseRoot->FindChildDirectory(rkPath, AllowCreate);
|
||||
}
|
||||
|
||||
else return nullptr;
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CResourceStore::ConditionalDeleteDirectory(CVirtualDirectory *pDir)
|
||||
|
@ -382,16 +345,7 @@ CResourceEntry* CResourceStore::RegisterResource(const CAssetID& rkID, EResType
|
|||
CResourceEntry *pEntry = FindEntry(rkID);
|
||||
|
||||
if (pEntry)
|
||||
{
|
||||
if (pEntry->IsTransient())
|
||||
{
|
||||
ASSERT(pEntry->ResourceType() == Type);
|
||||
pEntry->AddToProject(rkDir, rkName);
|
||||
}
|
||||
|
||||
else
|
||||
Log::Error("Attempted to register resource that's already tracked in the database: " + rkID.ToString() + " / " + rkDir + " / " + rkName);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
@ -409,69 +363,51 @@ CResourceEntry* CResourceStore::RegisterResource(const CAssetID& rkID, EResType
|
|||
return pEntry;
|
||||
}
|
||||
|
||||
CResourceEntry* CResourceStore::RegisterTransientResource(EResType Type, const TString& rkDir /*= ""*/, const TString& rkFileName /*= ""*/)
|
||||
{
|
||||
CResourceEntry *pEntry = new CResourceEntry(this, CAssetID::RandomID(), rkDir, rkFileName, Type, true);
|
||||
mResourceEntries[pEntry->ID()] = pEntry;
|
||||
return pEntry;
|
||||
}
|
||||
|
||||
CResourceEntry* CResourceStore::RegisterTransientResource(EResType Type, const CAssetID& rkID, const TString& rkDir /*=L ""*/, const TString& rkFileName /*= ""*/)
|
||||
{
|
||||
CResourceEntry *pEntry = FindEntry(rkID);
|
||||
|
||||
if (!pEntry)
|
||||
{
|
||||
pEntry = new CResourceEntry(this, rkID, rkDir, rkFileName, Type, true);
|
||||
mResourceEntries[rkID] = pEntry;
|
||||
}
|
||||
|
||||
return pEntry;
|
||||
}
|
||||
|
||||
CResource* CResourceStore::LoadResource(const CAssetID& rkID, const CFourCC& rkType)
|
||||
CResource* CResourceStore::LoadResource(const CAssetID& rkID)
|
||||
{
|
||||
if (!rkID.IsValid()) return nullptr;
|
||||
|
||||
// Check if resource is already loaded
|
||||
auto Find = mLoadedResources.find(rkID);
|
||||
if (Find != mLoadedResources.end())
|
||||
return Find->second->Resource();
|
||||
|
||||
// Check for resource in store
|
||||
CResourceEntry *pEntry = FindEntry(rkID);
|
||||
if (pEntry) return pEntry->Load();
|
||||
|
||||
// Check in transient load directory - this only works for cooked
|
||||
EResType Type = CResTypeInfo::TypeForCookedExtension(mGame, rkType)->Type();
|
||||
|
||||
if (Type != eInvalidResType)
|
||||
{
|
||||
// Note the entry may not be able to find the resource on its own (due to not knowing what game
|
||||
// it is) so we will attempt to open the file stream ourselves and pass it to the entry instead.
|
||||
TString Name = rkID.ToString();
|
||||
CResourceEntry *pEntry = RegisterTransientResource(Type, mTransientLoadDir, Name);
|
||||
|
||||
TString Path = mTransientLoadDir + Name + "." + rkType.ToString();
|
||||
CFileInStream File(Path, IOUtil::eBigEndian);
|
||||
CResource *pRes = pEntry->LoadCooked(File);
|
||||
|
||||
if (!pRes) DeleteResourceEntry(pEntry);
|
||||
return pRes;
|
||||
}
|
||||
if (pEntry)
|
||||
return pEntry->Load();
|
||||
|
||||
else
|
||||
{
|
||||
Log::Error("Can't load requested resource with ID \"" + rkID.ToString() + "\"; can't locate resource. Note: Loading raw assets from an arbitrary directory is unsupported.");;
|
||||
// Resource doesn't seem to exist
|
||||
Log::Error("Can't find requested resource with ID \"" + rkID.ToString() + "\".");;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
CResource* CResourceStore::LoadResource(const CAssetID& rkID, EResType Type)
|
||||
{
|
||||
CResource *pRes = LoadResource(rkID);
|
||||
|
||||
if (pRes)
|
||||
{
|
||||
if (pRes->Type() == Type)
|
||||
{
|
||||
return pRes;
|
||||
}
|
||||
else
|
||||
{
|
||||
CResTypeInfo *pExpectedType = CResTypeInfo::FindTypeInfo(Type);
|
||||
CResTypeInfo *pGotType = pRes->TypeInfo();
|
||||
ASSERT(pExpectedType && pGotType);
|
||||
|
||||
Log::Error("Resource with ID \"" + rkID.ToString() + "\" requested with the wrong type; expected " + pExpectedType->TypeName() + " asset, got " + pGotType->TypeName() + " asset");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CResource* CResourceStore::LoadResource(const TString& rkPath)
|
||||
{
|
||||
// If this is a relative path then load via the resource DB
|
||||
if (!FileUtil::IsAbsolute(rkPath))
|
||||
{
|
||||
CResourceEntry *pEntry = FindEntry(rkPath);
|
||||
|
||||
if (pEntry)
|
||||
|
@ -495,47 +431,6 @@ CResource* CResourceStore::LoadResource(const TString& rkPath)
|
|||
}
|
||||
|
||||
else return nullptr;
|
||||
}
|
||||
|
||||
// Otherwise create transient entry; construct ID from string, check if resource is loaded already
|
||||
TString Dir = FileUtil::MakeAbsolute(rkPath.GetFileDirectory());
|
||||
TString Name = rkPath.GetFileName(false);
|
||||
CAssetID ID = (Name.IsHexString() ? Name.ToInt64() : rkPath.Hash64());
|
||||
auto Find = mLoadedResources.find(ID);
|
||||
|
||||
if (Find != mLoadedResources.end())
|
||||
return Find->second->Resource();
|
||||
|
||||
// Determine type
|
||||
TString Extension = rkPath.GetFileExtension().ToUpper();
|
||||
EResType Type = CResTypeInfo::TypeForCookedExtension(mGame, Extension)->Type();
|
||||
|
||||
if (Type == eInvalidResType)
|
||||
{
|
||||
Log::Error("Unable to load resource " + rkPath + "; unrecognized extension: " + Extension);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Open file
|
||||
CFileInStream File(rkPath, IOUtil::eBigEndian);
|
||||
|
||||
if (!File.IsValid())
|
||||
{
|
||||
Log::Error("Unable to load resource; couldn't open file: " + rkPath);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Load resource
|
||||
TString OldTransientDir = mTransientLoadDir;
|
||||
mTransientLoadDir = Dir;
|
||||
|
||||
CResourceEntry *pEntry = RegisterTransientResource(Type, ID, Dir, Name);
|
||||
CResource *pRes = pEntry->LoadCooked(File);
|
||||
if (!pRes) DeleteResourceEntry(pEntry);
|
||||
|
||||
mTransientLoadDir = OldTransientDir;
|
||||
|
||||
return pRes;
|
||||
}
|
||||
|
||||
void CResourceStore::TrackLoadedResource(CResourceEntry *pEntry)
|
||||
|
@ -563,27 +458,11 @@ void CResourceStore::DestroyUnreferencedResources()
|
|||
{
|
||||
It = mLoadedResources.erase(It);
|
||||
NumDeleted++;
|
||||
|
||||
// Transient resources should have their entries cleared out when the resource is unloaded
|
||||
if (pEntry->IsTransient())
|
||||
DeleteResourceEntry(pEntry);
|
||||
}
|
||||
|
||||
else It++;
|
||||
}
|
||||
} while (NumDeleted > 0);
|
||||
|
||||
// Destroy empty virtual directories
|
||||
for (auto DirIt = mTransientRoots.begin(); DirIt != mTransientRoots.end(); DirIt++)
|
||||
{
|
||||
CVirtualDirectory *pRoot = *DirIt;
|
||||
|
||||
if (pRoot->IsEmpty())
|
||||
{
|
||||
delete pRoot;
|
||||
DirIt = mTransientRoots.erase(DirIt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CResourceStore::DeleteResourceEntry(CResourceEntry *pEntry)
|
||||
|
@ -611,13 +490,6 @@ bool CResourceStore::DeleteResourceEntry(CResourceEntry *pEntry)
|
|||
return true;
|
||||
}
|
||||
|
||||
void CResourceStore::SetTransientLoadDir(const TString& rkDir)
|
||||
{
|
||||
mTransientLoadDir = rkDir;
|
||||
mTransientLoadDir.EnsureEndsWith('/');
|
||||
Log::Write("Set resource directory: " + rkDir);
|
||||
}
|
||||
|
||||
void CResourceStore::ImportNamesFromPakContentsTxt(const TString& rkTxtPath, bool UnnamedOnly)
|
||||
{
|
||||
// Read file contents -first- then move assets -after-; this
|
||||
|
|
|
@ -22,7 +22,6 @@ class CResourceStore
|
|||
CGameProject *mpProj;
|
||||
EGame mGame;
|
||||
CVirtualDirectory *mpDatabaseRoot;
|
||||
std::vector<CVirtualDirectory*> mTransientRoots;
|
||||
std::map<CAssetID, CResourceEntry*> mResourceEntries;
|
||||
std::map<CAssetID, CResourceEntry*> mLoadedResources;
|
||||
bool mDatabaseDirty;
|
||||
|
@ -33,7 +32,6 @@ class CResourceStore
|
|||
TString mDatabaseName;
|
||||
TString mRawDir;
|
||||
TString mCookedDir;
|
||||
TString mTransientLoadDir;
|
||||
|
||||
enum EDatabaseVersion
|
||||
{
|
||||
|
@ -56,22 +54,21 @@ public:
|
|||
void ConditionalSaveStore();
|
||||
void SetProject(CGameProject *pProj);
|
||||
void CloseProject();
|
||||
CVirtualDirectory* GetVirtualDirectory(const TString& rkPath, bool Transient, bool AllowCreate);
|
||||
CVirtualDirectory* GetVirtualDirectory(const TString& rkPath, bool AllowCreate);
|
||||
void ConditionalDeleteDirectory(CVirtualDirectory *pDir);
|
||||
|
||||
bool IsResourceRegistered(const CAssetID& rkID) const;
|
||||
CResourceEntry* RegisterResource(const CAssetID& rkID, EResType Type, const TString& rkDir, const TString& rkName);
|
||||
CResourceEntry* FindEntry(const CAssetID& rkID) const;
|
||||
CResourceEntry* FindEntry(const TString& rkPath) const;
|
||||
CResourceEntry* RegisterTransientResource(EResType Type, const TString& rkDir = "", const TString& rkFileName = "");
|
||||
CResourceEntry* RegisterTransientResource(EResType Type, const CAssetID& rkID, const TString& rkDir = "", const TString& rkFileName = "");
|
||||
|
||||
CResource* LoadResource(const CAssetID& rkID, const CFourCC& rkType);
|
||||
template<typename ResType> ResType* LoadResource(const CAssetID& rkID) { return static_cast<ResType*>(LoadResource(rkID, ResType::StaticType())); }
|
||||
CResource* LoadResource(const CAssetID& rkID);
|
||||
CResource* LoadResource(const CAssetID& rkID, EResType Type);
|
||||
CResource* LoadResource(const TString& rkPath);
|
||||
void TrackLoadedResource(CResourceEntry *pEntry);
|
||||
void DestroyUnreferencedResources();
|
||||
bool DeleteResourceEntry(CResourceEntry *pEntry);
|
||||
void SetTransientLoadDir(const TString& rkDir);
|
||||
|
||||
void ImportNamesFromPakContentsTxt(const TString& rkTxtPath, bool UnnamedOnly);
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ void CCharacterUsageMap::DebugPrintContents()
|
|||
{
|
||||
CAssetID ID = Iter->first;
|
||||
std::vector<bool>& rUsedList = Iter->second;
|
||||
CAnimSet *pSet = (CAnimSet*) mpStore->LoadResource(ID, "ANCS");
|
||||
CAnimSet *pSet = mpStore->LoadResource<CAnimSet>(ID);
|
||||
|
||||
for (u32 iChar = 0; iChar < pSet->NumCharacters(); iChar++)
|
||||
{
|
||||
|
|
|
@ -161,7 +161,7 @@ public:
|
|||
rkAnim.pMetaAnim->GetUniquePrimitives(PrimitiveSet);
|
||||
}
|
||||
|
||||
CSourceAnimData *pAnimData = (CSourceAnimData*) gpResourceStore->LoadResource(rkChar.AnimDataID, "SAND");
|
||||
CSourceAnimData *pAnimData = gpResourceStore->LoadResource<CSourceAnimData>(rkChar.AnimDataID);
|
||||
if (pAnimData)
|
||||
pAnimData->AddTransitionDependencies(pTree);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
// Accessors
|
||||
inline EGame Version() const { return mGame; }
|
||||
inline CAssetID ID() const { return mCharacterID; }
|
||||
inline CAnimSet* AnimSet() const { return (CAnimSet*) gpResourceStore->LoadResource(mCharacterID, (mGame < eCorruptionProto ? "ANCS" : "CHAR")); }
|
||||
inline CAnimSet* AnimSet() const { return (CAnimSet*) gpResourceStore->LoadResource(mCharacterID); }
|
||||
inline u32 CharacterIndex() const { return mCharIndex; }
|
||||
inline u32 AnimIndex() const { return mAnimIndex; }
|
||||
inline void SetCharIndex(u32 Index) { mCharIndex = Index; }
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
|
||||
CAnimPrimitive(IInputStream& rInput, EGame Game)
|
||||
{
|
||||
mpAnim = gpResourceStore->LoadResource( CAssetID(rInput, Game), "ANIM" );
|
||||
mpAnim = gpResourceStore->LoadResource( CAssetID(rInput, Game) );
|
||||
mID = rInput.ReadLong();
|
||||
mName = rInput.ReadString();
|
||||
}
|
||||
|
|
|
@ -26,6 +26,11 @@ public: \
|
|||
return ResTypeEnum; \
|
||||
} \
|
||||
\
|
||||
static CResTypeInfo* StaticTypeInfo() \
|
||||
{ \
|
||||
return CResTypeInfo::FindTypeInfo(StaticType()); \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
|
||||
class CResource
|
||||
|
|
|
@ -166,7 +166,7 @@ bool CWorldCooker::CookMLVL(CWorld *pWorld, IOutputStream& rMLVL)
|
|||
|
||||
for (auto It = AudioGroups.begin(); It != AudioGroups.end(); It++)
|
||||
{
|
||||
CAudioGroup *pGroup = (CAudioGroup*) gpResourceStore->LoadResource(*It, "AGSC");
|
||||
CAudioGroup *pGroup = gpResourceStore->LoadResource<CAudioGroup>(*It);
|
||||
ASSERT(pGroup);
|
||||
SortedAudioGroups.push_back(pGroup);
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ CAnimSet* CAnimSetLoader::LoadCorruptionCHAR(IInputStream& rCHAR)
|
|||
// Character Header
|
||||
rChar.ID = rCHAR.ReadByte();
|
||||
rChar.Name = rCHAR.ReadString();
|
||||
rChar.pModel = gpResourceStore->LoadResource(rCHAR.ReadLongLong(), "CMDL");
|
||||
rChar.pSkin = gpResourceStore->LoadResource(rCHAR.ReadLongLong(), "CSKR");
|
||||
rChar.pModel = gpResourceStore->LoadResource<CModel>(rCHAR.ReadLongLong());
|
||||
rChar.pSkin = gpResourceStore->LoadResource<CSkin>(rCHAR.ReadLongLong());
|
||||
|
||||
u32 NumOverlays = rCHAR.ReadLong();
|
||||
|
||||
|
@ -29,7 +29,7 @@ CAnimSet* CAnimSetLoader::LoadCorruptionCHAR(IInputStream& rCHAR)
|
|||
rChar.OverlayModels.push_back(Overlay);
|
||||
}
|
||||
|
||||
rChar.pSkeleton = gpResourceStore->LoadResource(rCHAR.ReadLongLong(), "CINF");
|
||||
rChar.pSkeleton = gpResourceStore->LoadResource<CSkeleton>(rCHAR.ReadLongLong());
|
||||
rChar.AnimDataID = CAssetID(rCHAR, e64Bit);
|
||||
|
||||
// PAS Database
|
||||
|
@ -108,7 +108,7 @@ CAnimSet* CAnimSetLoader::LoadReturnsCHAR(IInputStream& rCHAR)
|
|||
rChar.Name = rCHAR.ReadString();
|
||||
rCHAR.Seek(0x14, SEEK_CUR);
|
||||
rCHAR.ReadString();
|
||||
rChar.pModel = gpResourceStore->LoadResource(rCHAR.ReadLongLong(), "CMDL");
|
||||
rChar.pModel = gpResourceStore->LoadResource<CModel>(rCHAR.ReadLongLong());
|
||||
return pSet;
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ void CAnimSetLoader::ProcessPrimitives()
|
|||
|
||||
if (mGame == eCorruptionProto || mGame == eCorruption)
|
||||
{
|
||||
CSourceAnimData *pAnimData = (CSourceAnimData*) gpResourceStore->LoadResource( pSet->mCharacters[0].AnimDataID, "SAND" );
|
||||
CSourceAnimData *pAnimData = gpResourceStore->LoadResource<CSourceAnimData>( pSet->mCharacters[0].AnimDataID );
|
||||
|
||||
if (pAnimData)
|
||||
pAnimData->GetUniquePrimitives(UniquePrimitives);
|
||||
|
@ -415,9 +415,9 @@ CAnimSet* CAnimSetLoader::LoadANCS(IInputStream& rANCS, CResourceEntry *pEntry)
|
|||
Loader.mGame = (CharVersion == 0xA) ? eEchoes : ePrime;
|
||||
}
|
||||
pChar->Name = rANCS.ReadString();
|
||||
pChar->pModel = gpResourceStore->LoadResource(rANCS.ReadLong(), "CMDL");
|
||||
pChar->pSkin = gpResourceStore->LoadResource(rANCS.ReadLong(), "CSKR");
|
||||
pChar->pSkeleton = gpResourceStore->LoadResource(rANCS.ReadLong(), "CINF");
|
||||
pChar->pModel = gpResourceStore->LoadResource<CModel>(rANCS.ReadLong());
|
||||
pChar->pSkin = gpResourceStore->LoadResource<CSkin>(rANCS.ReadLong());
|
||||
pChar->pSkeleton = gpResourceStore->LoadResource<CSkeleton>(rANCS.ReadLong());
|
||||
if (pChar->pModel) pChar->pModel->SetSkin(pChar->pSkin);
|
||||
|
||||
// Unfortunately that's all that's actually supported at the moment. Hope to expand later.
|
||||
|
|
|
@ -199,7 +199,7 @@ void CAnimationLoader::ReadUncompressedANIM()
|
|||
|
||||
if (mGame == ePrime)
|
||||
{
|
||||
mpAnim->mpEventData = gpResourceStore->LoadResource(mpInput->ReadLong(), "EVNT");
|
||||
mpAnim->mpEventData = gpResourceStore->LoadResource<CAnimEventData>(mpInput->ReadLong());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ void CAnimationLoader::ReadCompressedANIM()
|
|||
|
||||
if (mGame == ePrime)
|
||||
{
|
||||
mpAnim->mpEventData = gpResourceStore->LoadResource(mpInput->ReadLong(), "EVNT");
|
||||
mpAnim->mpEventData = gpResourceStore->LoadResource<CAnimEventData>(mpInput->ReadLong());
|
||||
mpInput->Seek(0x4, SEEK_CUR); // Skip unknown
|
||||
}
|
||||
else mpInput->Seek(0x2, SEEK_CUR); // Skip unknowns
|
||||
|
|
|
@ -603,7 +603,7 @@ void CAreaLoader::ReadEGMC()
|
|||
{
|
||||
mpSectionMgr->ToSection(mEGMCBlockNum);
|
||||
CAssetID EGMC(*mpMREA, mVersion);
|
||||
mpArea->mpPoiToWorldMap = gpResourceStore->LoadResource(EGMC, "EGMC");
|
||||
mpArea->mpPoiToWorldMap = gpResourceStore->LoadResource(EGMC, eStaticGeometryMap);
|
||||
}
|
||||
|
||||
void CAreaLoader::MergeGeneratedLayer(CScriptLayer *pLayer)
|
||||
|
|
|
@ -18,8 +18,8 @@ CFont* CFontLoader::LoadFont(IInputStream& rFONT)
|
|||
mpFont->mDefaultSize = rFONT.ReadLong();
|
||||
mpFont->mFontName = rFONT.ReadString();
|
||||
|
||||
if (mVersion <= eEchoes) mpFont->mpFontTexture = gpResourceStore->LoadResource(rFONT.ReadLong(), "TXTR");
|
||||
else mpFont->mpFontTexture = gpResourceStore->LoadResource(rFONT.ReadLongLong(), "TXTR");
|
||||
if (mVersion <= eEchoes) mpFont->mpFontTexture = gpResourceStore->LoadResource(rFONT.ReadLong(), eTexture);
|
||||
else mpFont->mpFontTexture = gpResourceStore->LoadResource(rFONT.ReadLongLong(), eTexture);
|
||||
|
||||
mpFont->mTextureFormat = rFONT.ReadLong();
|
||||
u32 NumGlyphs = rFONT.ReadLong();
|
||||
|
|
|
@ -50,7 +50,7 @@ void CMaterialLoader::ReadPrimeMatSet()
|
|||
for (u32 iTex = 0; iTex < NumTextures; iTex++)
|
||||
{
|
||||
u32 TextureID = mpFile->ReadLong();
|
||||
mTextures[iTex] = gpResourceStore->LoadResource(TextureID, "TXTR");
|
||||
mTextures[iTex] = gpResourceStore->LoadResource<CTexture>(TextureID);
|
||||
}
|
||||
|
||||
// Materials
|
||||
|
@ -367,7 +367,7 @@ CMaterial* CMaterialLoader::ReadCorruptionMaterial()
|
|||
continue;
|
||||
}
|
||||
|
||||
pPass->mpTexture = gpResourceStore->LoadResource(TextureID, "TXTR");
|
||||
pPass->mpTexture = gpResourceStore->LoadResource<CTexture>(TextureID);
|
||||
|
||||
pPass->mTexCoordSource = 4 + (u8) mpFile->ReadLong();
|
||||
u32 AnimSize = mpFile->ReadLong();
|
||||
|
|
|
@ -10,7 +10,7 @@ CScan* CScanLoader::LoadScanMP1(IInputStream& rSCAN)
|
|||
{
|
||||
// Basic support at the moment - don't read animation/scan image data
|
||||
mpScan->mFrameID = CAssetID(rSCAN, e32Bit);
|
||||
mpScan->mpStringTable = gpResourceStore->LoadResource(rSCAN.ReadLong(), "STRG");
|
||||
mpScan->mpStringTable = gpResourceStore->LoadResource(rSCAN.ReadLong(), eStringTable);
|
||||
mpScan->mIsSlow = (rSCAN.ReadLong() != 0);
|
||||
mpScan->mCategory = (CScan::ELogbookCategory) rSCAN.ReadLong();
|
||||
mpScan->mIsImportant = (rSCAN.ReadByte() == 1);
|
||||
|
@ -112,7 +112,7 @@ void CScanLoader::LoadParamsMP2(IInputStream& rSCAN, u16 NumProperties)
|
|||
switch (PropertyID)
|
||||
{
|
||||
case 0x2F5B6423:
|
||||
mpScan->mpStringTable = gpResourceStore->LoadResource(rSCAN.ReadLong(), "STRG");
|
||||
mpScan->mpStringTable = gpResourceStore->LoadResource(rSCAN.ReadLong(), eStringTable);
|
||||
break;
|
||||
|
||||
case 0xC308A322:
|
||||
|
@ -210,7 +210,7 @@ void CScanLoader::LoadParamsMP3(IInputStream& rSCAN, u16 NumProperties)
|
|||
switch (PropertyID)
|
||||
{
|
||||
case 0x2F5B6423:
|
||||
mpScan->mpStringTable = gpResourceStore->LoadResource(rSCAN.ReadLongLong(), "STRG");
|
||||
mpScan->mpStringTable = gpResourceStore->LoadResource(rSCAN.ReadLongLong(), eStringTable);
|
||||
break;
|
||||
|
||||
case 0xC308A322:
|
||||
|
|
|
@ -16,19 +16,19 @@ void CWorldLoader::LoadPrimeMLVL(IInputStream& rMLVL)
|
|||
// Header
|
||||
if (mVersion < eCorruptionProto)
|
||||
{
|
||||
mpWorld->mpWorldName = gpResourceStore->LoadResource(rMLVL.ReadLong(), "STRG");
|
||||
if (mVersion == eEchoes) mpWorld->mpDarkWorldName = gpResourceStore->LoadResource(rMLVL.ReadLong(), "STRG");
|
||||
mpWorld->mpWorldName = gpResourceStore->LoadResource(rMLVL.ReadLong(), eStringTable);
|
||||
if (mVersion == eEchoes) mpWorld->mpDarkWorldName = gpResourceStore->LoadResource(rMLVL.ReadLong(), eStringTable);
|
||||
if (mVersion >= eEchoes) mpWorld->mTempleKeyWorldIndex = rMLVL.ReadLong();
|
||||
if (mVersion >= ePrime) mpWorld->mpSaveWorld = gpResourceStore->LoadResource(rMLVL.ReadLong(), "SAVW");
|
||||
mpWorld->mpDefaultSkybox = gpResourceStore->LoadResource(rMLVL.ReadLong(), "CMDL");
|
||||
if (mVersion >= ePrime) mpWorld->mpSaveWorld = gpResourceStore->LoadResource(rMLVL.ReadLong(), eSaveWorld);
|
||||
mpWorld->mpDefaultSkybox = gpResourceStore->LoadResource(rMLVL.ReadLong(), eModel);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
mpWorld->mpWorldName = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), "STRG");
|
||||
mpWorld->mpWorldName = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), eStringTable);
|
||||
rMLVL.Seek(0x4, SEEK_CUR); // Skipping unknown value
|
||||
mpWorld->mpSaveWorld = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), "SAVW");
|
||||
mpWorld->mpDefaultSkybox = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), "CMDL");
|
||||
mpWorld->mpSaveWorld = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), eStringTable);
|
||||
mpWorld->mpDefaultSkybox = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), eModel);
|
||||
}
|
||||
|
||||
// Memory relays - only in MP1
|
||||
|
@ -57,7 +57,7 @@ void CWorldLoader::LoadPrimeMLVL(IInputStream& rMLVL)
|
|||
{
|
||||
// Area header
|
||||
CWorld::SArea *pArea = &mpWorld->mAreas[iArea];
|
||||
pArea->pAreaName = gpResourceStore->LoadResource( CAssetID(rMLVL, mVersion), "STRG" );
|
||||
pArea->pAreaName = gpResourceStore->LoadResource<CStringTable>( CAssetID(rMLVL, mVersion) );
|
||||
pArea->Transform = CTransform4f(rMLVL);
|
||||
pArea->AetherBox = CAABox(rMLVL);
|
||||
pArea->AreaResID = CAssetID(rMLVL, mVersion);
|
||||
|
@ -132,7 +132,7 @@ void CWorldLoader::LoadPrimeMLVL(IInputStream& rMLVL)
|
|||
}
|
||||
|
||||
// MapWorld
|
||||
mpWorld->mpMapWorld = gpResourceStore->LoadResource( CAssetID(rMLVL, mVersion), "MAPW" );
|
||||
mpWorld->mpMapWorld = gpResourceStore->LoadResource( CAssetID(rMLVL, mVersion), eMapWorld );
|
||||
rMLVL.Seek(0x5, SEEK_CUR); // Unknown values which are always 0
|
||||
|
||||
// Audio Groups - we don't need this info as we regenerate it on cook
|
||||
|
@ -173,7 +173,7 @@ void CWorldLoader::LoadPrimeMLVL(IInputStream& rMLVL)
|
|||
|
||||
void CWorldLoader::LoadReturnsMLVL(IInputStream& rMLVL)
|
||||
{
|
||||
mpWorld->mpWorldName = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), "STRG");
|
||||
mpWorld->mpWorldName = gpResourceStore->LoadResource<CStringTable>(rMLVL.ReadLongLong());
|
||||
|
||||
bool Check = (rMLVL.ReadByte() != 0);
|
||||
if (Check)
|
||||
|
@ -182,8 +182,8 @@ void CWorldLoader::LoadReturnsMLVL(IInputStream& rMLVL)
|
|||
rMLVL.Seek(0x10, SEEK_CUR);
|
||||
}
|
||||
|
||||
mpWorld->mpSaveWorld = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), "SAVW");
|
||||
mpWorld->mpDefaultSkybox = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), "CMDL");
|
||||
mpWorld->mpSaveWorld = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), eSaveWorld);
|
||||
mpWorld->mpDefaultSkybox = gpResourceStore->LoadResource<CModel>(rMLVL.ReadLongLong());
|
||||
|
||||
// Areas
|
||||
u32 NumAreas = rMLVL.ReadLong();
|
||||
|
@ -194,7 +194,7 @@ void CWorldLoader::LoadReturnsMLVL(IInputStream& rMLVL)
|
|||
// Area header
|
||||
CWorld::SArea *pArea = &mpWorld->mAreas[iArea];
|
||||
|
||||
pArea->pAreaName = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), "STRG");
|
||||
pArea->pAreaName = gpResourceStore->LoadResource<CStringTable>(rMLVL.ReadLongLong());
|
||||
pArea->Transform = CTransform4f(rMLVL);
|
||||
pArea->AetherBox = CAABox(rMLVL);
|
||||
pArea->AreaResID = rMLVL.ReadLongLong();
|
||||
|
|
|
@ -224,7 +224,7 @@ CCollisionMeshGroup* CScriptTemplate::FindCollision(CPropertyStruct *pProperties
|
|||
if (pProp->Type() == eAssetProperty)
|
||||
{
|
||||
TAssetProperty *pAsset = static_cast<TAssetProperty*>(pProp);
|
||||
pRes = gpResourceStore->LoadResource( pAsset->Get(), "DCLN" );
|
||||
pRes = gpResourceStore->LoadResource( pAsset->Get(), eDynamicCollision );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ void CScriptAttachNode::AttachPropertyModified()
|
|||
if (mpAttachAssetProp)
|
||||
{
|
||||
if (mpAttachAssetProp->Type() == eAssetProperty)
|
||||
mpAttachAsset = gpResourceStore->LoadResource( TPropCast<TAssetProperty>(mpAttachAssetProp)->Get(), "CMDL" );
|
||||
mpAttachAsset = gpResourceStore->LoadResource<CModel>( TPropCast<TAssetProperty>(mpAttachAssetProp)->Get() );
|
||||
else if (mpAttachAssetProp->Type() == eCharacterProperty)
|
||||
mpAttachAsset = TPropCast<TCharacterProperty>(mpAttachAssetProp)->Get().AnimSet();
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ void CDamageableTriggerExtra::PropertyModified(IProperty *pProperty)
|
|||
{
|
||||
if (pProperty == mpTextureProps[iTex])
|
||||
{
|
||||
mpTextures[iTex] = gpResourceStore->LoadResource( mpTextureProps[iTex]->Get(), "TXTR" );
|
||||
mpTextures[iTex] = gpResourceStore->LoadResource<CTexture>( mpTextureProps[iTex]->Get() );
|
||||
|
||||
if (mpTextures[iTex] && mpTextures[iTex]->Type() != eTexture)
|
||||
mpTextures[iTex] = nullptr;
|
||||
|
|
|
@ -29,7 +29,7 @@ void CDoorExtra::PropertyModified(IProperty *pProperty)
|
|||
{
|
||||
if (pProperty == mpShieldModelProp)
|
||||
{
|
||||
mpShieldModel = gpResourceStore->LoadResource( mpShieldModelProp->Get(), "CMDL" );
|
||||
mpShieldModel = gpResourceStore->LoadResource<CModel>( mpShieldModelProp->Get() );
|
||||
|
||||
if (mpShieldModel)
|
||||
mLocalAABox = mpShieldModel->AABox();
|
||||
|
|
|
@ -19,7 +19,7 @@ CPointOfInterestExtra::CPointOfInterestExtra(CScriptObject *pInstance, CScene *p
|
|||
void CPointOfInterestExtra::PropertyModified(IProperty* pProperty)
|
||||
{
|
||||
if (mpScanProperty == pProperty)
|
||||
mpScanData = gpResourceStore->LoadResource( mpScanProperty->Get(), "SCAN" );
|
||||
mpScanData = gpResourceStore->LoadResource<CScan>( mpScanProperty->Get() );
|
||||
}
|
||||
|
||||
void CPointOfInterestExtra::ModifyTintColor(CColor& Color)
|
||||
|
|
|
@ -705,7 +705,7 @@ void CWorldEditor::UpdateOpenRecentActions()
|
|||
// Remove projects that don't exist anymore
|
||||
foreach (const QString& rkProj, RecentProjectsList)
|
||||
{
|
||||
if (!FileUtil::Exists( TO_TSTRING(rkProj) ))
|
||||
if (!FileUtil::Exists( TO_TSTRING(rkProj) ) || rkProj.contains('\\') )
|
||||
RecentProjectsList.removeAll(rkProj);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue