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
This commit is contained in:
John Peterson
2009-02-11 10:30:02 +00:00
parent 5ba51ed789
commit 68f39cb287
18 changed files with 271 additions and 136 deletions

View File

@ -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()
{

View File

@ -61,6 +61,7 @@ namespace Core
void* GetWindowHandle();
bool GetRealWiimote();
void ReconnectWiimote();
void ReconnectPad();
extern bool bReadTrace;
extern bool bWriteTrace;

View File

@ -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);
}

View File

@ -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
);

View File

@ -38,6 +38,13 @@
////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Definitions
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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
}
//////////////////////////////////////////////////////////////////////////////////////////

View File

@ -52,6 +52,13 @@
namespace InputCommon
{
//////////////////////////////////////////////////////////////////////////////////////////
// Settings
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Show a status window with the detected axes, buttons and so on
//#define SHOW_PAD_STATUS
//////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Structures
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -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
////////////////////////////