summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/file_sys/disk_filesystem.cpp21
-rw-r--r--src/core/file_sys/filesystem.cpp6
-rw-r--r--src/core/file_sys/partition_filesystem.cpp3
-rw-r--r--src/core/file_sys/program_metadata.cpp39
-rw-r--r--src/core/file_sys/romfs_factory.cpp6
-rw-r--r--src/core/file_sys/romfs_filesystem.cpp38
-rw-r--r--src/core/file_sys/savedata_factory.cpp9
-rw-r--r--src/core/file_sys/sdmc_factory.cpp5
8 files changed, 59 insertions, 68 deletions
diff --git a/src/core/file_sys/disk_filesystem.cpp b/src/core/file_sys/disk_filesystem.cpp
index 4d00249fa..8aa0e0aa4 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
82ResultCode Disk_FileSystem::DeleteDirectory(const Path& path) const { 82ResultCode Disk_FileSystem::DeleteDirectory(const Path& path) const {
83 LOG_WARNING(Service_FS, "(STUBBED) called"); 83 NGLOG_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
88ResultCode Disk_FileSystem::DeleteDirectoryRecursively(const Path& path) const { 88ResultCode Disk_FileSystem::DeleteDirectoryRecursively(const Path& path) const {
89 LOG_WARNING(Service_FS, "(STUBBED) called"); 89 NGLOG_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
94ResultCode Disk_FileSystem::CreateFile(const std::string& path, u64 size) const { 94ResultCode Disk_FileSystem::CreateFile(const std::string& path, u64 size) const {
95 LOG_WARNING(Service_FS, "(STUBBED) called"); 95 NGLOG_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 LOG_ERROR(Service_FS, "Too large file"); 110 NGLOG_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 LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating %s", full_path.c_str()); 123 NGLOG_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
128ResultCode Disk_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const { 128ResultCode Disk_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const {
129 LOG_WARNING(Service_FS, "(STUBBED) called"); 129 NGLOG_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
148u64 Disk_FileSystem::GetFreeSpaceSize() const { 148u64 Disk_FileSystem::GetFreeSpaceSize() const {
149 LOG_WARNING(Service_FS, "(STUBBED) called"); 149 NGLOG_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
165ResultVal<size_t> Disk_Storage::Read(const u64 offset, const size_t length, u8* buffer) const { 165ResultVal<size_t> Disk_Storage::Read(const u64 offset, const size_t length, u8* buffer) const {
166 LOG_TRACE(Service_FS, "called offset=%llu, length=%zu", offset, length); 166 NGLOG_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
171ResultVal<size_t> Disk_Storage::Write(const u64 offset, const size_t length, const bool flush, 171ResultVal<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 LOG_WARNING(Service_FS, "(STUBBED) called"); 173 NGLOG_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,8 +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 LOG_TRACE(Service_FS, "File %s: size=%llu dir=%d", filename.c_str(), file.size, 207 NGLOG_TRACE(Service_FS, "File {}: size={} dir={}", filename, file.size, file.isDirectory);
208 file.isDirectory);
209 208
210 // TODO(Link Mauve): use a proper conversion to UTF-16. 209 // TODO(Link Mauve): use a proper conversion to UTF-16.
211 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 82fdb3c46..87083878b 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 LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!"); 74 NGLOG_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 LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!"); 90 NGLOG_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 LOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!"); 118 NGLOG_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 4a58a9291..808254ecc 100644
--- a/src/core/file_sys/partition_filesystem.cpp
+++ b/src/core/file_sys/partition_filesystem.cpp
@@ -2,7 +2,6 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cinttypes>
6#include <utility> 5#include <utility>
7#include "common/file_util.h" 6#include "common/file_util.h"
8#include "common/logging/log.h" 7#include "common/logging/log.h"
@@ -40,7 +39,7 @@ Loader::ResultStatus PartitionFilesystem::Load(const std::string& file_path, siz
40 39
41 Loader::ResultStatus result = Load(file_data); 40 Loader::ResultStatus result = Load(file_data);
42 if (result != Loader::ResultStatus::Success) 41 if (result != Loader::ResultStatus::Success)
43 LOG_ERROR(Service_FS, "Failed to load PFS from file %s!", file_path.c_str()); 42 NGLOG_ERROR(Service_FS, "Failed to load PFS from file {}!", file_path);
44 43
45 return result; 44 return result;
46} 45}
diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp
index a6dcebcc3..1f5ded514 100644
--- a/src/core/file_sys/program_metadata.cpp
+++ b/src/core/file_sys/program_metadata.cpp
@@ -2,7 +2,6 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cinttypes>
6#include "common/file_util.h" 5#include "common/file_util.h"
7#include "common/logging/log.h" 6#include "common/logging/log.h"
8#include "core/file_sys/program_metadata.h" 7#include "core/file_sys/program_metadata.h"
@@ -22,7 +21,7 @@ Loader::ResultStatus ProgramMetadata::Load(const std::string& file_path) {
22 21
23 Loader::ResultStatus result = Load(file_data); 22 Loader::ResultStatus result = Load(file_data);
24 if (result != Loader::ResultStatus::Success) 23 if (result != Loader::ResultStatus::Success)
25 LOG_ERROR(Service_FS, "Failed to load NPDM from file %s!", file_path.c_str()); 24 NGLOG_ERROR(Service_FS, "Failed to load NPDM from file {}!", file_path);
26 25
27 return result; 26 return result;
28} 27}
@@ -77,14 +76,14 @@ u64 ProgramMetadata::GetFilesystemPermissions() const {
77} 76}
78 77
79void ProgramMetadata::Print() const { 78void ProgramMetadata::Print() const {
80 LOG_DEBUG(Service_FS, "Magic: %.4s", npdm_header.magic.data()); 79 NGLOG_DEBUG(Service_FS, "Magic: {:.4}", npdm_header.magic.data());
81 LOG_DEBUG(Service_FS, "Main thread priority: 0x%02x", npdm_header.main_thread_priority); 80 NGLOG_DEBUG(Service_FS, "Main thread priority: {:#04X}", npdm_header.main_thread_priority);
82 LOG_DEBUG(Service_FS, "Main thread core: %u", npdm_header.main_thread_cpu); 81 NGLOG_DEBUG(Service_FS, "Main thread core: {}", npdm_header.main_thread_cpu);
83 LOG_DEBUG(Service_FS, "Main thread stack size: 0x%x bytes", npdm_header.main_stack_size); 82 NGLOG_DEBUG(Service_FS, "Main thread stack size: {:#X} bytes", npdm_header.main_stack_size);
84 LOG_DEBUG(Service_FS, "Process category: %u", npdm_header.process_category); 83 NGLOG_DEBUG(Service_FS, "Process category: {}", npdm_header.process_category);
85 LOG_DEBUG(Service_FS, "Flags: %02x", npdm_header.flags); 84 NGLOG_DEBUG(Service_FS, "Flags: {:02X}", npdm_header.flags);
86 LOG_DEBUG(Service_FS, " > 64-bit instructions: %s", 85 NGLOG_DEBUG(Service_FS, " > 64-bit instructions: {}",
87 npdm_header.has_64_bit_instructions ? "YES" : "NO"); 86 npdm_header.has_64_bit_instructions ? "YES" : "NO");
88 87
89 auto address_space = "Unknown"; 88 auto address_space = "Unknown";
90 switch (npdm_header.address_space_type) { 89 switch (npdm_header.address_space_type) {
@@ -96,19 +95,19 @@ void ProgramMetadata::Print() const {
96 break; 95 break;
97 } 96 }
98 97
99 LOG_DEBUG(Service_FS, " > Address space: %s\n", address_space); 98 NGLOG_DEBUG(Service_FS, " > Address space: {}\n", address_space);
100 99
101 // Begin ACID printing (potential perms, signed) 100 // Begin ACID printing (potential perms, signed)
102 LOG_DEBUG(Service_FS, "Magic: %.4s", acid_header.magic.data()); 101 NGLOG_DEBUG(Service_FS, "Magic: {:.4}", acid_header.magic.data());
103 LOG_DEBUG(Service_FS, "Flags: %02x", acid_header.flags); 102 NGLOG_DEBUG(Service_FS, "Flags: {:02X}", acid_header.flags);
104 LOG_DEBUG(Service_FS, " > Is Retail: %s", acid_header.is_retail ? "YES" : "NO"); 103 NGLOG_DEBUG(Service_FS, " > Is Retail: {}", acid_header.is_retail ? "YES" : "NO");
105 LOG_DEBUG(Service_FS, "Title ID Min: %016" PRIX64, acid_header.title_id_min); 104 NGLOG_DEBUG(Service_FS, "Title ID Min: {:016X}", acid_header.title_id_min);
106 LOG_DEBUG(Service_FS, "Title ID Max: %016" PRIX64, acid_header.title_id_max); 105 NGLOG_DEBUG(Service_FS, "Title ID Max: {:016X}", acid_header.title_id_max);
107 LOG_DEBUG(Service_FS, "Filesystem Access: %016" PRIX64 "\n", acid_file_access.permissions); 106 NGLOG_DEBUG(Service_FS, "Filesystem Access: {:016X}\n", acid_file_access.permissions);
108 107
109 // Begin ACI0 printing (actual perms, unsigned) 108 // Begin ACI0 printing (actual perms, unsigned)
110 LOG_DEBUG(Service_FS, "Magic: %.4s", aci_header.magic.data()); 109 NGLOG_DEBUG(Service_FS, "Magic: {:.4}", aci_header.magic.data());
111 LOG_DEBUG(Service_FS, "Title ID: %016" PRIX64, aci_header.title_id); 110 NGLOG_DEBUG(Service_FS, "Title ID: {:016X}", aci_header.title_id);
112 LOG_DEBUG(Service_FS, "Filesystem Access: %016" PRIX64 "\n", aci_file_access.permissions); 111 NGLOG_DEBUG(Service_FS, "Filesystem Access: {:016X}\n", aci_file_access.permissions);
113} 112}
114} // namespace FileSys 113} // namespace FileSys
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp
index b21427948..dc7591aca 100644
--- a/src/core/file_sys/romfs_factory.cpp
+++ b/src/core/file_sys/romfs_factory.cpp
@@ -14,7 +14,7 @@ namespace FileSys {
14RomFS_Factory::RomFS_Factory(Loader::AppLoader& app_loader) { 14RomFS_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 LOG_ERROR(Service_FS, "Unable to read RomFS!"); 17 NGLOG_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
26ResultCode RomFS_Factory::Format(const Path& path) { 26ResultCode RomFS_Factory::Format(const Path& path) {
27 LOG_ERROR(Service_FS, "Unimplemented Format archive %s", GetName().c_str()); 27 NGLOG_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
32ResultVal<ArchiveFormatInfo> RomFS_Factory::GetFormatInfo(const Path& path) const { 32ResultVal<ArchiveFormatInfo> RomFS_Factory::GetFormatInfo(const Path& path) const {
33 LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str()); 33 NGLOG_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 b9982e6fa..8e2bce687 100644
--- a/src/core/file_sys/romfs_filesystem.cpp
+++ b/src/core/file_sys/romfs_filesystem.cpp
@@ -21,74 +21,72 @@ ResultVal<std::unique_ptr<StorageBackend>> RomFS_FileSystem::OpenFile(const std:
21} 21}
22 22
23ResultCode RomFS_FileSystem::DeleteFile(const std::string& path) const { 23ResultCode RomFS_FileSystem::DeleteFile(const std::string& path) const {
24 LOG_CRITICAL(Service_FS, "Attempted to delete a file from an ROMFS archive (%s).", 24 NGLOG_CRITICAL(Service_FS, "Attempted to delete a file from an ROMFS archive ({}).", GetName());
25 GetName().c_str());
26 // TODO(bunnei): Use correct error code 25 // TODO(bunnei): Use correct error code
27 return ResultCode(-1); 26 return ResultCode(-1);
28} 27}
29 28
30ResultCode RomFS_FileSystem::RenameFile(const std::string& src_path, 29ResultCode RomFS_FileSystem::RenameFile(const std::string& src_path,
31 const std::string& dest_path) const { 30 const std::string& dest_path) const {
32 LOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive (%s).", 31 NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive ({}).",
33 GetName().c_str()); 32 GetName());
34 // TODO(wwylele): Use correct error code 33 // TODO(wwylele): Use correct error code
35 return ResultCode(-1); 34 return ResultCode(-1);
36} 35}
37 36
38ResultCode RomFS_FileSystem::DeleteDirectory(const Path& path) const { 37ResultCode RomFS_FileSystem::DeleteDirectory(const Path& path) const {
39 LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive (%s).", 38 NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive ({}).",
40 GetName().c_str()); 39 GetName());
41 // TODO(wwylele): Use correct error code 40 // TODO(wwylele): Use correct error code
42 return ResultCode(-1); 41 return ResultCode(-1);
43} 42}
44 43
45ResultCode RomFS_FileSystem::DeleteDirectoryRecursively(const Path& path) const { 44ResultCode RomFS_FileSystem::DeleteDirectoryRecursively(const Path& path) const {
46 LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive (%s).", 45 NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive ({}).",
47 GetName().c_str()); 46 GetName());
48 // TODO(wwylele): Use correct error code 47 // TODO(wwylele): Use correct error code
49 return ResultCode(-1); 48 return ResultCode(-1);
50} 49}
51 50
52ResultCode RomFS_FileSystem::CreateFile(const std::string& path, u64 size) const { 51ResultCode RomFS_FileSystem::CreateFile(const std::string& path, u64 size) const {
53 LOG_CRITICAL(Service_FS, "Attempted to create a file in an ROMFS archive (%s).", 52 NGLOG_CRITICAL(Service_FS, "Attempted to create a file in an ROMFS archive ({}).", GetName());
54 GetName().c_str());
55 // TODO(bunnei): Use correct error code 53 // TODO(bunnei): Use correct error code
56 return ResultCode(-1); 54 return ResultCode(-1);
57} 55}
58 56
59ResultCode RomFS_FileSystem::CreateDirectory(const std::string& path) const { 57ResultCode RomFS_FileSystem::CreateDirectory(const std::string& path) const {
60 LOG_CRITICAL(Service_FS, "Attempted to create a directory in an ROMFS archive (%s).", 58 NGLOG_CRITICAL(Service_FS, "Attempted to create a directory in an ROMFS archive ({}).",
61 GetName().c_str()); 59 GetName());
62 // TODO(wwylele): Use correct error code 60 // TODO(wwylele): Use correct error code
63 return ResultCode(-1); 61 return ResultCode(-1);
64} 62}
65 63
66ResultCode RomFS_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const { 64ResultCode RomFS_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const {
67 LOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive (%s).", 65 NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive ({}).",
68 GetName().c_str()); 66 GetName());
69 // TODO(wwylele): Use correct error code 67 // TODO(wwylele): Use correct error code
70 return ResultCode(-1); 68 return ResultCode(-1);
71} 69}
72 70
73ResultVal<std::unique_ptr<DirectoryBackend>> RomFS_FileSystem::OpenDirectory( 71ResultVal<std::unique_ptr<DirectoryBackend>> RomFS_FileSystem::OpenDirectory(
74 const std::string& path) const { 72 const std::string& path) const {
75 LOG_WARNING(Service_FS, "Opening Directory in a ROMFS archive"); 73 NGLOG_WARNING(Service_FS, "Opening Directory in a ROMFS archive");
76 return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<ROMFSDirectory>()); 74 return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<ROMFSDirectory>());
77} 75}
78 76
79u64 RomFS_FileSystem::GetFreeSpaceSize() const { 77u64 RomFS_FileSystem::GetFreeSpaceSize() const {
80 LOG_WARNING(Service_FS, "Attempted to get the free space in an ROMFS archive"); 78 NGLOG_WARNING(Service_FS, "Attempted to get the free space in an ROMFS archive");
81 return 0; 79 return 0;
82} 80}
83 81
84ResultVal<FileSys::EntryType> RomFS_FileSystem::GetEntryType(const std::string& path) const { 82ResultVal<FileSys::EntryType> RomFS_FileSystem::GetEntryType(const std::string& path) const {
85 LOG_CRITICAL(Service_FS, "Called within an ROMFS archive (path %s).", path.c_str()); 83 NGLOG_CRITICAL(Service_FS, "Called within an ROMFS archive (path {}).", path);
86 // TODO(wwylele): Use correct error code 84 // TODO(wwylele): Use correct error code
87 return ResultCode(-1); 85 return ResultCode(-1);
88} 86}
89 87
90ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8* buffer) const { 88ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8* buffer) const {
91 LOG_TRACE(Service_FS, "called offset=%llu, length=%zu", offset, length); 89 NGLOG_TRACE(Service_FS, "called offset={}, length={}", offset, length);
92 romfs_file->Seek(data_offset + offset, SEEK_SET); 90 romfs_file->Seek(data_offset + offset, SEEK_SET);
93 size_t read_length = (size_t)std::min((u64)length, data_size - offset); 91 size_t read_length = (size_t)std::min((u64)length, data_size - offset);
94 92
@@ -97,7 +95,7 @@ ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8*
97 95
98ResultVal<size_t> RomFS_Storage::Write(const u64 offset, const size_t length, const bool flush, 96ResultVal<size_t> RomFS_Storage::Write(const u64 offset, const size_t length, const bool flush,
99 const u8* buffer) const { 97 const u8* buffer) const {
100 LOG_ERROR(Service_FS, "Attempted to write to ROMFS file"); 98 NGLOG_ERROR(Service_FS, "Attempted to write to ROMFS file");
101 // TODO(Subv): Find error code 99 // TODO(Subv): Find error code
102 return MakeResult<size_t>(0); 100 return MakeResult<size_t>(0);
103} 101}
@@ -107,7 +105,7 @@ u64 RomFS_Storage::GetSize() const {
107} 105}
108 106
109bool RomFS_Storage::SetSize(const u64 size) const { 107bool RomFS_Storage::SetSize(const u64 size) const {
110 LOG_ERROR(Service_FS, "Attempted to set the size of an ROMFS file"); 108 NGLOG_ERROR(Service_FS, "Attempted to set the size of an ROMFS file");
111 return false; 109 return false;
112} 110}
113 111
diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp
index 14868fed2..c1be8fee4 100644
--- a/src/core/file_sys/savedata_factory.cpp
+++ b/src/core/file_sys/savedata_factory.cpp
@@ -2,11 +2,9 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cinttypes>
6#include <memory> 5#include <memory>
7#include "common/common_types.h" 6#include "common/common_types.h"
8#include "common/logging/log.h" 7#include "common/logging/log.h"
9#include "common/string_util.h"
10#include "core/core.h" 8#include "core/core.h"
11#include "core/file_sys/disk_filesystem.h" 9#include "core/file_sys/disk_filesystem.h"
12#include "core/file_sys/savedata_factory.h" 10#include "core/file_sys/savedata_factory.h"
@@ -30,7 +28,7 @@ ResultVal<std::unique_ptr<FileSystemBackend>> SaveData_Factory::Open(const Path&
30} 28}
31 29
32ResultCode SaveData_Factory::Format(const Path& path) { 30ResultCode SaveData_Factory::Format(const Path& path) {
33 LOG_WARNING(Service_FS, "Format archive %s", GetName().c_str()); 31 NGLOG_WARNING(Service_FS, "Format archive {}", GetName());
34 // Create the save data directory. 32 // Create the save data directory.
35 if (!FileUtil::CreateFullPath(GetFullPath())) { 33 if (!FileUtil::CreateFullPath(GetFullPath())) {
36 // TODO(Subv): Find the correct error code. 34 // TODO(Subv): Find the correct error code.
@@ -41,7 +39,7 @@ ResultCode SaveData_Factory::Format(const Path& path) {
41} 39}
42 40
43ResultVal<ArchiveFormatInfo> SaveData_Factory::GetFormatInfo(const Path& path) const { 41ResultVal<ArchiveFormatInfo> SaveData_Factory::GetFormatInfo(const Path& path) const {
44 LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str()); 42 NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
45 // TODO(bunnei): Find the right error code for this 43 // TODO(bunnei): Find the right error code for this
46 return ResultCode(-1); 44 return ResultCode(-1);
47} 45}
@@ -50,8 +48,7 @@ std::string SaveData_Factory::GetFullPath() const {
50 u64 title_id = Core::CurrentProcess()->program_id; 48 u64 title_id = Core::CurrentProcess()->program_id;
51 // TODO(Subv): Somehow obtain this value. 49 // TODO(Subv): Somehow obtain this value.
52 u32 user = 0; 50 u32 user = 0;
53 return Common::StringFromFormat("%ssave/%016" PRIX64 "/%08X/", nand_directory.c_str(), title_id, 51 return fmt::format("{}save/{:016X}/{:08X}/", nand_directory, title_id, user);
54 user);
55} 52}
56 53
57} // namespace FileSys 54} // namespace FileSys
diff --git a/src/core/file_sys/sdmc_factory.cpp b/src/core/file_sys/sdmc_factory.cpp
index 00e80d2a7..59ac3e0be 100644
--- a/src/core/file_sys/sdmc_factory.cpp
+++ b/src/core/file_sys/sdmc_factory.cpp
@@ -2,7 +2,6 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cinttypes>
6#include <memory> 5#include <memory>
7#include "common/common_types.h" 6#include "common/common_types.h"
8#include "common/logging/log.h" 7#include "common/logging/log.h"
@@ -26,13 +25,13 @@ ResultVal<std::unique_ptr<FileSystemBackend>> SDMC_Factory::Open(const Path& pat
26} 25}
27 26
28ResultCode SDMC_Factory::Format(const Path& path) { 27ResultCode SDMC_Factory::Format(const Path& path) {
29 LOG_ERROR(Service_FS, "Unimplemented Format archive %s", GetName().c_str()); 28 NGLOG_ERROR(Service_FS, "Unimplemented Format archive {}", GetName());
30 // TODO(Subv): Find the right error code for this 29 // TODO(Subv): Find the right error code for this
31 return ResultCode(-1); 30 return ResultCode(-1);
32} 31}
33 32
34ResultVal<ArchiveFormatInfo> SDMC_Factory::GetFormatInfo(const Path& path) const { 33ResultVal<ArchiveFormatInfo> SDMC_Factory::GetFormatInfo(const Path& path) const {
35 LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str()); 34 NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
36 // TODO(bunnei): Find the right error code for this 35 // TODO(bunnei): Find the right error code for this
37 return ResultCode(-1); 36 return ResultCode(-1);
38} 37}