Fixed bug occurring when more than 2 controllers had the same name; information

was being saved about only two of them.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3273 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2016-02-06 21:06:23 +00:00
parent 3b2f534bf7
commit a35c66e806
3 changed files with 11 additions and 10 deletions

View File

@ -22,6 +22,11 @@
* Fixed bug with 'Medieval Mayhem' ROMs; the paddle range was set too * Fixed bug with 'Medieval Mayhem' ROMs; the paddle range was set too
low, and as a result the number of players couldn't be selected. low, and as a result the number of players couldn't be selected.
* Fixed bug when using more than two input controllers with the same
name; each controller after the second one was named the same as the
second one. This caused the joystick mappings to be lost, since there
was only information about two controllers being saved.
* Updated internal ROM properties database to ROM-Hunter version 11 * Updated internal ROM properties database to ROM-Hunter version 11
(thanks go to RomHunter for his tireless research in this area). (thanks go to RomHunter for his tireless research in this area).
Related to this, updated the snapshot collection. Related to this, updated the snapshot collection.

View File

@ -196,11 +196,11 @@ EventHandlerSDL2::JoystickSDL2::JoystickSDL2(int idx)
myStick = SDL_JoystickOpen(idx); myStick = SDL_JoystickOpen(idx);
if(myStick) if(myStick)
{ {
// There still seems to be some issue with certain controllers not being // In Windows, all XBox controllers using the XInput API seem to name
// recognized. In this case, SDL names the controller as "XInput Controller". // the controller as "XInput Controller". This would be fine, except
// This would be fine except it also appends " #x", where x seems to vary. // it also appends " #x", where x seems to vary. Obviously this wreaks
// Obviously this wreaks havoc with the idea that a joystick will always // havoc with the idea that a joystick will always have the same name.
// have the same name. So we truncate the number. // So we truncate the number.
const char* sdlname = SDL_JoystickName(myStick); const char* sdlname = SDL_JoystickName(myStick);
const string& desc = BSPF_startsWithIgnoreCase(sdlname, "XInput Controller") const string& desc = BSPF_startsWithIgnoreCase(sdlname, "XInput Controller")
? "XInput Controller" : sdlname; ? "XInput Controller" : sdlname;

View File

@ -317,13 +317,9 @@ bool EventHandler::JoystickHandler::add(StellaJoystick* stick)
// we append ' #x', where 'x' increases consecutively // we append ' #x', where 'x' increases consecutively
int count = 0; int count = 0;
for(const auto& i: myDatabase) for(const auto& i: myDatabase)
{
if(BSPF_startsWithIgnoreCase(i.first, stick->name) && i.second.joy) if(BSPF_startsWithIgnoreCase(i.first, stick->name) && i.second.joy)
{
++count; ++count;
break;
}
}
if(count > 0) if(count > 0)
{ {
ostringstream name; ostringstream name;