diff options
| author | 2018-07-03 00:26:45 -0400 | |
|---|---|---|
| committer | 2018-07-03 00:26:45 -0400 | |
| commit | 15e68cdbaac38bbf13cd4eb0d70d1e34b2fd4256 (patch) | |
| tree | 9d072a572c0037a44e1e35aeffc242d3772a383c /src/core/file_sys | |
| parent | Merge pull request #612 from bunnei/fix-cull (diff) | |
| parent | Fix build and address review feedback (diff) | |
| download | yuzu-15e68cdbaac38bbf13cd4eb0d70d1e34b2fd4256.tar.gz yuzu-15e68cdbaac38bbf13cd4eb0d70d1e34b2fd4256.tar.xz yuzu-15e68cdbaac38bbf13cd4eb0d70d1e34b2fd4256.zip | |
Merge pull request #607 from jroweboy/logging
Logging - Customizable backends
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/disk_filesystem.cpp | 20 | ||||
| -rw-r--r-- | src/core/file_sys/filesystem.cpp | 6 | ||||
| -rw-r--r-- | src/core/file_sys/partition_filesystem.cpp | 12 | ||||
| -rw-r--r-- | src/core/file_sys/program_metadata.cpp | 38 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_factory.cpp | 6 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_filesystem.cpp | 34 | ||||
| -rw-r--r-- | src/core/file_sys/savedata_factory.cpp | 4 | ||||
| -rw-r--r-- | src/core/file_sys/sdmc_factory.cpp | 4 |
8 files changed, 61 insertions, 63 deletions
diff --git a/src/core/file_sys/disk_filesystem.cpp b/src/core/file_sys/disk_filesystem.cpp index 8aa0e0aa4..8c6f15bb5 100644 --- a/src/core/file_sys/disk_filesystem.cpp +++ b/src/core/file_sys/disk_filesystem.cpp | |||
| @@ -80,19 +80,19 @@ ResultCode Disk_FileSystem::RenameFile(const std::string& src_path, | |||
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | ResultCode Disk_FileSystem::DeleteDirectory(const Path& path) const { | 82 | ResultCode Disk_FileSystem::DeleteDirectory(const Path& path) const { |
| 83 | NGLOG_WARNING(Service_FS, "(STUBBED) called"); | 83 | LOG_WARNING(Service_FS, "(STUBBED) called"); |
| 84 | // TODO(wwylele): Use correct error code | 84 | // TODO(wwylele): Use correct error code |
| 85 | return ResultCode(-1); | 85 | return ResultCode(-1); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | ResultCode Disk_FileSystem::DeleteDirectoryRecursively(const Path& path) const { | 88 | ResultCode Disk_FileSystem::DeleteDirectoryRecursively(const Path& path) const { |
| 89 | NGLOG_WARNING(Service_FS, "(STUBBED) called"); | 89 | LOG_WARNING(Service_FS, "(STUBBED) called"); |
| 90 | // TODO(wwylele): Use correct error code | 90 | // TODO(wwylele): Use correct error code |
| 91 | return ResultCode(-1); | 91 | return ResultCode(-1); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | ResultCode Disk_FileSystem::CreateFile(const std::string& path, u64 size) const { | 94 | ResultCode Disk_FileSystem::CreateFile(const std::string& path, u64 size) const { |
| 95 | NGLOG_WARNING(Service_FS, "(STUBBED) called"); | 95 | LOG_WARNING(Service_FS, "(STUBBED) called"); |
| 96 | 96 | ||
| 97 | std::string full_path = base_directory + path; | 97 | std::string full_path = base_directory + path; |
| 98 | if (size == 0) { | 98 | if (size == 0) { |
| @@ -107,7 +107,7 @@ ResultCode Disk_FileSystem::CreateFile(const std::string& path, u64 size) const | |||
| 107 | return RESULT_SUCCESS; | 107 | return RESULT_SUCCESS; |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | NGLOG_ERROR(Service_FS, "Too large file"); | 110 | LOG_ERROR(Service_FS, "Too large file"); |
| 111 | // TODO(Subv): Find out the correct error code | 111 | // TODO(Subv): Find out the correct error code |
| 112 | return ResultCode(-1); | 112 | return ResultCode(-1); |
| 113 | } | 113 | } |
| @@ -120,13 +120,13 @@ ResultCode Disk_FileSystem::CreateDirectory(const std::string& path) const { | |||
| 120 | return RESULT_SUCCESS; | 120 | return RESULT_SUCCESS; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", full_path); | 123 | LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", full_path); |
| 124 | // TODO(wwylele): Use correct error code | 124 | // TODO(wwylele): Use correct error code |
| 125 | return ResultCode(-1); | 125 | return ResultCode(-1); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | ResultCode Disk_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const { | 128 | ResultCode Disk_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const { |
| 129 | NGLOG_WARNING(Service_FS, "(STUBBED) called"); | 129 | LOG_WARNING(Service_FS, "(STUBBED) called"); |
| 130 | // TODO(wwylele): Use correct error code | 130 | // TODO(wwylele): Use correct error code |
| 131 | return ResultCode(-1); | 131 | return ResultCode(-1); |
| 132 | } | 132 | } |
| @@ -146,7 +146,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> Disk_FileSystem::OpenDirectory( | |||
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | u64 Disk_FileSystem::GetFreeSpaceSize() const { | 148 | u64 Disk_FileSystem::GetFreeSpaceSize() const { |
| 149 | NGLOG_WARNING(Service_FS, "(STUBBED) called"); | 149 | LOG_WARNING(Service_FS, "(STUBBED) called"); |
| 150 | return 0; | 150 | return 0; |
| 151 | } | 151 | } |
| 152 | 152 | ||
| @@ -163,14 +163,14 @@ ResultVal<FileSys::EntryType> Disk_FileSystem::GetEntryType(const std::string& p | |||
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | ResultVal<size_t> Disk_Storage::Read(const u64 offset, const size_t length, u8* buffer) const { | 165 | ResultVal<size_t> Disk_Storage::Read(const u64 offset, const size_t length, u8* buffer) const { |
| 166 | NGLOG_TRACE(Service_FS, "called offset={}, length={}", offset, length); | 166 | LOG_TRACE(Service_FS, "called offset={}, length={}", offset, length); |
| 167 | file->Seek(offset, SEEK_SET); | 167 | file->Seek(offset, SEEK_SET); |
| 168 | return MakeResult<size_t>(file->ReadBytes(buffer, length)); | 168 | return MakeResult<size_t>(file->ReadBytes(buffer, length)); |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | ResultVal<size_t> Disk_Storage::Write(const u64 offset, const size_t length, const bool flush, | 171 | ResultVal<size_t> Disk_Storage::Write(const u64 offset, const size_t length, const bool flush, |
| 172 | const u8* buffer) const { | 172 | const u8* buffer) const { |
| 173 | NGLOG_WARNING(Service_FS, "(STUBBED) called"); | 173 | LOG_WARNING(Service_FS, "(STUBBED) called"); |
| 174 | file->Seek(offset, SEEK_SET); | 174 | file->Seek(offset, SEEK_SET); |
| 175 | size_t written = file->WriteBytes(buffer, length); | 175 | size_t written = file->WriteBytes(buffer, length); |
| 176 | if (flush) { | 176 | if (flush) { |
| @@ -204,7 +204,7 @@ u64 Disk_Directory::Read(const u64 count, Entry* entries) { | |||
| 204 | const std::string& filename = file.virtualName; | 204 | const std::string& filename = file.virtualName; |
| 205 | Entry& entry = entries[entries_read]; | 205 | Entry& entry = entries[entries_read]; |
| 206 | 206 | ||
| 207 | NGLOG_TRACE(Service_FS, "File {}: size={} dir={}", filename, file.size, file.isDirectory); | 207 | LOG_TRACE(Service_FS, "File {}: size={} dir={}", filename, file.size, file.isDirectory); |
| 208 | 208 | ||
| 209 | // TODO(Link Mauve): use a proper conversion to UTF-16. | 209 | // TODO(Link Mauve): use a proper conversion to UTF-16. |
| 210 | for (size_t j = 0; j < FILENAME_LENGTH; ++j) { | 210 | for (size_t j = 0; j < FILENAME_LENGTH; ++j) { |
diff --git a/src/core/file_sys/filesystem.cpp b/src/core/file_sys/filesystem.cpp index 87083878b..82fdb3c46 100644 --- a/src/core/file_sys/filesystem.cpp +++ b/src/core/file_sys/filesystem.cpp | |||
| @@ -71,7 +71,7 @@ std::string Path::AsString() const { | |||
| 71 | case Binary: | 71 | case Binary: |
| 72 | default: | 72 | default: |
| 73 | // TODO(yuriks): Add assert | 73 | // TODO(yuriks): Add assert |
| 74 | NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to string!"); | 74 | LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!"); |
| 75 | return {}; | 75 | return {}; |
| 76 | } | 76 | } |
| 77 | } | 77 | } |
| @@ -87,7 +87,7 @@ std::u16string Path::AsU16Str() const { | |||
| 87 | case Invalid: | 87 | case Invalid: |
| 88 | case Binary: | 88 | case Binary: |
| 89 | // TODO(yuriks): Add assert | 89 | // TODO(yuriks): Add assert |
| 90 | NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!"); | 90 | LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!"); |
| 91 | return {}; | 91 | return {}; |
| 92 | } | 92 | } |
| 93 | 93 | ||
| @@ -115,7 +115,7 @@ std::vector<u8> Path::AsBinary() const { | |||
| 115 | case Invalid: | 115 | case Invalid: |
| 116 | default: | 116 | default: |
| 117 | // TODO(yuriks): Add assert | 117 | // TODO(yuriks): Add assert |
| 118 | NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!"); | 118 | LOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!"); |
| 119 | return {}; | 119 | return {}; |
| 120 | } | 120 | } |
| 121 | } | 121 | } |
diff --git a/src/core/file_sys/partition_filesystem.cpp b/src/core/file_sys/partition_filesystem.cpp index 874b9e23b..46d438aca 100644 --- a/src/core/file_sys/partition_filesystem.cpp +++ b/src/core/file_sys/partition_filesystem.cpp | |||
| @@ -46,7 +46,7 @@ Loader::ResultStatus PartitionFilesystem::Load(const std::string& file_path, siz | |||
| 46 | 46 | ||
| 47 | Loader::ResultStatus result = Load(file_data); | 47 | Loader::ResultStatus result = Load(file_data); |
| 48 | if (result != Loader::ResultStatus::Success) | 48 | if (result != Loader::ResultStatus::Success) |
| 49 | NGLOG_ERROR(Service_FS, "Failed to load PFS from file {}!", file_path); | 49 | LOG_ERROR(Service_FS, "Failed to load PFS from file {}!", file_path); |
| 50 | 50 | ||
| 51 | return result; | 51 | return result; |
| 52 | } | 52 | } |
| @@ -125,12 +125,12 @@ u64 PartitionFilesystem::GetFileSize(const std::string& name) const { | |||
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | void PartitionFilesystem::Print() const { | 127 | void PartitionFilesystem::Print() const { |
| 128 | NGLOG_DEBUG(Service_FS, "Magic: {}", pfs_header.magic); | 128 | LOG_DEBUG(Service_FS, "Magic: {}", pfs_header.magic); |
| 129 | NGLOG_DEBUG(Service_FS, "Files: {}", pfs_header.num_entries); | 129 | LOG_DEBUG(Service_FS, "Files: {}", pfs_header.num_entries); |
| 130 | for (u32 i = 0; i < pfs_header.num_entries; i++) { | 130 | for (u32 i = 0; i < pfs_header.num_entries; i++) { |
| 131 | NGLOG_DEBUG(Service_FS, " > File {}: {} (0x{:X} bytes, at 0x{:X})", i, | 131 | LOG_DEBUG(Service_FS, " > File {}: {} (0x{:X} bytes, at 0x{:X})", i, |
| 132 | pfs_entries[i].name.c_str(), pfs_entries[i].fs_entry.size, | 132 | pfs_entries[i].name.c_str(), pfs_entries[i].fs_entry.size, |
| 133 | GetFileOffset(pfs_entries[i].name)); | 133 | GetFileOffset(pfs_entries[i].name)); |
| 134 | } | 134 | } |
| 135 | } | 135 | } |
| 136 | } // namespace FileSys | 136 | } // namespace FileSys |
diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp index 25a822891..226811115 100644 --- a/src/core/file_sys/program_metadata.cpp +++ b/src/core/file_sys/program_metadata.cpp | |||
| @@ -21,7 +21,7 @@ Loader::ResultStatus ProgramMetadata::Load(const std::string& file_path) { | |||
| 21 | 21 | ||
| 22 | Loader::ResultStatus result = Load(file_data); | 22 | Loader::ResultStatus result = Load(file_data); |
| 23 | if (result != Loader::ResultStatus::Success) | 23 | if (result != Loader::ResultStatus::Success) |
| 24 | NGLOG_ERROR(Service_FS, "Failed to load NPDM from file {}!", file_path); | 24 | LOG_ERROR(Service_FS, "Failed to load NPDM from file {}!", file_path); |
| 25 | 25 | ||
| 26 | return result; | 26 | return result; |
| 27 | } | 27 | } |
| @@ -76,14 +76,14 @@ u64 ProgramMetadata::GetFilesystemPermissions() const { | |||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | void ProgramMetadata::Print() const { | 78 | void ProgramMetadata::Print() const { |
| 79 | NGLOG_DEBUG(Service_FS, "Magic: {:.4}", npdm_header.magic.data()); | 79 | LOG_DEBUG(Service_FS, "Magic: {:.4}", npdm_header.magic.data()); |
| 80 | NGLOG_DEBUG(Service_FS, "Main thread priority: 0x{:02X}", npdm_header.main_thread_priority); | 80 | LOG_DEBUG(Service_FS, "Main thread priority: 0x{:02X}", npdm_header.main_thread_priority); |
| 81 | NGLOG_DEBUG(Service_FS, "Main thread core: {}", npdm_header.main_thread_cpu); | 81 | LOG_DEBUG(Service_FS, "Main thread core: {}", npdm_header.main_thread_cpu); |
| 82 | NGLOG_DEBUG(Service_FS, "Main thread stack size: 0x{:X} bytes", npdm_header.main_stack_size); | 82 | LOG_DEBUG(Service_FS, "Main thread stack size: 0x{:X} bytes", npdm_header.main_stack_size); |
| 83 | NGLOG_DEBUG(Service_FS, "Process category: {}", npdm_header.process_category); | 83 | LOG_DEBUG(Service_FS, "Process category: {}", npdm_header.process_category); |
| 84 | NGLOG_DEBUG(Service_FS, "Flags: 0x{:02X}", npdm_header.flags); | 84 | LOG_DEBUG(Service_FS, "Flags: 0x{:02X}", npdm_header.flags); |
| 85 | NGLOG_DEBUG(Service_FS, " > 64-bit instructions: {}", | 85 | LOG_DEBUG(Service_FS, " > 64-bit instructions: {}", |
| 86 | npdm_header.has_64_bit_instructions ? "YES" : "NO"); | 86 | npdm_header.has_64_bit_instructions ? "YES" : "NO"); |
| 87 | 87 | ||
| 88 | auto address_space = "Unknown"; | 88 | auto address_space = "Unknown"; |
| 89 | switch (npdm_header.address_space_type) { | 89 | switch (npdm_header.address_space_type) { |
| @@ -95,19 +95,19 @@ void ProgramMetadata::Print() const { | |||
| 95 | break; | 95 | break; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | NGLOG_DEBUG(Service_FS, " > Address space: {}\n", address_space); | 98 | LOG_DEBUG(Service_FS, " > Address space: {}\n", address_space); |
| 99 | 99 | ||
| 100 | // Begin ACID printing (potential perms, signed) | 100 | // Begin ACID printing (potential perms, signed) |
| 101 | NGLOG_DEBUG(Service_FS, "Magic: {:.4}", acid_header.magic.data()); | 101 | LOG_DEBUG(Service_FS, "Magic: {:.4}", acid_header.magic.data()); |
| 102 | NGLOG_DEBUG(Service_FS, "Flags: 0x{:02X}", acid_header.flags); | 102 | LOG_DEBUG(Service_FS, "Flags: 0x{:02X}", acid_header.flags); |
| 103 | NGLOG_DEBUG(Service_FS, " > Is Retail: {}", acid_header.is_retail ? "YES" : "NO"); | 103 | LOG_DEBUG(Service_FS, " > Is Retail: {}", acid_header.is_retail ? "YES" : "NO"); |
| 104 | NGLOG_DEBUG(Service_FS, "Title ID Min: 0x{:016X}", acid_header.title_id_min); | 104 | LOG_DEBUG(Service_FS, "Title ID Min: 0x{:016X}", acid_header.title_id_min); |
| 105 | NGLOG_DEBUG(Service_FS, "Title ID Max: 0x{:016X}", acid_header.title_id_max); | 105 | LOG_DEBUG(Service_FS, "Title ID Max: 0x{:016X}", acid_header.title_id_max); |
| 106 | NGLOG_DEBUG(Service_FS, "Filesystem Access: 0x{:016X}\n", acid_file_access.permissions); | 106 | LOG_DEBUG(Service_FS, "Filesystem Access: 0x{:016X}\n", acid_file_access.permissions); |
| 107 | 107 | ||
| 108 | // Begin ACI0 printing (actual perms, unsigned) | 108 | // Begin ACI0 printing (actual perms, unsigned) |
| 109 | NGLOG_DEBUG(Service_FS, "Magic: {:.4}", aci_header.magic.data()); | 109 | LOG_DEBUG(Service_FS, "Magic: {:.4}", aci_header.magic.data()); |
| 110 | NGLOG_DEBUG(Service_FS, "Title ID: 0x{:016X}", aci_header.title_id); | 110 | LOG_DEBUG(Service_FS, "Title ID: 0x{:016X}", aci_header.title_id); |
| 111 | NGLOG_DEBUG(Service_FS, "Filesystem Access: 0x{:016X}\n", aci_file_access.permissions); | 111 | LOG_DEBUG(Service_FS, "Filesystem Access: 0x{:016X}\n", aci_file_access.permissions); |
| 112 | } | 112 | } |
| 113 | } // namespace FileSys | 113 | } // namespace FileSys |
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp index dc7591aca..84ae0d99b 100644 --- a/src/core/file_sys/romfs_factory.cpp +++ b/src/core/file_sys/romfs_factory.cpp | |||
| @@ -14,7 +14,7 @@ namespace FileSys { | |||
| 14 | RomFS_Factory::RomFS_Factory(Loader::AppLoader& app_loader) { | 14 | RomFS_Factory::RomFS_Factory(Loader::AppLoader& app_loader) { |
| 15 | // Load the RomFS from the app | 15 | // Load the RomFS from the app |
| 16 | if (Loader::ResultStatus::Success != app_loader.ReadRomFS(romfs_file, data_offset, data_size)) { | 16 | if (Loader::ResultStatus::Success != app_loader.ReadRomFS(romfs_file, data_offset, data_size)) { |
| 17 | NGLOG_ERROR(Service_FS, "Unable to read RomFS!"); | 17 | LOG_ERROR(Service_FS, "Unable to read RomFS!"); |
| 18 | } | 18 | } |
| 19 | } | 19 | } |
| 20 | 20 | ||
| @@ -24,13 +24,13 @@ ResultVal<std::unique_ptr<FileSystemBackend>> RomFS_Factory::Open(const Path& pa | |||
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | ResultCode RomFS_Factory::Format(const Path& path) { | 26 | ResultCode RomFS_Factory::Format(const Path& path) { |
| 27 | NGLOG_ERROR(Service_FS, "Unimplemented Format archive {}", GetName()); | 27 | LOG_ERROR(Service_FS, "Unimplemented Format archive {}", GetName()); |
| 28 | // TODO(bunnei): Find the right error code for this | 28 | // TODO(bunnei): Find the right error code for this |
| 29 | return ResultCode(-1); | 29 | return ResultCode(-1); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | ResultVal<ArchiveFormatInfo> RomFS_Factory::GetFormatInfo(const Path& path) const { | 32 | ResultVal<ArchiveFormatInfo> RomFS_Factory::GetFormatInfo(const Path& path) const { |
| 33 | NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName()); | 33 | LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName()); |
| 34 | // TODO(bunnei): Find the right error code for this | 34 | // TODO(bunnei): Find the right error code for this |
| 35 | return ResultCode(-1); | 35 | return ResultCode(-1); |
| 36 | } | 36 | } |
diff --git a/src/core/file_sys/romfs_filesystem.cpp b/src/core/file_sys/romfs_filesystem.cpp index 8e2bce687..83162622b 100644 --- a/src/core/file_sys/romfs_filesystem.cpp +++ b/src/core/file_sys/romfs_filesystem.cpp | |||
| @@ -21,72 +21,70 @@ ResultVal<std::unique_ptr<StorageBackend>> RomFS_FileSystem::OpenFile(const std: | |||
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | ResultCode RomFS_FileSystem::DeleteFile(const std::string& path) const { | 23 | ResultCode RomFS_FileSystem::DeleteFile(const std::string& path) const { |
| 24 | NGLOG_CRITICAL(Service_FS, "Attempted to delete a file from an ROMFS archive ({}).", GetName()); | 24 | LOG_CRITICAL(Service_FS, "Attempted to delete a file from an ROMFS archive ({}).", GetName()); |
| 25 | // TODO(bunnei): Use correct error code | 25 | // TODO(bunnei): Use correct error code |
| 26 | return ResultCode(-1); | 26 | return ResultCode(-1); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | ResultCode RomFS_FileSystem::RenameFile(const std::string& src_path, | 29 | ResultCode RomFS_FileSystem::RenameFile(const std::string& src_path, |
| 30 | const std::string& dest_path) const { | 30 | const std::string& dest_path) const { |
| 31 | NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive ({}).", | 31 | LOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive ({}).", GetName()); |
| 32 | GetName()); | ||
| 33 | // TODO(wwylele): Use correct error code | 32 | // TODO(wwylele): Use correct error code |
| 34 | return ResultCode(-1); | 33 | return ResultCode(-1); |
| 35 | } | 34 | } |
| 36 | 35 | ||
| 37 | ResultCode RomFS_FileSystem::DeleteDirectory(const Path& path) const { | 36 | ResultCode RomFS_FileSystem::DeleteDirectory(const Path& path) const { |
| 38 | NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive ({}).", | 37 | LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive ({}).", |
| 39 | GetName()); | 38 | GetName()); |
| 40 | // TODO(wwylele): Use correct error code | 39 | // TODO(wwylele): Use correct error code |
| 41 | return ResultCode(-1); | 40 | return ResultCode(-1); |
| 42 | } | 41 | } |
| 43 | 42 | ||
| 44 | ResultCode RomFS_FileSystem::DeleteDirectoryRecursively(const Path& path) const { | 43 | ResultCode RomFS_FileSystem::DeleteDirectoryRecursively(const Path& path) const { |
| 45 | NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive ({}).", | 44 | LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive ({}).", |
| 46 | GetName()); | 45 | GetName()); |
| 47 | // TODO(wwylele): Use correct error code | 46 | // TODO(wwylele): Use correct error code |
| 48 | return ResultCode(-1); | 47 | return ResultCode(-1); |
| 49 | } | 48 | } |
| 50 | 49 | ||
| 51 | ResultCode RomFS_FileSystem::CreateFile(const std::string& path, u64 size) const { | 50 | ResultCode RomFS_FileSystem::CreateFile(const std::string& path, u64 size) const { |
| 52 | NGLOG_CRITICAL(Service_FS, "Attempted to create a file in an ROMFS archive ({}).", GetName()); | 51 | LOG_CRITICAL(Service_FS, "Attempted to create a file in an ROMFS archive ({}).", GetName()); |
| 53 | // TODO(bunnei): Use correct error code | 52 | // TODO(bunnei): Use correct error code |
| 54 | return ResultCode(-1); | 53 | return ResultCode(-1); |
| 55 | } | 54 | } |
| 56 | 55 | ||
| 57 | ResultCode RomFS_FileSystem::CreateDirectory(const std::string& path) const { | 56 | ResultCode RomFS_FileSystem::CreateDirectory(const std::string& path) const { |
| 58 | NGLOG_CRITICAL(Service_FS, "Attempted to create a directory in an ROMFS archive ({}).", | 57 | LOG_CRITICAL(Service_FS, "Attempted to create a directory in an ROMFS archive ({}).", |
| 59 | GetName()); | 58 | GetName()); |
| 60 | // TODO(wwylele): Use correct error code | 59 | // TODO(wwylele): Use correct error code |
| 61 | return ResultCode(-1); | 60 | return ResultCode(-1); |
| 62 | } | 61 | } |
| 63 | 62 | ||
| 64 | ResultCode RomFS_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const { | 63 | ResultCode RomFS_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const { |
| 65 | NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive ({}).", | 64 | LOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive ({}).", GetName()); |
| 66 | GetName()); | ||
| 67 | // TODO(wwylele): Use correct error code | 65 | // TODO(wwylele): Use correct error code |
| 68 | return ResultCode(-1); | 66 | return ResultCode(-1); |
| 69 | } | 67 | } |
| 70 | 68 | ||
| 71 | ResultVal<std::unique_ptr<DirectoryBackend>> RomFS_FileSystem::OpenDirectory( | 69 | ResultVal<std::unique_ptr<DirectoryBackend>> RomFS_FileSystem::OpenDirectory( |
| 72 | const std::string& path) const { | 70 | const std::string& path) const { |
| 73 | NGLOG_WARNING(Service_FS, "Opening Directory in a ROMFS archive"); | 71 | LOG_WARNING(Service_FS, "Opening Directory in a ROMFS archive"); |
| 74 | return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<ROMFSDirectory>()); | 72 | return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<ROMFSDirectory>()); |
| 75 | } | 73 | } |
| 76 | 74 | ||
| 77 | u64 RomFS_FileSystem::GetFreeSpaceSize() const { | 75 | u64 RomFS_FileSystem::GetFreeSpaceSize() const { |
| 78 | NGLOG_WARNING(Service_FS, "Attempted to get the free space in an ROMFS archive"); | 76 | LOG_WARNING(Service_FS, "Attempted to get the free space in an ROMFS archive"); |
| 79 | return 0; | 77 | return 0; |
| 80 | } | 78 | } |
| 81 | 79 | ||
| 82 | ResultVal<FileSys::EntryType> RomFS_FileSystem::GetEntryType(const std::string& path) const { | 80 | ResultVal<FileSys::EntryType> RomFS_FileSystem::GetEntryType(const std::string& path) const { |
| 83 | NGLOG_CRITICAL(Service_FS, "Called within an ROMFS archive (path {}).", path); | 81 | LOG_CRITICAL(Service_FS, "Called within an ROMFS archive (path {}).", path); |
| 84 | // TODO(wwylele): Use correct error code | 82 | // TODO(wwylele): Use correct error code |
| 85 | return ResultCode(-1); | 83 | return ResultCode(-1); |
| 86 | } | 84 | } |
| 87 | 85 | ||
| 88 | ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8* buffer) const { | 86 | ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8* buffer) const { |
| 89 | NGLOG_TRACE(Service_FS, "called offset={}, length={}", offset, length); | 87 | LOG_TRACE(Service_FS, "called offset={}, length={}", offset, length); |
| 90 | romfs_file->Seek(data_offset + offset, SEEK_SET); | 88 | romfs_file->Seek(data_offset + offset, SEEK_SET); |
| 91 | size_t read_length = (size_t)std::min((u64)length, data_size - offset); | 89 | size_t read_length = (size_t)std::min((u64)length, data_size - offset); |
| 92 | 90 | ||
| @@ -95,7 +93,7 @@ ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8* | |||
| 95 | 93 | ||
| 96 | ResultVal<size_t> RomFS_Storage::Write(const u64 offset, const size_t length, const bool flush, | 94 | ResultVal<size_t> RomFS_Storage::Write(const u64 offset, const size_t length, const bool flush, |
| 97 | const u8* buffer) const { | 95 | const u8* buffer) const { |
| 98 | NGLOG_ERROR(Service_FS, "Attempted to write to ROMFS file"); | 96 | LOG_ERROR(Service_FS, "Attempted to write to ROMFS file"); |
| 99 | // TODO(Subv): Find error code | 97 | // TODO(Subv): Find error code |
| 100 | return MakeResult<size_t>(0); | 98 | return MakeResult<size_t>(0); |
| 101 | } | 99 | } |
| @@ -105,7 +103,7 @@ u64 RomFS_Storage::GetSize() const { | |||
| 105 | } | 103 | } |
| 106 | 104 | ||
| 107 | bool RomFS_Storage::SetSize(const u64 size) const { | 105 | bool RomFS_Storage::SetSize(const u64 size) const { |
| 108 | NGLOG_ERROR(Service_FS, "Attempted to set the size of an ROMFS file"); | 106 | LOG_ERROR(Service_FS, "Attempted to set the size of an ROMFS file"); |
| 109 | return false; | 107 | return false; |
| 110 | } | 108 | } |
| 111 | 109 | ||
diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp index c1be8fee4..d78baf9c3 100644 --- a/src/core/file_sys/savedata_factory.cpp +++ b/src/core/file_sys/savedata_factory.cpp | |||
| @@ -28,7 +28,7 @@ ResultVal<std::unique_ptr<FileSystemBackend>> SaveData_Factory::Open(const Path& | |||
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | ResultCode SaveData_Factory::Format(const Path& path) { | 30 | ResultCode SaveData_Factory::Format(const Path& path) { |
| 31 | NGLOG_WARNING(Service_FS, "Format archive {}", GetName()); | 31 | LOG_WARNING(Service_FS, "Format archive {}", GetName()); |
| 32 | // Create the save data directory. | 32 | // Create the save data directory. |
| 33 | if (!FileUtil::CreateFullPath(GetFullPath())) { | 33 | if (!FileUtil::CreateFullPath(GetFullPath())) { |
| 34 | // TODO(Subv): Find the correct error code. | 34 | // TODO(Subv): Find the correct error code. |
| @@ -39,7 +39,7 @@ ResultCode SaveData_Factory::Format(const Path& path) { | |||
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | ResultVal<ArchiveFormatInfo> SaveData_Factory::GetFormatInfo(const Path& path) const { | 41 | ResultVal<ArchiveFormatInfo> SaveData_Factory::GetFormatInfo(const Path& path) const { |
| 42 | NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName()); | 42 | LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName()); |
| 43 | // TODO(bunnei): Find the right error code for this | 43 | // TODO(bunnei): Find the right error code for this |
| 44 | return ResultCode(-1); | 44 | return ResultCode(-1); |
| 45 | } | 45 | } |
diff --git a/src/core/file_sys/sdmc_factory.cpp b/src/core/file_sys/sdmc_factory.cpp index 59ac3e0be..2e5ffb764 100644 --- a/src/core/file_sys/sdmc_factory.cpp +++ b/src/core/file_sys/sdmc_factory.cpp | |||
| @@ -25,13 +25,13 @@ ResultVal<std::unique_ptr<FileSystemBackend>> SDMC_Factory::Open(const Path& pat | |||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | ResultCode SDMC_Factory::Format(const Path& path) { | 27 | ResultCode SDMC_Factory::Format(const Path& path) { |
| 28 | NGLOG_ERROR(Service_FS, "Unimplemented Format archive {}", GetName()); | 28 | LOG_ERROR(Service_FS, "Unimplemented Format archive {}", GetName()); |
| 29 | // TODO(Subv): Find the right error code for this | 29 | // TODO(Subv): Find the right error code for this |
| 30 | return ResultCode(-1); | 30 | return ResultCode(-1); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | ResultVal<ArchiveFormatInfo> SDMC_Factory::GetFormatInfo(const Path& path) const { | 33 | ResultVal<ArchiveFormatInfo> SDMC_Factory::GetFormatInfo(const Path& path) const { |
| 34 | NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName()); | 34 | LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName()); |
| 35 | // TODO(bunnei): Find the right error code for this | 35 | // TODO(bunnei): Find the right error code for this |
| 36 | return ResultCode(-1); | 36 | return ResultCode(-1); |
| 37 | } | 37 | } |