当前位置: 首页>>代码示例>>C++>>正文


C++ AddDevice函数代码示例

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


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

示例1: EXIDevice_Create

void CEXIChannel::DoState(PointerWrap &p)
{
	p.Do(m_Status);
	p.Do(m_DMAMemoryAddress);
	p.Do(m_DMALength);
	p.Do(m_Control);
	p.Do(m_ImmData);

	for (int d = 0; d < NUM_DEVICES; ++d)
	{
		IEXIDevice* pDevice = m_pDevices[d];
		TEXIDevices type = pDevice->m_deviceType;
		p.Do(type);
		IEXIDevice* pSaveDevice = (type == pDevice->m_deviceType) ? pDevice : EXIDevice_Create(type, m_ChannelId);
		pSaveDevice->DoState(p);
		if(pSaveDevice != pDevice)
		{
			// if we had to create a temporary device, discard it if we're not loading.
			// also, if no movie is active, we'll assume the user wants to keep their current devices
			// instead of the ones they had when the savestate was created,
			// unless the device is NONE (since ChangeDevice sets that temporarily).
			if(p.GetMode() != PointerWrap::MODE_READ)
			{
				delete pSaveDevice;
			}
			else
			{
				AddDevice(pSaveDevice, d, false);
			}
		}
	}
}
开发者ID:Everscent,项目名称:dolphin-emu,代码行数:32,代码来源:EXI_Channel.cpp

示例2: RemoveDevice

void FDeviceSDL::IgnoreGameControllers(bool bIgnore)
{
	if (bIgnore && !bIgnoreGameControllers)
	{
		bIgnoreGameControllers = true;
		for (auto &Device : Devices)
		{
			if (DeviceMapping.Contains(Device.Value.InstanceId) && SDL_IsGameController(Device.Value.DeviceIndex.value))
			{
				RemoveDevice(Device.Key);
			}
		}
	}
	else if (!bIgnore && bIgnoreGameControllers)
	{
		bIgnoreGameControllers = false;
		int Joysticks = SDL_NumJoysticks();
		for (int i = 0; i < Joysticks; i++)
		{
			if (SDL_IsGameController(i))
			{
				AddDevice(FDeviceIndex(i));
			}
		}
	}
}
开发者ID:Deepfreeze32,项目名称:UEJoystickPlugin,代码行数:26,代码来源:DeviceSDL.cpp

示例3: AddDevice

IDevice* CDeviceList::AddDevice(voidinstancefunc InstanceFunction, const int ID, void* MainWindow)
{
    instancefunc initializer=(instancefunc)InstanceFunction;
    IDevice* D=initializer();
    D->Init(ID,MainWindow);
    return AddDevice(D);
}
开发者ID:vemod-,项目名称:Object-Studio,代码行数:7,代码来源:cdevicelist.cpp

示例4: switch

INT_PTR CALLBACK BtrfsDeviceAdd::DeviceAddDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
    try {
        switch (uMsg) {
            case WM_INITDIALOG:
            {
                EnableThemeDialogTexture(hwndDlg, ETDT_ENABLETAB);
                populate_device_tree(GetDlgItem(hwndDlg, IDC_DEVICE_TREE));
                EnableWindow(GetDlgItem(hwndDlg, IDOK), false);
                break;
            }

            case WM_COMMAND:
                switch (HIWORD(wParam)) {
                    case BN_CLICKED:
                        switch (LOWORD(wParam)) {
                            case IDOK:
                                AddDevice(hwndDlg);
                            return true;

                            case IDCANCEL:
                                EndDialog(hwndDlg, 0);
                            return true;
                        }
                    break;
                }
            break;

            case WM_NOTIFY:
                switch (((LPNMHDR)lParam)->code) {
                    case TVN_SELCHANGEDW:
                    {
                        NMTREEVIEWW* nmtv = (NMTREEVIEWW*)lParam;
                        TVITEMW tvi;
                        bool enable = false;

                        RtlZeroMemory(&tvi, sizeof(TVITEMW));
                        tvi.hItem = nmtv->itemNew.hItem;
                        tvi.mask = TVIF_PARAM | TVIF_HANDLE;

                        if (SendMessageW(GetDlgItem(hwndDlg, IDC_DEVICE_TREE), TVM_GETITEMW, 0, (LPARAM)&tvi))
                            sel = tvi.lParam == 0 ? nullptr : (device*)tvi.lParam;
                        else
                            sel = nullptr;

                        if (sel)
                            enable = (!sel->is_disk || !sel->has_parts) && !sel->multi_device;

                        EnableWindow(GetDlgItem(hwndDlg, IDOK), enable);
                        break;
                    }
                }
            break;
        }
    } catch (const exception& e) {
        error_message(hwndDlg, e.what());
    }

    return false;
}
开发者ID:HeisSpiter,项目名称:btrfs,代码行数:59,代码来源:devices.cpp

