Changeset 9016 for trunk/src


Ignore:
Timestamp:
Aug 16, 2002, 5:08:25 PM (23 years ago)
Author:
sandervl
Message:

Wine resync; added missing bugfix

Location:
trunk/src/dinput
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/dinput/device.c

    r8346 r9016  
    44 * Copyright 1998,1999 Lionel Ulmer
    55 *
     6 *
     7 * This library is free software; you can redistribute it and/or
     8 * modify it under the terms of the GNU Lesser General Public
     9 * License as published by the Free Software Foundation; either
     10 * version 2.1 of the License, or (at your option) any later version.
     11 *
     12 * This library is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15 * Lesser General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU Lesser General Public
     18 * License along with this library; if not, write to the Free Software
     19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    620 */
    721
     
    1428
    1529#include <string.h>
    16 #include "debugtools.h"
     30#include "wine/debug.h"
    1731#include "winbase.h"
    1832#include "winerror.h"
     
    2135#include "device_private.h"
    2236
    23 DEFAULT_DEBUG_CHANNEL(dinput);
     37WINE_DEFAULT_DEBUG_CHANNEL(dinput);
    2438
    2539/******************************************************************************
     
    112126          *((char *) (out_c + df->dt[i].offset_out)) = *((char *) (in_c + df->dt[i].offset_in));
    113127          break;
    114        
     128
    115129        case 2:
    116130          TRACE("Copying (s) to %d from %d (value %d)\n",
     
    118132          *((short *) (out_c + df->dt[i].offset_out)) = *((short *) (in_c + df->dt[i].offset_in));
    119133          break;
    120        
     134
    121135        case 4:
    122136          TRACE("Copying (i) to %d from %d (value %d)\n",
     
    124138          *((int *) (out_c + df->dt[i].offset_out)) = *((int *) (in_c + df->dt[i].offset_in));
    125139          break;
    126        
     140
    127141        default:
    128142          memcpy((out_c + df->dt[i].offset_out), (in_c + df->dt[i].offset_in), df->dt[i].size);
     
    135149          *((char *) (out_c + df->dt[i].offset_out)) = (char) df->dt[i].value;
    136150          break;
    137        
     151
    138152        case 2:
    139153          TRACE("Copying (s) to %d default value %d\n",
     
    141155          *((short *) (out_c + df->dt[i].offset_out)) = (short) df->dt[i].value;
    142156          break;
    143        
     157
    144158        case 4:
    145159          TRACE("Copying (i) to %d default value %d\n",
     
    147161          *((int *) (out_c + df->dt[i].offset_out)) = (int) df->dt[i].value;
    148162          break;
    149        
     163
    150164        default:
    151165          memset((out_c + df->dt[i].offset_out), df->dt[i].size, 0);
     
    163177  int *done;
    164178  int index = 0;
    165  
     179
    166180  ret = (DataFormat *) HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat));
    167  
     181
    168182  done = (int *) HeapAlloc(GetProcessHeap(), 0, sizeof(int) * asked_format->dwNumObjs);
    169183  memset(done, 0, sizeof(int) * asked_format->dwNumObjs);
     
    172186
    173187  TRACE("Creating DataTransform : \n");
    174  
     188
    175189  for (i = 0; i < wine_format->dwNumObjs; i++) {
    176190    offset[i] = -1;
    177    
     191
    178192    for (j = 0; j < asked_format->dwNumObjs; j++) {
    179193      if (done[j] == 1)
    180194        continue;
    181      
     195
    182196      if (((asked_format->rgodf[j].pguid == NULL) || (IsEqualGUID(wine_format->rgodf[i].pguid, asked_format->rgodf[j].pguid)))
    183197          &&
     
    186200        done[j] = 1;
    187201
    188         TRACE("Matching : \n"); 
     202        TRACE("Matching : \n");
    189203        TRACE("   - Asked (%d) : %s - Ofs = %3ld - (Type = 0x%02x | Instance = %04x)\n",
    190               j, debugstr_guid(asked_format->rgodf[j].pguid), 
     204              j, debugstr_guid(asked_format->rgodf[j].pguid),
    191205              asked_format->rgodf[j].dwOfs,
    192206              DIDFT_GETTYPE(asked_format->rgodf[j].dwType), DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType));
    193        
     207
    194208        TRACE("   - Wine  (%d) : %s - Ofs = %3ld - (Type = 0x%02x | Instance = %04x)\n",
    195               j, debugstr_guid(wine_format->rgodf[i].pguid), 
     209              j, debugstr_guid(wine_format->rgodf[i].pguid),
    196210              wine_format->rgodf[i].dwOfs,
    197211              DIDFT_GETTYPE(wine_format->rgodf[i].dwType), DIDFT_GETINSTANCE(wine_format->rgodf[i].dwType));
    198        
     212
    199213        if (wine_format->rgodf[i].dwType & DIDFT_BUTTON)
    200214          dt[index].size = sizeof(BYTE);
     
    205219        dt[index].value = 0;
    206220        index++;
    207        
     221
    208222        if (wine_format->rgodf[i].dwOfs != asked_format->rgodf[j].dwOfs)
    209223          same = 0;
     
    222236    if (done[j] == 0) {
    223237      TRACE(" - Asked (%d) : %s - Ofs = %3ld - (Type = 0x%02x | Instance = %04x)\n",
    224             j, debugstr_guid(asked_format->rgodf[j].pguid), 
     238            j, debugstr_guid(asked_format->rgodf[j].pguid),
    225239            asked_format->rgodf[j].dwOfs,
    226240            DIDFT_GETTYPE(asked_format->rgodf[j].dwType), DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType));
    227241
    228      
     242
    229243      if (asked_format->rgodf[j].dwType & DIDFT_BUTTON)
    230244        dt[index].size = sizeof(BYTE);
     
    248262    ret->dt = dt;
    249263  }
    250  
     264
    251265  HeapFree(GetProcessHeap(), 0, done);
    252266
     
    259273
    260274HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(
    261         LPDIRECTINPUTDEVICE2A iface,LPCDIDATAFORMAT df
     275        LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df
    262276) {
    263277  int i;
     
    265279
    266280  TRACE("(this=%p,%p)\n",This,df);
    267  
     281
    268282  TRACE("df.dwSize=%ld\n",df->dwSize);
    269283  TRACE("(df.dwObjsize=%ld)\n",df->dwObjSize);
     
    271285  TRACE("(df.dwDataSize=%ld)\n",df->dwDataSize);
    272286  TRACE("(df.dwNumObjs=%ld)\n",df->dwNumObjs);
    273  
     287
    274288  for (i=0;i<df->dwNumObjs;i++) {
    275289    TRACE("df.rgodf[%d].guid %s\n",i,debugstr_guid(df->rgodf[i].pguid));
     
    282296
    283297HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(
    284         LPDIRECTINPUTDEVICE2A iface,HWND hwnd,DWORD dwflags
     298        LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags
    285299) {
    286300        ICOM_THIS(IDirectInputDevice2AImpl,iface);
     
    292306
    293307HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(
    294         LPDIRECTINPUTDEVICE2A iface,HANDLE hnd
     308        LPDIRECTINPUTDEVICE8A iface,HANDLE hnd
    295309) {
    296310        ICOM_THIS(IDirectInputDevice2AImpl,iface);
     
    299313}
    300314
    301 ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE2A iface)
     315ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface)
    302316{
    303317        ICOM_THIS(IDirectInputDevice2AImpl,iface);
     
    310324
    311325HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(
    312         LPDIRECTINPUTDEVICE2A iface,REFIID riid,LPVOID *ppobj
     326        LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj
    313327)
    314328{
     
    336350
    337351ULONG WINAPI IDirectInputDevice2AImpl_AddRef(
    338         LPDIRECTINPUTDEVICE2A iface)
     352        LPDIRECTINPUTDEVICE8A iface)
    339353{
    340354        ICOM_THIS(IDirectInputDevice2AImpl,iface);
     
    343357
    344358HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
    345         LPDIRECTINPUTDEVICE2A iface,
     359        LPDIRECTINPUTDEVICE8A iface,
    346360        LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
    347361        LPVOID lpvRef,
     
    354368          DPRINTF("\n");
    355369        }
    356        
    357         return DI_OK;
    358 }
    359        
     370
     371        return DI_OK;
     372}
     373
    360374HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(
    361         LPDIRECTINPUTDEVICE2A iface,
     375        LPDIRECTINPUTDEVICE8A iface,
    362376        REFGUID rguid,
    363377        LPDIPROPHEADER pdiph)
     
    365379        FIXME("(this=%p,%s,%p): stub!\n",
    366380              iface, debugstr_guid(rguid), pdiph);
    367        
     381
    368382        if (TRACE_ON(dinput))
    369383          _dump_DIPROPHEADER(pdiph);
    370        
     384
    371385        return DI_OK;
    372386}
    373387
    374388HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(
    375         LPDIRECTINPUTDEVICE2A iface,
     389        LPDIRECTINPUTDEVICE8A iface,
    376390        LPDIDEVICEOBJECTINSTANCEA pdidoi,
    377391        DWORD dwObj,
     
    380394        FIXME("(this=%p,%p,%ld,0x%08lx): stub!\n",
    381395              iface, pdidoi, dwObj, dwHow);
    382        
    383         return DI_OK;
    384 }
    385        
     396
     397        return DI_OK;
     398}
     399
    386400HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo(
    387         LPDIRECTINPUTDEVICE2A iface,
     401        LPDIRECTINPUTDEVICE8A iface,
    388402        LPDIDEVICEINSTANCEA pdidi)
    389403{
    390404        FIXME("(this=%p,%p): stub!\n",
    391405              iface, pdidi);
    392        
    393         return DI_OK;
    394 }
    395        
     406
     407        return DI_OK;
     408}
     409
    396410HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
    397         LPDIRECTINPUTDEVICE2A iface,
     411        LPDIRECTINPUTDEVICE8A iface,
    398412        HWND hwndOwner,
    399413        DWORD dwFlags)
     
    401415  FIXME("(this=%p,0x%08x,0x%08lx): stub!\n",
    402416        iface, hwndOwner, dwFlags);
    403        
    404         return DI_OK;
    405 }
    406        
     417
     418        return DI_OK;
     419}
     420
    407421HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(
    408         LPDIRECTINPUTDEVICE2A iface,
     422        LPDIRECTINPUTDEVICE8A iface,
    409423        HINSTANCE hinst,
    410424        DWORD dwVersion,
     
    415429        return DI_OK;
    416430}
    417        
     431
    418432/******************************************************************************
    419433 *      IDirectInputDevice2A
     
    421435
    422436HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(
    423         LPDIRECTINPUTDEVICE2A iface,
     437        LPDIRECTINPUTDEVICE8A iface,
    424438        REFGUID rguid,
    425439        LPCDIEFFECT lpeff,
     
    433447
    434448HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(
    435         LPDIRECTINPUTDEVICE2A iface,
     449        LPDIRECTINPUTDEVICE8A iface,
    436450        LPDIENUMEFFECTSCALLBACKA lpCallback,
    437451        LPVOID lpvRef,
     
    440454        FIXME("(this=%p,%p,%p,0x%08lx): stub!\n",
    441455              iface, lpCallback, lpvRef, dwFlags);
    442        
     456
    443457        if (lpCallback)
    444458                lpCallback(NULL, lpvRef);
     
    447461
    448462HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
    449         LPDIRECTINPUTDEVICE2A iface,
     463        LPDIRECTINPUTDEVICE8A iface,
    450464        LPDIEFFECTINFOA lpdei,
    451465        REFGUID rguid)
     
    457471
    458472HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(
    459         LPDIRECTINPUTDEVICE2A iface,
     473        LPDIRECTINPUTDEVICE8A iface,
    460474        LPDWORD pdwOut)
    461475{
     
    466480
    467481HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(
    468         LPDIRECTINPUTDEVICE2A iface,
     482        LPDIRECTINPUTDEVICE8A iface,
    469483        DWORD dwFlags)
    470484{
     
    475489
    476490HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(
    477         LPDIRECTINPUTDEVICE2A iface,
     491        LPDIRECTINPUTDEVICE8A iface,
    478492        LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
    479493        LPVOID lpvRef,
     
    488502
    489503HRESULT WINAPI IDirectInputDevice2AImpl_Escape(
    490         LPDIRECTINPUTDEVICE2A iface,
     504        LPDIRECTINPUTDEVICE8A iface,
    491505        LPDIEFFESCAPE lpDIEEsc)
    492506{
     
    497511
    498512HRESULT WINAPI IDirectInputDevice2AImpl_Poll(
    499         LPDIRECTINPUTDEVICE2A iface)
     513        LPDIRECTINPUTDEVICE8A iface)
    500514{
    501515        /* Because wine devices do not need to be polled, just return DI_NOEFFECT */
     
    504518
    505519HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(
    506         LPDIRECTINPUTDEVICE2A iface,
     520        LPDIRECTINPUTDEVICE8A iface,
    507521        DWORD cbObjectData,
    508         LPDIDEVICEOBJECTDATA rgdod,
     522        LPCDIDEVICEOBJECTDATA rgdod,
    509523        LPDWORD pdwInOut,
    510524        DWORD dwFlags)
     
    512526        FIXME("(this=%p,0x%08lx,%p,%p,0x%08lx): stub!\n",
    513527              iface, cbObjectData, rgdod, pdwInOut, dwFlags);
    514        
    515         return DI_OK;
    516 }
    517 
    518 HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE7A iface,
     528
     529        return DI_OK;
     530}
     531
     532HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface,
    519533                                                          LPCSTR lpszFileName,
    520534                                                          LPDIENUMEFFECTSINFILECALLBACK pec,
     
    527541}
    528542
    529 HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE7A iface,
     543HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
    530544                                                          LPCSTR lpszFileName,
    531545                                                          DWORD dwEntries,
     
    534548{
    535549  FIXME("(%p)->(%s,%08lx,%p,%08lx): stub !\n", iface, lpszFileName, dwEntries, rgDiFileEft, dwFlags);
    536  
     550
    537551  return DI_OK;
    538552}
     553
     554HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
     555                                                       LPDIACTIONFORMATA lpdiaf,
     556                                                       LPCSTR lpszUserName,
     557                                                       DWORD dwFlags)
     558{
     559  FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, lpszUserName, dwFlags);
     560
     561  return DI_OK;
     562}
     563
     564HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
     565                                                     LPDIACTIONFORMATA lpdiaf,
     566                                                     LPCSTR lpszUserName,
     567                                                     DWORD dwFlags)
     568{
     569  FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, lpszUserName, dwFlags);
     570
     571  return DI_OK;
     572}
     573
     574HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
     575                                                     LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader)
     576{
     577  FIXME("(%p)->(%p): stub !\n", iface, lpdiDevImageInfoHeader);
     578
     579  return DI_OK;
     580}
  • trunk/src/dinput/device_private.h

    r8346 r9016  
     1/*
     2 * Copyright 2000 Lionel Ulmer
     3 * Copyright 2000-2001 TransGaming Technologies Inc.
     4 *
     5 * This library is free software; you can redistribute it and/or
     6 * modify it under the terms of the GNU Lesser General Public
     7 * License as published by the Free Software Foundation; either
     8 * version 2.1 of the License, or (at your option) any later version.
     9 *
     10 * This library is distributed in the hope that it will be useful,
     11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13 * Lesser General Public License for more details.
     14 *
     15 * You should have received a copy of the GNU Lesser General Public
     16 * License along with this library; if not, write to the Free Software
     17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     18 */
     19
    120#ifndef __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
    221#define __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
     
    6180/* And the stubs */
    6281extern HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(
    63         LPDIRECTINPUTDEVICE2A iface,LPCDIDATAFORMAT df ) ;
     82        LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df ) ;
    6483extern HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(
    65         LPDIRECTINPUTDEVICE2A iface,HWND hwnd,DWORD dwflags ) ;
     84        LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags ) ;
    6685extern HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(
    67         LPDIRECTINPUTDEVICE2A iface,HANDLE hnd ) ;
    68 extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE2A iface) ;
     86        LPDIRECTINPUTDEVICE8A iface,HANDLE hnd ) ;
     87extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface) ;
    6988extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(
    70         LPDIRECTINPUTDEVICE2A iface,REFIID riid,LPVOID *ppobj ) ;
     89        LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj ) ;
    7190extern ULONG WINAPI IDirectInputDevice2AImpl_AddRef(
    72         LPDIRECTINPUTDEVICE2A iface) ;
     91        LPDIRECTINPUTDEVICE8A iface) ;
    7392extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
    74         LPDIRECTINPUTDEVICE2A iface,
     93        LPDIRECTINPUTDEVICE8A iface,
    7594        LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
    7695        LPVOID lpvRef,
    7796        DWORD dwFlags) ;
    7897extern HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(
    79         LPDIRECTINPUTDEVICE2A iface,
     98        LPDIRECTINPUTDEVICE8A iface,
    8099        REFGUID rguid,
    81100        LPDIPROPHEADER pdiph) ;
    82101extern HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(
    83         LPDIRECTINPUTDEVICE2A iface,
     102        LPDIRECTINPUTDEVICE8A iface,
    84103        LPDIDEVICEOBJECTINSTANCEA pdidoi,
    85104        DWORD dwObj,
    86105        DWORD dwHow) ;
    87106extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo(
    88         LPDIRECTINPUTDEVICE2A iface,
     107        LPDIRECTINPUTDEVICE8A iface,
    89108        LPDIDEVICEINSTANCEA pdidi) ;
    90109extern HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
    91         LPDIRECTINPUTDEVICE2A iface,
     110        LPDIRECTINPUTDEVICE8A iface,
    92111        HWND hwndOwner,
    93112        DWORD dwFlags) ;
    94113extern HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(
    95         LPDIRECTINPUTDEVICE2A iface,
     114        LPDIRECTINPUTDEVICE8A iface,
    96115        HINSTANCE hinst,
    97116        DWORD dwVersion,
    98117        REFGUID rguid) ;
    99118extern HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(
    100         LPDIRECTINPUTDEVICE2A iface,
     119        LPDIRECTINPUTDEVICE8A iface,
    101120        REFGUID rguid,
    102121        LPCDIEFFECT lpeff,
     
    104123        LPUNKNOWN pUnkOuter) ;
    105124extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(
    106         LPDIRECTINPUTDEVICE2A iface,
     125        LPDIRECTINPUTDEVICE8A iface,
    107126        LPDIENUMEFFECTSCALLBACKA lpCallback,
    108127        LPVOID lpvRef,
    109128        DWORD dwFlags) ;
    110129extern HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
    111         LPDIRECTINPUTDEVICE2A iface,
     130        LPDIRECTINPUTDEVICE8A iface,
    112131        LPDIEFFECTINFOA lpdei,
    113132        REFGUID rguid) ;
    114133extern HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(
    115         LPDIRECTINPUTDEVICE2A iface,
     134        LPDIRECTINPUTDEVICE8A iface,
    116135        LPDWORD pdwOut) ;
    117136extern HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(
    118         LPDIRECTINPUTDEVICE2A iface,
     137        LPDIRECTINPUTDEVICE8A iface,
    119138        DWORD dwFlags) ;
    120139extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(
    121         LPDIRECTINPUTDEVICE2A iface,
     140        LPDIRECTINPUTDEVICE8A iface,
    122141        LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
    123142        LPVOID lpvRef,
    124143        DWORD dwFlags) ;
    125144extern HRESULT WINAPI IDirectInputDevice2AImpl_Escape(
    126         LPDIRECTINPUTDEVICE2A iface,
     145        LPDIRECTINPUTDEVICE8A iface,
    127146        LPDIEFFESCAPE lpDIEEsc) ;
    128147extern HRESULT WINAPI IDirectInputDevice2AImpl_Poll(
    129         LPDIRECTINPUTDEVICE2A iface) ;
     148        LPDIRECTINPUTDEVICE8A iface) ;
    130149extern HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(
    131         LPDIRECTINPUTDEVICE2A iface,
     150        LPDIRECTINPUTDEVICE8A iface,
    132151        DWORD cbObjectData,
    133         LPDIDEVICEOBJECTDATA rgdod,
     152        LPCDIDEVICEOBJECTDATA rgdod,
    134153        LPDWORD pdwInOut,
    135154        DWORD dwFlags) ;
    136 extern HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE7A iface,
     155extern HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface,
    137156                                                                 LPCSTR lpszFileName,
    138157                                                                 LPDIENUMEFFECTSINFILECALLBACK pec,
    139158                                                                 LPVOID pvRef,
    140159                                                                 DWORD dwFlags) ;
    141 extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE7A iface,
     160extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
    142161                                                                 LPCSTR lpszFileName,
    143162                                                                 DWORD dwEntries,
    144163                                                                 LPDIFILEEFFECT rgDiFileEft,
    145164                                                                 DWORD dwFlags) ;
     165extern HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
     166                                                              LPDIACTIONFORMATA lpdiaf,
     167                                                              LPCSTR lpszUserName,
     168                                                              DWORD dwFlags);
     169extern HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
     170                                                            LPDIACTIONFORMATA lpdiaf,
     171                                                            LPCSTR lpszUserName,
     172                                                            DWORD dwFlags);
     173extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
     174                                                            LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader);
    146175
    147176#ifdef __WIN32OS2__
  • trunk/src/dinput/dinput_main.c

    r8346 r9016  
    33 * Copyright 1998 Marcus Meissner
    44 * Copyright 1998,1999 Lionel Ulmer
    5  *
     5 * Copyright 2000-2002 TransGaming Technologies Inc.
     6 *
     7 *
     8 * This library is free software; you can redistribute it and/or
     9 * modify it under the terms of the GNU Lesser General Public
     10 * License as published by the Free Software Foundation; either
     11 * version 2.1 of the License, or (at your option) any later version.
     12 *
     13 * This library is distributed in the hope that it will be useful,
     14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16 * Lesser General Public License for more details.
     17 *
     18 * You should have received a copy of the GNU Lesser General Public
     19 * License along with this library; if not, write to the Free Software
     20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    621 */
    722/* Status:
     
    1126 * - WingCommander Prophecy Demo:
    1227 *   Doesn't get Input Focus.
    13  * 
     28 *
    1429 * - Fallout : works great in X and DGA mode
    15  *
    16  * FIXME: The keyboard handling needs to (and will) be merged into keyboard.c
    17  *        (The current implementation is currently only a proof of concept and
    18  *         an utter mess.)
    1930 */
    2031
     
    2334#include <string.h>
    2435
    25 #include "debugtools.h"
     36#include "wine/debug.h"
    2637#include "winbase.h"
     38#include "winuser.h"
    2739#include "winerror.h"
    2840#include "windef.h"
    2941#include "dinput_private.h"
    3042
    31 DEFAULT_DEBUG_CHANNEL(dinput);
    32 
    33 static ICOM_VTABLE(IDirectInputA) ddiavt;
     43WINE_DEFAULT_DEBUG_CHANNEL(dinput);
     44
    3445static ICOM_VTABLE(IDirectInput7A) ddi7avt;
     46static ICOM_VTABLE(IDirectInput8A) ddi8avt;
    3547
    3648/* This array will be filled a dinput.so loading */
     
    3951static int nrof_dinput_devices = 0;
    4052
    41 /* register a direct draw driver. We better not use malloc for we are in
     53BOOL WINAPI Init( HINSTANCE inst, DWORD reason, LPVOID reserv)
     54{
     55    switch(reason)
     56    {
     57      case DLL_PROCESS_ATTACH:
     58        keyboard_hook = SetWindowsHookExW( WH_KEYBOARD_LL, KeyboardCallback, 0, 0 );
     59        break;
     60      case DLL_PROCESS_DETACH:
     61        UnhookWindowsHookEx(keyboard_hook);
     62        break;
     63    }
     64    return TRUE;
     65}
     66
     67
     68/* register a direct draw driver. We better not use malloc for we are in
    4269 * the ELF startup initialisation at this point.
    4370 */
     
    74101                (DWORD)hinst,dwVersion,debugstr_guid(riid),ppDI,punkOuter
    75102        );
    76         if (IsEqualGUID(&IID_IDirectInputA,riid)) {
     103        if (IsEqualGUID(&IID_IDirectInputA,riid) ||
     104            IsEqualGUID(&IID_IDirectInput2A,riid) ||
     105            IsEqualGUID(&IID_IDirectInput7A,riid)) {
    77106          This = (IDirectInputAImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputAImpl));
     107          This->lpVtbl = &ddi7avt;
    78108          This->ref = 1;
    79           ICOM_VTBL(This) = &ddiavt;
    80109          *ppDI = This;
    81          
     110
    82111          return DI_OK;
    83112        }
    84        
    85         if (IsEqualGUID(&IID_IDirectInput7A,riid)) {
     113
     114
     115        if (IsEqualGUID(&IID_IDirectInput8A,riid)) {
    86116          This = (IDirectInputAImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputAImpl));
     117          This->lpVtbl = &ddi8avt;
    87118          This->ref = 1;
    88           ICOM_VTBL(This) = (ICOM_VTABLE(IDirectInputA) *) &ddi7avt;
    89119          *ppDI = This;
    90          
     120
    91121          return DI_OK;
    92122        }
     
    105135        );
    106136        This = (IDirectInputAImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputAImpl));
     137        This->lpVtbl = &ddi7avt;
    107138        This->ref = 1;
    108         ICOM_VTBL(This) = &ddiavt;
    109139        *ppDI=(IDirectInputA*)This;
    110140        return 0;
     141
    111142}
    112143/******************************************************************************
     
    126157        for (i = 0; i < nrof_dinput_devices; i++) {
    127158          if (dinput_devices[i]->enum_device(dwDevType, dwFlags, &devInstance)) {
     159            devInstance.dwSize = sizeof(devInstance);
    128160            if (lpCallback(&devInstance,pvRef) == DIENUM_STOP)
    129161              return 0;
    130162          }
    131163        }
    132        
     164
    133165        return 0;
     166}
     167
     168static HRESULT WINAPI IDirectInputAImpl_QueryInterface(
     169        LPDIRECTINPUT7A iface,REFIID riid,LPVOID *ppobj
     170) {
     171        ICOM_THIS(IDirectInputAImpl,iface);
     172
     173        TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
     174        if (IsEqualGUID(&IID_IUnknown,riid) ||
     175            IsEqualGUID(&IID_IDirectInputA,riid) ||
     176            IsEqualGUID(&IID_IDirectInput2A,riid) ||
     177            IsEqualGUID(&IID_IDirectInput7A,riid)) {
     178                IDirectInputA_AddRef(iface);
     179                *ppobj = This;
     180                return 0;
     181        }
     182        TRACE("Unsupported interface !\n");
     183        return E_FAIL;
    134184}
    135185
     
    157207        HRESULT ret_value = DIERR_DEVICENOTREG;
    158208        int i;
    159        
     209
    160210        TRACE("(this=%p,%s,%p,%p)\n",This,debugstr_guid(rguid),pdev,punk);
    161211
     
    173223}
    174224
    175 static HRESULT WINAPI IDirectInputAImpl_QueryInterface(
    176         LPDIRECTINPUT7A iface,REFIID riid,LPVOID *ppobj
    177 ) {
    178         ICOM_THIS(IDirectInputAImpl,iface);
    179 
    180         TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
    181         if (IsEqualGUID(&IID_IUnknown,riid)) {
    182                 IDirectInputA_AddRef(iface);
    183                 *ppobj = This;
    184                 return 0;
    185         }
    186         if (IsEqualGUID(&IID_IDirectInputA,riid)) {
    187                 IDirectInputA_AddRef(iface);
    188                 *ppobj = This;
    189                 return 0;
    190         }
    191         TRACE("Unsupported interface !\n");
    192         return E_FAIL;
    193 }
    194 
    195225static HRESULT WINAPI IDirectInputAImpl_Initialize(
    196226        LPDIRECTINPUT7A iface,HINSTANCE hinst,DWORD x
     
    202232                                                        REFGUID rguid) {
    203233  ICOM_THIS(IDirectInputAImpl,iface);
    204  
     234
    205235  FIXME("(%p)->(%s): stub\n",This,debugstr_guid(rguid));
    206  
     236
    207237  return DI_OK;
    208238}
     
    213243  ICOM_THIS(IDirectInputAImpl,iface);
    214244  FIXME("(%p)->(%08lx,%08lx): stub\n",This, (DWORD) hwndOwner, dwFlags);
    215  
     245
    216246  return DI_OK;
    217247}
    218248
    219 static HRESULT WINAPI IDirectInput2AImpl_FindDevice(LPDIRECTINPUT2A iface, REFGUID rguid,
     249static HRESULT WINAPI IDirectInput2AImpl_FindDevice(LPDIRECTINPUT7A iface, REFGUID rguid,
    220250                                                    LPCSTR pszName, LPGUID pguidInstance) {
    221251  ICOM_THIS(IDirectInputAImpl,iface);
    222252  FIXME("(%p)->(%s, %s, %p): stub\n", This, debugstr_guid(rguid), pszName, pguidInstance);
    223  
     253
    224254  return DI_OK;
    225255}
     
    231261  HRESULT ret_value = DIERR_DEVICENOTREG;
    232262  int i;
    233        
     263
    234264  TRACE("(%p)->(%s, %s, %p, %p)\n", This, debugstr_guid(rguid), debugstr_guid(riid), pvOut, lpUnknownOuter);
    235265
     
    239269    if ((ret = dinput_devices[i]->create_device(This, rguid, riid, (LPDIRECTINPUTDEVICEA*) pvOut)) == DI_OK)
    240270      return DI_OK;
    241    
     271
    242272    if (ret == DIERR_NOINTERFACE)
    243273      ret_value = DIERR_NOINTERFACE;
    244274  }
    245  
     275
    246276  return ret_value;
    247277}
    248278
     279static HRESULT WINAPI IDirectInput8AImpl_QueryInterface(
     280      LPDIRECTINPUT8A iface,REFIID riid,LPVOID *ppobj
     281) {
     282      ICOM_THIS(IDirectInputAImpl,iface);
     283
     284      TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
     285      if (IsEqualGUID(&IID_IUnknown,riid) ||
     286          IsEqualGUID(&IID_IDirectInput8A,riid)) {
     287              IDirectInputA_AddRef(iface);
     288              *ppobj = This;
     289              return 0;
     290      }
     291      TRACE("Unsupported interface !\n");
     292      return E_FAIL;
     293}
     294
     295static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
     296      LPDIRECTINPUT8A iface, LPCSTR ptszUserName, LPDIACTIONFORMATA lpdiActionFormat,
     297      LPDIENUMDEVICESBYSEMANTICSCBA lpCallback,
     298      LPVOID pvRef, DWORD dwFlags
     299)
     300{
     301      ICOM_THIS(IDirectInputAImpl,iface);
     302
     303      FIXME("(this=%p,%s,%p,%p,%p,%04lx): stub\n", This, ptszUserName, lpdiActionFormat,
     304            lpCallback, pvRef, dwFlags);
     305      return 0;
     306}
     307
     308static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices(
     309      LPDIRECTINPUT8A iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback,
     310      LPDICONFIGUREDEVICESPARAMSA lpdiCDParams, DWORD dwFlags, LPVOID pvRefData
     311)
     312{
     313      ICOM_THIS(IDirectInputAImpl,iface);
     314
     315      FIXME("(this=%p,%p,%p,%04lx,%p): stub\n", This, lpdiCallback, lpdiCDParams,
     316            dwFlags, pvRefData);
     317      return 0;
     318}
     319
    249320#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
    250 # define XCAST(fun)     (typeof(ddiavt.fun))
    251 #else
    252 # define XCAST(fun)     (void*)
    253 #endif
    254 
    255 static ICOM_VTABLE(IDirectInputA) ddiavt =
    256 {
    257         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    258         XCAST(QueryInterface)IDirectInputAImpl_QueryInterface,
    259         XCAST(AddRef)IDirectInputAImpl_AddRef,
    260         XCAST(Release)IDirectInputAImpl_Release,
    261         XCAST(CreateDevice)IDirectInputAImpl_CreateDevice,
    262         XCAST(EnumDevices)IDirectInputAImpl_EnumDevices,
    263         XCAST(GetDeviceStatus)IDirectInputAImpl_GetDeviceStatus,
    264         XCAST(RunControlPanel)IDirectInputAImpl_RunControlPanel,
    265         XCAST(Initialize)IDirectInputAImpl_Initialize
    266 };
    267 #undef XCAST
    268 
    269 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
    270 # define XCAST(fun)     (typeof(ddi7avt.fun))
     321# define XCAST(fun)   (typeof(ddi7avt.fun))
    271322#else
    272323# define XCAST(fun)     (void*)
     
    288339#undef XCAST
    289340
     341#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
     342# define XCAST(fun)     (typeof(ddi8avt.fun))
     343#else
     344# define XCAST(fun)     (void*)
     345#endif
     346
     347static ICOM_VTABLE(IDirectInput8A) ddi8avt = {
     348        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     349        XCAST(QueryInterface)IDirectInput8AImpl_QueryInterface,
     350        XCAST(AddRef)IDirectInputAImpl_AddRef,
     351        XCAST(Release)IDirectInputAImpl_Release,
     352        XCAST(CreateDevice)IDirectInputAImpl_CreateDevice,
     353        XCAST(EnumDevices)IDirectInputAImpl_EnumDevices,
     354        XCAST(GetDeviceStatus)IDirectInputAImpl_GetDeviceStatus,
     355        XCAST(RunControlPanel)IDirectInputAImpl_RunControlPanel,
     356        XCAST(Initialize)IDirectInputAImpl_Initialize,
     357        XCAST(FindDevice)IDirectInput2AImpl_FindDevice,
     358        IDirectInput8AImpl_EnumDevicesBySemantics,
     359        IDirectInput8AImpl_ConfigureDevices
     360};
     361#undef XCAST
     362
    290363/***********************************************************************
    291364 *              DllCanUnloadNow (DINPUT.@)
     
    304377                                        LPVOID *ppv)
    305378{
    306     FIXME("(%p, %p, %p): stub\n", debugstr_guid(rclsid), 
     379    FIXME("(%p, %p, %p): stub\n", debugstr_guid(rclsid),
    307380          debugstr_guid(riid), ppv);
    308381
  • trunk/src/dinput/dinput_private.h

    r8346 r9016  
     1/*
     2 * Copyright 2000 Lionel Ulmer
     3 *
     4 * This library is free software; you can redistribute it and/or
     5 * modify it under the terms of the GNU Lesser General Public
     6 * License as published by the Free Software Foundation; either
     7 * version 2.1 of the License, or (at your option) any later version.
     8 *
     9 * This library is distributed in the hope that it will be useful,
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12 * Lesser General Public License for more details.
     13 *
     14 * You should have received a copy of the GNU Lesser General Public
     15 * License along with this library; if not, write to the Free Software
     16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     17 */
     18
    119#ifndef __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H
    220#define __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H
     
    927struct IDirectInputAImpl
    1028{
    11         ICOM_VFIELD(IDirectInputA);
    12         DWORD                   ref;
     29   LPVOID lpVtbl;
     30   DWORD  ref;
    1331
    14         /* Used to have an unique sequence number for all the events */
    15         DWORD evsequence;
     32   /* Used to have an unique sequence number for all the events */
     33   DWORD evsequence;
    1634};
    1735
     
    1937typedef struct dinput_device {
    2038  INT pref;
    21   BOOL (*enum_device)(DWORD dwDevType, DWORD dwFlags, LPCDIDEVICEINSTANCEA lpddi);
     39  BOOL (*enum_device)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi);
    2240  HRESULT (*create_device)(IDirectInputAImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev);
    2341} dinput_device;
     
    2543extern void dinput_register_device(dinput_device *device) ;
    2644
     45HHOOK keyboard_hook;
     46
     47LRESULT CALLBACK KeyboardCallback( int code, WPARAM wparam, LPARAM lparam );
     48
    2749#endif /* __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H */
  • trunk/src/dinput/keyboard.c

    r8346 r9016  
    33 * Copyright 1998 Marcus Meissner
    44 * Copyright 1998,1999 Lionel Ulmer
     5 * Copyright 2000-2001 TransGaming Technologies Inc.
    56 *
     7 * This library is free software; you can redistribute it and/or
     8 * modify it under the terms of the GNU Lesser General Public
     9 * License as published by the Free Software Foundation; either
     10 * version 2.1 of the License, or (at your option) any later version.
     11 *
     12 * This library is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15 * Lesser General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU Lesser General Public
     18 * License along with this library; if not, write to the Free Software
     19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    620 */
    721
    822#include "config.h"
     23#include "wine/port.h"
     24
    925#include <string.h>
    1026#ifdef HAVE_SYS_ERRNO_H
     
    1935#include "dinput_private.h"
    2036#include "device_private.h"
    21 #include "debugtools.h"
    22 
    23 DEFAULT_DEBUG_CHANNEL(dinput);
    24 
    25 static ICOM_VTABLE(IDirectInputDevice2A) SysKeyboardAvt;
    26 static ICOM_VTABLE(IDirectInputDevice7A) SysKeyboard7Avt;
    27      
     37#include "wine/debug.h"
     38
     39WINE_DEFAULT_DEBUG_CHANNEL(dinput);
     40
     41static ICOM_VTABLE(IDirectInputDevice8A) SysKeyboardAvt;
     42
    2843typedef struct SysKeyboardAImpl SysKeyboardAImpl;
    2944struct SysKeyboardAImpl
    3045{
    31         /* IDirectInputDevice2AImpl */
    32         ICOM_VFIELD(IDirectInputDevice2A);
     46        LPVOID                          lpVtbl;
    3347        DWORD                           ref;
    3448        GUID                            guid;
    3549
    3650        IDirectInputAImpl *dinput;
    37        
     51
     52        HANDLE  hEvent;
    3853        /* SysKeyboardAImpl */
    39         BYTE                            keystate[256];
    4054        int                             acquired;
     55        int                             buffersize;  /* set in 'SetProperty'         */
     56        LPDIDEVICEOBJECTDATA            buffer;      /* buffer for 'GetDeviceData'.
     57                                                        Alloc at 'Acquire', Free at
     58                                                        'Unacquire'                  */
     59        int                             count;       /* number of objects in use in
     60                                                        'buffer'                     */
     61        int                             start;       /* 'buffer' rotates. This is the
     62                                                        first in use (if count > 0)  */
     63        BOOL                            overflow;    /* return DI_BUFFEROVERFLOW in
     64                                                        'GetDeviceData'              */
     65        CRITICAL_SECTION                crit;
    4166};
     67
     68SysKeyboardAImpl *current; /* Today's acquired device
     69FIXME: currently this can be only one.
     70Maybe this should be a linked list or st.
     71I don't know what the rules are for multiple acquired keyboards,
     72but 'DI_LOSTFOCUS' and 'DI_UNACQUIRED' exist for a reason.
     73*/
     74
     75static BYTE DInputKeyState[256]; /* array for 'GetDeviceState' */
     76
     77HHOOK keyboard_hook;
     78
     79LRESULT CALLBACK KeyboardCallback( int code, WPARAM wparam, LPARAM lparam )
     80{
     81  TRACE("(%d,%d,%ld)\n", code, wparam, lparam);
     82
     83  if (code == HC_ACTION)
     84    {
     85      BYTE dik_code;
     86      BOOL down;
     87      DWORD timestamp;
     88
     89      {
     90        KBDLLHOOKSTRUCT *hook = (KBDLLHOOKSTRUCT *)lparam;
     91        dik_code = hook->scanCode;
     92        if (hook->flags & LLKHF_EXTENDED) dik_code |= 0x80;
     93        down = !(hook->flags & LLKHF_UP);
     94        timestamp = hook->time;
     95      }
     96
     97      DInputKeyState[dik_code] = (down ? 0x80 : 0);
     98
     99      if (current != NULL)
     100        {
     101          if (current->hEvent)
     102            SetEvent(current->hEvent);
     103
     104          if (current->buffer != NULL)
     105            {
     106              int n;
     107
     108              EnterCriticalSection(&(current->crit));
     109
     110              n = (current->start + current->count) % current->buffersize;
     111
     112              current->buffer[n].dwOfs = dik_code;
     113              current->buffer[n].dwData = down ? 0x80 : 0;
     114              current->buffer[n].dwTimeStamp = timestamp;
     115              current->buffer[n].dwSequence = current->dinput->evsequence++;
     116
     117              TRACE("Adding event at offset %d : %ld - %ld - %ld - %ld\n", n,
     118                    current->buffer[n].dwOfs, current->buffer[n].dwData, current->buffer[n].dwTimeStamp, current->buffer[n].dwSequence);
     119
     120              if (current->count == current->buffersize)
     121                {
     122                  current->start++;
     123                  current->overflow = TRUE;
     124                }
     125              else
     126                current->count++;
     127
     128              LeaveCriticalSection(&(current->crit));
     129            }
     130        }
     131    }
     132
     133  return CallNextHookEx(keyboard_hook, code, wparam, lparam);
     134}
    42135
    43136static GUID DInput_Wine_Keyboard_GUID = { /* 0ab8648a-7735-11d2-8c73-71df54a96441 */
     
    48141};
    49142
    50 static BOOL keyboarddev_enum_device(DWORD dwDevType, DWORD dwFlags, LPCDIDEVICEINSTANCEA lpddi)
     143static BOOL keyboarddev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi)
    51144{
    52145  if ((dwDevType == 0) || (dwDevType == DIDEVTYPE_KEYBOARD)) {
    53146    TRACE("Enumerating the Keyboard device\n");
    54    
     147
    55148    lpddi->guidInstance = GUID_SysKeyboard;/* DInput's GUID */
    56149    lpddi->guidProduct = DInput_Wine_Keyboard_GUID; /* Vendor's GUID */
     
    58151    strcpy(lpddi->tszInstanceName, "Keyboard");
    59152    strcpy(lpddi->tszProductName, "Wine Keyboard");
    60    
     153
    61154    return TRUE;
    62155  }
     
    65158}
    66159
    67 static SysKeyboardAImpl *alloc_device(REFGUID rguid, ICOM_VTABLE(IDirectInputDevice2A) *kvt, IDirectInputAImpl *dinput)
     160static SysKeyboardAImpl *alloc_device(REFGUID rguid, LPVOID kvt, IDirectInputAImpl *dinput)
    68161{
    69162    SysKeyboardAImpl* newDevice;
    70163    newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysKeyboardAImpl));
     164    newDevice->lpVtbl = kvt;
    71165    newDevice->ref = 1;
    72     ICOM_VTBL(newDevice) = kvt;
    73166    memcpy(&(newDevice->guid),rguid,sizeof(*rguid));
    74     memset(newDevice->keystate,0,256);
    75167    newDevice->dinput = dinput;
    76168
     
    83175  if ((IsEqualGUID(&GUID_SysKeyboard,rguid)) ||          /* Generic Keyboard */
    84176      (IsEqualGUID(&DInput_Wine_Keyboard_GUID,rguid))) { /* Wine Keyboard */
    85     if ((riid == NULL) || (IsEqualGUID(&IID_IDirectInputDevice2A,riid)) || (IsEqualGUID(&IID_IDirectInputDevice2A,riid))) {
     177    if ((riid == NULL) ||
     178        IsEqualGUID(&IID_IDirectInputDeviceA,riid) ||
     179        IsEqualGUID(&IID_IDirectInputDevice2A,riid) ||
     180        IsEqualGUID(&IID_IDirectInputDevice7A,riid) ||
     181        IsEqualGUID(&IID_IDirectInputDevice8A,riid)) {
    86182      *pdev=(IDirectInputDeviceA*) alloc_device(rguid, &SysKeyboardAvt, dinput);
    87    
    88183      TRACE("Creating a Keyboard device (%p)\n", *pdev);
    89       return DI_OK;
    90     } else if (IsEqualGUID(&IID_IDirectInputDevice7A,riid)) {
    91       *pdev=(IDirectInputDeviceA*) alloc_device(rguid, (ICOM_VTABLE(IDirectInputDevice2A) *) &SysKeyboard7Avt, dinput);
    92    
    93       TRACE("Creating a Keyboard DInput7A device (%p)\n", *pdev);
    94184      return DI_OK;
    95185    } else
     
    109199
    110200static HRESULT WINAPI SysKeyboardAImpl_SetProperty(
    111         LPDIRECTINPUTDEVICE2A iface,REFGUID rguid,LPCDIPROPHEADER ph
     201        LPDIRECTINPUTDEVICE8A iface,REFGUID rguid,LPCDIPROPHEADER ph
    112202)
    113203{
     
    123213
    124214                        TRACE("(buffersize=%ld)\n",pd->dwData);
     215
     216                        if (This->acquired)
     217                           return DIERR_INVALIDPARAM;
     218
     219                        This->buffersize = pd->dwData;
     220
    125221                        break;
    126222                }
     
    134230
    135231static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
    136         LPDIRECTINPUTDEVICE2A iface,DWORD len,LPVOID ptr
     232        LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr
    137233)
    138234{
    139     DWORD i;
    140 
    141     memset( ptr, 0, len );
     235    /* Note: device does not need to be acquired */
    142236    if (len != 256)
    143     {
    144         WARN("whoops, got len %ld?\n", len);
    145         return DI_OK;
    146     }
    147     for (i = 0; i < 0x80; i++)
    148     {
    149         WORD vkey = MapVirtualKeyA( i, 1 );
    150         if (vkey && (GetAsyncKeyState( vkey ) & 0x8000))
    151         {
    152             ((LPBYTE)ptr)[i] = 0x80;
    153             ((LPBYTE)ptr)[i | 0x80] = 0x80;
    154         }
    155     }
     237      return DIERR_INVALIDPARAM;
     238
     239    memcpy(ptr, DInputKeyState, 256);
    156240    return DI_OK;
    157241}
    158242
    159243static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData(
    160         LPDIRECTINPUTDEVICE2A iface,DWORD dodsize,LPDIDEVICEOBJECTDATA dod,
     244        LPDIRECTINPUTDEVICE8A iface,DWORD dodsize,LPDIDEVICEOBJECTDATA dod,
    161245        LPDWORD entries,DWORD flags
    162246)
    163247{
    164248        ICOM_THIS(SysKeyboardAImpl,iface);
    165         int i, n;
     249        int ret = DI_OK, i = 0;
    166250
    167251        TRACE("(this=%p,%ld,%p,%p(%ld)),0x%08lx)\n",
    168252              This,dodsize,dod,entries,entries?*entries:0,flags);
    169253
    170 
    171         for (i = n = 0; (i < 0x80) && (n < *entries); i++)
    172         {
    173             WORD state, vkey = MapVirtualKeyA( i, 1 );
    174             if (!vkey) continue;
    175             state = (GetAsyncKeyState( vkey ) >> 8) & 0x80;
    176             if (state != This->keystate[vkey])
    177             {
    178                 if (dod)
    179                 {
    180                     /* add an entry */
    181                     dod[n].dwOfs       = i; /* scancode */
    182                     dod[n].dwData      = state;
    183                     dod[n].dwTimeStamp = GetCurrentTime(); /* umm */
    184                     dod[n].dwSequence  = This->dinput->evsequence++;
    185                     n++;
    186                 }
    187                 if (!(flags & DIGDD_PEEK)) This->keystate[vkey] = state;
    188             }
    189         }
    190         if (n) TRACE_(dinput)("%d entries\n",n);
    191         *entries = n;
    192         return DI_OK;
    193 }
    194 
    195 static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface)
     254        if (This->acquired == 0)
     255          return DIERR_NOTACQUIRED;
     256
     257        if (This->buffer == NULL)
     258          return DIERR_NOTBUFFERED;
     259
     260        if (dodsize < sizeof(*dod))
     261          return DIERR_INVALIDPARAM;
     262
     263        EnterCriticalSection(&(This->crit));
     264
     265        /* Copy item at a time for the case dodsize > sizeof(buffer[n]) */
     266        while ((i < *entries || *entries == INFINITE) && i < This->count)
     267          {
     268            if (dod != NULL)
     269              {
     270                int n = (This->start + i) % This->buffersize;
     271                LPDIDEVICEOBJECTDATA pd
     272                   = (LPDIDEVICEOBJECTDATA)((BYTE *)dod + dodsize * i);
     273                pd->dwOfs       = This->buffer[n].dwOfs;
     274                pd->dwData      = This->buffer[n].dwData;
     275                pd->dwTimeStamp = This->buffer[n].dwTimeStamp;
     276                pd->dwSequence  = This->buffer[n].dwSequence;
     277              }
     278            i++;
     279          }
     280
     281        *entries = i;
     282
     283        if (This->overflow)
     284          ret = DI_BUFFEROVERFLOW;
     285
     286        if (!(flags & DIGDD_PEEK))
     287          {
     288            /* Empty buffer */
     289            This->count -= i;
     290            This->start = (This->start + i) % This->buffersize;
     291            This->overflow = FALSE;
     292          }
     293
     294        LeaveCriticalSection(&(This->crit));
     295
     296        TRACE("Returning %ld events queued\n", *entries);
     297
     298        return ret;
     299}
     300
     301static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface);
     302
     303static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
    196304{
    197305        ICOM_THIS(SysKeyboardAImpl,iface);
    198        
     306
    199307        TRACE("(this=%p)\n",This);
    200        
    201         if (This->acquired == 0) {
    202           This->acquired = 1;
    203         }
    204        
     308
     309        if (This->acquired)
     310          return S_FALSE;
     311
     312        This->acquired = 1;
     313
     314        if (current != NULL)
     315          {
     316            FIXME("Not more than one keyboard can be acquired at the same time.\n");
     317            SysKeyboardAImpl_Unacquire(iface);
     318          }
     319
     320        current = This;
     321
     322        if (This->buffersize > 0)
     323          {
     324            This->buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
     325                                     This->buffersize * sizeof(*(This->buffer)));
     326            This->start = 0;
     327            This->count = 0;
     328            This->overflow = FALSE;
     329            InitializeCriticalSection(&(This->crit));
     330          }
     331        else
     332          This->buffer = NULL;
     333
    205334        return DI_OK;
    206335}
    207336
    208 static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE2A iface)
     337static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
    209338{
    210339        ICOM_THIS(SysKeyboardAImpl,iface);
    211340        TRACE("(this=%p)\n",This);
    212341
    213         if (This->acquired == 1) {
    214           This->acquired = 0;
    215         } else {
    216           ERR("Unacquiring a not-acquired device !!!\n");
    217         }
     342        if (This->acquired == 0)
     343          return DI_NOEFFECT;
     344
     345        if (current == This)
     346          current = NULL;
     347        else
     348          ERR("this != current\n");
     349
     350        This->acquired = 0;
     351
     352        if (This->buffersize >= 0)
     353          {
     354            HeapFree(GetProcessHeap(), 0, This->buffer);
     355            This->buffer = NULL;
     356            DeleteCriticalSection(&(This->crit));
     357          }
    218358
    219359        return DI_OK;
     360}
     361
     362static HRESULT WINAPI SysKeyboardAImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface,
     363                                                            HANDLE hnd) {
     364  ICOM_THIS(SysKeyboardAImpl,iface);
     365
     366  TRACE("(this=%p,0x%08lx)\n",This,(DWORD)hnd);
     367
     368  This->hEvent = hnd;
     369  return DI_OK;
    220370}
    221371
     
    224374  */
    225375static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities(
    226         LPDIRECTINPUTDEVICE2A iface,
     376        LPDIRECTINPUTDEVICE8A iface,
    227377        LPDIDEVCAPS lpDIDevCaps)
    228378{
     
    246396    FIXME("DirectX 3.0 not supported....\n");
    247397  }
    248  
     398
    249399  return DI_OK;
    250400}
    251401
    252 static ICOM_VTABLE(IDirectInputDevice2A) SysKeyboardAvt =
     402static ICOM_VTABLE(IDirectInputDevice8A) SysKeyboardAvt =
    253403{
    254404        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     
    265415        SysKeyboardAImpl_GetDeviceData,
    266416        IDirectInputDevice2AImpl_SetDataFormat,
    267         IDirectInputDevice2AImpl_SetEventNotification,
     417        SysKeyboardAImpl_SetEventNotification,
    268418        IDirectInputDevice2AImpl_SetCooperativeLevel,
    269419        IDirectInputDevice2AImpl_GetObjectInfo,
     
    279429        IDirectInputDevice2AImpl_Escape,
    280430        IDirectInputDevice2AImpl_Poll,
    281         IDirectInputDevice2AImpl_SendDeviceData
     431        IDirectInputDevice2AImpl_SendDeviceData,
     432        IDirectInputDevice7AImpl_EnumEffectsInFile,
     433        IDirectInputDevice7AImpl_WriteEffectToFile,
     434        IDirectInputDevice8AImpl_BuildActionMap,
     435        IDirectInputDevice8AImpl_SetActionMap,
     436        IDirectInputDevice8AImpl_GetImageInfo
    282437};
    283 
    284 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
    285 # define XCAST(fun)     (typeof(SysKeyboard7Avt.fun))
    286 #else
    287 # define XCAST(fun)     (void*)
    288 #endif
    289 
    290 static ICOM_VTABLE(IDirectInputDevice7A) SysKeyboard7Avt =
    291 {
    292         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    293         XCAST(QueryInterface)IDirectInputDevice2AImpl_QueryInterface,
    294         XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
    295         XCAST(Release)IDirectInputDevice2AImpl_Release,
    296         XCAST(GetCapabilities)SysKeyboardAImpl_GetCapabilities,
    297         XCAST(EnumObjects)IDirectInputDevice2AImpl_EnumObjects,
    298         XCAST(GetProperty)IDirectInputDevice2AImpl_GetProperty,
    299         XCAST(SetProperty)SysKeyboardAImpl_SetProperty,
    300         XCAST(Acquire)SysKeyboardAImpl_Acquire,
    301         XCAST(Unacquire)SysKeyboardAImpl_Unacquire,
    302         XCAST(GetDeviceState)SysKeyboardAImpl_GetDeviceState,
    303         XCAST(GetDeviceData)SysKeyboardAImpl_GetDeviceData,
    304         XCAST(SetDataFormat)IDirectInputDevice2AImpl_SetDataFormat,
    305         XCAST(SetEventNotification)IDirectInputDevice2AImpl_SetEventNotification,
    306         XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel,
    307         XCAST(GetObjectInfo)IDirectInputDevice2AImpl_GetObjectInfo,
    308         XCAST(GetDeviceInfo)IDirectInputDevice2AImpl_GetDeviceInfo,
    309         XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel,
    310         XCAST(Initialize)IDirectInputDevice2AImpl_Initialize,
    311         XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect,
    312         XCAST(EnumEffects)IDirectInputDevice2AImpl_EnumEffects,
    313         XCAST(GetEffectInfo)IDirectInputDevice2AImpl_GetEffectInfo,
    314         XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState,
    315         XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand,
    316         XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
    317         XCAST(Escape)IDirectInputDevice2AImpl_Escape,
    318         XCAST(Poll)IDirectInputDevice2AImpl_Poll,
    319         XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData,
    320         IDirectInputDevice7AImpl_EnumEffectsInFile,
    321         IDirectInputDevice7AImpl_WriteEffectToFile
    322 };
    323 
    324 #undef XCAST
  • trunk/src/dinput/mouse.c

    r8532 r9016  
    33 * Copyright 1998 Marcus Meissner
    44 * Copyright 1998,1999 Lionel Ulmer
     5 * Copyright 2000-2001 TransGaming Technologies Inc.
    56 *
     7 * This library is free software; you can redistribute it and/or
     8 * modify it under the terms of the GNU Lesser General Public
     9 * License as published by the Free Software Foundation; either
     10 * version 2.1 of the License, or (at your option) any later version.
     11 *
     12 * This library is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15 * Lesser General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU Lesser General Public
     18 * License along with this library; if not, write to the Free Software
     19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    620 */
    721
    822#include "config.h"
     23#include "wine/port.h"
     24
    925#include <string.h>
    1026#ifdef HAVE_SYS_ERRNO_H
     
    2036#include "dinput_private.h"
    2137#include "device_private.h"
    22 #include "debugtools.h"
     38#include "wine/debug.h"
    2339
    2440#define MOUSE_HACK
    2541
    26 DEFAULT_DEBUG_CHANNEL(dinput);
     42WINE_DEFAULT_DEBUG_CHANNEL(dinput);
    2743
    2844/* Wine mouse driver object instances */
    2945#define WINE_MOUSE_X_AXIS_INSTANCE 0x0001
    3046#define WINE_MOUSE_Y_AXIS_INSTANCE 0x0002
    31 #define WINE_MOUSE_L_BUTTON_INSTANCE 0x0004
    32 #define WINE_MOUSE_R_BUTTON_INSTANCE 0x0008
    33 #define WINE_MOUSE_M_BUTTON_INSTANCE 0x0010
     47#define WINE_MOUSE_Z_AXIS_INSTANCE 0x0004
     48#define WINE_MOUSE_L_BUTTON_INSTANCE 0x0008
     49#define WINE_MOUSE_R_BUTTON_INSTANCE 0x0010
     50#define WINE_MOUSE_M_BUTTON_INSTANCE 0x0020
    3451
    3552/* ------------------------------- */
     
    4057#define WINE_MOUSE_X_POSITION 0
    4158#define WINE_MOUSE_Y_POSITION 1
    42 #define WINE_MOUSE_L_POSITION 2
    43 #define WINE_MOUSE_R_POSITION 3
    44 #define WINE_MOUSE_M_POSITION 4
     59#define WINE_MOUSE_Z_POSITION 2
     60#define WINE_MOUSE_L_POSITION 3
     61#define WINE_MOUSE_R_POSITION 4
     62#define WINE_MOUSE_M_POSITION 5
    4563
    4664typedef struct {
    4765  LONG lX;
    4866  LONG lY;
     67  LONG lZ;
    4968  BYTE rgbButtons[4];
    5069} Wine_InternalMouseData;
    5170
    52 #define WINE_INTERNALMOUSE_NUM_OBJS 5
     71#define WINE_INTERNALMOUSE_NUM_OBJS 6
    5372
    5473static DIOBJECTDATAFORMAT Wine_InternalMouseObjectFormat[WINE_INTERNALMOUSE_NUM_OBJS] = {
     
    5776  { &GUID_YAxis,   FIELD_OFFSET(Wine_InternalMouseData, lY),
    5877      DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS, 0 },
     78  { &GUID_ZAxis,   FIELD_OFFSET(Wine_InternalMouseData, lZ),
     79      DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS, 0 },
    5980  { &GUID_Button, (FIELD_OFFSET(Wine_InternalMouseData, rgbButtons)) + 0,
    6081      DIDFT_MAKEINSTANCE(WINE_MOUSE_L_BUTTON_INSTANCE) | DIDFT_PSHBUTTON, 0 },
     
    7495};
    7596
    76 static ICOM_VTABLE(IDirectInputDevice2A) SysMouseAvt;
    77 static ICOM_VTABLE(IDirectInputDevice7A) SysMouse7Avt;
     97static ICOM_VTABLE(IDirectInputDevice8A) SysMouseAvt;
    7898typedef struct SysMouseAImpl SysMouseAImpl;
    7999
     
    86106struct SysMouseAImpl
    87107{
    88         /* IDirectInputDevice2AImpl */
    89         ICOM_VFIELD(IDirectInputDevice2A);
     108        LPVOID                          lpVtbl;
    90109        DWORD                           ref;
    91110        GUID                            guid;
    92111
    93112        IDirectInputAImpl *dinput;
    94        
     113
    95114        /* The current data format and the conversion between internal
    96115           and external data formats */
    97116        LPDIDATAFORMAT                  df;
    98117        DataFormat                     *wine_df;
    99         int                             offset_array[5];
    100        
     118        int                             offset_array[WINE_INTERNALMOUSE_NUM_OBJS];
     119
    101120        /* SysMouseAImpl */
    102121        BYTE                            absolute;
     
    133152
    134153/* FIXME: This is ugly and not thread safe :/ */
    135 static IDirectInputDevice2A* current_lock = NULL;
    136 
    137 
    138 static BOOL mousedev_enum_device(DWORD dwDevType, DWORD dwFlags, LPCDIDEVICEINSTANCEA lpddi)
     154static IDirectInputDevice8A* current_lock = NULL;
     155
     156
     157static BOOL mousedev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi)
    139158{
    140159  if ((dwDevType == 0) || (dwDevType == DIDEVTYPE_MOUSE)) {
     
    154173}
    155174
    156 static SysMouseAImpl *alloc_device(REFGUID rguid, ICOM_VTABLE(IDirectInputDevice2A) *mvt, IDirectInputAImpl *dinput)
    157 {
    158     int offset_array[5] = {
     175static SysMouseAImpl *alloc_device(REFGUID rguid, LPVOID mvt, IDirectInputAImpl *dinput)
     176{
     177    int offset_array[WINE_INTERNALMOUSE_NUM_OBJS] = {
    159178      FIELD_OFFSET(Wine_InternalMouseData, lX),
    160179      FIELD_OFFSET(Wine_InternalMouseData, lY),
     180      FIELD_OFFSET(Wine_InternalMouseData, lZ),
    161181      FIELD_OFFSET(Wine_InternalMouseData, rgbButtons) + 0,
    162182      FIELD_OFFSET(Wine_InternalMouseData, rgbButtons) + 1,
     
    166186    newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysMouseAImpl));
    167187    newDevice->ref = 1;
    168     ICOM_VTBL(newDevice) = mvt;
     188    newDevice->lpVtbl = mvt;
    169189    InitializeCriticalSection(&(newDevice->crit));
    170190    memcpy(&(newDevice->guid),rguid,sizeof(*rguid));
    171    
     191
    172192    /* Per default, Wine uses its internal data format */
    173193    newDevice->df = &Wine_InternalMouseFormat;
    174     memcpy(newDevice->offset_array, offset_array, 5 * sizeof(int));
     194    memcpy(newDevice->offset_array, offset_array, WINE_INTERNALMOUSE_NUM_OBJS * sizeof(int));
    175195    newDevice->wine_df = (DataFormat *) HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat));
    176196    newDevice->wine_df->size = 0;
     
    186206  if ((IsEqualGUID(&GUID_SysMouse,rguid)) ||             /* Generic Mouse */
    187207      (IsEqualGUID(&DInput_Wine_Mouse_GUID,rguid))) { /* Wine Mouse */
    188     if ((riid == NULL) || (IsEqualGUID(&IID_IDirectInputDevice2A,riid)) || (IsEqualGUID(&IID_IDirectInputDevice2A,riid))) {
     208    if ((riid == NULL) ||
     209        IsEqualGUID(&IID_IDirectInputDeviceA,riid) ||
     210        IsEqualGUID(&IID_IDirectInputDevice2A,riid) ||
     211        IsEqualGUID(&IID_IDirectInputDevice7A,riid) ||
     212        IsEqualGUID(&IID_IDirectInputDevice8A,riid)) {
    189213      *pdev=(IDirectInputDeviceA*) alloc_device(rguid, &SysMouseAvt, dinput);
    190    
    191214      TRACE("Creating a Mouse device (%p)\n", *pdev);
    192       return DI_OK;
    193     }else if (IsEqualGUID(&IID_IDirectInputDevice7A,riid)) {
    194       *pdev=(IDirectInputDeviceA*) alloc_device(rguid, (ICOM_VTABLE(IDirectInputDevice2A) *) &SysMouse7Avt, dinput);
    195    
    196       TRACE("Creating a Mouse DInput7A device (%p)\n", *pdev);
    197215      return DI_OK;
    198216    } else
     
    218236  *     Release : release the mouse buffer.
    219237  */
    220 static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE2A iface)
     238static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
    221239{
    222240        ICOM_THIS(SysMouseAImpl,iface);
     
    234252          HeapFree(GetProcessHeap(),0,This->data_queue);
    235253
    236         if (This->hook) UnhookWindowsHookEx( This->hook );
     254        if (This->hook) {
     255          UnhookWindowsHookEx( This->hook );
     256          if (This->dwCoopLevel & DISCL_EXCLUSIVE)
     257            ShowCursor(TRUE); /* show cursor */
     258        }
    237259        DeleteCriticalSection(&(This->crit));
    238260
     
    242264          HeapFree(GetProcessHeap(), 0, This->df);
    243265        }
    244        
     266
    245267        HeapFree(GetProcessHeap(),0,This);
    246268        return 0;
     
    253275  */
    254276static HRESULT WINAPI SysMouseAImpl_SetCooperativeLevel(
    255         LPDIRECTINPUTDEVICE2A iface,HWND hwnd,DWORD dwflags
     277        LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags
    256278)
    257279{
     
    268290  This->win = hwnd;
    269291  This->dwCoopLevel = dwflags;
    270  
     292
    271293  return 0;
    272294}
     
    281303  */
    282304static HRESULT WINAPI SysMouseAImpl_SetDataFormat(
    283         LPDIRECTINPUTDEVICE2A iface,LPCDIDATAFORMAT df
     305        LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df
    284306)
    285307{
    286308  ICOM_THIS(SysMouseAImpl,iface);
    287309  int i;
    288  
     310
    289311  TRACE("(this=%p,%p)\n",This,df);
    290312
     
    319341  /* Prepare all the data-conversion filters */
    320342  This->wine_df = create_DataFormat(&(Wine_InternalMouseFormat), df, This->offset_array);
    321  
     343
    322344  return 0;
    323345}
    324  
     346
    325347/* low-level mouse hook */
    326348#ifdef __WIN32OS2__
     
    335357    SysMouseAImpl* This = (SysMouseAImpl*) current_lock;
    336358#endif
    337 
    338 //testestest
     359    DWORD dwCoop;
     360    static long last_event = 0;
     361    int wdata;
     362
     363#ifdef __WIN32OS2__
    339364    dprintf(("dinput_mouse_hook %d %x %x", code, wparam, lparam));
     365#endif
    340366
    341367    if (code != HC_ACTION) return CallNextHookEx( This->hook, code, wparam, lparam );
    342368
    343369    EnterCriticalSection(&(This->crit));
     370    dwCoop = This->dwCoopLevel;
     371
     372#ifndef __WIN32OS2__
     373    /* Only allow mouse events every 10 ms.
     374     * This is to allow the cursor to start acceleration before
     375     * the warps happen. But if it involves a mouse button event we
     376     * allow it since we dont want to loose the clicks.
     377     */
     378    if (((GetCurrentTime() - last_event) < 10)
     379        && wparam == WM_MOUSEMOVE)
     380      goto end;
     381    else last_event = GetCurrentTime();
     382#endif
     383
    344384    /* Mouse moved -> send event if asked */
    345385    if (This->hEvent)
     
    350390      if(hook->flags != LLMHF_INJECTED)
    351391#endif
    352       if(hook->dwExtraInfo != 666)
    353392        if (This->absolute) {
    354393          if (hook->pt.x != This->prevX)
     
    364403            goto end;
    365404          }
    366                  
     405
    367406          /* Relative mouse input with absolute mouse event : the real fun starts here... */
    368407          if ((This->need_warp == WARP_NEEDED) ||
     
    379418              This->need_warp = WARP_NEEDED;
    380419            }
    381            
     420
    382421            if (hook->pt.y != This->mapped_center.y) {
    383422              GEN_EVENT(This->offset_array[WINE_MOUSE_Y_POSITION], hook->pt.y - This->mapped_center.y, hook->time, (This->dinput->evsequence)++);
     
    389428        This->prevX = hook->pt.x;
    390429        This->prevY = hook->pt.y;
    391        
     430
    392431        if (This->absolute) {
    393432          This->m_state.lX = hook->pt.x;
     
    434473        This->m_state.rgbButtons[2] = 0x00;
    435474        break;
     475    case WM_MOUSEWHEEL:
     476        wdata = (short)HIWORD(hook->mouseData);
     477        GEN_EVENT(This->offset_array[WINE_MOUSE_Z_POSITION], wdata,
     478                  hook->time, This->dinput->evsequence++);
     479        This->m_state.lZ += wdata;
     480        break;
    436481    }
    437482
     
    441486
    442487end:
    443   if (This->dwCoopLevel & DISCL_NONEXCLUSIVE)
     488  LeaveCriticalSection(&(This->crit));
     489
     490  if (dwCoop & DISCL_NONEXCLUSIVE)
    444491  { /* pass the events down to previous handlers (e.g. win32 input) */
    445492      ret = CallNextHookEx( This->hook, code, wparam, lparam );
    446493  }
    447494  else ret = 1;  /* ignore message */
    448   LeaveCriticalSection(&(This->crit));
    449495  return ret;
    450496}
    451497
    452498
     499static void dinput_window_check(SysMouseAImpl* This)
     500{
     501  RECT rect;
     502  DWORD centerX, centerY;
     503
     504  /* make sure the window hasn't moved */
     505  GetWindowRect(This->win, &rect);
     506  centerX = (rect.right  - rect.left) / 2;
     507  centerY = (rect.bottom - rect.top ) / 2;
     508  if (This->win_centerX != centerX || This->win_centerY != centerY) {
     509    This->win_centerX = centerX;
     510    This->win_centerY = centerY;
     511  }
     512  This->mapped_center.x = This->win_centerX;
     513  This->mapped_center.y = This->win_centerY;
     514  MapWindowPoints(This->win, HWND_DESKTOP, &This->mapped_center, 1);
     515}
     516
     517
    453518/******************************************************************************
    454519  *     Acquire : gets exclusive control of the mouse
    455520  */
    456 static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface)
     521static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
    457522{
    458523  ICOM_THIS(SysMouseAImpl,iface);
     
    464529  TRACE("(this=%p)\n",This);
    465530#endif
     531
    466532  if (This->acquired == 0) {
    467533    POINT point;
    468534
    469535    /* Store (in a global variable) the current lock */
    470     current_lock = (IDirectInputDevice2A*)This;
     536    current_lock = (IDirectInputDevice8A*)This;
    471537
    472538    /* Init the mouse state */
     
    481547      This->m_state.lY = 0;
    482548    }
     549    This->m_state.lZ = 0;
    483550    This->m_state.rgbButtons[0] = (GetKeyState(VK_LBUTTON) ? 0xFF : 0x00);
    484551    This->m_state.rgbButtons[1] = (GetKeyState(VK_MBUTTON) ? 0xFF : 0x00);
     
    486553
    487554    /* Install our mouse hook */
     555    if (This->dwCoopLevel & DISCL_EXCLUSIVE)
     556      ShowCursor(FALSE); /* hide cursor */
     557
    488558#ifdef __WIN32OS2__
    489559    /* push ebp */
     
    524594      This->mapped_center.y = This->win_centerY;
    525595      MapWindowPoints(This->win, HWND_DESKTOP, &This->mapped_center, 1);
    526       TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y); 
     596      TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y);
    527597      SetCursorPos( This->mapped_center.x, This->mapped_center.y );
    528598#ifdef MOUSE_HACK
     
    533603    }
    534604#endif
     605
    535606    This->acquired = 1;
    536   }
    537   return DI_OK;
     607    return DI_OK;
     608  }
     609  return S_FALSE;
    538610}
    539611
     
    541613  *     Unacquire : frees the mouse
    542614  */
    543 static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE2A iface)
     615static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
    544616{
    545617    ICOM_THIS(SysMouseAImpl,iface);
     
    550622    TRACE("(this=%p)\n",This);
    551623#endif
    552 
    553624    if (This->acquired)
    554625    {
    555626        /* Reinstall previous mouse event handler */
    556         if (This->hook) UnhookWindowsHookEx( This->hook );
    557         This->hook = 0;
     627        if (This->hook) {
     628          UnhookWindowsHookEx( This->hook );
     629          This->hook = 0;
     630          if (This->dwCoopLevel & DISCL_EXCLUSIVE)
     631            ShowCursor(TRUE); /* show cursor */
     632        }
    558633
    559634        /* No more locks */
     
    565640    else
    566641        ERR("Unacquiring a not-acquired device !!!\n");
    567  
     642
    568643    return DI_OK;
    569644}
     
    576651  */
    577652static HRESULT WINAPI SysMouseAImpl_GetDeviceState(
    578         LPDIRECTINPUTDEVICE2A iface,DWORD len,LPVOID ptr
     653        LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr
    579654) {
    580655  ICOM_THIS(SysMouseAImpl,iface);
    581  
     656
     657#ifdef __WIN32OS2__
     658  /* mouse state may have changed since last hook call; update it first */
     659  POINT point;
     660  GetCursorPos(&point);
     661
     662  if(point.x != This->prevX || point.y != This->prevY) {
     663      MSLLHOOKSTRUCT hook;
     664
     665      //Note: this is not entirely correct (should use HOOK_CallHooksW)
     666      hook.pt.x        = point.x;
     667      hook.pt.y        = point.y;
     668      hook.mouseData   = 0;
     669      hook.flags       = 0;
     670      hook.time        = GetCurrentTime();
     671      hook.dwExtraInfo = 0;
     672
     673      dinput_mouse_hook(This, HC_ACTION, WM_MOUSEMOVE, (LPARAM)&hook );
     674  }
     675#endif
     676
    582677  EnterCriticalSection(&(This->crit));
    583678  TRACE("(this=%p,0x%08lx,%p): \n",This,len,ptr);
    584  
     679
    585680  /* Copy the current mouse state */
    586681  fill_DataFormat(ptr, &(This->m_state), This->wine_df);
    587  
     682
    588683  /* Initialize the buffer when in relative mode */
    589684  if (This->absolute == 0) {
    590685    This->m_state.lX = 0;
    591686    This->m_state.lY = 0;
     687    This->m_state.lZ = 0;
    592688  }
    593689
     
    596692  /* Check if we need to do a mouse warping */
    597693  if (This->need_warp == WARP_NEEDED) {
    598     This->mapped_center.x = This->win_centerX;
    599     This->mapped_center.y = This->win_centerY;
    600     MapWindowPoints(This->win, HWND_DESKTOP, &This->mapped_center, 1);
    601     TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y);
     694    dinput_window_check(This);
     695    TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y);
    602696    SetCursorPos( This->mapped_center.x, This->mapped_center.y );
    603697
     
    609703  }
    610704#endif
    611 
    612705  LeaveCriticalSection(&(This->crit));
    613  
     706
    614707  TRACE("(X: %ld - Y: %ld   L: %02x M: %02x R: %02x)\n",
    615708        This->m_state.lX, This->m_state.lY,
    616709        This->m_state.rgbButtons[0], This->m_state.rgbButtons[2], This->m_state.rgbButtons[1]);
    617  
     710
    618711  return 0;
    619712}
     
    622715  *     GetDeviceState : gets buffered input data.
    623716  */
    624 static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE2A iface,
     717static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface,
    625718                                              DWORD dodsize,
    626719                                              LPDIDEVICEOBJECTDATA dod,
     
    630723  ICOM_THIS(SysMouseAImpl,iface);
    631724  DWORD len, nqtail;
    632  
     725
    633726  EnterCriticalSection(&(This->crit));
    634727  TRACE("(%p)->(dods=%ld,entries=%ld,fl=0x%08lx)\n",This,dodsize,*entries,flags);
     
    639732
    640733  if (dod == NULL) {
     734    if (len)
     735        TRACE("Application discarding %ld event(s).\n", len);
     736
    641737    *entries = len;
    642738    nqtail = This->queue_tail + len;
    643739    while (nqtail >= This->queue_len) nqtail -= This->queue_len;
    644740  } else {
    645     if (dodsize != sizeof(DIDEVICEOBJECTDATA)) {
     741    if (dodsize < sizeof(DIDEVICEOBJECTDATA)) {
    646742      ERR("Wrong structure size !\n");
    647743      LeaveCriticalSection(&(This->crit));
     
    650746
    651747    if (len)
    652         TRACE("Application retrieving %ld event(s).\n", len); 
     748        TRACE("Application retrieving %ld event(s).\n", len);
    653749
    654750    *entries = 0;
     
    676772  /* Check if we need to do a mouse warping */
    677773  if (This->need_warp == WARP_NEEDED) {
    678     This->mapped_center.x = This->win_centerX;
    679     This->mapped_center.y = This->win_centerY;
    680     MapWindowPoints(This->win, HWND_DESKTOP, &This->mapped_center, 1);
    681     TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y);
     774    dinput_window_check(This);
     775    TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y);
    682776    SetCursorPos( This->mapped_center.x, This->mapped_center.y );
    683777
     
    695789  *     SetProperty : change input device properties
    696790  */
    697 static HRESULT WINAPI SysMouseAImpl_SetProperty(LPDIRECTINPUTDEVICE2A iface,
     791static HRESULT WINAPI SysMouseAImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface,
    698792                                            REFGUID rguid,
    699793                                            LPCDIPROPHEADER ph)
     
    702796
    703797  TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
    704  
     798
    705799  if (!HIWORD(rguid)) {
    706800    switch ((DWORD)rguid) {
    707801    case (DWORD) DIPROP_BUFFERSIZE: {
    708802      LPCDIPROPDWORD    pd = (LPCDIPROPDWORD)ph;
    709      
     803
    710804      TRACE("buffersize = %ld\n",pd->dwData);
    711805
     
    728822    }
    729823  }
    730  
     824
    731825  return 0;
    732826}
     
    735829  *     GetProperty : get input device properties
    736830  */
    737 static HRESULT WINAPI SysMouseAImpl_GetProperty(LPDIRECTINPUTDEVICE2A iface,
     831static HRESULT WINAPI SysMouseAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface,
    738832                                                REFGUID rguid,
    739833                                                LPDIPROPHEADER pdiph)
     
    746840  if (TRACE_ON(dinput))
    747841    _dump_DIPROPHEADER(pdiph);
    748  
     842
    749843  if (!HIWORD(rguid)) {
    750844    switch ((DWORD)rguid) {
    751845    case (DWORD) DIPROP_BUFFERSIZE: {
    752846      LPDIPROPDWORD     pd = (LPDIPROPDWORD)pdiph;
    753      
     847
    754848      TRACE(" return buffersize = %d\n",This->queue_len);
    755849      pd->dwData = This->queue_len;
     850      break;
     851    }
     852
     853    case (DWORD) DIPROP_GRANULARITY: {
     854      LPDIPROPDWORD pr = (LPDIPROPDWORD) pdiph;
     855
     856      /* We'll just assume that the app asks about the Z axis */
     857      pr->dwData = WHEEL_DELTA;
     858
    756859      break;
    757860    }
     
    769872        pr->lMax = DIPROPRANGE_NOMAX;
    770873      }
    771      
     874
    772875      break;
    773876    }
    774      
     877
    775878    default:
    776879      FIXME("Unknown type %ld (%s)\n",(DWORD)rguid,debugstr_guid(rguid));
     
    778881    }
    779882  }
    780  
    781  
     883
     884
    782885  return DI_OK;
    783886}
     
    788891  *     SetEventNotification : specifies event to be sent on state change
    789892  */
    790 static HRESULT WINAPI SysMouseAImpl_SetEventNotification(LPDIRECTINPUTDEVICE2A iface,
     893static HRESULT WINAPI SysMouseAImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface,
    791894                                                         HANDLE hnd) {
    792895  ICOM_THIS(SysMouseAImpl,iface);
     
    803906  */
    804907static HRESULT WINAPI SysMouseAImpl_GetCapabilities(
    805         LPDIRECTINPUTDEVICE2A iface,
     908        LPDIRECTINPUTDEVICE8A iface,
    806909        LPDIDEVCAPS lpDIDevCaps)
    807910{
     
    813916    lpDIDevCaps->dwFlags = DIDC_ATTACHED;
    814917    lpDIDevCaps->dwDevType = DIDEVTYPE_MOUSE;
    815     lpDIDevCaps->dwAxes = 2;
     918    lpDIDevCaps->dwAxes = 3;
    816919    lpDIDevCaps->dwButtons = 3;
    817920    lpDIDevCaps->dwPOVs = 0;
     
    825928    FIXME("DirectX 3.0 not supported....\n");
    826929  }
    827  
     930
    828931  return DI_OK;
    829932}
     
    834937  */
    835938static HRESULT WINAPI SysMouseAImpl_EnumObjects(
    836         LPDIRECTINPUTDEVICE2A iface,
     939        LPDIRECTINPUTDEVICE8A iface,
    837940        LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
    838941        LPVOID lpvRef,
     
    841944  ICOM_THIS(SysMouseAImpl,iface);
    842945  DIDEVICEOBJECTINSTANCEA ddoi;
    843  
     946
    844947  TRACE("(this=%p,%p,%p,%08lx)\n", This, lpCallback, lpvRef, dwFlags);
    845948  if (TRACE_ON(dinput)) {
     
    851954  /* Only the fields till dwFFMaxForce are relevant */
    852955  ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce);
    853    
     956
    854957  /* In a mouse, we have : two relative axis and three buttons */
    855958  if ((dwFlags == DIDFT_ALL) ||
     
    862965    _dump_OBJECTINSTANCEA(&ddoi);
    863966    if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
    864    
     967
    865968    /* Y axis */
    866969    ddoi.guidType = GUID_YAxis;
     
    870973    _dump_OBJECTINSTANCEA(&ddoi);
    871974    if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
     975
     976    /* Z axis */
     977    ddoi.guidType = GUID_ZAxis;
     978    ddoi.dwOfs = This->offset_array[WINE_MOUSE_Z_POSITION];
     979    ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS;
     980    strcpy(ddoi.tszName, "Z-Axis");
     981    _dump_OBJECTINSTANCEA(&ddoi);
     982    if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
    872983  }
    873984
     
    9021013
    9031014
    904 static ICOM_VTABLE(IDirectInputDevice2A) SysMouseAvt =
     1015static ICOM_VTABLE(IDirectInputDevice8A) SysMouseAvt =
    9051016{
    9061017        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     
    9321043        IDirectInputDevice2AImpl_Poll,
    9331044        IDirectInputDevice2AImpl_SendDeviceData,
     1045        IDirectInputDevice7AImpl_EnumEffectsInFile,
     1046        IDirectInputDevice7AImpl_WriteEffectToFile,
     1047        IDirectInputDevice8AImpl_BuildActionMap,
     1048        IDirectInputDevice8AImpl_SetActionMap,
     1049        IDirectInputDevice8AImpl_GetImageInfo
    9341050};
    935 
    936 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
    937 # define XCAST(fun)     (typeof(SysMouse7Avt.fun))
    938 #else
    939 # define XCAST(fun)     (void*)
    940 #endif
    941 
    942 static ICOM_VTABLE(IDirectInputDevice7A) SysMouse7Avt =
    943 {
    944         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    945         XCAST(QueryInterface)IDirectInputDevice2AImpl_QueryInterface,
    946         XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
    947         XCAST(Release)SysMouseAImpl_Release,
    948         XCAST(GetCapabilities)SysMouseAImpl_GetCapabilities,
    949         XCAST(EnumObjects)SysMouseAImpl_EnumObjects,
    950         XCAST(GetProperty)SysMouseAImpl_GetProperty,
    951         XCAST(SetProperty)SysMouseAImpl_SetProperty,
    952         XCAST(Acquire)SysMouseAImpl_Acquire,
    953         XCAST(Unacquire)SysMouseAImpl_Unacquire,
    954         XCAST(GetDeviceState)SysMouseAImpl_GetDeviceState,
    955         XCAST(GetDeviceData)SysMouseAImpl_GetDeviceData,
    956         XCAST(SetDataFormat)SysMouseAImpl_SetDataFormat,
    957         XCAST(SetEventNotification)SysMouseAImpl_SetEventNotification,
    958         XCAST(SetCooperativeLevel)SysMouseAImpl_SetCooperativeLevel,
    959         XCAST(GetObjectInfo)IDirectInputDevice2AImpl_GetObjectInfo,
    960         XCAST(GetDeviceInfo)IDirectInputDevice2AImpl_GetDeviceInfo,
    961         XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel,
    962         XCAST(Initialize)IDirectInputDevice2AImpl_Initialize,
    963         XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect,
    964         XCAST(EnumEffects)IDirectInputDevice2AImpl_EnumEffects,
    965         XCAST(GetEffectInfo)IDirectInputDevice2AImpl_GetEffectInfo,
    966         XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState,
    967         XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand,
    968         XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
    969         XCAST(Escape)IDirectInputDevice2AImpl_Escape,
    970         XCAST(Poll)IDirectInputDevice2AImpl_Poll,
    971         XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData,
    972         IDirectInputDevice7AImpl_EnumEffectsInFile,
    973         IDirectInputDevice7AImpl_WriteEffectToFile
    974 };
    975 
    976 #undef XCAST
Note: See TracChangeset for help on using the changeset viewer.