BGE: Fix for regressions T43883 and T43456 (and T43876 likely). SDL joystick related

Only to create and destroy joystick devices for connected joysticks

Reviewers: campbellbarton, sybren, moguri

Reviewed By: sybren

Maniphest Tasks: T43883, T43876

Differential Revision: https://developer.blender.org/D1161
This commit is contained in:
Jorge Bernal 2015-03-07 21:27:30 +01:00
parent c32ded3654
commit b4fccce1f6
Notes: blender-bot 2023-06-12 00:52:52 +02:00
Referenced by issue #43937, Texture paint brush shortcuts no longer working
Referenced by issue #43876, Blender Crashed by Joystick.
Referenced by issue #43456, Blender Game Engine 2.73a - App crashes when in the "Blender Game" Mode and you start/stop 5 times
Referenced by issue #43439, Joystick Sensor doesn't work after second running
1 changed files with 2 additions and 2 deletions

View File

@ -127,7 +127,7 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex )
m_joynum = SDL_NumJoysticks();
for (i=0; i<JOYINDEX_MAX; i++) {
for (i = 0; i < m_joynum; i++) {
m_instance[i] = new SCA_Joystick(i);
m_instance[i]->CreateJoystickDevice();
}
@ -149,7 +149,7 @@ void SCA_Joystick::ReleaseInstance()
if (!SDL_CHECK(SDL_QuitSubSystem)) {
return;
}
for (int i=0; i<JOYINDEX_MAX; i++) {
for (int i = 0; i < m_joynum; i++) {
if (m_instance[i]) {
m_instance[i]->DestroyJoystickDevice();
delete m_instance[i];