2000-11-05 21:25:02 +01:00
|
|
|
/* DirectInput Device
|
|
|
|
*
|
|
|
|
* Copyright 1998 Marcus Meissner
|
|
|
|
* Copyright 1998,1999 Lionel Ulmer
|
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2000-11-05 21:25:02 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* This file contains all the Device specific functions that can be used as stubs
|
|
|
|
by real device implementations.
|
|
|
|
|
|
|
|
It also contains all the helper functions.
|
|
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2001-01-26 21:43:40 +01:00
|
|
|
#include <string.h>
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2003-06-16 22:22:13 +02:00
|
|
|
#include "wine/unicode.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
2000-11-05 21:25:02 +01:00
|
|
|
#include "winbase.h"
|
2006-03-18 19:26:37 +01:00
|
|
|
#include "winuser.h"
|
2000-11-05 21:25:02 +01:00
|
|
|
#include "winerror.h"
|
|
|
|
#include "dinput.h"
|
|
|
|
#include "device_private.h"
|
2006-03-18 19:26:37 +01:00
|
|
|
#include "dinput_private.h"
|
2000-11-05 21:25:02 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
|
2000-11-05 21:25:02 +01:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Various debugging tools
|
|
|
|
*/
|
|
|
|
void _dump_cooperativelevel_DI(DWORD dwFlags) {
|
2004-06-02 02:36:54 +02:00
|
|
|
if (TRACE_ON(dinput)) {
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int i;
|
2004-06-02 02:36:54 +02:00
|
|
|
static const struct {
|
|
|
|
DWORD mask;
|
|
|
|
const char *name;
|
|
|
|
} flags[] = {
|
|
|
|
#define FE(x) { x, #x}
|
|
|
|
FE(DISCL_BACKGROUND),
|
|
|
|
FE(DISCL_EXCLUSIVE),
|
|
|
|
FE(DISCL_FOREGROUND),
|
|
|
|
FE(DISCL_NONEXCLUSIVE)
|
2000-11-05 21:25:02 +01:00
|
|
|
#undef FE
|
2004-06-02 02:36:54 +02:00
|
|
|
};
|
|
|
|
for (i = 0; i < (sizeof(flags) / sizeof(flags[0])); i++)
|
|
|
|
if (flags[i].mask & dwFlags)
|
|
|
|
DPRINTF("%s ",flags[i].name);
|
|
|
|
DPRINTF("\n");
|
|
|
|
}
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void _dump_EnumObjects_flags(DWORD dwFlags) {
|
2004-06-02 02:36:54 +02:00
|
|
|
if (TRACE_ON(dinput)) {
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int i;
|
2004-06-02 02:36:54 +02:00
|
|
|
DWORD type, instance;
|
|
|
|
static const struct {
|
|
|
|
DWORD mask;
|
|
|
|
const char *name;
|
|
|
|
} flags[] = {
|
|
|
|
#define FE(x) { x, #x}
|
|
|
|
FE(DIDFT_RELAXIS),
|
|
|
|
FE(DIDFT_ABSAXIS),
|
|
|
|
FE(DIDFT_PSHBUTTON),
|
|
|
|
FE(DIDFT_TGLBUTTON),
|
|
|
|
FE(DIDFT_POV),
|
|
|
|
FE(DIDFT_COLLECTION),
|
|
|
|
FE(DIDFT_NODATA),
|
|
|
|
FE(DIDFT_FFACTUATOR),
|
|
|
|
FE(DIDFT_FFEFFECTTRIGGER),
|
2005-05-05 11:49:54 +02:00
|
|
|
FE(DIDFT_OUTPUT),
|
|
|
|
FE(DIDFT_VENDORDEFINED),
|
|
|
|
FE(DIDFT_ALIAS),
|
|
|
|
FE(DIDFT_OPTIONAL)
|
2000-11-05 21:25:02 +01:00
|
|
|
#undef FE
|
2004-06-02 02:36:54 +02:00
|
|
|
};
|
|
|
|
type = (dwFlags & 0xFF0000FF);
|
|
|
|
instance = ((dwFlags >> 8) & 0xFFFF);
|
|
|
|
DPRINTF("Type:");
|
|
|
|
if (type == DIDFT_ALL) {
|
|
|
|
DPRINTF(" DIDFT_ALL");
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < (sizeof(flags) / sizeof(flags[0])); i++) {
|
|
|
|
if (flags[i].mask & type) {
|
|
|
|
type &= ~flags[i].mask;
|
|
|
|
DPRINTF(" %s",flags[i].name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (type) {
|
|
|
|
DPRINTF(" (unhandled: %08lx)", type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DPRINTF(" / Instance: ");
|
|
|
|
if (instance == ((DIDFT_ANYINSTANCE >> 8) & 0xFFFF)) {
|
|
|
|
DPRINTF("DIDFT_ANYINSTANCE");
|
|
|
|
} else {
|
|
|
|
DPRINTF("%3ld", instance);
|
|
|
|
}
|
|
|
|
}
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2004-08-31 20:51:23 +02:00
|
|
|
void _dump_DIPROPHEADER(LPCDIPROPHEADER diph) {
|
2004-06-02 02:36:54 +02:00
|
|
|
if (TRACE_ON(dinput)) {
|
|
|
|
DPRINTF(" - dwObj = 0x%08lx\n", diph->dwObj);
|
|
|
|
DPRINTF(" - dwHow = %s\n",
|
|
|
|
((diph->dwHow == DIPH_DEVICE) ? "DIPH_DEVICE" :
|
|
|
|
((diph->dwHow == DIPH_BYOFFSET) ? "DIPH_BYOFFSET" :
|
|
|
|
((diph->dwHow == DIPH_BYID)) ? "DIPH_BYID" : "unknown")));
|
|
|
|
}
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void _dump_OBJECTINSTANCEA(DIDEVICEOBJECTINSTANCEA *ddoi) {
|
2004-06-02 02:36:54 +02:00
|
|
|
if (TRACE_ON(dinput)) {
|
|
|
|
DPRINTF(" - enumerating : %s ('%s') - %2ld - 0x%08lx - %s\n",
|
|
|
|
debugstr_guid(&ddoi->guidType), _dump_dinput_GUID(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, ddoi->tszName);
|
|
|
|
}
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
void _dump_OBJECTINSTANCEW(DIDEVICEOBJECTINSTANCEW *ddoi) {
|
2004-06-02 02:36:54 +02:00
|
|
|
if (TRACE_ON(dinput)) {
|
|
|
|
DPRINTF(" - enumerating : %s ('%s'), - %2ld - 0x%08lx - %s\n",
|
|
|
|
debugstr_guid(&ddoi->guidType), _dump_dinput_GUID(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, debugstr_w(ddoi->tszName));
|
|
|
|
}
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
/* This function is a helper to convert a GUID into any possible DInput GUID out there */
|
|
|
|
const char *_dump_dinput_GUID(const GUID *guid) {
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int i;
|
2004-06-02 02:36:54 +02:00
|
|
|
static const struct {
|
|
|
|
const GUID *guid;
|
|
|
|
const char *name;
|
|
|
|
} guids[] = {
|
|
|
|
#define FE(x) { &x, #x}
|
|
|
|
FE(GUID_XAxis),
|
|
|
|
FE(GUID_YAxis),
|
|
|
|
FE(GUID_ZAxis),
|
|
|
|
FE(GUID_RxAxis),
|
|
|
|
FE(GUID_RyAxis),
|
|
|
|
FE(GUID_RzAxis),
|
|
|
|
FE(GUID_Slider),
|
|
|
|
FE(GUID_Button),
|
|
|
|
FE(GUID_Key),
|
|
|
|
FE(GUID_POV),
|
|
|
|
FE(GUID_Unknown),
|
|
|
|
FE(GUID_SysMouse),
|
|
|
|
FE(GUID_SysKeyboard),
|
|
|
|
FE(GUID_Joystick),
|
|
|
|
FE(GUID_ConstantForce),
|
|
|
|
FE(GUID_RampForce),
|
|
|
|
FE(GUID_Square),
|
|
|
|
FE(GUID_Sine),
|
|
|
|
FE(GUID_Triangle),
|
|
|
|
FE(GUID_SawtoothUp),
|
|
|
|
FE(GUID_SawtoothDown),
|
|
|
|
FE(GUID_Spring),
|
|
|
|
FE(GUID_Damper),
|
|
|
|
FE(GUID_Inertia),
|
|
|
|
FE(GUID_Friction),
|
|
|
|
FE(GUID_CustomForce)
|
|
|
|
#undef FE
|
|
|
|
};
|
|
|
|
if (guid == NULL)
|
|
|
|
return "null GUID";
|
|
|
|
for (i = 0; i < (sizeof(guids) / sizeof(guids[0])); i++) {
|
|
|
|
if (IsEqualGUID(guids[i].guid, guid)) {
|
|
|
|
return guids[i].name;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
}
|
2004-06-02 02:36:54 +02:00
|
|
|
return "Unknown GUID";
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
void _dump_DIDATAFORMAT(const DIDATAFORMAT *df) {
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int i;
|
2000-11-05 21:25:02 +01:00
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
TRACE("Dumping DIDATAFORMAT structure:\n");
|
|
|
|
TRACE(" - dwSize: %ld\n", df->dwSize);
|
|
|
|
if (df->dwSize != sizeof(DIDATAFORMAT)) {
|
|
|
|
WARN("Non-standard DIDATAFORMAT structure size (%ld instead of %d).\n", df->dwSize, sizeof(DIDATAFORMAT));
|
|
|
|
}
|
|
|
|
TRACE(" - dwObjsize: %ld\n", df->dwObjSize);
|
|
|
|
if (df->dwObjSize != sizeof(DIOBJECTDATAFORMAT)) {
|
|
|
|
WARN("Non-standard DIOBJECTDATAFORMAT structure size (%ld instead of %d).\n", df->dwObjSize, sizeof(DIOBJECTDATAFORMAT));
|
|
|
|
}
|
|
|
|
TRACE(" - dwFlags: 0x%08lx (", df->dwFlags);
|
|
|
|
switch (df->dwFlags) {
|
|
|
|
case DIDF_ABSAXIS: TRACE("DIDF_ABSAXIS"); break;
|
|
|
|
case DIDF_RELAXIS: TRACE("DIDF_RELAXIS"); break;
|
|
|
|
default: TRACE("unknown"); break;
|
|
|
|
}
|
|
|
|
TRACE(")\n");
|
|
|
|
TRACE(" - dwDataSize: %ld\n", df->dwDataSize);
|
|
|
|
TRACE(" - dwNumObjs: %ld\n", df->dwNumObjs);
|
|
|
|
|
|
|
|
for (i = 0; i < df->dwNumObjs; i++) {
|
|
|
|
TRACE(" - Object %d:\n", i);
|
|
|
|
TRACE(" * GUID: %s ('%s')\n", debugstr_guid(df->rgodf[i].pguid), _dump_dinput_GUID(df->rgodf[i].pguid));
|
|
|
|
TRACE(" * dwOfs: %ld\n", df->rgodf[i].dwOfs);
|
|
|
|
TRACE(" * dwType: 0x%08lx\n", df->rgodf[i].dwType);
|
|
|
|
TRACE(" "); _dump_EnumObjects_flags(df->rgodf[i].dwType); TRACE("\n");
|
|
|
|
TRACE(" * dwFlags: 0x%08lx\n", df->rgodf[i].dwFlags);
|
|
|
|
}
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
/* Conversion between internal data buffer and external data buffer */
|
2004-09-02 22:09:54 +02:00
|
|
|
void fill_DataFormat(void *out, const void *in, DataFormat *df) {
|
2004-06-02 02:36:54 +02:00
|
|
|
int i;
|
|
|
|
char *in_c = (char *) in;
|
|
|
|
char *out_c = (char *) out;
|
|
|
|
|
|
|
|
if (df->dt == NULL) {
|
|
|
|
/* This means that the app uses Wine's internal data format */
|
|
|
|
memcpy(out, in, df->internal_format_size);
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < df->size; i++) {
|
|
|
|
if (df->dt[i].offset_in >= 0) {
|
|
|
|
switch (df->dt[i].size) {
|
|
|
|
case 1:
|
|
|
|
TRACE("Copying (c) to %d from %d (value %d)\n",
|
|
|
|
df->dt[i].offset_out, df->dt[i].offset_in, *((char *) (in_c + df->dt[i].offset_in)));
|
|
|
|
*((char *) (out_c + df->dt[i].offset_out)) = *((char *) (in_c + df->dt[i].offset_in));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
TRACE("Copying (s) to %d from %d (value %d)\n",
|
|
|
|
df->dt[i].offset_out, df->dt[i].offset_in, *((short *) (in_c + df->dt[i].offset_in)));
|
|
|
|
*((short *) (out_c + df->dt[i].offset_out)) = *((short *) (in_c + df->dt[i].offset_in));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
TRACE("Copying (i) to %d from %d (value %d)\n",
|
|
|
|
df->dt[i].offset_out, df->dt[i].offset_in, *((int *) (in_c + df->dt[i].offset_in)));
|
|
|
|
*((int *) (out_c + df->dt[i].offset_out)) = *((int *) (in_c + df->dt[i].offset_in));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
memcpy((out_c + df->dt[i].offset_out), (in_c + df->dt[i].offset_in), df->dt[i].size);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (df->dt[i].size) {
|
|
|
|
case 1:
|
|
|
|
TRACE("Copying (c) to %d default value %d\n",
|
|
|
|
df->dt[i].offset_out, df->dt[i].value);
|
|
|
|
*((char *) (out_c + df->dt[i].offset_out)) = (char) df->dt[i].value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
TRACE("Copying (s) to %d default value %d\n",
|
|
|
|
df->dt[i].offset_out, df->dt[i].value);
|
|
|
|
*((short *) (out_c + df->dt[i].offset_out)) = (short) df->dt[i].value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
TRACE("Copying (i) to %d default value %d\n",
|
|
|
|
df->dt[i].offset_out, df->dt[i].value);
|
|
|
|
*((int *) (out_c + df->dt[i].offset_out)) = (int) df->dt[i].value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
memset((out_c + df->dt[i].offset_out), df->dt[i].size, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-09-02 22:09:54 +02:00
|
|
|
void release_DataFormat(DataFormat * format)
|
|
|
|
{
|
2005-11-10 13:14:56 +01:00
|
|
|
TRACE("Deleting DataTransform :\n");
|
2004-09-02 22:09:54 +02:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, format->dt);
|
|
|
|
}
|
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
DataFormat *create_DataFormat(const DIDATAFORMAT *wine_format, LPCDIDATAFORMAT asked_format, int *offset) {
|
|
|
|
DataFormat *ret;
|
|
|
|
DataTransform *dt;
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int i, j;
|
2004-06-02 02:36:54 +02:00
|
|
|
int same = 1;
|
|
|
|
int *done;
|
|
|
|
int index = 0;
|
2004-09-06 23:26:03 +02:00
|
|
|
DWORD next = 0;
|
2004-06-02 02:36:54 +02:00
|
|
|
|
2005-03-24 22:01:35 +01:00
|
|
|
ret = HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat));
|
2004-06-02 02:36:54 +02:00
|
|
|
|
2005-03-24 22:01:35 +01:00
|
|
|
done = HeapAlloc(GetProcessHeap(), 0, sizeof(int) * asked_format->dwNumObjs);
|
2004-06-02 02:36:54 +02:00
|
|
|
memset(done, 0, sizeof(int) * asked_format->dwNumObjs);
|
|
|
|
|
2005-03-24 22:01:35 +01:00
|
|
|
dt = HeapAlloc(GetProcessHeap(), 0, asked_format->dwNumObjs * sizeof(DataTransform));
|
2004-06-02 02:36:54 +02:00
|
|
|
|
2005-11-10 13:14:56 +01:00
|
|
|
TRACE("Creating DataTransform :\n");
|
2004-06-02 02:36:54 +02:00
|
|
|
|
|
|
|
for (i = 0; i < wine_format->dwNumObjs; i++) {
|
|
|
|
offset[i] = -1;
|
|
|
|
|
|
|
|
for (j = 0; j < asked_format->dwNumObjs; j++) {
|
|
|
|
if (done[j] == 1)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (/* Check if the application either requests any GUID and if not, it if matches
|
|
|
|
* the GUID of the Wine object.
|
|
|
|
*/
|
|
|
|
((asked_format->rgodf[j].pguid == NULL) ||
|
2005-05-10 15:17:03 +02:00
|
|
|
(wine_format->rgodf[i].pguid == NULL) ||
|
2004-06-02 02:36:54 +02:00
|
|
|
(IsEqualGUID(wine_format->rgodf[i].pguid, asked_format->rgodf[j].pguid)))
|
|
|
|
&&
|
|
|
|
(/* Then check if it accepts any instance id, and if not, if it matches Wine's
|
|
|
|
* instance id.
|
|
|
|
*/
|
2005-05-05 11:49:54 +02:00
|
|
|
(DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType) == 0xFFFF) ||
|
|
|
|
(DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType) == 0x00FF) || /* This is mentionned in no DX docs, but it works fine - tested on WinXP */
|
|
|
|
(DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType) == DIDFT_GETINSTANCE(wine_format->rgodf[i].dwType)))
|
|
|
|
&&
|
|
|
|
( /* Then if the asked type matches the one Wine provides */
|
|
|
|
wine_format->rgodf[i].dwType & asked_format->rgodf[j].dwType)) {
|
2004-06-02 02:36:54 +02:00
|
|
|
|
|
|
|
done[j] = 1;
|
|
|
|
|
2005-11-10 13:14:56 +01:00
|
|
|
TRACE("Matching :\n");
|
2004-06-02 02:36:54 +02:00
|
|
|
TRACE(" - Asked (%d) :\n", j);
|
|
|
|
TRACE(" * GUID: %s ('%s')\n",
|
|
|
|
debugstr_guid(asked_format->rgodf[j].pguid),
|
|
|
|
_dump_dinput_GUID(asked_format->rgodf[j].pguid));
|
|
|
|
TRACE(" * Offset: %3ld\n", asked_format->rgodf[j].dwOfs);
|
|
|
|
TRACE(" * dwType: %08lx\n", asked_format->rgodf[j].dwType);
|
|
|
|
TRACE(" "); _dump_EnumObjects_flags(asked_format->rgodf[j].dwType); TRACE("\n");
|
|
|
|
|
2005-05-10 15:17:03 +02:00
|
|
|
TRACE(" - Wine (%d) :\n", i);
|
2004-06-02 02:36:54 +02:00
|
|
|
TRACE(" * GUID: %s ('%s')\n",
|
2005-05-10 15:17:03 +02:00
|
|
|
debugstr_guid(wine_format->rgodf[i].pguid),
|
|
|
|
_dump_dinput_GUID(wine_format->rgodf[i].pguid));
|
|
|
|
TRACE(" * Offset: %3ld\n", wine_format->rgodf[i].dwOfs);
|
|
|
|
TRACE(" * dwType: %08lx\n", wine_format->rgodf[i].dwType);
|
|
|
|
TRACE(" "); _dump_EnumObjects_flags(wine_format->rgodf[i].dwType); TRACE("\n");
|
2004-06-02 02:36:54 +02:00
|
|
|
|
|
|
|
if (wine_format->rgodf[i].dwType & DIDFT_BUTTON)
|
|
|
|
dt[index].size = sizeof(BYTE);
|
|
|
|
else
|
|
|
|
dt[index].size = sizeof(DWORD);
|
2005-05-10 15:17:03 +02:00
|
|
|
dt[index].offset_in = wine_format->rgodf[i].dwOfs;
|
2004-09-06 23:26:03 +02:00
|
|
|
if (asked_format->rgodf[j].dwOfs < next) {
|
|
|
|
WARN("bad format: dwOfs=%ld, changing to %ld\n", asked_format->rgodf[j].dwOfs, next);
|
|
|
|
dt[index].offset_out = next;
|
|
|
|
offset[i] = next;
|
|
|
|
} else {
|
|
|
|
dt[index].offset_out = asked_format->rgodf[j].dwOfs;
|
|
|
|
offset[i] = asked_format->rgodf[j].dwOfs;
|
|
|
|
}
|
2004-06-02 02:36:54 +02:00
|
|
|
dt[index].value = 0;
|
2004-09-06 23:26:03 +02:00
|
|
|
next = next + dt[index].size;
|
2004-06-02 02:36:54 +02:00
|
|
|
|
2004-09-06 23:26:03 +02:00
|
|
|
if (wine_format->rgodf[i].dwOfs != dt[index].offset_out)
|
2004-06-02 02:36:54 +02:00
|
|
|
same = 0;
|
|
|
|
|
2004-09-06 23:26:03 +02:00
|
|
|
index++;
|
2004-06-02 02:36:54 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (j == asked_format->dwNumObjs)
|
|
|
|
same = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("Setting to default value :\n");
|
2000-11-05 21:25:02 +01:00
|
|
|
for (j = 0; j < asked_format->dwNumObjs; j++) {
|
2004-06-02 02:36:54 +02:00
|
|
|
if (done[j] == 0) {
|
|
|
|
TRACE(" - Asked (%d) :\n", j);
|
|
|
|
TRACE(" * GUID: %s ('%s')\n",
|
|
|
|
debugstr_guid(asked_format->rgodf[j].pguid),
|
|
|
|
_dump_dinput_GUID(asked_format->rgodf[j].pguid));
|
|
|
|
TRACE(" * Offset: %3ld\n", asked_format->rgodf[j].dwOfs);
|
|
|
|
TRACE(" * dwType: %08lx\n", asked_format->rgodf[j].dwType);
|
|
|
|
TRACE(" "); _dump_EnumObjects_flags(asked_format->rgodf[j].dwType); TRACE("\n");
|
|
|
|
|
|
|
|
if (asked_format->rgodf[j].dwType & DIDFT_BUTTON)
|
|
|
|
dt[index].size = sizeof(BYTE);
|
|
|
|
else
|
|
|
|
dt[index].size = sizeof(DWORD);
|
|
|
|
dt[index].offset_in = -1;
|
|
|
|
dt[index].offset_out = asked_format->rgodf[j].dwOfs;
|
|
|
|
dt[index].value = 0;
|
|
|
|
index++;
|
|
|
|
|
|
|
|
same = 0;
|
|
|
|
}
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
2004-06-02 02:36:54 +02:00
|
|
|
|
|
|
|
ret->internal_format_size = wine_format->dwDataSize;
|
|
|
|
ret->size = index;
|
|
|
|
if (same) {
|
|
|
|
ret->dt = NULL;
|
|
|
|
HeapFree(GetProcessHeap(), 0, dt);
|
|
|
|
} else {
|
|
|
|
ret->dt = dt;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
2004-06-02 02:36:54 +02:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, done);
|
|
|
|
|
|
|
|
return ret;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
BOOL DIEnumDevicesCallbackAtoW(LPCDIDEVICEOBJECTINSTANCEA lpddi, LPVOID lpvRef) {
|
2004-06-02 02:36:54 +02:00
|
|
|
DIDEVICEOBJECTINSTANCEW ddtmp;
|
|
|
|
device_enumobjects_AtoWcb_data* data;
|
|
|
|
|
|
|
|
data = (device_enumobjects_AtoWcb_data*) lpvRef;
|
|
|
|
|
2005-04-25 12:48:38 +02:00
|
|
|
memset(&ddtmp, 0, sizeof(ddtmp));
|
2004-06-02 02:36:54 +02:00
|
|
|
|
|
|
|
ddtmp.dwSize = sizeof(DIDEVICEINSTANCEW);
|
|
|
|
ddtmp.guidType = lpddi->guidType;
|
|
|
|
ddtmp.dwOfs = lpddi->dwOfs;
|
|
|
|
ddtmp.dwType = lpddi->dwType;
|
|
|
|
ddtmp.dwFlags = lpddi->dwFlags;
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpddi->tszName, -1, ddtmp.tszName, MAX_PATH);
|
|
|
|
|
|
|
|
if (lpddi->dwSize == sizeof(DIDEVICEINSTANCEA)) {
|
|
|
|
/**
|
|
|
|
* if dwSize < sizeof(DIDEVICEINSTANCEA of DInput version >= 5)
|
|
|
|
* force feedback and other newer datas aren't available
|
|
|
|
*/
|
|
|
|
ddtmp.dwFFMaxForce = lpddi->dwFFMaxForce;
|
|
|
|
ddtmp.dwFFForceResolution = lpddi->dwFFForceResolution;
|
|
|
|
ddtmp.wCollectionNumber = lpddi->wCollectionNumber;
|
|
|
|
ddtmp.wDesignatorIndex = lpddi->wDesignatorIndex;
|
|
|
|
ddtmp.wUsagePage = lpddi->wUsagePage;
|
|
|
|
ddtmp.wUsage = lpddi->wUsage;
|
|
|
|
ddtmp.dwDimension = lpddi->dwDimension;
|
|
|
|
ddtmp.wExponent = lpddi->wExponent;
|
|
|
|
ddtmp.wReserved = lpddi->wReserved;
|
|
|
|
}
|
|
|
|
return data->lpCallBack(&ddtmp, data->lpvRef);
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* IDirectInputDeviceA
|
|
|
|
*/
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df
|
2000-11-05 21:25:02 +01:00
|
|
|
) {
|
2004-09-09 22:17:07 +02:00
|
|
|
IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface;
|
2004-06-02 02:36:54 +02:00
|
|
|
|
|
|
|
TRACE("(this=%p,%p)\n",This,df);
|
|
|
|
|
|
|
|
_dump_DIDATAFORMAT(df);
|
|
|
|
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags
|
2000-11-05 21:25:02 +01:00
|
|
|
) {
|
2004-09-09 22:17:07 +02:00
|
|
|
IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface;
|
2005-09-12 12:30:05 +02:00
|
|
|
TRACE("(this=%p,%p,0x%08lx)\n",This,hwnd,dwflags);
|
2004-06-02 02:36:54 +02:00
|
|
|
if (TRACE_ON(dinput)) {
|
|
|
|
TRACE(" cooperative level : ");
|
|
|
|
_dump_cooperativelevel_DI(dwflags);
|
|
|
|
}
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,HANDLE hnd
|
2000-11-05 21:25:02 +01:00
|
|
|
) {
|
2004-09-09 22:17:07 +02:00
|
|
|
IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface;
|
2005-09-12 12:30:05 +02:00
|
|
|
FIXME("(this=%p,%p): stub\n",This,hnd);
|
2004-06-02 02:36:54 +02:00
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2002-06-14 02:39:44 +02:00
|
|
|
ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface;
|
2004-09-17 20:10:41 +02:00
|
|
|
ULONG ref;
|
|
|
|
ref = InterlockedDecrement(&(This->ref));
|
|
|
|
if (ref == 0)
|
|
|
|
HeapFree(GetProcessHeap(),0,This);
|
|
|
|
return ref;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj
|
2000-11-05 21:25:02 +01:00
|
|
|
)
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface;
|
2004-06-02 02:36:54 +02:00
|
|
|
|
|
|
|
TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
|
|
|
|
if (IsEqualGUID(&IID_IUnknown,riid)) {
|
|
|
|
IDirectInputDevice2_AddRef(iface);
|
|
|
|
*ppobj = This;
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
if (IsEqualGUID(&IID_IDirectInputDeviceA,riid)) {
|
|
|
|
IDirectInputDevice2_AddRef(iface);
|
|
|
|
*ppobj = This;
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
if (IsEqualGUID(&IID_IDirectInputDevice2A,riid)) {
|
|
|
|
IDirectInputDevice2_AddRef(iface);
|
|
|
|
*ppobj = This;
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
if (IsEqualGUID(&IID_IDirectInputDevice7A,riid)) {
|
|
|
|
IDirectInputDevice7_AddRef(iface);
|
|
|
|
*ppobj = This;
|
|
|
|
return DI_OK;
|
|
|
|
}
|
2005-11-28 10:38:59 +01:00
|
|
|
if (IsEqualGUID(&IID_IDirectInputDevice8A,riid)) {
|
|
|
|
IDirectInputDevice8_AddRef(iface);
|
|
|
|
*ppobj = This;
|
|
|
|
return DI_OK;
|
|
|
|
}
|
2004-06-02 02:36:54 +02:00
|
|
|
TRACE("Unsupported interface !\n");
|
|
|
|
return E_FAIL;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(
|
|
|
|
LPDIRECTINPUTDEVICE8W iface,REFIID riid,LPVOID *ppobj
|
|
|
|
)
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface;
|
2004-06-02 02:36:54 +02:00
|
|
|
|
|
|
|
TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
|
|
|
|
if (IsEqualGUID(&IID_IUnknown,riid)) {
|
|
|
|
IDirectInputDevice2_AddRef(iface);
|
|
|
|
*ppobj = This;
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
if (IsEqualGUID(&IID_IDirectInputDeviceW,riid)) {
|
|
|
|
IDirectInputDevice2_AddRef(iface);
|
|
|
|
*ppobj = This;
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
if (IsEqualGUID(&IID_IDirectInputDevice2W,riid)) {
|
|
|
|
IDirectInputDevice2_AddRef(iface);
|
|
|
|
*ppobj = This;
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
if (IsEqualGUID(&IID_IDirectInputDevice7W,riid)) {
|
|
|
|
IDirectInputDevice7_AddRef(iface);
|
|
|
|
*ppobj = This;
|
|
|
|
return DI_OK;
|
|
|
|
}
|
2005-11-28 10:38:59 +01:00
|
|
|
if (IsEqualGUID(&IID_IDirectInputDevice8W,riid)) {
|
|
|
|
IDirectInputDevice8_AddRef(iface);
|
|
|
|
*ppobj = This;
|
|
|
|
return DI_OK;
|
|
|
|
}
|
2004-06-02 02:36:54 +02:00
|
|
|
TRACE("Unsupported interface !\n");
|
|
|
|
return E_FAIL;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
ULONG WINAPI IDirectInputDevice2AImpl_AddRef(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface;
|
2004-09-17 20:10:41 +02:00
|
|
|
return InterlockedIncrement(&(This->ref));
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
|
|
|
|
LPVOID lpvRef,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%p,%p,%08lx): stub!\n", iface, lpCallback, lpvRef, dwFlags);
|
|
|
|
if (TRACE_ON(dinput)) {
|
|
|
|
DPRINTF(" - flags = ");
|
|
|
|
_dump_EnumObjects_flags(dwFlags);
|
|
|
|
DPRINTF("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(
|
|
|
|
LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
|
|
|
|
LPVOID lpvRef,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%p,%p,%08lx): stub!\n", iface, lpCallback, lpvRef, dwFlags);
|
|
|
|
if (TRACE_ON(dinput)) {
|
|
|
|
DPRINTF(" - flags = ");
|
|
|
|
_dump_EnumObjects_flags(dwFlags);
|
|
|
|
DPRINTF("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
return DI_OK;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
REFGUID rguid,
|
|
|
|
LPDIPROPHEADER pdiph)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%s,%p): stub!\n",
|
|
|
|
iface, debugstr_guid(rguid), pdiph);
|
|
|
|
|
|
|
|
if (TRACE_ON(dinput))
|
|
|
|
_dump_DIPROPHEADER(pdiph);
|
|
|
|
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDIDEVICEOBJECTINSTANCEA pdidoi,
|
|
|
|
DWORD dwObj,
|
|
|
|
DWORD dwHow)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%p,%ld,0x%08lx): stub!\n",
|
|
|
|
iface, pdidoi, dwObj, dwHow);
|
|
|
|
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(
|
|
|
|
LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIDEVICEOBJECTINSTANCEW pdidoi,
|
|
|
|
DWORD dwObj,
|
|
|
|
DWORD dwHow)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%p,%ld,0x%08lx): stub!\n",
|
|
|
|
iface, pdidoi, dwObj, dwHow);
|
|
|
|
|
|
|
|
return DI_OK;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDIDEVICEINSTANCEA pdidi)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%p): stub!\n",
|
|
|
|
iface, pdidi);
|
|
|
|
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
2004-06-02 02:36:54 +02:00
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo(
|
|
|
|
LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIDEVICEINSTANCEW pdidi)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%p): stub!\n",
|
|
|
|
iface, pdidi);
|
|
|
|
|
|
|
|
return DI_OK;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
HWND hwndOwner,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%p,0x%08lx): stub!\n",
|
|
|
|
iface, hwndOwner, dwFlags);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
HINSTANCE hinst,
|
|
|
|
DWORD dwVersion,
|
|
|
|
REFGUID rguid)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%p,%ld,%s): stub!\n",
|
|
|
|
iface, hinst, dwVersion, debugstr_guid(rguid));
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* IDirectInputDevice2A
|
|
|
|
*/
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
REFGUID rguid,
|
|
|
|
LPCDIEFFECT lpeff,
|
|
|
|
LPDIRECTINPUTEFFECT *ppdef,
|
|
|
|
LPUNKNOWN pUnkOuter)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%s,%p,%p,%p): stub!\n",
|
|
|
|
iface, debugstr_guid(rguid), lpeff, ppdef, pUnkOuter);
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDIENUMEFFECTSCALLBACKA lpCallback,
|
|
|
|
LPVOID lpvRef,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%p,%p,0x%08lx): stub!\n",
|
|
|
|
iface, lpCallback, lpvRef, dwFlags);
|
|
|
|
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
|
|
|
|
LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIENUMEFFECTSCALLBACKW lpCallback,
|
|
|
|
LPVOID lpvRef,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%p,%p,0x%08lx): stub!\n",
|
|
|
|
iface, lpCallback, lpvRef, dwFlags);
|
|
|
|
|
|
|
|
return DI_OK;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDIEFFECTINFOA lpdei,
|
|
|
|
REFGUID rguid)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%p,%s): stub!\n",
|
|
|
|
iface, lpdei, debugstr_guid(rguid));
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
|
|
|
|
LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIEFFECTINFOW lpdei,
|
|
|
|
REFGUID rguid)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%p,%s): stub!\n",
|
|
|
|
iface, lpdei, debugstr_guid(rguid));
|
|
|
|
return DI_OK;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDWORD pdwOut)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%p): stub!\n",
|
|
|
|
iface, pdwOut);
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,0x%08lx): stub!\n",
|
|
|
|
iface, dwFlags);
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
|
|
|
|
LPVOID lpvRef,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%p,%p,0x%08lx): stub!\n",
|
|
|
|
iface, lpCallback, lpvRef, dwFlags);
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_Escape(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDIEFFESCAPE lpDIEEsc)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,%p): stub!\n",
|
|
|
|
iface, lpDIEEsc);
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_Poll(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
/* Because wine devices do not need to be polled, just return DI_NOEFFECT */
|
|
|
|
return DI_NOEFFECT;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
DWORD cbObjectData,
|
2002-06-14 02:39:44 +02:00
|
|
|
LPCDIDEVICEOBJECTDATA rgdod,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDWORD pdwInOut,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(this=%p,0x%08lx,%p,%p,0x%08lx): stub!\n",
|
|
|
|
iface, cbObjectData, rgdod, pdwInOut, dwFlags);
|
|
|
|
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2002-06-14 02:39:44 +02:00
|
|
|
HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPCSTR lpszFileName,
|
|
|
|
LPDIENUMEFFECTSINFILECALLBACK pec,
|
|
|
|
LPVOID pvRef,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(%p)->(%s,%p,%p,%08lx): stub !\n", iface, lpszFileName, pec, pvRef, dwFlags);
|
|
|
|
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPCWSTR lpszFileName,
|
|
|
|
LPDIENUMEFFECTSINFILECALLBACK pec,
|
|
|
|
LPVOID pvRef,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(%p)->(%s,%p,%p,%08lx): stub !\n", iface, debugstr_w(lpszFileName), pec, pvRef, dwFlags);
|
|
|
|
|
|
|
|
return DI_OK;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
2002-06-14 02:39:44 +02:00
|
|
|
HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPCSTR lpszFileName,
|
|
|
|
DWORD dwEntries,
|
|
|
|
LPDIFILEEFFECT rgDiFileEft,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(%p)->(%s,%08lx,%p,%08lx): stub !\n", iface, lpszFileName, dwEntries, rgDiFileEft, dwFlags);
|
|
|
|
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
2002-06-14 02:39:44 +02:00
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPCWSTR lpszFileName,
|
|
|
|
DWORD dwEntries,
|
|
|
|
LPDIFILEEFFECT rgDiFileEft,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(%p)->(%s,%08lx,%p,%08lx): stub !\n", iface, debugstr_w(lpszFileName), dwEntries, rgDiFileEft, dwFlags);
|
|
|
|
|
|
|
|
return DI_OK;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
2002-06-14 02:39:44 +02:00
|
|
|
HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
LPDIACTIONFORMATA lpdiaf,
|
|
|
|
LPCSTR lpszUserName,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, lpszUserName, dwFlags);
|
|
|
|
|
|
|
|
return DI_OK;
|
2002-06-14 02:39:44 +02:00
|
|
|
}
|
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIACTIONFORMATW lpdiaf,
|
|
|
|
LPCWSTR lpszUserName,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
|
|
|
|
|
|
|
|
return DI_OK;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
2002-06-14 02:39:44 +02:00
|
|
|
HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
LPDIACTIONFORMATA lpdiaf,
|
|
|
|
LPCSTR lpszUserName,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, lpszUserName, dwFlags);
|
|
|
|
|
|
|
|
return DI_OK;
|
2002-06-14 02:39:44 +02:00
|
|
|
}
|
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIACTIONFORMATW lpdiaf,
|
|
|
|
LPCWSTR lpszUserName,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
|
|
|
|
|
|
|
|
return DI_OK;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
2002-06-14 02:39:44 +02:00
|
|
|
HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(%p)->(%p): stub !\n", iface, lpdiDevImageInfoHeader);
|
|
|
|
|
|
|
|
return DI_OK;
|
2002-06-14 02:39:44 +02:00
|
|
|
}
|
2003-06-16 22:22:13 +02:00
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
FIXME("(%p)->(%p): stub !\n", iface, lpdiDevImageInfoHeader);
|
|
|
|
|
|
|
|
return DI_OK;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
2006-03-18 19:26:37 +01:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* DInput hook thread
|
|
|
|
*/
|
|
|
|
|
|
|
|
static LRESULT CALLBACK dinput_hook_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
static HHOOK kbd_hook, mouse_hook;
|
|
|
|
BOOL res;
|
|
|
|
|
|
|
|
TRACE("got message %x %p %p\n", message, (LPVOID)wParam, (LPVOID)lParam);
|
|
|
|
switch (message)
|
|
|
|
{
|
|
|
|
case WM_USER+0x10:
|
|
|
|
if (wParam == WH_KEYBOARD_LL)
|
|
|
|
{
|
|
|
|
if (lParam)
|
|
|
|
{
|
|
|
|
if (kbd_hook) return 0;
|
|
|
|
kbd_hook = SetWindowsHookExW(WH_KEYBOARD_LL, (LPVOID)lParam, DINPUT_instance, 0);
|
|
|
|
return (LRESULT)kbd_hook;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!kbd_hook) return 0;
|
|
|
|
res = UnhookWindowsHookEx(kbd_hook);
|
|
|
|
kbd_hook = NULL;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (wParam == WH_MOUSE_LL)
|
|
|
|
{
|
|
|
|
if (lParam)
|
|
|
|
{
|
|
|
|
if (mouse_hook) return 0;
|
|
|
|
mouse_hook = SetWindowsHookExW(WH_MOUSE_LL, (LPVOID)lParam, DINPUT_instance, 0);
|
|
|
|
return (LRESULT)mouse_hook;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!mouse_hook) return 0;
|
|
|
|
res = UnhookWindowsHookEx(mouse_hook);
|
|
|
|
mouse_hook = NULL;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case WM_DESTROY:
|
|
|
|
PostQuitMessage(0);
|
|
|
|
}
|
|
|
|
return DefWindowProcW(hWnd, message, wParam, lParam);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HANDLE signal_event;
|
|
|
|
|
|
|
|
static DWORD WINAPI hook_thread_proc(void *param)
|
|
|
|
{
|
|
|
|
static const WCHAR classW[]={'H','o','o','k','_','L','L','_','C','L',0};
|
|
|
|
MSG msg;
|
|
|
|
WNDCLASSEXW wcex;
|
|
|
|
HWND hwnd;
|
|
|
|
|
|
|
|
memset(&wcex, 0, sizeof(wcex));
|
|
|
|
wcex.cbSize = sizeof(wcex);
|
|
|
|
wcex.lpfnWndProc = dinput_hook_WndProc;
|
|
|
|
wcex.lpszClassName = classW;
|
|
|
|
wcex.hInstance = GetModuleHandleW(0);
|
|
|
|
|
|
|
|
if (!RegisterClassExW(&wcex)) ERR("Error registering window class\n");
|
|
|
|
hwnd = CreateWindowExW(0, classW, NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, 0);
|
|
|
|
*(HWND*)param = hwnd;
|
|
|
|
|
|
|
|
SetEvent(signal_event);
|
|
|
|
if (hwnd)
|
|
|
|
{
|
|
|
|
while (GetMessageW(&msg, 0, 0, 0))
|
|
|
|
{
|
|
|
|
TranslateMessage(&msg);
|
|
|
|
DispatchMessageW(&msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else ERR("Error creating message window\n");
|
|
|
|
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
UnregisterClassW(wcex.lpszClassName, wcex.hInstance);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static CRITICAL_SECTION dinput_hook_crit;
|
|
|
|
static CRITICAL_SECTION_DEBUG dinput_critsect_debug =
|
|
|
|
{
|
|
|
|
0, 0, &dinput_hook_crit,
|
|
|
|
{ &dinput_critsect_debug.ProcessLocksList, &dinput_critsect_debug.ProcessLocksList },
|
|
|
|
0, 0, { (DWORD_PTR)(__FILE__ ": dinput_hook_crit") }
|
|
|
|
};
|
|
|
|
static CRITICAL_SECTION dinput_hook_crit = { &dinput_critsect_debug, -1, 0, 0, 0, 0 };
|
|
|
|
|
|
|
|
static HWND get_thread_hwnd(void)
|
|
|
|
{
|
|
|
|
static HANDLE hook_thread;
|
|
|
|
static HWND hook_thread_hwnd;
|
|
|
|
|
|
|
|
EnterCriticalSection(&dinput_hook_crit);
|
|
|
|
if (!hook_thread)
|
|
|
|
{
|
|
|
|
DWORD tid;
|
|
|
|
HWND hwnd;
|
|
|
|
|
|
|
|
signal_event = CreateEventW(NULL, FALSE, FALSE, NULL);
|
|
|
|
hook_thread = CreateThread(NULL, 0, hook_thread_proc, &hwnd, 0, &tid);
|
|
|
|
if (signal_event && hook_thread)
|
|
|
|
{
|
|
|
|
HANDLE handles[2];
|
|
|
|
handles[0] = signal_event;
|
|
|
|
handles[1] = hook_thread;
|
|
|
|
WaitForMultipleObjects(2, handles, FALSE, INFINITE);
|
|
|
|
}
|
|
|
|
CloseHandle(signal_event);
|
|
|
|
|
|
|
|
if (!(hook_thread_hwnd = hwnd))
|
|
|
|
{
|
|
|
|
/* Thread failed to create window - reset things so we could try again later */
|
|
|
|
CloseHandle(hook_thread);
|
|
|
|
hook_thread = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LeaveCriticalSection(&dinput_hook_crit);
|
|
|
|
|
|
|
|
return hook_thread_hwnd;
|
|
|
|
}
|
|
|
|
|
|
|
|
HHOOK set_dinput_hook(int hook_id, LPVOID proc)
|
|
|
|
{
|
|
|
|
return (HHOOK)SendMessageW(get_thread_hwnd(), WM_USER+0x10, (WPARAM)hook_id, (LPARAM)proc);
|
|
|
|
}
|