mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-27 08:15:33 +01:00
Fix compilation with SDL2. (based on a patch from matthewharveys)
Fixes issue 5971.
This commit is contained in:
parent
af9b9c8f45
commit
ef9d7fb789
@ -18,6 +18,15 @@ namespace ciface
|
|||||||
namespace SDL
|
namespace SDL
|
||||||
{
|
{
|
||||||
|
|
||||||
|
std::string GetJoystickName(int index)
|
||||||
|
{
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
|
return SDL_JoystickNameForIndex(index);
|
||||||
|
#else
|
||||||
|
return SDL_JoystickName(index);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void Init( std::vector<ControllerInterface::Device*>& devices )
|
void Init( std::vector<ControllerInterface::Device*>& devices )
|
||||||
{
|
{
|
||||||
// this is used to number the joysticks
|
// this is used to number the joysticks
|
||||||
@ -32,7 +41,7 @@ void Init( std::vector<ControllerInterface::Device*>& devices )
|
|||||||
SDL_Joystick* dev = SDL_JoystickOpen(i);
|
SDL_Joystick* dev = SDL_JoystickOpen(i);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
Joystick* js = new Joystick(dev, i, name_counts[SDL_JoystickName(i)]++);
|
Joystick* js = new Joystick(dev, i, name_counts[GetJoystickName(i)]++);
|
||||||
// only add if it has some inputs/outputs
|
// only add if it has some inputs/outputs
|
||||||
if (js->Inputs().size() || js->Outputs().size())
|
if (js->Inputs().size() || js->Outputs().size())
|
||||||
devices.push_back( js );
|
devices.push_back( js );
|
||||||
@ -325,13 +334,7 @@ bool Joystick::UpdateOutput()
|
|||||||
|
|
||||||
std::string Joystick::GetName() const
|
std::string Joystick::GetName() const
|
||||||
{
|
{
|
||||||
return StripSpaces(
|
return StripSpaces(GetJoystickName(m_sdl_index));
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
|
||||||
SDL_JoystickNameForIndex(m_sdl_index)
|
|
||||||
#else
|
|
||||||
SDL_JoystickName(m_sdl_index)
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Joystick::GetSource() const
|
std::string Joystick::GetSource() const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user