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
IMPORTS = dinput8 ole32 user32 advapi32
EXTRADEFS = -U__WINESRC__ -DWINE_STRICT_PROTOTYPES -DWINE_NO_NAMELESS_EXTENSION -DWIDL_C_INLINE_WRAPPERS
C_SRCS = \
device.c \
......
......@@ -27,10 +27,10 @@
#include "dinput.h"
struct enum_data {
LPDIRECTINPUT8 pDI;
LPDIACTIONFORMAT lpdiaf;
LPDIRECTINPUTDEVICE8 keyboard;
LPDIRECTINPUTDEVICE8 mouse;
IDirectInput8A *pDI;
DIACTIONFORMATA *lpdiaf;
IDirectInputDevice8A *keyboard;
IDirectInputDevice8A *mouse;
const char* username;
int ndevices;
};
......@@ -46,7 +46,7 @@ enum {
DITEST_YAXIS
};
static DIACTION actionMapping[]=
static DIACTIONA actionMapping[]=
{
/* axis */
{ 0, 0x01008A01 /* DIAXIS_DRIVINGR_STEER */ , 0, { "Steer" } },
......@@ -60,12 +60,7 @@ static DIACTION actionMapping[]=
{ 4, DIMOUSE_YAXIS, 0, { "Y Axis" } }
};
static void test_device_input(
LPDIRECTINPUTDEVICE8 lpdid,
DWORD event_type,
DWORD event,
DWORD expected
)
static void test_device_input(IDirectInputDevice8A *lpdid, DWORD event_type, DWORD event, DWORD expected)
{
HRESULT hr;
DIDEVICEOBJECTDATA obj_data;
......@@ -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);
}
static void test_build_action_map(
LPDIRECTINPUTDEVICE8 lpdid,
LPDIACTIONFORMAT lpdiaf,
int action_index,
DWORD expected_type,
DWORD expected_inst
)
static void test_build_action_map(IDirectInputDevice8A *lpdid, DIACTIONFORMATA *lpdiaf,
int action_index, DWORD expected_type, DWORD expected_inst)
{
HRESULT hr;
DIACTION *actions;
DIACTIONA *actions;
DWORD instance, type, how;
GUID assigned_to;
DIDEVICEINSTANCEA ddi;
......@@ -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);
}
static BOOL CALLBACK enumeration_callback(
LPCDIDEVICEINSTANCE lpddi,
LPDIRECTINPUTDEVICE8 lpdid,
DWORD dwFlags,
DWORD dwRemaining,
LPVOID pvRef)
static BOOL CALLBACK enumeration_callback(const DIDEVICEINSTANCEA *lpddi, IDirectInputDevice8A *lpdid,
DWORD dwFlags, DWORD dwRemaining, LPVOID pvRef)
{
HRESULT hr;
DIPROPDWORD dp;
......@@ -266,9 +252,9 @@ static BOOL CALLBACK enumeration_callback(
static void test_action_mapping(void)
{
HRESULT hr;
HINSTANCE hinst = GetModuleHandle(NULL);
LPDIRECTINPUT8 pDI = NULL;
DIACTIONFORMAT af;
HINSTANCE hinst = GetModuleHandleA(NULL);
IDirectInput8A *pDI = NULL;
DIACTIONFORMATA af;
struct enum_data data = {pDI, &af, NULL, NULL, NULL, 0};
hr = CoCreateInstance(&CLSID_DirectInput8, 0, CLSCTX_INPROC_SERVER, &IID_IDirectInput8A, (LPVOID*)&pDI);
......@@ -293,7 +279,7 @@ static void test_action_mapping(void)
memset (&af, 0, sizeof(af));
af.dwSize = sizeof(af);
af.dwActionSize = sizeof(DIACTION);
af.dwActionSize = sizeof(DIACTIONA);
af.dwDataSize = 4 * sizeof(actionMapping) / sizeof(actionMapping[0]);
af.dwNumActions = sizeof(actionMapping) / sizeof(actionMapping[0]);
af.rgoAction = actionMapping;
......@@ -345,15 +331,15 @@ static void test_action_mapping(void)
static void test_save_settings(void)
{
HRESULT hr;
HINSTANCE hinst = GetModuleHandle(NULL);
LPDIRECTINPUT8 pDI = NULL;
DIACTIONFORMAT af;
HINSTANCE hinst = GetModuleHandleA(NULL);
IDirectInput8A *pDI = NULL;
DIACTIONFORMATA af;
IDirectInputDevice8A *pKey;
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 DIACTION actions[] = {
static DIACTIONA actions[] = {
{ 0, DIKEYBOARD_A , 0, { "Blam" } },
{ 1, DIKEYBOARD_B , 0, { "Kapow"} }
};
......@@ -392,7 +378,7 @@ static void test_save_settings(void)
memset (&af, 0, sizeof(af));
af.dwSize = sizeof(af);
af.dwActionSize = sizeof(DIACTION);
af.dwActionSize = sizeof(DIACTIONA);
af.dwDataSize = 4 * sizeof(actions) / sizeof(actions[0]);
af.dwNumActions = sizeof(actions) / sizeof(actions[0]);
af.rgoAction = actions;
......
......@@ -436,11 +436,11 @@ struct enum_semantics_test
unsigned int device_count;
BOOL mouse;
BOOL keyboard;
LPDIACTIONFORMAT lpdiaf;
DIACTIONFORMATA *lpdiaf;
const char* username;
};
static DIACTION actionMapping[]=
static DIACTIONA actionMapping[]=
{
/* axis */
{ 0, 0x01008A01 /* DIAXIS_DRIVINGR_STEER */, 0, { "Steer" } },
......@@ -454,7 +454,7 @@ static DIACTION actionMapping[]=
{ 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;
......@@ -469,7 +469,7 @@ static BOOL CALLBACK enum_semantics_callback(LPCDIDEVICEINSTANCE lpddi, IDirectI
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;
struct enum_semantics_test *data = context;
......@@ -503,7 +503,7 @@ static void test_EnumDevicesBySemantics(void)
memset (&diaf, 0, sizeof(diaf));
diaf.dwSize = sizeof(diaf);
diaf.dwActionSize = sizeof(DIACTION);
diaf.dwActionSize = sizeof(DIACTIONA);
diaf.dwNumActions = sizeof(actionMapping) / sizeof(actionMapping[0]);
diaf.dwDataSize = 4 * diaf.dwNumActions;
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