示例5: nitroFSInit

//Figure out if its gba or ds, setup stuff
int nitroFSInit(const char *ndsfile) {
	unsigned int pos=0;
	char romstr[0x10];
	chdirpathid=NITROROOT;
	ndsFileLastpos=0;
	ndsFile=NULL;
	REG_EXMEMCNT &= ~ARM7_OWNS_CARD; //give us gba slot ownership
	if(strncmp(((const char *)GBAROM)+LOADERSTROFFSET,LOADERSTR,strlen(LOADERSTR))==0) {	// We has gba rahm
		if(strncmp(((const char *)GBAROM)+LOADERSTROFFSET+LOADEROFFSET,LOADERSTR,strlen(LOADERSTR))==0) { //Look for second magic string, if found its a sc.nds or nds.gba
			fntOffset=((u32)*(u32*)(((const char *)GBAROM)+FNTOFFSET+LOADEROFFSET))+LOADEROFFSET;	
			fatOffset=((u32)*(u32*)(((const char *)GBAROM)+FATOFFSET+LOADEROFFSET))+LOADEROFFSET;
			hasLoader=true;
			AddDevice(&nitroFSdevoptab);
			return(1);
		} else {	//Ok, its not a .gba build, so must be emulator
			fntOffset=((u32)*(u32*)(((const char *)GBAROM)+FNTOFFSET));	
			fatOffset=((u32)*(u32*)(((const char *)GBAROM)+FATOFFSET));
			hasLoader=false;
			AddDevice(&nitroFSdevoptab);
			return(1);
		}
	} else {	//okay then try something else ~_~ (like dldi)
		if((ndsFile=fopen(ndsfile,"rb"))) {
			nitroSubRead(&pos,romstr,strlen(LOADERSTR));
			if(strncmp(romstr,LOADERSTR,strlen(LOADERSTR))==0) {	
				nitroSubSeek(&pos,LOADEROFFSET+FNTOFFSET,SEEK_SET);
				nitroSubRead(&pos,&fntOffset,sizeof(fntOffset));
				nitroSubSeek(&pos,LOADEROFFSET+FATOFFSET,SEEK_SET);
				nitroSubRead(&pos,&fatOffset,sizeof(fatOffset));
				fatOffset+=LOADEROFFSET;
				fntOffset+=LOADEROFFSET;
				hasLoader=true;
			} else {
				nitroSubSeek(&pos,FNTOFFSET,SEEK_SET);
				nitroSubRead(&pos,&fntOffset,sizeof(fntOffset));
				nitroSubSeek(&pos,FATOFFSET,SEEK_SET);
				nitroSubRead(&pos,&fatOffset,sizeof(fatOffset));
				hasLoader=false;
			}
			setvbuf(ndsFile,NULL,_IONBF,0);		//we dont need double buffs u_u
			AddDevice(&nitroFSdevoptab);
			return(1);
		} 
	}
	return(0);
}
开发者ID:kusma,项目名称:nds,代码行数:47,代码来源:nitrofs.c

示例6: GOptimizer

void GOptimizingBench::CreateOptimizer()
{
	if(m_pOpt)
		delete m_pOpt;
	m_pOpt = new GOptimizer(this);
	GDeviceWidget* pDevWid = AddDevice(m_pOpt);
	setCentralWidget(pDevWid);
}
开发者ID:GaelReinaudi,项目名称:LabExe,代码行数:8,代码来源:GOptimizingBench.cpp

示例7: AddDevice

int CEnumerator::OnEnumFindDevice(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DEVICE_INTERFACE_DETAIL_DATA DeviceInterfaceDetailData, int a5)
{
	if(PowerUp(0, DeviceInfoData->DevInst))
	{
		return 1;
	}
	return AddDevice(DeviceInfoSet, DeviceInfoData, DeviceInterfaceDetailData, a5);
}
开发者ID:jte,项目名称:logitech-rce,代码行数:8,代码来源:CEnumerator.cpp

示例8: cd_init

int cd_init (void *elf)
{
	KPRINTF ("cd_init()");

	elf_header = elf;
	AddDevice (&cd_device);
	
	return 0;
}
开发者ID:cod5,项目名称:kielder,代码行数:9,代码来源:wrapper.c

示例9: AddDevice

GBenchDockWidget* GWorkBench::AddDeviceInNewDock( GDevice* pTheDevice, bool putOnStack /*= true*/ )
{
    GDeviceWidget* pDevWid = AddDevice(pTheDevice);
    if(!pDevWid)
        return 0;
    GBenchDockWidget* pNewDock = new GBenchDockWidget(this, Qt::AllDockWidgetAreas);
    pNewDock->InsertDeviceWidget(pDevWid);
    return pNewDock;
}
开发者ID:GaelReinaudi,项目名称:LabExe,代码行数:9,代码来源:GWorkBench.cpp

