summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/am
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/am')
-rw-r--r--src/core/hle/service/am/applets/applet_cabinet.cpp16
-rw-r--r--src/core/hle/service/am/applets/applet_cabinet.h11
2 files changed, 14 insertions, 13 deletions
diff --git a/src/core/hle/service/am/applets/applet_cabinet.cpp b/src/core/hle/service/am/applets/applet_cabinet.cpp
index 01f577ab9..d0969b0f1 100644
--- a/src/core/hle/service/am/applets/applet_cabinet.cpp
+++ b/src/core/hle/service/am/applets/applet_cabinet.cpp
@@ -98,7 +98,7 @@ void Cabinet::Execute() {
}
}
-void Cabinet::DisplayCompleted(bool apply_changes, const std::string& amiibo_name) {
+void Cabinet::DisplayCompleted(bool apply_changes, std::string_view amiibo_name) {
Service::Mii::MiiManager manager;
ReturnValueForAmiiboSettings applet_output{};
@@ -118,7 +118,7 @@ void Cabinet::DisplayCompleted(bool apply_changes, const std::string& amiibo_nam
switch (applet_input_common.applet_mode) {
case Service::NFP::CabinetMode::StartNicknameAndOwnerSettings: {
Service::NFP::AmiiboName name{};
- memcpy(name.data(), amiibo_name.data(), std::min(amiibo_name.size(), name.size() - 1));
+ std::memcpy(name.data(), amiibo_name.data(), std::min(amiibo_name.size(), name.size() - 1));
nfp_device->SetNicknameAndOwner(name);
break;
}
@@ -142,12 +142,12 @@ void Cabinet::DisplayCompleted(bool apply_changes, const std::string& amiibo_nam
const auto tag_result = nfp_device->GetTagInfo(applet_output.tag_info);
nfp_device->Finalize();
- if (reg_result.IsSuccess() && tag_result.IsSuccess()) {
- applet_output.result = CabinetResult::All;
- } else if (reg_result.IsSuccess()) {
- applet_output.result = CabinetResult::RegisterInfo;
- } else if (tag_result.IsSuccess()) {
- applet_output.result = CabinetResult::TagInfo;
+ if (reg_result.IsSuccess()) {
+ applet_output.result |= CabinetResult::RegisterInfo;
+ }
+
+ if (tag_result.IsSuccess()) {
+ applet_output.result |= CabinetResult::TagInfo;
}
std::vector<u8> out_data(sizeof(ReturnValueForAmiiboSettings));
diff --git a/src/core/hle/service/am/applets/applet_cabinet.h b/src/core/hle/service/am/applets/applet_cabinet.h
index 8466d5997..84197a807 100644
--- a/src/core/hle/service/am/applets/applet_cabinet.h
+++ b/src/core/hle/service/am/applets/applet_cabinet.h
@@ -25,16 +25,17 @@ class NfpDevice;
namespace Service::AM::Applets {
-enum class CabinetAppletVersion : s32 {
+enum class CabinetAppletVersion : u32 {
Version1 = 0x1,
};
enum class CabinetResult : u8 {
- Cancel,
+ Cancel = 0,
TagInfo = 1 << 1,
RegisterInfo = 1 << 2,
All = TagInfo | RegisterInfo,
};
+DECLARE_ENUM_FLAG_OPERATORS(CabinetResult)
// This is nn::nfp::AmiiboSettingsStartParam
struct AmiiboSettingsStartParam {
@@ -45,7 +46,7 @@ struct AmiiboSettingsStartParam {
static_assert(sizeof(AmiiboSettingsStartParam) == 0x30,
"AmiiboSettingsStartParam is an invalid size");
-#pragma pack(1)
+#pragma pack(push, 1)
// This is nn::nfp::StartParamForAmiiboSettings
struct StartParamForAmiiboSettings {
u8 param_1;
@@ -72,7 +73,7 @@ struct ReturnValueForAmiiboSettings {
};
static_assert(sizeof(ReturnValueForAmiiboSettings) == 0x188,
"ReturnValueForAmiiboSettings is an invalid size");
-#pragma pack()
+#pragma pack(pop)
class Cabinet final : public Applet {
public:
@@ -86,7 +87,7 @@ public:
Result GetStatus() const override;
void ExecuteInteractive() override;
void Execute() override;
- void DisplayCompleted(bool apply_changes, const std::string& amiibo_name);
+ void DisplayCompleted(bool apply_changes, std::string_view amiibo_name);
void Cancel();
private: