diff options
author | bunnei <bunneidev@gmail.com> | 2021-06-03 00:29:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-03 00:29:09 +0200 |
commit | 4ea171fa5e50723d50b57b26aaaca2fac30eea57 (patch) | |
tree | ef2f0869252f59b0b8aeb62a48e2a233c0f94664 /src/core/hle/service/filesystem | |
parent | Merge pull request #6403 from Kewlan/game-list-for-loop-optimization (diff) | |
parent | general: Replace RESULT_UNKNOWN with ResultUnknown (diff) | |
download | yuzu-4ea171fa5e50723d50b57b26aaaca2fac30eea57.tar yuzu-4ea171fa5e50723d50b57b26aaaca2fac30eea57.tar.gz yuzu-4ea171fa5e50723d50b57b26aaaca2fac30eea57.tar.bz2 yuzu-4ea171fa5e50723d50b57b26aaaca2fac30eea57.tar.lz yuzu-4ea171fa5e50723d50b57b26aaaca2fac30eea57.tar.xz yuzu-4ea171fa5e50723d50b57b26aaaca2fac30eea57.tar.zst yuzu-4ea171fa5e50723d50b57b26aaaca2fac30eea57.zip |
Diffstat (limited to 'src/core/hle/service/filesystem')
-rw-r--r-- | src/core/hle/service/filesystem/filesystem.cpp | 62 | ||||
-rw-r--r-- | src/core/hle/service/filesystem/fsp_srv.cpp | 76 |
2 files changed, 69 insertions, 69 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index 78664439d..4a1908bcb 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp @@ -60,27 +60,27 @@ ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 } const auto entry_type = GetEntryType(path); - if (entry_type.Code() == RESULT_SUCCESS) { + if (entry_type.Code() == ResultSuccess) { return FileSys::ERROR_PATH_ALREADY_EXISTS; } auto file = dir->CreateFile(Common::FS::GetFilename(path)); if (file == nullptr) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } if (!file->Resize(size)) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) const { std::string path(Common::FS::SanitizePath(path_)); if (path.empty()) { // TODO(DarkLordZach): Why do games call this and what should it do? Works as is but... - return RESULT_SUCCESS; + return ResultSuccess; } auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); @@ -89,10 +89,10 @@ ResultCode VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) cons } if (!dir->DeleteFile(Common::FS::GetFilename(path))) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode VfsDirectoryServiceWrapper::CreateDirectory(const std::string& path_) const { @@ -104,9 +104,9 @@ ResultCode VfsDirectoryServiceWrapper::CreateDirectory(const std::string& path_) auto new_dir = dir->CreateSubdirectory(Common::FS::GetFilename(path)); if (new_dir == nullptr) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode VfsDirectoryServiceWrapper::DeleteDirectory(const std::string& path_) const { @@ -114,9 +114,9 @@ ResultCode VfsDirectoryServiceWrapper::DeleteDirectory(const std::string& path_) auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); if (!dir->DeleteSubdirectory(Common::FS::GetFilename(path))) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode VfsDirectoryServiceWrapper::DeleteDirectoryRecursively(const std::string& path_) const { @@ -124,9 +124,9 @@ ResultCode VfsDirectoryServiceWrapper::DeleteDirectoryRecursively(const std::str auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); if (!dir->DeleteSubdirectoryRecursive(Common::FS::GetFilename(path))) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode VfsDirectoryServiceWrapper::CleanDirectoryRecursively(const std::string& path) const { @@ -135,10 +135,10 @@ ResultCode VfsDirectoryServiceWrapper::CleanDirectoryRecursively(const std::stri if (!dir->CleanSubdirectoryRecursive(Common::FS::GetFilename(sanitized_path))) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode VfsDirectoryServiceWrapper::RenameFile(const std::string& src_path_, @@ -152,14 +152,14 @@ ResultCode VfsDirectoryServiceWrapper::RenameFile(const std::string& src_path_, return FileSys::ERROR_PATH_NOT_FOUND; if (!src->Rename(Common::FS::GetFilename(dest_path))) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } // Move by hand -- TODO(DarkLordZach): Optimize auto c_res = CreateFile(dest_path, src->GetSize()); - if (c_res != RESULT_SUCCESS) + if (c_res != ResultSuccess) return c_res; auto dest = backing->GetFileRelative(dest_path); @@ -170,10 +170,10 @@ ResultCode VfsDirectoryServiceWrapper::RenameFile(const std::string& src_path_, if (!src->GetContainingDirectory()->DeleteFile(Common::FS::GetFilename(src_path))) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode VfsDirectoryServiceWrapper::RenameDirectory(const std::string& src_path_, @@ -187,9 +187,9 @@ ResultCode VfsDirectoryServiceWrapper::RenameDirectory(const std::string& src_pa return FileSys::ERROR_PATH_NOT_FOUND; if (!src->Rename(Common::FS::GetFilename(dest_path))) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } // TODO(DarkLordZach): Implement renaming across the tree (move). @@ -199,7 +199,7 @@ ResultCode VfsDirectoryServiceWrapper::RenameDirectory(const std::string& src_pa src_path, dest_path); // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } ResultVal<FileSys::VirtualFile> VfsDirectoryServiceWrapper::OpenFile(const std::string& path_, @@ -258,7 +258,7 @@ FileSystemController::~FileSystemController() = default; ResultCode FileSystemController::RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory) { romfs_factory = std::move(factory); LOG_DEBUG(Service_FS, "Registered RomFS"); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode FileSystemController::RegisterSaveData( @@ -266,21 +266,21 @@ ResultCode FileSystemController::RegisterSaveData( ASSERT_MSG(save_data_factory == nullptr, "Tried to register a second save data"); save_data_factory = std::move(factory); LOG_DEBUG(Service_FS, "Registered save data"); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode FileSystemController::RegisterSDMC(std::unique_ptr<FileSys::SDMCFactory>&& factory) { ASSERT_MSG(sdmc_factory == nullptr, "Tried to register a second SDMC"); sdmc_factory = std::move(factory); LOG_DEBUG(Service_FS, "Registered SDMC"); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode FileSystemController::RegisterBIS(std::unique_ptr<FileSys::BISFactory>&& factory) { ASSERT_MSG(bis_factory == nullptr, "Tried to register a second BIS"); bis_factory = std::move(factory); LOG_DEBUG(Service_FS, "Registered BIS"); - return RESULT_SUCCESS; + return ResultSuccess; } void FileSystemController::SetPackedUpdate(FileSys::VirtualFile update_raw) { @@ -297,7 +297,7 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFSCurrentProcess() if (romfs_factory == nullptr) { // TODO(bunnei): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } return romfs_factory->OpenCurrentProcess(system.CurrentProcess()->GetTitleID()); @@ -309,7 +309,7 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenPatchedRomFS( if (romfs_factory == nullptr) { // TODO: Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } return romfs_factory->OpenPatchedRomFS(title_id, type); @@ -322,7 +322,7 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenPatchedRomFSWithProgra if (romfs_factory == nullptr) { // TODO: Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } return romfs_factory->OpenPatchedRomFSWithProgramIndex(title_id, program_index, type); @@ -335,7 +335,7 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFS( if (romfs_factory == nullptr) { // TODO(bunnei): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } return romfs_factory->Open(title_id, storage_id, type); diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 92ea27074..d9e8020b4 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -100,7 +100,7 @@ private: ctx.WriteBuffer(output); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetSize(Kernel::HLERequestContext& ctx) { @@ -108,7 +108,7 @@ private: LOG_DEBUG(Service_FS, "called, size={}", size); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(size); } }; @@ -162,7 +162,7 @@ private: ctx.WriteBuffer(output); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(static_cast<u64>(output.size())); } @@ -206,7 +206,7 @@ private: written); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Flush(Kernel::HLERequestContext& ctx) { @@ -215,7 +215,7 @@ private: // Exists for SDK compatibiltity -- No need to flush file. IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void SetSize(Kernel::HLERequestContext& ctx) { @@ -226,7 +226,7 @@ private: backend->Resize(size); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetSize(Kernel::HLERequestContext& ctx) { @@ -234,7 +234,7 @@ private: LOG_DEBUG(Service_FS, "called, size={}", size); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(size); } }; @@ -290,7 +290,7 @@ private: ctx.WriteBuffer(begin, range_size); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(actual_entries); } @@ -300,7 +300,7 @@ private: u64 count = entries.size() - next_entry_index; IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(count); } }; @@ -430,7 +430,7 @@ public: auto file = std::make_shared<IFile>(system, result.Unwrap()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IFile>(std::move(file)); } @@ -455,7 +455,7 @@ public: auto directory = std::make_shared<IDirectory>(system, result.Unwrap()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IDirectory>(std::move(directory)); } @@ -473,7 +473,7 @@ public: } IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(static_cast<u32>(*result)); } @@ -481,14 +481,14 @@ public: LOG_WARNING(Service_FS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetFreeSpaceSize(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_FS, "called"); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(size.get_free_size()); } @@ -496,7 +496,7 @@ public: LOG_DEBUG(Service_FS, "called"); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(size.get_total_size()); } @@ -538,7 +538,7 @@ public: ctx.WriteBuffer(begin, range_size); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(static_cast<u32>(actual_entries)); } @@ -796,7 +796,7 @@ void FSP_SRV::SetCurrentProcess(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_FS, "called. current_process_id=0x{:016X}", current_process_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void FSP_SRV::OpenFileSystemWithPatch(Kernel::HLERequestContext& ctx) { @@ -807,7 +807,7 @@ void FSP_SRV::OpenFileSystemWithPatch(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_FS, "(STUBBED) called with type={}, title_id={:016X}", type, title_id); IPC::ResponseBuilder rb{ctx, 2, 0, 0}; - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); } void FSP_SRV::OpenSdCardFileSystem(Kernel::HLERequestContext& ctx) { @@ -818,7 +818,7 @@ void FSP_SRV::OpenSdCardFileSystem(Kernel::HLERequestContext& ctx) { SizeGetter::FromStorageId(fsc, FileSys::StorageId::SdCard)); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IFileSystem>(std::move(filesystem)); } @@ -835,7 +835,7 @@ void FSP_SRV::CreateSaveDataFileSystem(Kernel::HLERequestContext& ctx) { fsc.CreateSaveData(FileSys::SaveDataSpaceId::NandUser, save_struct); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void FSP_SRV::OpenSaveDataFileSystem(Kernel::HLERequestContext& ctx) { @@ -879,7 +879,7 @@ void FSP_SRV::OpenSaveDataFileSystem(Kernel::HLERequestContext& ctx) { SizeGetter::FromStorageId(fsc, id)); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IFileSystem>(std::move(filesystem)); } @@ -894,7 +894,7 @@ void FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId(Kernel::HLERequestContext& LOG_INFO(Service_FS, "called, space={}", space); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISaveDataInfoReader>( std::make_shared<ISaveDataInfoReader>(system, space, fsc)); } @@ -903,7 +903,7 @@ void FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute(Kernel::HLEReq LOG_WARNING(Service_FS, "(STUBBED) called."); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( @@ -929,7 +929,7 @@ void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( parameters.attribute.index); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(flags); } @@ -941,14 +941,14 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) { // TODO (bunnei): Find the right error code to use here LOG_CRITICAL(Service_FS, "no file system interface available!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } auto storage = std::make_shared<IStorage>(system, std::move(current_romfs.Unwrap())); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IStorage>(std::move(storage)); } @@ -968,7 +968,7 @@ void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) { if (archive != nullptr) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface(std::make_shared<IStorage>(system, archive)); return; } @@ -978,7 +978,7 @@ void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) { "could not open data storage with title_id={:016X}, storage_id={:02X}", title_id, storage_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } @@ -988,7 +988,7 @@ void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) { system, pm.PatchRomFS(std::move(data.Unwrap()), 0, FileSys::ContentRecordType::Data)); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IStorage>(std::move(storage)); } @@ -1019,14 +1019,14 @@ void FSP_SRV::OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx) { LOG_ERROR(Service_FS, "could not open storage with program_index={}", program_index); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } auto storage = std::make_shared<IStorage>(system, std::move(patched_romfs.Unwrap())); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IStorage>(std::move(storage)); } @@ -1037,14 +1037,14 @@ void FSP_SRV::SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_FS, "called, log_mode={:08X}", log_mode); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_FS, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(log_mode); } @@ -1058,14 +1058,14 @@ void FSP_SRV::OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx) { reporter.SaveFilesystemAccessReport(log_mode, std::move(log)); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void FSP_SRV::GetProgramIndexForAccessLog(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_FS, "called"); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(AccessLogVersion::Latest); rb.Push(access_log_program_index); } @@ -1088,14 +1088,14 @@ private: LOG_WARNING(Service_FS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Commit(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_FS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } }; @@ -1103,7 +1103,7 @@ void FSP_SRV::OpenMultiCommitManager(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_FS, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IMultiCommitManager>(std::make_shared<IMultiCommitManager>(system)); } |