• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TDeviceMap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TDeviceMap的典型用法代码示例。如果您正苦于以下问题:C++ TDeviceMap类的具体用法?C++ TDeviceMap怎么用?C++ TDeviceMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TDeviceMap类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: EnqueueEventCallback

namespace WII_IPC_HLE_Interface
{

typedef std::map<u32, IWII_IPC_HLE_Device*> TDeviceMap;
static TDeviceMap g_DeviceMap;

// STATE_TO_SAVE
typedef std::map<u32, std::string> TFileNameMap;

#define IPC_MAX_FDS 0x18
#define ES_MAX_COUNT 2
static IWII_IPC_HLE_Device* g_FdMap[IPC_MAX_FDS];
static bool es_inuse[ES_MAX_COUNT];
static IWII_IPC_HLE_Device* es_handles[ES_MAX_COUNT];


typedef std::deque<u32> ipc_msg_queue;
static ipc_msg_queue request_queue; // ppc -> arm
static ipc_msg_queue reply_queue;   // arm -> ppc
static ipc_msg_queue ack_queue;   // arm -> ppc

static int event_enqueue;

static u64 last_reply_time;

static const u64 ENQUEUE_REQUEST_FLAG = 0x100000000ULL;
static const u64 ENQUEUE_ACKNOWLEDGEMENT_FLAG = 0x200000000ULL;
static void EnqueueEventCallback(u64 userdata, int)
{
	if (userdata & ENQUEUE_ACKNOWLEDGEMENT_FLAG)
	{
		ack_queue.push_back((u32)userdata);
	}
	else if (userdata & ENQUEUE_REQUEST_FLAG)
	{
		request_queue.push_back((u32)userdata);
	}
	else
	{
		reply_queue.push_back((u32)userdata);
	}
	Update();
}

void Init()
{
	_dbg_assert_msg_(WII_IPC_HLE, g_DeviceMap.empty(), "DeviceMap isn't empty on init");
	CWII_IPC_HLE_Device_es::m_ContentFile = "";

	for (IWII_IPC_HLE_Device*& dev : g_FdMap)
	{
		dev = nullptr;
	}

	u32 i = 0;
	// Build hardware devices
	g_DeviceMap[i] = new CWII_IPC_HLE_Device_usb_oh1_57e_305(i, "/dev/usb/oh1/57e/305"); i++;
	g_DeviceMap[i] = new CWII_IPC_HLE_Device_stm_immediate(i, "/dev/stm/immediate"); i++;
	g_DeviceMap[i] = new CWII_IPC_HLE_Device_stm_eventhook(i, "/dev/stm/eventhook"); i++;
	g_DeviceMap[i] = new CWII_IPC_HLE_Device_fs(i, "/dev/fs"); i++;

	// IOS allows two ES devices at a time
	for (u32 j=0; j<ES_MAX_COUNT; j++)
	{
		g_DeviceMap[i] = es_handles[j] = new CWII_IPC_HLE_Device_es(i, "/dev/es"); i++;
		es_inuse[j] = false;
	}

	g_DeviceMap[i] = new CWII_IPC_HLE_Device_di(i, std::string("/dev/di")); i++;
	g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_kd_request(i, "/dev/net/kd/request"); i++;
	g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_kd_time(i, "/dev/net/kd/time"); i++;
	g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_ncd_manage(i, "/dev/net/ncd/manage"); i++;
	g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_wd_command(i, "/dev/net/wd/command"); i++;
	g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_ip_top(i, "/dev/net/ip/top"); i++;
	g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_ssl(i, "/dev/net/ssl"); i++;
	g_DeviceMap[i] = new CWII_IPC_HLE_Device_usb_kbd(i, "/dev/usb/kbd"); i++;
	g_DeviceMap[i] = new CWII_IPC_HLE_Device_sdio_slot0(i, "/dev/sdio/slot0"); i++;
	g_DeviceMap[i] = new CWII_IPC_HLE_Device_stub(i, "/dev/sdio/slot1"); i++;
	#if defined(__LIBUSB__) || defined(_WIN32)
		g_DeviceMap[i] = new CWII_IPC_HLE_Device_hid(i, "/dev/usb/hid"); i++;
	#else
		g_DeviceMap[i] = new CWII_IPC_HLE_Device_stub(i, "/dev/usb/hid"); i++;
	#endif
	g_DeviceMap[i] = new CWII_IPC_HLE_Device_stub(i, "/dev/usb/oh1"); i++;
	g_DeviceMap[i] = new IWII_IPC_HLE_Device(i, "_Unimplemented_Device_"); i++;

	event_enqueue = CoreTiming::RegisterEvent("IPCEvent", EnqueueEventCallback);
}

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;
//.........这里部分代码省略.........
开发者ID:calmbrain,项目名称:dolphin,代码行数:101,代码来源:WII_IPC_HLE.cpp


示例2: EnqueueEvent

namespace WII_IPC_HLE_Interface
{

typedef std::map<u32, std::shared_ptr<IWII_IPC_HLE_Device>> TDeviceMap;
static TDeviceMap g_DeviceMap;

// STATE_TO_SAVE
#define IPC_MAX_FDS 0x18
#define ES_MAX_COUNT 2
static std::shared_ptr<IWII_IPC_HLE_Device> g_FdMap[IPC_MAX_FDS];
static bool es_inuse[ES_MAX_COUNT];
static std::shared_ptr<IWII_IPC_HLE_Device> es_handles[ES_MAX_COUNT];


typedef std::deque<u32> ipc_msg_queue;
static ipc_msg_queue request_queue; // ppc -> arm
static ipc_msg_queue reply_queue;   // arm -> ppc
static ipc_msg_queue ack_queue;   // arm -> ppc

static int event_enqueue;

static u64 last_reply_time;

static const u64 ENQUEUE_REQUEST_FLAG = 0x100000000ULL;
static const u64 ENQUEUE_ACKNOWLEDGEMENT_FLAG = 0x200000000ULL;
static void EnqueueEvent(u64 userdata, int cycles_late = 0)
{
	if (userdata & ENQUEUE_ACKNOWLEDGEMENT_FLAG)
	{
		ack_queue.push_back((u32)userdata);
	}
	else if (userdata & ENQUEUE_REQUEST_FLAG)
	{
		request_queue.push_back((u32)userdata);
	}
	else
	{
		reply_queue.push_back((u32)userdata);
	}
	Update();
}

static u32 num_devices;

template <typename T>
std::shared_ptr<T> AddDevice(const char* deviceName)
{
	auto device = std::make_shared<T>(num_devices, deviceName);
	g_DeviceMap[num_devices] = device;
	num_devices++;
	return device;
}

void Init()
{
	bool Wee_speeak_support = SConfig::GetInstance().bWiiSpeakSupport;
	_dbg_assert_msg_(WII_IPC_HLE, g_DeviceMap.empty(), "DeviceMap isn't empty on init");
	CWII_IPC_HLE_Device_es::m_ContentFile = "";

	num_devices = 0;

	// Build hardware devices
	if (Wee_speeak_support)
	{
		AddDevice<CWII_IPC_HLE_Device_usb_oh0>("/dev/usb/oh0");
		AddDevice<CWII_IPC_HLE_Device_usb_ven>("/dev/usb/ven");
		AddDevice<CWII_IPC_HLE_Device_usb_oh0_57e_308>("/dev/usb/oh0/57e/308");
		AddDevice<CWII_IPC_HLE_Device_usb_oh0_46d_a03>("/dev/usb/oh0/46d/a03");
	}
	AddDevice<CWII_IPC_HLE_Device_usb_oh1_57e_305>("/dev/usb/oh1/57e/305");
	AddDevice<CWII_IPC_HLE_Device_stm_immediate>("/dev/stm/immediate");
	AddDevice<CWII_IPC_HLE_Device_stm_eventhook>("/dev/stm/eventhook");
	AddDevice<CWII_IPC_HLE_Device_fs>("/dev/fs");

	// IOS allows two ES devices at a time
	for (u32 j=0; j<ES_MAX_COUNT; j++)
	{
		es_handles[j] = AddDevice<CWII_IPC_HLE_Device_es>("/dev/es");
		es_inuse[j] = false;
	}

	AddDevice<CWII_IPC_HLE_Device_di>("/dev/di");
	AddDevice<CWII_IPC_HLE_Device_net_kd_request>("/dev/net/kd/request");
	AddDevice<CWII_IPC_HLE_Device_net_kd_time>("/dev/net/kd/time");
	AddDevice<CWII_IPC_HLE_Device_net_ncd_manage>("/dev/net/ncd/manage");
	AddDevice<CWII_IPC_HLE_Device_net_wd_command>("/dev/net/wd/command");
	AddDevice<CWII_IPC_HLE_Device_net_ip_top>("/dev/net/ip/top");
	AddDevice<CWII_IPC_HLE_Device_net_ssl>("/dev/net/ssl");
	AddDevice<CWII_IPC_HLE_Device_usb_kbd>("/dev/usb/kbd");
	AddDevice<CWII_IPC_HLE_Device_sdio_slot0>("/dev/sdio/slot0");
	AddDevice<CWII_IPC_HLE_Device_stub>("/dev/sdio/slot1");
	#if defined(__LIBUSB__) || defined(_WIN32)
		AddDevice<CWII_IPC_HLE_Device_hid>("/dev/usb/hid");
	#else
		AddDevice<CWII_IPC_HLE_Device_stub>("/dev/usb/hid");
	#endif
	AddDevice<CWII_IPC_HLE_Device_stub>("/dev/usb/oh1");
	AddDevice<IWII_IPC_HLE_Device>("_Unimplemented_Device_");

	event_enqueue = CoreTiming::RegisterEvent("IPCEvent", EnqueueEvent);
//.........这里部分代码省略.........
开发者ID:Jack-Walker,项目名称:Ishiiruka,代码行数:101,代码来源:WII_IPC_HLE.cpp


示例3: AccessDeviceByID

IWII_IPC_HLE_Device* AccessDeviceByID(u32 _ID)
{
	if (g_DeviceMap.find(_ID) != g_DeviceMap.end())
	{
		return g_DeviceMap[_ID];
	}

	return nullptr;
}
开发者ID:calmbrain,项目名称:dolphin,代码行数:9,代码来源:WII_IPC_HLE.cpp


示例4: Reset

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;
}
开发者ID:calmbrain,项目名称:dolphin,代码行数:43,代码来源:WII_IPC_HLE.cpp


示例5: Init

void Init()
{
	bool Wee_speeak_support = SConfig::GetInstance().bWiiSpeakSupport;
	_dbg_assert_msg_(WII_IPC_HLE, g_DeviceMap.empty(), "DeviceMap isn't empty on init");
	CWII_IPC_HLE_Device_es::m_ContentFile = "";

	num_devices = 0;

	// Build hardware devices
	if (Wee_speeak_support)
	{
		AddDevice<CWII_IPC_HLE_Device_usb_oh0>("/dev/usb/oh0");
		AddDevice<CWII_IPC_HLE_Device_usb_ven>("/dev/usb/ven");
		AddDevice<CWII_IPC_HLE_Device_usb_oh0_57e_308>("/dev/usb/oh0/57e/308");
		AddDevice<CWII_IPC_HLE_Device_usb_oh0_46d_a03>("/dev/usb/oh0/46d/a03");
	}
	AddDevice<CWII_IPC_HLE_Device_usb_oh1_57e_305>("/dev/usb/oh1/57e/305");
	AddDevice<CWII_IPC_HLE_Device_stm_immediate>("/dev/stm/immediate");
	AddDevice<CWII_IPC_HLE_Device_stm_eventhook>("/dev/stm/eventhook");
	AddDevice<CWII_IPC_HLE_Device_fs>("/dev/fs");

	// IOS allows two ES devices at a time
	for (u32 j=0; j<ES_MAX_COUNT; j++)
	{
		es_handles[j] = AddDevice<CWII_IPC_HLE_Device_es>("/dev/es");
		es_inuse[j] = false;
	}

	AddDevice<CWII_IPC_HLE_Device_di>("/dev/di");
	AddDevice<CWII_IPC_HLE_Device_net_kd_request>("/dev/net/kd/request");
	AddDevice<CWII_IPC_HLE_Device_net_kd_time>("/dev/net/kd/time");
	AddDevice<CWII_IPC_HLE_Device_net_ncd_manage>("/dev/net/ncd/manage");
	AddDevice<CWII_IPC_HLE_Device_net_wd_command>("/dev/net/wd/command");
	AddDevice<CWII_IPC_HLE_Device_net_ip_top>("/dev/net/ip/top");
	AddDevice<CWII_IPC_HLE_Device_net_ssl>("/dev/net/ssl");
	AddDevice<CWII_IPC_HLE_Device_usb_kbd>("/dev/usb/kbd");
	AddDevice<CWII_IPC_HLE_Device_sdio_slot0>("/dev/sdio/slot0");
	AddDevice<CWII_IPC_HLE_Device_stub>("/dev/sdio/slot1");
	#if defined(__LIBUSB__) || defined(_WIN32)
		AddDevice<CWII_IPC_HLE_Device_hid>("/dev/usb/hid");
	#else
		AddDevice<CWII_IPC_HLE_Device_stub>("/dev/usb/hid");
	#endif
	AddDevice<CWII_IPC_HLE_Device_stub>("/dev/usb/oh1");
	AddDevice<IWII_IPC_HLE_Device>("_Unimplemented_Device_");

	event_enqueue = CoreTiming::RegisterEvent("IPCEvent", EnqueueEvent);
}
开发者ID:Jack-Walker,项目名称:Ishiiruka,代码行数:48,代码来源:WII_IPC_HLE.cpp


示例6: Init

void Init()
{
  _dbg_assert_msg_(WII_IPC_HLE, g_DeviceMap.empty(), "DeviceMap isn't empty on init");
  CWII_IPC_HLE_Device_es::m_ContentFile = "";

  num_devices = 0;

  // Build hardware devices
  AddDevice<CWII_IPC_HLE_Device_usb_oh1_57e_305>("/dev/usb/oh1/57e/305");
  AddDevice<CWII_IPC_HLE_Device_stm_immediate>("/dev/stm/immediate");
  AddDevice<CWII_IPC_HLE_Device_stm_eventhook>("/dev/stm/eventhook");
  AddDevice<CWII_IPC_HLE_Device_fs>("/dev/fs");

  // IOS allows two ES devices at a time
  for (u32 j = 0; j < ES_MAX_COUNT; j++)
  {
    es_handles[j] = AddDevice<CWII_IPC_HLE_Device_es>("/dev/es");
    es_inuse[j] = false;
  }

  AddDevice<CWII_IPC_HLE_Device_di>("/dev/di");
  AddDevice<CWII_IPC_HLE_Device_net_kd_request>("/dev/net/kd/request");
  AddDevice<CWII_IPC_HLE_Device_net_kd_time>("/dev/net/kd/time");
  AddDevice<CWII_IPC_HLE_Device_net_ncd_manage>("/dev/net/ncd/manage");
  AddDevice<CWII_IPC_HLE_Device_net_wd_command>("/dev/net/wd/command");
  AddDevice<CWII_IPC_HLE_Device_net_ip_top>("/dev/net/ip/top");
  AddDevice<CWII_IPC_HLE_Device_net_ssl>("/dev/net/ssl");
  AddDevice<CWII_IPC_HLE_Device_usb_kbd>("/dev/usb/kbd");
  AddDevice<CWII_IPC_HLE_Device_sdio_slot0>("/dev/sdio/slot0");
  AddDevice<CWII_IPC_HLE_Device_stub>("/dev/sdio/slot1");
#if defined(__LIBUSB__) || defined(_WIN32)
  AddDevice<CWII_IPC_HLE_Device_hid>("/dev/usb/hid");
#else
  AddDevice<CWII_IPC_HLE_Device_stub>("/dev/usb/hid");
#endif
  AddDevice<CWII_IPC_HLE_Device_stub>("/dev/usb/oh1");
  AddDevice<IWII_IPC_HLE_Device>("_Unimplemented_Device_");

  event_enqueue = CoreTiming::RegisterEvent("IPCEvent", EnqueueEvent);
  event_sdio_notify = CoreTiming::RegisterEvent("SDIO_EventNotify", SDIO_EventNotify_CPUThread);
}
开发者ID:Antidote,项目名称:dolphin,代码行数:41,代码来源:WII_IPC_HLE.cpp


示例7: Reset

void Reset(bool _bHard)
{
	CoreTiming::RemoveAllEvents(event_enqueue);

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

		dev.reset();
	}

	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);
		}
	}

	if (_bHard)
	{
		g_DeviceMap.clear();
	}
	request_queue.clear();
	reply_queue.clear();

	last_reply_time = 0;
}
开发者ID:Jack-Walker,项目名称:Ishiiruka,代码行数:38,代码来源:WII_IPC_HLE.cpp



注:本文中的TDeviceMap类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TDirectory类代码示例发布时间:2022-05-31
下一篇:
C++ TDesC8类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap