SDLJoystick: store name on creation
Otherwise, Dolphin will crash when the joystick is removed.
This commit is contained in:
parent
0eb47e1071
commit
7062967b5b
|
@ -69,7 +69,7 @@ void PopulateDevices()
|
||||||
}
|
}
|
||||||
|
|
||||||
Joystick::Joystick(SDL_Joystick* const joystick, const int sdl_index)
|
Joystick::Joystick(SDL_Joystick* const joystick, const int sdl_index)
|
||||||
: m_joystick(joystick), m_sdl_index(sdl_index)
|
: m_joystick(joystick), m_name(StripSpaces(GetJoystickName(sdl_index)))
|
||||||
{
|
{
|
||||||
// really bad HACKS:
|
// really bad HACKS:
|
||||||
// to not use SDL for an XInput device
|
// to not use SDL for an XInput device
|
||||||
|
@ -284,7 +284,7 @@ void Joystick::UpdateInput()
|
||||||
|
|
||||||
std::string Joystick::GetName() const
|
std::string Joystick::GetName() const
|
||||||
{
|
{
|
||||||
return StripSpaces(GetJoystickName(m_sdl_index));
|
return m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Joystick::GetSource() const
|
std::string Joystick::GetSource() const
|
||||||
|
|
|
@ -151,7 +151,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SDL_Joystick* const m_joystick;
|
SDL_Joystick* const m_joystick;
|
||||||
const int m_sdl_index;
|
std::string m_name;
|
||||||
|
|
||||||
#ifdef USE_SDL_HAPTIC
|
#ifdef USE_SDL_HAPTIC
|
||||||
SDL_Haptic* m_haptic;
|
SDL_Haptic* m_haptic;
|
||||||
|
|
Loading…
Reference in New Issue