summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJohn Peterson <jpeterson57@gmail.com>2009-02-11 10:30:02 +0000
committerJohn Peterson <jpeterson57@gmail.com>2009-02-11 10:30:02 +0000
commit68f39cb28754b1121fb3d808d5095ef58cf918ed (patch)
tree6078bdd8d94a3859ee2e7593892c8cd633a076de /Source/Core
parent5ba51ed789eb29eb5c75686991c2170f438e1936 (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')
-rw-r--r--Source/Core/Core/Src/Core.cpp8
-rw-r--r--Source/Core/Core/Src/Core.h1
-rw-r--r--Source/Core/DolphinWX/Src/Frame.cpp5
-rw-r--r--Source/Core/DolphinWX/Src/FrameTools.cpp3
-rw-r--r--Source/Core/InputCommon/Src/SDL.cpp42
-rw-r--r--Source/Core/InputCommon/Src/SDL.h9
6 files changed, 52 insertions, 16 deletions
diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp
index 6293490eee..3d7ca44444 100644
--- a/Source/Core/Core/Src/Core.cpp
+++ b/Source/Core/Core/Src/Core.cpp
@@ -145,6 +145,14 @@ bool GetRealWiimote()
{
return g_bRealWiimote;
}
+// This can occur when the emulator is not running and the nJoy configuration window is opened
+void ReconnectPad()
+{
+ CPluginManager &Plugins = CPluginManager::GetInstance();
+ Plugins.FreePad(0);
+ Plugins.GetPad(0)->Config(g_pWindowHandle);
+ Console::Print("ReconnectPad()\n");
+}
// This doesn't work yet, I don't understand how the connection work yet
void ReconnectWiimote()
{
diff --git a/Source/Core/Core/Src/Core.h b/Source/Core/Core/Src/Core.h
index 3dcf8ae49b..0cd70634d9 100644
--- a/Source/Core/Core/Src/Core.h
+++ b/Source/Core/Core/Src/Core.h
@@ -61,6 +61,7 @@ namespace Core
void* GetWindowHandle();
bool GetRealWiimote();
void ReconnectWiimote();
+ void ReconnectPad();
extern bool bReadTrace;
extern bool bWriteTrace;
diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp
index 38dcfae8b1..ffee57e50a 100644
--- a/Source/Core/DolphinWX/Src/Frame.cpp
+++ b/Source/Core/DolphinWX/Src/Frame.cpp
@@ -47,7 +47,6 @@ be accessed from Core::GetWindowHandle().
#include "Common.h" // Common
#include "FileUtil.h"
#include "Timer.h"
-#include "ConsoleWindow.h"
#include "ConfigManager.h" // Core
#include "Core.h"
@@ -184,16 +183,16 @@ int abc = 0;
case NJOY_RELOAD:
// DirectInput in nJoy has failed
+ Core::ReconnectPad();
return 0;
case WIIMOTE_RECONNECT:
// The Wiimote plugin has been shut down, now reconnect the Wiimote
- Console::Print("WIIMOTE_RECONNECT\n");
+ //Console::Print("WIIMOTE_RECONNECT\n");
Core::ReconnectWiimote();
return 0;
}
break;
-
//default:
// return wxPanel::MSWWindowProc(nMsg, wParam, lParam);
}
diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp
index 036f8217bd..40b7a70f72 100644
--- a/Source/Core/DolphinWX/Src/FrameTools.cpp
+++ b/Source/Core/DolphinWX/Src/FrameTools.cpp
@@ -48,6 +48,7 @@ be accessed from Core::GetWindowHandle().
#include "Common.h" // Common
#include "FileUtil.h"
#include "Timer.h"
+#include "ConsoleWindow.h"
#include "ConfigManager.h" // Core
#include "Core.h"
@@ -537,7 +538,7 @@ void CFrame::OnPluginDSP(wxCommandEvent& WXUNUSED (event))
void CFrame::OnPluginPAD(wxCommandEvent& WXUNUSED (event))
{
CPluginManager::GetInstance().OpenConfig(
- GetHandle(),
+ m_Panel->GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[0].c_str(),
PLUGIN_TYPE_PAD
);
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
////////////////////////////