diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/core/file_sys/disk_filesystem.cpp | 21 | ||||
| -rw-r--r-- | src/core/file_sys/filesystem.cpp | 6 | ||||
| -rw-r--r-- | src/core/file_sys/partition_filesystem.cpp | 3 | ||||
| -rw-r--r-- | src/core/file_sys/program_metadata.cpp | 39 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_factory.cpp | 6 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_filesystem.cpp | 38 | ||||
| -rw-r--r-- | src/core/file_sys/savedata_factory.cpp | 9 | ||||
| -rw-r--r-- | src/core/file_sys/sdmc_factory.cpp | 5 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/module.cpp (renamed from src/core/hle/service/pctl/pctl_a.cpp) | 37 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/module.h | 28 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/pctl.cpp | 11 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/pctl.h | 8 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/pctl_a.h | 20 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 2 | ||||
| -rw-r--r-- | src/core/memory.cpp | 50 |
16 files changed, 156 insertions, 131 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index b3807c204..f4be926e4 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -181,10 +181,10 @@ add_library(core STATIC | |||
| 181 | hle/service/nvflinger/buffer_queue.h | 181 | hle/service/nvflinger/buffer_queue.h |
| 182 | hle/service/nvflinger/nvflinger.cpp | 182 | hle/service/nvflinger/nvflinger.cpp |
| 183 | hle/service/nvflinger/nvflinger.h | 183 | hle/service/nvflinger/nvflinger.h |
| 184 | hle/service/pctl/module.cpp | ||
| 185 | hle/service/pctl/module.h | ||
| 184 | hle/service/pctl/pctl.cpp | 186 | hle/service/pctl/pctl.cpp |
| 185 | hle/service/pctl/pctl.h | 187 | hle/service/pctl/pctl.h |
| 186 | hle/service/pctl/pctl_a.cpp | ||
| 187 | hle/service/pctl/pctl_a.h | ||
| 188 | hle/service/service.cpp | 188 | hle/service/service.cpp |
| 189 | hle/service/service.h | 189 | hle/service/service.h |
| 190 | hle/service/set/set.cpp | 190 | hle/service/set/set.cpp |
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 | ||
| 82 | ResultCode Disk_FileSystem::DeleteDirectory(const Path& path) const { | 82 | ResultCode 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 | ||
| 88 | ResultCode Disk_FileSystem::DeleteDirectoryRecursively(const Path& path) const { | 88 | ResultCode 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 | ||
| 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 | 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 | ||
| 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 | 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 | ||
| 148 | u64 Disk_FileSystem::GetFreeSpaceSize() const { | 148 | u64 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 | ||
| 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 | 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 | ||
| 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 | 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 | ||
| 79 | void ProgramMetadata::Print() const { | 78 | void 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 { | |||
| 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 | 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 | ||
| 26 | ResultCode RomFS_Factory::Format(const Path& path) { | 26 | ResultCode 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 | ||
| 32 | ResultVal<ArchiveFormatInfo> RomFS_Factory::GetFormatInfo(const Path& path) const { | 32 | ResultVal<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 | ||
| 23 | ResultCode RomFS_FileSystem::DeleteFile(const std::string& path) const { | 23 | ResultCode 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 | ||
| 30 | ResultCode RomFS_FileSystem::RenameFile(const std::string& src_path, | 29 | ResultCode 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 | ||
| 38 | ResultCode RomFS_FileSystem::DeleteDirectory(const Path& path) const { | 37 | ResultCode 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 | ||
| 45 | ResultCode RomFS_FileSystem::DeleteDirectoryRecursively(const Path& path) const { | 44 | ResultCode 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 | ||
| 52 | ResultCode RomFS_FileSystem::CreateFile(const std::string& path, u64 size) const { | 51 | ResultCode 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 | ||
| 59 | ResultCode RomFS_FileSystem::CreateDirectory(const std::string& path) const { | 57 | ResultCode 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 | ||
| 66 | ResultCode RomFS_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const { | 64 | ResultCode 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 | ||
| 73 | ResultVal<std::unique_ptr<DirectoryBackend>> RomFS_FileSystem::OpenDirectory( | 71 | ResultVal<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 | ||
| 79 | u64 RomFS_FileSystem::GetFreeSpaceSize() const { | 77 | u64 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 | ||
| 84 | ResultVal<FileSys::EntryType> RomFS_FileSystem::GetEntryType(const std::string& path) const { | 82 | ResultVal<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 | ||
| 90 | ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8* buffer) const { | 88 | ResultVal<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 | ||
| 98 | ResultVal<size_t> RomFS_Storage::Write(const u64 offset, const size_t length, const bool flush, | 96 | ResultVal<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 | ||
| 109 | bool RomFS_Storage::SetSize(const u64 size) const { | 107 | bool 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 | ||
| 32 | ResultCode SaveData_Factory::Format(const Path& path) { | 30 | ResultCode 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 | ||
| 43 | ResultVal<ArchiveFormatInfo> SaveData_Factory::GetFormatInfo(const Path& path) const { | 41 | ResultVal<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 | ||
| 28 | ResultCode SDMC_Factory::Format(const Path& path) { | 27 | ResultCode 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 | ||
| 34 | ResultVal<ArchiveFormatInfo> SDMC_Factory::GetFormatInfo(const Path& path) const { | 33 | ResultVal<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 | } |
diff --git a/src/core/hle/service/pctl/pctl_a.cpp b/src/core/hle/service/pctl/module.cpp index 24a6cf310..dd20d5ae7 100644 --- a/src/core/hle/service/pctl/pctl_a.cpp +++ b/src/core/hle/service/pctl/module.cpp | |||
| @@ -4,7 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 6 | #include "core/hle/ipc_helpers.h" | 6 | #include "core/hle/ipc_helpers.h" |
| 7 | #include "core/hle/service/pctl/pctl_a.h" | 7 | #include "core/hle/service/pctl/module.h" |
| 8 | #include "core/hle/service/pctl/pctl.h" | ||
| 8 | 9 | ||
| 9 | namespace Service::PCTL { | 10 | namespace Service::PCTL { |
| 10 | 11 | ||
| @@ -12,7 +13,7 @@ class IParentalControlService final : public ServiceFramework<IParentalControlSe | |||
| 12 | public: | 13 | public: |
| 13 | IParentalControlService() : ServiceFramework("IParentalControlService") { | 14 | IParentalControlService() : ServiceFramework("IParentalControlService") { |
| 14 | static const FunctionInfo functions[] = { | 15 | static const FunctionInfo functions[] = { |
| 15 | {1, nullptr, "Initialize"}, | 16 | {1, &IParentalControlService::Initialize, "Initialize"}, |
| 16 | {1001, nullptr, "CheckFreeCommunicationPermission"}, | 17 | {1001, nullptr, "CheckFreeCommunicationPermission"}, |
| 17 | {1002, nullptr, "ConfirmLaunchApplicationPermission"}, | 18 | {1002, nullptr, "ConfirmLaunchApplicationPermission"}, |
| 18 | {1003, nullptr, "ConfirmResumeApplicationPermission"}, | 19 | {1003, nullptr, "ConfirmResumeApplicationPermission"}, |
| @@ -108,20 +109,38 @@ public: | |||
| 108 | }; | 109 | }; |
| 109 | RegisterHandlers(functions); | 110 | RegisterHandlers(functions); |
| 110 | } | 111 | } |
| 112 | |||
| 113 | private: | ||
| 114 | void Initialize(Kernel::HLERequestContext& ctx) { | ||
| 115 | NGLOG_WARNING(Service_PCTL, "(STUBBED) called"); | ||
| 116 | IPC::ResponseBuilder rb{ctx, 2, 0, 0}; | ||
| 117 | rb.Push(RESULT_SUCCESS); | ||
| 118 | } | ||
| 111 | }; | 119 | }; |
| 112 | void PCTL_A::CreateService(Kernel::HLERequestContext& ctx) { | 120 | |
| 121 | void Module::Interface::CreateService(Kernel::HLERequestContext& ctx) { | ||
| 122 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 123 | rb.Push(RESULT_SUCCESS); | ||
| 124 | rb.PushIpcInterface<IParentalControlService>(); | ||
| 125 | NGLOG_DEBUG(Service_PCTL, "called"); | ||
| 126 | } | ||
| 127 | |||
| 128 | void Module::Interface::CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx) { | ||
| 113 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 129 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 114 | rb.Push(RESULT_SUCCESS); | 130 | rb.Push(RESULT_SUCCESS); |
| 115 | rb.PushIpcInterface<IParentalControlService>(); | 131 | rb.PushIpcInterface<IParentalControlService>(); |
| 116 | NGLOG_DEBUG(Service_PCTL, "called"); | 132 | NGLOG_DEBUG(Service_PCTL, "called"); |
| 117 | } | 133 | } |
| 118 | 134 | ||
| 119 | PCTL_A::PCTL_A() : ServiceFramework("pctl:a") { | 135 | Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) |
| 120 | static const FunctionInfo functions[] = { | 136 | : ServiceFramework(name), module(std::move(module)) {} |
| 121 | {0, &PCTL_A::CreateService, "CreateService"}, | 137 | |
| 122 | {1, nullptr, "CreateServiceWithoutInitialize"}, | 138 | void InstallInterfaces(SM::ServiceManager& service_manager) { |
| 123 | }; | 139 | auto module = std::make_shared<Module>(); |
| 124 | RegisterHandlers(functions); | 140 | std::make_shared<PCTL>(module, "pctl")->InstallAsService(service_manager); |
| 141 | std::make_shared<PCTL>(module, "pctl:a")->InstallAsService(service_manager); | ||
| 142 | std::make_shared<PCTL>(module, "pctl:r")->InstallAsService(service_manager); | ||
| 143 | std::make_shared<PCTL>(module, "pctl:s")->InstallAsService(service_manager); | ||
| 125 | } | 144 | } |
| 126 | 145 | ||
| 127 | } // namespace Service::PCTL | 146 | } // namespace Service::PCTL |
diff --git a/src/core/hle/service/pctl/module.h b/src/core/hle/service/pctl/module.h new file mode 100644 index 000000000..68da628a8 --- /dev/null +++ b/src/core/hle/service/pctl/module.h | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "core/hle/service/service.h" | ||
| 8 | |||
| 9 | namespace Service::PCTL { | ||
| 10 | |||
| 11 | class Module final { | ||
| 12 | public: | ||
| 13 | class Interface : public ServiceFramework<Interface> { | ||
| 14 | public: | ||
| 15 | Interface(std::shared_ptr<Module> module, const char* name); | ||
| 16 | |||
| 17 | void CreateService(Kernel::HLERequestContext& ctx); | ||
| 18 | void CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx); | ||
| 19 | |||
| 20 | protected: | ||
| 21 | std::shared_ptr<Module> module; | ||
| 22 | }; | ||
| 23 | }; | ||
| 24 | |||
| 25 | /// Registers all PCTL services with the specified service manager. | ||
| 26 | void InstallInterfaces(SM::ServiceManager& service_manager); | ||
| 27 | |||
| 28 | } // namespace Service::PCTL | ||
diff --git a/src/core/hle/service/pctl/pctl.cpp b/src/core/hle/service/pctl/pctl.cpp index 6ee81866d..de2741d66 100644 --- a/src/core/hle/service/pctl/pctl.cpp +++ b/src/core/hle/service/pctl/pctl.cpp | |||
| @@ -3,12 +3,15 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/hle/service/pctl/pctl.h" | 5 | #include "core/hle/service/pctl/pctl.h" |
| 6 | #include "core/hle/service/pctl/pctl_a.h" | ||
| 7 | 6 | ||
| 8 | namespace Service::PCTL { | 7 | namespace Service::PCTL { |
| 9 | 8 | ||
| 10 | void InstallInterfaces(SM::ServiceManager& service_manager) { | 9 | PCTL::PCTL(std::shared_ptr<Module> module, const char* name) |
| 11 | std::make_shared<PCTL_A>()->InstallAsService(service_manager); | 10 | : Module::Interface(std::move(module), name) { |
| 11 | static const FunctionInfo functions[] = { | ||
| 12 | {0, &PCTL::CreateService, "CreateService"}, | ||
| 13 | {1, &PCTL::CreateServiceWithoutInitialize, "CreateServiceWithoutInitialize"}, | ||
| 14 | }; | ||
| 15 | RegisterHandlers(functions); | ||
| 12 | } | 16 | } |
| 13 | |||
| 14 | } // namespace Service::PCTL | 17 | } // namespace Service::PCTL |
diff --git a/src/core/hle/service/pctl/pctl.h b/src/core/hle/service/pctl/pctl.h index f0a84b115..8ddf69128 100644 --- a/src/core/hle/service/pctl/pctl.h +++ b/src/core/hle/service/pctl/pctl.h | |||
| @@ -4,11 +4,13 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "core/hle/service/service.h" | 7 | #include "core/hle/service/pctl/module.h" |
| 8 | 8 | ||
| 9 | namespace Service::PCTL { | 9 | namespace Service::PCTL { |
| 10 | 10 | ||
| 11 | /// Registers all PCTL services with the specified service manager. | 11 | class PCTL final : public Module::Interface { |
| 12 | void InstallInterfaces(SM::ServiceManager& service_manager); | 12 | public: |
| 13 | explicit PCTL(std::shared_ptr<Module> module, const char* name); | ||
| 14 | }; | ||
| 13 | 15 | ||
| 14 | } // namespace Service::PCTL | 16 | } // namespace Service::PCTL |
diff --git a/src/core/hle/service/pctl/pctl_a.h b/src/core/hle/service/pctl/pctl_a.h deleted file mode 100644 index 09ed82e1b..000000000 --- a/src/core/hle/service/pctl/pctl_a.h +++ /dev/null | |||
| @@ -1,20 +0,0 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "core/hle/service/service.h" | ||
| 8 | |||
| 9 | namespace Service::PCTL { | ||
| 10 | |||
| 11 | class PCTL_A final : public ServiceFramework<PCTL_A> { | ||
| 12 | public: | ||
| 13 | PCTL_A(); | ||
| 14 | ~PCTL_A() = default; | ||
| 15 | |||
| 16 | private: | ||
| 17 | void CreateService(Kernel::HLERequestContext& ctx); | ||
| 18 | }; | ||
| 19 | |||
| 20 | } // namespace Service::PCTL | ||
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 5817819fe..a85c406be 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | #include "core/hle/service/nifm/nifm.h" | 29 | #include "core/hle/service/nifm/nifm.h" |
| 30 | #include "core/hle/service/ns/ns.h" | 30 | #include "core/hle/service/ns/ns.h" |
| 31 | #include "core/hle/service/nvdrv/nvdrv.h" | 31 | #include "core/hle/service/nvdrv/nvdrv.h" |
| 32 | #include "core/hle/service/pctl/pctl.h" | 32 | #include "core/hle/service/pctl/module.h" |
| 33 | #include "core/hle/service/service.h" | 33 | #include "core/hle/service/service.h" |
| 34 | #include "core/hle/service/set/settings.h" | 34 | #include "core/hle/service/set/settings.h" |
| 35 | #include "core/hle/service/sm/controller.h" | 35 | #include "core/hle/service/sm/controller.h" |
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 9e5d1cd4b..2afa0916d 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp | |||
| @@ -39,8 +39,8 @@ PageTable* GetCurrentPageTable() { | |||
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, PageType type) { | 41 | static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, PageType type) { |
| 42 | LOG_DEBUG(HW_Memory, "Mapping %p onto %016" PRIX64 "-%016" PRIX64, memory, base * PAGE_SIZE, | 42 | NGLOG_DEBUG(HW_Memory, "Mapping {} onto {:016X}-{:016X}", fmt::ptr(memory), base * PAGE_SIZE, |
| 43 | (base + size) * PAGE_SIZE); | 43 | (base + size) * PAGE_SIZE); |
| 44 | 44 | ||
| 45 | RasterizerFlushVirtualRegion(base << PAGE_BITS, size * PAGE_SIZE, | 45 | RasterizerFlushVirtualRegion(base << PAGE_BITS, size * PAGE_SIZE, |
| 46 | FlushMode::FlushAndInvalidate); | 46 | FlushMode::FlushAndInvalidate); |
| @@ -169,10 +169,10 @@ T Read(const VAddr vaddr) { | |||
| 169 | PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; | 169 | PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; |
| 170 | switch (type) { | 170 | switch (type) { |
| 171 | case PageType::Unmapped: | 171 | case PageType::Unmapped: |
| 172 | LOG_ERROR(HW_Memory, "unmapped Read%lu @ 0x%08X", sizeof(T) * 8, vaddr); | 172 | NGLOG_ERROR(HW_Memory, "Unmapped Read{} @ {:#010X}", sizeof(T) * 8, vaddr); |
| 173 | return 0; | 173 | return 0; |
| 174 | case PageType::Memory: | 174 | case PageType::Memory: |
| 175 | ASSERT_MSG(false, "Mapped memory page without a pointer @ %08X", vaddr); | 175 | ASSERT_MSG(false, "Mapped memory page without a pointer @ %016" PRIX64, vaddr); |
| 176 | break; | 176 | break; |
| 177 | case PageType::RasterizerCachedMemory: { | 177 | case PageType::RasterizerCachedMemory: { |
| 178 | RasterizerFlushVirtualRegion(vaddr, sizeof(T), FlushMode::Flush); | 178 | RasterizerFlushVirtualRegion(vaddr, sizeof(T), FlushMode::Flush); |
| @@ -201,11 +201,11 @@ void Write(const VAddr vaddr, const T data) { | |||
| 201 | PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; | 201 | PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; |
| 202 | switch (type) { | 202 | switch (type) { |
| 203 | case PageType::Unmapped: | 203 | case PageType::Unmapped: |
| 204 | LOG_ERROR(HW_Memory, "unmapped Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, | 204 | NGLOG_ERROR(HW_Memory, "Unmapped Write{} {:#010X} @ {:#018X}", sizeof(data) * 8, (u32)data, |
| 205 | vaddr); | 205 | vaddr); |
| 206 | return; | 206 | return; |
| 207 | case PageType::Memory: | 207 | case PageType::Memory: |
| 208 | ASSERT_MSG(false, "Mapped memory page without a pointer @ %08X", vaddr); | 208 | ASSERT_MSG(false, "Mapped memory page without a pointer @ %016" PRIX64, vaddr); |
| 209 | break; | 209 | break; |
| 210 | case PageType::RasterizerCachedMemory: { | 210 | case PageType::RasterizerCachedMemory: { |
| 211 | RasterizerFlushVirtualRegion(vaddr, sizeof(T), FlushMode::Invalidate); | 211 | RasterizerFlushVirtualRegion(vaddr, sizeof(T), FlushMode::Invalidate); |
| @@ -251,7 +251,7 @@ u8* GetPointer(const VAddr vaddr) { | |||
| 251 | return GetPointerFromVMA(vaddr); | 251 | return GetPointerFromVMA(vaddr); |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | LOG_ERROR(HW_Memory, "unknown GetPointer @ 0x%08x", vaddr); | 254 | NGLOG_ERROR(HW_Memory, "Unknown GetPointer @ {:#018X}", vaddr); |
| 255 | return nullptr; | 255 | return nullptr; |
| 256 | } | 256 | } |
| 257 | 257 | ||
| @@ -288,13 +288,12 @@ u8* GetPhysicalPointer(PAddr address) { | |||
| 288 | }); | 288 | }); |
| 289 | 289 | ||
| 290 | if (area == std::end(memory_areas)) { | 290 | if (area == std::end(memory_areas)) { |
| 291 | LOG_ERROR(HW_Memory, "unknown GetPhysicalPointer @ 0x%016" PRIX64, address); | 291 | NGLOG_ERROR(HW_Memory, "Unknown GetPhysicalPointer @ {:#018X}", address); |
| 292 | return nullptr; | 292 | return nullptr; |
| 293 | } | 293 | } |
| 294 | 294 | ||
| 295 | if (area->paddr_base == IO_AREA_PADDR) { | 295 | if (area->paddr_base == IO_AREA_PADDR) { |
| 296 | LOG_ERROR(HW_Memory, "MMIO mappings are not supported yet. phys_addr=0x%016" PRIX64, | 296 | NGLOG_ERROR(HW_Memory, "MMIO mappings are not supported yet. phys_addr={:018X}", address); |
| 297 | address); | ||
| 298 | return nullptr; | 297 | return nullptr; |
| 299 | } | 298 | } |
| 300 | 299 | ||
| @@ -341,9 +340,9 @@ void RasterizerMarkRegionCached(Tegra::GPUVAddr gpu_addr, u64 size, bool cached) | |||
| 341 | Core::System::GetInstance().GPU().memory_manager->GpuToCpuAddress(gpu_addr); | 340 | Core::System::GetInstance().GPU().memory_manager->GpuToCpuAddress(gpu_addr); |
| 342 | // The GPU <-> CPU virtual memory mapping is not 1:1 | 341 | // The GPU <-> CPU virtual memory mapping is not 1:1 |
| 343 | if (!maybe_vaddr) { | 342 | if (!maybe_vaddr) { |
| 344 | LOG_ERROR(HW_Memory, | 343 | NGLOG_ERROR(HW_Memory, |
| 345 | "Trying to flush a cached region to an invalid physical address %08X", | 344 | "Trying to flush a cached region to an invalid physical address {:016X}", |
| 346 | gpu_addr); | 345 | gpu_addr); |
| 347 | continue; | 346 | continue; |
| 348 | } | 347 | } |
| 349 | VAddr vaddr = *maybe_vaddr; | 348 | VAddr vaddr = *maybe_vaddr; |
| @@ -477,8 +476,9 @@ void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_ | |||
| 477 | 476 | ||
| 478 | switch (page_table.attributes[page_index]) { | 477 | switch (page_table.attributes[page_index]) { |
| 479 | case PageType::Unmapped: { | 478 | case PageType::Unmapped: { |
| 480 | LOG_ERROR(HW_Memory, "unmapped ReadBlock @ 0x%08X (start address = 0x%08X, size = %zu)", | 479 | NGLOG_ERROR(HW_Memory, |
| 481 | current_vaddr, src_addr, size); | 480 | "Unmapped ReadBlock @ {:#018X} (start address = {:#018X}, size = {})", |
| 481 | current_vaddr, src_addr, size); | ||
| 482 | std::memset(dest_buffer, 0, copy_amount); | 482 | std::memset(dest_buffer, 0, copy_amount); |
| 483 | break; | 483 | break; |
| 484 | } | 484 | } |
| @@ -540,9 +540,9 @@ void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const voi | |||
| 540 | 540 | ||
| 541 | switch (page_table.attributes[page_index]) { | 541 | switch (page_table.attributes[page_index]) { |
| 542 | case PageType::Unmapped: { | 542 | case PageType::Unmapped: { |
| 543 | LOG_ERROR(HW_Memory, | 543 | NGLOG_ERROR(HW_Memory, |
| 544 | "unmapped WriteBlock @ 0x%08X (start address = 0x%08X, size = %zu)", | 544 | "Unmapped WriteBlock @ {:#018X} (start address = {:#018X}, size = {})", |
| 545 | current_vaddr, dest_addr, size); | 545 | current_vaddr, dest_addr, size); |
| 546 | break; | 546 | break; |
| 547 | } | 547 | } |
| 548 | case PageType::Memory: { | 548 | case PageType::Memory: { |
| @@ -588,8 +588,9 @@ void ZeroBlock(const Kernel::Process& process, const VAddr dest_addr, const size | |||
| 588 | 588 | ||
| 589 | switch (page_table.attributes[page_index]) { | 589 | switch (page_table.attributes[page_index]) { |
| 590 | case PageType::Unmapped: { | 590 | case PageType::Unmapped: { |
| 591 | LOG_ERROR(HW_Memory, "unmapped ZeroBlock @ 0x%08X (start address = 0x%08X, size = %zu)", | 591 | NGLOG_ERROR(HW_Memory, |
| 592 | current_vaddr, dest_addr, size); | 592 | "Unmapped ZeroBlock @ {:#018X} (start address = {#:018X}, size = {})", |
| 593 | current_vaddr, dest_addr, size); | ||
| 593 | break; | 594 | break; |
| 594 | } | 595 | } |
| 595 | case PageType::Memory: { | 596 | case PageType::Memory: { |
| @@ -628,8 +629,9 @@ void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr, | |||
| 628 | 629 | ||
| 629 | switch (page_table.attributes[page_index]) { | 630 | switch (page_table.attributes[page_index]) { |
| 630 | case PageType::Unmapped: { | 631 | case PageType::Unmapped: { |
| 631 | LOG_ERROR(HW_Memory, "unmapped CopyBlock @ 0x%08X (start address = 0x%08X, size = %zu)", | 632 | NGLOG_ERROR(HW_Memory, |
| 632 | current_vaddr, src_addr, size); | 633 | "Unmapped CopyBlock @ {:#018X} (start address = {:#018X}, size = {})", |
| 634 | current_vaddr, src_addr, size); | ||
| 633 | ZeroBlock(process, dest_addr, copy_amount); | 635 | ZeroBlock(process, dest_addr, copy_amount); |
| 634 | break; | 636 | break; |
| 635 | } | 637 | } |
| @@ -682,7 +684,7 @@ boost::optional<PAddr> TryVirtualToPhysicalAddress(const VAddr addr) { | |||
| 682 | PAddr VirtualToPhysicalAddress(const VAddr addr) { | 684 | PAddr VirtualToPhysicalAddress(const VAddr addr) { |
| 683 | auto paddr = TryVirtualToPhysicalAddress(addr); | 685 | auto paddr = TryVirtualToPhysicalAddress(addr); |
| 684 | if (!paddr) { | 686 | if (!paddr) { |
| 685 | LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x%016" PRIX64, addr); | 687 | NGLOG_ERROR(HW_Memory, "Unknown virtual address @ {:#018X}", addr); |
| 686 | // To help with debugging, set bit on address so that it's obviously invalid. | 688 | // To help with debugging, set bit on address so that it's obviously invalid. |
| 687 | return addr | 0x80000000; | 689 | return addr | 0x80000000; |
| 688 | } | 690 | } |