From feb9ab68b99a53c9c32bbab784724278369176f1 Mon Sep 17 00:00:00 2001 From: Daniel Remenak Date: Tue, 6 Sep 2005 11:03:48 +0000 Subject: [PATCH] - Allow the creation of an FF effect while the joystick is not acquired. - Failing to download an effect after setting parameters is not a fatal error. --- dlls/dinput/effect_linuxinput.c | 14 +++++++------- dlls/dinput/joystick_linuxinput.c | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dlls/dinput/effect_linuxinput.c b/dlls/dinput/effect_linuxinput.c index ca0a18bc9f1..68fda2b3881 100644 --- a/dlls/dinput/effect_linuxinput.c +++ b/dlls/dinput/effect_linuxinput.c @@ -54,7 +54,7 @@ struct LinuxInputEffectImpl struct ff_effect effect; /* Parent device */ - int fd; + int* fd; }; @@ -254,7 +254,7 @@ static HRESULT WINAPI LinuxInputEffectImpl_Download( TRACE("(this=%p)\n", This); - if (ioctl(This->fd, EVIOCSFF, &This->effect) == -1) { + if (ioctl(*(This->fd), EVIOCSFF, &This->effect) == -1) { if (errno == ENOMEM) { return DIERR_DEVICEFULL; } else { @@ -516,7 +516,7 @@ static HRESULT WINAPI LinuxInputEffectImpl_Start( event.type = EV_FF; event.code = This->effect.id; event.value = dwIterations; - if (write(This->fd, &event, sizeof(event)) == -1) { + if (write(*(This->fd), &event, sizeof(event)) == -1) { FIXME("Unable to write event. Assuming device disconnected.\n"); return DIERR_INPUTLOST; } @@ -708,7 +708,7 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters( if (!(dwFlags & DIEP_NODOWNLOAD)) retval = LinuxInputEffectImpl_Download(iface); if (retval != DI_OK) - return retval; + return DI_DOWNLOADSKIPPED; if (dwFlags & DIEP_NORESTART) TRACE("DIEP_NORESTART: not handled (we have no control of that).\n"); @@ -744,7 +744,7 @@ static HRESULT WINAPI LinuxInputEffectImpl_Stop( event.code = This->effect.id; event.value = 0; /* we don't care about the success or failure of this call */ - write(This->fd, &event, sizeof(event)); + write(*(This->fd), &event, sizeof(event)); return DI_OK; } @@ -756,7 +756,7 @@ static HRESULT WINAPI LinuxInputEffectImpl_Unload( TRACE("(this=%p)\n", This); /* Erase the downloaded effect */ - if (ioctl(This->fd, EVIOCRMFF, This->effect.id) == -1) + if (ioctl(*(This->fd), EVIOCRMFF, This->effect.id) == -1) return DIERR_INVALIDPARAM; /* Mark the effect as deallocated */ @@ -770,7 +770,7 @@ static HRESULT WINAPI LinuxInputEffectImpl_Unload( */ HRESULT linuxinput_create_effect( - int fd, + int* fd, REFGUID rguid, LPDIRECTINPUTEFFECT* peff) { diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 908d0e4c261..1c1d89efca0 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -77,7 +77,7 @@ struct EffectListItem }; /* implemented in effect_linuxinput.c */ -HRESULT linuxinput_create_effect(int fd, REFGUID rguid, LPDIRECTINPUTEFFECT* peff); +HRESULT linuxinput_create_effect(int* fd, REFGUID rguid, LPDIRECTINPUTEFFECT* peff); HRESULT linuxinput_get_info_A(int fd, REFGUID rguid, LPDIEFFECTINFOA info); HRESULT linuxinput_get_info_W(int fd, REFGUID rguid, LPDIEFFECTINFOW info); @@ -1171,13 +1171,13 @@ static HRESULT WINAPI JoystickAImpl_CreateEffect(LPDIRECTINPUTDEVICE8A iface, new->next = This->top_effect; This->top_effect = new; - retval = linuxinput_create_effect(This->joyfd, rguid, &(new->ref)); + retval = linuxinput_create_effect(&(This->joyfd), rguid, &(new->ref)); if (retval != DI_OK) return retval; if (lpeff != NULL) retval = new->ref->lpVtbl->SetParameters(new->ref, lpeff, 0); - if (retval != DI_OK) + if (retval != DI_OK && retval != DI_DOWNLOADSKIPPED) return retval; *ppdef = new->ref; -- 2.11.4.GIT