mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-16 01:30:05 +00:00
Merge pull request #7807 from german77/moar-buttons
input_common: Add home and hard touch press buttons to UDP controllers
This commit is contained in:
commit
72add82ee9
@ -209,6 +209,8 @@ enum class ButtonNames {
|
|||||||
Triangle,
|
Triangle,
|
||||||
Share,
|
Share,
|
||||||
Options,
|
Options,
|
||||||
|
Home,
|
||||||
|
Touch,
|
||||||
|
|
||||||
// Mouse buttons
|
// Mouse buttons
|
||||||
ButtonMouseWheel,
|
ButtonMouseWheel,
|
||||||
|
@ -271,7 +271,7 @@ void UDPClient::OnPadData(Response::PadData data, std::size_t client) {
|
|||||||
const auto touch_axis_y_id =
|
const auto touch_axis_y_id =
|
||||||
static_cast<int>(id == 0 ? PadAxes::Touch1Y : PadAxes::Touch2Y);
|
static_cast<int>(id == 0 ? PadAxes::Touch1Y : PadAxes::Touch2Y);
|
||||||
const auto touch_button_id =
|
const auto touch_button_id =
|
||||||
static_cast<int>(id == 0 ? PadButton::Touch1 : PadButton::touch2);
|
static_cast<int>(id == 0 ? PadButton::Touch1 : PadButton::Touch2);
|
||||||
|
|
||||||
// TODO: Use custom calibration per device
|
// TODO: Use custom calibration per device
|
||||||
const Common::ParamPackage touch_param(Settings::values.touch_device.GetValue());
|
const Common::ParamPackage touch_param(Settings::values.touch_device.GetValue());
|
||||||
@ -319,6 +319,9 @@ void UDPClient::OnPadData(Response::PadData data, std::size_t client) {
|
|||||||
SetButton(identifier, button, button_status);
|
SetButton(identifier, button, button_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetButton(identifier, static_cast<int>(PadButton::Home), data.home != 0);
|
||||||
|
SetButton(identifier, static_cast<int>(PadButton::TouchHardPress), data.touch_hard_press != 0);
|
||||||
|
|
||||||
SetBattery(identifier, GetBatteryLevel(data.info.battery));
|
SetBattery(identifier, GetBatteryLevel(data.info.battery));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,7 +396,7 @@ std::vector<Common::ParamPackage> UDPClient::GetInputDevices() const {
|
|||||||
|
|
||||||
ButtonMapping UDPClient::GetButtonMappingForDevice(const Common::ParamPackage& params) {
|
ButtonMapping UDPClient::GetButtonMappingForDevice(const Common::ParamPackage& params) {
|
||||||
// This list excludes any button that can't be really mapped
|
// This list excludes any button that can't be really mapped
|
||||||
static constexpr std::array<std::pair<Settings::NativeButton::Values, PadButton>, 18>
|
static constexpr std::array<std::pair<Settings::NativeButton::Values, PadButton>, 20>
|
||||||
switch_to_dsu_button = {
|
switch_to_dsu_button = {
|
||||||
std::pair{Settings::NativeButton::A, PadButton::Circle},
|
std::pair{Settings::NativeButton::A, PadButton::Circle},
|
||||||
{Settings::NativeButton::B, PadButton::Cross},
|
{Settings::NativeButton::B, PadButton::Cross},
|
||||||
@ -413,6 +416,8 @@ ButtonMapping UDPClient::GetButtonMappingForDevice(const Common::ParamPackage& p
|
|||||||
{Settings::NativeButton::SR, PadButton::R2},
|
{Settings::NativeButton::SR, PadButton::R2},
|
||||||
{Settings::NativeButton::LStick, PadButton::L3},
|
{Settings::NativeButton::LStick, PadButton::L3},
|
||||||
{Settings::NativeButton::RStick, PadButton::R3},
|
{Settings::NativeButton::RStick, PadButton::R3},
|
||||||
|
{Settings::NativeButton::Home, PadButton::Home},
|
||||||
|
{Settings::NativeButton::Screenshot, PadButton::TouchHardPress},
|
||||||
};
|
};
|
||||||
if (!params.Has("guid") || !params.Has("port") || !params.Has("pad")) {
|
if (!params.Has("guid") || !params.Has("port") || !params.Has("pad")) {
|
||||||
return {};
|
return {};
|
||||||
@ -517,6 +522,12 @@ Common::Input::ButtonNames UDPClient::GetUIButtonName(const Common::ParamPackage
|
|||||||
return Common::Input::ButtonNames::Share;
|
return Common::Input::ButtonNames::Share;
|
||||||
case PadButton::Options:
|
case PadButton::Options:
|
||||||
return Common::Input::ButtonNames::Options;
|
return Common::Input::ButtonNames::Options;
|
||||||
|
case PadButton::Home:
|
||||||
|
return Common::Input::ButtonNames::Home;
|
||||||
|
case PadButton::Touch1:
|
||||||
|
case PadButton::Touch2:
|
||||||
|
case PadButton::TouchHardPress:
|
||||||
|
return Common::Input::ButtonNames::Touch;
|
||||||
default:
|
default:
|
||||||
return Common::Input::ButtonNames::Undefined;
|
return Common::Input::ButtonNames::Undefined;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,9 @@ private:
|
|||||||
Cross = 0x4000,
|
Cross = 0x4000,
|
||||||
Square = 0x8000,
|
Square = 0x8000,
|
||||||
Touch1 = 0x10000,
|
Touch1 = 0x10000,
|
||||||
touch2 = 0x20000,
|
Touch2 = 0x20000,
|
||||||
|
Home = 0x40000,
|
||||||
|
TouchHardPress = 0x80000,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class PadAxes : u8 {
|
enum class PadAxes : u8 {
|
||||||
|
@ -102,6 +102,10 @@ QString GetButtonName(Common::Input::ButtonNames button_name) {
|
|||||||
return QObject::tr("Share");
|
return QObject::tr("Share");
|
||||||
case Common::Input::ButtonNames::Options:
|
case Common::Input::ButtonNames::Options:
|
||||||
return QObject::tr("Options");
|
return QObject::tr("Options");
|
||||||
|
case Common::Input::ButtonNames::Home:
|
||||||
|
return QObject::tr("Home");
|
||||||
|
case Common::Input::ButtonNames::Touch:
|
||||||
|
return QObject::tr("Touch");
|
||||||
case Common::Input::ButtonNames::ButtonMouseWheel:
|
case Common::Input::ButtonNames::ButtonMouseWheel:
|
||||||
return QObject::tr("Wheel", "Indicates the mouse wheel");
|
return QObject::tr("Wheel", "Indicates the mouse wheel");
|
||||||
case Common::Input::ButtonNames::ButtonBackward:
|
case Common::Input::ButtonNames::ButtonBackward:
|
||||||
|
Loading…
Reference in New Issue
Block a user