Пример #1
0
void Reset(bool _bHard)
{

	CoreTiming::RemoveAllEvents(enque_reply);

	u32 i;
	for (i=0; i<IPC_MAX_FDS; i++)
	{
		if (g_FdMap[i] != NULL && !g_FdMap[i]->IsHardware())
		{
			// close all files and delete their resources
			g_FdMap[i]->Close(0, true);
			delete g_FdMap[i];
		}
		g_FdMap[i] = NULL;
	}

	u32 j;
	for (j=0; j<ES_MAX_COUNT; j++)
	{
		es_inuse[j] = false;
	}

	TDeviceMap::iterator itr = g_DeviceMap.begin();
	while (itr != g_DeviceMap.end())
	{
		if (itr->second)
		{
			// Force close
			itr->second->Close(0, true);
			// Hardware should not be deleted unless it is a hard reset
			if (_bHard)
				delete itr->second;
		}
		++itr;
	}
	if (_bHard)
	{
		g_DeviceMap.erase(g_DeviceMap.begin(), g_DeviceMap.end());
	}
	request_queue.clear();

	// lock due to using reply_queue
	{
		std::lock_guard<std::mutex> lk(s_reply_queue);
		reply_queue.clear();
	}
	last_reply_time = 0;
}
Пример #2
0
void Reset(bool _bHard)
{
	CoreTiming::RemoveAllEvents(event_enqueue);

	for (IWII_IPC_HLE_Device*& dev : g_FdMap)
	{
		if (dev != nullptr && !dev->IsHardware())
		{
			// close all files and delete their resources
			dev->Close(0, true);
			delete dev;
		}

		dev = nullptr;
	}

	for (bool& in_use : es_inuse)
	{
		in_use = false;
	}

	for (const auto& entry : g_DeviceMap)
	{
		if (entry.second)
		{
			// Force close
			entry.second->Close(0, true);

			// Hardware should not be deleted unless it is a hard reset
			if (_bHard)
				delete entry.second;
		}
	}

	if (_bHard)
	{
		g_DeviceMap.erase(g_DeviceMap.begin(), g_DeviceMap.end());
	}
	request_queue.clear();
	reply_queue.clear();

	last_reply_time = 0;
}