From 2c4c2b5eeeae29413a59548bda40b225c443ce91 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 14 Nov 2019 16:29:31 -0500 Subject: service/am: Remove unnecessary Skip calls We can simplify these by wrapping the necessary members in structs and then simply reading out the whole struct. --- src/core/hle/service/am/am.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src/core/hle/service/am') diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index d52ec4387..d79997fe0 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -1336,12 +1336,16 @@ void IApplicationFunctions::GetPseudoDeviceId(Kernel::HLERequestContext& ctx) { } void IApplicationFunctions::ExtendSaveData(Kernel::HLERequestContext& ctx) { + struct Parameters { + FileSys::SaveDataType type; + u128 user_id; + u64 new_normal_size; + u64 new_journal_size; + }; + static_assert(sizeof(Parameters) == 40); + IPC::RequestParser rp{ctx}; - const auto type{rp.PopRaw()}; - rp.Skip(1, false); - const auto user_id{rp.PopRaw()}; - const auto new_normal_size{rp.PopRaw()}; - const auto new_journal_size{rp.PopRaw()}; + const auto [type, user_id, new_normal_size, new_journal_size] = rp.PopRaw(); LOG_DEBUG(Service_AM, "called with type={:02X}, user_id={:016X}{:016X}, new_normal={:016X}, " @@ -1360,10 +1364,14 @@ void IApplicationFunctions::ExtendSaveData(Kernel::HLERequestContext& ctx) { } void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) { + struct Parameters { + FileSys::SaveDataType type; + u128 user_id; + }; + static_assert(sizeof(Parameters) == 24); + IPC::RequestParser rp{ctx}; - const auto type{rp.PopRaw()}; - rp.Skip(1, false); - const auto user_id{rp.PopRaw()}; + const auto [type, user_id] = rp.PopRaw(); LOG_DEBUG(Service_AM, "called with type={:02X}, user_id={:016X}{:016X}", static_cast(type), user_id[1], user_id[0]); -- cgit v1.2.3