summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-07-21 06:01:46 +0200
committerGitHub <noreply@github.com>2021-07-21 06:01:46 +0200
commit2e93df7e486ec8b31300eca0795c5ca75b85b6a0 (patch)
tree862163e299fd46b2bb9124d4f9affb24cd4522d6
parentMerge pull request #6649 from german77/toggle_sdl (diff)
parentapplet_controller: Add preliminary support for version 8 (diff)
downloadyuzu-2e93df7e486ec8b31300eca0795c5ca75b85b6a0.tar
yuzu-2e93df7e486ec8b31300eca0795c5ca75b85b6a0.tar.gz
yuzu-2e93df7e486ec8b31300eca0795c5ca75b85b6a0.tar.bz2
yuzu-2e93df7e486ec8b31300eca0795c5ca75b85b6a0.tar.lz
yuzu-2e93df7e486ec8b31300eca0795c5ca75b85b6a0.tar.xz
yuzu-2e93df7e486ec8b31300eca0795c5ca75b85b6a0.tar.zst
yuzu-2e93df7e486ec8b31300eca0795c5ca75b85b6a0.zip
-rw-r--r--src/core/hle/service/am/applets/applet_controller.cpp21
-rw-r--r--src/core/hle/service/am/applets/applet_controller.h15
2 files changed, 33 insertions, 3 deletions
diff --git a/src/core/hle/service/am/applets/applet_controller.cpp b/src/core/hle/service/am/applets/applet_controller.cpp
index 12682effe..2721679c1 100644
--- a/src/core/hle/service/am/applets/applet_controller.cpp
+++ b/src/core/hle/service/am/applets/applet_controller.cpp
@@ -87,6 +87,10 @@ void Controller::Initialize() {
case sizeof(ControllerUpdateFirmwareArg):
controller_private_arg.mode = ControllerSupportMode::ShowControllerFirmwareUpdate;
break;
+ case sizeof(ControllerKeyRemappingArg):
+ controller_private_arg.mode =
+ ControllerSupportMode::ShowControllerKeyRemappingForSystem;
+ break;
default:
UNIMPLEMENTED_MSG("Unknown ControllerPrivateArg mode={} with arg_size={}",
controller_private_arg.mode, controller_private_arg.arg_size);
@@ -99,7 +103,9 @@ void Controller::Initialize() {
// This is always 0 (Application) except with ShowControllerFirmwareUpdateForSystem.
if (controller_private_arg.caller >= ControllerSupportCaller::MaxControllerSupportCaller) {
if (controller_private_arg.flag_1 &&
- controller_private_arg.mode == ControllerSupportMode::ShowControllerFirmwareUpdate) {
+ (controller_private_arg.mode == ControllerSupportMode::ShowControllerFirmwareUpdate ||
+ controller_private_arg.mode ==
+ ControllerSupportMode::ShowControllerKeyRemappingForSystem)) {
controller_private_arg.caller = ControllerSupportCaller::System;
} else {
controller_private_arg.caller = ControllerSupportCaller::Application;
@@ -121,6 +127,7 @@ void Controller::Initialize() {
std::memcpy(&controller_user_arg_old, user_arg.data(), user_arg.size());
break;
case ControllerAppletVersion::Version7:
+ case ControllerAppletVersion::Version8:
ASSERT(user_arg.size() == sizeof(ControllerSupportArgNew));
std::memcpy(&controller_user_arg_new, user_arg.data(), user_arg.size());
break;
@@ -143,6 +150,16 @@ void Controller::Initialize() {
std::memcpy(&controller_update_arg, update_arg.data(), update_arg.size());
break;
}
+ case ControllerSupportMode::ShowControllerKeyRemappingForSystem: {
+ const auto remapping_arg_storage = broker.PopNormalDataToApplet();
+ ASSERT(remapping_arg_storage != nullptr);
+
+ const auto& remapping_arg = remapping_arg_storage->GetData();
+ ASSERT(remapping_arg.size() == sizeof(ControllerKeyRemappingArg));
+
+ std::memcpy(&controller_key_remapping_arg, remapping_arg.data(), remapping_arg.size());
+ break;
+ }
default: {
UNIMPLEMENTED_MSG("Unimplemented ControllerSupportMode={}", controller_private_arg.mode);
break;
@@ -179,6 +196,7 @@ void Controller::Execute() {
std::vector<ExplainText>(controller_user_arg_old.explain_text.begin(),
controller_user_arg_old.explain_text.end()));
case ControllerAppletVersion::Version7:
+ case ControllerAppletVersion::Version8:
default:
return ConvertToFrontendParameters(
controller_private_arg, controller_user_arg_new.header,
@@ -210,6 +228,7 @@ void Controller::Execute() {
}
case ControllerSupportMode::ShowControllerStrapGuide:
case ControllerSupportMode::ShowControllerFirmwareUpdate:
+ case ControllerSupportMode::ShowControllerKeyRemappingForSystem:
UNIMPLEMENTED_MSG("ControllerSupportMode={} is not implemented",
controller_private_arg.mode);
ConfigurationComplete();
diff --git a/src/core/hle/service/am/applets/applet_controller.h b/src/core/hle/service/am/applets/applet_controller.h
index 20617e91f..0a34c4fc0 100644
--- a/src/core/hle/service/am/applets/applet_controller.h
+++ b/src/core/hle/service/am/applets/applet_controller.h
@@ -25,13 +25,15 @@ enum class ControllerAppletVersion : u32_le {
Version3 = 0x3, // 1.0.0 - 2.3.0
Version4 = 0x4, // 3.0.0 - 5.1.0
Version5 = 0x5, // 6.0.0 - 7.0.1
- Version7 = 0x7, // 8.0.0+
+ Version7 = 0x7, // 8.0.0 - 10.2.0
+ Version8 = 0x8, // 11.0.0+
};
enum class ControllerSupportMode : u8 {
ShowControllerSupport,
ShowControllerStrapGuide,
ShowControllerFirmwareUpdate,
+ ShowControllerKeyRemappingForSystem,
MaxControllerSupportMode,
};
@@ -78,7 +80,7 @@ struct ControllerSupportArgOld {
static_assert(sizeof(ControllerSupportArgOld) == 0x21C,
"ControllerSupportArgOld has incorrect size.");
-// LibraryAppletVersion 0x7
+// LibraryAppletVersion 0x7, 0x8
struct ControllerSupportArgNew {
ControllerSupportArgHeader header{};
std::array<IdentificationColor, 8> identification_colors{};
@@ -95,6 +97,14 @@ struct ControllerUpdateFirmwareArg {
static_assert(sizeof(ControllerUpdateFirmwareArg) == 0x4,
"ControllerUpdateFirmwareArg has incorrect size.");
+struct ControllerKeyRemappingArg {
+ u64 unknown{};
+ u32 unknown_2{};
+ INSERT_PADDING_WORDS(1);
+};
+static_assert(sizeof(ControllerKeyRemappingArg) == 0x10,
+ "ControllerKeyRemappingArg has incorrect size.");
+
struct ControllerSupportResultInfo {
s8 player_count{};
INSERT_PADDING_BYTES(3);
@@ -128,6 +138,7 @@ private:
ControllerSupportArgOld controller_user_arg_old;
ControllerSupportArgNew controller_user_arg_new;
ControllerUpdateFirmwareArg controller_update_arg;
+ ControllerKeyRemappingArg controller_key_remapping_arg;
bool complete{false};
ResultCode status{ResultSuccess};
bool is_single_mode{false};