summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-12-24 19:39:07 +0100
committerZach Hilman <zachhilman@gmail.com>2019-04-25 14:07:57 +0200
commitc40cff454d0b4af1c14cafe11ca7372be8ccbd11 (patch)
tree939cc519cf8f7f6df253b228ae6bd26f14506fda /src/core/hle/service
parentmii_manager: Cleanup and optimization (diff)
downloadyuzu-c40cff454d0b4af1c14cafe11ca7372be8ccbd11.tar
yuzu-c40cff454d0b4af1c14cafe11ca7372be8ccbd11.tar.gz
yuzu-c40cff454d0b4af1c14cafe11ca7372be8ccbd11.tar.bz2
yuzu-c40cff454d0b4af1c14cafe11ca7372be8ccbd11.tar.lz
yuzu-c40cff454d0b4af1c14cafe11ca7372be8ccbd11.tar.xz
yuzu-c40cff454d0b4af1c14cafe11ca7372be8ccbd11.tar.zst
yuzu-c40cff454d0b4af1c14cafe11ca7372be8ccbd11.zip
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/mii/mii.cpp27
-rw-r--r--src/core/hle/service/mii/mii_manager.cpp12
-rw-r--r--src/core/hle/service/mii/mii_manager.h4
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:
void IsUpdated(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
- const auto unknown{rp.PopRaw<u32>()};
+ const auto source{rp.PopRaw<Source>()};
- LOG_WARNING(Service_Mii, "(STUBBED) called with unknown={:08X}", unknown);
+ LOG_DEBUG(Service_Mii, "called with source={}", source);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
- rb.Push(false);
+ rb.Push(db.CheckUpdatedFlag());
+ db.ResetUpdatedFlag();
}
void IsFullDatabase(Kernel::HLERequestContext& ctx) {
@@ -87,9 +88,9 @@ private:
void GetCount(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
- const auto unknown{rp.PopRaw<u32>()};
+ const auto source{rp.PopRaw<Source>()};
- LOG_DEBUG(Service_Mii, "called with unknown={:08X}", unknown);
+ LOG_DEBUG(Service_Mii, "called with source={}", source);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
@@ -100,8 +101,10 @@ private:
void Get(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto size{rp.PopRaw<u32>()};
+ const auto source{rp.PopRaw<Source>()};
- LOG_DEBUG(Service_Mii, "called with size={:08X}, offset={:08X}", size, offsets[0]);
+ LOG_DEBUG(Service_Mii, "called with size={:08X}, offset={:08X}, source={}", size,
+ offsets[0], source);
u32 read_size{};
ctx.WriteBuffer(SerializeArray(&MiiManager::GetInfoElement, offsets[0], size, read_size));
@@ -116,8 +119,10 @@ private:
void Get1(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto size{rp.PopRaw<u32>()};
+ const auto source{rp.PopRaw<Source>()};
- LOG_DEBUG(Service_Mii, "called with size={:08X}, offset={:08X}", size, offsets[1]);
+ LOG_DEBUG(Service_Mii, "called with size={:08X}, offset={:08X}, source={}", size,
+ offsets[1], source);
u32 read_size{};
ctx.WriteBuffer(SerializeArray(&MiiManager::GetInfo, offsets[1], size, read_size));
@@ -157,8 +162,10 @@ private:
void Get2(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto size{rp.PopRaw<u32>()};
+ const auto source{rp.PopRaw<Source>()};
- LOG_DEBUG(Service_Mii, "called with size={:08X}, offset={:08X}", size, offsets[2]);
+ LOG_DEBUG(Service_Mii, "called with size={:08X}, offset={:08X}, source={}", size,
+ offsets[2], source);
u32 read_size{};
ctx.WriteBuffer(
@@ -174,8 +181,10 @@ private:
void Get3(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto size{rp.PopRaw<u32>()};
+ const auto source{rp.PopRaw<Source>()};
- LOG_DEBUG(Service_Mii, "called with size={:08X}, offset={:08X}", size, offsets[3]);
+ LOG_DEBUG(Service_Mii, "called with size={:08X}, offset={:08X}, source={}", size,
+ offsets[3], source);
u32 read_size{};
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) {
return ConvertStoreDataToInfo(new_mii);
}
+bool MiiManager::CheckUpdatedFlag() const {
+ return updated_flag;
+}
+
+void MiiManager::ResetUpdatedFlag() {
+ updated_flag = false;
+}
+
bool MiiManager::Empty() const {
return Size() == 0;
}
@@ -213,6 +221,7 @@ bool MiiManager::Full() const {
}
void MiiManager::Clear() {
+ updated_flag = true;
std::fill(database.miis.begin(), database.miis.end(), MiiStoreData{});
}
@@ -244,6 +253,7 @@ bool MiiManager::Remove(Common::UUID uuid) {
if (iter == database.miis.end())
return false;
+ updated_flag = true;
*iter = MiiStoreData{};
EnsureDatabasePartition();
return true;
@@ -277,6 +287,7 @@ bool MiiManager::Move(Common::UUID uuid, u32 new_index) {
if (index == INVALID_INDEX || new_index >= MAX_MIIS)
return false;
+ updated_flag = true;
const auto moving = database.miis[index];
const auto replacing = database.miis[new_index];
if (replacing.uuid) {
@@ -294,6 +305,7 @@ bool MiiManager::Move(Common::UUID uuid, u32 new_index) {
bool MiiManager::AddOrReplace(const MiiStoreData& data) {
const auto index = IndexOf(data.uuid);
+ updated_flag = true;
if (index == INVALID_INDEX) {
const auto size = Size();
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:
MiiInfo CreateRandom(RandomParameters params);
MiiInfo CreateDefault(u32 index);
+ bool CheckUpdatedFlag() const;
+ void ResetUpdatedFlag();
+
bool Empty() const;
bool Full() const;
@@ -254,6 +257,7 @@ private:
void EnsureDatabasePartition();
MiiDatabase database;
+ bool updated_flag = false;
};
}; // namespace Service::Mii