summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/mii
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-07-15 02:16:39 +0200
committerLiam <byteslice@airmail.cc>2023-08-08 17:09:37 +0200
commit84cb20bc72031947ac9e625b4a2b5e0059dda441 (patch)
tree94e816691b3800153f7955b03ae63cc36dfdb9dc /src/core/hle/service/mii
parentMerge pull request #11216 from lat9nq/no-mesa-astc (diff)
downloadyuzu-84cb20bc72031947ac9e625b4a2b5e0059dda441.tar
yuzu-84cb20bc72031947ac9e625b4a2b5e0059dda441.tar.gz
yuzu-84cb20bc72031947ac9e625b4a2b5e0059dda441.tar.bz2
yuzu-84cb20bc72031947ac9e625b4a2b5e0059dda441.tar.lz
yuzu-84cb20bc72031947ac9e625b4a2b5e0059dda441.tar.xz
yuzu-84cb20bc72031947ac9e625b4a2b5e0059dda441.tar.zst
yuzu-84cb20bc72031947ac9e625b4a2b5e0059dda441.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/mii/mii.cpp34
-rw-r--r--src/core/hle/service/mii/mii_manager.cpp5
-rw-r--r--src/core/hle/service/mii/mii_manager.h4
3 files changed, 16 insertions, 27 deletions
diff --git a/src/core/hle/service/mii/mii.cpp b/src/core/hle/service/mii/mii.cpp
index 5c7adf97d..65c11a2f3 100644
--- a/src/core/hle/service/mii/mii.cpp
+++ b/src/core/hle/service/mii/mii.cpp
@@ -101,20 +101,14 @@ private:
LOG_DEBUG(Service_Mii, "called with source_flag={}", source_flag);
- const auto result{manager.GetDefault(source_flag)};
- if (result.Failed()) {
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(result.Code());
- return;
- }
-
- if (result->size() > 0) {
- ctx.WriteBuffer(SerializeArray(*result));
+ const auto default_miis{manager.GetDefault(source_flag)};
+ if (default_miis.size() > 0) {
+ ctx.WriteBuffer(SerializeArray(default_miis));
}
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
- rb.Push<u32>(static_cast<u32>(result->size()));
+ rb.Push<u32>(static_cast<u32>(default_miis.size()));
}
void Get1(HLERequestContext& ctx) {
@@ -123,15 +117,10 @@ private:
LOG_DEBUG(Service_Mii, "called with source_flag={}", source_flag);
- const auto result{manager.GetDefault(source_flag)};
- if (result.Failed()) {
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(result.Code());
- return;
- }
+ const auto default_miis{manager.GetDefault(source_flag)};
std::vector<CharInfo> values;
- for (const auto& element : *result) {
+ for (const auto& element : default_miis) {
values.emplace_back(element.info);
}
@@ -139,7 +128,7 @@ private:
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
- rb.Push<u32>(static_cast<u32>(result->size()));
+ rb.Push<u32>(static_cast<u32>(default_miis.size()));
}
void UpdateLatest(HLERequestContext& ctx) {
@@ -149,16 +138,17 @@ private:
LOG_DEBUG(Service_Mii, "called with source_flag={}", source_flag);
- const auto result{manager.UpdateLatest(info, source_flag)};
- if (result.Failed()) {
+ CharInfo new_char_info{};
+ const auto result{manager.UpdateLatest(&new_char_info, info, source_flag)};
+ if (result != ResultSuccess) {
IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(result.Code());
+ rb.Push(result);
return;
}
IPC::ResponseBuilder rb{ctx, 2 + sizeof(CharInfo) / sizeof(u32)};
rb.Push(ResultSuccess);
- rb.PushRaw<CharInfo>(*result);
+ rb.PushRaw<CharInfo>(new_char_info);
}
void BuildRandom(HLERequestContext& ctx) {
diff --git a/src/core/hle/service/mii/mii_manager.cpp b/src/core/hle/service/mii/mii_manager.cpp
index c920650f5..46125d473 100644
--- a/src/core/hle/service/mii/mii_manager.cpp
+++ b/src/core/hle/service/mii/mii_manager.cpp
@@ -409,8 +409,7 @@ u32 MiiManager::GetCount(SourceFlag source_flag) const {
return static_cast<u32>(count);
}
-ResultVal<CharInfo> MiiManager::UpdateLatest([[maybe_unused]] const CharInfo& info,
- SourceFlag source_flag) {
+Result MiiManager::UpdateLatest(CharInfo* out_info, const CharInfo& info, SourceFlag source_flag) {
if ((source_flag & SourceFlag::Database) == SourceFlag::None) {
return ERROR_CANNOT_FIND_ENTRY;
}
@@ -672,7 +671,7 @@ bool MiiManager::ValidateV3Info(const Ver3StoreData& mii_v3) const {
return is_valid;
}
-ResultVal<std::vector<MiiInfoElement>> MiiManager::GetDefault(SourceFlag source_flag) {
+std::vector<MiiInfoElement> MiiManager::GetDefault(SourceFlag source_flag) {
std::vector<MiiInfoElement> result;
if ((source_flag & SourceFlag::Default) == SourceFlag::None) {
diff --git a/src/core/hle/service/mii/mii_manager.h b/src/core/hle/service/mii/mii_manager.h
index 5525fcd1c..45c2be3c8 100644
--- a/src/core/hle/service/mii/mii_manager.h
+++ b/src/core/hle/service/mii/mii_manager.h
@@ -19,12 +19,12 @@ public:
bool CheckAndResetUpdateCounter(SourceFlag source_flag, u64& current_update_counter);
bool IsFullDatabase() const;
u32 GetCount(SourceFlag source_flag) const;
- ResultVal<CharInfo> UpdateLatest(const CharInfo& info, SourceFlag source_flag);
+ Result UpdateLatest(CharInfo* out_info, const CharInfo& info, SourceFlag source_flag);
CharInfo BuildRandom(Age age, Gender gender, Race race);
CharInfo BuildDefault(std::size_t index);
CharInfo ConvertV3ToCharInfo(const Ver3StoreData& mii_v3) const;
bool ValidateV3Info(const Ver3StoreData& mii_v3) const;
- ResultVal<std::vector<MiiInfoElement>> GetDefault(SourceFlag source_flag);
+ std::vector<MiiInfoElement> GetDefault(SourceFlag source_flag);
Result GetIndex(const CharInfo& info, u32& index);
// This is nn::mii::detail::Ver::StoreDataRaw::BuildFromStoreData