summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/CMakeLists.txt4
-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
-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.h28
-rw-r--r--src/core/hle/service/pctl/pctl.cpp11
-rw-r--r--src/core/hle/service/pctl/pctl.h8
-rw-r--r--src/core/hle/service/pctl/pctl_a.h20
-rw-r--r--src/core/hle/service/service.cpp2
-rw-r--r--src/core/memory.cpp50
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
hle/service/nvflinger/buffer_queue.h
hle/service/nvflinger/nvflinger.cpp
hle/service/nvflinger/nvflinger.h
+ hle/service/pctl/module.cpp
+ hle/service/pctl/module.h
hle/service/pctl/pctl.cpp
hle/service/pctl/pctl.h
- hle/service/pctl/pctl_a.cpp
- hle/service/pctl/pctl_a.h
hle/service/service.cpp
hle/service/service.h
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,
}
ResultCode Disk_FileSystem::DeleteDirectory(const Path& path) const {
- LOG_WARNING(Service_FS, "(STUBBED) called");
+ NGLOG_WARNING(Service_FS, "(STUBBED) called");
// TODO(wwylele): Use correct error code
return ResultCode(-1);
}
ResultCode Disk_FileSystem::DeleteDirectoryRecursively(const Path& path) const {
- LOG_WARNING(Service_FS, "(STUBBED) called");
+ NGLOG_WARNING(Service_FS, "(STUBBED) called");
// TODO(wwylele): Use correct error code
return ResultCode(-1);
}
ResultCode Disk_FileSystem::CreateFile(const std::string& path, u64 size) const {
- LOG_WARNING(Service_FS, "(STUBBED) called");
+ NGLOG_WARNING(Service_FS, "(STUBBED) called");
std::string full_path = base_directory + path;
if (size == 0) {
@@ -107,7 +107,7 @@ ResultCode Disk_FileSystem::CreateFile(const std::string& path, u64 size) const
return RESULT_SUCCESS;
}
- LOG_ERROR(Service_FS, "Too large file");
+ NGLOG_ERROR(Service_FS, "Too large file");
// TODO(Subv): Find out the correct error code
return ResultCode(-1);
}
@@ -120,13 +120,13 @@ ResultCode Disk_FileSystem::CreateDirectory(const std::string& path) const {
return RESULT_SUCCESS;
}
- LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating %s", full_path.c_str());
+ NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", full_path);
// TODO(wwylele): Use correct error code
return ResultCode(-1);
}
ResultCode Disk_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const {
- LOG_WARNING(Service_FS, "(STUBBED) called");
+ NGLOG_WARNING(Service_FS, "(STUBBED) called");
// TODO(wwylele): Use correct error code
return ResultCode(-1);
}
@@ -146,7 +146,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> Disk_FileSystem::OpenDirectory(
}
u64 Disk_FileSystem::GetFreeSpaceSize() const {
- LOG_WARNING(Service_FS, "(STUBBED) called");
+ NGLOG_WARNING(Service_FS, "(STUBBED) called");
return 0;
}
@@ -163,14 +163,14 @@ ResultVal<FileSys::EntryType> Disk_FileSystem::GetEntryType(const std::string& p
}
ResultVal<size_t> Disk_Storage::Read(const u64 offset, const size_t length, u8* buffer) const {
- LOG_TRACE(Service_FS, "called offset=%llu, length=%zu", offset, length);
+ NGLOG_TRACE(Service_FS, "called offset={}, length={}", offset, length);
file->Seek(offset, SEEK_SET);
return MakeResult<size_t>(file->ReadBytes(buffer, length));
}
ResultVal<size_t> Disk_Storage::Write(const u64 offset, const size_t length, const bool flush,
const u8* buffer) const {
- LOG_WARNING(Service_FS, "(STUBBED) called");
+ NGLOG_WARNING(Service_FS, "(STUBBED) called");
file->Seek(offset, SEEK_SET);
size_t written = file->WriteBytes(buffer, length);
if (flush) {
@@ -204,8 +204,7 @@ u64 Disk_Directory::Read(const u64 count, Entry* entries) {
const std::string& filename = file.virtualName;
Entry& entry = entries[entries_read];
- LOG_TRACE(Service_FS, "File %s: size=%llu dir=%d", filename.c_str(), file.size,
- file.isDirectory);
+ NGLOG_TRACE(Service_FS, "File {}: size={} dir={}", filename, file.size, file.isDirectory);
// TODO(Link Mauve): use a proper conversion to UTF-16.
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 {
case Binary:
default:
// TODO(yuriks): Add assert
- LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!");
+ NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to string!");
return {};
}
}
@@ -87,7 +87,7 @@ std::u16string Path::AsU16Str() const {
case Invalid:
case Binary:
// TODO(yuriks): Add assert
- LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
+ NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
return {};
}
@@ -115,7 +115,7 @@ std::vector<u8> Path::AsBinary() const {
case Invalid:
default:
// TODO(yuriks): Add assert
- LOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!");
+ NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!");
return {};
}
}
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 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include <cinttypes>
#include <utility>
#include "common/file_util.h"
#include "common/logging/log.h"
@@ -40,7 +39,7 @@ Loader::ResultStatus PartitionFilesystem::Load(const std::string& file_path, siz
Loader::ResultStatus result = Load(file_data);
if (result != Loader::ResultStatus::Success)
- LOG_ERROR(Service_FS, "Failed to load PFS from file %s!", file_path.c_str());
+ NGLOG_ERROR(Service_FS, "Failed to load PFS from file {}!", file_path);
return result;
}
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 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include <cinttypes>
#include "common/file_util.h"
#include "common/logging/log.h"
#include "core/file_sys/program_metadata.h"
@@ -22,7 +21,7 @@ Loader::ResultStatus ProgramMetadata::Load(const std::string& file_path) {
Loader::ResultStatus result = Load(file_data);
if (result != Loader::ResultStatus::Success)
- LOG_ERROR(Service_FS, "Failed to load NPDM from file %s!", file_path.c_str());
+ NGLOG_ERROR(Service_FS, "Failed to load NPDM from file {}!", file_path);
return result;
}
@@ -77,14 +76,14 @@ u64 ProgramMetadata::GetFilesystemPermissions() const {
}
void ProgramMetadata::Print() const {
- LOG_DEBUG(Service_FS, "Magic: %.4s", npdm_header.magic.data());
- LOG_DEBUG(Service_FS, "Main thread priority: 0x%02x", npdm_header.main_thread_priority);
- LOG_DEBUG(Service_FS, "Main thread core: %u", npdm_header.main_thread_cpu);
- LOG_DEBUG(Service_FS, "Main thread stack size: 0x%x bytes", npdm_header.main_stack_size);
- LOG_DEBUG(Service_FS, "Process category: %u", npdm_header.process_category);
- LOG_DEBUG(Service_FS, "Flags: %02x", npdm_header.flags);
- LOG_DEBUG(Service_FS, " > 64-bit instructions: %s",
- npdm_header.has_64_bit_instructions ? "YES" : "NO");
+ NGLOG_DEBUG(Service_FS, "Magic: {:.4}", npdm_header.magic.data());
+ NGLOG_DEBUG(Service_FS, "Main thread priority: {:#04X}", npdm_header.main_thread_priority);
+ NGLOG_DEBUG(Service_FS, "Main thread core: {}", npdm_header.main_thread_cpu);
+ NGLOG_DEBUG(Service_FS, "Main thread stack size: {:#X} bytes", npdm_header.main_stack_size);
+ NGLOG_DEBUG(Service_FS, "Process category: {}", npdm_header.process_category);
+ NGLOG_DEBUG(Service_FS, "Flags: {:02X}", npdm_header.flags);
+ NGLOG_DEBUG(Service_FS, " > 64-bit instructions: {}",
+ npdm_header.has_64_bit_instructions ? "YES" : "NO");
auto address_space = "Unknown";
switch (npdm_header.address_space_type) {
@@ -96,19 +95,19 @@ void ProgramMetadata::Print() const {
break;
}
- LOG_DEBUG(Service_FS, " > Address space: %s\n", address_space);
+ NGLOG_DEBUG(Service_FS, " > Address space: {}\n", address_space);
// Begin ACID printing (potential perms, signed)
- LOG_DEBUG(Service_FS, "Magic: %.4s", acid_header.magic.data());
- LOG_DEBUG(Service_FS, "Flags: %02x", acid_header.flags);
- LOG_DEBUG(Service_FS, " > Is Retail: %s", acid_header.is_retail ? "YES" : "NO");
- LOG_DEBUG(Service_FS, "Title ID Min: %016" PRIX64, acid_header.title_id_min);
- LOG_DEBUG(Service_FS, "Title ID Max: %016" PRIX64, acid_header.title_id_max);
- LOG_DEBUG(Service_FS, "Filesystem Access: %016" PRIX64 "\n", acid_file_access.permissions);
+ NGLOG_DEBUG(Service_FS, "Magic: {:.4}", acid_header.magic.data());
+ NGLOG_DEBUG(Service_FS, "Flags: {:02X}", acid_header.flags);
+ NGLOG_DEBUG(Service_FS, " > Is Retail: {}", acid_header.is_retail ? "YES" : "NO");
+ NGLOG_DEBUG(Service_FS, "Title ID Min: {:016X}", acid_header.title_id_min);
+ NGLOG_DEBUG(Service_FS, "Title ID Max: {:016X}", acid_header.title_id_max);
+ NGLOG_DEBUG(Service_FS, "Filesystem Access: {:016X}\n", acid_file_access.permissions);
// Begin ACI0 printing (actual perms, unsigned)
- LOG_DEBUG(Service_FS, "Magic: %.4s", aci_header.magic.data());
- LOG_DEBUG(Service_FS, "Title ID: %016" PRIX64, aci_header.title_id);
- LOG_DEBUG(Service_FS, "Filesystem Access: %016" PRIX64 "\n", aci_file_access.permissions);
+ NGLOG_DEBUG(Service_FS, "Magic: {:.4}", aci_header.magic.data());
+ NGLOG_DEBUG(Service_FS, "Title ID: {:016X}", aci_header.title_id);
+ NGLOG_DEBUG(Service_FS, "Filesystem Access: {:016X}\n", aci_file_access.permissions);
}
} // 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 {
RomFS_Factory::RomFS_Factory(Loader::AppLoader& app_loader) {
// Load the RomFS from the app
if (Loader::ResultStatus::Success != app_loader.ReadRomFS(romfs_file, data_offset, data_size)) {
- LOG_ERROR(Service_FS, "Unable to read RomFS!");
+ NGLOG_ERROR(Service_FS, "Unable to read RomFS!");
}
}
@@ -24,13 +24,13 @@ ResultVal<std::unique_ptr<FileSystemBackend>> RomFS_Factory::Open(const Path& pa
}
ResultCode RomFS_Factory::Format(const Path& path) {
- LOG_ERROR(Service_FS, "Unimplemented Format archive %s", GetName().c_str());
+ NGLOG_ERROR(Service_FS, "Unimplemented Format archive {}", GetName());
// TODO(bunnei): Find the right error code for this
return ResultCode(-1);
}
ResultVal<ArchiveFormatInfo> RomFS_Factory::GetFormatInfo(const Path& path) const {
- LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str());
+ NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
// TODO(bunnei): Find the right error code for this
return ResultCode(-1);
}
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:
}
ResultCode RomFS_FileSystem::DeleteFile(const std::string& path) const {
- LOG_CRITICAL(Service_FS, "Attempted to delete a file from an ROMFS archive (%s).",
- GetName().c_str());
+ NGLOG_CRITICAL(Service_FS, "Attempted to delete a file from an ROMFS archive ({}).", GetName());
// TODO(bunnei): Use correct error code
return ResultCode(-1);
}
ResultCode RomFS_FileSystem::RenameFile(const std::string& src_path,
const std::string& dest_path) const {
- LOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive (%s).",
- GetName().c_str());
+ NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive ({}).",
+ GetName());
// TODO(wwylele): Use correct error code
return ResultCode(-1);
}
ResultCode RomFS_FileSystem::DeleteDirectory(const Path& path) const {
- LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive (%s).",
- GetName().c_str());
+ NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive ({}).",
+ GetName());
// TODO(wwylele): Use correct error code
return ResultCode(-1);
}
ResultCode RomFS_FileSystem::DeleteDirectoryRecursively(const Path& path) const {
- LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive (%s).",
- GetName().c_str());
+ NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive ({}).",
+ GetName());
// TODO(wwylele): Use correct error code
return ResultCode(-1);
}
ResultCode RomFS_FileSystem::CreateFile(const std::string& path, u64 size) const {
- LOG_CRITICAL(Service_FS, "Attempted to create a file in an ROMFS archive (%s).",
- GetName().c_str());
+ NGLOG_CRITICAL(Service_FS, "Attempted to create a file in an ROMFS archive ({}).", GetName());
// TODO(bunnei): Use correct error code
return ResultCode(-1);
}
ResultCode RomFS_FileSystem::CreateDirectory(const std::string& path) const {
- LOG_CRITICAL(Service_FS, "Attempted to create a directory in an ROMFS archive (%s).",
- GetName().c_str());
+ NGLOG_CRITICAL(Service_FS, "Attempted to create a directory in an ROMFS archive ({}).",
+ GetName());
// TODO(wwylele): Use correct error code
return ResultCode(-1);
}
ResultCode RomFS_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const {
- LOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive (%s).",
- GetName().c_str());
+ NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive ({}).",
+ GetName());
// TODO(wwylele): Use correct error code
return ResultCode(-1);
}
ResultVal<std::unique_ptr<DirectoryBackend>> RomFS_FileSystem::OpenDirectory(
const std::string& path) const {
- LOG_WARNING(Service_FS, "Opening Directory in a ROMFS archive");
+ NGLOG_WARNING(Service_FS, "Opening Directory in a ROMFS archive");
return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<ROMFSDirectory>());
}
u64 RomFS_FileSystem::GetFreeSpaceSize() const {
- LOG_WARNING(Service_FS, "Attempted to get the free space in an ROMFS archive");
+ NGLOG_WARNING(Service_FS, "Attempted to get the free space in an ROMFS archive");
return 0;
}
ResultVal<FileSys::EntryType> RomFS_FileSystem::GetEntryType(const std::string& path) const {
- LOG_CRITICAL(Service_FS, "Called within an ROMFS archive (path %s).", path.c_str());
+ NGLOG_CRITICAL(Service_FS, "Called within an ROMFS archive (path {}).", path);
// TODO(wwylele): Use correct error code
return ResultCode(-1);
}
ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8* buffer) const {
- LOG_TRACE(Service_FS, "called offset=%llu, length=%zu", offset, length);
+ NGLOG_TRACE(Service_FS, "called offset={}, length={}", offset, length);
romfs_file->Seek(data_offset + offset, SEEK_SET);
size_t read_length = (size_t)std::min((u64)length, data_size - offset);
@@ -97,7 +95,7 @@ ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8*
ResultVal<size_t> RomFS_Storage::Write(const u64 offset, const size_t length, const bool flush,
const u8* buffer) const {
- LOG_ERROR(Service_FS, "Attempted to write to ROMFS file");
+ NGLOG_ERROR(Service_FS, "Attempted to write to ROMFS file");
// TODO(Subv): Find error code
return MakeResult<size_t>(0);
}
@@ -107,7 +105,7 @@ u64 RomFS_Storage::GetSize() const {
}
bool RomFS_Storage::SetSize(const u64 size) const {
- LOG_ERROR(Service_FS, "Attempted to set the size of an ROMFS file");
+ NGLOG_ERROR(Service_FS, "Attempted to set the size of an ROMFS file");
return false;
}
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 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include <cinttypes>
#include <memory>
#include "common/common_types.h"
#include "common/logging/log.h"
-#include "common/string_util.h"
#include "core/core.h"
#include "core/file_sys/disk_filesystem.h"
#include "core/file_sys/savedata_factory.h"
@@ -30,7 +28,7 @@ ResultVal<std::unique_ptr<FileSystemBackend>> SaveData_Factory::Open(const Path&
}
ResultCode SaveData_Factory::Format(const Path& path) {
- LOG_WARNING(Service_FS, "Format archive %s", GetName().c_str());
+ NGLOG_WARNING(Service_FS, "Format archive {}", GetName());
// Create the save data directory.
if (!FileUtil::CreateFullPath(GetFullPath())) {
// TODO(Subv): Find the correct error code.
@@ -41,7 +39,7 @@ ResultCode SaveData_Factory::Format(const Path& path) {
}
ResultVal<ArchiveFormatInfo> SaveData_Factory::GetFormatInfo(const Path& path) const {
- LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str());
+ NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
// TODO(bunnei): Find the right error code for this
return ResultCode(-1);
}
@@ -50,8 +48,7 @@ std::string SaveData_Factory::GetFullPath() const {
u64 title_id = Core::CurrentProcess()->program_id;
// TODO(Subv): Somehow obtain this value.
u32 user = 0;
- return Common::StringFromFormat("%ssave/%016" PRIX64 "/%08X/", nand_directory.c_str(), title_id,
- user);
+ return fmt::format("{}save/{:016X}/{:08X}/", nand_directory, title_id, user);
}
} // 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 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include <cinttypes>
#include <memory>
#include "common/common_types.h"
#include "common/logging/log.h"
@@ -26,13 +25,13 @@ ResultVal<std::unique_ptr<FileSystemBackend>> SDMC_Factory::Open(const Path& pat
}
ResultCode SDMC_Factory::Format(const Path& path) {
- LOG_ERROR(Service_FS, "Unimplemented Format archive %s", GetName().c_str());
+ NGLOG_ERROR(Service_FS, "Unimplemented Format archive {}", GetName());
// TODO(Subv): Find the right error code for this
return ResultCode(-1);
}
ResultVal<ArchiveFormatInfo> SDMC_Factory::GetFormatInfo(const Path& path) const {
- LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str());
+ NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
// TODO(bunnei): Find the right error code for this
return ResultCode(-1);
}
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 @@
#include "common/logging/log.h"
#include "core/hle/ipc_helpers.h"
-#include "core/hle/service/pctl/pctl_a.h"
+#include "core/hle/service/pctl/module.h"
+#include "core/hle/service/pctl/pctl.h"
namespace Service::PCTL {
@@ -12,7 +13,7 @@ class IParentalControlService final : public ServiceFramework<IParentalControlSe
public:
IParentalControlService() : ServiceFramework("IParentalControlService") {
static const FunctionInfo functions[] = {
- {1, nullptr, "Initialize"},
+ {1, &IParentalControlService::Initialize, "Initialize"},
{1001, nullptr, "CheckFreeCommunicationPermission"},
{1002, nullptr, "ConfirmLaunchApplicationPermission"},
{1003, nullptr, "ConfirmResumeApplicationPermission"},
@@ -108,20 +109,38 @@ public:
};
RegisterHandlers(functions);
}
+
+private:
+ void Initialize(Kernel::HLERequestContext& ctx) {
+ NGLOG_WARNING(Service_PCTL, "(STUBBED) called");
+ IPC::ResponseBuilder rb{ctx, 2, 0, 0};
+ rb.Push(RESULT_SUCCESS);
+ }
};
-void PCTL_A::CreateService(Kernel::HLERequestContext& ctx) {
+
+void Module::Interface::CreateService(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+ rb.Push(RESULT_SUCCESS);
+ rb.PushIpcInterface<IParentalControlService>();
+ NGLOG_DEBUG(Service_PCTL, "called");
+}
+
+void Module::Interface::CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IParentalControlService>();
NGLOG_DEBUG(Service_PCTL, "called");
}
-PCTL_A::PCTL_A() : ServiceFramework("pctl:a") {
- static const FunctionInfo functions[] = {
- {0, &PCTL_A::CreateService, "CreateService"},
- {1, nullptr, "CreateServiceWithoutInitialize"},
- };
- RegisterHandlers(functions);
+Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
+ : ServiceFramework(name), module(std::move(module)) {}
+
+void InstallInterfaces(SM::ServiceManager& service_manager) {
+ auto module = std::make_shared<Module>();
+ std::make_shared<PCTL>(module, "pctl")->InstallAsService(service_manager);
+ std::make_shared<PCTL>(module, "pctl:a")->InstallAsService(service_manager);
+ std::make_shared<PCTL>(module, "pctl:r")->InstallAsService(service_manager);
+ std::make_shared<PCTL>(module, "pctl:s")->InstallAsService(service_manager);
}
} // 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 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "core/hle/service/service.h"
+
+namespace Service::PCTL {
+
+class Module final {
+public:
+ class Interface : public ServiceFramework<Interface> {
+ public:
+ Interface(std::shared_ptr<Module> module, const char* name);
+
+ void CreateService(Kernel::HLERequestContext& ctx);
+ void CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx);
+
+ protected:
+ std::shared_ptr<Module> module;
+ };
+};
+
+/// Registers all PCTL services with the specified service manager.
+void InstallInterfaces(SM::ServiceManager& service_manager);
+
+} // 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 @@
// Refer to the license.txt file included.
#include "core/hle/service/pctl/pctl.h"
-#include "core/hle/service/pctl/pctl_a.h"
namespace Service::PCTL {
-void InstallInterfaces(SM::ServiceManager& service_manager) {
- std::make_shared<PCTL_A>()->InstallAsService(service_manager);
+PCTL::PCTL(std::shared_ptr<Module> module, const char* name)
+ : Module::Interface(std::move(module), name) {
+ static const FunctionInfo functions[] = {
+ {0, &PCTL::CreateService, "CreateService"},
+ {1, &PCTL::CreateServiceWithoutInitialize, "CreateServiceWithoutInitialize"},
+ };
+ RegisterHandlers(functions);
}
-
} // 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 @@
#pragma once
-#include "core/hle/service/service.h"
+#include "core/hle/service/pctl/module.h"
namespace Service::PCTL {
-/// Registers all PCTL services with the specified service manager.
-void InstallInterfaces(SM::ServiceManager& service_manager);
+class PCTL final : public Module::Interface {
+public:
+ explicit PCTL(std::shared_ptr<Module> module, const char* name);
+};
} // 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 @@
-// Copyright 2018 yuzu emulator team
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include "core/hle/service/service.h"
-
-namespace Service::PCTL {
-
-class PCTL_A final : public ServiceFramework<PCTL_A> {
-public:
- PCTL_A();
- ~PCTL_A() = default;
-
-private:
- void CreateService(Kernel::HLERequestContext& ctx);
-};
-
-} // 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 @@
#include "core/hle/service/nifm/nifm.h"
#include "core/hle/service/ns/ns.h"
#include "core/hle/service/nvdrv/nvdrv.h"
-#include "core/hle/service/pctl/pctl.h"
+#include "core/hle/service/pctl/module.h"
#include "core/hle/service/service.h"
#include "core/hle/service/set/settings.h"
#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() {
}
static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, PageType type) {
- LOG_DEBUG(HW_Memory, "Mapping %p onto %016" PRIX64 "-%016" PRIX64, memory, base * PAGE_SIZE,
- (base + size) * PAGE_SIZE);
+ NGLOG_DEBUG(HW_Memory, "Mapping {} onto {:016X}-{:016X}", fmt::ptr(memory), base * PAGE_SIZE,
+ (base + size) * PAGE_SIZE);
RasterizerFlushVirtualRegion(base << PAGE_BITS, size * PAGE_SIZE,
FlushMode::FlushAndInvalidate);
@@ -169,10 +169,10 @@ T Read(const VAddr vaddr) {
PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
switch (type) {
case PageType::Unmapped:
- LOG_ERROR(HW_Memory, "unmapped Read%lu @ 0x%08X", sizeof(T) * 8, vaddr);
+ NGLOG_ERROR(HW_Memory, "Unmapped Read{} @ {:#010X}", sizeof(T) * 8, vaddr);
return 0;
case PageType::Memory:
- ASSERT_MSG(false, "Mapped memory page without a pointer @ %08X", vaddr);
+ ASSERT_MSG(false, "Mapped memory page without a pointer @ %016" PRIX64, vaddr);
break;
case PageType::RasterizerCachedMemory: {
RasterizerFlushVirtualRegion(vaddr, sizeof(T), FlushMode::Flush);
@@ -201,11 +201,11 @@ void Write(const VAddr vaddr, const T data) {
PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
switch (type) {
case PageType::Unmapped:
- LOG_ERROR(HW_Memory, "unmapped Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data,
- vaddr);
+ NGLOG_ERROR(HW_Memory, "Unmapped Write{} {:#010X} @ {:#018X}", sizeof(data) * 8, (u32)data,
+ vaddr);
return;
case PageType::Memory:
- ASSERT_MSG(false, "Mapped memory page without a pointer @ %08X", vaddr);
+ ASSERT_MSG(false, "Mapped memory page without a pointer @ %016" PRIX64, vaddr);
break;
case PageType::RasterizerCachedMemory: {
RasterizerFlushVirtualRegion(vaddr, sizeof(T), FlushMode::Invalidate);
@@ -251,7 +251,7 @@ u8* GetPointer(const VAddr vaddr) {
return GetPointerFromVMA(vaddr);
}
- LOG_ERROR(HW_Memory, "unknown GetPointer @ 0x%08x", vaddr);
+ NGLOG_ERROR(HW_Memory, "Unknown GetPointer @ {:#018X}", vaddr);
return nullptr;
}
@@ -288,13 +288,12 @@ u8* GetPhysicalPointer(PAddr address) {
});
if (area == std::end(memory_areas)) {
- LOG_ERROR(HW_Memory, "unknown GetPhysicalPointer @ 0x%016" PRIX64, address);
+ NGLOG_ERROR(HW_Memory, "Unknown GetPhysicalPointer @ {:#018X}", address);
return nullptr;
}
if (area->paddr_base == IO_AREA_PADDR) {
- LOG_ERROR(HW_Memory, "MMIO mappings are not supported yet. phys_addr=0x%016" PRIX64,
- address);
+ NGLOG_ERROR(HW_Memory, "MMIO mappings are not supported yet. phys_addr={:018X}", address);
return nullptr;
}
@@ -341,9 +340,9 @@ void RasterizerMarkRegionCached(Tegra::GPUVAddr gpu_addr, u64 size, bool cached)
Core::System::GetInstance().GPU().memory_manager->GpuToCpuAddress(gpu_addr);
// The GPU <-> CPU virtual memory mapping is not 1:1
if (!maybe_vaddr) {
- LOG_ERROR(HW_Memory,
- "Trying to flush a cached region to an invalid physical address %08X",
- gpu_addr);
+ NGLOG_ERROR(HW_Memory,
+ "Trying to flush a cached region to an invalid physical address {:016X}",
+ gpu_addr);
continue;
}
VAddr vaddr = *maybe_vaddr;
@@ -477,8 +476,9 @@ void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_
switch (page_table.attributes[page_index]) {
case PageType::Unmapped: {
- LOG_ERROR(HW_Memory, "unmapped ReadBlock @ 0x%08X (start address = 0x%08X, size = %zu)",
- current_vaddr, src_addr, size);
+ NGLOG_ERROR(HW_Memory,
+ "Unmapped ReadBlock @ {:#018X} (start address = {:#018X}, size = {})",
+ current_vaddr, src_addr, size);
std::memset(dest_buffer, 0, copy_amount);
break;
}
@@ -540,9 +540,9 @@ void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const voi
switch (page_table.attributes[page_index]) {
case PageType::Unmapped: {
- LOG_ERROR(HW_Memory,
- "unmapped WriteBlock @ 0x%08X (start address = 0x%08X, size = %zu)",
- current_vaddr, dest_addr, size);
+ NGLOG_ERROR(HW_Memory,
+ "Unmapped WriteBlock @ {:#018X} (start address = {:#018X}, size = {})",
+ current_vaddr, dest_addr, size);
break;
}
case PageType::Memory: {
@@ -588,8 +588,9 @@ void ZeroBlock(const Kernel::Process& process, const VAddr dest_addr, const size
switch (page_table.attributes[page_index]) {
case PageType::Unmapped: {
- LOG_ERROR(HW_Memory, "unmapped ZeroBlock @ 0x%08X (start address = 0x%08X, size = %zu)",
- current_vaddr, dest_addr, size);
+ NGLOG_ERROR(HW_Memory,
+ "Unmapped ZeroBlock @ {:#018X} (start address = {#:018X}, size = {})",
+ current_vaddr, dest_addr, size);
break;
}
case PageType::Memory: {
@@ -628,8 +629,9 @@ void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr,
switch (page_table.attributes[page_index]) {
case PageType::Unmapped: {
- LOG_ERROR(HW_Memory, "unmapped CopyBlock @ 0x%08X (start address = 0x%08X, size = %zu)",
- current_vaddr, src_addr, size);
+ NGLOG_ERROR(HW_Memory,
+ "Unmapped CopyBlock @ {:#018X} (start address = {:#018X}, size = {})",
+ current_vaddr, src_addr, size);
ZeroBlock(process, dest_addr, copy_amount);
break;
}
@@ -682,7 +684,7 @@ boost::optional<PAddr> TryVirtualToPhysicalAddress(const VAddr addr) {
PAddr VirtualToPhysicalAddress(const VAddr addr) {
auto paddr = TryVirtualToPhysicalAddress(addr);
if (!paddr) {
- LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x%016" PRIX64, addr);
+ NGLOG_ERROR(HW_Memory, "Unknown virtual address @ {:#018X}", addr);
// To help with debugging, set bit on address so that it's obviously invalid.
return addr | 0x80000000;
}