summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp68
-rw-r--r--src/core/hle/service/filesystem/filesystem.h68
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.cpp8
3 files changed, 76 insertions, 68 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index 76a860c6d..31d5fd79b 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -241,6 +241,10 @@ ResultVal<FileSys::EntryType> VfsDirectoryServiceWrapper::GetEntryType(
return FileSys::ERROR_PATH_NOT_FOUND;
}
+FileSystemController::FileSystemController() = default;
+
+FileSystemController::~FileSystemController() = default;
+
ResultCode FileSystemController::RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory) {
romfs_factory = std::move(factory);
LOG_DEBUG(Service_FS, "Registered RomFS");
@@ -278,7 +282,7 @@ void FileSystemController::SetPackedUpdate(FileSys::VirtualFile update_raw) {
romfs_factory->SetPackedUpdate(std::move(update_raw));
}
-ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFSCurrentProcess() {
+ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFSCurrentProcess() const {
LOG_TRACE(Service_FS, "Opening RomFS for current process");
if (romfs_factory == nullptr) {
@@ -289,9 +293,8 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFSCurrentProcess()
return romfs_factory->OpenCurrentProcess();
}
-ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFS(u64 title_id,
- FileSys::StorageId storage_id,
- FileSys::ContentRecordType type) {
+ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFS(
+ u64 title_id, FileSys::StorageId storage_id, FileSys::ContentRecordType type) const {
LOG_TRACE(Service_FS, "Opening RomFS for title_id={:016X}, storage_id={:02X}, type={:02X}",
title_id, static_cast<u8>(storage_id), static_cast<u8>(type));
@@ -304,7 +307,7 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFS(u64 title_id,
}
ResultVal<FileSys::VirtualDir> FileSystemController::CreateSaveData(
- FileSys::SaveDataSpaceId space, const FileSys::SaveDataDescriptor& save_struct) {
+ FileSys::SaveDataSpaceId space, const FileSys::SaveDataDescriptor& save_struct) const {
LOG_TRACE(Service_FS, "Creating Save Data for space_id={:01X}, save_struct={}",
static_cast<u8>(space), save_struct.DebugInfo());
@@ -316,7 +319,7 @@ ResultVal<FileSys::VirtualDir> FileSystemController::CreateSaveData(
}
ResultVal<FileSys::VirtualDir> FileSystemController::OpenSaveData(
- FileSys::SaveDataSpaceId space, const FileSys::SaveDataDescriptor& descriptor) {
+ FileSys::SaveDataSpaceId space, const FileSys::SaveDataDescriptor& descriptor) const {
LOG_TRACE(Service_FS, "Opening Save Data for space_id={:01X}, save_struct={}",
static_cast<u8>(space), descriptor.DebugInfo());
@@ -328,7 +331,7 @@ ResultVal<FileSys::VirtualDir> FileSystemController::OpenSaveData(
}
ResultVal<FileSys::VirtualDir> FileSystemController::OpenSaveDataSpace(
- FileSys::SaveDataSpaceId space) {
+ FileSys::SaveDataSpaceId space) const {
LOG_TRACE(Service_FS, "Opening Save Data Space for space_id={:01X}", static_cast<u8>(space));
if (save_data_factory == nullptr) {
@@ -338,7 +341,7 @@ ResultVal<FileSys::VirtualDir> FileSystemController::OpenSaveDataSpace(
return MakeResult(save_data_factory->GetSaveDataSpaceDirectory(space));
}
-ResultVal<FileSys::VirtualDir> FileSystemController::OpenSDMC() {
+ResultVal<FileSys::VirtualDir> FileSystemController::OpenSDMC() const {
LOG_TRACE(Service_FS, "Opening SDMC");
if (sdmc_factory == nullptr) {
@@ -348,7 +351,8 @@ ResultVal<FileSys::VirtualDir> FileSystemController::OpenSDMC() {
return sdmc_factory->Open();
}
-ResultVal<FileSys::VirtualDir> FileSystemController::OpenBISPartition(FileSys::BisPartitionId id) {
+ResultVal<FileSys::VirtualDir> FileSystemController::OpenBISPartition(
+ FileSys::BisPartitionId id) const {
LOG_TRACE(Service_FS, "Opening BIS Partition with id={:08X}", static_cast<u32>(id));
if (bis_factory == nullptr) {
@@ -364,7 +368,7 @@ ResultVal<FileSys::VirtualDir> FileSystemController::OpenBISPartition(FileSys::B
}
ResultVal<FileSys::VirtualFile> FileSystemController::OpenBISPartitionStorage(
- FileSys::BisPartitionId id) {
+ FileSys::BisPartitionId id) const {
LOG_TRACE(Service_FS, "Opening BIS Partition Storage with id={:08X}", static_cast<u32>(id));
if (bis_factory == nullptr) {
@@ -432,7 +436,7 @@ u64 FileSystemController::GetTotalSpaceSize(FileSys::StorageId id) const {
}
FileSys::SaveDataSize FileSystemController::ReadSaveDataSize(FileSys::SaveDataType type,
- u64 title_id, u128 user_id) {
+ u64 title_id, u128 user_id) const {
if (save_data_factory == nullptr) {
return {0, 0};
}
@@ -465,7 +469,7 @@ FileSys::SaveDataSize FileSystemController::ReadSaveDataSize(FileSys::SaveDataTy
}
void FileSystemController::WriteSaveDataSize(FileSys::SaveDataType type, u64 title_id, u128 user_id,
- FileSys::SaveDataSize new_value) {
+ FileSys::SaveDataSize new_value) const {
if (save_data_factory != nullptr)
save_data_factory->WriteSaveDataSize(type, title_id, user_id, new_value);
}
@@ -477,19 +481,19 @@ void FileSystemController::SetGameCard(FileSys::VirtualFile file) {
gamecard_placeholder = std::make_unique<FileSys::PlaceholderCache>(dir);
}
-FileSys::XCI* FileSystemController::GetGameCard() {
+FileSys::XCI* FileSystemController::GetGameCard() const {
return gamecard.get();
}
-FileSys::RegisteredCache* FileSystemController::GetGameCardContents() {
+FileSys::RegisteredCache* FileSystemController::GetGameCardContents() const {
return gamecard_registered.get();
}
-FileSys::PlaceholderCache* FileSystemController::GetGameCardPlaceholder() {
+FileSys::PlaceholderCache* FileSystemController::GetGameCardPlaceholder() const {
return gamecard_placeholder.get();
}
-FileSys::RegisteredCache* FileSystemController::GetSystemNANDContents() {
+FileSys::RegisteredCache* FileSystemController::GetSystemNANDContents() const {
LOG_TRACE(Service_FS, "Opening System NAND Contents");
if (bis_factory == nullptr)
@@ -498,7 +502,7 @@ FileSys::RegisteredCache* FileSystemController::GetSystemNANDContents() {
return bis_factory->GetSystemNANDContents();
}
-FileSys::RegisteredCache* FileSystemController::GetUserNANDContents() {
+FileSys::RegisteredCache* FileSystemController::GetUserNANDContents() const {
LOG_TRACE(Service_FS, "Opening User NAND Contents");
if (bis_factory == nullptr)
@@ -507,7 +511,7 @@ FileSys::RegisteredCache* FileSystemController::GetUserNANDContents() {
return bis_factory->GetUserNANDContents();
}
-FileSys::RegisteredCache* FileSystemController::GetSDMCContents() {
+FileSys::RegisteredCache* FileSystemController::GetSDMCContents() const {
LOG_TRACE(Service_FS, "Opening SDMC Contents");
if (sdmc_factory == nullptr)
@@ -516,7 +520,7 @@ FileSys::RegisteredCache* FileSystemController::GetSDMCContents() {
return sdmc_factory->GetSDMCContents();
}
-FileSys::PlaceholderCache* FileSystemController::GetSystemNANDPlaceholder() {
+FileSys::PlaceholderCache* FileSystemController::GetSystemNANDPlaceholder() const {
LOG_TRACE(Service_FS, "Opening System NAND Placeholder");
if (bis_factory == nullptr)
@@ -525,7 +529,7 @@ FileSys::PlaceholderCache* FileSystemController::GetSystemNANDPlaceholder() {
return bis_factory->GetSystemNANDPlaceholder();
}
-FileSys::PlaceholderCache* FileSystemController::GetUserNANDPlaceholder() {
+FileSys::PlaceholderCache* FileSystemController::GetUserNANDPlaceholder() const {
LOG_TRACE(Service_FS, "Opening User NAND Placeholder");
if (bis_factory == nullptr)
@@ -534,7 +538,7 @@ FileSys::PlaceholderCache* FileSystemController::GetUserNANDPlaceholder() {
return bis_factory->GetUserNANDPlaceholder();
}
-FileSys::PlaceholderCache* FileSystemController::GetSDMCPlaceholder() {
+FileSys::PlaceholderCache* FileSystemController::GetSDMCPlaceholder() const {
LOG_TRACE(Service_FS, "Opening SDMC Placeholder");
if (sdmc_factory == nullptr)
@@ -544,7 +548,7 @@ FileSys::PlaceholderCache* FileSystemController::GetSDMCPlaceholder() {
}
FileSys::RegisteredCache* FileSystemController::GetRegisteredCacheForStorage(
- FileSys::StorageId id) {
+ FileSys::StorageId id) const {
switch (id) {
case FileSys::StorageId::None:
case FileSys::StorageId::Host:
@@ -564,7 +568,7 @@ FileSys::RegisteredCache* FileSystemController::GetRegisteredCacheForStorage(
}
FileSys::PlaceholderCache* FileSystemController::GetPlaceholderCacheForStorage(
- FileSys::StorageId id) {
+ FileSys::StorageId id) const {
switch (id) {
case FileSys::StorageId::None:
case FileSys::StorageId::Host:
@@ -583,7 +587,7 @@ FileSys::PlaceholderCache* FileSystemController::GetPlaceholderCacheForStorage(
return nullptr;
}
-FileSys::VirtualDir FileSystemController::GetSystemNANDContentDirectory() {
+FileSys::VirtualDir FileSystemController::GetSystemNANDContentDirectory() const {
LOG_TRACE(Service_FS, "Opening system NAND content directory");
if (bis_factory == nullptr)
@@ -592,7 +596,7 @@ FileSys::VirtualDir FileSystemController::GetSystemNANDContentDirectory() {
return bis_factory->GetSystemNANDContentDirectory();
}
-FileSys::VirtualDir FileSystemController::GetUserNANDContentDirectory() {
+FileSys::VirtualDir FileSystemController::GetUserNANDContentDirectory() const {
LOG_TRACE(Service_FS, "Opening user NAND content directory");
if (bis_factory == nullptr)
@@ -601,7 +605,7 @@ FileSys::VirtualDir FileSystemController::GetUserNANDContentDirectory() {
return bis_factory->GetUserNANDContentDirectory();
}
-FileSys::VirtualDir FileSystemController::GetSDMCContentDirectory() {
+FileSys::VirtualDir FileSystemController::GetSDMCContentDirectory() const {
LOG_TRACE(Service_FS, "Opening SDMC content directory");
if (sdmc_factory == nullptr)
@@ -610,7 +614,7 @@ FileSys::VirtualDir FileSystemController::GetSDMCContentDirectory() {
return sdmc_factory->GetSDMCContentDirectory();
}
-FileSys::VirtualDir FileSystemController::GetNANDImageDirectory() {
+FileSys::VirtualDir FileSystemController::GetNANDImageDirectory() const {
LOG_TRACE(Service_FS, "Opening NAND image directory");
if (bis_factory == nullptr)
@@ -619,7 +623,7 @@ FileSys::VirtualDir FileSystemController::GetNANDImageDirectory() {
return bis_factory->GetImageDirectory();
}
-FileSys::VirtualDir FileSystemController::GetSDMCImageDirectory() {
+FileSys::VirtualDir FileSystemController::GetSDMCImageDirectory() const {
LOG_TRACE(Service_FS, "Opening SDMC image directory");
if (sdmc_factory == nullptr)
@@ -628,7 +632,7 @@ FileSys::VirtualDir FileSystemController::GetSDMCImageDirectory() {
return sdmc_factory->GetImageDirectory();
}
-FileSys::VirtualDir FileSystemController::GetContentDirectory(ContentStorageId id) {
+FileSys::VirtualDir FileSystemController::GetContentDirectory(ContentStorageId id) const {
switch (id) {
case ContentStorageId::System:
return GetSystemNANDContentDirectory();
@@ -641,7 +645,7 @@ FileSys::VirtualDir FileSystemController::GetContentDirectory(ContentStorageId i
return nullptr;
}
-FileSys::VirtualDir FileSystemController::GetImageDirectory(ImageDirectoryId id) {
+FileSys::VirtualDir FileSystemController::GetImageDirectory(ImageDirectoryId id) const {
switch (id) {
case ImageDirectoryId::NAND:
return GetNANDImageDirectory();
@@ -652,7 +656,7 @@ FileSys::VirtualDir FileSystemController::GetImageDirectory(ImageDirectoryId id)
return nullptr;
}
-FileSys::VirtualDir FileSystemController::GetModificationLoadRoot(u64 title_id) {
+FileSys::VirtualDir FileSystemController::GetModificationLoadRoot(u64 title_id) const {
LOG_TRACE(Service_FS, "Opening mod load root for tid={:016X}", title_id);
if (bis_factory == nullptr)
@@ -661,7 +665,7 @@ FileSys::VirtualDir FileSystemController::GetModificationLoadRoot(u64 title_id)
return bis_factory->GetModificationLoadRoot(title_id);
}
-FileSys::VirtualDir FileSystemController::GetModificationDumpRoot(u64 title_id) {
+FileSys::VirtualDir FileSystemController::GetModificationDumpRoot(u64 title_id) const {
LOG_TRACE(Service_FS, "Opening mod dump root for tid={:016X}", title_id);
if (bis_factory == nullptr)
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h
index 2eb3a641d..4d7da3b6f 100644
--- a/src/core/hle/service/filesystem/filesystem.h
+++ b/src/core/hle/service/filesystem/filesystem.h
@@ -52,59 +52,63 @@ enum class ImageDirectoryId : u32 {
class FileSystemController {
public:
+ FileSystemController();
+ ~FileSystemController();
+
ResultCode RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory);
ResultCode RegisterSaveData(std::unique_ptr<FileSys::SaveDataFactory>&& factory);
ResultCode RegisterSDMC(std::unique_ptr<FileSys::SDMCFactory>&& factory);
ResultCode RegisterBIS(std::unique_ptr<FileSys::BISFactory>&& factory);
void SetPackedUpdate(FileSys::VirtualFile update_raw);
- ResultVal<FileSys::VirtualFile> OpenRomFSCurrentProcess();
+ ResultVal<FileSys::VirtualFile> OpenRomFSCurrentProcess() const;
ResultVal<FileSys::VirtualFile> OpenRomFS(u64 title_id, FileSys::StorageId storage_id,
- FileSys::ContentRecordType type);
- ResultVal<FileSys::VirtualDir> CreateSaveData(FileSys::SaveDataSpaceId space,
- const FileSys::SaveDataDescriptor& save_struct);
- ResultVal<FileSys::VirtualDir> OpenSaveData(FileSys::SaveDataSpaceId space,
- const FileSys::SaveDataDescriptor& save_struct);
- ResultVal<FileSys::VirtualDir> OpenSaveDataSpace(FileSys::SaveDataSpaceId space);
- ResultVal<FileSys::VirtualDir> OpenSDMC();
- ResultVal<FileSys::VirtualDir> OpenBISPartition(FileSys::BisPartitionId id);
- ResultVal<FileSys::VirtualFile> OpenBISPartitionStorage(FileSys::BisPartitionId id);
+ FileSys::ContentRecordType type) const;
+ ResultVal<FileSys::VirtualDir> CreateSaveData(
+ FileSys::SaveDataSpaceId space, const FileSys::SaveDataDescriptor& save_struct) const;
+ ResultVal<FileSys::VirtualDir> OpenSaveData(
+ FileSys::SaveDataSpaceId space, const FileSys::SaveDataDescriptor& save_struct) const;
+ ResultVal<FileSys::VirtualDir> OpenSaveDataSpace(FileSys::SaveDataSpaceId space) const;
+ ResultVal<FileSys::VirtualDir> OpenSDMC() const;
+ ResultVal<FileSys::VirtualDir> OpenBISPartition(FileSys::BisPartitionId id) const;
+ ResultVal<FileSys::VirtualFile> OpenBISPartitionStorage(FileSys::BisPartitionId id) const;
u64 GetFreeSpaceSize(FileSys::StorageId id) const;
u64 GetTotalSpaceSize(FileSys::StorageId id) const;
- FileSys::SaveDataSize ReadSaveDataSize(FileSys::SaveDataType type, u64 title_id, u128 user_id);
+ FileSys::SaveDataSize ReadSaveDataSize(FileSys::SaveDataType type, u64 title_id,
+ u128 user_id) const;
void WriteSaveDataSize(FileSys::SaveDataType type, u64 title_id, u128 user_id,
- FileSys::SaveDataSize new_value);
+ FileSys::SaveDataSize new_value) const;
void SetGameCard(FileSys::VirtualFile file);
- FileSys::XCI* GetGameCard();
+ FileSys::XCI* GetGameCard() const;
- FileSys::RegisteredCache* GetSystemNANDContents();
- FileSys::RegisteredCache* GetUserNANDContents();
- FileSys::RegisteredCache* GetSDMCContents();
- FileSys::RegisteredCache* GetGameCardContents();
+ FileSys::RegisteredCache* GetSystemNANDContents() const;
+ FileSys::RegisteredCache* GetUserNANDContents() const;
+ FileSys::RegisteredCache* GetSDMCContents() const;
+ FileSys::RegisteredCache* GetGameCardContents() const;
- FileSys::PlaceholderCache* GetSystemNANDPlaceholder();
- FileSys::PlaceholderCache* GetUserNANDPlaceholder();
- FileSys::PlaceholderCache* GetSDMCPlaceholder();
- FileSys::PlaceholderCache* GetGameCardPlaceholder();
+ FileSys::PlaceholderCache* GetSystemNANDPlaceholder() const;
+ FileSys::PlaceholderCache* GetUserNANDPlaceholder() const;
+ FileSys::PlaceholderCache* GetSDMCPlaceholder() const;
+ FileSys::PlaceholderCache* GetGameCardPlaceholder() const;
- FileSys::RegisteredCache* GetRegisteredCacheForStorage(FileSys::StorageId id);
- FileSys::PlaceholderCache* GetPlaceholderCacheForStorage(FileSys::StorageId id);
+ FileSys::RegisteredCache* GetRegisteredCacheForStorage(FileSys::StorageId id) const;
+ FileSys::PlaceholderCache* GetPlaceholderCacheForStorage(FileSys::StorageId id) const;
- FileSys::VirtualDir GetSystemNANDContentDirectory();
- FileSys::VirtualDir GetUserNANDContentDirectory();
- FileSys::VirtualDir GetSDMCContentDirectory();
+ FileSys::VirtualDir GetSystemNANDContentDirectory() const;
+ FileSys::VirtualDir GetUserNANDContentDirectory() const;
+ FileSys::VirtualDir GetSDMCContentDirectory() const;
- FileSys::VirtualDir GetNANDImageDirectory();
- FileSys::VirtualDir GetSDMCImageDirectory();
+ FileSys::VirtualDir GetNANDImageDirectory() const;
+ FileSys::VirtualDir GetSDMCImageDirectory() const;
- FileSys::VirtualDir GetContentDirectory(ContentStorageId id);
- FileSys::VirtualDir GetImageDirectory(ImageDirectoryId id);
+ FileSys::VirtualDir GetContentDirectory(ContentStorageId id) const;
+ FileSys::VirtualDir GetImageDirectory(ImageDirectoryId id) const;
- FileSys::VirtualDir GetModificationLoadRoot(u64 title_id);
- FileSys::VirtualDir GetModificationDumpRoot(u64 title_id);
+ FileSys::VirtualDir GetModificationLoadRoot(u64 title_id) const;
+ FileSys::VirtualDir GetModificationDumpRoot(u64 title_id) const;
// Creates the SaveData, SDMC, and BIS Factories. Should be called once and before any function
// above is called.
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp
index 525fda19f..305d9e176 100644
--- a/src/core/hle/service/filesystem/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp_srv.cpp
@@ -32,8 +32,8 @@
namespace Service::FileSystem {
struct SizeGetter {
- std::function<u64()> free;
- std::function<u64()> total;
+ std::function<u64()> get_free_size;
+ std::function<u64()> get_total_size;
static SizeGetter FromStorageId(const FileSystemController& fsc, FileSys::StorageId id) {
return {
@@ -485,7 +485,7 @@ public:
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
- rb.Push(size.free());
+ rb.Push(size.get_free_size());
}
void GetTotalSpaceSize(Kernel::HLERequestContext& ctx) {
@@ -493,7 +493,7 @@ public:
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
- rb.Push(size.total());
+ rb.Push(size.get_total_size());
}
private: