diff options
| author | 2018-12-24 13:39:07 -0500 | |
|---|---|---|
| committer | 2019-04-25 08:07:57 -0400 | |
| commit | c40cff454d0b4af1c14cafe11ca7372be8ccbd11 (patch) | |
| tree | 939cc519cf8f7f6df253b228ae6bd26f14506fda /src | |
| parent | mii_manager: Cleanup and optimization (diff) | |
| download | yuzu-c40cff454d0b4af1c14cafe11ca7372be8ccbd11.tar.gz yuzu-c40cff454d0b4af1c14cafe11ca7372be8ccbd11.tar.xz yuzu-c40cff454d0b4af1c14cafe11ca7372be8ccbd11.zip | |
mii: Implement IsUpdated command (IPC 0)
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/mii/mii.cpp | 27 | ||||
| -rw-r--r-- | src/core/hle/service/mii/mii_manager.cpp | 12 | ||||
| -rw-r--r-- | src/core/hle/service/mii/mii_manager.h | 4 |
3 files changed, 34 insertions, 9 deletions
diff --git a/src/core/hle/service/mii/mii.cpp b/src/core/hle/service/mii/mii.cpp index c2263569d..39e4e937a 100644 --- a/src/core/hle/service/mii/mii.cpp +++ b/src/core/hle/service/mii/mii.cpp | |||
| @@ -68,13 +68,14 @@ private: | |||
| 68 | 68 | ||
| 69 | void IsUpdated(Kernel::HLERequestContext& ctx) { | 69 | void IsUpdated(Kernel::HLERequestContext& ctx) { |
| 70 | IPC::RequestParser rp{ctx}; | 70 | IPC::RequestParser rp{ctx}; |
| 71 | const auto unknown{rp.PopRaw<u32>()}; | 71 | const auto source{rp.PopRaw<Source>()}; |
| 72 | 72 | ||
| 73 | LOG_WARNING(Service_Mii, "(STUBBED) called with unknown={:08X}", unknown); | 73 | LOG_DEBUG(Service_Mii, "called with source={}", source); |
| 74 | 74 | ||
| 75 | IPC::ResponseBuilder rb{ctx, 3}; | 75 | IPC::ResponseBuilder rb{ctx, 3}; |
| 76 | rb.Push(RESULT_SUCCESS); | 76 | rb.Push(RESULT_SUCCESS); |
| 77 | rb.Push(false); | 77 | rb.Push(db.CheckUpdatedFlag()); |
| 78 | db.ResetUpdatedFlag(); | ||
| 78 | } | 79 | } |
| 79 | 80 | ||
| 80 | void IsFullDatabase(Kernel::HLERequestContext& ctx) { | 81 | void IsFullDatabase(Kernel::HLERequestContext& ctx) { |
| @@ -87,9 +88,9 @@ private: | |||
| 87 | 88 | ||
| 88 | void GetCount(Kernel::HLERequestContext& ctx) { | 89 | void GetCount(Kernel::HLERequestContext& ctx) { |
| 89 | IPC::RequestParser rp{ctx}; | 90 | IPC::RequestParser rp{ctx}; |
| 90 | const auto unknown{rp.PopRaw<u32>()}; | 91 | const auto source{rp.PopRaw<Source>()}; |
| 91 | 92 | ||
| 92 | LOG_DEBUG(Service_Mii, "called with unknown={:08X}", unknown); | 93 | LOG_DEBUG(Service_Mii, "called with source={}", source); |
| 93 | 94 | ||
| 94 | IPC::ResponseBuilder rb{ctx, 3}; | 95 | IPC::ResponseBuilder rb{ctx, 3}; |
| 95 | rb.Push(RESULT_SUCCESS); | 96 | rb.Push(RESULT_SUCCESS); |
| @@ -100,8 +101,10 @@ private: | |||
| 100 | void Get(Kernel::HLERequestContext& ctx) { | 101 | void Get(Kernel::HLERequestContext& ctx) { |
| 101 | IPC::RequestParser rp{ctx}; | 102 | IPC::RequestParser rp{ctx}; |
| 102 | const auto size{rp.PopRaw<u32>()}; | 103 | const auto size{rp.PopRaw<u32>()}; |
| 104 | const auto source{rp.PopRaw<Source>()}; | ||
| 103 | 105 | ||
| 104 | LOG_DEBUG(Service_Mii, "called with size={:08X}, offset={:08X}", size, offsets[0]); | 106 | LOG_DEBUG(Service_Mii, "called with size={:08X}, offset={:08X}, source={}", size, |
| 107 | offsets[0], source); | ||
| 105 | 108 | ||
| 106 | u32 read_size{}; | 109 | u32 read_size{}; |
| 107 | ctx.WriteBuffer(SerializeArray(&MiiManager::GetInfoElement, offsets[0], size, read_size)); | 110 | ctx.WriteBuffer(SerializeArray(&MiiManager::GetInfoElement, offsets[0], size, read_size)); |
| @@ -116,8 +119,10 @@ private: | |||
| 116 | void Get1(Kernel::HLERequestContext& ctx) { | 119 | void Get1(Kernel::HLERequestContext& ctx) { |
| 117 | IPC::RequestParser rp{ctx}; | 120 | IPC::RequestParser rp{ctx}; |
| 118 | const auto size{rp.PopRaw<u32>()}; | 121 | const auto size{rp.PopRaw<u32>()}; |
| 122 | const auto source{rp.PopRaw<Source>()}; | ||
| 119 | 123 | ||
| 120 | LOG_DEBUG(Service_Mii, "called with size={:08X}, offset={:08X}", size, offsets[1]); | 124 | LOG_DEBUG(Service_Mii, "called with size={:08X}, offset={:08X}, source={}", size, |
| 125 | offsets[1], source); | ||
| 121 | 126 | ||
| 122 | u32 read_size{}; | 127 | u32 read_size{}; |
| 123 | ctx.WriteBuffer(SerializeArray(&MiiManager::GetInfo, offsets[1], size, read_size)); | 128 | ctx.WriteBuffer(SerializeArray(&MiiManager::GetInfo, offsets[1], size, read_size)); |
| @@ -157,8 +162,10 @@ private: | |||
| 157 | void Get2(Kernel::HLERequestContext& ctx) { | 162 | void Get2(Kernel::HLERequestContext& ctx) { |
| 158 | IPC::RequestParser rp{ctx}; | 163 | IPC::RequestParser rp{ctx}; |
| 159 | const auto size{rp.PopRaw<u32>()}; | 164 | const auto size{rp.PopRaw<u32>()}; |
| 165 | const auto source{rp.PopRaw<Source>()}; | ||
| 160 | 166 | ||
| 161 | LOG_DEBUG(Service_Mii, "called with size={:08X}, offset={:08X}", size, offsets[2]); | 167 | LOG_DEBUG(Service_Mii, "called with size={:08X}, offset={:08X}, source={}", size, |
| 168 | offsets[2], source); | ||
| 162 | 169 | ||
| 163 | u32 read_size{}; | 170 | u32 read_size{}; |
| 164 | ctx.WriteBuffer( | 171 | ctx.WriteBuffer( |
| @@ -174,8 +181,10 @@ private: | |||
| 174 | void Get3(Kernel::HLERequestContext& ctx) { | 181 | void Get3(Kernel::HLERequestContext& ctx) { |
| 175 | IPC::RequestParser rp{ctx}; | 182 | IPC::RequestParser rp{ctx}; |
| 176 | const auto size{rp.PopRaw<u32>()}; | 183 | const auto size{rp.PopRaw<u32>()}; |
| 184 | const auto source{rp.PopRaw<Source>()}; | ||
| 177 | 185 | ||
| 178 | LOG_DEBUG(Service_Mii, "called with size={:08X}, offset={:08X}", size, offsets[3]); | 186 | LOG_DEBUG(Service_Mii, "called with size={:08X}, offset={:08X}, source={}", size, |
| 187 | offsets[3], source); | ||
| 179 | 188 | ||
| 180 | u32 read_size{}; | 189 | u32 read_size{}; |
| 181 | ctx.WriteBuffer(SerializeArray(&MiiManager::GetStoreData, offsets[3], size, read_size)); | 190 | ctx.WriteBuffer(SerializeArray(&MiiManager::GetStoreData, offsets[3], size, read_size)); |
diff --git a/src/core/hle/service/mii/mii_manager.cpp b/src/core/hle/service/mii/mii_manager.cpp index 083c62b1e..7011ea2bd 100644 --- a/src/core/hle/service/mii/mii_manager.cpp +++ b/src/core/hle/service/mii/mii_manager.cpp | |||
| @@ -204,6 +204,14 @@ MiiInfo MiiManager::CreateDefault(u32 index) { | |||
| 204 | return ConvertStoreDataToInfo(new_mii); | 204 | return ConvertStoreDataToInfo(new_mii); |
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | bool MiiManager::CheckUpdatedFlag() const { | ||
| 208 | return updated_flag; | ||
| 209 | } | ||
| 210 | |||
| 211 | void MiiManager::ResetUpdatedFlag() { | ||
| 212 | updated_flag = false; | ||
| 213 | } | ||
| 214 | |||
| 207 | bool MiiManager::Empty() const { | 215 | bool MiiManager::Empty() const { |
| 208 | return Size() == 0; | 216 | return Size() == 0; |
| 209 | } | 217 | } |
| @@ -213,6 +221,7 @@ bool MiiManager::Full() const { | |||
| 213 | } | 221 | } |
| 214 | 222 | ||
| 215 | void MiiManager::Clear() { | 223 | void MiiManager::Clear() { |
| 224 | updated_flag = true; | ||
| 216 | std::fill(database.miis.begin(), database.miis.end(), MiiStoreData{}); | 225 | std::fill(database.miis.begin(), database.miis.end(), MiiStoreData{}); |
| 217 | } | 226 | } |
| 218 | 227 | ||
| @@ -244,6 +253,7 @@ bool MiiManager::Remove(Common::UUID uuid) { | |||
| 244 | if (iter == database.miis.end()) | 253 | if (iter == database.miis.end()) |
| 245 | return false; | 254 | return false; |
| 246 | 255 | ||
| 256 | updated_flag = true; | ||
| 247 | *iter = MiiStoreData{}; | 257 | *iter = MiiStoreData{}; |
| 248 | EnsureDatabasePartition(); | 258 | EnsureDatabasePartition(); |
| 249 | return true; | 259 | return true; |
| @@ -277,6 +287,7 @@ bool MiiManager::Move(Common::UUID uuid, u32 new_index) { | |||
| 277 | if (index == INVALID_INDEX || new_index >= MAX_MIIS) | 287 | if (index == INVALID_INDEX || new_index >= MAX_MIIS) |
| 278 | return false; | 288 | return false; |
| 279 | 289 | ||
| 290 | updated_flag = true; | ||
| 280 | const auto moving = database.miis[index]; | 291 | const auto moving = database.miis[index]; |
| 281 | const auto replacing = database.miis[new_index]; | 292 | const auto replacing = database.miis[new_index]; |
| 282 | if (replacing.uuid) { | 293 | if (replacing.uuid) { |
| @@ -294,6 +305,7 @@ bool MiiManager::Move(Common::UUID uuid, u32 new_index) { | |||
| 294 | bool MiiManager::AddOrReplace(const MiiStoreData& data) { | 305 | bool MiiManager::AddOrReplace(const MiiStoreData& data) { |
| 295 | const auto index = IndexOf(data.uuid); | 306 | const auto index = IndexOf(data.uuid); |
| 296 | 307 | ||
| 308 | updated_flag = true; | ||
| 297 | if (index == INVALID_INDEX) { | 309 | if (index == INVALID_INDEX) { |
| 298 | const auto size = Size(); | 310 | const auto size = Size(); |
| 299 | if (size == MAX_MIIS) | 311 | if (size == MAX_MIIS) |
diff --git a/src/core/hle/service/mii/mii_manager.h b/src/core/hle/service/mii/mii_manager.h index f7e3d2cf9..bf955930d 100644 --- a/src/core/hle/service/mii/mii_manager.h +++ b/src/core/hle/service/mii/mii_manager.h | |||
| @@ -226,6 +226,9 @@ public: | |||
| 226 | MiiInfo CreateRandom(RandomParameters params); | 226 | MiiInfo CreateRandom(RandomParameters params); |
| 227 | MiiInfo CreateDefault(u32 index); | 227 | MiiInfo CreateDefault(u32 index); |
| 228 | 228 | ||
| 229 | bool CheckUpdatedFlag() const; | ||
| 230 | void ResetUpdatedFlag(); | ||
| 231 | |||
| 229 | bool Empty() const; | 232 | bool Empty() const; |
| 230 | bool Full() const; | 233 | bool Full() const; |
| 231 | 234 | ||
| @@ -254,6 +257,7 @@ private: | |||
| 254 | void EnsureDatabasePartition(); | 257 | void EnsureDatabasePartition(); |
| 255 | 258 | ||
| 256 | MiiDatabase database; | 259 | MiiDatabase database; |
| 260 | bool updated_flag = false; | ||
| 257 | }; | 261 | }; |
| 258 | 262 | ||
| 259 | }; // namespace Service::Mii | 263 | }; // namespace Service::Mii |