void joypad::free() { if (device_ref) { IOHIDDeviceUnscheduleFromRunLoop(device_ref, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE); } if (ff_device) { FFDeviceReleaseEffect(ff_device, ff_object); FFReleaseDevice(ff_device); memfree(ff_axes); memfree(ff_directions); } }
static ULONG WINAPI effect_Release(IDirectInputEffect *iface) { EffectImpl *This = impl_from_IDirectInputEffect(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p, ref is now: %u\n", This, ref); if(!ref) { list_remove(&This->entry); FFDeviceReleaseEffect(This->device->ff, This->effect); HeapFree(GetProcessHeap(), 0, This); } return ref; }
/* * Frees the effect. */ void SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect) { HRESULT ret; ret = FFDeviceReleaseEffect(haptic->hwdata->device, effect->hweffect->ref); if (ret != FF_OK) { SDL_SetError("Haptic: Error removing the effect from the device: %s.", FFStrError(ret)); } SDL_SYS_HapticFreeFFEFFECT(&effect->hweffect->effect, effect->effect.type); SDL_free(effect->hweffect); effect->hweffect = NULL; }