summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.h')
-rw-r--r--src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.h b/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.h
new file mode 100644
index 000000000..e45ad852b
--- /dev/null
+++ b/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.h
@@ -0,0 +1,50 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <vector>
+#include "common/common_types.h"
+#include "core/hle/service/cmif_types.h"
+#include "core/hle/service/service.h"
+
+namespace Service::FileSystem {
+
+class SaveDataController;
+
+class ISaveDataInfoReader final : public ServiceFramework<ISaveDataInfoReader> {
+public:
+ explicit ISaveDataInfoReader(Core::System& system_,
+ std::shared_ptr<SaveDataController> save_data_controller_,
+ FileSys::SaveDataSpaceId space);
+ ~ISaveDataInfoReader() override;
+
+ struct SaveDataInfo {
+ u64_le save_id_unknown;
+ FileSys::SaveDataSpaceId space;
+ FileSys::SaveDataType type;
+ INSERT_PADDING_BYTES(0x6);
+ std::array<u8, 0x10> user_id;
+ u64_le save_id;
+ u64_le title_id;
+ u64_le save_image_size;
+ u16_le index;
+ FileSys::SaveDataRank rank;
+ INSERT_PADDING_BYTES(0x25);
+ };
+ static_assert(sizeof(SaveDataInfo) == 0x60, "SaveDataInfo has incorrect size.");
+
+ Result ReadSaveDataInfo(Out<u64> out_count,
+ OutArray<SaveDataInfo, BufferAttr_HipcMapAlias> out_entries);
+
+private:
+ void FindAllSaves(FileSys::SaveDataSpaceId space);
+ void FindNormalSaves(FileSys::SaveDataSpaceId space, const FileSys::VirtualDir& type);
+ void FindTemporaryStorageSaves(FileSys::SaveDataSpaceId space, const FileSys::VirtualDir& type);
+
+ std::shared_ptr<SaveDataController> save_data_controller;
+ std::vector<SaveDataInfo> info;
+ u64 next_entry_index = 0;
+};
+
+} // namespace Service::FileSystem