aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/configuration/configure_input.cpp
diff options
context:
space:
mode:
authorTobias <thm.frey@gmail.com>2018-09-11 03:29:59 +0200
committerbunnei <bunneidev@gmail.com>2018-09-10 21:29:59 -0400
commit804115b2a46d25408b34e3e08e83d3f926fd9968 (patch)
treee34636fd7928333756ef2d1282a2e2ef9c908069 /src/yuzu/configuration/configure_input.cpp
parentd6e8e16a664c7a8761f98ee690a2621e4ace6edc (diff)
Port #4141 from citra: Joystick hotplug support (#1275)
* Joystick hotplug support (#4141) * use SDL_PollEvent instead of SDL_JoystickUpdate Register hot plugged controller by GUID if they were configured in a previous session * Move SDL_PollEvent into its own thread * Don't store SDLJoystick pointer in Input Device; Get pointer on each GetStatus call * Fix that joystick_list gets cleared after SDL_Quit * Add VirtualJoystick for InputDevices thats never nullptr * fixup! Add VirtualJoystick for InputDevices thats never nullptr * fixup! fixup! Add VirtualJoystick for InputDevices thats never nullptr * Remove SDL_GameController, make SDL_Joystick* unique_ptr * fixup! Remove SDL_GameController, make SDL_Joystick* unique_ptr * Adressed feedback; fixed handling of same guid reconnects * fixup! Adressed feedback; fixed handling of same guid reconnects * merge the two joystick_lists into one * make SDLJoystick a member of VirtualJoystick * fixup! make SDLJoystick a member of VirtualJoystick * fixup! make SDLJoystick a member of VirtualJoystick * fixup! fixup! make SDLJoystick a member of VirtualJoystick * SDLJoystick: Addressed review comments * Address one missed review comment
Diffstat (limited to 'src/yuzu/configuration/configure_input.cpp')
-rw-r--r--src/yuzu/configuration/configure_input.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp
index 5e7badedf4..d29abb74b2 100644
--- a/src/yuzu/configuration/configure_input.cpp
+++ b/src/yuzu/configuration/configure_input.cpp
@@ -1,4 +1,4 @@
-// Copyright 2016 Citra Emulator Project
+// Copyright 2016 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
@@ -53,19 +53,18 @@ static QString ButtonToText(const Common::ParamPackage& param) {
} else if (param.Get("engine", "") == "keyboard") {
return getKeyName(param.Get("code", 0));
} else if (param.Get("engine", "") == "sdl") {
- QString text = QString(QObject::tr("Joystick %1")).arg(param.Get("joystick", "").c_str());
if (param.Has("hat")) {
- text += QString(QObject::tr(" Hat %1 %2"))
- .arg(param.Get("hat", "").c_str(), param.Get("direction", "").c_str());
+ return QString(QObject::tr("Hat %1 %2"))
+ .arg(param.Get("hat", "").c_str(), param.Get("direction", "").c_str());
}
if (param.Has("axis")) {
- text += QString(QObject::tr(" Axis %1%2"))
- .arg(param.Get("axis", "").c_str(), param.Get("direction", "").c_str());
+ return QString(QObject::tr("Axis %1%2"))
+ .arg(param.Get("axis", "").c_str(), param.Get("direction", "").c_str());
}
if (param.Has("button")) {
- text += QString(QObject::tr(" Button %1")).arg(param.Get("button", "").c_str());
+ return QString(QObject::tr("Button %1")).arg(param.Get("button", "").c_str());
}
- return text;
+ return QString();
} else {
return QObject::tr("[unknown]");
}
@@ -81,13 +80,12 @@ static QString AnalogToText(const Common::ParamPackage& param, const std::string
return QString(QObject::tr("[unused]"));
}
- QString text = QString(QObject::tr("Joystick %1")).arg(param.Get("joystick", "").c_str());
if (dir == "left" || dir == "right") {
- text += QString(QObject::tr(" Axis %1")).arg(param.Get("axis_x", "").c_str());
+ return QString(QObject::tr("Axis %1")).arg(param.Get("axis_x", "").c_str());
} else if (dir == "up" || dir == "down") {
- text += QString(QObject::tr(" Axis %1")).arg(param.Get("axis_y", "").c_str());
+ return QString(QObject::tr("Axis %1")).arg(param.Get("axis_y", "").c_str());
}
- return text;
+ return QString();
} else {
return QObject::tr("[unknown]");
}