void PreFullReleaseModel(int streamingIdx)
{
	int drawblDict = *(int*)0xF272E4;

	if (streamingIdx >= GetTypeStart(drawblDict) && streamingIdx <= GetTypeEnd(drawblDict))
	{
		int dict = streamingIdx - GetTypeStart(drawblDict);

		auto pair = m_dependencyDrawableDicts.equal_range(dict);

		for (auto it = pair.first; it != pair.second; it++)
		{
			if (it->second->HasInstance())
			{
				//trace("releasing dict %s (0x%08x) for a full release because *reasons*\n", GetStreamName(dict, *(int*)0xF272E4).c_str(), it->second->GetModelHash());

				it->second->RemoveInstance();
			}
		}

		//m_dependencyDrawableDicts.erase(dict);

		auto entPair = m_dependencyDictEnts.equal_range(dict);

		for (auto it = entPair.first; it != entPair.second; it++)
		{
			//trace("also destroying model for dict %s\n", GetStreamName(dict, *(int*)0xF272E4).c_str());

			it->second->DestroyModel();
		}

		m_dependencyDictEnts.erase(dict);
	}
}
示例#2
0
	void deregisterListener(const std::string& attributeName, std::function<void(EmberEntity&, const Atlas::Message::Element&)>& listener) {
		for (auto range = mCallbacks.equal_range(attributeName); range.first != range.second; ++range.first) {
			if (range.first->second == &listener) {
				mCallbacks.erase(range.first);
				break;
			}
		}
	}
int DrawableDictStoreGetUsageWrap(int dict)
{
	int usage = DrawblDictGetUsage(dict);

	if (usage == 0 && _ReturnAddress() == (void*)0xBCC153)
	{
		bool deferred = false;

		auto pair = m_dependencyDrawableDicts.equal_range(dict);

		for (auto it = pair.first; it != pair.second; it++)
		{
			if (it->second->HasInstance())
			{
				if (!it->second->ShouldRelease())
				{
					//trace("model info for %s (0x%08x) still has %i references!\n", GetStreamName(dict, *(int*)0xF272E4).c_str(), it->second->GetModelHash(), it->second->GetRefCount());

					return 1;
				}

				it->second->RemoveInstance();

				deferred = true;
			}
		}

		//m_dependencyDrawableDicts.erase(dict);

		auto entPair = m_dependencyDictEnts.equal_range(dict);

		for (auto it = entPair.first; it != entPair.second; it++)
		{
			it->second->DestroyModel();

			deferred = true;
		}

		m_dependencyDictEnts.erase(dict);

		if (deferred)
		{
			//trace("pre-deferring drawable destruction for %s\n", GetStreamName(dict, *(int*)0xF272E4).c_str());

			DeferToNextFrame([=] ()
			{
				//trace("executing pre-deferred drawable destruction for %s\n", GetStreamName(dict, *(int*)0xF272E4).c_str());

				//ReleaseDrawblDict(dict);
				ReleaseStreamingObjectNow((void*)0xF21C60, dict + GetTypeStart(*(int*)0xF272E4));
			});

			return 1;
		}
	}

	return usage;
}
示例#4
0
	sf::RenderTexture* ShadowTextRenderer::findFromTextureCache(sf::Vector2u size)
	{
		auto it = shadowCache.find(size);

		if (it != shadowCache.end())
		{
			auto ptr = it->second;
			shadowCache.erase(it);
			return ptr;
		}

		return 0;
	}