diff options
| author | 2020-12-03 22:57:28 -0500 | |
|---|---|---|
| committer | 2020-12-08 08:19:05 -0500 | |
| commit | e15039372ea63efb37cdaa70833b2d080931ee3c (patch) | |
| tree | 978997c532d32f3861ab25e06d128ddcaad65a0f /src/core/hle | |
| parent | file_sys: Consolidate common Title ID operations (diff) | |
| download | yuzu-e15039372ea63efb37cdaa70833b2d080931ee3c.tar.gz yuzu-e15039372ea63efb37cdaa70833b2d080931ee3c.tar.xz yuzu-e15039372ea63efb37cdaa70833b2d080931ee3c.zip | |
fsp_srv: Implement OpenDataStorageWithProgramIndex
- Used by RollerCoaster Tycoon 3: Complete Edition
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.cpp | 25 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/fsp_srv.cpp | 28 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/fsp_srv.h | 1 |
4 files changed, 57 insertions, 1 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index ca93062cf..0e9e06267 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp | |||
| @@ -298,6 +298,31 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFSCurrentProcess() | |||
| 298 | return romfs_factory->OpenCurrentProcess(system.CurrentProcess()->GetTitleID()); | 298 | return romfs_factory->OpenCurrentProcess(system.CurrentProcess()->GetTitleID()); |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | ResultVal<FileSys::VirtualFile> FileSystemController::OpenPatchedRomFS( | ||
| 302 | u64 title_id, FileSys::ContentRecordType type) const { | ||
| 303 | LOG_TRACE(Service_FS, "Opening patched RomFS for title_id={:016X}", title_id); | ||
| 304 | |||
| 305 | if (romfs_factory == nullptr) { | ||
| 306 | // TODO: Find a better error code for this | ||
| 307 | return RESULT_UNKNOWN; | ||
| 308 | } | ||
| 309 | |||
| 310 | return romfs_factory->OpenPatchedRomFS(title_id, type); | ||
| 311 | } | ||
| 312 | |||
| 313 | ResultVal<FileSys::VirtualFile> FileSystemController::OpenPatchedRomFSWithProgramIndex( | ||
| 314 | u64 title_id, u8 program_index, FileSys::ContentRecordType type) const { | ||
| 315 | LOG_TRACE(Service_FS, "Opening patched RomFS for title_id={:016X}, program_index={}", title_id, | ||
| 316 | program_index); | ||
| 317 | |||
| 318 | if (romfs_factory == nullptr) { | ||
| 319 | // TODO: Find a better error code for this | ||
| 320 | return RESULT_UNKNOWN; | ||
| 321 | } | ||
| 322 | |||
| 323 | return romfs_factory->OpenPatchedRomFSWithProgramIndex(title_id, program_index, type); | ||
| 324 | } | ||
| 325 | |||
| 301 | ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFS( | 326 | ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFS( |
| 302 | u64 title_id, FileSys::StorageId storage_id, FileSys::ContentRecordType type) const { | 327 | u64 title_id, FileSys::StorageId storage_id, FileSys::ContentRecordType type) const { |
| 303 | LOG_TRACE(Service_FS, "Opening RomFS for title_id={:016X}, storage_id={:02X}, type={:02X}", | 328 | LOG_TRACE(Service_FS, "Opening RomFS for title_id={:016X}, storage_id={:02X}, type={:02X}", |
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h index 6dbbf0b2b..7102d3f9a 100644 --- a/src/core/hle/service/filesystem/filesystem.h +++ b/src/core/hle/service/filesystem/filesystem.h | |||
| @@ -66,6 +66,10 @@ public: | |||
| 66 | 66 | ||
| 67 | void SetPackedUpdate(FileSys::VirtualFile update_raw); | 67 | void SetPackedUpdate(FileSys::VirtualFile update_raw); |
| 68 | ResultVal<FileSys::VirtualFile> OpenRomFSCurrentProcess() const; | 68 | ResultVal<FileSys::VirtualFile> OpenRomFSCurrentProcess() const; |
| 69 | ResultVal<FileSys::VirtualFile> OpenPatchedRomFS(u64 title_id, | ||
| 70 | FileSys::ContentRecordType type) const; | ||
| 71 | ResultVal<FileSys::VirtualFile> OpenPatchedRomFSWithProgramIndex( | ||
| 72 | u64 title_id, u8 program_index, FileSys::ContentRecordType type) const; | ||
| 69 | ResultVal<FileSys::VirtualFile> OpenRomFS(u64 title_id, FileSys::StorageId storage_id, | 73 | ResultVal<FileSys::VirtualFile> OpenRomFS(u64 title_id, FileSys::StorageId storage_id, |
| 70 | FileSys::ContentRecordType type) const; | 74 | FileSys::ContentRecordType type) const; |
| 71 | ResultVal<FileSys::VirtualDir> CreateSaveData( | 75 | ResultVal<FileSys::VirtualDir> CreateSaveData( |
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index b3480494c..a3623e0be 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp | |||
| @@ -718,7 +718,7 @@ FSP_SRV::FSP_SRV(Core::System& system_) | |||
| 718 | {202, &FSP_SRV::OpenDataStorageByDataId, "OpenDataStorageByDataId"}, | 718 | {202, &FSP_SRV::OpenDataStorageByDataId, "OpenDataStorageByDataId"}, |
| 719 | {203, &FSP_SRV::OpenPatchDataStorageByCurrentProcess, "OpenPatchDataStorageByCurrentProcess"}, | 719 | {203, &FSP_SRV::OpenPatchDataStorageByCurrentProcess, "OpenPatchDataStorageByCurrentProcess"}, |
| 720 | {204, nullptr, "OpenDataFileSystemByProgramIndex"}, | 720 | {204, nullptr, "OpenDataFileSystemByProgramIndex"}, |
| 721 | {205, nullptr, "OpenDataStorageByProgramIndex"}, | 721 | {205, &FSP_SRV::OpenDataStorageWithProgramIndex, "OpenDataStorageWithProgramIndex"}, |
| 722 | {400, nullptr, "OpenDeviceOperator"}, | 722 | {400, nullptr, "OpenDeviceOperator"}, |
| 723 | {500, nullptr, "OpenSdCardDetectionEventNotifier"}, | 723 | {500, nullptr, "OpenSdCardDetectionEventNotifier"}, |
| 724 | {501, nullptr, "OpenGameCardDetectionEventNotifier"}, | 724 | {501, nullptr, "OpenGameCardDetectionEventNotifier"}, |
| @@ -997,6 +997,32 @@ void FSP_SRV::OpenPatchDataStorageByCurrentProcess(Kernel::HLERequestContext& ct | |||
| 997 | rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND); | 997 | rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND); |
| 998 | } | 998 | } |
| 999 | 999 | ||
| 1000 | void FSP_SRV::OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx) { | ||
| 1001 | IPC::RequestParser rp{ctx}; | ||
| 1002 | |||
| 1003 | const auto program_index = rp.PopRaw<u8>(); | ||
| 1004 | |||
| 1005 | LOG_DEBUG(Service_FS, "called, program_index={}", program_index); | ||
| 1006 | |||
| 1007 | auto romfs = fsc.OpenPatchedRomFSWithProgramIndex( | ||
| 1008 | system.CurrentProcess()->GetTitleID(), program_index, FileSys::ContentRecordType::Program); | ||
| 1009 | |||
| 1010 | if (romfs.Failed()) { | ||
| 1011 | // TODO: Find the right error code to use here | ||
| 1012 | LOG_ERROR(Service_FS, "could not open storage with program_index={}", program_index); | ||
| 1013 | |||
| 1014 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1015 | rb.Push(RESULT_UNKNOWN); | ||
| 1016 | return; | ||
| 1017 | } | ||
| 1018 | |||
| 1019 | auto storage = std::make_shared<IStorage>(system, std::move(romfs.Unwrap())); | ||
| 1020 | |||
| 1021 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 1022 | rb.Push(RESULT_SUCCESS); | ||
| 1023 | rb.PushIpcInterface<IStorage>(std::move(storage)); | ||
| 1024 | } | ||
| 1025 | |||
| 1000 | void FSP_SRV::SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) { | 1026 | void FSP_SRV::SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) { |
| 1001 | IPC::RequestParser rp{ctx}; | 1027 | IPC::RequestParser rp{ctx}; |
| 1002 | log_mode = rp.PopEnum<LogMode>(); | 1028 | log_mode = rp.PopEnum<LogMode>(); |
diff --git a/src/core/hle/service/filesystem/fsp_srv.h b/src/core/hle/service/filesystem/fsp_srv.h index 472286d6e..8ed933279 100644 --- a/src/core/hle/service/filesystem/fsp_srv.h +++ b/src/core/hle/service/filesystem/fsp_srv.h | |||
| @@ -49,6 +49,7 @@ private: | |||
| 49 | void OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx); | 49 | void OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx); |
| 50 | void OpenDataStorageByDataId(Kernel::HLERequestContext& ctx); | 50 | void OpenDataStorageByDataId(Kernel::HLERequestContext& ctx); |
| 51 | void OpenPatchDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx); | 51 | void OpenPatchDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx); |
| 52 | void OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx); | ||
| 52 | void SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx); | 53 | void SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx); |
| 53 | void GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx); | 54 | void GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx); |
| 54 | void OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx); | 55 | void OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx); |