3
0
Fork 0
forked from suyu/suyu

service: Add proper GetCacheStorageMax implementation to IApplicationFunctions

This commit is contained in:
Leystryku 2024-02-18 05:02:35 +01:00
parent 82949085c0
commit d93fdc8a6c
3 changed files with 17 additions and 7 deletions

View file

@ -17,6 +17,7 @@
#include "core/hle/service/filesystem/save_data_controller.h"
#include "core/hle/service/ns/ns.h"
#include "core/hle/service/sm/sm.h"
#include "core/hle/service/glue/glue_manager.h"
namespace Service::AM {
@ -267,12 +268,21 @@ Result IApplicationFunctions::GetSaveDataSizeMax(Out<u64> out_max_normal_size,
R_SUCCEED();
}
Result IApplicationFunctions::GetCacheStorageMax(Out<u32> out_max_normal_size,
Result IApplicationFunctions::GetCacheStorageMax(Out<u32> out_cache_storage_index_max,
Out<u64> out_max_journal_size) {
LOG_WARNING(Service_AM, "(STUBBED) called");
LOG_DEBUG(Service_AM, "called");
*out_max_normal_size = 0xFFFFFF;
*out_max_journal_size = 0xFFFFFF;
const auto title_id = m_applet->program_id;
std::vector<u8> nacp;
const auto result = system.GetARPManager().GetControlProperty(&nacp, title_id);
if (R_SUCCEEDED(result)) {
const auto rawnacp = reinterpret_cast<FileSys::RawNACP*>(nacp.data());
*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);
}
R_SUCCEED();
}

View file

@ -40,7 +40,7 @@ private:
Result CreateCacheStorage(Out<u32> out_target_media, Out<u64> out_required_size, u16 index,
u64 normal_size, u64 journal_size);
Result GetSaveDataSizeMax(Out<u64> out_max_normal_size, Out<u64> out_max_journal_size);
Result GetCacheStorageMax(Out<u32> out_max_normal_size, Out<u64> out_max_journal_size);
Result GetCacheStorageMax(Out<u32> out_cache_storage_index_max, Out<u64> out_max_journal_size);
Result BeginBlockingHomeButtonShortAndLongPressed(s64 unused);
Result EndBlockingHomeButtonShortAndLongPressed();
Result BeginBlockingHomeButton(s64 timeout_ns);