diff options
| author | John Peterson <jpeterson57@gmail.com> | 2009-02-11 10:30:02 +0000 |
|---|---|---|
| committer | John Peterson <jpeterson57@gmail.com> | 2009-02-11 10:30:02 +0000 |
| commit | 68f39cb28754b1121fb3d808d5095ef58cf918ed (patch) | |
| tree | 6078bdd8d94a3859ee2e7593892c8cd633a076de /Source/Core/InputCommon | |
| parent | 5ba51ed789eb29eb5c75686991c2170f438e1936 (diff) | |
nJoy:
1. Circumvent the IDirectInputDevice2::SetDataFormat() error when opening the configuration window to.
2. Fixed the Allow out of focus input option again
3. Allow changing of the mapped pads while a game is running
4. Prevented crashes or problems from any combination of having the configuration window open when a game is started or stopped
5. Fixed a crash that would occur after nJoy was started with a connected pad, then stopped, and all pads disconnected, then started again
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2215 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/InputCommon')
| -rw-r--r-- | Source/Core/InputCommon/Src/SDL.cpp | 42 | ||||
| -rw-r--r-- | Source/Core/InputCommon/Src/SDL.h | 9 |
2 files changed, 39 insertions, 12 deletions
diff --git a/Source/Core/InputCommon/Src/SDL.cpp b/Source/Core/InputCommon/Src/SDL.cpp index 6967e6c489..2c20379394 100644 --- a/Source/Core/InputCommon/Src/SDL.cpp +++ b/Source/Core/InputCommon/Src/SDL.cpp @@ -38,6 +38,13 @@ ////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////
+// Definitions
+// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
+int g_LastPad = 0;
+////////////////////////////////////
+
+
namespace InputCommon
{
@@ -150,7 +157,7 @@ void ReadButton(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, int Input: The virtual device 0, 1, 2 or 3
Function: Updates the PadState struct with the current pad status. The input value "controller" is
for a virtual controller 0 to 3. */
-void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, int controller, int NumButtons)
+void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, int Controller, int NumButtons)
{
// Update the gamepad status
SDL_JoystickUpdate();
@@ -211,21 +218,34 @@ void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, in _PadState.dpad2[CTL_D_PAD_RIGHT] = SDL_JoystickGetButton(_PadState.joy, _PadMapping.dpad2[CTL_D_PAD_RIGHT]);
}
- /* Debugging
- Console::ClearScreen();
+ #ifdef SHOW_PAD_STATUS
+ // Show the status of all connected pads
+ if ((g_LastPad == 0 && Controller == 0) || Controller < g_LastPad) Console::ClearScreen();
+ g_LastPad = Controller;
Console::Print(
- "Controller and handle: %i %i\n"
+ "Pad | Number:%i Enabled:%i Handle:%i\n"
+ "Main Stick | X:%03i Y:%03i\n"
+ "Trigger | Type:%s DigitalL:%i DigitalR:%i AnalogL:%03i AnalogR:%03i HalfPress:%i\n"
+ "Buttons | A:%i X:%i\n"
+ "D-Pad | Type:%s Hat:%i U:%i D:%i\n"
+ "======================================================\n",
- "Triggers:%i %i %i %i %i | HalfPress: %i Mapping: %i\n",
+ Controller, _PadMapping.enabled, _PadState.joy,
- controller, (int)_PadState.joy,
+ _PadState.axis[InputCommon::CTL_MAIN_X], _PadState.axis[InputCommon::CTL_MAIN_Y],
- _PadMapping.triggertype,
- _PadMapping.buttons[CTL_L_SHOULDER], _PadMapping.buttons[CTL_R_SHOULDER],
- _PadState.axis[CTL_L_SHOULDER], _PadState.axis[CTL_R_SHOULDER],
+ (_PadMapping.triggertype ? "CTL_TRIGGER_XINPUT" : "CTL_TRIGGER_SDL"),
+ _PadState.buttons[InputCommon::CTL_L_SHOULDER], _PadState.buttons[InputCommon::CTL_R_SHOULDER],
+ _PadState.axis[InputCommon::CTL_L_SHOULDER], _PadState.axis[InputCommon::CTL_R_SHOULDER],
+ _PadState.halfpress,
- _PadState.halfpress, _PadMapping.halfpress
- ); */
+ _PadState.buttons[InputCommon::CTL_A_BUTTON], _PadState.buttons[InputCommon::CTL_X_BUTTON],
+
+ (_PadMapping.controllertype ? "CTL_DPAD_CUSTOM" : "CTL_DPAD_HAT"),
+ _PadState.dpad,
+ _PadState.dpad2[InputCommon::CTL_D_PAD_UP], _PadState.dpad2[InputCommon::CTL_D_PAD_DOWN]
+ );
+ #endif
}
//////////////////////////////////////////////////////////////////////////////////////////
diff --git a/Source/Core/InputCommon/Src/SDL.h b/Source/Core/InputCommon/Src/SDL.h index c3b0597954..b6da81d6cb 100644 --- a/Source/Core/InputCommon/Src/SDL.h +++ b/Source/Core/InputCommon/Src/SDL.h @@ -53,6 +53,13 @@ namespace InputCommon {
//////////////////////////////////////////////////////////////////////////////////////////
+// Settings
+// ŻŻŻŻŻŻŻŻŻŻ
+// Show a status window with the detected axes, buttons and so on
+//#define SHOW_PAD_STATUS
+//////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////////////////
// Structures
/* ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
CONTROLLER_STATE buttons (PadState) = 0 or 1
@@ -198,7 +205,7 @@ int Pad_Convert(int _val); std::vector<int> Pad_Square_to_Circle(int _x, int _y, int _pad, CONTROLLER_MAPPING _PadMapping);
#ifndef _SDL_MAIN_
-
+ extern int g_LastPad;
#endif
////////////////////////////
|
