yuzu-emu
/
yuzu
Archived
1
0
Fork 0

mii: Implement IsUpdated command (IPC 0)

This commit is contained in:
Zach Hilman 2018-12-24 13:39:07 -05:00
parent f0db2e3ef3
commit c40cff454d
3 changed files with 34 additions and 9 deletions

View File

@ -68,13 +68,14 @@ private:
void IsUpdated(Kernel::HLERequestContext& ctx) { void IsUpdated(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{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}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(false); rb.Push(db.CheckUpdatedFlag());
db.ResetUpdatedFlag();
} }
void IsFullDatabase(Kernel::HLERequestContext& ctx) { void IsFullDatabase(Kernel::HLERequestContext& ctx) {
@ -87,9 +88,9 @@ private:
void GetCount(Kernel::HLERequestContext& ctx) { void GetCount(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{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}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -100,8 +101,10 @@ private:
void Get(Kernel::HLERequestContext& ctx) { void Get(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const auto size{rp.PopRaw<u32>()}; 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{}; u32 read_size{};
ctx.WriteBuffer(SerializeArray(&MiiManager::GetInfoElement, offsets[0], size, read_size)); ctx.WriteBuffer(SerializeArray(&MiiManager::GetInfoElement, offsets[0], size, read_size));
@ -116,8 +119,10 @@ private:
void Get1(Kernel::HLERequestContext& ctx) { void Get1(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const auto size{rp.PopRaw<u32>()}; 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{}; u32 read_size{};
ctx.WriteBuffer(SerializeArray(&MiiManager::GetInfo, offsets[1], size, read_size)); ctx.WriteBuffer(SerializeArray(&MiiManager::GetInfo, offsets[1], size, read_size));
@ -157,8 +162,10 @@ private:
void Get2(Kernel::HLERequestContext& ctx) { void Get2(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const auto size{rp.PopRaw<u32>()}; 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{}; u32 read_size{};
ctx.WriteBuffer( ctx.WriteBuffer(
@ -174,8 +181,10 @@ private:
void Get3(Kernel::HLERequestContext& ctx) { void Get3(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const auto size{rp.PopRaw<u32>()}; 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{}; u32 read_size{};
ctx.WriteBuffer(SerializeArray(&MiiManager::GetStoreData, offsets[3], size, read_size)); ctx.WriteBuffer(SerializeArray(&MiiManager::GetStoreData, offsets[3], size, read_size));

View File

@ -204,6 +204,14 @@ MiiInfo MiiManager::CreateDefault(u32 index) {
return ConvertStoreDataToInfo(new_mii); return ConvertStoreDataToInfo(new_mii);
} }
bool MiiManager::CheckUpdatedFlag() const {
return updated_flag;
}
void MiiManager::ResetUpdatedFlag() {
updated_flag = false;
}
bool MiiManager::Empty() const { bool MiiManager::Empty() const {
return Size() == 0; return Size() == 0;
} }
@ -213,6 +221,7 @@ bool MiiManager::Full() const {
} }
void MiiManager::Clear() { void MiiManager::Clear() {
updated_flag = true;
std::fill(database.miis.begin(), database.miis.end(), MiiStoreData{}); std::fill(database.miis.begin(), database.miis.end(), MiiStoreData{});
} }
@ -244,6 +253,7 @@ bool MiiManager::Remove(Common::UUID uuid) {
if (iter == database.miis.end()) if (iter == database.miis.end())
return false; return false;
updated_flag = true;
*iter = MiiStoreData{}; *iter = MiiStoreData{};
EnsureDatabasePartition(); EnsureDatabasePartition();
return true; return true;
@ -277,6 +287,7 @@ bool MiiManager::Move(Common::UUID uuid, u32 new_index) {
if (index == INVALID_INDEX || new_index >= MAX_MIIS) if (index == INVALID_INDEX || new_index >= MAX_MIIS)
return false; return false;
updated_flag = true;
const auto moving = database.miis[index]; const auto moving = database.miis[index];
const auto replacing = database.miis[new_index]; const auto replacing = database.miis[new_index];
if (replacing.uuid) { if (replacing.uuid) {
@ -294,6 +305,7 @@ bool MiiManager::Move(Common::UUID uuid, u32 new_index) {
bool MiiManager::AddOrReplace(const MiiStoreData& data) { bool MiiManager::AddOrReplace(const MiiStoreData& data) {
const auto index = IndexOf(data.uuid); const auto index = IndexOf(data.uuid);
updated_flag = true;
if (index == INVALID_INDEX) { if (index == INVALID_INDEX) {
const auto size = Size(); const auto size = Size();
if (size == MAX_MIIS) if (size == MAX_MIIS)

View File

@ -226,6 +226,9 @@ public:
MiiInfo CreateRandom(RandomParameters params); MiiInfo CreateRandom(RandomParameters params);
MiiInfo CreateDefault(u32 index); MiiInfo CreateDefault(u32 index);
bool CheckUpdatedFlag() const;
void ResetUpdatedFlag();
bool Empty() const; bool Empty() const;
bool Full() const; bool Full() const;
@ -254,6 +257,7 @@ private:
void EnsureDatabasePartition(); void EnsureDatabasePartition();
MiiDatabase database; MiiDatabase database;
bool updated_flag = false;
}; };
}; // namespace Service::Mii }; // namespace Service::Mii