am: Fix GetSaveDataSize stub (#1748)

This commit is contained in:
Ac_K 2020-11-24 20:45:23 +01:00 committed by GitHub
parent fd0b9d1926
commit 44c1f16280
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -159,18 +159,19 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
return ResultCode.Success; return ResultCode.Success;
} }
// GetSaveDataSize(u8, nn::account::Uid) -> (u64, u64)
[Command(26)] // 3.0.0+ [Command(26)] // 3.0.0+
// GetSaveDataSize(u8 save_data_type, nn::account::Uid) -> (u64 save_size, u64 journal_size)
public ResultCode GetSaveDataSize(ServiceCtx context) public ResultCode GetSaveDataSize(ServiceCtx context)
{ {
SaveDataType saveDataType = (SaveDataType)context.RequestData.ReadByte(); SaveDataType saveDataType = (SaveDataType)context.RequestData.ReadUInt64();
Uid userId = context.RequestData.ReadStruct<AccountUid>().ToLibHacUid();
context.RequestData.BaseStream.Seek(7, System.IO.SeekOrigin.Current); // NOTE: Service calls nn::fs::FindSaveDataWithFilter with SaveDataType = 1 hardcoded.
// Then it calls nn::fs::GetSaveDataAvailableSize and nn::fs::GetSaveDataJournalSize to get the sizes.
// Since LibHac currently doesn't support the 2 last methods, we can hardcode the values to 200mb.
Uid userId = context.RequestData.ReadStruct<AccountUid>().ToLibHacUid(); context.ResponseData.Write((long)200000000);
context.ResponseData.Write((long)200000000);
// TODO: We return a size of 2GB as we use a directory based save system. This should be enough for most of the games.
context.ResponseData.Write(2000000000u);
Logger.Stub?.PrintStub(LogClass.ServiceAm, new { saveDataType, userId }); Logger.Stub?.PrintStub(LogClass.ServiceAm, new { saveDataType, userId });