Used better variable name.

This commit is contained in:
hiker 2014-11-03 21:36:54 +11:00
parent 150941aad2
commit 18bcb92afc
6 changed files with 11 additions and 13 deletions

View File

@ -483,11 +483,11 @@ struct SJoystickInfo
} PovHat; } PovHat;
//! Set if the name of the joystick is useful: //! Set if the name of the joystick is useful:
/** On windows the default name is useless, since it's always the same /** On windows the generic name is useless, since it's always the same
* indepentent of what joystick is connected ("Microsoft PC-joystick driver"). * indepentent of what joystick is connected ("Microsoft PC-joystick driver").
* We will try to get a better name from the registry, but if this should * We will try to get a better name from the registry, but if this should
* fail this flag is set and used by STK. */ * fail this flag is set and used by STK. */
bool HasNonDefaultName; bool HasGenericName;
}; // struct SJoystickInfo }; // struct SJoystickInfo

View File

@ -2038,7 +2038,7 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> & joystickInf
ActiveJoysticks.push_back(info); ActiveJoysticks.push_back(info);
returnInfo.HasNonDefaultName = true; returnInfo.HasGenericName = false;
returnInfo.Joystick = joystick; returnInfo.Joystick = joystick;
returnInfo.PovHat = SJoystickInfo::POV_HAT_UNKNOWN; returnInfo.PovHat = SJoystickInfo::POV_HAT_UNKNOWN;
returnInfo.Axes = info.axes; returnInfo.Axes = info.axes;

View File

@ -557,7 +557,7 @@ bool CIrrDeviceSDL::activateJoysticks(core::array<SJoystickInfo> & joystickInfo)
SJoystickInfo info; SJoystickInfo info;
info.Joystick = joystick; info.Joystick = joystick;
info.HasNonDefaultName = true; info.HasGenericName = false;
info.Axes = SDL_JoystickNumAxes(Joysticks[joystick]); info.Axes = SDL_JoystickNumAxes(Joysticks[joystick]);
info.Buttons = SDL_JoystickNumButtons(Joysticks[joystick]); info.Buttons = SDL_JoystickNumButtons(Joysticks[joystick]);
info.Name = SDL_JoystickName(joystick); info.Name = SDL_JoystickName(joystick);

View File

@ -369,7 +369,7 @@ void setJoystickName(int index, const JOYCAPS &caps, SJoystickInfo *joystick)
// As a default use the name given in the joystick structure // As a default use the name given in the joystick structure
// - though that is always the same name, independent of joystick :( // - though that is always the same name, independent of joystick :(
joystick->Name = caps.szPname; joystick->Name = caps.szPname;
joystick->HasNonDefaultName = true; joystick->HasGenericName = true;
core::stringc key = core::stringc(REGSTR_PATH_JOYCONFIG)+"\\"+caps.szRegKey core::stringc key = core::stringc(REGSTR_PATH_JOYCONFIG)+"\\"+caps.szRegKey
+ "\\"+REGSTR_KEY_JOYCURR; + "\\"+REGSTR_KEY_JOYCURR;
@ -413,7 +413,7 @@ void setJoystickName(int index, const JOYCAPS &caps, SJoystickInfo *joystick)
regresult = RegQueryValueExA(hKey, REGSTR_VAL_JOYOEMNAME, 0, 0, regresult = RegQueryValueExA(hKey, REGSTR_VAL_JOYOEMNAME, 0, 0,
(LPBYTE)name, &regsize ); (LPBYTE)name, &regsize );
joystick->Name = name; joystick->Name = name;
joystick->HasNonDefaultName = false; joystick->HasGenericName = false;
} // if name } // if name
} // if SUCCESS } // if SUCCESS
RegCloseKey(hKey); RegCloseKey(hKey);

View File

@ -1709,7 +1709,7 @@ bool CIrrDeviceMacOSX::activateJoysticks(core::array<SJoystickInfo> & joystickIn
SJoystickInfo returnInfo; SJoystickInfo returnInfo;
returnInfo.Joystick = jindex; returnInfo.Joystick = jindex;
returnInfo..HasNonDefaultName = true; returnInfo..HasGenericName = false;
returnInfo.Axes = info.axes; returnInfo.Axes = info.axes;
//returnInfo.Hats = info.hats; //returnInfo.Hats = info.hats;
returnInfo.Buttons = info.buttons; returnInfo.Buttons = info.buttons;

View File

@ -101,14 +101,12 @@ bool DeviceManager::initialize()
// Some linux systems report a disk accelerometer as a gamepad, skip that // Some linux systems report a disk accelerometer as a gamepad, skip that
if (name.find("LIS3LV02DL") != -1) continue; if (name.find("LIS3LV02DL") != -1) continue;
if(!m_irrlicht_gamepads[id].HasNonDefaultName) if(m_irrlicht_gamepads[id].HasGenericName)
{ {
// On Windows all gamepads are given the same name ('microsoft // On Windows all gamepads are given the same name ('microsoft
// pc-joystick driver') - unless we add DirectInput or so as // pc-joystick driver'). Irrlicht now tries to get a better name
// dependency. We can't test for the name, since the name is even // from the registry, but in case this should fail we still have
// translated. Irrlicht now tries to get a better name from the // all gamepads with the same name shown in the GUI. This makes
// registry, but in case this should fail we still have all
// gamepads with the same name shown in the GUI. This makes
// configuration totally useless, so append an ID to the name. // configuration totally useless, so append an ID to the name.
name = name + " " + StringUtils::toString(id).c_str(); name = name + " " + StringUtils::toString(id).c_str();
} }