2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

applets/controller: Pop normal data for StrapGuide and FirmwareUpdate

This commit is contained in:
Morph 2020-11-05 22:43:39 -05:00
parent af1183a993
commit 9efbf5309f
2 changed files with 19 additions and 6 deletions

View file

@ -70,7 +70,7 @@ void Controller::Initialize() {
const auto& private_arg = private_arg_storage->GetData(); const auto& private_arg = private_arg_storage->GetData();
ASSERT(private_arg.size() == sizeof(ControllerSupportArgPrivate)); 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), ASSERT_MSG(controller_private_arg.arg_private_size == sizeof(ControllerSupportArgPrivate),
"Unknown ControllerSupportArgPrivate revision={} with size={}", "Unknown ControllerSupportArgPrivate revision={} with size={}",
library_applet_version, controller_private_arg.arg_private_size); library_applet_version, controller_private_arg.arg_private_size);
@ -106,7 +106,8 @@ void Controller::Initialize() {
} }
switch (controller_private_arg.mode) { switch (controller_private_arg.mode) {
case ControllerSupportMode::ShowControllerSupport: { case ControllerSupportMode::ShowControllerSupport:
case ControllerSupportMode::ShowControllerStrapGuide: {
const auto user_arg_storage = broker.PopNormalDataToApplet(); const auto user_arg_storage = broker.PopNormalDataToApplet();
ASSERT(user_arg_storage != nullptr); ASSERT(user_arg_storage != nullptr);
@ -116,11 +117,11 @@ void Controller::Initialize() {
case LibraryAppletVersion::Version4: case LibraryAppletVersion::Version4:
case LibraryAppletVersion::Version5: case LibraryAppletVersion::Version5:
ASSERT(user_arg.size() == sizeof(ControllerSupportArgOld)); 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; break;
case LibraryAppletVersion::Version7: case LibraryAppletVersion::Version7:
ASSERT(user_arg.size() == sizeof(ControllerSupportArgNew)); 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; break;
default: default:
UNIMPLEMENTED_MSG("Unknown ControllerSupportArg revision={} with size={}", UNIMPLEMENTED_MSG("Unknown ControllerSupportArg revision={} with size={}",
@ -131,8 +132,16 @@ void Controller::Initialize() {
} }
break; 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: { default: {
UNIMPLEMENTED_MSG("Unimplemented ControllerSupportMode={}", controller_private_arg.mode); UNIMPLEMENTED_MSG("Unimplemented ControllerSupportMode={}", controller_private_arg.mode);
break; break;
@ -200,6 +209,9 @@ void Controller::Execute() {
} }
case ControllerSupportMode::ShowControllerStrapGuide: case ControllerSupportMode::ShowControllerStrapGuide:
case ControllerSupportMode::ShowControllerFirmwareUpdate: case ControllerSupportMode::ShowControllerFirmwareUpdate:
UNIMPLEMENTED_MSG("ControllerSupportMode={} is not implemented",
controller_private_arg.mode);
[[fallthrough]];
default: { default: {
ConfigurationComplete(); ConfigurationComplete();
break; break;

View file

@ -125,6 +125,7 @@ private:
ControllerSupportArgPrivate controller_private_arg; ControllerSupportArgPrivate controller_private_arg;
ControllerSupportArgOld controller_user_arg_old; ControllerSupportArgOld controller_user_arg_old;
ControllerSupportArgNew controller_user_arg_new; ControllerSupportArgNew controller_user_arg_new;
ControllerUpdateFirmwareArg controller_update_arg;
bool complete{false}; bool complete{false};
ResultCode status{RESULT_SUCCESS}; ResultCode status{RESULT_SUCCESS};
bool is_single_mode{false}; bool is_single_mode{false};