當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。