summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2020-11-06 04:43:39 +0100
committerMorph <39850852+Morph1984@users.noreply.github.com>2020-11-08 15:35:25 +0100
commit9efbf5309f687b64ff246f1b19ff224ce52814a0 (patch)
tree10b1d955178163661ec98dfe44440e18b3f25649 /src/core/hle/service
parentapplets/controller: Introduce additional checks for mode and caller (diff)
downloadyuzu-9efbf5309f687b64ff246f1b19ff224ce52814a0.tar
yuzu-9efbf5309f687b64ff246f1b19ff224ce52814a0.tar.gz
yuzu-9efbf5309f687b64ff246f1b19ff224ce52814a0.tar.bz2
yuzu-9efbf5309f687b64ff246f1b19ff224ce52814a0.tar.lz
yuzu-9efbf5309f687b64ff246f1b19ff224ce52814a0.tar.xz
yuzu-9efbf5309f687b64ff246f1b19ff224ce52814a0.tar.zst
yuzu-9efbf5309f687b64ff246f1b19ff224ce52814a0.zip
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/am/applets/controller.cpp24
-rw-r--r--src/core/hle/service/am/applets/controller.h1
2 files changed, 19 insertions, 6 deletions
diff --git a/src/core/hle/service/am/applets/controller.cpp b/src/core/hle/service/am/applets/controller.cpp
index 6b8eeabf4..4da10dd38 100644
--- a/src/core/hle/service/am/applets/controller.cpp
+++ b/src/core/hle/service/am/applets/controller.cpp
@@ -70,7 +70,7 @@ void Controller::Initialize() {
const auto& private_arg = private_arg_storage->GetData();
ASSERT(private_arg.size() == sizeof(ControllerSupportArgPrivate));
- std::memcpy(&controller_private_arg, private_arg.data(), sizeof(ControllerSupportArgPrivate));
+ std::memcpy(&controller_private_arg, private_arg.data(), private_arg.size());
ASSERT_MSG(controller_private_arg.arg_private_size == sizeof(ControllerSupportArgPrivate),
"Unknown ControllerSupportArgPrivate revision={} with size={}",
library_applet_version, controller_private_arg.arg_private_size);
@@ -106,7 +106,8 @@ void Controller::Initialize() {
}
switch (controller_private_arg.mode) {
- case ControllerSupportMode::ShowControllerSupport: {
+ case ControllerSupportMode::ShowControllerSupport:
+ case ControllerSupportMode::ShowControllerStrapGuide: {
const auto user_arg_storage = broker.PopNormalDataToApplet();
ASSERT(user_arg_storage != nullptr);
@@ -116,11 +117,11 @@ void Controller::Initialize() {
case LibraryAppletVersion::Version4:
case LibraryAppletVersion::Version5:
ASSERT(user_arg.size() == sizeof(ControllerSupportArgOld));
- std::memcpy(&controller_user_arg_old, user_arg.data(), sizeof(ControllerSupportArgOld));
+ std::memcpy(&controller_user_arg_old, user_arg.data(), user_arg.size());
break;
case LibraryAppletVersion::Version7:
ASSERT(user_arg.size() == sizeof(ControllerSupportArgNew));
- std::memcpy(&controller_user_arg_new, user_arg.data(), sizeof(ControllerSupportArgNew));
+ std::memcpy(&controller_user_arg_new, user_arg.data(), user_arg.size());
break;
default:
UNIMPLEMENTED_MSG("Unknown ControllerSupportArg revision={} with size={}",
@@ -131,8 +132,16 @@ void Controller::Initialize() {
}
break;
}
- case ControllerSupportMode::ShowControllerStrapGuide:
- case ControllerSupportMode::ShowControllerFirmwareUpdate:
+ case ControllerSupportMode::ShowControllerFirmwareUpdate: {
+ const auto update_arg_storage = broker.PopNormalDataToApplet();
+ ASSERT(update_arg_storage != nullptr);
+
+ const auto& update_arg = update_arg_storage->GetData();
+ ASSERT(update_arg.size() == sizeof(ControllerUpdateFirmwareArg));
+
+ std::memcpy(&controller_update_arg, update_arg.data(), update_arg.size());
+ break;
+ }
default: {
UNIMPLEMENTED_MSG("Unimplemented ControllerSupportMode={}", controller_private_arg.mode);
break;
@@ -200,6 +209,9 @@ void Controller::Execute() {
}
case ControllerSupportMode::ShowControllerStrapGuide:
case ControllerSupportMode::ShowControllerFirmwareUpdate:
+ UNIMPLEMENTED_MSG("ControllerSupportMode={} is not implemented",
+ controller_private_arg.mode);
+ [[fallthrough]];
default: {
ConfigurationComplete();
break;
diff --git a/src/core/hle/service/am/applets/controller.h b/src/core/hle/service/am/applets/controller.h
index 05788966e..dfc52da58 100644
--- a/src/core/hle/service/am/applets/controller.h
+++ b/src/core/hle/service/am/applets/controller.h
@@ -125,6 +125,7 @@ private:
ControllerSupportArgPrivate controller_private_arg;
ControllerSupportArgOld controller_user_arg_old;
ControllerSupportArgNew controller_user_arg_new;
+ ControllerUpdateFirmwareArg controller_update_arg;
bool complete{false};
ResultCode status{RESULT_SUCCESS};
bool is_single_mode{false};