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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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"
|
2007-09-25 03:34:27 +02:00
|
|
|
#include "winreg.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
|
|
|
|
2011-01-09 23:43:21 +01:00
|
|
|
static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
|
|
|
|
{
|
2011-01-09 23:44:19 +01:00
|
|
|
return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8A_iface);
|
2011-01-09 23:43:21 +01:00
|
|
|
}
|
|
|
|
static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
|
|
|
|
{
|
2011-01-09 23:44:19 +01:00
|
|
|
return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface);
|
2011-01-09 23:43:21 +01:00
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
static inline IDirectInputDevice8A *IDirectInputDevice8A_from_impl(IDirectInputDeviceImpl *This)
|
|
|
|
{
|
2011-01-09 23:44:19 +01:00
|
|
|
return &This->IDirectInputDevice8A_iface;
|
2011-01-09 23:43:55 +01:00
|
|
|
}
|
|
|
|
static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
|
|
|
|
{
|
2011-01-09 23:44:19 +01:00
|
|
|
return &This->IDirectInputDevice8W_iface;
|
2011-01-09 23:43:55 +01:00
|
|
|
}
|
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* Various debugging tools
|
|
|
|
*/
|
2008-12-03 12:13:37 +01:00
|
|
|
static 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),
|
2006-07-28 16:13:21 +02:00
|
|
|
FE(DISCL_NONEXCLUSIVE),
|
|
|
|
FE(DISCL_NOWINKEY)
|
2000-11-05 21:25:02 +01:00
|
|
|
#undef FE
|
2004-06-02 02:36:54 +02:00
|
|
|
};
|
2007-12-18 10:01:51 +01:00
|
|
|
TRACE(" cooperative level : ");
|
2004-06-02 02:36:54 +02:00
|
|
|
for (i = 0; i < (sizeof(flags) / sizeof(flags[0])); i++)
|
|
|
|
if (flags[i].mask & dwFlags)
|
2007-12-12 08:48:31 +01:00
|
|
|
TRACE("%s ",flags[i].name);
|
|
|
|
TRACE("\n");
|
2004-06-02 02:36:54 +02:00
|
|
|
}
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2008-12-03 12:13:37 +01:00
|
|
|
static 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);
|
2007-12-12 08:48:31 +01:00
|
|
|
TRACE("Type:");
|
2004-06-02 02:36:54 +02:00
|
|
|
if (type == DIDFT_ALL) {
|
2007-12-12 08:48:31 +01:00
|
|
|
TRACE(" DIDFT_ALL");
|
2004-06-02 02:36:54 +02:00
|
|
|
} else {
|
|
|
|
for (i = 0; i < (sizeof(flags) / sizeof(flags[0])); i++) {
|
|
|
|
if (flags[i].mask & type) {
|
|
|
|
type &= ~flags[i].mask;
|
2007-12-12 08:48:31 +01:00
|
|
|
TRACE(" %s",flags[i].name);
|
2004-06-02 02:36:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (type) {
|
2007-12-12 08:48:31 +01:00
|
|
|
TRACE(" (unhandled: %08x)", type);
|
2004-06-02 02:36:54 +02:00
|
|
|
}
|
|
|
|
}
|
2007-12-12 08:48:31 +01:00
|
|
|
TRACE(" / Instance: ");
|
2004-06-02 02:36:54 +02:00
|
|
|
if (instance == ((DIDFT_ANYINSTANCE >> 8) & 0xFFFF)) {
|
2007-12-12 08:48:31 +01:00
|
|
|
TRACE("DIDFT_ANYINSTANCE");
|
2004-06-02 02:36:54 +02:00
|
|
|
} else {
|
2007-12-12 08:48:31 +01:00
|
|
|
TRACE("%3d", instance);
|
2004-06-02 02:36:54 +02:00
|
|
|
}
|
|
|
|
}
|
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)) {
|
2007-12-12 08:48:31 +01:00
|
|
|
TRACE(" - dwObj = 0x%08x\n", diph->dwObj);
|
|
|
|
TRACE(" - dwHow = %s\n",
|
|
|
|
((diph->dwHow == DIPH_DEVICE) ? "DIPH_DEVICE" :
|
|
|
|
((diph->dwHow == DIPH_BYOFFSET) ? "DIPH_BYOFFSET" :
|
|
|
|
((diph->dwHow == DIPH_BYID)) ? "DIPH_BYID" : "unknown")));
|
2004-06-02 02:36:54 +02:00
|
|
|
}
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2007-04-24 08:45:32 +02:00
|
|
|
void _dump_OBJECTINSTANCEA(const DIDEVICEOBJECTINSTANCEA *ddoi) {
|
2007-12-12 08:48:31 +01:00
|
|
|
TRACE(" - enumerating : %s ('%s') - %2d - 0x%08x - %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
|
|
|
}
|
|
|
|
|
2007-04-24 08:45:32 +02:00
|
|
|
void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW *ddoi) {
|
2007-12-12 08:48:31 +01:00
|
|
|
TRACE(" - enumerating : %s ('%s'), - %2d - 0x%08x - %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
|
|
|
}
|
|
|
|
}
|
2008-07-06 06:24:37 +02:00
|
|
|
return debugstr_guid(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");
|
2006-10-08 01:55:40 +02:00
|
|
|
TRACE(" - dwSize: %d\n", df->dwSize);
|
2004-06-02 02:36:54 +02:00
|
|
|
if (df->dwSize != sizeof(DIDATAFORMAT)) {
|
2006-10-08 01:55:40 +02:00
|
|
|
WARN("Non-standard DIDATAFORMAT structure size %d\n", df->dwSize);
|
2004-06-02 02:36:54 +02:00
|
|
|
}
|
2006-10-08 01:55:40 +02:00
|
|
|
TRACE(" - dwObjsize: %d\n", df->dwObjSize);
|
2004-06-02 02:36:54 +02:00
|
|
|
if (df->dwObjSize != sizeof(DIOBJECTDATAFORMAT)) {
|
2006-10-08 01:55:40 +02:00
|
|
|
WARN("Non-standard DIOBJECTDATAFORMAT structure size %d\n", df->dwObjSize);
|
2004-06-02 02:36:54 +02:00
|
|
|
}
|
2006-10-08 01:55:40 +02:00
|
|
|
TRACE(" - dwFlags: 0x%08x (", df->dwFlags);
|
2004-06-02 02:36:54 +02:00
|
|
|
switch (df->dwFlags) {
|
|
|
|
case DIDF_ABSAXIS: TRACE("DIDF_ABSAXIS"); break;
|
|
|
|
case DIDF_RELAXIS: TRACE("DIDF_RELAXIS"); break;
|
|
|
|
default: TRACE("unknown"); break;
|
|
|
|
}
|
|
|
|
TRACE(")\n");
|
2006-10-08 01:55:40 +02:00
|
|
|
TRACE(" - dwDataSize: %d\n", df->dwDataSize);
|
|
|
|
TRACE(" - dwNumObjs: %d\n", df->dwNumObjs);
|
2004-06-02 02:36:54 +02:00
|
|
|
|
|
|
|
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));
|
2006-10-08 01:55:40 +02:00
|
|
|
TRACE(" * dwOfs: %d\n", df->rgodf[i].dwOfs);
|
|
|
|
TRACE(" * dwType: 0x%08x\n", df->rgodf[i].dwType);
|
2004-06-02 02:36:54 +02:00
|
|
|
TRACE(" "); _dump_EnumObjects_flags(df->rgodf[i].dwType); TRACE("\n");
|
2006-10-08 01:55:40 +02:00
|
|
|
TRACE(" * dwFlags: 0x%08x\n", df->rgodf[i].dwFlags);
|
2004-06-02 02:36:54 +02:00
|
|
|
}
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2007-09-25 03:34:32 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* Get the default and the app-specific config keys.
|
|
|
|
*/
|
|
|
|
BOOL get_app_key(HKEY *defkey, HKEY *appkey)
|
|
|
|
{
|
|
|
|
char buffer[MAX_PATH+16];
|
|
|
|
DWORD len;
|
|
|
|
|
|
|
|
*appkey = 0;
|
|
|
|
|
|
|
|
/* @@ Wine registry key: HKCU\Software\Wine\DirectInput */
|
|
|
|
if (RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\DirectInput", defkey))
|
|
|
|
*defkey = 0;
|
|
|
|
|
|
|
|
len = GetModuleFileNameA(0, buffer, MAX_PATH);
|
|
|
|
if (len && len < MAX_PATH)
|
|
|
|
{
|
|
|
|
HKEY tmpkey;
|
|
|
|
|
|
|
|
/* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\DirectInput */
|
|
|
|
if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\AppDefaults", &tmpkey))
|
|
|
|
{
|
|
|
|
char *p, *appname = buffer;
|
|
|
|
if ((p = strrchr(appname, '/'))) appname = p + 1;
|
|
|
|
if ((p = strrchr(appname, '\\'))) appname = p + 1;
|
|
|
|
strcat(appname, "\\DirectInput");
|
|
|
|
|
2007-09-29 18:23:11 +02:00
|
|
|
if (RegOpenKeyA(tmpkey, appname, appkey)) *appkey = 0;
|
2007-09-25 03:34:32 +02:00
|
|
|
RegCloseKey(tmpkey);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return *defkey || *appkey;
|
|
|
|
}
|
|
|
|
|
2007-09-25 03:34:27 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* Get a config key from either the app-specific or the default config
|
|
|
|
*/
|
|
|
|
DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name,
|
|
|
|
char *buffer, DWORD size )
|
|
|
|
{
|
|
|
|
if (appkey && !RegQueryValueExA( appkey, name, 0, NULL, (LPBYTE)buffer, &size ))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (defkey && !RegQueryValueExA( defkey, name, 0, NULL, (LPBYTE)buffer, &size ))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return ERROR_FILE_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
/* Conversion between internal data buffer and external data buffer */
|
2008-07-27 17:53:34 +02:00
|
|
|
void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df)
|
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
int i;
|
2006-09-08 17:35:27 +02:00
|
|
|
const char *in_c = in;
|
2009-01-28 10:24:42 +01:00
|
|
|
char *out_c = out;
|
2006-09-08 17:35:27 +02:00
|
|
|
|
2008-07-27 17:53:34 +02:00
|
|
|
memset(out, 0, size);
|
2004-06-02 02:36:54 +02:00
|
|
|
if (df->dt == NULL) {
|
|
|
|
/* This means that the app uses Wine's internal data format */
|
2009-01-08 06:43:27 +01:00
|
|
|
memcpy(out, in, min(size, df->internal_format_size));
|
2004-06-02 02:36:54 +02:00
|
|
|
} 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",
|
2006-09-08 17:35:27 +02:00
|
|
|
df->dt[i].offset_out, df->dt[i].offset_in, *(in_c + df->dt[i].offset_in));
|
|
|
|
*(out_c + df->dt[i].offset_out) = *(in_c + df->dt[i].offset_in);
|
2004-06-02 02:36:54 +02:00
|
|
|
break;
|
2006-09-08 17:35:27 +02:00
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
case 2:
|
|
|
|
TRACE("Copying (s) to %d from %d (value %d)\n",
|
2006-09-08 17:35:27 +02:00
|
|
|
df->dt[i].offset_out, df->dt[i].offset_in, *((const short *)(in_c + df->dt[i].offset_in)));
|
|
|
|
*((short *)(out_c + df->dt[i].offset_out)) = *((const short *)(in_c + df->dt[i].offset_in));
|
2004-06-02 02:36:54 +02:00
|
|
|
break;
|
2006-09-08 17:35:27 +02:00
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
case 4:
|
|
|
|
TRACE("Copying (i) to %d from %d (value %d)\n",
|
2006-09-08 17:35:27 +02:00
|
|
|
df->dt[i].offset_out, df->dt[i].offset_in, *((const int *)(in_c + df->dt[i].offset_in)));
|
|
|
|
*((int *)(out_c + df->dt[i].offset_out)) = *((const int *)(in_c + df->dt[i].offset_in));
|
2004-06-02 02:36:54 +02:00
|
|
|
break;
|
2006-09-08 17:35:27 +02:00
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
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);
|
2006-09-08 17:35:27 +02:00
|
|
|
*(out_c + df->dt[i].offset_out) = (char) df->dt[i].value;
|
2004-06-02 02:36:54 +02:00
|
|
|
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);
|
2007-12-06 21:58:42 +01:00
|
|
|
*((int *) (out_c + df->dt[i].offset_out)) = df->dt[i].value;
|
2004-06-02 02:36:54 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2006-07-13 23:06:17 +02:00
|
|
|
memset((out_c + df->dt[i].offset_out), 0, df->dt[i].size);
|
2004-06-02 02:36:54 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-09-02 22:09:54 +02:00
|
|
|
void release_DataFormat(DataFormat * format)
|
|
|
|
{
|
2006-12-12 16:57:54 +01:00
|
|
|
TRACE("Deleting DataFormat: %p\n", format);
|
2004-09-02 22:09:54 +02:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, format->dt);
|
2006-12-12 16:57:54 +01:00
|
|
|
format->dt = NULL;
|
|
|
|
HeapFree(GetProcessHeap(), 0, format->offsets);
|
|
|
|
format->offsets = NULL;
|
2006-12-12 16:58:02 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, format->user_df);
|
|
|
|
format->user_df = NULL;
|
2004-09-02 22:09:54 +02:00
|
|
|
}
|
|
|
|
|
2008-12-03 12:13:37 +01:00
|
|
|
static inline LPDIOBJECTDATAFORMAT dataformat_to_odf(LPCDIDATAFORMAT df, int idx)
|
2007-01-04 07:04:24 +01:00
|
|
|
{
|
|
|
|
if (idx < 0 || idx >= df->dwNumObjs) return NULL;
|
|
|
|
return (LPDIOBJECTDATAFORMAT)((LPBYTE)df->rgodf + idx * df->dwObjSize);
|
|
|
|
}
|
|
|
|
|
2011-07-21 20:36:31 +02:00
|
|
|
/* dataformat_to_odf_by_type
|
|
|
|
* Find the Nth object of the selected type in the DataFormat
|
|
|
|
*/
|
|
|
|
LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type(LPCDIDATAFORMAT df, int n, DWORD type)
|
|
|
|
{
|
|
|
|
int i, nfound = 0;
|
|
|
|
|
|
|
|
for (i=0; i < df->dwNumObjs; i++)
|
|
|
|
{
|
|
|
|
LPDIOBJECTDATAFORMAT odf = dataformat_to_odf(df, i);
|
|
|
|
|
|
|
|
if (odf->dwType & type)
|
|
|
|
{
|
|
|
|
if (n == nfound)
|
|
|
|
return odf;
|
|
|
|
|
|
|
|
nfound++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-12-03 12:13:37 +01:00
|
|
|
static HRESULT create_DataFormat(LPCDIDATAFORMAT asked_format, DataFormat *format)
|
2006-12-10 22:15:20 +01:00
|
|
|
{
|
2004-06-02 02:36:54 +02:00
|
|
|
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;
|
2006-12-12 16:58:40 +01:00
|
|
|
|
|
|
|
if (!format->wine_df) return DIERR_INVALIDPARAM;
|
2006-12-12 16:57:54 +01:00
|
|
|
done = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, asked_format->dwNumObjs * sizeof(int));
|
2005-03-24 22:01:35 +01:00
|
|
|
dt = HeapAlloc(GetProcessHeap(), 0, asked_format->dwNumObjs * sizeof(DataTransform));
|
2006-12-12 16:57:54 +01:00
|
|
|
if (!dt || !done) goto failed;
|
|
|
|
|
2006-12-12 16:58:40 +01:00
|
|
|
if (!(format->offsets = HeapAlloc(GetProcessHeap(), 0, format->wine_df->dwNumObjs * sizeof(int))))
|
2006-12-12 16:57:54 +01:00
|
|
|
goto failed;
|
|
|
|
|
2006-12-12 16:58:02 +01:00
|
|
|
if (!(format->user_df = HeapAlloc(GetProcessHeap(), 0, asked_format->dwSize)))
|
|
|
|
goto failed;
|
|
|
|
memcpy(format->user_df, asked_format, asked_format->dwSize);
|
|
|
|
|
2005-11-10 13:14:56 +01:00
|
|
|
TRACE("Creating DataTransform :\n");
|
2004-06-02 02:36:54 +02:00
|
|
|
|
2006-12-12 16:58:40 +01:00
|
|
|
for (i = 0; i < format->wine_df->dwNumObjs; i++)
|
|
|
|
{
|
2006-12-12 16:57:54 +01:00
|
|
|
format->offsets[i] = -1;
|
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
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) ||
|
2006-12-12 16:58:40 +01:00
|
|
|
(format->wine_df->rgodf[i].pguid == NULL) ||
|
|
|
|
(IsEqualGUID(format->wine_df->rgodf[i].pguid, asked_format->rgodf[j].pguid)))
|
2004-06-02 02:36:54 +02:00
|
|
|
&&
|
|
|
|
(/* Then check if it accepts any instance id, and if not, if it matches Wine's
|
|
|
|
* instance id.
|
|
|
|
*/
|
2006-12-20 12:28:58 +01:00
|
|
|
((asked_format->rgodf[j].dwType & DIDFT_INSTANCEMASK) == DIDFT_ANYINSTANCE) ||
|
2011-07-30 12:03:08 +02:00
|
|
|
(DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType) == 0x00FF) || /* This is mentioned in no DX docs, but it works fine - tested on WinXP */
|
2006-12-12 16:58:40 +01:00
|
|
|
(DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType) == DIDFT_GETINSTANCE(format->wine_df->rgodf[i].dwType)))
|
2005-05-05 11:49:54 +02:00
|
|
|
&&
|
|
|
|
( /* Then if the asked type matches the one Wine provides */
|
2006-12-12 16:58:40 +01:00
|
|
|
DIDFT_GETTYPE(asked_format->rgodf[j].dwType) & format->wine_df->rgodf[i].dwType))
|
2006-12-10 07:56:58 +01:00
|
|
|
{
|
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));
|
2006-10-08 01:55:40 +02:00
|
|
|
TRACE(" * Offset: %3d\n", asked_format->rgodf[j].dwOfs);
|
|
|
|
TRACE(" * dwType: %08x\n", asked_format->rgodf[j].dwType);
|
2004-06-02 02:36:54 +02:00
|
|
|
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",
|
2006-12-12 16:58:40 +01:00
|
|
|
debugstr_guid(format->wine_df->rgodf[i].pguid),
|
|
|
|
_dump_dinput_GUID(format->wine_df->rgodf[i].pguid));
|
|
|
|
TRACE(" * Offset: %3d\n", format->wine_df->rgodf[i].dwOfs);
|
|
|
|
TRACE(" * dwType: %08x\n", format->wine_df->rgodf[i].dwType);
|
|
|
|
TRACE(" "); _dump_EnumObjects_flags(format->wine_df->rgodf[i].dwType); TRACE("\n");
|
2004-06-02 02:36:54 +02:00
|
|
|
|
2006-12-12 16:58:40 +01:00
|
|
|
if (format->wine_df->rgodf[i].dwType & DIDFT_BUTTON)
|
2004-06-02 02:36:54 +02:00
|
|
|
dt[index].size = sizeof(BYTE);
|
|
|
|
else
|
|
|
|
dt[index].size = sizeof(DWORD);
|
2006-12-12 16:58:40 +01:00
|
|
|
dt[index].offset_in = format->wine_df->rgodf[i].dwOfs;
|
2006-12-11 01:10:34 +01:00
|
|
|
dt[index].offset_out = asked_format->rgodf[j].dwOfs;
|
2006-12-12 16:57:54 +01:00
|
|
|
format->offsets[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
|
|
|
|
2006-12-12 16:58:40 +01:00
|
|
|
if (format->wine_df->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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-01-04 01:53:22 +01:00
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
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));
|
2006-10-08 01:55:40 +02:00
|
|
|
TRACE(" * Offset: %3d\n", asked_format->rgodf[j].dwOfs);
|
|
|
|
TRACE(" * dwType: %08x\n", asked_format->rgodf[j].dwType);
|
2004-06-02 02:36:54 +02:00
|
|
|
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;
|
2008-05-08 16:11:19 +02:00
|
|
|
if (asked_format->rgodf[j].dwType & DIDFT_POV)
|
|
|
|
dt[index].value = -1;
|
|
|
|
else
|
|
|
|
dt[index].value = 0;
|
2004-06-02 02:36:54 +02:00
|
|
|
index++;
|
2008-05-08 16:11:19 +02:00
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
same = 0;
|
|
|
|
}
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
2004-06-02 02:36:54 +02:00
|
|
|
|
2006-12-12 16:58:40 +01:00
|
|
|
format->internal_format_size = format->wine_df->dwDataSize;
|
2006-12-12 16:57:54 +01:00
|
|
|
format->size = index;
|
2004-06-02 02:36:54 +02:00
|
|
|
if (same) {
|
|
|
|
HeapFree(GetProcessHeap(), 0, dt);
|
2006-12-12 16:57:54 +01:00
|
|
|
dt = NULL;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
2006-12-12 16:57:54 +01:00
|
|
|
format->dt = dt;
|
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, done);
|
2006-12-10 22:15:20 +01:00
|
|
|
|
2006-12-12 16:57:54 +01:00
|
|
|
return DI_OK;
|
|
|
|
|
|
|
|
failed:
|
|
|
|
HeapFree(GetProcessHeap(), 0, done);
|
|
|
|
HeapFree(GetProcessHeap(), 0, dt);
|
|
|
|
format->dt = NULL;
|
|
|
|
HeapFree(GetProcessHeap(), 0, format->offsets);
|
|
|
|
format->offsets = NULL;
|
2006-12-12 16:58:02 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, format->user_df);
|
|
|
|
format->user_df = NULL;
|
2006-12-12 16:57:54 +01:00
|
|
|
|
|
|
|
return DIERR_OUTOFMEMORY;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2006-12-10 22:15:29 +01:00
|
|
|
/* find an object by it's offset in a data format */
|
2007-04-24 08:45:32 +02:00
|
|
|
static int offset_to_object(const DataFormat *df, int offset)
|
2006-12-10 22:15:29 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2007-01-09 21:44:54 +01:00
|
|
|
if (!df->offsets) return -1;
|
|
|
|
|
|
|
|
for (i = 0; i < df->wine_df->dwNumObjs; i++)
|
|
|
|
if (df->offsets[i] == offset) return i;
|
2006-12-10 22:15:29 +01:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2007-08-05 20:18:26 +02:00
|
|
|
int id_to_object(LPCDIDATAFORMAT df, int id)
|
2006-12-10 22:15:29 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2007-01-06 01:14:55 +01:00
|
|
|
id &= 0x00ffffff;
|
2006-12-10 22:15:29 +01:00
|
|
|
for (i = 0; i < df->dwNumObjs; i++)
|
2007-01-06 01:14:55 +01:00
|
|
|
if ((dataformat_to_odf(df, i)->dwType & 0x00ffffff) == id)
|
2006-12-10 22:15:29 +01:00
|
|
|
return i;
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-12-02 12:13:14 +01:00
|
|
|
static int id_to_offset(const DataFormat *df, int id)
|
2007-01-06 01:14:55 +01:00
|
|
|
{
|
|
|
|
int obj = id_to_object(df->wine_df, id);
|
|
|
|
|
|
|
|
return obj >= 0 && df->offsets ? df->offsets[obj] : -1;
|
|
|
|
}
|
|
|
|
|
2007-04-24 08:45:32 +02:00
|
|
|
int find_property(const DataFormat *df, LPCDIPROPHEADER ph)
|
2006-12-10 22:15:29 +01:00
|
|
|
{
|
|
|
|
switch (ph->dwHow)
|
|
|
|
{
|
2007-01-09 21:44:54 +01:00
|
|
|
case DIPH_BYID: return id_to_object(df->wine_df, ph->dwObj);
|
|
|
|
case DIPH_BYOFFSET: return offset_to_object(df, ph->dwObj);
|
2006-12-10 22:15:29 +01:00
|
|
|
}
|
|
|
|
FIXME("Unhandled ph->dwHow=='%04X'\n", (unsigned int)ph->dwHow);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2011-09-02 10:51:12 +02:00
|
|
|
static DWORD semantic_to_obj_id(IDirectInputDeviceImpl* This, DWORD dwSemantic)
|
2011-07-02 06:06:37 +02:00
|
|
|
{
|
|
|
|
DWORD type = (0x0000ff00 & dwSemantic) >> 8;
|
|
|
|
DWORD offset = 0x000000ff & dwSemantic;
|
|
|
|
DWORD obj_instance = 0;
|
|
|
|
DWORD found = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < This->data_format.wine_df->dwNumObjs; i++)
|
|
|
|
{
|
|
|
|
LPDIOBJECTDATAFORMAT odf = dataformat_to_odf(This->data_format.wine_df, i);
|
|
|
|
|
|
|
|
if (odf->dwOfs == offset)
|
|
|
|
{
|
|
|
|
obj_instance = DIDFT_GETINSTANCE(odf->dwType);
|
|
|
|
found = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!found) return 0;
|
|
|
|
|
|
|
|
if (type & DIDFT_AXIS) type = DIDFT_RELAXIS;
|
|
|
|
if (type & DIDFT_BUTTON) type = DIDFT_PSHBUTTON;
|
|
|
|
|
|
|
|
return type | (0x0000ff00 & (obj_instance << 8));
|
|
|
|
}
|
|
|
|
|
2012-08-24 19:04:52 +02:00
|
|
|
/*
|
|
|
|
* get_mapping_key
|
|
|
|
* Retrieves an open registry key to save the mapping, parametrized for an username,
|
|
|
|
* specific device and specific action mapping guid.
|
|
|
|
*/
|
|
|
|
static HKEY get_mapping_key(const WCHAR *device, const WCHAR *username, const WCHAR *guid)
|
|
|
|
{
|
|
|
|
static const WCHAR subkey[] = {
|
|
|
|
'S','o','f','t','w','a','r','e','\\',
|
|
|
|
'W','i','n','e','\\',
|
|
|
|
'D','i','r','e','c','t','I','n','p','u','t','\\',
|
|
|
|
'M','a','p','p','i','n','g','s','\\','%','s','\\','%','s','\\','%','s','\0'};
|
|
|
|
HKEY hkey;
|
|
|
|
WCHAR *keyname;
|
|
|
|
|
|
|
|
keyname = HeapAlloc(GetProcessHeap(), 0,
|
|
|
|
sizeof(WCHAR) * (lstrlenW(subkey) + strlenW(username) + strlenW(device) + strlenW(guid)));
|
|
|
|
sprintfW(keyname, subkey, username, device, guid);
|
|
|
|
|
|
|
|
/* The key used is HKCU\Software\Wine\DirectInput\Mappings\[username]\[device]\[mapping_guid] */
|
|
|
|
if (RegCreateKeyW(HKEY_CURRENT_USER, keyname, &hkey))
|
|
|
|
hkey = 0;
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, keyname);
|
|
|
|
|
|
|
|
return hkey;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUsername)
|
|
|
|
{
|
|
|
|
WCHAR *guid_str = NULL;
|
|
|
|
DIDEVICEINSTANCEW didev;
|
|
|
|
HKEY hkey;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
didev.dwSize = sizeof(didev);
|
|
|
|
IDirectInputDevice8_GetDeviceInfo(iface, &didev);
|
|
|
|
|
|
|
|
if (StringFromCLSID(&lpdiaf->guidActionMap, &guid_str) != S_OK)
|
|
|
|
return DI_SETTINGSNOTSAVED;
|
|
|
|
|
|
|
|
hkey = get_mapping_key(didev.tszInstanceName, lpszUsername, guid_str);
|
|
|
|
|
|
|
|
if (!hkey)
|
|
|
|
{
|
|
|
|
CoTaskMemFree(guid_str);
|
|
|
|
return DI_SETTINGSNOTSAVED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Write each of the actions mapped for this device.
|
|
|
|
Format is "dwSemantic"="dwObjID" and key is of type REG_DWORD
|
|
|
|
*/
|
|
|
|
for (i = 0; i < lpdiaf->dwNumActions; i++)
|
|
|
|
{
|
|
|
|
static const WCHAR format[] = {'%','x','\0'};
|
|
|
|
WCHAR label[9];
|
|
|
|
|
|
|
|
if (IsEqualGUID(&didev.guidInstance, &lpdiaf->rgoAction[i].guidInstance) &&
|
|
|
|
lpdiaf->rgoAction[i].dwHow != DIAH_UNMAPPED)
|
|
|
|
{
|
|
|
|
sprintfW(label, format, lpdiaf->rgoAction[i].dwSemantic);
|
|
|
|
RegSetValueExW(hkey, label, 0, REG_DWORD, (const BYTE*) &lpdiaf->rgoAction[i].dwObjID, sizeof(DWORD));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
CoTaskMemFree(guid_str);
|
|
|
|
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdiaf, const WCHAR *username)
|
|
|
|
{
|
|
|
|
HKEY hkey;
|
|
|
|
WCHAR *guid_str;
|
|
|
|
DIDEVICEINSTANCEW didev;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
didev.dwSize = sizeof(didev);
|
|
|
|
IDirectInputDevice8_GetDeviceInfo(&This->IDirectInputDevice8W_iface, &didev);
|
|
|
|
|
|
|
|
if (StringFromCLSID(&lpdiaf->guidActionMap, &guid_str) != S_OK)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
hkey = get_mapping_key(didev.tszInstanceName, username, guid_str);
|
|
|
|
|
|
|
|
if (!hkey)
|
|
|
|
{
|
|
|
|
CoTaskMemFree(guid_str);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Try to read each action in the DIACTIONFORMAT from registry */
|
|
|
|
for (i = 0; i < lpdiaf->dwNumActions; i++)
|
|
|
|
{
|
|
|
|
static const WCHAR format[] = {'%','x','\0'};
|
|
|
|
DWORD id, size = sizeof(DWORD);
|
|
|
|
WCHAR label[9];
|
|
|
|
|
|
|
|
sprintfW(label, format, lpdiaf->rgoAction[i].dwSemantic);
|
|
|
|
|
|
|
|
if (!RegQueryValueExW(hkey, label, 0, NULL, (LPBYTE) &id, &size))
|
|
|
|
{
|
|
|
|
lpdiaf->rgoAction[i].dwObjID = id;
|
|
|
|
lpdiaf->rgoAction[i].guidInstance = didev.guidInstance;
|
|
|
|
lpdiaf->rgoAction[i].dwHow = DIAH_USERCONFIG;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
CoTaskMemFree(guid_str);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-08-24 04:42:49 +02:00
|
|
|
HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, DWORD devMask, LPCDIDATAFORMAT df)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
2012-08-24 19:04:52 +02:00
|
|
|
WCHAR username[MAX_PATH];
|
|
|
|
DWORD username_size = MAX_PATH;
|
2011-08-24 04:42:49 +02:00
|
|
|
int i, has_actions = 0;
|
2012-08-24 19:04:52 +02:00
|
|
|
BOOL load_success = FALSE;
|
|
|
|
|
|
|
|
/* Unless asked the contrary by these flags, try to load a previous mapping */
|
|
|
|
if (!(dwFlags & DIDBAM_HWDEFAULTS))
|
|
|
|
{
|
|
|
|
/* Retrieve logged user name if necessary */
|
|
|
|
if (lpszUserName == NULL)
|
|
|
|
GetUserNameW(username, &username_size);
|
|
|
|
else
|
|
|
|
lstrcpynW(username, lpszUserName, MAX_PATH);
|
|
|
|
|
|
|
|
load_success = load_mapping_settings(This, lpdiaf, username);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (load_success) return DI_OK;
|
2011-08-24 04:42:49 +02:00
|
|
|
|
|
|
|
for (i=0; i < lpdiaf->dwNumActions; i++)
|
|
|
|
{
|
2012-07-03 09:13:55 +02:00
|
|
|
/* Don't touch a user configured action */
|
2011-08-24 04:42:51 +02:00
|
|
|
if (lpdiaf->rgoAction[i].dwHow == DIAH_USERCONFIG) continue;
|
|
|
|
|
2011-08-24 04:42:49 +02:00
|
|
|
if ((lpdiaf->rgoAction[i].dwSemantic & devMask) == devMask)
|
|
|
|
{
|
|
|
|
DWORD obj_id = semantic_to_obj_id(This, lpdiaf->rgoAction[i].dwSemantic);
|
|
|
|
DWORD type = DIDFT_GETTYPE(obj_id);
|
|
|
|
DWORD inst = DIDFT_GETINSTANCE(obj_id);
|
|
|
|
|
|
|
|
LPDIOBJECTDATAFORMAT odf;
|
|
|
|
|
|
|
|
if (type == DIDFT_PSHBUTTON) type = DIDFT_BUTTON;
|
|
|
|
if (type == DIDFT_RELAXIS) type = DIDFT_AXIS;
|
|
|
|
|
2012-07-03 09:13:55 +02:00
|
|
|
/* Make sure the object exists */
|
2011-08-24 04:42:49 +02:00
|
|
|
odf = dataformat_to_odf_by_type(df, inst, type);
|
|
|
|
|
|
|
|
if (odf != NULL)
|
|
|
|
{
|
|
|
|
lpdiaf->rgoAction[i].dwObjID = obj_id;
|
|
|
|
lpdiaf->rgoAction[i].guidInstance = This->guid;
|
|
|
|
lpdiaf->rgoAction[i].dwHow = DIAH_DEFAULT;
|
|
|
|
has_actions = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!(dwFlags & DIDBAM_PRESERVE))
|
|
|
|
{
|
2012-07-03 09:13:55 +02:00
|
|
|
/* We must clear action data belonging to other devices */
|
2011-08-24 04:42:49 +02:00
|
|
|
memset(&lpdiaf->rgoAction[i].guidInstance, 0, sizeof(GUID));
|
|
|
|
lpdiaf->rgoAction[i].dwHow = DIAH_UNMAPPED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!has_actions) return DI_NOEFFECT;
|
|
|
|
|
|
|
|
return IDirectInputDevice8WImpl_BuildActionMap(iface, lpdiaf, lpszUserName, dwFlags);
|
|
|
|
}
|
|
|
|
|
2011-08-24 04:42:50 +02:00
|
|
|
HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, LPCDIDATAFORMAT df)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
|
|
|
DIDATAFORMAT data_format;
|
|
|
|
DIOBJECTDATAFORMAT *obj_df = NULL;
|
|
|
|
DIPROPDWORD dp;
|
|
|
|
DIPROPRANGE dpr;
|
2012-08-24 19:04:52 +02:00
|
|
|
WCHAR username[MAX_PATH];
|
|
|
|
DWORD username_size = MAX_PATH;
|
2011-08-24 04:42:50 +02:00
|
|
|
int i, action = 0, num_actions = 0;
|
|
|
|
unsigned int offset = 0;
|
|
|
|
|
|
|
|
if (This->acquired) return DIERR_ACQUIRED;
|
|
|
|
|
|
|
|
data_format.dwSize = sizeof(data_format);
|
|
|
|
data_format.dwObjSize = sizeof(DIOBJECTDATAFORMAT);
|
|
|
|
data_format.dwFlags = DIDF_RELAXIS;
|
|
|
|
data_format.dwDataSize = lpdiaf->dwDataSize;
|
|
|
|
|
|
|
|
/* Count the actions */
|
|
|
|
for (i=0; i < lpdiaf->dwNumActions; i++)
|
|
|
|
if (IsEqualGUID(&This->guid, &lpdiaf->rgoAction[i].guidInstance))
|
|
|
|
num_actions++;
|
|
|
|
|
|
|
|
if (num_actions == 0) return DI_NOEFFECT;
|
|
|
|
|
|
|
|
This->num_actions = num_actions;
|
|
|
|
|
|
|
|
/* Construct the dataformat and actionmap */
|
|
|
|
obj_df = HeapAlloc(GetProcessHeap(), 0, sizeof(DIOBJECTDATAFORMAT)*num_actions);
|
|
|
|
data_format.rgodf = (LPDIOBJECTDATAFORMAT)obj_df;
|
|
|
|
data_format.dwNumObjs = num_actions;
|
|
|
|
|
2011-08-24 04:42:52 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, This->action_map);
|
2011-08-24 04:42:50 +02:00
|
|
|
This->action_map = HeapAlloc(GetProcessHeap(), 0, sizeof(ActionMap)*num_actions);
|
|
|
|
|
|
|
|
for (i = 0; i < lpdiaf->dwNumActions; i++)
|
|
|
|
{
|
|
|
|
if (IsEqualGUID(&This->guid, &lpdiaf->rgoAction[i].guidInstance))
|
|
|
|
{
|
|
|
|
DWORD inst = DIDFT_GETINSTANCE(lpdiaf->rgoAction[i].dwObjID);
|
|
|
|
DWORD type = DIDFT_GETTYPE(lpdiaf->rgoAction[i].dwObjID);
|
|
|
|
LPDIOBJECTDATAFORMAT obj;
|
|
|
|
|
|
|
|
if (type == DIDFT_PSHBUTTON) type = DIDFT_BUTTON;
|
|
|
|
if (type == DIDFT_RELAXIS) type = DIDFT_AXIS;
|
|
|
|
|
|
|
|
obj = dataformat_to_odf_by_type(df, inst, type);
|
|
|
|
|
|
|
|
memcpy(&obj_df[action], obj, df->dwObjSize);
|
|
|
|
|
|
|
|
This->action_map[action].uAppData = lpdiaf->rgoAction[i].uAppData;
|
|
|
|
This->action_map[action].offset = offset;
|
|
|
|
obj_df[action].dwOfs = offset;
|
|
|
|
offset += (type & DIDFT_BUTTON) ? 1 : 4;
|
|
|
|
|
|
|
|
action++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
IDirectInputDevice8_SetDataFormat(iface, &data_format);
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, obj_df);
|
|
|
|
|
|
|
|
/* Set the device properties according to the action format */
|
|
|
|
dpr.diph.dwSize = sizeof(DIPROPRANGE);
|
|
|
|
dpr.lMin = lpdiaf->lAxisMin;
|
|
|
|
dpr.lMax = lpdiaf->lAxisMax;
|
|
|
|
dpr.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
|
|
|
dpr.diph.dwHow = DIPH_DEVICE;
|
|
|
|
IDirectInputDevice8_SetProperty(iface, DIPROP_RANGE, &dpr.diph);
|
|
|
|
|
|
|
|
if (lpdiaf->dwBufferSize > 0)
|
|
|
|
{
|
|
|
|
dp.diph.dwSize = sizeof(DIPROPDWORD);
|
|
|
|
dp.dwData = lpdiaf->dwBufferSize;
|
|
|
|
dp.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
|
|
|
dp.diph.dwHow = DIPH_DEVICE;
|
|
|
|
IDirectInputDevice8_SetProperty(iface, DIPROP_BUFFERSIZE, &dp.diph);
|
|
|
|
}
|
|
|
|
|
2012-08-24 19:04:52 +02:00
|
|
|
/* Retrieve logged user name if necessary */
|
|
|
|
if (lpszUserName == NULL)
|
|
|
|
GetUserNameW(username, &username_size);
|
|
|
|
else
|
|
|
|
lstrcpynW(username, lpszUserName, MAX_PATH);
|
|
|
|
|
|
|
|
/* Save the settings to disk */
|
|
|
|
save_mapping_settings(iface, lpdiaf, username);
|
|
|
|
|
2011-08-24 04:42:50 +02:00
|
|
|
return IDirectInputDevice8WImpl_SetActionMap(iface, lpdiaf, lpszUserName, dwFlags);
|
|
|
|
}
|
|
|
|
|
2006-12-04 18:54:05 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* queue_event - add new event to the ring queue
|
|
|
|
*/
|
|
|
|
|
2009-11-30 05:07:25 +01:00
|
|
|
void queue_event(LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD time, DWORD seq)
|
2006-12-04 18:54:05 +01:00
|
|
|
{
|
2011-01-09 23:43:21 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
2009-11-30 05:07:25 +01:00
|
|
|
int next_pos, ofs = id_to_offset(&This->data_format, inst_id);
|
2006-12-04 18:54:05 +01:00
|
|
|
|
2007-04-08 17:05:56 +02:00
|
|
|
/* Event is being set regardless of the queue state */
|
|
|
|
if (This->hEvent) SetEvent(This->hEvent);
|
|
|
|
|
2006-12-04 18:54:05 +01:00
|
|
|
if (!This->queue_len || This->overflow || ofs < 0) return;
|
|
|
|
|
|
|
|
next_pos = (This->queue_head + 1) % This->queue_len;
|
|
|
|
if (next_pos == This->queue_tail)
|
|
|
|
{
|
|
|
|
TRACE(" queue overflowed\n");
|
|
|
|
This->overflow = TRUE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE(" queueing %d at offset %d (queue head %d / size %d)\n",
|
|
|
|
data, ofs, This->queue_head, This->queue_len);
|
|
|
|
|
|
|
|
This->data_queue[This->queue_head].dwOfs = ofs;
|
|
|
|
This->data_queue[This->queue_head].dwData = data;
|
|
|
|
This->data_queue[This->queue_head].dwTimeStamp = time;
|
|
|
|
This->data_queue[This->queue_head].dwSequence = seq;
|
2011-07-02 06:07:15 +02:00
|
|
|
|
|
|
|
/* Set uAppData by means of action mapping */
|
|
|
|
if (This->num_actions > 0)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i=0; i < This->num_actions; i++)
|
|
|
|
{
|
|
|
|
if (This->action_map[i].offset == ofs)
|
|
|
|
{
|
|
|
|
TRACE("Offset %d mapped to uAppData %lu\n", ofs, This->action_map[i].uAppData);
|
|
|
|
This->data_queue[This->queue_head].uAppData = This->action_map[i].uAppData;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-04 18:54:05 +01:00
|
|
|
This->queue_head = next_pos;
|
2007-01-07 08:14:56 +01:00
|
|
|
/* Send event if asked */
|
2006-12-04 18:54:05 +01:00
|
|
|
}
|
|
|
|
|
2006-12-01 18:54:42 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* Acquire
|
|
|
|
*/
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
|
2006-12-01 18:54:42 +01:00
|
|
|
{
|
2011-01-09 23:43:55 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
2006-12-01 18:56:00 +01:00
|
|
|
HRESULT res;
|
2006-12-01 18:54:42 +01:00
|
|
|
|
2011-10-20 15:42:44 +02:00
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
2006-12-12 16:58:02 +01:00
|
|
|
if (!This->data_format.user_df) return DIERR_INVALIDPARAM;
|
2007-06-03 17:09:35 +02:00
|
|
|
if (This->dwCoopLevel & DISCL_FOREGROUND && This->win != GetForegroundWindow())
|
|
|
|
return DIERR_OTHERAPPHASPRIO;
|
2006-12-12 16:58:02 +01:00
|
|
|
|
2006-12-01 18:56:00 +01:00
|
|
|
EnterCriticalSection(&This->crit);
|
|
|
|
res = This->acquired ? S_FALSE : DI_OK;
|
2006-12-01 18:54:42 +01:00
|
|
|
This->acquired = 1;
|
2006-12-04 18:54:05 +01:00
|
|
|
if (res == DI_OK)
|
2011-01-09 23:43:55 +01:00
|
|
|
check_dinput_hooks(iface);
|
2006-12-01 18:56:00 +01:00
|
|
|
LeaveCriticalSection(&This->crit);
|
2006-12-01 18:54:42 +01:00
|
|
|
|
2006-12-01 18:56:00 +01:00
|
|
|
return res;
|
2006-12-01 18:54:42 +01:00
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_Acquire(IDirectInputDevice8W_from_impl(This));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-12-01 18:54:42 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* Unacquire
|
|
|
|
*/
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
|
2006-12-01 18:54:42 +01:00
|
|
|
{
|
2011-01-09 23:43:55 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
2006-12-01 18:56:00 +01:00
|
|
|
HRESULT res;
|
2006-12-01 18:54:42 +01:00
|
|
|
|
2011-10-20 15:42:44 +02:00
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
2006-12-01 18:56:00 +01:00
|
|
|
EnterCriticalSection(&This->crit);
|
|
|
|
res = !This->acquired ? DI_NOEFFECT : DI_OK;
|
2006-12-01 18:54:42 +01:00
|
|
|
This->acquired = 0;
|
2007-07-07 07:36:39 +02:00
|
|
|
if (res == DI_OK)
|
2011-01-09 23:43:55 +01:00
|
|
|
check_dinput_hooks(iface);
|
2006-12-01 18:56:00 +01:00
|
|
|
LeaveCriticalSection(&This->crit);
|
2006-12-01 18:54:42 +01:00
|
|
|
|
2006-12-01 18:56:00 +01:00
|
|
|
return res;
|
2006-12-01 18:54:42 +01:00
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_Unacquire(IDirectInputDevice8W_from_impl(This));
|
|
|
|
}
|
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* IDirectInputDeviceA
|
|
|
|
*/
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W iface, LPCDIDATAFORMAT df)
|
2006-12-12 16:58:02 +01:00
|
|
|
{
|
2011-01-09 23:43:55 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
2006-12-12 16:58:02 +01:00
|
|
|
HRESULT res = DI_OK;
|
|
|
|
|
|
|
|
if (!df) return E_POINTER;
|
|
|
|
TRACE("(%p) %p\n", This, df);
|
2004-06-02 02:36:54 +02:00
|
|
|
_dump_DIDATAFORMAT(df);
|
2006-12-12 16:58:02 +01:00
|
|
|
|
|
|
|
if (df->dwSize != sizeof(DIDATAFORMAT)) return DIERR_INVALIDPARAM;
|
|
|
|
if (This->acquired) return DIERR_ACQUIRED;
|
|
|
|
|
|
|
|
EnterCriticalSection(&This->crit);
|
|
|
|
|
|
|
|
release_DataFormat(&This->data_format);
|
2006-12-12 16:58:40 +01:00
|
|
|
res = create_DataFormat(df, &This->data_format);
|
2006-12-12 16:58:02 +01:00
|
|
|
|
|
|
|
LeaveCriticalSection(&This->crit);
|
|
|
|
return res;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(LPDIRECTINPUTDEVICE8A iface, LPCDIDATAFORMAT df)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_SetDataFormat(IDirectInputDevice8W_from_impl(This), df);
|
|
|
|
}
|
|
|
|
|
2006-10-15 19:30:07 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* SetCooperativeLevel
|
|
|
|
*
|
|
|
|
* Set cooperative level and the source window for the events.
|
|
|
|
*/
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8W iface, HWND hwnd, DWORD dwflags)
|
2006-10-15 19:30:07 +02:00
|
|
|
{
|
2011-01-09 23:43:55 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
2006-10-15 19:30:07 +02:00
|
|
|
|
|
|
|
TRACE("(%p) %p,0x%08x\n", This, hwnd, dwflags);
|
|
|
|
_dump_cooperativelevel_DI(dwflags);
|
|
|
|
|
|
|
|
if ((dwflags & (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE)) == 0 ||
|
|
|
|
(dwflags & (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE)) == (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE) ||
|
|
|
|
(dwflags & (DISCL_FOREGROUND | DISCL_BACKGROUND)) == 0 ||
|
|
|
|
(dwflags & (DISCL_FOREGROUND | DISCL_BACKGROUND)) == (DISCL_FOREGROUND | DISCL_BACKGROUND))
|
|
|
|
return DIERR_INVALIDPARAM;
|
|
|
|
|
2011-11-02 06:45:39 +01:00
|
|
|
if (hwnd && GetWindowLongW(hwnd, GWL_STYLE) & WS_CHILD) return E_HANDLE;
|
|
|
|
|
2006-10-15 19:30:07 +02:00
|
|
|
if (dwflags == (DISCL_NONEXCLUSIVE | DISCL_BACKGROUND))
|
|
|
|
hwnd = GetDesktopWindow();
|
|
|
|
|
|
|
|
if (!hwnd) return E_HANDLE;
|
|
|
|
|
|
|
|
/* For security reasons native does not allow exclusive background level
|
|
|
|
for mouse and keyboard only */
|
|
|
|
if (dwflags & DISCL_EXCLUSIVE && dwflags & DISCL_BACKGROUND &&
|
|
|
|
(IsEqualGUID(&This->guid, &GUID_SysMouse) ||
|
|
|
|
IsEqualGUID(&This->guid, &GUID_SysKeyboard)))
|
|
|
|
return DIERR_UNSUPPORTED;
|
|
|
|
|
|
|
|
/* Store the window which asks for the mouse */
|
2006-12-01 18:56:00 +01:00
|
|
|
EnterCriticalSection(&This->crit);
|
2006-10-15 19:30:07 +02:00
|
|
|
This->win = hwnd;
|
|
|
|
This->dwCoopLevel = dwflags;
|
2006-12-01 18:56:00 +01:00
|
|
|
LeaveCriticalSection(&This->crit);
|
2006-10-15 19:30:07 +02:00
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8A iface, HWND hwnd, DWORD dwflags)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_SetCooperativeLevel(IDirectInputDevice8W_from_impl(This), hwnd, dwflags);
|
|
|
|
}
|
|
|
|
|
2006-10-15 19:29:48 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* SetEventNotification : specifies event to be sent on state change
|
|
|
|
*/
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification(LPDIRECTINPUTDEVICE8W iface, HANDLE event)
|
2006-10-15 19:29:48 +02:00
|
|
|
{
|
2011-01-09 23:43:55 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
2006-10-15 19:29:48 +02:00
|
|
|
|
|
|
|
TRACE("(%p) %p\n", This, event);
|
|
|
|
|
2006-12-01 18:56:00 +01:00
|
|
|
EnterCriticalSection(&This->crit);
|
2006-10-15 19:29:48 +02:00
|
|
|
This->hEvent = event;
|
2006-12-01 18:56:00 +01:00
|
|
|
LeaveCriticalSection(&This->crit);
|
2004-06-02 02:36:54 +02:00
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface, HANDLE event)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2011-01-09 23:43:21 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
2011-01-09 23:43:55 +01:00
|
|
|
return IDirectInputDevice2WImpl_SetEventNotification(IDirectInputDevice8W_from_impl(This), event);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
2011-10-20 15:42:44 +02:00
|
|
|
ULONG ref = InterlockedDecrement(&(This->ref));
|
|
|
|
|
|
|
|
TRACE("(%p) releasing from %d\n", This, ref + 1);
|
2006-12-04 18:54:05 +01:00
|
|
|
|
|
|
|
if (ref) return ref;
|
|
|
|
|
2007-06-27 14:58:27 +02:00
|
|
|
IDirectInputDevice_Unacquire(iface);
|
|
|
|
/* Reset the FF state, free all effects, etc */
|
|
|
|
IDirectInputDevice8_SendForceFeedbackCommand(iface, DISFFC_RESET);
|
|
|
|
|
2006-12-04 18:54:05 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, This->data_queue);
|
2007-06-27 14:58:27 +02:00
|
|
|
|
|
|
|
/* Free data format */
|
|
|
|
HeapFree(GetProcessHeap(), 0, This->data_format.wine_df->rgodf);
|
|
|
|
HeapFree(GetProcessHeap(), 0, This->data_format.wine_df);
|
|
|
|
release_DataFormat(&This->data_format);
|
|
|
|
|
2011-07-02 06:07:15 +02:00
|
|
|
/* Free action mapping */
|
|
|
|
HeapFree(GetProcessHeap(), 0, This->action_map);
|
|
|
|
|
2007-07-07 07:36:09 +02:00
|
|
|
EnterCriticalSection( &This->dinput->crit );
|
|
|
|
list_remove( &This->entry );
|
|
|
|
LeaveCriticalSection( &This->dinput->crit );
|
|
|
|
|
2011-01-09 23:43:09 +01:00
|
|
|
IDirectInput_Release(&This->dinput->IDirectInput7A_iface);
|
2007-06-27 14:58:27 +02:00
|
|
|
This->crit.DebugInfo->Spare[0] = 0;
|
|
|
|
DeleteCriticalSection(&This->crit);
|
|
|
|
|
2006-12-04 18:54:05 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
|
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_Release(IDirectInputDevice8W_from_impl(This));
|
|
|
|
}
|
|
|
|
|
2011-01-19 05:06:48 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface, REFIID riid, LPVOID *ppobj)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2011-01-19 05:06:48 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
|
|
|
|
|
|
|
TRACE("(%p this=%p,%s,%p)\n", iface, This, debugstr_guid(riid), ppobj);
|
|
|
|
if (IsEqualGUID(&IID_IUnknown, riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDeviceA, riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice2A, riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice7A, riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice8A, riid))
|
|
|
|
{
|
|
|
|
IDirectInputDevice2_AddRef(iface);
|
|
|
|
*ppobj = IDirectInputDevice8A_from_impl(This);
|
|
|
|
return DI_OK;
|
2004-06-02 02:36:54 +02:00
|
|
|
}
|
2011-01-19 05:06:48 +01:00
|
|
|
if (IsEqualGUID(&IID_IDirectInputDeviceW, riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice2W, riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice7W, riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice8W, riid))
|
|
|
|
{
|
|
|
|
IDirectInputDevice2_AddRef(iface);
|
|
|
|
*ppobj = IDirectInputDevice8W_from_impl(This);
|
|
|
|
return DI_OK;
|
2005-11-28 10:38:59 +01:00
|
|
|
}
|
2011-01-19 05:06:48 +01:00
|
|
|
|
|
|
|
WARN("Unsupported interface!\n");
|
2004-06-02 02:36:54 +02:00
|
|
|
return E_FAIL;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2011-01-19 05:06:48 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface, REFIID riid, LPVOID *ppobj)
|
2003-06-16 22:22:13 +02:00
|
|
|
{
|
2011-01-19 05:06:48 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_QueryInterface(IDirectInputDevice8W_from_impl(This), riid, ppobj);
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
ULONG WINAPI IDirectInputDevice2WImpl_AddRef(LPDIRECTINPUTDEVICE8W iface)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
|
|
|
return InterlockedIncrement(&This->ref);
|
|
|
|
}
|
|
|
|
|
|
|
|
ULONG WINAPI IDirectInputDevice2AImpl_AddRef(LPDIRECTINPUTDEVICE8A iface)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2011-01-09 23:43:21 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
2011-01-09 23:43:55 +01:00
|
|
|
return IDirectInputDevice2WImpl_AddRef(IDirectInputDevice8W_from_impl(This));
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2007-01-04 19:59:23 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2011-01-09 23:43:21 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
2006-12-28 00:32:19 +01:00
|
|
|
DIDEVICEOBJECTINSTANCEA ddoi;
|
2007-01-04 19:59:23 +01:00
|
|
|
int i;
|
2006-12-28 00:32:19 +01:00
|
|
|
|
|
|
|
TRACE("(%p) %p,%p flags:%08x)\n", iface, lpCallback, lpvRef, dwFlags);
|
|
|
|
TRACE(" - flags = ");
|
|
|
|
_dump_EnumObjects_flags(dwFlags);
|
|
|
|
TRACE("\n");
|
|
|
|
|
|
|
|
/* Only the fields till dwFFMaxForce are relevant */
|
|
|
|
memset(&ddoi, 0, sizeof(ddoi));
|
|
|
|
ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce);
|
|
|
|
|
|
|
|
for (i = 0; i < This->data_format.wine_df->dwNumObjs; i++)
|
|
|
|
{
|
2007-01-04 19:59:23 +01:00
|
|
|
LPDIOBJECTDATAFORMAT odf = dataformat_to_odf(This->data_format.wine_df, i);
|
2006-12-28 00:32:19 +01:00
|
|
|
|
2011-07-14 21:25:03 +02:00
|
|
|
if (dwFlags != DIDFT_ALL && !(dwFlags & DIDFT_GETTYPE(odf->dwType))) continue;
|
2007-01-04 19:59:23 +01:00
|
|
|
if (IDirectInputDevice_GetObjectInfo(iface, &ddoi, odf->dwType, DIPH_BYID) != DI_OK)
|
|
|
|
continue;
|
2006-12-28 00:32:19 +01:00
|
|
|
|
|
|
|
if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) break;
|
2004-06-02 02:36:54 +02:00
|
|
|
}
|
2006-12-28 00:32:19 +01: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
|
|
|
|
2007-01-04 19:59:23 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID lpvRef, DWORD dwFlags)
|
2003-06-16 22:22:13 +02:00
|
|
|
{
|
2011-01-09 23:43:21 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
2007-01-04 19:59:23 +01:00
|
|
|
DIDEVICEOBJECTINSTANCEW ddoi;
|
|
|
|
int i;
|
2006-12-28 00:32:19 +01:00
|
|
|
|
2007-01-04 19:59:23 +01:00
|
|
|
TRACE("(%p) %p,%p flags:%08x)\n", iface, lpCallback, lpvRef, dwFlags);
|
|
|
|
TRACE(" - flags = ");
|
|
|
|
_dump_EnumObjects_flags(dwFlags);
|
|
|
|
TRACE("\n");
|
2006-12-28 00:32:19 +01:00
|
|
|
|
2007-01-04 19:59:23 +01:00
|
|
|
/* Only the fields till dwFFMaxForce are relevant */
|
|
|
|
memset(&ddoi, 0, sizeof(ddoi));
|
|
|
|
ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEW, dwFFMaxForce);
|
|
|
|
|
|
|
|
for (i = 0; i < This->data_format.wine_df->dwNumObjs; i++)
|
|
|
|
{
|
|
|
|
LPDIOBJECTDATAFORMAT odf = dataformat_to_odf(This->data_format.wine_df, i);
|
|
|
|
|
2011-07-14 21:25:03 +02:00
|
|
|
if (dwFlags != DIDFT_ALL && !(dwFlags & DIDFT_GETTYPE(odf->dwType))) continue;
|
2007-01-04 19:59:23 +01:00
|
|
|
if (IDirectInputDevice_GetObjectInfo(iface, &ddoi, odf->dwType, DIPH_BYID) != DI_OK)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return DI_OK;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
2006-12-04 18:54:05 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* GetProperty
|
|
|
|
*/
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2011-01-09 23:43:55 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
2006-12-04 18:54:05 +01:00
|
|
|
|
|
|
|
TRACE("(%p) %s,%p\n", iface, debugstr_guid(rguid), pdiph);
|
|
|
|
_dump_DIPROPHEADER(pdiph);
|
|
|
|
|
2010-02-02 00:11:49 +01:00
|
|
|
if (!IS_DIPROP(rguid)) return DI_OK;
|
2006-12-04 18:54:05 +01:00
|
|
|
|
|
|
|
switch (LOWORD(rguid))
|
|
|
|
{
|
2009-01-05 12:39:44 +01:00
|
|
|
case (DWORD_PTR) DIPROP_BUFFERSIZE:
|
2006-12-04 18:54:05 +01:00
|
|
|
{
|
|
|
|
LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph;
|
|
|
|
|
|
|
|
if (pdiph->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
|
|
|
|
|
|
|
|
pd->dwData = This->queue_len;
|
|
|
|
TRACE("buffersize = %d\n", pd->dwData);
|
|
|
|
break;
|
|
|
|
}
|
2011-02-02 04:28:00 +01:00
|
|
|
case (DWORD_PTR) DIPROP_VIDPID:
|
|
|
|
FIXME("DIPROP_VIDPID not implemented\n");
|
|
|
|
return DIERR_UNSUPPORTED;
|
2006-12-04 18:54:05 +01:00
|
|
|
default:
|
2010-09-16 06:48:12 +02:00
|
|
|
FIXME("Unknown property %s\n", debugstr_guid(rguid));
|
|
|
|
return DIERR_INVALIDPARAM;
|
2006-12-04 18:54:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_GetProperty(IDirectInputDevice8W_from_impl(This), rguid, pdiph);
|
|
|
|
}
|
|
|
|
|
2006-12-04 18:54:05 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* SetProperty
|
|
|
|
*/
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty(
|
|
|
|
LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIPROPHEADER pdiph)
|
2006-12-04 18:54:05 +01:00
|
|
|
{
|
2011-01-09 23:43:55 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
2006-12-04 18:54:05 +01:00
|
|
|
|
|
|
|
TRACE("(%p) %s,%p\n", iface, debugstr_guid(rguid), pdiph);
|
|
|
|
_dump_DIPROPHEADER(pdiph);
|
|
|
|
|
2010-02-02 00:11:49 +01:00
|
|
|
if (!IS_DIPROP(rguid)) return DI_OK;
|
2006-12-04 18:54:05 +01:00
|
|
|
|
|
|
|
switch (LOWORD(rguid))
|
|
|
|
{
|
2009-01-05 12:39:44 +01:00
|
|
|
case (DWORD_PTR) DIPROP_AXISMODE:
|
2006-12-18 07:22:11 +01:00
|
|
|
{
|
|
|
|
LPCDIPROPDWORD pd = (LPCDIPROPDWORD)pdiph;
|
|
|
|
|
|
|
|
if (pdiph->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
|
|
|
|
if (pdiph->dwHow == DIPH_DEVICE && pdiph->dwObj) return DIERR_INVALIDPARAM;
|
|
|
|
if (This->acquired) return DIERR_ACQUIRED;
|
|
|
|
if (pdiph->dwHow != DIPH_DEVICE) return DIERR_UNSUPPORTED;
|
2006-12-28 00:32:19 +01:00
|
|
|
if (!This->data_format.user_df) return DI_OK;
|
2006-12-18 07:22:11 +01:00
|
|
|
|
|
|
|
TRACE("Axis mode: %s\n", pd->dwData == DIPROPAXISMODE_ABS ? "absolute" :
|
|
|
|
"relative");
|
|
|
|
|
|
|
|
EnterCriticalSection(&This->crit);
|
|
|
|
This->data_format.user_df->dwFlags &= ~DIDFT_AXIS;
|
|
|
|
This->data_format.user_df->dwFlags |= pd->dwData == DIPROPAXISMODE_ABS ?
|
|
|
|
DIDF_ABSAXIS : DIDF_RELAXIS;
|
|
|
|
LeaveCriticalSection(&This->crit);
|
|
|
|
break;
|
|
|
|
}
|
2009-01-05 12:39:44 +01:00
|
|
|
case (DWORD_PTR) DIPROP_BUFFERSIZE:
|
2006-12-04 18:54:05 +01:00
|
|
|
{
|
|
|
|
LPCDIPROPDWORD pd = (LPCDIPROPDWORD)pdiph;
|
|
|
|
|
|
|
|
if (pdiph->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
|
|
|
|
if (This->acquired) return DIERR_ACQUIRED;
|
|
|
|
|
|
|
|
TRACE("buffersize = %d\n", pd->dwData);
|
|
|
|
|
|
|
|
EnterCriticalSection(&This->crit);
|
|
|
|
HeapFree(GetProcessHeap(), 0, This->data_queue);
|
|
|
|
|
|
|
|
This->data_queue = !pd->dwData ? NULL : HeapAlloc(GetProcessHeap(), 0,
|
|
|
|
pd->dwData * sizeof(DIDEVICEOBJECTDATA));
|
|
|
|
This->queue_head = This->queue_tail = This->overflow = 0;
|
|
|
|
This->queue_len = pd->dwData;
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->crit);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
WARN("Unknown property %s\n", debugstr_guid(rguid));
|
|
|
|
return DIERR_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_SetProperty(
|
|
|
|
LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER pdiph)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_SetProperty(IDirectInputDevice8W_from_impl(This), rguid, pdiph);
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
{
|
2011-01-09 23:43:55 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
2007-01-04 07:04:24 +01:00
|
|
|
DIDEVICEOBJECTINSTANCEW didoiW;
|
|
|
|
HRESULT res;
|
|
|
|
|
|
|
|
if (!pdidoi ||
|
|
|
|
(pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCEA) &&
|
|
|
|
pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCE_DX3A)))
|
|
|
|
return DIERR_INVALIDPARAM;
|
|
|
|
|
|
|
|
didoiW.dwSize = sizeof(didoiW);
|
2011-01-09 23:43:55 +01:00
|
|
|
res = IDirectInputDevice2WImpl_GetObjectInfo(IDirectInputDevice8W_from_impl(This), &didoiW, dwObj, dwHow);
|
2007-01-04 07:04:24 +01:00
|
|
|
if (res == DI_OK)
|
|
|
|
{
|
|
|
|
DWORD dwSize = pdidoi->dwSize;
|
|
|
|
|
|
|
|
memset(pdidoi, 0, pdidoi->dwSize);
|
|
|
|
pdidoi->dwSize = dwSize;
|
|
|
|
pdidoi->guidType = didoiW.guidType;
|
|
|
|
pdidoi->dwOfs = didoiW.dwOfs;
|
|
|
|
pdidoi->dwType = didoiW.dwType;
|
|
|
|
pdidoi->dwFlags = didoiW.dwFlags;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
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)
|
|
|
|
{
|
2011-01-09 23:43:21 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
2007-02-01 16:08:21 +01:00
|
|
|
DWORD dwSize;
|
2007-01-04 07:04:24 +01:00
|
|
|
LPDIOBJECTDATAFORMAT odf;
|
|
|
|
int idx = -1;
|
|
|
|
|
|
|
|
TRACE("(%p) %d(0x%08x) -> %p\n", This, dwHow, dwObj, pdidoi);
|
|
|
|
|
|
|
|
if (!pdidoi ||
|
|
|
|
(pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCEW) &&
|
|
|
|
pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCE_DX3W)))
|
|
|
|
return DIERR_INVALIDPARAM;
|
|
|
|
|
|
|
|
switch (dwHow)
|
|
|
|
{
|
|
|
|
case DIPH_BYOFFSET:
|
|
|
|
if (!This->data_format.offsets) break;
|
|
|
|
for (idx = This->data_format.wine_df->dwNumObjs - 1; idx >= 0; idx--)
|
|
|
|
if (This->data_format.offsets[idx] == dwObj) break;
|
|
|
|
break;
|
|
|
|
case DIPH_BYID:
|
|
|
|
dwObj &= 0x00ffffff;
|
|
|
|
for (idx = This->data_format.wine_df->dwNumObjs - 1; idx >= 0; idx--)
|
|
|
|
if ((dataformat_to_odf(This->data_format.wine_df, idx)->dwType & 0x00ffffff) == dwObj)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DIPH_BYUSAGE:
|
|
|
|
FIXME("dwHow = DIPH_BYUSAGE not implemented\n");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
WARN("invalid parameter: dwHow = %08x\n", dwHow);
|
|
|
|
return DIERR_INVALIDPARAM;
|
|
|
|
}
|
|
|
|
if (idx < 0) return DIERR_OBJECTNOTFOUND;
|
|
|
|
|
|
|
|
odf = dataformat_to_odf(This->data_format.wine_df, idx);
|
2007-02-01 16:08:21 +01:00
|
|
|
dwSize = pdidoi->dwSize; /* save due to memset below */
|
2007-01-04 07:04:24 +01:00
|
|
|
memset(pdidoi, 0, pdidoi->dwSize);
|
|
|
|
pdidoi->dwSize = dwSize;
|
2007-01-06 01:15:09 +01:00
|
|
|
if (odf->pguid) pdidoi->guidType = *odf->pguid;
|
2007-01-04 07:04:24 +01:00
|
|
|
pdidoi->dwOfs = This->data_format.offsets ? This->data_format.offsets[idx] : odf->dwOfs;
|
|
|
|
pdidoi->dwType = odf->dwType;
|
|
|
|
pdidoi->dwFlags = odf->dwFlags;
|
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
return DI_OK;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD dodsize,
|
|
|
|
LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
|
2006-12-04 18:54:05 +01:00
|
|
|
{
|
2011-01-09 23:43:55 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
2006-12-04 18:54:05 +01:00
|
|
|
HRESULT ret = DI_OK;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
TRACE("(%p) %p -> %p(%d) x%d, 0x%08x\n",
|
|
|
|
This, dod, entries, entries ? *entries : 0, dodsize, flags);
|
|
|
|
|
2011-10-20 15:42:49 +02:00
|
|
|
if (This->dinput->dwVersion == 0x0800 || dodsize == sizeof(DIDEVICEOBJECTDATA_DX3))
|
2011-10-16 20:36:50 +02:00
|
|
|
{
|
|
|
|
if (!This->queue_len) return DIERR_NOTBUFFERED;
|
2011-10-20 15:42:49 +02:00
|
|
|
if (!This->acquired) return DIERR_NOTACQUIRED;
|
2011-10-16 20:36:50 +02:00
|
|
|
}
|
|
|
|
|
2006-12-04 18:54:05 +01:00
|
|
|
if (!This->queue_len)
|
2011-10-14 05:22:26 +02:00
|
|
|
return DI_OK;
|
2006-12-04 18:54:05 +01:00
|
|
|
if (dodsize < sizeof(DIDEVICEOBJECTDATA_DX3))
|
|
|
|
return DIERR_INVALIDPARAM;
|
|
|
|
|
|
|
|
IDirectInputDevice2_Poll(iface);
|
|
|
|
EnterCriticalSection(&This->crit);
|
|
|
|
|
|
|
|
len = This->queue_head - This->queue_tail;
|
|
|
|
if (len < 0) len += This->queue_len;
|
|
|
|
|
|
|
|
if ((*entries != INFINITE) && (len > *entries)) len = *entries;
|
|
|
|
|
|
|
|
if (dod)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
{
|
|
|
|
int n = (This->queue_tail + i) % This->queue_len;
|
|
|
|
memcpy((char *)dod + dodsize * i, This->data_queue + n, dodsize);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*entries = len;
|
|
|
|
|
2011-10-16 20:36:48 +02:00
|
|
|
if (This->overflow && This->dinput->dwVersion == 0x0800)
|
2006-12-04 18:54:05 +01:00
|
|
|
ret = DI_BUFFEROVERFLOW;
|
|
|
|
|
|
|
|
if (!(flags & DIGDD_PEEK))
|
|
|
|
{
|
|
|
|
/* Advance reading position */
|
|
|
|
This->queue_tail = (This->queue_tail + len) % This->queue_len;
|
|
|
|
This->overflow = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->crit);
|
|
|
|
|
|
|
|
TRACE("Returning %d events queued\n", *entries);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD dodsize,
|
|
|
|
LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2011-01-09 23:43:55 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_GetDeviceData(IDirectInputDevice8W_from_impl(This), dodsize, dod, entries, flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel(LPDIRECTINPUTDEVICE8W iface, HWND hwndOwner, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
FIXME("(this=%p,%p,0x%08x): 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
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(LPDIRECTINPUTDEVICE8A iface, HWND hwndOwner, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_RunControlPanel(IDirectInputDevice8W_from_impl(This), hwndOwner, dwFlags);
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_Initialize(LPDIRECTINPUTDEVICE8W iface, HINSTANCE hinst, DWORD dwVersion,
|
|
|
|
REFGUID rguid)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2011-01-09 23:43:55 +01:00
|
|
|
FIXME("(this=%p,%p,%d,%s): stub!\n", iface, hinst, dwVersion, debugstr_guid(rguid));
|
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
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(LPDIRECTINPUTDEVICE8A iface, HINSTANCE hinst, DWORD dwVersion,
|
|
|
|
REFGUID rguid)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_Initialize(IDirectInputDevice8W_from_impl(This), hinst, dwVersion, rguid);
|
|
|
|
}
|
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* IDirectInputDevice2A
|
|
|
|
*/
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIEFFECT lpeff,
|
|
|
|
LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2011-01-09 23:43:55 +01:00
|
|
|
FIXME("(this=%p,%s,%p,%p,%p): stub!\n", iface, debugstr_guid(rguid), lpeff, ppdef, pUnkOuter);
|
2004-06-02 02:36:54 +02:00
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIEFFECT lpeff,
|
|
|
|
LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_CreateEffect(IDirectInputDevice8W_from_impl(This), rguid, lpeff, ppdef, pUnkOuter);
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
{
|
2006-10-08 01:55:40 +02:00
|
|
|
FIXME("(this=%p,%p,%p,0x%08x): stub!\n",
|
2004-06-02 02:36:54 +02:00
|
|
|
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)
|
|
|
|
{
|
2006-10-08 01:55:40 +02:00
|
|
|
FIXME("(this=%p,%p,%p,0x%08x): stub!\n",
|
2004-06-02 02:36:54 +02:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8W iface, LPDWORD pdwOut)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2011-01-09 23:43:55 +01:00
|
|
|
FIXME("(this=%p,%p): stub!\n", iface, pdwOut);
|
2004-06-02 02:36:54 +02:00
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8A iface, LPDWORD pdwOut)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_GetForceFeedbackState(IDirectInputDevice8W_from_impl(This), pdwOut);
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8W iface, DWORD dwFlags)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2007-06-27 14:58:27 +02:00
|
|
|
TRACE("(%p) 0x%08x:\n", iface, dwFlags);
|
|
|
|
return DI_NOEFFECT;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8A iface, DWORD dwFlags)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2011-01-09 23:43:55 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_SendForceFeedbackCommand(IDirectInputDevice8W_from_impl(This), dwFlags);
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
FIXME("(this=%p,%p,%p,0x%08x): stub!\n", iface, lpCallback, lpvRef, dwFlags);
|
2004-06-02 02:36:54 +02:00
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_EnumCreatedEffectObjects(IDirectInputDevice8W_from_impl(This), lpCallback, lpvRef, dwFlags);
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_Escape(LPDIRECTINPUTDEVICE8W iface, LPDIEFFESCAPE lpDIEEsc)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2011-01-09 23:43:55 +01:00
|
|
|
FIXME("(this=%p,%p): stub!\n", iface, lpDIEEsc);
|
2004-06-02 02:36:54 +02:00
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_Escape(LPDIRECTINPUTDEVICE8A iface, LPDIEFFESCAPE lpDIEEsc)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2011-01-09 23:43:21 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
2011-01-09 23:43:55 +01:00
|
|
|
return IDirectInputDevice2WImpl_Escape(IDirectInputDevice8W_from_impl(This), lpDIEEsc);
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_Poll(LPDIRECTINPUTDEVICE8W iface)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
2006-12-10 07:56:58 +01:00
|
|
|
|
|
|
|
if (!This->acquired) return DIERR_NOTACQUIRED;
|
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
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_Poll(LPDIRECTINPUTDEVICE8A iface)
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2011-01-09 23:43:55 +01:00
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_Poll(IDirectInputDevice8W_from_impl(This));
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD cbObjectData,
|
|
|
|
LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
|
|
|
FIXME("(this=%p,0x%08x,%p,%p,0x%08x): stub!\n", iface, cbObjectData, rgdod, pdwInOut, dwFlags);
|
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
return DI_OK;
|
2000-11-05 21:25:02 +01:00
|
|
|
}
|
|
|
|
|
2011-01-09 23:43:55 +01:00
|
|
|
HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD cbObjectData,
|
|
|
|
LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
|
|
|
return IDirectInputDevice2WImpl_SendDeviceData(IDirectInputDevice8W_from_impl(This), cbObjectData, rgdod,
|
|
|
|
pdwInOut, dwFlags);
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
{
|
2006-10-08 01:55:40 +02:00
|
|
|
FIXME("(%p)->(%s,%p,%p,%08x): stub !\n", iface, lpszFileName, pec, pvRef, dwFlags);
|
2004-06-02 02:36:54 +02:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2006-10-08 01:55:40 +02:00
|
|
|
FIXME("(%p)->(%s,%p,%p,%08x): stub !\n", iface, debugstr_w(lpszFileName), pec, pvRef, dwFlags);
|
2004-06-02 02:36:54 +02:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2006-10-08 01:55:40 +02:00
|
|
|
FIXME("(%p)->(%s,%08x,%p,%08x): stub !\n", iface, lpszFileName, dwEntries, rgDiFileEft, dwFlags);
|
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
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPCWSTR lpszFileName,
|
|
|
|
DWORD dwEntries,
|
|
|
|
LPDIFILEEFFECT rgDiFileEft,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2006-10-08 01:55:40 +02:00
|
|
|
FIXME("(%p)->(%s,%08x,%p,%08x): stub !\n", iface, debugstr_w(lpszFileName), dwEntries, rgDiFileEft, dwFlags);
|
2004-06-02 02:36:54 +02:00
|
|
|
|
|
|
|
return DI_OK;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIACTIONFORMATW lpdiaf,
|
|
|
|
LPCWSTR lpszUserName,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2011-07-02 06:06:37 +02:00
|
|
|
FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
|
2008-02-17 15:20:54 +01:00
|
|
|
#define X(x) if (dwFlags & x) FIXME("\tdwFlags =|"#x"\n");
|
|
|
|
X(DIDBAM_DEFAULT)
|
|
|
|
X(DIDBAM_PRESERVE)
|
|
|
|
X(DIDBAM_INITIALIZE)
|
|
|
|
X(DIDBAM_HWDEFAULTS)
|
|
|
|
#undef X
|
2004-06-02 02:36:54 +02:00
|
|
|
|
|
|
|
return DI_OK;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
|
2011-08-24 04:42:50 +02:00
|
|
|
LPDIACTIONFORMATW lpdiaf,
|
|
|
|
LPCWSTR lpszUserName,
|
|
|
|
DWORD dwFlags)
|
2003-06-16 22:22:13 +02:00
|
|
|
{
|
2011-06-28 18:55:24 +02:00
|
|
|
FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
|
|
|
|
|
2004-06-02 02:36:54 +02:00
|
|
|
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
|
|
|
}
|