コード例 #1
0
ファイル: Package.cpp プロジェクト: Foreven/Unreal4-1
/**
 * Fully loads this package. Safe to call multiple times and won't clobber already loaded assets.
 */
void UPackage::FullyLoad()
{
	// Make sure we're a topmost package.
	check(GetOuter()==NULL);

	// Only perform work if we're not already fully loaded.
	if( !IsFullyLoaded() )
	{
		// Mark package so exports are found in memory first instead of being clobbered.
		bool bSavedState = ShouldFindExportsInMemoryFirst();
		FindExportsInMemoryFirst( true );

		// Re-load this package.
		LoadPackage( NULL, *GetName(), LOAD_None );

		// Restore original state.
		FindExportsInMemoryFirst( bSavedState );
	}
}
コード例 #2
0
ファイル: plRegistryNode.cpp プロジェクト: branan/Plasma
void plRegistryPageNode::LoadKeys()
{
    hsAssert(IsValid(), "Trying to load keys for invalid page");
    hsAssert(!fIsNewPage, "Trying to read a new page");
    if (IsFullyLoaded())
        return;

    hsStream* stream = OpenStream();
    if (!stream)
    {
        hsAssert(0, plString::Format("plRegistryPageNode::LoadKeysFromSource - bad stream %s,%s",
            GetPageInfo().GetAge(), GetPageInfo().GetPage()).c_str());
        return;
    }

    // If we're loading keys in the middle of a read because FindKey() failed, we'd better
    // make note of our stream position and restore it when we're done.
    uint32_t oldPos = stream->GetPosition();
    stream->SetPosition(GetPageInfo().GetIndexStart());

    // Read in the number of key types
    uint32_t numTypes = stream->ReadLE32();
    for (uint32_t i = 0; i < numTypes; i++)
    {
        uint16_t classType = stream->ReadLE16();
        plRegistryKeyList* keyList = IGetKeyList(classType);
        if (!keyList)
        {
            keyList = new plRegistryKeyList(classType);
            fKeyLists[classType] = keyList;
        }
        keyList->Read(stream);
    }

    stream->SetPosition(oldPos);
    CloseStream();
    fStaticLoadedTypes = fKeyLists.size();
}