Compare commits

...

1 Commits

Author SHA1 Message Date
Zach Hilman
bba549b7e7 am: Implement GetSaveDataSize 2018-08-19 10:42:40 -04:00
2 changed files with 27 additions and 1 deletions

View File

@@ -594,7 +594,7 @@ IApplicationFunctions::IApplicationFunctions() : ServiceFramework("IApplicationF
{23, &IApplicationFunctions::GetDisplayVersion, "GetDisplayVersion"},
{24, nullptr, "GetLaunchStorageInfoForDebug"},
{25, nullptr, "ExtendSaveData"},
{26, nullptr, "GetSaveDataSize"},
{26, &IApplicationFunctions::GetSaveDataSize, "GetSaveDataSize"},
{30, nullptr, "BeginBlockingHomeButtonShortAndLongPressed"},
{31, nullptr, "EndBlockingHomeButtonShortAndLongPressed"},
{32, nullptr, "BeginBlockingHomeButton"},
@@ -683,6 +683,31 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
}
void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto type = rp.PopRaw<FileSys::SaveDataType>();
const auto uid = rp.PopRaw<u128>();
auto save =
FileSystem::OpenSaveData(FileSys::SaveDataSpaceId::NandUser,
{Core::CurrentProcess()->program_id, uid, 0, type, 0, 0, 0, 0});
if (save.Failed()) {
IPC::ResponseBuilder rb{ctx, 2};
// TODO(DarkLordZach): Find a better error code for this.
rb.Push(ResultCode(-1));
}
const auto dir = save.Unwrap();
IPC::ResponseBuilder rb{ctx, 6};
rb.Push(RESULT_SUCCESS);
rb.Push<u64>(dir->GetSize());
// TODO(DarkLordZach): Find out what this second value is (journal size?)
rb.Push<u64>(dir->GetSize());
}
void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
// TODO(bunnei): This should be configurable
IPC::ResponseBuilder rb{ctx, 4};

View File

@@ -139,6 +139,7 @@ private:
void EnsureSaveData(Kernel::HLERequestContext& ctx);
void SetTerminateResult(Kernel::HLERequestContext& ctx);
void GetDisplayVersion(Kernel::HLERequestContext& ctx);
void GetSaveDataSize(Kernel::HLERequestContext& ctx);
void GetDesiredLanguage(Kernel::HLERequestContext& ctx);
void InitializeGamePlayRecording(Kernel::HLERequestContext& ctx);
void SetGamePlayRecordingState(Kernel::HLERequestContext& ctx);