From dc0ce0859fda4e7b62b5e4252340f833ee194abd Mon Sep 17 00:00:00 2001 From: Baruch Rutman Date: Tue, 6 Nov 2018 23:08:38 +0200 Subject: [PATCH 1/2] [WINEJOYSTICK] Add stub --- dll/win32/winmm/CMakeLists.txt | 1 + .../winmm/winejoystick.drv/CMakeLists.txt | 11 ++++ dll/win32/winmm/winejoystick.drv/joystick.c | 66 +++++++++++++++++++ dll/win32/winmm/winejoystick.drv/joystick.h | 34 ++++++++++ .../winejoystick.drv/winejoystick.drv.spec | 1 + 5 files changed, 113 insertions(+) create mode 100644 dll/win32/winmm/winejoystick.drv/CMakeLists.txt create mode 100644 dll/win32/winmm/winejoystick.drv/joystick.c create mode 100644 dll/win32/winmm/winejoystick.drv/joystick.h create mode 100644 dll/win32/winmm/winejoystick.drv/winejoystick.drv.spec diff --git a/dll/win32/winmm/CMakeLists.txt b/dll/win32/winmm/CMakeLists.txt index eb3cbecbbe..a6bda33003 100644 --- a/dll/win32/winmm/CMakeLists.txt +++ b/dll/win32/winmm/CMakeLists.txt @@ -32,3 +32,4 @@ if(NOT MSVC) endif() add_subdirectory(midimap) +add_subdirectory(winejoystick.drv) diff --git a/dll/win32/winmm/winejoystick.drv/CMakeLists.txt b/dll/win32/winmm/winejoystick.drv/CMakeLists.txt new file mode 100644 index 0000000000..f1835f2f97 --- /dev/null +++ b/dll/win32/winmm/winejoystick.drv/CMakeLists.txt @@ -0,0 +1,11 @@ + +spec2def(winejoystick.drv winejoystick.drv.spec) + +add_library(winejoystick.drv SHARED + joystick.c + ${CMAKE_CURRENT_BINARY_DIR}/winejoystick.def) + +set_module_type(winejoystick.drv win32dll UNICODE) +target_link_libraries(winejoystick.drv wine) +add_importlibs(winejoystick.drv user32 winmm msvcrt kernel32 ntdll) +add_cd_file(TARGET winejoystick.drv DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/winmm/winejoystick.drv/joystick.c b/dll/win32/winmm/winejoystick.drv/joystick.c new file mode 100644 index 0000000000..33b5fab42f --- /dev/null +++ b/dll/win32/winmm/winejoystick.drv/joystick.c @@ -0,0 +1,66 @@ +/* + * WinMM joystick driver common code + * + * Copyright 1997 Andreas Mohr + * Copyright 2000 Wolfgang Schwotzer + * Copyright 2002 David Hagood + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "joystick.h" + + +/************************************************************************** + * DriverProc (JOYSTICK.@) + */ +LRESULT CALLBACK JSTCK_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg, LPARAM dwParam1, LPARAM dwParam2) +{ + switch(wMsg) { + case DRV_LOAD: return 1; + case DRV_FREE: return 1; +#ifdef __REACTOS__ + case DRV_OPEN: return 0; + case DRV_CLOSE: return 0; +#else + case DRV_OPEN: return driver_open((LPSTR)dwParam1, dwParam2); + case DRV_CLOSE: return driver_close(dwDevID); +#endif + case DRV_ENABLE: return 1; + case DRV_DISABLE: return 1; + case DRV_QUERYCONFIGURE: return 1; + case DRV_CONFIGURE: MessageBoxA(0, "JoyStick MultiMedia Driver !", "JoyStick Driver", MB_OK); return 1; + case DRV_INSTALL: return DRVCNF_RESTART; + case DRV_REMOVE: return DRVCNF_RESTART; + + case JDD_GETNUMDEVS: return 1; +#ifdef __REACTOS__ + case JDD_GETDEVCAPS: return 0; + case JDD_GETPOS: return 0; +#else + case JDD_GETDEVCAPS: return driver_joyGetDevCaps(dwDevID, (LPJOYCAPSW)dwParam1, dwParam2); + case JDD_GETPOS: return driver_joyGetPos(dwDevID, (LPJOYINFO)dwParam1); +#endif + case JDD_SETCALIBRATION: + case JDD_CONFIGCHANGED: return JOYERR_NOCANDO; +#ifdef __REACTOS__ + case JDD_GETPOSEX: return 0; +#else + case JDD_GETPOSEX: return driver_joyGetPosEx(dwDevID, (LPJOYINFOEX)dwParam1); +#endif + default: + return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); + } +} diff --git a/dll/win32/winmm/winejoystick.drv/joystick.h b/dll/win32/winmm/winejoystick.drv/joystick.h new file mode 100644 index 0000000000..1ec1edb813 --- /dev/null +++ b/dll/win32/winmm/winejoystick.drv/joystick.h @@ -0,0 +1,34 @@ +/* + * WinMM joystick driver header + * + * Copyright 2015 Ken Thomases for CodeWeavers Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + + +#include + +#include "windef.h" +#include "winbase.h" +#include "mmddk.h" +#include "winuser.h" + + +LRESULT driver_open(LPSTR str, DWORD index) DECLSPEC_HIDDEN; +LRESULT driver_close(DWORD_PTR device_id) DECLSPEC_HIDDEN; +LRESULT driver_joyGetDevCaps(DWORD_PTR device_id, JOYCAPSW* caps, DWORD size) DECLSPEC_HIDDEN; +LRESULT driver_joyGetPosEx(DWORD_PTR device_id, JOYINFOEX* info) DECLSPEC_HIDDEN; +LRESULT driver_joyGetPos(DWORD_PTR device_id, JOYINFO* info) DECLSPEC_HIDDEN; diff --git a/dll/win32/winmm/winejoystick.drv/winejoystick.drv.spec b/dll/win32/winmm/winejoystick.drv/winejoystick.drv.spec new file mode 100644 index 0000000000..affaa4f0ef --- /dev/null +++ b/dll/win32/winmm/winejoystick.drv/winejoystick.drv.spec @@ -0,0 +1 @@ +@ stdcall DriverProc(long long long long long) JSTCK_DriverProc -- 2.19.1.windows.1