This should fix Issue 1798

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4760 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx 2009-12-31 17:42:55 +00:00
parent 40f4dd30c2
commit ba25f038af
5 changed files with 38 additions and 23 deletions

View File

@ -164,8 +164,8 @@ void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, in
else else
{ {
// XInput triggers for Xbox360 pads // XInput triggers for Xbox360 pads
_PadState.axis[CTL_L_SHOULDER] = XInput::GetXI(0, _PadMapping.buttons[CTL_L_SHOULDER] - 1000); _PadState.axis[CTL_L_SHOULDER] = XInput::GetXI(Controller, _PadMapping.buttons[CTL_L_SHOULDER] - 1000);
_PadState.axis[CTL_R_SHOULDER] = XInput::GetXI(0, _PadMapping.buttons[CTL_R_SHOULDER] - 1000); _PadState.axis[CTL_R_SHOULDER] = XInput::GetXI(Controller, _PadMapping.buttons[CTL_R_SHOULDER] - 1000);
} }
#endif #endif
@ -326,7 +326,7 @@ void GetButton(SDL_Joystick *joy, int ControllerID, int buttons, int axes, int h
{ {
for(int i = 0; i <= InputCommon::XI_TRIGGER_R; i++) for(int i = 0; i <= InputCommon::XI_TRIGGER_R; i++)
{ {
if(XInput::GetXI(0, i)) if(XInput::GetXI(ControllerID, i))
{ {
pressed = i + 1000; pressed = i + 1000;
type = InputCommon::CTL_AXIS; type = InputCommon::CTL_AXIS;

View File

@ -187,7 +187,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId)
else if (WiiMoteEmu::NumGoodPads > 0) else if (WiiMoteEmu::NumGoodPads > 0)
{ {
InputCommon::GetButton( InputCommon::GetButton(
WiiMoteEmu::joyinfo[PadID].joy, PadID, WiiMoteEmu::joyinfo[PadID].NumButtons, WiiMoteEmu::joyinfo[PadID].NumAxes, WiiMoteEmu::joyinfo[PadID].NumHats, WiiMoteEmu::WiiMapping[m_Page].joy, PadID, WiiMoteEmu::joyinfo[PadID].NumButtons, WiiMoteEmu::joyinfo[PadID].NumAxes, WiiMoteEmu::joyinfo[PadID].NumHats,
KeyPressed, value, type, pressed, Succeed, Stop, KeyPressed, value, type, pressed, Succeed, Stop,
LeftRight, Axis, XInput, Button, Hat, NoTriggerFilter); LeftRight, Axis, XInput, Button, Hat, NoTriggerFilter);
} }

View File

@ -129,10 +129,12 @@ PADConfigDialognJoy::PADConfigDialognJoy(wxWindow *parent, wxWindowID id, const
// Reset values // Reset values
GetButtonWaitingID = 0; GetButtonWaitingTimer = 0; GetButtonWaitingID = 0; GetButtonWaitingTimer = 0;
if (NumGoodPads)
// Start the constant timer {
int TimesPerSecond = 10; // Start the constant timer
m_ConstantTimer->Start(1000 / TimesPerSecond); int TimesPerSecond = 10;
m_ConstantTimer->Start(1000 / TimesPerSecond);
}
#endif #endif
// wxEVT_KEY_DOWN is blocked for enter, tab and the directional keys // wxEVT_KEY_DOWN is blocked for enter, tab and the directional keys
@ -166,6 +168,7 @@ void PADConfigDialognJoy::OnClose(wxCloseEvent& event)
// Close pads, unless we are running a game // Close pads, unless we are running a game
//if (!g_EmulatorRunning) Shutdown(); //if (!g_EmulatorRunning) Shutdown();
g_FrameOpen = false;
EndModal(wxID_CLOSE); EndModal(wxID_CLOSE);
} }

View File

@ -48,6 +48,7 @@ std::vector<InputCommon::CONTROLLER_INFO> joyinfo;
InputCommon::CONTROLLER_STATE PadState[4]; InputCommon::CONTROLLER_STATE PadState[4];
InputCommon::CONTROLLER_MAPPING PadMapping[4]; InputCommon::CONTROLLER_MAPPING PadMapping[4];
bool g_EmulatorRunning = false; bool g_EmulatorRunning = false;
bool g_FrameOpen = false;
int NumPads = 0, NumGoodPads = 0, LastPad = 0; int NumPads = 0, NumGoodPads = 0, LastPad = 0;
#ifdef _WIN32 #ifdef _WIN32
HWND m_hWnd = NULL, m_hConsole = NULL; // Handle to window HWND m_hWnd = NULL, m_hConsole = NULL; // Handle to window
@ -154,11 +155,13 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
// ------------------ // ------------------
void DllConfig(HWND _hParent) void DllConfig(HWND _hParent)
{ {
// Init Joystick + Haptic (force feedback) subsystem on SDL 1.3 if (!g_EmulatorRunning)
// Populate joyinfo for all attached devices {
Search_Devices(joyinfo, NumPads, NumGoodPads); g_Config.Load(); // load settings
// Init Joystick + Haptic (force feedback) subsystem on SDL 1.3
g_Config.Load(); // load settings // Populate joyinfo for all attached devices
Search_Devices(joyinfo, NumPads, NumGoodPads);
}
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if (!m_ConfigFrame) if (!m_ConfigFrame)
@ -168,9 +171,15 @@ void DllConfig(HWND _hParent)
// Only allow one open at a time // Only allow one open at a time
if (!m_ConfigFrame->IsShown()) if (!m_ConfigFrame->IsShown())
{
g_FrameOpen = true;
m_ConfigFrame->ShowModal(); m_ConfigFrame->ShowModal();
}
else else
{
g_FrameOpen = false;
m_ConfigFrame->Hide(); m_ConfigFrame->Hide();
}
#endif #endif
} }
@ -185,18 +194,20 @@ void Initialize(void *init)
g_PADInitialize = (SPADInitialize*)init; g_PADInitialize = (SPADInitialize*)init;
g_EmulatorRunning = true; g_EmulatorRunning = true;
#ifdef _WIN32 #ifdef _WIN32
m_hWnd = (HWND)g_PADInitialize->hWnd; m_hWnd = (HWND)g_PADInitialize->hWnd;
#endif #endif
#ifdef _DEBUG #ifdef _DEBUG
DEBUG_INIT(); DEBUG_INIT();
#endif #endif
// Populate joyinfo for all attached devices if (!g_FrameOpen)
Search_Devices(joyinfo, NumPads, NumGoodPads); {
g_Config.Load(); // load settings
g_Config.Load(); // load settings // Populate joyinfo for all attached devices
Search_Devices(joyinfo, NumPads, NumGoodPads);
}
} }
void Close_Devices() void Close_Devices()

View File

@ -95,6 +95,7 @@
#ifdef _WIN32 #ifdef _WIN32
extern HWND m_hWnd, m_hConsole; // Handle to window extern HWND m_hWnd, m_hConsole; // Handle to window
#endif #endif
extern bool g_FrameOpen;
extern int NumPads, NumGoodPads, LastPad; // Number of goods pads extern int NumPads, NumGoodPads, LastPad; // Number of goods pads
#endif #endif