Hello!
I’ve been trying to add joystick/joypad support to my app. However I have ran into some problems.
I test this with a “dualshock” type of gamepad. All of the buttons work correctly. The analogues and the d-pad are recognized as axes.
The problem is:
When I use any of the analogue sticks the axis is always returned as 0.
When I use the D-pad the app exits.
GDB says that the crash appears somewhere deep within SDL.
I call SDL_PollEvent(),
which in turn calls SDL_PumpEvents(),
which in turn calls SDL_JoystickUpdate()
and then the app. exits with a Segmentation fault.
I initialize SDL with:
[source lang=“cpp”]
if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) != 0 )
{
std::cout << "Unable to initialize SDL: " << SDL_GetError() << std::endl;
return false;
}
[/source]
Here’s how I setup joystick support:
[source lang=“cpp”]
bool joyok = true;
Which version of SDL is it? Can you post the backtrace?
Jonny DOn Thu, Jun 24, 2010 at 1:19 AM, yezu wrote:
Hello!
I’ve been trying to add joystick/joypad support to my app. However I have
ran into some problems.
I test this with a “dualshock” type of gamepad. All of the buttons work
correctly. The analogues and the d-pad are recognized as axes.
The problem is:
When I use any of the analogue sticks the axis is always returned as 0.
When I use the D-pad the app exits.
GDB says that the crash appears somewhere deep within SDL.
I call SDL_PollEvent(),
which in turn calls SDL_PumpEvents(),
which in turn calls SDL_JoystickUpdate()
and then the app. exits with a Segmentation fault.
I initialize SDL with:
[source lang=“cpp”]
if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) != 0 )
{
std::cout << "Unable to initialize SDL: " << SDL_GetError() << std::endl;
return false;
}
[/source]
Here’s how I setup joystick support:
[source lang=“cpp”]
bool joyok = true;
According to my package manager I use 1.2.14-4. The one that is currently packaged in the Fedora 13 repository.
The backtrace:
Code: #0 0x0084749d in ?? () from /usr/lib/libSDL-1.2.so.0 #1 0x0081dc50 in SDL_JoystickUpdate () from /usr/lib/libSDL-1.2.so.0 #2 0x007f62de in SDL_PumpEvents () from /usr/lib/libSDL-1.2.so.0 #3 0x007f6748 in SDL_PollEvent () from /usr/lib/libSDL-1.2.so.0 #4 0x08060081 in MenuState::gatherInput (this=0x83c6e68)
at …/src/Menu/MenuState.cpp:250 #5 0x0805fc21 in MenuState::update (this=0x83c6e68, frame=0.479999989)
at …/src/Menu/MenuState.cpp:224 #6 0x080617df in MenuManager::executeMachineState (this=0x8276888)
at …/src/Menu/MenuManager.cpp:169 #7 0x08060f5b in MenuManager::run (this=0x8276888, frame=0.479999989)
at …/src/Menu/MenuManager.cpp:32 #8 0x08070c71 in Application::executeMachineState (this=0x809e350)
at …/src/Application/Application.cpp:259 #9 0x08070aed in Application::run (this=0x809e350)
at …/src/Application/Application.cpp:204 #10 0x080593b2 in main () at …/src/PAJ-TUN.cpp:103
Those question marks are probably SDL_SYS_JoystickUpdate(). If you feel
comfortable, you could rebuild SDL from source with debug symbols. Could
you attach a minimal program’s source which reproduces the crash?
Jonny DOn Sat, Jun 26, 2010 at 5:19 AM, yezu wrote:
According to my package manager I use 1.2.14-4. The one that is currently
packaged in the Fedora 13 repository.
The backtrace:
Code:
#0 0x0084749d in ?? () from /usr/lib/libSDL-1.2.so.0 #1 0x0081dc50 in SDL_JoystickUpdate () from /usr/lib/libSDL-1.2.so.0 #2 0x007f62de in SDL_PumpEvents () from /usr/lib/libSDL-1.2.so.0 #3 0x007f6748 in SDL_PollEvent () from /usr/lib/libSDL-1.2.so.0 #4 0x08060081 in MenuState::gatherInput (this=0x83c6e68)
at …/src/Menu/MenuState.cpp:250 #5 0x0805fc21 in MenuState::update (this=0x83c6e68, frame=0.479999989)
at …/src/Menu/MenuState.cpp:224 #6 0x080617df in MenuManager::executeMachineState (this=0x8276888)
at …/src/Menu/MenuManager.cpp:169 #7 0x08060f5b in MenuManager::run (this=0x8276888, frame=0.479999989)
at …/src/Menu/MenuManager.cpp:32 #8 0x08070c71 in Application::executeMachineState (this=0x809e350)
at …/src/Application/Application.cpp:259 #9 0x08070aed in Application::run (this=0x809e350)
at …/src/Application/Application.cpp:204 #10 0x080593b2 in main () at …/src/PAJ-TUN.cpp:103
Hello!
I’ve been trying to add joystick/joypad support to my app. However I have
ran into some problems.
I test this with a “dualshock” type of gamepad. All of the buttons work
correctly. The analogues and the d-pad are recognized as axes.
The problem is:
When I use any of the analogue sticks the axis is always returned as 0.
When I use the D-pad the app exits.
GDB says that the crash appears somewhere deep within SDL.
I call SDL_PollEvent(),
which in turn calls SDL_PumpEvents(),
which in turn calls SDL_JoystickUpdate()
and then the app. exits with a Segmentation fault.
I initialize SDL with:
[source lang=“cpp”]
if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) != 0 )
{
std::cout << "Unable to initialize SDL: " << SDL_GetError() << std::endl;
return false;
}
[/source]
Here’s how I setup joystick support:
[source lang=“cpp”]
bool joyok = true;
Why not just install the debug package for it? I assume Fedora has those? on OpenSUSE there is a debug rpm for each package which adds the symbols, and gdb picks up on that.On 06/26/2010 06:48 AM, Jonathan Dearborn wrote:
Those question marks are probably SDL_SYS_JoystickUpdate(). If you feel
comfortable, you could rebuild SDL from source with debug symbols.
Could you attach a minimal program’s source which reproduces the crash?
Jonny D
On Sat, Jun 26, 2010 at 5:19 AM, yezu <yezu666 at gmail.com <mailto:yezu666 at gmail.com>> wrote:
According to my package manager I use 1.2.14-4. The one that is
currently packaged in the Fedora 13 repository.
The backtrace:
Code:
#0 0x0084749d in ?? () from /usr/lib/libSDL-1.2.so.0
#1 0x0081dc50 in SDL_JoystickUpdate () from /usr/lib/libSDL-1.2.so.0
#2 0x007f62de in SDL_PumpEvents () from /usr/lib/libSDL-1.2.so.0
#3 0x007f6748 in SDL_PollEvent () from /usr/lib/libSDL-1.2.so.0
#4 0x08060081 in MenuState::gatherInput (this=0x83c6e68)
at ../src/Menu/MenuState.cpp:250
#5 0x0805fc21 in MenuState::update (this=0x83c6e68, frame=0.479999989)
at ../src/Menu/MenuState.cpp:224
#6 0x080617df in MenuManager::executeMachineState (this=0x8276888)
at ../src/Menu/MenuManager.cpp:169
#7 0x08060f5b in MenuManager::run (this=0x8276888, frame=0.479999989)
at ../src/Menu/MenuManager.cpp:32
#8 0x08070c71 in Application::executeMachineState (this=0x809e350)
at ../src/Application/Application.cpp:259
#9 0x08070aed in Application::run (this=0x809e350)
at ../src/Application/Application.cpp:204
#10 0x080593b2 in main () at ../src/PAJ-TUN.cpp:103
_______________________________________________
SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
–
LordHavoc
Author of DarkPlaces Quake1 engine - http://icculus.org/twilight/darkplaces
Co-designer of Nexuiz - http://alientrap.org/nexuiz
"War does not prove who is right, it proves who is left." - Unknown
"Any sufficiently advanced technology is indistinguishable from a rigged demo." - James Klass
"A game is a series of interesting choices." - Sid Meier
Have you been able to reproduce the crash with “testjoystick” from the SDL
source distribution?
The first step in diagnosing this kind of problem should be attempting to
reproduce a bug with tests from the SDL source distribution.
If you cannot reproduce the bug, it’s more likely that the bug is in your
program, in which case I advise you to proceed with diagnostics using
valgrind or a similar tool.On Thu, Jun 24, 2010 at 4:19 AM, yezu wrote:
Hello!
I’ve been trying to add joystick/joypad support to my app. However I have
ran into some problems.
I test this with a “dualshock” type of gamepad. All of the buttons work
correctly. The analogues and the d-pad are recognized as axes.
The problem is:
When I use any of the analogue sticks the axis is always returned as 0.
When I use the D-pad the app exits.
GDB says that the crash appears somewhere deep within SDL.
I call SDL_PollEvent(),
which in turn calls SDL_PumpEvents(),
which in turn calls SDL_JoystickUpdate()
and then the app. exits with a Segmentation fault.
I initialize SDL with:
[source lang=“cpp”]
if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) != 0 )
{
std::cout << "Unable to initialize SDL: " << SDL_GetError() << std::endl;
return false;
}
[/source]
Here’s how I setup joystick support:
[source lang=“cpp”]
bool joyok = true;