Commit 7ddb8e25 authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

dinput8/tests: Enable compilation with -D__WINESRC__.

parent daf3c95d
TESTDLL = dinput8.dll TESTDLL = dinput8.dll
IMPORTS = dinput8 ole32 user32 advapi32 IMPORTS = dinput8 ole32 user32 advapi32
EXTRADEFS = -U__WINESRC__ -DWINE_STRICT_PROTOTYPES -DWINE_NO_NAMELESS_EXTENSION -DWIDL_C_INLINE_WRAPPERS
C_SRCS = \ C_SRCS = \
device.c \ device.c \
......
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
#include "dinput.h" #include "dinput.h"
struct enum_data { struct enum_data {
LPDIRECTINPUT8 pDI; IDirectInput8A *pDI;
LPDIACTIONFORMAT lpdiaf; DIACTIONFORMATA *lpdiaf;
LPDIRECTINPUTDEVICE8 keyboard; IDirectInputDevice8A *keyboard;
LPDIRECTINPUTDEVICE8 mouse; IDirectInputDevice8A *mouse;
const char* username; const char* username;
int ndevices; int ndevices;
}; };
...@@ -46,7 +46,7 @@ enum { ...@@ -46,7 +46,7 @@ enum {
DITEST_YAXIS DITEST_YAXIS
}; };
static DIACTION actionMapping[]= static DIACTIONA actionMapping[]=
{ {
/* axis */ /* axis */
{ 0, 0x01008A01 /* DIAXIS_DRIVINGR_STEER */ , 0, { "Steer" } }, { 0, 0x01008A01 /* DIAXIS_DRIVINGR_STEER */ , 0, { "Steer" } },
...@@ -60,12 +60,7 @@ static DIACTION actionMapping[]= ...@@ -60,12 +60,7 @@ static DIACTION actionMapping[]=
{ 4, DIMOUSE_YAXIS, 0, { "Y Axis" } } { 4, DIMOUSE_YAXIS, 0, { "Y Axis" } }
}; };
static void test_device_input( static void test_device_input(IDirectInputDevice8A *lpdid, DWORD event_type, DWORD event, DWORD expected)
LPDIRECTINPUTDEVICE8 lpdid,
DWORD event_type,
DWORD event,
DWORD expected
)
{ {
HRESULT hr; HRESULT hr;
DIDEVICEOBJECTDATA obj_data; DIDEVICEOBJECTDATA obj_data;
...@@ -115,16 +110,11 @@ static void test_device_input( ...@@ -115,16 +110,11 @@ static void test_device_input(
ok(hr == DI_OK && data_size == 1, "GetDeviceData() failed: %08x cnt:%d\n", hr, data_size); ok(hr == DI_OK && data_size == 1, "GetDeviceData() failed: %08x cnt:%d\n", hr, data_size);
} }
static void test_build_action_map( static void test_build_action_map(IDirectInputDevice8A *lpdid, DIACTIONFORMATA *lpdiaf,
LPDIRECTINPUTDEVICE8 lpdid, int action_index, DWORD expected_type, DWORD expected_inst)
LPDIACTIONFORMAT lpdiaf,
int action_index,
DWORD expected_type,
DWORD expected_inst
)
{ {
HRESULT hr; HRESULT hr;
DIACTION *actions; DIACTIONA *actions;
DWORD instance, type, how; DWORD instance, type, how;
GUID assigned_to; GUID assigned_to;
DIDEVICEINSTANCEA ddi; DIDEVICEINSTANCEA ddi;
...@@ -147,12 +137,8 @@ static void test_build_action_map( ...@@ -147,12 +137,8 @@ static void test_build_action_map(
ok (IsEqualGUID(&assigned_to, &ddi.guidInstance), "Action and device GUID do not match action=%d\n", action_index); ok (IsEqualGUID(&assigned_to, &ddi.guidInstance), "Action and device GUID do not match action=%d\n", action_index);
} }
static BOOL CALLBACK enumeration_callback( static BOOL CALLBACK enumeration_callback(const DIDEVICEINSTANCEA *lpddi, IDirectInputDevice8A *lpdid,
LPCDIDEVICEINSTANCE lpddi, DWORD dwFlags, DWORD dwRemaining, LPVOID pvRef)
LPDIRECTINPUTDEVICE8 lpdid,
DWORD dwFlags,
DWORD dwRemaining,
LPVOID pvRef)
{ {
HRESULT hr; HRESULT hr;
DIPROPDWORD dp; DIPROPDWORD dp;
...@@ -266,9 +252,9 @@ static BOOL CALLBACK enumeration_callback( ...@@ -266,9 +252,9 @@ static BOOL CALLBACK enumeration_callback(
static void test_action_mapping(void) static void test_action_mapping(void)
{ {
HRESULT hr; HRESULT hr;
HINSTANCE hinst = GetModuleHandle(NULL); HINSTANCE hinst = GetModuleHandleA(NULL);
LPDIRECTINPUT8 pDI = NULL; IDirectInput8A *pDI = NULL;
DIACTIONFORMAT af; DIACTIONFORMATA af;
struct enum_data data = {pDI, &af, NULL, NULL, NULL, 0}; struct enum_data data = {pDI, &af, NULL, NULL, NULL, 0};
hr = CoCreateInstance(&CLSID_DirectInput8, 0, CLSCTX_INPROC_SERVER, &IID_IDirectInput8A, (LPVOID*)&pDI); hr = CoCreateInstance(&CLSID_DirectInput8, 0, CLSCTX_INPROC_SERVER, &IID_IDirectInput8A, (LPVOID*)&pDI);
...@@ -293,7 +279,7 @@ static void test_action_mapping(void) ...@@ -293,7 +279,7 @@ static void test_action_mapping(void)
memset (&af, 0, sizeof(af)); memset (&af, 0, sizeof(af));
af.dwSize = sizeof(af); af.dwSize = sizeof(af);
af.dwActionSize = sizeof(DIACTION); af.dwActionSize = sizeof(DIACTIONA);
af.dwDataSize = 4 * sizeof(actionMapping) / sizeof(actionMapping[0]); af.dwDataSize = 4 * sizeof(actionMapping) / sizeof(actionMapping[0]);
af.dwNumActions = sizeof(actionMapping) / sizeof(actionMapping[0]); af.dwNumActions = sizeof(actionMapping) / sizeof(actionMapping[0]);
af.rgoAction = actionMapping; af.rgoAction = actionMapping;
...@@ -345,15 +331,15 @@ static void test_action_mapping(void) ...@@ -345,15 +331,15 @@ static void test_action_mapping(void)
static void test_save_settings(void) static void test_save_settings(void)
{ {
HRESULT hr; HRESULT hr;
HINSTANCE hinst = GetModuleHandle(NULL); HINSTANCE hinst = GetModuleHandleA(NULL);
LPDIRECTINPUT8 pDI = NULL; IDirectInput8A *pDI = NULL;
DIACTIONFORMAT af; DIACTIONFORMATA af;
IDirectInputDevice8A *pKey; IDirectInputDevice8A *pKey;
static const GUID mapping_guid = { 0xcafecafe, 0x2, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } }; static const GUID mapping_guid = { 0xcafecafe, 0x2, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } };
static const GUID other_guid = { 0xcafe, 0xcafe, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } }; static const GUID other_guid = { 0xcafe, 0xcafe, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } };
static DIACTION actions[] = { static DIACTIONA actions[] = {
{ 0, DIKEYBOARD_A , 0, { "Blam" } }, { 0, DIKEYBOARD_A , 0, { "Blam" } },
{ 1, DIKEYBOARD_B , 0, { "Kapow"} } { 1, DIKEYBOARD_B , 0, { "Kapow"} }
}; };
...@@ -392,7 +378,7 @@ static void test_save_settings(void) ...@@ -392,7 +378,7 @@ static void test_save_settings(void)
memset (&af, 0, sizeof(af)); memset (&af, 0, sizeof(af));
af.dwSize = sizeof(af); af.dwSize = sizeof(af);
af.dwActionSize = sizeof(DIACTION); af.dwActionSize = sizeof(DIACTIONA);
af.dwDataSize = 4 * sizeof(actions) / sizeof(actions[0]); af.dwDataSize = 4 * sizeof(actions) / sizeof(actions[0]);
af.dwNumActions = sizeof(actions) / sizeof(actions[0]); af.dwNumActions = sizeof(actions) / sizeof(actions[0]);
af.rgoAction = actions; af.rgoAction = actions;
......
...@@ -436,11 +436,11 @@ struct enum_semantics_test ...@@ -436,11 +436,11 @@ struct enum_semantics_test
unsigned int device_count; unsigned int device_count;
BOOL mouse; BOOL mouse;
BOOL keyboard; BOOL keyboard;
LPDIACTIONFORMAT lpdiaf; DIACTIONFORMATA *lpdiaf;
const char* username; const char* username;
}; };
static DIACTION actionMapping[]= static DIACTIONA actionMapping[]=
{ {
/* axis */ /* axis */
{ 0, 0x01008A01 /* DIAXIS_DRIVINGR_STEER */, 0, { "Steer" } }, { 0, 0x01008A01 /* DIAXIS_DRIVINGR_STEER */, 0, { "Steer" } },
...@@ -454,7 +454,7 @@ static DIACTION actionMapping[]= ...@@ -454,7 +454,7 @@ static DIACTION actionMapping[]=
{ 4, DIMOUSE_YAXIS, 0, { "Y Axis" } } { 4, DIMOUSE_YAXIS, 0, { "Y Axis" } }
}; };
static BOOL CALLBACK enum_semantics_callback(LPCDIDEVICEINSTANCE lpddi, IDirectInputDevice8A *lpdid, DWORD dwFlags, DWORD dwRemaining, void *context) static BOOL CALLBACK enum_semantics_callback(const DIDEVICEINSTANCEA *lpddi, IDirectInputDevice8A *lpdid, DWORD dwFlags, DWORD dwRemaining, void *context)
{ {
struct enum_semantics_test *data = context; struct enum_semantics_test *data = context;
...@@ -469,7 +469,7 @@ static BOOL CALLBACK enum_semantics_callback(LPCDIDEVICEINSTANCE lpddi, IDirectI ...@@ -469,7 +469,7 @@ static BOOL CALLBACK enum_semantics_callback(LPCDIDEVICEINSTANCE lpddi, IDirectI
return DIENUM_CONTINUE; return DIENUM_CONTINUE;
} }
static BOOL CALLBACK set_action_map_callback(LPCDIDEVICEINSTANCE lpddi, IDirectInputDevice8A *lpdid, DWORD dwFlags, DWORD dwRemaining, void *context) static BOOL CALLBACK set_action_map_callback(const DIDEVICEINSTANCEA *lpddi, IDirectInputDevice8A *lpdid, DWORD dwFlags, DWORD dwRemaining, void *context)
{ {
HRESULT hr; HRESULT hr;
struct enum_semantics_test *data = context; struct enum_semantics_test *data = context;
...@@ -503,7 +503,7 @@ static void test_EnumDevicesBySemantics(void) ...@@ -503,7 +503,7 @@ static void test_EnumDevicesBySemantics(void)
memset (&diaf, 0, sizeof(diaf)); memset (&diaf, 0, sizeof(diaf));
diaf.dwSize = sizeof(diaf); diaf.dwSize = sizeof(diaf);
diaf.dwActionSize = sizeof(DIACTION); diaf.dwActionSize = sizeof(DIACTIONA);
diaf.dwNumActions = sizeof(actionMapping) / sizeof(actionMapping[0]); diaf.dwNumActions = sizeof(actionMapping) / sizeof(actionMapping[0]);
diaf.dwDataSize = 4 * diaf.dwNumActions; diaf.dwDataSize = 4 * diaf.dwNumActions;
diaf.rgoAction = actionMapping; diaf.rgoAction = actionMapping;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment