10-25-2009, 05:18 PM
Hello,
I've found two problem with zeropad (svn version) under my linux (debian lenny/squeeze with a 2.6.31)
I use the svn revision 396
The first trouble is : if i open the controller config windows, i close it, then i reopen it, the system will launch me a "double free or corruption" then kill the soft with a sigabrt.
With some investigation, this problem was resolved with this little modification
===================================================================
--- linux.cpp (révision 396)
+++ linux.cpp (copie de travail)
@@ -721,7 +721,8 @@
}
vector<JoystickInfo*>::iterator it;
- FORIT(it, vjoysticks) delete *it;
+ vjoysticks.clear();
vjoysticks.resize(SDL_NumJoysticks());
for(int i = 0; i < (int)vjoysticks.size(); ++i) {
The Joystickinfo must have been deleted elsewhere (but I haven't investigate it), so just clear them will be ok.
I've first try to put "*it" to null after the delete, but it doesn' correct the double free.
The second problem is a bit more funny (always on this plugin)
When I change only a button (with a joystick button), it is saved without trouble.
But if i change more than one, the software display the right buttons, but save only the first ! (for example : if i put triangle with JBut1 and after this square with JBut2 , only jbut1 will be saved).
After a bit more of investigation, i have found that this comportement was caused by "savestate".
I've done a workaround, but i can't say why it doesn't work before.
Here my workaround:
(I just hope that "=" on a vector do a clone )
===================================================================
--- linux.cpp (révision 396)
+++ linux.cpp (copie de travail)
@@ -816,11 +817,18 @@
void JoystickInfo:aveState()
{
+
#ifdef JOYSTICK_SUPPORT
+ vector<int> a,b;
+ a.resize(numbuttons);
+ b.resize(numaxes);
+
for(int i = 0; i < numbuttons; ++i)
- vbutstate[i] = SDL_JoystickGetButton(joy, i);
+ a[i] = SDL_JoystickGetButton(joy, i);
for(int i = 0; i < numaxes; ++i)
- vaxisstate[i] = SDL_JoystickGetAxis(joy, i);
+ b[i] = SDL_JoystickGetAxis(joy, i);
+ vbutstate=a;
+ vaxisstate=b;
#endif
}
I've found two problem with zeropad (svn version) under my linux (debian lenny/squeeze with a 2.6.31)
I use the svn revision 396
The first trouble is : if i open the controller config windows, i close it, then i reopen it, the system will launch me a "double free or corruption" then kill the soft with a sigabrt.
With some investigation, this problem was resolved with this little modification
===================================================================
--- linux.cpp (révision 396)
+++ linux.cpp (copie de travail)
@@ -721,7 +721,8 @@
}
vector<JoystickInfo*>::iterator it;
- FORIT(it, vjoysticks) delete *it;
+ vjoysticks.clear();
vjoysticks.resize(SDL_NumJoysticks());
for(int i = 0; i < (int)vjoysticks.size(); ++i) {
The Joystickinfo must have been deleted elsewhere (but I haven't investigate it), so just clear them will be ok.
I've first try to put "*it" to null after the delete, but it doesn' correct the double free.
The second problem is a bit more funny (always on this plugin)
When I change only a button (with a joystick button), it is saved without trouble.
But if i change more than one, the software display the right buttons, but save only the first ! (for example : if i put triangle with JBut1 and after this square with JBut2 , only jbut1 will be saved).
After a bit more of investigation, i have found that this comportement was caused by "savestate".
I've done a workaround, but i can't say why it doesn't work before.
Here my workaround:
(I just hope that "=" on a vector do a clone )
===================================================================
--- linux.cpp (révision 396)
+++ linux.cpp (copie de travail)
@@ -816,11 +817,18 @@
void JoystickInfo:aveState()
{
+
#ifdef JOYSTICK_SUPPORT
+ vector<int> a,b;
+ a.resize(numbuttons);
+ b.resize(numaxes);
+
for(int i = 0; i < numbuttons; ++i)
- vbutstate[i] = SDL_JoystickGetButton(joy, i);
+ a[i] = SDL_JoystickGetButton(joy, i);
for(int i = 0; i < numaxes; ++i)
- vaxisstate[i] = SDL_JoystickGetAxis(joy, i);
+ b[i] = SDL_JoystickGetAxis(joy, i);
+ vbutstate=a;
+ vaxisstate=b;
#endif
}