|
|
|
@ -140,6 +140,7 @@ void CDllDirectory::parse(uint16 version, TParseLevel level)
|
|
|
|
|
switch (id)
|
|
|
|
|
{
|
|
|
|
|
case 0x2038: // DllEntry
|
|
|
|
|
{
|
|
|
|
|
if (parsedDllEntry && (lastCached != id))
|
|
|
|
|
throw EStorageParse(); // There were chunks inbetween
|
|
|
|
|
if (!parsedDllEntry)
|
|
|
|
@ -148,7 +149,10 @@ void CDllDirectory::parse(uint16 version, TParseLevel level)
|
|
|
|
|
lastCached = id;
|
|
|
|
|
parsedDllEntry = true;
|
|
|
|
|
}
|
|
|
|
|
m_Entries.push_back(static_cast<CDllEntry *>(it->second));
|
|
|
|
|
CDllEntry *dllEntry = static_cast<CDllEntry *>(it->second);
|
|
|
|
|
m_InternalNameToIndex[NLMISC::toLower(dllEntry->dllFilename())] = m_Entries.size();
|
|
|
|
|
m_Entries.push_back(dllEntry);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
m_ChunkCache.push_back(*it); // Dummy entry to know the location
|
|
|
|
@ -222,6 +226,7 @@ void CDllDirectory::disown()
|
|
|
|
|
CStorageContainer::disown();
|
|
|
|
|
m_ChunkCache.clear();
|
|
|
|
|
m_Entries.clear();
|
|
|
|
|
m_InternalNameToIndex.clear();
|
|
|
|
|
|
|
|
|
|
// Ownership goes back to Chunks
|
|
|
|
|
ChunksOwnsPointers = true;
|
|
|
|
@ -233,6 +238,37 @@ const CDllEntry *CDllDirectory::get(uint16 index) const
|
|
|
|
|
return m_Entries[index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Parallel to CClassDirectory3
|
|
|
|
|
void CDllDirectory::reset()
|
|
|
|
|
{
|
|
|
|
|
nlassert(!ChunksOwnsPointers);
|
|
|
|
|
for (std::vector<CDllEntry *>::iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
|
|
|
|
|
{
|
|
|
|
|
delete (*subit);
|
|
|
|
|
}
|
|
|
|
|
m_Entries.clear();
|
|
|
|
|
m_InternalNameToIndex.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Parallel to CClassDirectory3
|
|
|
|
|
uint16 CDllDirectory::getOrCreateIndex(const IDllPluginDesc *dllPluginDesc)
|
|
|
|
|
{
|
|
|
|
|
nlassert(!ChunksOwnsPointers);
|
|
|
|
|
std::map<ucstring, uint16>::iterator it = m_InternalNameToIndex.find(NLMISC::toLower(ucstring(dllPluginDesc->internalName())));
|
|
|
|
|
|
|
|
|
|
// Return existing index
|
|
|
|
|
if (it != m_InternalNameToIndex.end())
|
|
|
|
|
return it->second;
|
|
|
|
|
|
|
|
|
|
// Create new entry
|
|
|
|
|
/*CClassEntry *classEntry = new CClassEntry(sceneClassDesc);
|
|
|
|
|
uint16 index = m_Entries.size();
|
|
|
|
|
m_ClassIdToIndex[classEntry->classId()] = index;
|
|
|
|
|
m_Entries.push_back(classEntry);
|
|
|
|
|
return index;*/
|
|
|
|
|
return 0xFFFF;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IStorageObject *CDllDirectory::createChunkById(uint16 id, bool container)
|
|
|
|
|
{
|
|
|
|
|
if (container)
|
|
|
|
|