Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fengzch-das
OIS
Commits
d9b8990a
Commit
d9b8990a
authored
Jul 10, 2010
by
Phillip Castaneda
Browse files
Adding XInput support for win32. Not currently an option to compile out - todo.
parent
6a6c0c87
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
557 additions
and
268 deletions
+557
-268
ReadMe.txt
ReadMe.txt
+5
-16
Win32/CommandLine/CommandLine_vc9.vcproj
Win32/CommandLine/CommandLine_vc9.vcproj
+31
-31
Win32/DemoFFTest/DemoFFTest_vc9.vcproj
Win32/DemoFFTest/DemoFFTest_vc9.vcproj
+2
-2
Win32/OIS_vc8.vcproj
Win32/OIS_vc8.vcproj
+8
-8
Win32/OIS_vc9.vcproj
Win32/OIS_vc9.vcproj
+8
-15
includes/win32/Win32JoyStick.h
includes/win32/Win32JoyStick.h
+11
-3
includes/win32/Win32Prereqs.h
includes/win32/Win32Prereqs.h
+5
-1
src/win32/Win32InputManager.cpp
src/win32/Win32InputManager.cpp
+16
-2
src/win32/Win32JoyStick.cpp
src/win32/Win32JoyStick.cpp
+471
-190
No files found.
ReadMe.txt
View file @
d9b8990a
...
...
@@ -4,7 +4,7 @@
The zlib/libpng License
Copyright (c) 2005-200
7
Phillip Castaneda (pjcast -- www.wreckedgames.com)
Copyright (c) 2005-20
1
0 Phillip Castaneda (pjcast -- www.wreckedgames.com)
This software is provided 'as-is', without any express or implied warranty. In no
event will the authors be held liable for any damages arising from the use of this
...
...
@@ -45,21 +45,16 @@ compatiable with many systems and operating systems
Win32/
Contains Visual Studio .Net Solution Files
Contains CodeBlocks
+ MinGW + StlPort
project files for OIS
Contains CodeBlocks project files for OIS
---- Dependencies ------------------------------------------------------
DirectInput 8
Ogre & CEGUI 0.4.0 If building CEGUIOgre OIS Demo
SDL/
A test bed for an OIS InputManager with SDL as the backend. Not recommended;
however, useful for platforms with non-native OIS ports for temporary use.
Linux/
---- Dependencies ------------------------------------------------------
X11
Ogre (GLX Platform) & CEGUI 0.4.0 If building CEGUIOgre OIS Demo
Newer Linux Kernel (2.6+ ?) for Event API - else, use --disable-joyevents
Newer Linux Kernel (2.6+ ?) for Event API
Steps to build on Linux:
./bootstrap
...
...
@@ -68,9 +63,7 @@ Linux/
---- Configure build options --------------------------------------------
./configure --help --- List all configure options
./configure --disable-ogre --- Disables CEGUIOgre ActionMapping Demo
./configure --disable-joyevents --- Uses /dev/input/jsX instead of
/dev/input/eventX
LinuxCB/
Contains CodeBlock files for building OIS and Demos with codeblocks
...
...
@@ -79,9 +72,5 @@ LinuxCB/
settings. It also installs libOIS to ~/libs
Mac/
XCode-1.5/
Non-complete native OIS port.
XCode-2.2/
Working, complete, OIS port to OSX using SDL as a backend.
\ No newline at end of file
Working, mostly complete OSX vackend.
\ No newline at end of file
Win32/CommandLine/CommandLine_vc9.vcproj
View file @
d9b8990a
...
...
@@ -64,7 +64,7 @@
/>
<Tool
Name=
"VCLinkerTool"
AdditionalDependencies=
"ois_static_d.lib"
AdditionalDependencies=
"ois_static_d.lib
xinput.lib
"
OutputFile=
"$(OutDir)/CommandLine.exe"
LinkIncremental=
"2"
AdditionalLibraryDirectories=
"..\..\lib;..\..\src\win32\extras\WiiMote"
...
...
@@ -99,9 +99,9 @@
/>
</Configuration>
<Configuration
Name=
"
Debug|x64
"
OutputDirectory=
"
$(PlatformName)\$(ConfigurationName)
"
IntermediateDirectory=
"
$(PlatformName)\$(ConfigurationName)
"
Name=
"
Release|Win32
"
OutputDirectory=
"
Release
"
IntermediateDirectory=
"
Release
"
ConfigurationType=
"1"
CharacterSet=
"2"
>
...
...
@@ -119,16 +119,17 @@
/>
<Tool
Name=
"VCMIDLTool"
TargetEnvironment=
"3"
/>
<Tool
Name=
"VCCLCompilerTool"
Optimization=
"0"
Optimization=
"2"
InlineFunctionExpansion=
"1"
OmitFramePointers=
"true"
AdditionalIncludeDirectories=
"..\..\includes;..\CommandLine\"
PreprocessorDefinitions=
"WIN32;
_
DEBUG;_CONSOLE
;_STLP_DEBUG
"
MinimalRebuild
=
"true"
Basic
Runtime
Checks
=
"
3
"
R
unti
meLibrary=
"3
"
PreprocessorDefinitions=
"WIN32;
N
DEBUG;_CONSOLE"
StringPooling
=
"true"
Runtime
Library
=
"
2
"
EnableF
un
c
ti
onLevelLinking=
"true
"
UsePrecompiledHeader=
"0"
WarningLevel=
"3"
Detect64BitPortabilityProblems=
"true"
...
...
@@ -145,16 +146,17 @@
/>
<Tool
Name=
"VCLinkerTool"
AdditionalDependencies=
"ois_
d
.lib"
AdditionalDependencies=
"ois_
static.lib xinput
.lib"
OutputFile=
"$(OutDir)/CommandLine.exe"
LinkIncremental=
"
2
"
AdditionalLibraryDirectories=
"..\..\lib
64
"
LinkIncremental=
"
1
"
AdditionalLibraryDirectories=
"..\..\lib
;..\..\src\win32\extras\WiiMote
"
GenerateDebugInformation=
"true"
ProgramDatabaseFile=
"$(OutDir)/CommandLine.pdb"
SubSystem=
"1"
OptimizeReferences=
"2"
EnableCOMDATFolding=
"2"
RandomizedBaseAddress=
"1"
DataExecutionPrevention=
"0"
TargetMachine=
"1
7
"
TargetMachine=
"1"
/>
<Tool
Name=
"VCALinkTool"
...
...
@@ -180,9 +182,9 @@
/>
</Configuration>
<Configuration
Name=
"
Release|Win32
"
OutputDirectory=
"
Release
"
IntermediateDirectory=
"
Release
"
Name=
"
Debug|x64
"
OutputDirectory=
"
$(PlatformName)\$(ConfigurationName)
"
IntermediateDirectory=
"
$(PlatformName)\$(ConfigurationName)
"
ConfigurationType=
"1"
CharacterSet=
"2"
>
...
...
@@ -200,17 +202,16 @@
/>
<Tool
Name=
"VCMIDLTool"
TargetEnvironment=
"3"
/>
<Tool
Name=
"VCCLCompilerTool"
Optimization=
"2"
InlineFunctionExpansion=
"1"
OmitFramePointers=
"true"
Optimization=
"0"
AdditionalIncludeDirectories=
"..\..\includes;..\CommandLine\"
PreprocessorDefinitions=
"WIN32;
N
DEBUG;_CONSOLE"
StringPooling
=
"true"
Runtime
Library
=
"
2
"
EnableF
un
c
ti
onLevelLinking=
"true
"
PreprocessorDefinitions=
"WIN32;
_
DEBUG;_CONSOLE
;_STLP_DEBUG
"
MinimalRebuild
=
"true"
Basic
Runtime
Checks
=
"
3
"
R
unti
meLibrary=
"3
"
UsePrecompiledHeader=
"0"
WarningLevel=
"3"
Detect64BitPortabilityProblems=
"true"
...
...
@@ -227,17 +228,16 @@
/>
<Tool
Name=
"VCLinkerTool"
AdditionalDependencies=
"ois_
static
.lib"
AdditionalDependencies=
"ois_
d
.lib"
OutputFile=
"$(OutDir)/CommandLine.exe"
LinkIncremental=
"
1
"
AdditionalLibraryDirectories=
"..\..\lib
;..\..\src\win32\extras\WiiMote
"
LinkIncremental=
"
2
"
AdditionalLibraryDirectories=
"..\..\lib
64
"
GenerateDebugInformation=
"true"
ProgramDatabaseFile=
"$(OutDir)/CommandLine.pdb"
SubSystem=
"1"
OptimizeReferences=
"2"
EnableCOMDATFolding=
"2"
RandomizedBaseAddress=
"1"
DataExecutionPrevention=
"0"
TargetMachine=
"1"
TargetMachine=
"1
7
"
/>
<Tool
Name=
"VCALinkTool"
...
...
Win32/DemoFFTest/DemoFFTest_vc9.vcproj
View file @
d9b8990a
...
...
@@ -64,7 +64,7 @@
/>
<Tool
Name=
"VCLinkerTool"
AdditionalDependencies=
"ois_static_d.lib"
AdditionalDependencies=
"ois_static_d.lib
xinput.lib
"
OutputFile=
"$(OutDir)/DemoFFTest.exe"
LinkIncremental=
"2"
AdditionalLibraryDirectories=
"..\..\lib;..\..\src\win32\extras\WiiMote"
...
...
@@ -146,7 +146,7 @@
/>
<Tool
Name=
"VCLinkerTool"
AdditionalDependencies=
"ois_static.lib"
AdditionalDependencies=
"ois_static.lib
xinput.lib
"
OutputFile=
"$(OutDir)/DemoFFTest.exe"
LinkIncremental=
"1"
AdditionalLibraryDirectories=
"..\..\lib;..\..\src\win32\extras\WiiMote"
...
...
Win32/OIS_vc8.vcproj
View file @
d9b8990a
...
...
@@ -68,7 +68,7 @@
/>
<Tool
Name=
"VCLibrarianTool"
AdditionalDependencies=
"dxguid.lib dinput8.lib"
AdditionalDependencies=
"dxguid.lib dinput8.lib
xinput.lib
"
OutputFile=
"$(OutDir)/OIS_static_d.lib"
AdditionalLibraryDirectories=
"..\src\win32\extras\WiiMote"
/>
...
...
@@ -140,7 +140,7 @@
/>
<Tool
Name=
"VCLibrarianTool"
AdditionalDependencies=
"dxguid.lib dinput8.lib"
AdditionalDependencies=
"dxguid.lib dinput8.lib
xinput.lib
"
OutputFile=
"$(OutDir)/OIS_d.lib"
/>
<Tool
...
...
@@ -212,7 +212,7 @@
/>
<Tool
Name=
"VCLibrarianTool"
AdditionalDependencies=
"dxguid.lib dinput8.lib"
AdditionalDependencies=
"dxguid.lib dinput8.lib
xinput.lib
"
OutputFile=
"$(OutDir)/OIS_static.lib"
AdditionalLibraryDirectories=
"..\src\win32\extras\WiiMote"
/>
...
...
@@ -289,7 +289,7 @@
/>
<Tool
Name=
"VCLibrarianTool"
AdditionalDependencies=
"dxguid.lib dinput8.lib"
AdditionalDependencies=
"dxguid.lib dinput8.lib
xinput.lib
"
OutputFile=
"$(OutDir)/OIS.lib"
/>
<Tool
...
...
@@ -361,7 +361,7 @@
/>
<Tool
Name=
"VCLinkerTool"
AdditionalDependencies=
"dxguid.lib dinput8.lib"
AdditionalDependencies=
"dxguid.lib dinput8.lib
xinput.lib
"
AdditionalLibraryDirectories=
"..\src\win32\extras\WiiMote\"
GenerateDebugInformation=
"false"
OptimizeReferences=
"2"
...
...
@@ -451,7 +451,7 @@
/>
<Tool
Name=
"VCLinkerTool"
AdditionalDependencies=
"dxguid.lib dinput8.lib"
AdditionalDependencies=
"dxguid.lib dinput8.lib
xinput.lib
"
GenerateDebugInformation=
"true"
TargetMachine=
"17"
/>
...
...
@@ -531,7 +531,7 @@
/>
<Tool
Name=
"VCLinkerTool"
AdditionalDependencies=
"dxguid.lib dinput8.lib"
AdditionalDependencies=
"dxguid.lib dinput8.lib
xinput.lib
"
OutputFile=
"$(OutDir)/OIS_d.dll"
AdditionalLibraryDirectories=
"..\src\win32\extras\WiiMote\"
GenerateDebugInformation=
"true"
...
...
@@ -613,7 +613,7 @@
/>
<Tool
Name=
"VCLinkerTool"
AdditionalDependencies=
"dxguid.lib dinput8.lib"
AdditionalDependencies=
"dxguid.lib dinput8.lib
xinput.lib
"
OutputFile=
"$(OutDir)/OIS_d.dll"
TargetMachine=
"17"
/>
...
...
Win32/OIS_vc9.vcproj
View file @
d9b8990a
...
...
@@ -69,7 +69,7 @@
/>
<Tool
Name=
"VCLibrarianTool"
AdditionalDependencies=
"dxguid.lib dinput8.lib"
AdditionalDependencies=
"dxguid.lib dinput8.lib
xinput.lib
"
OutputFile=
"$(OutDir)/OIS_static_d.lib"
AdditionalLibraryDirectories=
"..\src\win32\extras\WiiMote"
/>
...
...
@@ -142,7 +142,7 @@
/>
<Tool
Name=
"VCLibrarianTool"
AdditionalDependencies=
"dxguid.lib dinput8.lib"
AdditionalDependencies=
"dxguid.lib dinput8.lib
xinput.lib
"
OutputFile=
"$(OutDir)/OIS_static.lib"
AdditionalLibraryDirectories=
"..\src\win32\extras\WiiMote"
/>
...
...
@@ -215,7 +215,7 @@
/>
<Tool
Name=
"VCLinkerTool"
AdditionalDependencies=
"dxguid.lib dinput8.lib"
AdditionalDependencies=
"dxguid.lib dinput8.lib
xinput.lib
"
AdditionalLibraryDirectories=
"..\src\win32\extras\WiiMote\"
GenerateDebugInformation=
"false"
OptimizeReferences=
"2"
...
...
@@ -298,7 +298,7 @@
/>
<Tool
Name=
"VCLinkerTool"
AdditionalDependencies=
"dxguid.lib dinput8.lib"
AdditionalDependencies=
"dxguid.lib dinput8.lib
xinput.lib
"
OutputFile=
"$(OutDir)/OIS_d.dll"
AdditionalLibraryDirectories=
"..\src\win32\extras\WiiMote\"
GenerateDebugInformation=
"true"
...
...
@@ -379,7 +379,7 @@
/>
<Tool
Name=
"VCLibrarianTool"
AdditionalDependencies=
"dxguid.lib dinput8.lib"
AdditionalDependencies=
"dxguid.lib dinput8.lib
xinput.lib
"
OutputFile=
"$(OutDir)/OIS_d.lib"
/>
<Tool
...
...
@@ -455,7 +455,7 @@
/>
<Tool
Name=
"VCLibrarianTool"
AdditionalDependencies=
"dxguid.lib dinput8.lib"
AdditionalDependencies=
"dxguid.lib dinput8.lib
xinput.lib
"
OutputFile=
"$(OutDir)/OIS.lib"
/>
<Tool
...
...
@@ -531,7 +531,7 @@
/>
<Tool
Name=
"VCLinkerTool"
AdditionalDependencies=
"dxguid.lib dinput8.lib"
AdditionalDependencies=
"dxguid.lib dinput8.lib
xinput.lib
"
GenerateDebugInformation=
"true"
RandomizedBaseAddress=
"1"
DataExecutionPrevention=
"0"
...
...
@@ -611,7 +611,7 @@
/>
<Tool
Name=
"VCLinkerTool"
AdditionalDependencies=
"dxguid.lib dinput8.lib"
AdditionalDependencies=
"dxguid.lib dinput8.lib
xinput.lib
"
OutputFile=
"$(OutDir)/OIS_d.dll"
RandomizedBaseAddress=
"1"
DataExecutionPrevention=
"0"
...
...
@@ -897,13 +897,6 @@
Name=
"VCResourceCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name=
"OIS_ReleaseDll|Win32"
>
<Tool
Name=
"VCResourceCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name=
"OIS_DebugDll|Win32"
ExcludedFromBuild=
"true"
...
...
includes/win32/Win32JoyStick.h
View file @
d9b8990a
...
...
@@ -46,6 +46,14 @@ namespace OIS
/** @copydoc Object::_initialize */
virtual
void
_initialize
();
/**
@remarks
Enum each PNP device using WMI and check each device ID to see if it contains
"IG_" (ex. "VID_045E&PID_028E&IG_00"). If it does, then it's an XInput device
Unfortunately this information can not be found by just using DirectInput
*/
static
void
CheckXInputDevices
(
JoyStickInfoList
&
joys
);
protected:
//! Enumerates all things
void
_enumerate
();
...
...
@@ -60,12 +68,12 @@ namespace OIS
IDirectInput8
*
mDirectInput
;
IDirectInputDevice8
*
mJoyStick
;
DIDEVCAPS
mDIJoyCaps
;
DWORD
coopSetting
;
GUID
deviceGuid
;
JoyStickInfo
mJoyInfo
;
//! A force feedback device
Win32ForceFeedback
*
ff_d
evice
;
Win32ForceFeedback
*
mFfD
evice
;
//! Mapping
int
_AxisNumber
;
...
...
includes/win32/Win32Prereqs.h
View file @
d9b8990a
...
...
@@ -27,6 +27,7 @@ restrictions:
#define DIRECTINPUT_VERSION 0x0800
#include <windows.h>
#include <dinput.h>
#include <XInput.h>
//Max number of elements to collect from buffered DirectInput
#define KEYBOARD_DX_BUFFERSIZE 17
...
...
@@ -54,10 +55,13 @@ namespace OIS
public:
int
devId
;
GUID
deviceID
;
GUID
productGuid
;
std
::
string
vendor
;
bool
isXInput
;
int
xInputDev
;
};
typedef
std
::
vector
<
JoyStickInfo
>
JoyStickInfoList
;
typedef
std
::
vector
<
JoyStickInfo
>
JoyStickInfoList
;
}
#endif //_WIN32_INPUTSYSTEM_PREREQS_H
src/win32/Win32InputManager.cpp
View file @
d9b8990a
...
...
@@ -74,7 +74,7 @@ void Win32InputManager::_initialize( ParamList ¶mList )
hInst
=
GetModuleHandle
(
0
);
//Create the
input system
//Create the
device
hr
=
DirectInput8Create
(
hInst
,
DIRECTINPUT_VERSION
,
IID_IDirectInput8
,
(
VOID
**
)
&
mDirectInput
,
NULL
);
if
(
FAILED
(
hr
))
OIS_EXCEPT
(
E_General
,
"Win32InputManager::Win32InputManager >> Not able to init DirectX8 Input!"
);
...
...
@@ -117,7 +117,19 @@ void Win32InputManager::_parseConfigSettings( ParamList ¶mList )
void
Win32InputManager
::
_enumerateDevices
()
{
//Enumerate all attached devices
mDirectInput
->
EnumDevices
(
NULL
,
_DIEnumDevCallback
,
this
,
DIEDFL_ATTACHEDONLY
);
mDirectInput
->
EnumDevices
(
NULL
,
_DIEnumDevCallback
,
this
,
DIEDFL_ATTACHEDONLY
);
int
xinputControllers
=
0
;
//let's check how many possible XInput devices we may have (max 4)...
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
XINPUT_STATE
state
;
if
(
XInputGetState
(
i
,
&
state
)
!=
ERROR_DEVICE_NOT_CONNECTED
)
{
//Once we found 1, just check our whole list against devices
Win32JoyStick
::
CheckXInputDevices
(
unusedJoyStickList
);
break
;
}
}
}
//--------------------------------------------------------------------------------//
...
...
@@ -133,6 +145,8 @@ BOOL CALLBACK Win32InputManager::_DIEnumDevCallback(LPCDIDEVICEINSTANCE lpddi, L
GET_DIDEVICE_TYPE
(
lpddi
->
dwDevType
)
==
DI8DEVTYPE_FLIGHT
)
{
JoyStickInfo
jsInfo
;
jsInfo
.
isXInput
=
false
;
jsInfo
.
productGuid
=
lpddi
->
guidProduct
;
jsInfo
.
deviceID
=
lpddi
->
guidInstance
;
jsInfo
.
vendor
=
lpddi
->
tszInstanceName
;
jsInfo
.
devId
=
_this_
->
joySticks
;
...
...
src/win32/Win32JoyStick.cpp
View file @
d9b8990a
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment