MCPcopy Create free account
hub / github.com/360Controller/360Controller / InitializeTerminate

Method InitializeTerminate

Feedback360/Feedback360.cpp:490–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488}
489
490HRESULT Feedback360::InitializeTerminate(NumVersion APIversion, io_object_t hidDevice, boolean_t begin)
491{
492 if(begin) {
493 if (APIversion.majorRev != kFFPlugInAPIMajorRev)
494 {
495 // fprintf(stderr,"Feedback: Invalid version\n");
496 return FFERR_INVALIDPARAM;
497 }
498 // From probe
499 if( (hidDevice==0)
500 || ((!IOObjectConformsTo(hidDevice,"Xbox360ControllerClass"))
501 && (!IOObjectConformsTo(hidDevice,"Wireless360Controller"))) )
502 {
503 // fprintf(stderr,"Feedback: Invalid device\n");
504 return FFERR_INVALIDPARAM;
505 }
506 if(!Device_Initialise(&this->device, hidDevice)) {
507 // fprintf(stderr,"Feedback: Failed to initialise\n");
508 return FFERR_NOINTERFACE;
509 }
510 Queue = dispatch_queue_create("com.mice.driver.Feedback360", NULL);
511 Timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, Queue);
512 dispatch_source_set_timer(Timer, dispatch_walltime(NULL, 0), LoopGranularity*1000, 10);
513 dispatch_set_context(Timer, this);
514 dispatch_source_set_event_handler_f(Timer, EffectProc);
515 dispatch_resume(Timer);
516 }
517 else {
518 dispatch_sync(Queue, ^{
519 dispatch_source_cancel(Timer);
520 SetForce(0, 0);
521 Device_Finalise(&this->device);
522 });
523
524 }
525 return FF_OK;
526}
527
528HRESULT Feedback360::DestroyEffect(FFEffectDownloadID EffectHandle)
529{

Callers 1

sInitializeTerminateMethod · 0.45

Calls 2

Device_InitialiseFunction · 0.85
Device_FinaliseFunction · 0.85

Tested by

no test coverage detected