summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Zach Hilman2019-04-17 11:59:07 -0400
committerGravatar Zach Hilman2019-09-21 16:43:10 -0400
commit1b04b7265301684530dd2298b5d148a05dc010c3 (patch)
tree5b92dd4992c08eefb9bd0160f93a8311d1c7bfda /src
parentfilesystem: Pass Size Getter functions to IFileSystem for sizes (diff)
downloadyuzu-1b04b7265301684530dd2298b5d148a05dc010c3.tar.gz
yuzu-1b04b7265301684530dd2298b5d148a05dc010c3.tar.xz
yuzu-1b04b7265301684530dd2298b5d148a05dc010c3.zip
am: Unstub IApplicationFunctions EnsureSaveData (20)
Creates a default save data for the application given a user ID.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/am/am.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index aa2c83937..eae052ce0 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -1143,13 +1143,20 @@ void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest(
1143 1143
1144void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) { 1144void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) {
1145 IPC::RequestParser rp{ctx}; 1145 IPC::RequestParser rp{ctx};
1146 u128 uid = rp.PopRaw<u128>(); // What does this do? 1146 u128 user_id = rp.PopRaw<u128>();
1147 LOG_WARNING(Service, "(STUBBED) called uid = {:016X}{:016X}", uid[1], uid[0]); 1147
1148 LOG_DEBUG(Service_AM, "called, uid={:016X}{:016X}", user_id[1], user_id[0]);
1149
1150 FileSys::SaveDataDescriptor descriptor{};
1151 descriptor.title_id = Core::CurrentProcess()->GetTitleID();
1152 descriptor.user_id = user_id;
1153 descriptor.type = FileSys::SaveDataType::SaveData;
1154 const auto res = fsc.CreateSaveData(FileSys::SaveDataSpaceId::NandUser, descriptor);
1148 1155
1149 IPC::ResponseBuilder rb{ctx, 4}; 1156 IPC::ResponseBuilder rb{ctx, 4};
1150 rb.Push(RESULT_SUCCESS); 1157 rb.Push(res.Code());
1151 rb.Push<u64>(0); 1158 rb.Push<u64>(0);
1152} // namespace Service::AM 1159}
1153 1160
1154void IApplicationFunctions::SetTerminateResult(Kernel::HLERequestContext& ctx) { 1161void IApplicationFunctions::SetTerminateResult(Kernel::HLERequestContext& ctx) {
1155 // Takes an input u32 Result, no output. 1162 // Takes an input u32 Result, no output.
@@ -1261,8 +1268,8 @@ void IApplicationFunctions::ExtendSaveData(Kernel::HLERequestContext& ctx) {
1261 "new_journal={:016X}", 1268 "new_journal={:016X}",
1262 static_cast<u8>(type), user_id[1], user_id[0], new_normal_size, new_journal_size); 1269 static_cast<u8>(type), user_id[1], user_id[0], new_normal_size, new_journal_size);
1263 1270
1264 const auto title_id = system.CurrentProcess()->GetTitleID(); 1271 fsc.WriteSaveDataSize(type, Core::CurrentProcess()->GetTitleID(), user_id,
1265 FileSystem::WriteSaveDataSize(type, title_id, user_id, {new_normal_size, new_journal_size}); 1272 {new_normal_size, new_journal_size});
1266 1273
1267 IPC::ResponseBuilder rb{ctx, 4}; 1274 IPC::ResponseBuilder rb{ctx, 4};
1268 rb.Push(RESULT_SUCCESS); 1275 rb.Push(RESULT_SUCCESS);
@@ -1281,8 +1288,7 @@ void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) {
1281 LOG_DEBUG(Service_AM, "called with type={:02X}, user_id={:016X}{:016X}", static_cast<u8>(type), 1288 LOG_DEBUG(Service_AM, "called with type={:02X}, user_id={:016X}{:016X}", static_cast<u8>(type),
1282 user_id[1], user_id[0]); 1289 user_id[1], user_id[0]);
1283 1290
1284 const auto title_id = system.CurrentProcess()->GetTitleID(); 1291 const auto size = fsc.ReadSaveDataSize(type, Core::CurrentProcess()->GetTitleID(), user_id);
1285 const auto size = FileSystem::ReadSaveDataSize(type, title_id, user_id);
1286 1292
1287 IPC::ResponseBuilder rb{ctx, 6}; 1293 IPC::ResponseBuilder rb{ctx, 6};
1288 rb.Push(RESULT_SUCCESS); 1294 rb.Push(RESULT_SUCCESS);