[hle] constexpr handler dispatch maps, introduce version gating (#4480)

This PR primarily focuses on upbringing constexpr maps for handlers.

Each time an HLE object of a service is construed, it registers it's own handlers, over and over.
Regardless of whetever it needs them at the moment or not.
Additionally we don't require to keep track of different function pointers amongst each object.
This can be done by overriding the given function instead, as opposed to having a separate
hash map for every given object.

In other words: Remove handlers (and handlers_tipc) map for every instance
then read from a static defined per-class.

- [x] Migrate all HLE functions to new `frozen::map` constexpr time finder
- [ ] Measure if this approach actually makes better codegen

Optional:
- [x] Properly gate all functions (that have versions commented next to them)
- [x] Maybe store `HandlerFnP<>` and `const char*` separately, version gating can go in a different map as well

Information such as name can be used on debug builds, but doesn't particularly help on release as one can consult an external reference (or have an annotated IPC map)

Signed-off-by: lizzie <lizzie@eden-emu.dev>

- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
- [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md)
- [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.

-------------------

Co-authored-by: Maufeat <sahyno1996@gmail.com>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4480
Reviewed-by: Maufeat <sahyno1996@gmail.com>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
This commit is contained in:
lizzie
2026-10-13 04:38:36 +02:00
committed by PavelBARABANOV
parent 989768aa46
commit 1059202c75
392 changed files with 12453 additions and 14117 deletions
@@ -11,15 +11,18 @@
namespace Service::FileSystem {
std::optional<ServiceFrameworkBase::FunctionInfoBase> IDirectory::FindRequest(u32 key) {
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, D<&IDirectory::Read>, "Read"},
FunctionInfo{1, D<&IDirectory::GetEntryCount>, "GetEntryCount"}
);
return HandlerTableGenerateWithFind(key, functions);
}
IDirectory::IDirectory(Core::System& system_, FileSys::VirtualDir directory_,
FileSys::OpenDirectoryMode mode)
: ServiceFramework{system_, "IDirectory"},
backend(std::make_unique<FileSys::Fsa::IDirectory>(directory_, mode)) {
static const FunctionInfo functions[] = {
{0, D<&IDirectory::Read>, "Read"},
{1, D<&IDirectory::GetEntryCount>, "GetEntryCount"},
};
RegisterHandlers(functions);
}
Result IDirectory::Read(
@@ -29,6 +29,8 @@ private:
Result Read(Out<s64> out_count,
const OutArray<FileSys::DirectoryEntry, BufferAttr_HipcMapAlias> out_entries);
Result GetEntryCount(Out<s64> out_count);
std::optional<FunctionInfoBase> FindRequest(u32 key) override;
};
} // namespace Service::FileSystem
@@ -12,18 +12,6 @@ namespace Service::FileSystem {
IFile::IFile(Core::System& system_, FileSys::VirtualFile file_)
: ServiceFramework{system_, "IFile"}, backend{std::make_unique<FileSys::Fsa::IFile>(file_)} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&IFile::Read>, "Read"},
{1, D<&IFile::Write>, "Write"},
{2, D<&IFile::Flush>, "Flush"},
{3, D<&IFile::SetSize>, "SetSize"},
{4, D<&IFile::GetSize>, "GetSize"},
{5, nullptr, "OperateRange"},
{6, nullptr, "OperateRangeWithBuffer"},
};
// clang-format on
RegisterHandlers(functions);
}
Result IFile::Read(
@@ -30,6 +30,19 @@ private:
Result Flush();
Result SetSize(s64 size);
Result GetSize(Out<s64> out_size);
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, D<&IFile::Read>, "Read"},
FunctionInfo{1, D<&IFile::Write>, "Write"},
FunctionInfo{2, D<&IFile::Flush>, "Flush"},
FunctionInfo{3, D<&IFile::SetSize>, "SetSize"},
FunctionInfo{4, D<&IFile::GetSize>, "GetSize"},
FunctionInfo{5, nullptr, "OperateRange"},
FunctionInfo{6, nullptr, "OperateRangeWithBuffer"}
);
};
} // namespace Service::FileSystem
@@ -13,30 +13,33 @@
namespace Service::FileSystem {
std::optional<ServiceFrameworkBase::FunctionInfoBase> IFileSystem::FindRequest(u32 key) {
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, D<&IFileSystem::CreateFile>, "CreateFile"},
FunctionInfo{1, D<&IFileSystem::DeleteFile>, "DeleteFile"},
FunctionInfo{2, D<&IFileSystem::CreateDirectory>, "CreateDirectory"},
FunctionInfo{3, D<&IFileSystem::DeleteDirectory>, "DeleteDirectory"},
FunctionInfo{4, D<&IFileSystem::DeleteDirectoryRecursively>, "DeleteDirectoryRecursively"},
FunctionInfo{5, D<&IFileSystem::RenameFile>, "RenameFile"},
FunctionInfo{6, D<&IFileSystem::RenameDirectory>, "RenameDirectory"},
FunctionInfo{7, D<&IFileSystem::GetEntryType>, "GetEntryType"},
FunctionInfo{8, D<&IFileSystem::OpenFile>, "OpenFile"},
FunctionInfo{9, D<&IFileSystem::OpenDirectory>, "OpenDirectory"},
FunctionInfo{10, D<&IFileSystem::Commit>, "Commit"},
FunctionInfo{11, D<&IFileSystem::GetFreeSpaceSize>, "GetFreeSpaceSize"},
FunctionInfo{12, D<&IFileSystem::GetTotalSpaceSize>, "GetTotalSpaceSize"},
FunctionInfo{13, D<&IFileSystem::CleanDirectoryRecursively>, "CleanDirectoryRecursively"},
FunctionInfo{14, D<&IFileSystem::GetFileTimeStampRaw>, "GetFileTimeStampRaw"},
FunctionInfo{15, nullptr, "QueryEntry"},
FunctionInfo{16, D<&IFileSystem::GetFileSystemAttribute>, "GetFileSystemAttribute"}
);
return HandlerTableGenerateWithFind(key, functions);
}
IFileSystem::IFileSystem(Core::System& system_, FileSys::VirtualDir dir_, SizeGetter size_getter_)
: ServiceFramework{system_, "IFileSystem"}, backend{std::make_unique<FileSys::Fsa::IFileSystem>(
dir_)},
size_getter{std::move(size_getter_)} {
static const FunctionInfo functions[] = {
{0, D<&IFileSystem::CreateFile>, "CreateFile"},
{1, D<&IFileSystem::DeleteFile>, "DeleteFile"},
{2, D<&IFileSystem::CreateDirectory>, "CreateDirectory"},
{3, D<&IFileSystem::DeleteDirectory>, "DeleteDirectory"},
{4, D<&IFileSystem::DeleteDirectoryRecursively>, "DeleteDirectoryRecursively"},
{5, D<&IFileSystem::RenameFile>, "RenameFile"},
{6, D<&IFileSystem::RenameDirectory>, "RenameDirectory"},
{7, D<&IFileSystem::GetEntryType>, "GetEntryType"},
{8, D<&IFileSystem::OpenFile>, "OpenFile"},
{9, D<&IFileSystem::OpenDirectory>, "OpenDirectory"},
{10, D<&IFileSystem::Commit>, "Commit"},
{11, D<&IFileSystem::GetFreeSpaceSize>, "GetFreeSpaceSize"},
{12, D<&IFileSystem::GetTotalSpaceSize>, "GetTotalSpaceSize"},
{13, D<&IFileSystem::CleanDirectoryRecursively>, "CleanDirectoryRecursively"},
{14, D<&IFileSystem::GetFileTimeStampRaw>, "GetFileTimeStampRaw"},
{15, nullptr, "QueryEntry"},
{16, D<&IFileSystem::GetFileSystemAttribute>, "GetFileSystemAttribute"},
};
RegisterHandlers(functions);
}
Result IFileSystem::CreateFile(const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path,
@@ -58,6 +58,7 @@ public:
Result GetFileSystemAttribute(Out<FileSys::FileSystemAttribute> out_attribute);
private:
std::optional<FunctionInfoBase> FindRequest(u32 key) override;
std::unique_ptr<FileSys::Fsa::IFileSystem> backend;
SizeGetter size_getter;
};
@@ -12,11 +12,6 @@ namespace Service::FileSystem {
IMultiCommitManager::IMultiCommitManager(Core::System& system_)
: ServiceFramework{system_, "IMultiCommitManager"} {
static const FunctionInfo functions[] = {
{1, D<&IMultiCommitManager::Add>, "Add"},
{2, D<&IMultiCommitManager::Commit>, "Commit"},
};
RegisterHandlers(functions);
}
IMultiCommitManager::~IMultiCommitManager() = default;
@@ -20,6 +20,13 @@ private:
Result Add(std::shared_ptr<IFileSystem> filesystem);
Result Commit();
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{1, D<&IMultiCommitManager::Add>, "Add"},
FunctionInfo{2, D<&IMultiCommitManager::Commit>, "Commit"}
);
FileSys::VirtualFile backend;
};
@@ -17,11 +17,6 @@ ISaveDataInfoReader::ISaveDataInfoReader(Core::System& system_,
FileSys::SaveDataSpaceId space)
: ServiceFramework{system_, "ISaveDataInfoReader"}, save_data_controller{
save_data_controller_} {
static const FunctionInfo functions[] = {
{0, D<&ISaveDataInfoReader::ReadSaveDataInfo>, "ReadSaveDataInfo"},
};
RegisterHandlers(functions);
FindAllSaves(space);
}
@@ -45,6 +45,12 @@ private:
void FindNormalSaves(FileSys::SaveDataSpaceId space, const FileSys::VirtualDir& type);
void FindTemporaryStorageSaves(FileSys::SaveDataSpaceId space, const FileSys::VirtualDir& type);
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, D<&ISaveDataInfoReader::ReadSaveDataInfo>, "ReadSaveDataInfo"}
);
std::shared_ptr<SaveDataController> save_data_controller;
std::vector<SaveDataInfo> info;
u64 next_entry_index = 0;
@@ -12,15 +12,6 @@ namespace Service::FileSystem {
IStorage::IStorage(Core::System& system_, FileSys::VirtualFile backend_)
: ServiceFramework{system_, "IStorage"}, backend(std::move(backend_)) {
static const FunctionInfo functions[] = {
{0, D<&IStorage::Read>, "Read"},
{1, nullptr, "Write"},
{2, nullptr, "Flush"},
{3, nullptr, "SetSize"},
{4, D<&IStorage::GetSize>, "GetSize"},
{5, nullptr, "OperateRange"},
};
RegisterHandlers(functions);
}
Result IStorage::Read(
@@ -18,12 +18,23 @@ public:
explicit IStorage(Core::System& system_, FileSys::VirtualFile backend_);
private:
FileSys::VirtualFile backend;
Result Read(
OutBuffer<BufferAttr_HipcMapAlias | BufferAttr_HipcMapTransferAllowsNonSecure> out_bytes,
s64 offset, s64 length);
Result GetSize(Out<u64> out_size);
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, D<&IStorage::Read>, "Read"},
FunctionInfo{1, nullptr, "Write"},
FunctionInfo{2, nullptr, "Flush"},
FunctionInfo{3, nullptr, "SetSize"},
FunctionInfo{4, D<&IStorage::GetSize>, "GetSize"},
FunctionInfo{5, nullptr, "OperateRange"}
);
FileSys::VirtualFile backend;
};
} // namespace Service::FileSystem
@@ -9,15 +9,6 @@
namespace Service::FileSystem {
FSP_LDR::FSP_LDR(Core::System& system_) : ServiceFramework{system_, "fsp:ldr"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "OpenCodeFileSystem"},
{1, nullptr, "IsArchivedProgram"},
{2, nullptr, "SetCurrentProcess"},
};
// clang-format on
RegisterHandlers(functions);
}
FSP_LDR::~FSP_LDR() = default;
@@ -18,6 +18,15 @@ class FSP_LDR final : public ServiceFramework<FSP_LDR> {
public:
explicit FSP_LDR(Core::System& system_);
~FSP_LDR() override;
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "OpenCodeFileSystem"},
FunctionInfo{1, nullptr, "IsArchivedProgram"},
FunctionInfo{2, nullptr, "SetCurrentProcess"}
);
};
} // namespace Service::FileSystem
@@ -9,16 +9,6 @@
namespace Service::FileSystem {
FSP_PR::FSP_PR(Core::System& system_) : ServiceFramework{system_, "fsp:pr"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "RegisterProgram"},
{1, nullptr, "UnregisterProgram"},
{2, nullptr, "SetCurrentProcess"},
{256, nullptr, "SetEnabledProgramVerification"},
};
// clang-format on
RegisterHandlers(functions);
}
FSP_PR::~FSP_PR() = default;
@@ -18,6 +18,16 @@ class FSP_PR final : public ServiceFramework<FSP_PR> {
public:
explicit FSP_PR(Core::System& system_);
~FSP_PR() override;
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "RegisterProgram"},
FunctionInfo{1, nullptr, "UnregisterProgram"},
FunctionInfo{2, nullptr, "SetCurrentProcess"},
FunctionInfo{256, nullptr, "SetEnabledProgramVerification"}
);
};
} // namespace Service::FileSystem
+135 -136
View File
@@ -47,143 +47,142 @@
namespace Service::FileSystem {
FSP_SRV::FSP_SRV(Core::System& system_)
: ServiceFramework{system_, "fsp-srv"}, fsc{system.GetFileSystemController()},
content_provider{system.GetContentProvider()}, reporter{system.GetReporter()} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "OpenFileSystem"},
{1, D<&FSP_SRV::SetCurrentProcess>, "SetCurrentProcess"},
{2, D<&FSP_SRV::OpenDataFileSystemByCurrentProcess>, "OpenDataFileSystemByCurrentProcess"},
{7, D<&FSP_SRV::OpenFileSystemWithPatch>, "OpenFileSystemWithPatch"},
{8, nullptr, "OpenFileSystemWithId"},
{9, nullptr, "OpenDataFileSystemByApplicationId"},
{11, nullptr, "OpenBisFileSystem"},
{12, nullptr, "OpenBisStorage"},
{13, nullptr, "InvalidateBisCache"},
{17, nullptr, "OpenHostFileSystem"},
{18, D<&FSP_SRV::OpenSdCardFileSystem>, "OpenSdCardFileSystem"},
{19, nullptr, "FormatSdCardFileSystem"},
{21, nullptr, "DeleteSaveDataFileSystem"},
{22, D<&FSP_SRV::CreateSaveDataFileSystem>, "CreateSaveDataFileSystem"},
{23, D<&FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId>, "CreateSaveDataFileSystemBySystemSaveDataId"},
{24, nullptr, "RegisterSaveDataFileSystemAtomicDeletion"},
{25, nullptr, "DeleteSaveDataFileSystemBySaveDataSpaceId"},
{26, nullptr, "FormatSdCardDryRun"},
{27, D<&FSP_SRV::IsExFatSupported>, "IsExFatSupported"},
{28, nullptr, "DeleteSaveDataFileSystemBySaveDataAttribute"},
{30, nullptr, "OpenGameCardStorage"},
{31, nullptr, "OpenGameCardFileSystem"},
{32, D<&FSP_SRV::ExtendSaveDataFileSystem>, "ExtendSaveDataFileSystem"},
{33, nullptr, "DeleteCacheStorage"},
{34, D<&FSP_SRV::GetCacheStorageSize>, "GetCacheStorageSize"},
{35, nullptr, "CreateSaveDataFileSystemByHashSalt"},
{36, nullptr, "OpenHostFileSystemWithOption"},
{37, D<&FSP_SRV::CreateSaveDataFileSystemWithCreationInfo2>, "CreateSaveDataFileSystemWithCreationInfo2"},
{51, D<&FSP_SRV::OpenSaveDataFileSystem>, "OpenSaveDataFileSystem"},
{52, D<&FSP_SRV::OpenSaveDataFileSystemBySystemSaveDataId>, "OpenSaveDataFileSystemBySystemSaveDataId"},
{53, D<&FSP_SRV::OpenReadOnlySaveDataFileSystem>, "OpenReadOnlySaveDataFileSystem"},
{57, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataSpaceId>, "ReadSaveDataFileSystemExtraDataBySaveDataSpaceId"},
{58, D<&FSP_SRV::ReadSaveDataFileSystemExtraData>, "ReadSaveDataFileSystemExtraData"},
{59, D<&FSP_SRV::WriteSaveDataFileSystemExtraData>, "WriteSaveDataFileSystemExtraData"},
{60, nullptr, "OpenSaveDataInfoReader"},
{61, D<&FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId>, "OpenSaveDataInfoReaderBySaveDataSpaceId"},
{62, D<&FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage>, "OpenSaveDataInfoReaderOnlyCacheStorage"},
{64, nullptr, "OpenSaveDataInternalStorageFileSystem"},
{65, nullptr, "UpdateSaveDataMacForDebug"},
{66, nullptr, "WriteSaveDataFileSystemExtraData2"},
{67, D<&FSP_SRV::FindSaveDataWithFilter>, "FindSaveDataWithFilter"},
{68, nullptr, "OpenSaveDataInfoReaderBySaveDataFilter"},
{69, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataBySaveDataAttribute"},
{70, D<&FSP_SRV::WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"},
{71, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"},
{80, nullptr, "OpenSaveDataMetaFile"},
{81, nullptr, "OpenSaveDataTransferManager"},
{82, nullptr, "OpenSaveDataTransferManagerVersion2"},
{83, D<&FSP_SRV::OpenSaveDataTransferProhibiter>, "OpenSaveDataTransferProhibiter"},
{84, nullptr, "ListApplicationAccessibleSaveDataOwnerId"},
{85, nullptr, "OpenSaveDataTransferManagerForSaveDataRepair"},
{86, nullptr, "OpenSaveDataMover"},
{87, nullptr, "OpenSaveDataTransferManagerForRepair"},
{100, nullptr, "OpenImageDirectoryFileSystem"},
{101, nullptr, "OpenBaseFileSystem"},
{102, nullptr, "FormatBaseFileSystem"},
{110, nullptr, "OpenContentStorageFileSystem"},
{120, nullptr, "OpenCloudBackupWorkStorageFileSystem"},
{130, nullptr, "OpenCustomStorageFileSystem"},
{200, D<&FSP_SRV::OpenDataStorageByCurrentProcess>, "OpenDataStorageByCurrentProcess"},
{201, nullptr, "OpenDataStorageByProgramId"},
{202, D<&FSP_SRV::OpenDataStorageByDataId>, "OpenDataStorageByDataId"},
{203, D<&FSP_SRV::OpenPatchDataStorageByCurrentProcess>, "OpenPatchDataStorageByCurrentProcess"},
{204, nullptr, "OpenDataFileSystemByProgramIndex"},
{205, D<&FSP_SRV::OpenDataStorageWithProgramIndex>, "OpenDataStorageWithProgramIndex"},
{206, nullptr, "OpenDataStorageByPath"},
{210, D<&FSP_SRV::SetCurrentProcess>, "SetCurrentProcess"},
{400, nullptr, "OpenDeviceOperator"},
{500, nullptr, "OpenSdCardDetectionEventNotifier"},
{501, nullptr, "OpenGameCardDetectionEventNotifier"},
{510, nullptr, "OpenSystemDataUpdateEventNotifier"},
{511, nullptr, "NotifySystemDataUpdateEvent"},
{520, nullptr, "SimulateGameCardDetectionEvent"},
{600, nullptr, "SetCurrentPosixTime"},
{601, nullptr, "QuerySaveDataTotalSize"},
{602, nullptr, "VerifySaveDataFileSystem"},
{603, nullptr, "CorruptSaveDataFileSystem"},
{604, nullptr, "CreatePaddingFile"},
{605, nullptr, "DeleteAllPaddingFiles"},
{606, nullptr, "GetRightsId"},
{607, nullptr, "RegisterExternalKey"},
{608, nullptr, "UnregisterAllExternalKey"},
{609, nullptr, "GetRightsIdByPath"},
{610, nullptr, "GetRightsIdAndKeyGenerationByPath"},
{611, nullptr, "SetCurrentPosixTimeWithTimeDifference"},
{612, nullptr, "GetFreeSpaceSizeForSaveData"},
{613, nullptr, "VerifySaveDataFileSystemBySaveDataSpaceId"},
{614, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId"},
{615, nullptr, "QuerySaveDataInternalStorageTotalSize"},
{616, nullptr, "GetSaveDataCommitId"},
{617, nullptr, "UnregisterExternalKey"},
{620, nullptr, "SetSdCardEncryptionSeed"},
{630, nullptr, "SetSdCardAccessibility"},
{631, D<&FSP_SRV::IsSdCardAccessible>, "IsSdCardAccessible"},
{640, nullptr, "IsSignedSystemPartitionOnSdCardValid"},
{700, nullptr, "OpenAccessFailureResolver"},
{701, nullptr, "GetAccessFailureDetectionEvent"},
{702, nullptr, "IsAccessFailureDetected"},
{710, nullptr, "ResolveAccessFailure"},
{720, nullptr, "AbandonAccessFailure"},
{800, nullptr, "GetAndClearFileSystemProxyErrorInfo"},
{810, nullptr, "RegisterProgramIndexMapInfo"},
{820, nullptr, "GetContentStorageInfoIndex"},
{830, nullptr, "EncryptStreamPlaySaveData"},
{831, nullptr, "DecryptStreamPlaySaveData"},
{1000, nullptr, "SetBisRootForHost"},
{1001, nullptr, "SetSaveDataSize"},
{1002, nullptr, "SetSaveDataRootPath"},
{1003, D<&FSP_SRV::DisableAutoSaveDataCreation>, "DisableAutoSaveDataCreation"},
{1004, D<&FSP_SRV::SetGlobalAccessLogMode>, "SetGlobalAccessLogMode"},
{1005, D<&FSP_SRV::GetGlobalAccessLogMode>, "GetGlobalAccessLogMode"},
{1006, D<&FSP_SRV::OutputAccessLogToSdCard>, "OutputAccessLogToSdCard"},
{1007, nullptr, "RegisterUpdatePartition"},
{1008, nullptr, "OpenRegisteredUpdatePartition"},
{1009, nullptr, "GetAndClearMemoryReportInfo"},
{1010, nullptr, "SetDataStorageRedirectTarget"},
{1011, D<&FSP_SRV::GetProgramIndexForAccessLog>, "GetProgramIndexForAccessLog"},
{1012, nullptr, "GetFsStackUsage"},
{1013, nullptr, "UnsetSaveDataRootPath"},
{1014, nullptr, "OutputMultiProgramTagAccessLog"},
{1016, D<&FSP_SRV::FlushAccessLogOnSdCard>, "FlushAccessLogOnSdCard"},
{1017, nullptr, "OutputApplicationInfoAccessLog"},
{1018, nullptr, "SetDebugOption"},
{1019, nullptr, "UnsetDebugOption"},
{1100, nullptr, "OverrideSaveDataTransferTokenSignVerificationKey"},
{1110, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId2"},
{1200, D<&FSP_SRV::OpenMultiCommitManager>, "OpenMultiCommitManager"},
{1300, nullptr, "OpenBisWiper"},
};
// clang-format on
RegisterHandlers(functions);
std::optional<ServiceFrameworkBase::FunctionInfoBase> FSP_SRV::FindRequest(u32 key) {
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "OpenFileSystem"},
FunctionInfo{1, D<&FSP_SRV::SetCurrentProcess>, "SetCurrentProcess"},
FunctionInfo{2, D<&FSP_SRV::OpenDataFileSystemByCurrentProcess>, "OpenDataFileSystemByCurrentProcess"},
FunctionInfo{7, D<&FSP_SRV::OpenFileSystemWithPatch>, "OpenFileSystemWithPatch"},
FunctionInfo{8, nullptr, "OpenFileSystemWithId"},
FunctionInfo{9, nullptr, "OpenDataFileSystemByApplicationId"},
FunctionInfo{11, nullptr, "OpenBisFileSystem"},
FunctionInfo{12, nullptr, "OpenBisStorage"},
FunctionInfo{13, nullptr, "InvalidateBisCache"},
FunctionInfo{17, nullptr, "OpenHostFileSystem"},
FunctionInfo{18, D<&FSP_SRV::OpenSdCardFileSystem>, "OpenSdCardFileSystem"},
FunctionInfo{19, nullptr, "FormatSdCardFileSystem"},
FunctionInfo{21, nullptr, "DeleteSaveDataFileSystem"},
FunctionInfo{22, D<&FSP_SRV::CreateSaveDataFileSystem>, "CreateSaveDataFileSystem"},
FunctionInfo{23, D<&FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId>, "CreateSaveDataFileSystemBySystemSaveDataId"},
FunctionInfo{24, nullptr, "RegisterSaveDataFileSystemAtomicDeletion"},
FunctionInfo{25, nullptr, "DeleteSaveDataFileSystemBySaveDataSpaceId"},
FunctionInfo{26, nullptr, "FormatSdCardDryRun"},
FunctionInfo{27, D<&FSP_SRV::IsExFatSupported>, "IsExFatSupported"},
FunctionInfo{28, nullptr, "DeleteSaveDataFileSystemBySaveDataAttribute"},
FunctionInfo{30, nullptr, "OpenGameCardStorage"},
FunctionInfo{31, nullptr, "OpenGameCardFileSystem"},
FunctionInfo{32, D<&FSP_SRV::ExtendSaveDataFileSystem>, "ExtendSaveDataFileSystem"},
FunctionInfo{33, nullptr, "DeleteCacheStorage"},
FunctionInfo{34, D<&FSP_SRV::GetCacheStorageSize>, "GetCacheStorageSize"},
FunctionInfo{35, nullptr, "CreateSaveDataFileSystemByHashSalt"},
FunctionInfo{36, nullptr, "OpenHostFileSystemWithOption"},
FunctionInfo{37, D<&FSP_SRV::CreateSaveDataFileSystemWithCreationInfo2>, "CreateSaveDataFileSystemWithCreationInfo2"},
FunctionInfo{51, D<&FSP_SRV::OpenSaveDataFileSystem>, "OpenSaveDataFileSystem"},
FunctionInfo{52, D<&FSP_SRV::OpenSaveDataFileSystemBySystemSaveDataId>, "OpenSaveDataFileSystemBySystemSaveDataId"},
FunctionInfo{53, D<&FSP_SRV::OpenReadOnlySaveDataFileSystem>, "OpenReadOnlySaveDataFileSystem"},
FunctionInfo{57, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataSpaceId>, "ReadSaveDataFileSystemExtraDataBySaveDataSpaceId"},
FunctionInfo{58, D<&FSP_SRV::ReadSaveDataFileSystemExtraData>, "ReadSaveDataFileSystemExtraData"},
FunctionInfo{59, D<&FSP_SRV::WriteSaveDataFileSystemExtraData>, "WriteSaveDataFileSystemExtraData"},
FunctionInfo{60, nullptr, "OpenSaveDataInfoReader"},
FunctionInfo{61, D<&FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId>, "OpenSaveDataInfoReaderBySaveDataSpaceId"},
FunctionInfo{62, D<&FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage>, "OpenSaveDataInfoReaderOnlyCacheStorage"},
FunctionInfo{64, nullptr, "OpenSaveDataInternalStorageFileSystem"},
FunctionInfo{65, nullptr, "UpdateSaveDataMacForDebug"},
FunctionInfo{66, nullptr, "WriteSaveDataFileSystemExtraData2"},
FunctionInfo{67, D<&FSP_SRV::FindSaveDataWithFilter>, "FindSaveDataWithFilter"},
FunctionInfo{68, nullptr, "OpenSaveDataInfoReaderBySaveDataFilter"},
FunctionInfo{69, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataBySaveDataAttribute"},
FunctionInfo{70, D<&FSP_SRV::WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"},
FunctionInfo{71, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"},
FunctionInfo{80, nullptr, "OpenSaveDataMetaFile"},
FunctionInfo{81, nullptr, "OpenSaveDataTransferManager"},
FunctionInfo{82, nullptr, "OpenSaveDataTransferManagerVersion2"},
FunctionInfo{83, D<&FSP_SRV::OpenSaveDataTransferProhibiter>, "OpenSaveDataTransferProhibiter"},
FunctionInfo{84, nullptr, "ListApplicationAccessibleSaveDataOwnerId"},
FunctionInfo{85, nullptr, "OpenSaveDataTransferManagerForSaveDataRepair"},
FunctionInfo{86, nullptr, "OpenSaveDataMover"},
FunctionInfo{87, nullptr, "OpenSaveDataTransferManagerForRepair"},
FunctionInfo{100, nullptr, "OpenImageDirectoryFileSystem"},
FunctionInfo{101, nullptr, "OpenBaseFileSystem"},
FunctionInfo{102, nullptr, "FormatBaseFileSystem"},
FunctionInfo{110, nullptr, "OpenContentStorageFileSystem"},
FunctionInfo{120, nullptr, "OpenCloudBackupWorkStorageFileSystem"},
FunctionInfo{130, nullptr, "OpenCustomStorageFileSystem"},
FunctionInfo{200, D<&FSP_SRV::OpenDataStorageByCurrentProcess>, "OpenDataStorageByCurrentProcess"},
FunctionInfo{201, nullptr, "OpenDataStorageByProgramId"},
FunctionInfo{202, D<&FSP_SRV::OpenDataStorageByDataId>, "OpenDataStorageByDataId"},
FunctionInfo{203, D<&FSP_SRV::OpenPatchDataStorageByCurrentProcess>, "OpenPatchDataStorageByCurrentProcess"},
FunctionInfo{204, nullptr, "OpenDataFileSystemByProgramIndex"},
FunctionInfo{205, D<&FSP_SRV::OpenDataStorageWithProgramIndex>, "OpenDataStorageWithProgramIndex"},
FunctionInfo{206, nullptr, "OpenDataStorageByPath"},
FunctionInfo{210, D<&FSP_SRV::SetCurrentProcess>, "SetCurrentProcess"},
FunctionInfo{400, nullptr, "OpenDeviceOperator"},
FunctionInfo{500, nullptr, "OpenSdCardDetectionEventNotifier"},
FunctionInfo{501, nullptr, "OpenGameCardDetectionEventNotifier"},
FunctionInfo{510, nullptr, "OpenSystemDataUpdateEventNotifier"},
FunctionInfo{511, nullptr, "NotifySystemDataUpdateEvent"},
FunctionInfo{520, nullptr, "SimulateGameCardDetectionEvent"},
FunctionInfo{600, nullptr, "SetCurrentPosixTime"},
FunctionInfo{601, nullptr, "QuerySaveDataTotalSize"},
FunctionInfo{602, nullptr, "VerifySaveDataFileSystem"},
FunctionInfo{603, nullptr, "CorruptSaveDataFileSystem"},
FunctionInfo{604, nullptr, "CreatePaddingFile"},
FunctionInfo{605, nullptr, "DeleteAllPaddingFiles"},
FunctionInfo{606, nullptr, "GetRightsId"},
FunctionInfo{607, nullptr, "RegisterExternalKey"},
FunctionInfo{608, nullptr, "UnregisterAllExternalKey"},
FunctionInfo{609, nullptr, "GetRightsIdByPath"},
FunctionInfo{610, nullptr, "GetRightsIdAndKeyGenerationByPath"},
FunctionInfo{611, nullptr, "SetCurrentPosixTimeWithTimeDifference"},
FunctionInfo{612, nullptr, "GetFreeSpaceSizeForSaveData"},
FunctionInfo{613, nullptr, "VerifySaveDataFileSystemBySaveDataSpaceId"},
FunctionInfo{614, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId"},
FunctionInfo{615, nullptr, "QuerySaveDataInternalStorageTotalSize"},
FunctionInfo{616, nullptr, "GetSaveDataCommitId"},
FunctionInfo{617, nullptr, "UnregisterExternalKey"},
FunctionInfo{620, nullptr, "SetSdCardEncryptionSeed"},
FunctionInfo{630, nullptr, "SetSdCardAccessibility"},
FunctionInfo{631, D<&FSP_SRV::IsSdCardAccessible>, "IsSdCardAccessible"},
FunctionInfo{640, nullptr, "IsSignedSystemPartitionOnSdCardValid"},
FunctionInfo{700, nullptr, "OpenAccessFailureResolver"},
FunctionInfo{701, nullptr, "GetAccessFailureDetectionEvent"},
FunctionInfo{702, nullptr, "IsAccessFailureDetected"},
FunctionInfo{710, nullptr, "ResolveAccessFailure"},
FunctionInfo{720, nullptr, "AbandonAccessFailure"},
FunctionInfo{800, nullptr, "GetAndClearFileSystemProxyErrorInfo"},
FunctionInfo{810, nullptr, "RegisterProgramIndexMapInfo"},
FunctionInfo{820, nullptr, "GetContentStorageInfoIndex"},
FunctionInfo{830, nullptr, "EncryptStreamPlaySaveData"},
FunctionInfo{831, nullptr, "DecryptStreamPlaySaveData"},
FunctionInfo{1000, nullptr, "SetBisRootForHost"},
FunctionInfo{1001, nullptr, "SetSaveDataSize"},
FunctionInfo{1002, nullptr, "SetSaveDataRootPath"},
FunctionInfo{1003, D<&FSP_SRV::DisableAutoSaveDataCreation>, "DisableAutoSaveDataCreation"},
FunctionInfo{1004, D<&FSP_SRV::SetGlobalAccessLogMode>, "SetGlobalAccessLogMode"},
FunctionInfo{1005, D<&FSP_SRV::GetGlobalAccessLogMode>, "GetGlobalAccessLogMode"},
FunctionInfo{1006, D<&FSP_SRV::OutputAccessLogToSdCard>, "OutputAccessLogToSdCard"},
FunctionInfo{1007, nullptr, "RegisterUpdatePartition"},
FunctionInfo{1008, nullptr, "OpenRegisteredUpdatePartition"},
FunctionInfo{1009, nullptr, "GetAndClearMemoryReportInfo"},
FunctionInfo{1010, nullptr, "SetDataStorageRedirectTarget"},
FunctionInfo{1011, D<&FSP_SRV::GetProgramIndexForAccessLog>, "GetProgramIndexForAccessLog"},
FunctionInfo{1012, nullptr, "GetFsStackUsage"},
FunctionInfo{1013, nullptr, "UnsetSaveDataRootPath"},
FunctionInfo{1014, nullptr, "OutputMultiProgramTagAccessLog"},
FunctionInfo{1016, D<&FSP_SRV::FlushAccessLogOnSdCard>, "FlushAccessLogOnSdCard"},
FunctionInfo{1017, nullptr, "OutputApplicationInfoAccessLog"},
FunctionInfo{1018, nullptr, "SetDebugOption"},
FunctionInfo{1019, nullptr, "UnsetDebugOption"},
FunctionInfo{1100, nullptr, "OverrideSaveDataTransferTokenSignVerificationKey"},
FunctionInfo{1110, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId2"},
FunctionInfo{1200, D<&FSP_SRV::OpenMultiCommitManager>, "OpenMultiCommitManager"},
FunctionInfo{1300, nullptr, "OpenBisWiper"}
);
return HandlerTableGenerateWithFind(key, functions);
}
FSP_SRV::FSP_SRV(Core::System& system_)
: ServiceFramework{system_, "fsp-srv"}, fsc{system.GetFileSystemController()}, content_provider{system.GetContentProvider()}, reporter{system.GetReporter()} {
if (Settings::values.enable_fs_access_log) {
access_log_mode = AccessLogMode::SdCard;
}
@@ -115,6 +115,7 @@ private:
s64 available_size, s64 journal_size);
Result GetCacheStorageSize(s32 index, Out<s64> out_data_size, Out<s64> out_journal_size);
std::optional<FunctionInfoBase> FindRequest(u32 key) override;
FileSystemController& fsc;
const FileSys::ContentProvider& content_provider;
const Core::Reporter& reporter;