mirror of
https://git.suyu.dev/suyu/suyu
synced 2025-08-30 16:06:30 -05:00
fs: Add and use fs_save_data_types.h
This commit is contained in:
@@ -123,13 +123,13 @@ Result IApplicationFunctions::EnsureSaveData(Out<u64> out_size, Common::UUID use
|
||||
LOG_INFO(Service_AM, "called, uid={}", user_id.FormattedString());
|
||||
|
||||
FileSys::SaveDataAttribute attribute{};
|
||||
attribute.title_id = m_applet->program_id;
|
||||
attribute.program_id = m_applet->program_id;
|
||||
attribute.user_id = user_id.AsU128();
|
||||
attribute.type = FileSys::SaveDataType::SaveData;
|
||||
attribute.type = FileSys::SaveDataType::Account;
|
||||
|
||||
FileSys::VirtualDir save_data{};
|
||||
R_TRY(system.GetFileSystemController().OpenSaveDataController()->CreateSaveData(
|
||||
&save_data, FileSys::SaveDataSpaceId::NandUser, attribute));
|
||||
&save_data, FileSys::SaveDataSpaceId::User, attribute));
|
||||
|
||||
*out_size = 0;
|
||||
R_SUCCEED();
|
||||
|
@@ -72,7 +72,7 @@ void ISaveDataInfoReader::FindAllSaves(FileSys::SaveDataSpaceId space) {
|
||||
for (const auto& type : save_root->GetSubdirectories()) {
|
||||
if (type->GetName() == "save") {
|
||||
FindNormalSaves(space, type);
|
||||
} else if (space == FileSys::SaveDataSpaceId::TemporaryStorage) {
|
||||
} else if (space == FileSys::SaveDataSpaceId::Temporary) {
|
||||
FindTemporaryStorageSaves(space, type);
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,7 @@ void ISaveDataInfoReader::FindNormalSaves(FileSys::SaveDataSpaceId space,
|
||||
info.emplace_back(SaveDataInfo{
|
||||
0,
|
||||
space,
|
||||
FileSys::SaveDataType::SystemSaveData,
|
||||
FileSys::SaveDataType::System,
|
||||
{},
|
||||
user_id_numeric,
|
||||
save_id_numeric,
|
||||
@@ -115,8 +115,7 @@ void ISaveDataInfoReader::FindNormalSaves(FileSys::SaveDataSpaceId space,
|
||||
info.emplace_back(SaveDataInfo{
|
||||
0,
|
||||
space,
|
||||
device ? FileSys::SaveDataType::DeviceSaveData
|
||||
: FileSys::SaveDataType::SaveData,
|
||||
device ? FileSys::SaveDataType::Device : FileSys::SaveDataType::Account,
|
||||
{},
|
||||
user_id_numeric,
|
||||
save_id_numeric,
|
||||
@@ -145,7 +144,7 @@ void ISaveDataInfoReader::FindTemporaryStorageSaves(FileSys::SaveDataSpaceId spa
|
||||
info.emplace_back(SaveDataInfo{
|
||||
0,
|
||||
space,
|
||||
FileSys::SaveDataType::TemporaryStorage,
|
||||
FileSys::SaveDataType::Temporary,
|
||||
{},
|
||||
user_id_numeric,
|
||||
stoull_be(type->GetName()),
|
||||
|
@@ -224,23 +224,23 @@ Result FSP_SRV::OpenSdCardFileSystem(OutInterface<IFileSystem> out_interface) {
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result FSP_SRV::CreateSaveDataFileSystem(std::array<u8, 0x40> save_create_struct,
|
||||
Result FSP_SRV::CreateSaveDataFileSystem(FileSys::SaveDataCreationInfo save_create_struct,
|
||||
FileSys::SaveDataAttribute save_struct, u128 uid) {
|
||||
LOG_DEBUG(Service_FS, "called save_struct = {}, uid = {:016X}{:016X}", save_struct.DebugInfo(),
|
||||
uid[1], uid[0]);
|
||||
|
||||
FileSys::VirtualDir save_data_dir{};
|
||||
R_RETURN(save_data_controller->CreateSaveData(&save_data_dir,
|
||||
FileSys::SaveDataSpaceId::NandUser, save_struct));
|
||||
R_RETURN(save_data_controller->CreateSaveData(&save_data_dir, FileSys::SaveDataSpaceId::User,
|
||||
save_struct));
|
||||
}
|
||||
|
||||
Result FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId(std::array<u8, 0x40> save_create_struct,
|
||||
FileSys::SaveDataAttribute save_struct) {
|
||||
Result FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId(
|
||||
FileSys::SaveDataCreationInfo save_create_struct, FileSys::SaveDataAttribute save_struct) {
|
||||
LOG_DEBUG(Service_FS, "called save_struct = {}", save_struct.DebugInfo());
|
||||
|
||||
FileSys::VirtualDir save_data_dir{};
|
||||
R_RETURN(save_data_controller->CreateSaveData(
|
||||
&save_data_dir, FileSys::SaveDataSpaceId::NandSystem, save_struct));
|
||||
R_RETURN(save_data_controller->CreateSaveData(&save_data_dir, FileSys::SaveDataSpaceId::System,
|
||||
save_struct));
|
||||
}
|
||||
|
||||
Result FSP_SRV::OpenSaveDataFileSystem(OutInterface<IFileSystem> out_interface,
|
||||
@@ -253,17 +253,17 @@ Result FSP_SRV::OpenSaveDataFileSystem(OutInterface<IFileSystem> out_interface,
|
||||
|
||||
FileSys::StorageId id{};
|
||||
switch (space_id) {
|
||||
case FileSys::SaveDataSpaceId::NandUser:
|
||||
case FileSys::SaveDataSpaceId::User:
|
||||
id = FileSys::StorageId::NandUser;
|
||||
break;
|
||||
case FileSys::SaveDataSpaceId::SdCardSystem:
|
||||
case FileSys::SaveDataSpaceId::SdCardUser:
|
||||
case FileSys::SaveDataSpaceId::SdSystem:
|
||||
case FileSys::SaveDataSpaceId::SdUser:
|
||||
id = FileSys::StorageId::SdCard;
|
||||
break;
|
||||
case FileSys::SaveDataSpaceId::NandSystem:
|
||||
case FileSys::SaveDataSpaceId::System:
|
||||
id = FileSys::StorageId::NandSystem;
|
||||
break;
|
||||
case FileSys::SaveDataSpaceId::TemporaryStorage:
|
||||
case FileSys::SaveDataSpaceId::Temporary:
|
||||
case FileSys::SaveDataSpaceId::ProperSystem:
|
||||
case FileSys::SaveDataSpaceId::SafeMode:
|
||||
ASSERT(false);
|
||||
@@ -302,8 +302,8 @@ Result FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage(
|
||||
OutInterface<ISaveDataInfoReader> out_interface) {
|
||||
LOG_WARNING(Service_FS, "(STUBBED) called");
|
||||
|
||||
*out_interface = std::make_shared<ISaveDataInfoReader>(
|
||||
system, save_data_controller, FileSys::SaveDataSpaceId::TemporaryStorage);
|
||||
*out_interface = std::make_shared<ISaveDataInfoReader>(system, save_data_controller,
|
||||
FileSys::SaveDataSpaceId::Temporary);
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
@@ -323,11 +323,11 @@ Result FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(
|
||||
[[maybe_unused]] constexpr auto flags = static_cast<u32>(FileSys::SaveDataFlags::None);
|
||||
|
||||
LOG_WARNING(Service_FS,
|
||||
"(STUBBED) called, flags={}, space_id={}, attribute.title_id={:016X}\n"
|
||||
"(STUBBED) called, flags={}, space_id={}, attribute.program_id={:016X}\n"
|
||||
"attribute.user_id={:016X}{:016X}, attribute.save_id={:016X}\n"
|
||||
"attribute.type={}, attribute.rank={}, attribute.index={}",
|
||||
flags, space_id, attribute.title_id, attribute.user_id[1], attribute.user_id[0],
|
||||
attribute.save_id, attribute.type, attribute.rank, attribute.index);
|
||||
flags, space_id, attribute.program_id, attribute.user_id[1], attribute.user_id[0],
|
||||
attribute.system_save_data_id, attribute.type, attribute.rank, attribute.index);
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include "core/file_sys/fs_save_data_types.h"
|
||||
#include "core/hle/service/cmif_types.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
@@ -60,10 +61,10 @@ private:
|
||||
Result OpenFileSystemWithPatch(OutInterface<IFileSystem> out_interface,
|
||||
FileSystemProxyType type, u64 open_program_id);
|
||||
Result OpenSdCardFileSystem(OutInterface<IFileSystem> out_interface);
|
||||
Result CreateSaveDataFileSystem(std::array<u8, 0x40> save_create_struct,
|
||||
Result CreateSaveDataFileSystem(FileSys::SaveDataCreationInfo save_create_struct,
|
||||
FileSys::SaveDataAttribute save_struct, u128 uid);
|
||||
Result CreateSaveDataFileSystemBySystemSaveDataId(std::array<u8, 0x40> save_create_struct,
|
||||
FileSys::SaveDataAttribute save_struct);
|
||||
Result CreateSaveDataFileSystemBySystemSaveDataId(
|
||||
FileSys::SaveDataCreationInfo save_create_struct, FileSys::SaveDataAttribute save_struct);
|
||||
Result OpenSaveDataFileSystem(OutInterface<IFileSystem> out_interface,
|
||||
FileSys::SaveDataSpaceId space_id,
|
||||
FileSys::SaveDataAttribute attribute);
|
||||
|
Reference in New Issue
Block a user