Fixed crash: when you try to change pad in config dialog

Fixed issue: XInput trigger source cannot be selected
Added proper close of SDL_Joystick

But still nJoy and Wiimote cannot share the same gamepad. It needs to be figured out how to do it with SDL.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4686 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx
2009-12-13 04:31:38 +00:00
parent d476048359
commit 5f47aa7bb1
6 changed files with 37 additions and 40 deletions

View File

@ -204,7 +204,7 @@ void Initialize(void *init)
Called from: The Dolphin Core, PADConfigDialognJoy::OnClose() */
void Shutdown()
{
INFO_LOG(PAD, "Shutdown: %i\n", SDL_WasInit(0));
INFO_LOG(PAD, "Shutdown: %i", SDL_WasInit(0));
// Always change this variable
g_EmulatorRunning = false;
@ -220,8 +220,8 @@ void Shutdown()
vector elements or any bad devices */
for (int i = 0; i < 4; i++)
{
if (joyinfo.size() > (u32)PadMapping[i].ID)
if (joyinfo.at(PadMapping[i].ID).Good)
if (SDL_WasInit(0) && joyinfo.size() > (u32)PadMapping[i].ID)
if (PadState[i].joy && joyinfo.at(PadMapping[i].ID).Good)
if(SDL_JoystickOpened(PadMapping[i].ID))
{
SDL_JoystickClose(PadState[i].joy);
@ -235,7 +235,8 @@ void Shutdown()
NumGoodPads = 0;
// Finally close SDL
SDL_Quit();
if (SDL_WasInit(0))
SDL_Quit();
// Remove the pointer to the initialize data
g_PADInitialize = NULL;