summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorLeystryku <Leystryku@gmail.com>2024-02-18 06:00:42 +0100
committerLeystryku <Leystryku@gmail.com>2024-02-18 06:00:42 +0100
commit4f387b0b74138e033b88fbe4e137d6ab8c7130ac (patch)
tree2488b892641ad43653dda2e757741b3ed3dccf95 /src/core/hle/service
parentservice: Add proper GetCacheStorageMax implementation to IApplicationFunctions (diff)
downloadyuzu-4f387b0b74138e033b88fbe4e137d6ab8c7130ac.tar
yuzu-4f387b0b74138e033b88fbe4e137d6ab8c7130ac.tar.gz
yuzu-4f387b0b74138e033b88fbe4e137d6ab8c7130ac.tar.bz2
yuzu-4f387b0b74138e033b88fbe4e137d6ab8c7130ac.tar.lz
yuzu-4f387b0b74138e033b88fbe4e137d6ab8c7130ac.tar.xz
yuzu-4f387b0b74138e033b88fbe4e137d6ab8c7130ac.tar.zst
yuzu-4f387b0b74138e033b88fbe4e137d6ab8c7130ac.zip
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/am/service/application_functions.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/core/hle/service/am/service/application_functions.cpp b/src/core/hle/service/am/service/application_functions.cpp
index eee9428ce..fe37083f3 100644
--- a/src/core/hle/service/am/service/application_functions.cpp
+++ b/src/core/hle/service/am/service/application_functions.cpp
@@ -272,17 +272,14 @@ Result IApplicationFunctions::GetCacheStorageMax(Out<u32> out_cache_storage_inde
Out<u64> out_max_journal_size) {
LOG_DEBUG(Service_AM, "called");
- const auto title_id = m_applet->program_id;
-
std::vector<u8> nacp;
- const auto result = system.GetARPManager().GetControlProperty(&nacp, title_id);
+ R_TRY(system.GetARPManager().GetControlProperty(&nacp, m_applet->program_id));
- if (R_SUCCEEDED(result)) {
- const auto rawnacp = reinterpret_cast<FileSys::RawNACP*>(nacp.data());
+ FileSys::RawNACP raw_nacp{};
+ std::memcpy(&raw_nacp, nacp.data(), std::min(sizeof(raw_nacp), nacp.size()));
- *out_cache_storage_index_max = static_cast<u32>(rawnacp->cache_storage_max_index);
- *out_max_journal_size = static_cast<u64>(rawnacp->cache_storage_data_and_journal_max_size);
- }
+ *out_cache_storage_index_max = static_cast<u32>(raw_nacp.cache_storage_max_index);
+ *out_max_journal_size = static_cast<u64>(raw_nacp.cache_storage_data_and_journal_max_size);
R_SUCCEED();
}