mirror of https://github.com/stella-emu/stella.git
Fixed joystick messages, to properly indicate when no joysticks are present.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2866 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
90fbea8286
commit
81347af093
|
@ -37,15 +37,12 @@ void EventHandlerSDL2::initializeJoysticks()
|
|||
{
|
||||
#ifdef JOYSTICK_SUPPORT
|
||||
// Initialize the joystick subsystem
|
||||
if((SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1) || (SDL_NumJoysticks() <= 0))
|
||||
if((SDL_InitSubSystem(SDL_INIT_JOYSTICK) >= 0) && (SDL_NumJoysticks() > 0))
|
||||
{
|
||||
myOSystem->logMessage("No joysticks present.", 1);
|
||||
return;
|
||||
int numSticks = SDL_NumJoysticks();
|
||||
for(int i = 0; i < numSticks; ++i)
|
||||
addJoystick(new JoystickSDL2(i), i);
|
||||
}
|
||||
|
||||
int numSticks = SDL_NumJoysticks();
|
||||
for(int i = 0; i < numSticks; ++i)
|
||||
addJoystick(new JoystickSDL2(i), i);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -130,8 +130,13 @@ void EventHandler::initialize()
|
|||
|
||||
ostringstream buf;
|
||||
buf << "Joystick devices found:" << endl;
|
||||
for(uInt32 i = 0; i < myJoysticks.size(); ++i)
|
||||
buf << " " << i << ": " << myJoysticks[i]->about() << endl << endl;
|
||||
if(myJoysticks.size() == 0)
|
||||
buf << "No joysticks present." << endl;
|
||||
else
|
||||
{
|
||||
for(uInt32 i = 0; i < myJoysticks.size(); ++i)
|
||||
buf << " " << i << ": " << myJoysticks[i]->about() << endl;
|
||||
}
|
||||
myOSystem->logMessage(buf.str(), 1);
|
||||
#else
|
||||
myOSystem->logMessage("Joystick support disabled.", 1);
|
||||
|
|
Loading…
Reference in New Issue