示例10: NS_ENSURE_ARG_POINTER

NS_IMETHODIMP
sbCDDeviceMarshall::OnMediaInserted(sbICDDevice *aDevice)
{
  NS_ENSURE_ARG_POINTER(aDevice);

  nsresult rv = AddDevice(aDevice);
  NS_ENSURE_SUCCESS(rv, rv);

  return NS_OK;
}
开发者ID:AntoineTurmel,项目名称:nightingale-hacking,代码行数:10,代码来源:sbCDDeviceMarshall.cpp

示例11: MODULE_INIT

MODULE_INIT(const char *opt)
{
	devRandom = AddDevice("random", NULL, openRandom, 0);
	if (devRandom == NULL)
	{
		kprintf("could not add the random device!\n");
		return 1;
	};
	return 0;
};
开发者ID:osstudy,项目名称:glidix,代码行数:10,代码来源:random.c

示例12: MOZ_ASSERT

// nsIDNSServiceResolveListener
NS_IMETHODIMP
LegacyMDNSDeviceProvider::OnServiceResolved(nsIDNSServiceInfo* aServiceInfo)
{
  MOZ_ASSERT(NS_IsMainThread());

  if (NS_WARN_IF(!aServiceInfo)) {
    return NS_ERROR_INVALID_ARG;
  }

  nsresult rv;

  nsAutoCString serviceName;
  if (NS_WARN_IF(NS_FAILED(rv = aServiceInfo->GetServiceName(serviceName)))) {
    return rv;
  }

  LOG_I("OnServiceResolved: %s", serviceName.get());

  nsAutoCString host;
  if (NS_WARN_IF(NS_FAILED(rv = aServiceInfo->GetHost(host)))) {
    return rv;
  }

  nsAutoCString address;
  if (NS_WARN_IF(NS_FAILED(rv = aServiceInfo->GetAddress(address)))) {
    return rv;
  }

  uint16_t port;
  if (NS_WARN_IF(NS_FAILED(rv = aServiceInfo->GetPort(&port)))) {
    return rv;
  }

  nsAutoCString serviceType;
  if (NS_WARN_IF(NS_FAILED(rv = aServiceInfo->GetServiceType(serviceType)))) {
    return rv;
  }

  uint32_t index;
  if (FindDeviceById(host, index)) {
    return UpdateDevice(index,
                        serviceName,
                        serviceType,
                        address,
                        port);
  } else {
    return AddDevice(host,
                     serviceName,
                     serviceType,
                     address,
                     port);
  }

  return NS_OK;
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:56,代码来源:LegacyMDNSDeviceProvider.cpp

示例13: AddDevice

/**
 * Fetch a list of all FTDI widgets and create a new device for each of them.
 */
bool FtdiDmxPlugin::StartHook() {
  typedef vector<FtdiWidgetInfo> FtdiWidgetInfoVector;
  FtdiWidgetInfoVector widgets;
  FtdiWidget::Widgets(&widgets);

  FtdiWidgetInfoVector::const_iterator iter;
  for (iter = widgets.begin(); iter != widgets.end(); ++iter) {
    AddDevice(new FtdiDmxDevice(this, *iter, GetFrequency()));
  }
  return true;
}
开发者ID:basileus,项目名称:ola,代码行数:14,代码来源:FtdiDmxPlugin.cpp

示例14: CreateDeviceList

static void CreateDeviceList(IXMLDOMDocument* pDoc,IXMLDOMElement* pParent,const DEVICELIST& l)
{
	HRESULT hr;
	for(size_t n=0;n<l.size();n++)
	{
		IXMLDOMElementPtr device;
		CreateElement(pDoc,L"device",&device);
		AddDevice(pDoc,device,l[n]);
		AppendChild(device,pParent);
	}
}
开发者ID:jensvaaben,项目名称:mfcbdainf,代码行数:11,代码来源:xmldoc.cpp

示例15: InitialiseOpenNI

OpenNi2Video::OpenNi2Video(const std::string& device_uri)
{
    InitialiseOpenNI();

    const int dev_id = AddDevice(device_uri);
    AddStream(OpenNiStreamMode( OpenNiDepth_1mm, ImageDim(), 30, dev_id) );
    AddStream(OpenNiStreamMode( OpenNiRgb,   ImageDim(), 30, dev_id) );

    SetupStreamModes();
    Start();
}
开发者ID:mp3guy,项目名称:Pangolin,代码行数:11,代码来源:openni2.cpp


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