summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/hid/controllers/npad.cpp
diff options
context:
space:
mode:
authorDavid Marcec <dmarcecguzman@gmail.com>2018-10-12 07:28:00 +0200
committerDavid Marcec <dmarcecguzman@gmail.com>2018-10-12 07:28:00 +0200
commit98b760c645088ef690c7fe5941bdebeed34a3012 (patch)
tree42cee7c01fcf9932fb5d480790cb7e4a3f2612c2 /src/core/hle/service/hid/controllers/npad.cpp
parentDynamically decide handheld variant based on supported npad id priority (diff)
downloadyuzu-98b760c645088ef690c7fe5941bdebeed34a3012.tar
yuzu-98b760c645088ef690c7fe5941bdebeed34a3012.tar.gz
yuzu-98b760c645088ef690c7fe5941bdebeed34a3012.tar.bz2
yuzu-98b760c645088ef690c7fe5941bdebeed34a3012.tar.lz
yuzu-98b760c645088ef690c7fe5941bdebeed34a3012.tar.xz
yuzu-98b760c645088ef690c7fe5941bdebeed34a3012.tar.zst
yuzu-98b760c645088ef690c7fe5941bdebeed34a3012.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index dbb0dd72d..9aa8d6f92 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -287,15 +287,31 @@ Controller_NPad::NPadType Controller_NPad::GetSupportedStyleSet() const {
void Controller_NPad::SetSupportedNPadIdTypes(u8* data, std::size_t length) {
ASSERT(length > 0 && (length % sizeof(u32)) == 0);
+ supported_npad_id_types.clear();
supported_npad_id_types.resize(length / sizeof(u32));
std::memcpy(supported_npad_id_types.data(), data, length);
CheckForHandheldVariant();
}
-
+#pragma optimize("", off)
void Controller_NPad::CheckForHandheldVariant() {
// As some games expect us to use the variant of handheld mode and some games don't. It's
// consistent that games set the npad ids in order of priority. We can just swap the controller
// ids on the fly then if we're in handheld mode
+ if (std::find(supported_npad_id_types.begin(), supported_npad_id_types.end(), 32) !=
+ supported_npad_id_types.end()) {
+ const auto& first_controller = connected_controllers.front();
+ if (first_controller.is_connected &&
+ first_controller.type == NPadControllerType::Handheld) {
+ DisconnectNPad(0);
+ AddNewController(NPadControllerType::Handheld, true);
+ }
+ } else {
+ if (connected_controllers[8].is_connected) {
+ DisconnectNPad(8);
+ AddNewController(NPadControllerType::Handheld);
+ }
+ }
+ /*
if (supported_npad_id_types.size() > 0) {
const auto& first_controller = supported_npad_id_types.front();
if (first_controller == 32 && !connected_controllers[8].is_connected) {
@@ -311,7 +327,7 @@ void Controller_NPad::CheckForHandheldVariant() {
AddNewController(NPadControllerType::Handheld);
}
}
- }
+ }*/
}
const void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) {