yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

Merge pull request #607 from jroweboy/logging

Logging - Customizable backends
This commit is contained in:
bunnei 2018-07-03 00:26:45 -04:00 committed by GitHub
commit 15e68cdbaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
116 changed files with 1261 additions and 887 deletions

View File

@ -30,15 +30,14 @@ __declspec(noinline, noreturn)
#define ASSERT(_a_) \ #define ASSERT(_a_) \
do \ do \
if (!(_a_)) { \ if (!(_a_)) { \
assert_noinline_call([] { NGLOG_CRITICAL(Debug, "Assertion Failed!"); }); \ assert_noinline_call([] { LOG_CRITICAL(Debug, "Assertion Failed!"); }); \
} \ } \
while (0) while (0)
#define ASSERT_MSG(_a_, ...) \ #define ASSERT_MSG(_a_, ...) \
do \ do \
if (!(_a_)) { \ if (!(_a_)) { \
assert_noinline_call( \ assert_noinline_call([&] { LOG_CRITICAL(Debug, "Assertion Failed!\n" __VA_ARGS__); }); \
[&] { NGLOG_CRITICAL(Debug, "Assertion Failed!\n" __VA_ARGS__); }); \
} \ } \
while (0) while (0)

View File

@ -32,12 +32,15 @@
#define SDMC_DIR "sdmc" #define SDMC_DIR "sdmc"
#define NAND_DIR "nand" #define NAND_DIR "nand"
#define SYSDATA_DIR "sysdata" #define SYSDATA_DIR "sysdata"
#define LOG_DIR "log"
// Filenames // Filenames
// Files in the directory returned by GetUserPath(D_CONFIG_IDX) // Files in the directory returned by GetUserPath(D_CONFIG_IDX)
#define EMU_CONFIG "emu.ini" #define EMU_CONFIG "emu.ini"
#define DEBUGGER_CONFIG "debugger.ini" #define DEBUGGER_CONFIG "debugger.ini"
#define LOGGER_CONFIG "logger.ini" #define LOGGER_CONFIG "logger.ini"
// Files in the directory returned by GetUserPath(D_LOGS_IDX)
#define LOG_FILE "citra_log.txt"
// Sys files // Sys files
#define SHARED_FONT "shared_font.bin" #define SHARED_FONT "shared_font.bin"

View File

@ -118,7 +118,7 @@ bool IsDirectory(const std::string& filename) {
#endif #endif
if (result < 0) { if (result < 0) {
NGLOG_DEBUG(Common_Filesystem, "stat failed on {}: {}", filename, GetLastErrorMsg()); LOG_DEBUG(Common_Filesystem, "stat failed on {}: {}", filename, GetLastErrorMsg());
return false; return false;
} }
@ -128,29 +128,29 @@ bool IsDirectory(const std::string& filename) {
// Deletes a given filename, return true on success // Deletes a given filename, return true on success
// Doesn't supports deleting a directory // Doesn't supports deleting a directory
bool Delete(const std::string& filename) { bool Delete(const std::string& filename) {
NGLOG_TRACE(Common_Filesystem, "file {}", filename); LOG_TRACE(Common_Filesystem, "file {}", filename);
// Return true because we care about the file no // Return true because we care about the file no
// being there, not the actual delete. // being there, not the actual delete.
if (!Exists(filename)) { if (!Exists(filename)) {
NGLOG_DEBUG(Common_Filesystem, "{} does not exist", filename); LOG_DEBUG(Common_Filesystem, "{} does not exist", filename);
return true; return true;
} }
// We can't delete a directory // We can't delete a directory
if (IsDirectory(filename)) { if (IsDirectory(filename)) {
NGLOG_ERROR(Common_Filesystem, "Failed: {} is a directory", filename); LOG_ERROR(Common_Filesystem, "Failed: {} is a directory", filename);
return false; return false;
} }
#ifdef _WIN32 #ifdef _WIN32
if (!DeleteFileW(Common::UTF8ToUTF16W(filename).c_str())) { if (!DeleteFileW(Common::UTF8ToUTF16W(filename).c_str())) {
NGLOG_ERROR(Common_Filesystem, "DeleteFile failed on {}: {}", filename, GetLastErrorMsg()); LOG_ERROR(Common_Filesystem, "DeleteFile failed on {}: {}", filename, GetLastErrorMsg());
return false; return false;
} }
#else #else
if (unlink(filename.c_str()) == -1) { if (unlink(filename.c_str()) == -1) {
NGLOG_ERROR(Common_Filesystem, "unlink failed on {}: {}", filename, GetLastErrorMsg()); LOG_ERROR(Common_Filesystem, "unlink failed on {}: {}", filename, GetLastErrorMsg());
return false; return false;
} }
#endif #endif
@ -160,16 +160,16 @@ bool Delete(const std::string& filename) {
// Returns true if successful, or path already exists. // Returns true if successful, or path already exists.
bool CreateDir(const std::string& path) { bool CreateDir(const std::string& path) {
NGLOG_TRACE(Common_Filesystem, "directory {}", path); LOG_TRACE(Common_Filesystem, "directory {}", path);
#ifdef _WIN32 #ifdef _WIN32
if (::CreateDirectoryW(Common::UTF8ToUTF16W(path).c_str(), nullptr)) if (::CreateDirectoryW(Common::UTF8ToUTF16W(path).c_str(), nullptr))
return true; return true;
DWORD error = GetLastError(); DWORD error = GetLastError();
if (error == ERROR_ALREADY_EXISTS) { if (error == ERROR_ALREADY_EXISTS) {
NGLOG_DEBUG(Common_Filesystem, "CreateDirectory failed on {}: already exists", path); LOG_DEBUG(Common_Filesystem, "CreateDirectory failed on {}: already exists", path);
return true; return true;
} }
NGLOG_ERROR(Common_Filesystem, "CreateDirectory failed on {}: {}", path, error); LOG_ERROR(Common_Filesystem, "CreateDirectory failed on {}: {}", path, error);
return false; return false;
#else #else
if (mkdir(path.c_str(), 0755) == 0) if (mkdir(path.c_str(), 0755) == 0)
@ -178,11 +178,11 @@ bool CreateDir(const std::string& path) {
int err = errno; int err = errno;
if (err == EEXIST) { if (err == EEXIST) {
NGLOG_DEBUG(Common_Filesystem, "mkdir failed on {}: already exists", path); LOG_DEBUG(Common_Filesystem, "mkdir failed on {}: already exists", path);
return true; return true;
} }
NGLOG_ERROR(Common_Filesystem, "mkdir failed on {}: {}", path, strerror(err)); LOG_ERROR(Common_Filesystem, "mkdir failed on {}: {}", path, strerror(err));
return false; return false;
#endif #endif
} }
@ -190,10 +190,10 @@ bool CreateDir(const std::string& path) {
// Creates the full path of fullPath returns true on success // Creates the full path of fullPath returns true on success
bool CreateFullPath(const std::string& fullPath) { bool CreateFullPath(const std::string& fullPath) {
int panicCounter = 100; int panicCounter = 100;
NGLOG_TRACE(Common_Filesystem, "path {}", fullPath); LOG_TRACE(Common_Filesystem, "path {}", fullPath);
if (FileUtil::Exists(fullPath)) { if (FileUtil::Exists(fullPath)) {
NGLOG_DEBUG(Common_Filesystem, "path exists {}", fullPath); LOG_DEBUG(Common_Filesystem, "path exists {}", fullPath);
return true; return true;
} }
@ -209,14 +209,14 @@ bool CreateFullPath(const std::string& fullPath) {
// Include the '/' so the first call is CreateDir("/") rather than CreateDir("") // Include the '/' so the first call is CreateDir("/") rather than CreateDir("")
std::string const subPath(fullPath.substr(0, position + 1)); std::string const subPath(fullPath.substr(0, position + 1));
if (!FileUtil::IsDirectory(subPath) && !FileUtil::CreateDir(subPath)) { if (!FileUtil::IsDirectory(subPath) && !FileUtil::CreateDir(subPath)) {
NGLOG_ERROR(Common, "CreateFullPath: directory creation failed"); LOG_ERROR(Common, "CreateFullPath: directory creation failed");
return false; return false;
} }
// A safety check // A safety check
panicCounter--; panicCounter--;
if (panicCounter <= 0) { if (panicCounter <= 0) {
NGLOG_ERROR(Common, "CreateFullPath: directory structure is too deep"); LOG_ERROR(Common, "CreateFullPath: directory structure is too deep");
return false; return false;
} }
position++; position++;
@ -225,11 +225,11 @@ bool CreateFullPath(const std::string& fullPath) {
// Deletes a directory filename, returns true on success // Deletes a directory filename, returns true on success
bool DeleteDir(const std::string& filename) { bool DeleteDir(const std::string& filename) {
NGLOG_TRACE(Common_Filesystem, "directory {}", filename); LOG_TRACE(Common_Filesystem, "directory {}", filename);
// check if a directory // check if a directory
if (!FileUtil::IsDirectory(filename)) { if (!FileUtil::IsDirectory(filename)) {
NGLOG_ERROR(Common_Filesystem, "Not a directory {}", filename); LOG_ERROR(Common_Filesystem, "Not a directory {}", filename);
return false; return false;
} }
@ -240,14 +240,14 @@ bool DeleteDir(const std::string& filename) {
if (rmdir(filename.c_str()) == 0) if (rmdir(filename.c_str()) == 0)
return true; return true;
#endif #endif
NGLOG_ERROR(Common_Filesystem, "failed {}: {}", filename, GetLastErrorMsg()); LOG_ERROR(Common_Filesystem, "failed {}: {}", filename, GetLastErrorMsg());
return false; return false;
} }
// renames file srcFilename to destFilename, returns true on success // renames file srcFilename to destFilename, returns true on success
bool Rename(const std::string& srcFilename, const std::string& destFilename) { bool Rename(const std::string& srcFilename, const std::string& destFilename) {
NGLOG_TRACE(Common_Filesystem, "{} --> {}", srcFilename, destFilename); LOG_TRACE(Common_Filesystem, "{} --> {}", srcFilename, destFilename);
#ifdef _WIN32 #ifdef _WIN32
if (_wrename(Common::UTF8ToUTF16W(srcFilename).c_str(), if (_wrename(Common::UTF8ToUTF16W(srcFilename).c_str(),
Common::UTF8ToUTF16W(destFilename).c_str()) == 0) Common::UTF8ToUTF16W(destFilename).c_str()) == 0)
@ -256,21 +256,21 @@ bool Rename(const std::string& srcFilename, const std::string& destFilename) {
if (rename(srcFilename.c_str(), destFilename.c_str()) == 0) if (rename(srcFilename.c_str(), destFilename.c_str()) == 0)
return true; return true;
#endif #endif
NGLOG_ERROR(Common_Filesystem, "failed {} --> {}: {}", srcFilename, destFilename, LOG_ERROR(Common_Filesystem, "failed {} --> {}: {}", srcFilename, destFilename,
GetLastErrorMsg()); GetLastErrorMsg());
return false; return false;
} }
// copies file srcFilename to destFilename, returns true on success // copies file srcFilename to destFilename, returns true on success
bool Copy(const std::string& srcFilename, const std::string& destFilename) { bool Copy(const std::string& srcFilename, const std::string& destFilename) {
NGLOG_TRACE(Common_Filesystem, "{} --> {}", srcFilename, destFilename); LOG_TRACE(Common_Filesystem, "{} --> {}", srcFilename, destFilename);
#ifdef _WIN32 #ifdef _WIN32
if (CopyFileW(Common::UTF8ToUTF16W(srcFilename).c_str(), if (CopyFileW(Common::UTF8ToUTF16W(srcFilename).c_str(),
Common::UTF8ToUTF16W(destFilename).c_str(), FALSE)) Common::UTF8ToUTF16W(destFilename).c_str(), FALSE))
return true; return true;
NGLOG_ERROR(Common_Filesystem, "failed {} --> {}: {}", srcFilename, destFilename, LOG_ERROR(Common_Filesystem, "failed {} --> {}: {}", srcFilename, destFilename,
GetLastErrorMsg()); GetLastErrorMsg());
return false; return false;
#else #else
@ -282,8 +282,8 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename) {
// Open input file // Open input file
FILE* input = fopen(srcFilename.c_str(), "rb"); FILE* input = fopen(srcFilename.c_str(), "rb");
if (!input) { if (!input) {
NGLOG_ERROR(Common_Filesystem, "opening input failed {} --> {}: {}", srcFilename, LOG_ERROR(Common_Filesystem, "opening input failed {} --> {}: {}", srcFilename,
destFilename, GetLastErrorMsg()); destFilename, GetLastErrorMsg());
return false; return false;
} }
@ -291,8 +291,8 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename) {
FILE* output = fopen(destFilename.c_str(), "wb"); FILE* output = fopen(destFilename.c_str(), "wb");
if (!output) { if (!output) {
fclose(input); fclose(input);
NGLOG_ERROR(Common_Filesystem, "opening output failed {} --> {}: {}", srcFilename, LOG_ERROR(Common_Filesystem, "opening output failed {} --> {}: {}", srcFilename,
destFilename, GetLastErrorMsg()); destFilename, GetLastErrorMsg());
return false; return false;
} }
@ -302,8 +302,8 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename) {
size_t rnum = fread(buffer, sizeof(char), BSIZE, input); size_t rnum = fread(buffer, sizeof(char), BSIZE, input);
if (rnum != BSIZE) { if (rnum != BSIZE) {
if (ferror(input) != 0) { if (ferror(input) != 0) {
NGLOG_ERROR(Common_Filesystem, "failed reading from source, {} --> {}: {}", LOG_ERROR(Common_Filesystem, "failed reading from source, {} --> {}: {}",
srcFilename, destFilename, GetLastErrorMsg()); srcFilename, destFilename, GetLastErrorMsg());
goto bail; goto bail;
} }
} }
@ -311,8 +311,8 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename) {
// write output // write output
size_t wnum = fwrite(buffer, sizeof(char), rnum, output); size_t wnum = fwrite(buffer, sizeof(char), rnum, output);
if (wnum != rnum) { if (wnum != rnum) {
NGLOG_ERROR(Common_Filesystem, "failed writing to output, {} --> {}: {}", srcFilename, LOG_ERROR(Common_Filesystem, "failed writing to output, {} --> {}: {}", srcFilename,
destFilename, GetLastErrorMsg()); destFilename, GetLastErrorMsg());
goto bail; goto bail;
} }
} }
@ -332,12 +332,12 @@ bail:
// Returns the size of filename (64bit) // Returns the size of filename (64bit)
u64 GetSize(const std::string& filename) { u64 GetSize(const std::string& filename) {
if (!Exists(filename)) { if (!Exists(filename)) {
NGLOG_ERROR(Common_Filesystem, "failed {}: No such file", filename); LOG_ERROR(Common_Filesystem, "failed {}: No such file", filename);
return 0; return 0;
} }
if (IsDirectory(filename)) { if (IsDirectory(filename)) {
NGLOG_ERROR(Common_Filesystem, "failed {}: is a directory", filename); LOG_ERROR(Common_Filesystem, "failed {}: is a directory", filename);
return 0; return 0;
} }
@ -348,11 +348,11 @@ u64 GetSize(const std::string& filename) {
if (stat(filename.c_str(), &buf) == 0) if (stat(filename.c_str(), &buf) == 0)
#endif #endif
{ {
NGLOG_TRACE(Common_Filesystem, "{}: {}", filename, buf.st_size); LOG_TRACE(Common_Filesystem, "{}: {}", filename, buf.st_size);
return buf.st_size; return buf.st_size;
} }
NGLOG_ERROR(Common_Filesystem, "Stat failed {}: {}", filename, GetLastErrorMsg()); LOG_ERROR(Common_Filesystem, "Stat failed {}: {}", filename, GetLastErrorMsg());
return 0; return 0;
} }
@ -360,7 +360,7 @@ u64 GetSize(const std::string& filename) {
u64 GetSize(const int fd) { u64 GetSize(const int fd) {
struct stat buf; struct stat buf;
if (fstat(fd, &buf) != 0) { if (fstat(fd, &buf) != 0) {
NGLOG_ERROR(Common_Filesystem, "GetSize: stat failed {}: {}", fd, GetLastErrorMsg()); LOG_ERROR(Common_Filesystem, "GetSize: stat failed {}: {}", fd, GetLastErrorMsg());
return 0; return 0;
} }
return buf.st_size; return buf.st_size;
@ -371,14 +371,12 @@ u64 GetSize(FILE* f) {
// can't use off_t here because it can be 32-bit // can't use off_t here because it can be 32-bit
u64 pos = ftello(f); u64 pos = ftello(f);
if (fseeko(f, 0, SEEK_END) != 0) { if (fseeko(f, 0, SEEK_END) != 0) {
NGLOG_ERROR(Common_Filesystem, "GetSize: seek failed {}: {}", fmt::ptr(f), LOG_ERROR(Common_Filesystem, "GetSize: seek failed {}: {}", fmt::ptr(f), GetLastErrorMsg());
GetLastErrorMsg());
return 0; return 0;
} }
u64 size = ftello(f); u64 size = ftello(f);
if ((size != pos) && (fseeko(f, pos, SEEK_SET) != 0)) { if ((size != pos) && (fseeko(f, pos, SEEK_SET) != 0)) {
NGLOG_ERROR(Common_Filesystem, "GetSize: seek failed {}: {}", fmt::ptr(f), LOG_ERROR(Common_Filesystem, "GetSize: seek failed {}: {}", fmt::ptr(f), GetLastErrorMsg());
GetLastErrorMsg());
return 0; return 0;
} }
return size; return size;
@ -386,10 +384,10 @@ u64 GetSize(FILE* f) {
// creates an empty file filename, returns true on success // creates an empty file filename, returns true on success
bool CreateEmptyFile(const std::string& filename) { bool CreateEmptyFile(const std::string& filename) {
NGLOG_TRACE(Common_Filesystem, "{}", filename); LOG_TRACE(Common_Filesystem, "{}", filename);
if (!FileUtil::IOFile(filename, "wb")) { if (!FileUtil::IOFile(filename, "wb")) {
NGLOG_ERROR(Common_Filesystem, "failed {}: {}", filename, GetLastErrorMsg()); LOG_ERROR(Common_Filesystem, "failed {}: {}", filename, GetLastErrorMsg());
return false; return false;
} }
@ -398,7 +396,7 @@ bool CreateEmptyFile(const std::string& filename) {
bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string& directory, bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string& directory,
DirectoryEntryCallable callback) { DirectoryEntryCallable callback) {
NGLOG_TRACE(Common_Filesystem, "directory {}", directory); LOG_TRACE(Common_Filesystem, "directory {}", directory);
// How many files + directories we found // How many files + directories we found
unsigned found_entries = 0; unsigned found_entries = 0;
@ -556,7 +554,7 @@ std::string GetCurrentDir() {
char* dir; char* dir;
if (!(dir = getcwd(nullptr, 0))) { if (!(dir = getcwd(nullptr, 0))) {
#endif #endif
NGLOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: {}", GetLastErrorMsg()); LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: {}", GetLastErrorMsg());
return nullptr; return nullptr;
} }
#ifdef _WIN32 #ifdef _WIN32
@ -676,7 +674,7 @@ std::string GetSysDirectory() {
#endif #endif
sysDir += DIR_SEP; sysDir += DIR_SEP;
NGLOG_DEBUG(Common_Filesystem, "Setting to {}:", sysDir); LOG_DEBUG(Common_Filesystem, "Setting to {}:", sysDir);
return sysDir; return sysDir;
} }
@ -692,7 +690,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string& new
if (!FileUtil::IsDirectory(paths[D_USER_IDX])) { if (!FileUtil::IsDirectory(paths[D_USER_IDX])) {
paths[D_USER_IDX] = AppDataRoamingDirectory() + DIR_SEP EMU_DATA_DIR DIR_SEP; paths[D_USER_IDX] = AppDataRoamingDirectory() + DIR_SEP EMU_DATA_DIR DIR_SEP;
} else { } else {
NGLOG_INFO(Common_Filesystem, "Using the local user directory"); LOG_INFO(Common_Filesystem, "Using the local user directory");
} }
paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
@ -715,11 +713,13 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string& new
paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP; paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP;
paths[D_NAND_IDX] = paths[D_USER_IDX] + NAND_DIR DIR_SEP; paths[D_NAND_IDX] = paths[D_USER_IDX] + NAND_DIR DIR_SEP;
paths[D_SYSDATA_IDX] = paths[D_USER_IDX] + SYSDATA_DIR DIR_SEP; paths[D_SYSDATA_IDX] = paths[D_USER_IDX] + SYSDATA_DIR DIR_SEP;
// TODO: Put the logs in a better location for each OS
paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOG_DIR DIR_SEP;
} }
if (!newPath.empty()) { if (!newPath.empty()) {
if (!FileUtil::IsDirectory(newPath)) { if (!FileUtil::IsDirectory(newPath)) {
NGLOG_ERROR(Common_Filesystem, "Invalid path specified {}", newPath); LOG_ERROR(Common_Filesystem, "Invalid path specified {}", newPath);
return paths[DirIDX]; return paths[DirIDX];
} else { } else {
paths[DirIDX] = newPath; paths[DirIDX] = newPath;
@ -801,8 +801,8 @@ void SplitFilename83(const std::string& filename, std::array<char, 9>& short_nam
IOFile::IOFile() {} IOFile::IOFile() {}
IOFile::IOFile(const std::string& filename, const char openmode[]) { IOFile::IOFile(const std::string& filename, const char openmode[], int flags) {
Open(filename, openmode); Open(filename, openmode, flags);
} }
IOFile::~IOFile() { IOFile::~IOFile() {
@ -823,11 +823,16 @@ void IOFile::Swap(IOFile& other) noexcept {
std::swap(m_good, other.m_good); std::swap(m_good, other.m_good);
} }
bool IOFile::Open(const std::string& filename, const char openmode[]) { bool IOFile::Open(const std::string& filename, const char openmode[], int flags) {
Close(); Close();
#ifdef _WIN32 #ifdef _WIN32
_wfopen_s(&m_file, Common::UTF8ToUTF16W(filename).c_str(), if (flags != 0) {
Common::UTF8ToUTF16W(openmode).c_str()); m_file = _wfsopen(Common::UTF8ToUTF16W(filename).c_str(),
Common::UTF8ToUTF16W(openmode).c_str(), flags);
} else {
_wfopen_s(&m_file, Common::UTF8ToUTF16W(filename).c_str(),
Common::UTF8ToUTF16W(openmode).c_str());
}
#else #else
m_file = fopen(filename.c_str(), openmode); m_file = fopen(filename.c_str(), openmode);
#endif #endif

View File

@ -156,7 +156,10 @@ void SplitFilename83(const std::string& filename, std::array<char, 9>& short_nam
class IOFile : public NonCopyable { class IOFile : public NonCopyable {
public: public:
IOFile(); IOFile();
IOFile(const std::string& filename, const char openmode[]); // flags is used for windows specific file open mode flags, which
// allows yuzu to open the logs in shared write mode, so that the file
// isn't considered "locked" while yuzu is open and people can open the log file and view it
IOFile(const std::string& filename, const char openmode[], int flags = 0);
~IOFile(); ~IOFile();
@ -165,7 +168,7 @@ public:
void Swap(IOFile& other) noexcept; void Swap(IOFile& other) noexcept;
bool Open(const std::string& filename, const char openmode[]); bool Open(const std::string& filename, const char openmode[], int flags = 0);
bool Close(); bool Close();
template <typename T> template <typename T>
@ -220,6 +223,10 @@ public:
return WriteArray(&object, 1); return WriteArray(&object, 1);
} }
size_t WriteString(const std::string& str) {
return WriteArray(str.c_str(), str.length());
}
bool IsOpen() const { bool IsOpen() const {
return nullptr != m_file; return nullptr != m_file;
} }

View File

@ -2,16 +2,145 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <utility> #include <algorithm>
#include <array>
#include <chrono>
#include <condition_variable>
#include <memory>
#include <thread>
#ifdef _WIN32
#include <share.h> // For _SH_DENYWR
#else
#define _SH_DENYWR 0
#endif
#include "common/assert.h" #include "common/assert.h"
#include "common/common_funcs.h" // snprintf compatibility define
#include "common/logging/backend.h" #include "common/logging/backend.h"
#include "common/logging/filter.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/logging/text_formatter.h" #include "common/logging/text_formatter.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "common/threadsafe_queue.h"
namespace Log { namespace Log {
/**
* Static state as a singleton.
*/
class Impl {
public:
static Impl& Instance() {
static Impl backend;
return backend;
}
Impl(Impl const&) = delete;
const Impl& operator=(Impl const&) = delete;
void PushEntry(Entry e) {
std::lock_guard<std::mutex> lock(message_mutex);
message_queue.Push(std::move(e));
message_cv.notify_one();
}
void AddBackend(std::unique_ptr<Backend> backend) {
std::lock_guard<std::mutex> lock(writing_mutex);
backends.push_back(std::move(backend));
}
void RemoveBackend(const std::string& backend_name) {
std::lock_guard<std::mutex> lock(writing_mutex);
auto it = std::remove_if(backends.begin(), backends.end(), [&backend_name](const auto& i) {
return !strcmp(i->GetName(), backend_name.c_str());
});
backends.erase(it, backends.end());
}
const Filter& GetGlobalFilter() const {
return filter;
}
void SetGlobalFilter(const Filter& f) {
filter = f;
}
Backend* GetBackend(const std::string& backend_name) {
auto it = std::find_if(backends.begin(), backends.end(), [&backend_name](const auto& i) {
return !strcmp(i->GetName(), backend_name.c_str());
});
if (it == backends.end())
return nullptr;
return it->get();
}
private:
Impl() {
backend_thread = std::thread([&] {
Entry entry;
auto write_logs = [&](Entry& e) {
std::lock_guard<std::mutex> lock(writing_mutex);
for (const auto& backend : backends) {
backend->Write(e);
}
};
while (true) {
std::unique_lock<std::mutex> lock(message_mutex);
message_cv.wait(lock, [&] { return !running || message_queue.Pop(entry); });
if (!running) {
break;
}
write_logs(entry);
}
// Drain the logging queue. Only writes out up to MAX_LOGS_TO_WRITE to prevent a case
// where a system is repeatedly spamming logs even on close.
constexpr int MAX_LOGS_TO_WRITE = 100;
int logs_written = 0;
while (logs_written++ < MAX_LOGS_TO_WRITE && message_queue.Pop(entry)) {
write_logs(entry);
}
});
}
~Impl() {
running = false;
message_cv.notify_one();
backend_thread.join();
}
std::atomic_bool running{true};
std::mutex message_mutex, writing_mutex;
std::condition_variable message_cv;
std::thread backend_thread;
std::vector<std::unique_ptr<Backend>> backends;
Common::MPSCQueue<Log::Entry> message_queue;
Filter filter;
};
void ConsoleBackend::Write(const Entry& entry) {
PrintMessage(entry);
}
void ColorConsoleBackend::Write(const Entry& entry) {
PrintColoredMessage(entry);
}
// _SH_DENYWR allows read only access to the file for other programs.
// It is #defined to 0 on other platforms
FileBackend::FileBackend(const std::string& filename)
: file(filename, "w", _SH_DENYWR), bytes_written(0) {}
void FileBackend::Write(const Entry& entry) {
// prevent logs from going over the maximum size (in case its spamming and the user doesn't
// know)
constexpr size_t MAX_BYTES_WRITTEN = 50 * 1024L * 1024L;
if (!file.IsOpen() || bytes_written > MAX_BYTES_WRITTEN) {
return;
}
bytes_written += file.WriteString(FormatLogMessage(entry) + '\n');
if (entry.log_level >= Level::Error) {
file.Flush();
}
}
/// Macro listing all log classes. Code should define CLS and SUB as desired before invoking this. /// Macro listing all log classes. Code should define CLS and SUB as desired before invoking this.
#define ALL_LOG_CLASSES() \ #define ALL_LOG_CLASSES() \
CLS(Log) \ CLS(Log) \
@ -125,20 +254,32 @@ Entry CreateEntry(Class log_class, Level log_level, const char* filename, unsign
return entry; return entry;
} }
static Filter* filter = nullptr; void SetGlobalFilter(const Filter& filter) {
Impl::Instance().SetGlobalFilter(filter);
}
void SetFilter(Filter* new_filter) { void AddBackend(std::unique_ptr<Backend> backend) {
filter = new_filter; Impl::Instance().AddBackend(std::move(backend));
}
void RemoveBackend(const std::string& backend_name) {
Impl::Instance().RemoveBackend(backend_name);
}
Backend* GetBackend(const std::string& backend_name) {
return Impl::Instance().GetBackend(backend_name);
} }
void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename, void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename,
unsigned int line_num, const char* function, const char* format, unsigned int line_num, const char* function, const char* format,
const fmt::format_args& args) { const fmt::format_args& args) {
if (filter && !filter->CheckMessage(log_class, log_level)) auto filter = Impl::Instance().GetGlobalFilter();
if (!filter.CheckMessage(log_class, log_level))
return; return;
Entry entry = Entry entry =
CreateEntry(log_class, log_level, filename, line_num, function, fmt::vformat(format, args)); CreateEntry(log_class, log_level, filename, line_num, function, fmt::vformat(format, args));
PrintColoredMessage(entry); Impl::Instance().PushEntry(std::move(entry));
} }
} // namespace Log } // namespace Log

View File

@ -1,13 +1,15 @@
// Copyright 2014 Citra Emulator Project // Copyright 2014 Citra Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once #pragma once
#include <chrono> #include <chrono>
#include <cstdarg> #include <cstdarg>
#include <memory>
#include <string> #include <string>
#include <utility> #include <utility>
#include "common/file_util.h"
#include "common/logging/filter.h"
#include "common/logging/log.h" #include "common/logging/log.h"
namespace Log { namespace Log {
@ -34,6 +36,80 @@ struct Entry {
Entry& operator=(const Entry& o) = default; Entry& operator=(const Entry& o) = default;
}; };
/**
* Interface for logging backends. As loggers can be created and removed at runtime, this can be
* used by a frontend for adding a custom logging backend as needed
*/
class Backend {
public:
virtual ~Backend() = default;
virtual void SetFilter(const Filter& new_filter) {
filter = new_filter;
}
virtual const char* GetName() const = 0;
virtual void Write(const Entry& entry) = 0;
private:
Filter filter;
};
/**
* Backend that writes to stderr without any color commands
*/
class ConsoleBackend : public Backend {
public:
static const char* Name() {
return "console";
}
const char* GetName() const override {
return Name();
}
void Write(const Entry& entry) override;
};
/**
* Backend that writes to stderr and with color
*/
class ColorConsoleBackend : public Backend {
public:
static const char* Name() {
return "color_console";
}
const char* GetName() const override {
return Name();
}
void Write(const Entry& entry) override;
};
/**
* Backend that writes to a file passed into the constructor
*/
class FileBackend : public Backend {
public:
explicit FileBackend(const std::string& filename);
static const char* Name() {
return "file";
}
const char* GetName() const override {
return Name();
}
void Write(const Entry& entry) override;
private:
FileUtil::IOFile file;
size_t bytes_written;
};
void AddBackend(std::unique_ptr<Backend> backend);
void RemoveBackend(const std::string& backend_name);
Backend* GetBackend(const std::string& backend_name);
/** /**
* Returns the name of the passed log class as a C-string. Subclasses are separated by periods * Returns the name of the passed log class as a C-string. Subclasses are separated by periods
* instead of underscores as in the enumeration. * instead of underscores as in the enumeration.
@ -49,5 +125,10 @@ const char* GetLevelName(Level log_level);
Entry CreateEntry(Class log_class, Level log_level, const char* filename, unsigned int line_nr, Entry CreateEntry(Class log_class, Level log_level, const char* filename, unsigned int line_nr,
const char* function, std::string message); const char* function, std::string message);
void SetFilter(Filter* filter); /**
} // namespace Log * The global filter will prevent any messages from even being processed if they are filtered. Each
* backend can have a filter, but if the level is lower than the global filter, the backend will
* never get the message
*/
void SetGlobalFilter(const Filter& filter);
} // namespace Log

View File

@ -65,14 +65,14 @@ bool Filter::ParseFilterRule(const std::string::const_iterator begin,
const std::string::const_iterator end) { const std::string::const_iterator end) {
auto level_separator = std::find(begin, end, ':'); auto level_separator = std::find(begin, end, ':');
if (level_separator == end) { if (level_separator == end) {
NGLOG_ERROR(Log, "Invalid log filter. Must specify a log level after `:`: %s", LOG_ERROR(Log, "Invalid log filter. Must specify a log level after `:`: {}",
std::string(begin, end).c_str()); std::string(begin, end));
return false; return false;
} }
const Level level = GetLevelByName(level_separator + 1, end); const Level level = GetLevelByName(level_separator + 1, end);
if (level == Level::Count) { if (level == Level::Count) {
NGLOG_ERROR(Log, "Unknown log level in filter: %s", std::string(begin, end).c_str()); LOG_ERROR(Log, "Unknown log level in filter: {}", std::string(begin, end));
return false; return false;
} }
@ -83,7 +83,7 @@ bool Filter::ParseFilterRule(const std::string::const_iterator begin,
const Class log_class = GetClassByName(begin, level_separator); const Class log_class = GetClassByName(begin, level_separator);
if (log_class == Class::Count) { if (log_class == Class::Count) {
NGLOG_ERROR(Log, "Unknown log class in filter: %s", std::string(begin, end).c_str()); LOG_ERROR(Log, "Unknown log class in filter: {}", std::string(begin, end));
return false; return false;
} }

View File

@ -109,25 +109,25 @@ void FmtLogMessage(Class log_class, Level log_level, const char* filename, unsig
} // namespace Log } // namespace Log
#ifdef _DEBUG #ifdef _DEBUG
#define NGLOG_TRACE(log_class, ...) \ #define LOG_TRACE(log_class, ...) \
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Trace, __FILE__, __LINE__, \ ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Trace, __FILE__, __LINE__, \
__func__, __VA_ARGS__) __func__, __VA_ARGS__)
#else #else
#define NGLOG_TRACE(log_class, fmt, ...) (void(0)) #define LOG_TRACE(log_class, fmt, ...) (void(0))
#endif #endif
#define NGLOG_DEBUG(log_class, ...) \ #define LOG_DEBUG(log_class, ...) \
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Debug, __FILE__, __LINE__, \ ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Debug, __FILE__, __LINE__, \
__func__, __VA_ARGS__) __func__, __VA_ARGS__)
#define NGLOG_INFO(log_class, ...) \ #define LOG_INFO(log_class, ...) \
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Info, __FILE__, __LINE__, \ ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Info, __FILE__, __LINE__, \
__func__, __VA_ARGS__) __func__, __VA_ARGS__)
#define NGLOG_WARNING(log_class, ...) \ #define LOG_WARNING(log_class, ...) \
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Warning, __FILE__, __LINE__, \ ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Warning, __FILE__, __LINE__, \
__func__, __VA_ARGS__) __func__, __VA_ARGS__)
#define NGLOG_ERROR(log_class, ...) \ #define LOG_ERROR(log_class, ...) \
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Error, __FILE__, __LINE__, \ ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Error, __FILE__, __LINE__, \
__func__, __VA_ARGS__) __func__, __VA_ARGS__)
#define NGLOG_CRITICAL(log_class, ...) \ #define LOG_CRITICAL(log_class, ...) \
::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Critical, __FILE__, __LINE__, \ ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Critical, __FILE__, __LINE__, \
__func__, __VA_ARGS__) __func__, __VA_ARGS__)

View File

@ -55,7 +55,7 @@ void* AllocateExecutableMemory(size_t size, bool low) {
if (ptr == MAP_FAILED) { if (ptr == MAP_FAILED) {
ptr = nullptr; ptr = nullptr;
#endif #endif
NGLOG_ERROR(Common_Memory, "Failed to allocate executable memory"); LOG_ERROR(Common_Memory, "Failed to allocate executable memory");
} }
#if !defined(_WIN32) && defined(ARCHITECTURE_X64) && !defined(MAP_32BIT) #if !defined(_WIN32) && defined(ARCHITECTURE_X64) && !defined(MAP_32BIT)
else { else {
@ -68,7 +68,7 @@ void* AllocateExecutableMemory(size_t size, bool low) {
#if EMU_ARCH_BITS == 64 #if EMU_ARCH_BITS == 64
if ((u64)ptr >= 0x80000000 && low == true) if ((u64)ptr >= 0x80000000 && low == true)
NGLOG_ERROR(Common_Memory, "Executable memory ended up above 2GB!"); LOG_ERROR(Common_Memory, "Executable memory ended up above 2GB!");
#endif #endif
return ptr; return ptr;
@ -85,7 +85,7 @@ void* AllocateMemoryPages(size_t size) {
#endif #endif
if (ptr == nullptr) if (ptr == nullptr)
NGLOG_ERROR(Common_Memory, "Failed to allocate raw memory"); LOG_ERROR(Common_Memory, "Failed to allocate raw memory");
return ptr; return ptr;
} }
@ -99,12 +99,12 @@ void* AllocateAlignedMemory(size_t size, size_t alignment) {
ptr = memalign(alignment, size); ptr = memalign(alignment, size);
#else #else
if (posix_memalign(&ptr, alignment, size) != 0) if (posix_memalign(&ptr, alignment, size) != 0)
NGLOG_ERROR(Common_Memory, "Failed to allocate aligned memory"); LOG_ERROR(Common_Memory, "Failed to allocate aligned memory");
#endif #endif
#endif #endif
if (ptr == nullptr) if (ptr == nullptr)
NGLOG_ERROR(Common_Memory, "Failed to allocate aligned memory"); LOG_ERROR(Common_Memory, "Failed to allocate aligned memory");
return ptr; return ptr;
} }
@ -113,7 +113,7 @@ void FreeMemoryPages(void* ptr, size_t size) {
if (ptr) { if (ptr) {
#ifdef _WIN32 #ifdef _WIN32
if (!VirtualFree(ptr, 0, MEM_RELEASE)) if (!VirtualFree(ptr, 0, MEM_RELEASE))
NGLOG_ERROR(Common_Memory, "FreeMemoryPages failed!\n{}", GetLastErrorMsg()); LOG_ERROR(Common_Memory, "FreeMemoryPages failed!\n{}", GetLastErrorMsg());
#else #else
munmap(ptr, size); munmap(ptr, size);
#endif #endif
@ -134,7 +134,7 @@ void WriteProtectMemory(void* ptr, size_t size, bool allowExecute) {
#ifdef _WIN32 #ifdef _WIN32
DWORD oldValue; DWORD oldValue;
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READ : PAGE_READONLY, &oldValue)) if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READ : PAGE_READONLY, &oldValue))
NGLOG_ERROR(Common_Memory, "WriteProtectMemory failed!\n{}", GetLastErrorMsg()); LOG_ERROR(Common_Memory, "WriteProtectMemory failed!\n{}", GetLastErrorMsg());
#else #else
mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_EXEC) : PROT_READ); mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_EXEC) : PROT_READ);
#endif #endif
@ -145,7 +145,7 @@ void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute) {
DWORD oldValue; DWORD oldValue;
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE, if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE,
&oldValue)) &oldValue))
NGLOG_ERROR(Common_Memory, "UnWriteProtectMemory failed!\n{}", GetLastErrorMsg()); LOG_ERROR(Common_Memory, "UnWriteProtectMemory failed!\n{}", GetLastErrorMsg());
#else #else
mprotect(ptr, size, mprotect(ptr, size,
allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ); allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ);

View File

@ -25,7 +25,7 @@ ParamPackage::ParamPackage(const std::string& serialized) {
std::vector<std::string> key_value; std::vector<std::string> key_value;
Common::SplitString(pair, KEY_VALUE_SEPARATOR, key_value); Common::SplitString(pair, KEY_VALUE_SEPARATOR, key_value);
if (key_value.size() != 2) { if (key_value.size() != 2) {
NGLOG_ERROR(Common, "invalid key pair {}", pair); LOG_ERROR(Common, "invalid key pair {}", pair);
continue; continue;
} }
@ -64,7 +64,7 @@ std::string ParamPackage::Serialize() const {
std::string ParamPackage::Get(const std::string& key, const std::string& default_value) const { std::string ParamPackage::Get(const std::string& key, const std::string& default_value) const {
auto pair = data.find(key); auto pair = data.find(key);
if (pair == data.end()) { if (pair == data.end()) {
NGLOG_DEBUG(Common, "key '{}' not found", key); LOG_DEBUG(Common, "key '{}' not found", key);
return default_value; return default_value;
} }
@ -74,14 +74,14 @@ std::string ParamPackage::Get(const std::string& key, const std::string& default
int ParamPackage::Get(const std::string& key, int default_value) const { int ParamPackage::Get(const std::string& key, int default_value) const {
auto pair = data.find(key); auto pair = data.find(key);
if (pair == data.end()) { if (pair == data.end()) {
NGLOG_DEBUG(Common, "key '{}' not found", key); LOG_DEBUG(Common, "key '{}' not found", key);
return default_value; return default_value;
} }
try { try {
return std::stoi(pair->second); return std::stoi(pair->second);
} catch (const std::logic_error&) { } catch (const std::logic_error&) {
NGLOG_ERROR(Common, "failed to convert {} to int", pair->second); LOG_ERROR(Common, "failed to convert {} to int", pair->second);
return default_value; return default_value;
} }
} }
@ -89,14 +89,14 @@ int ParamPackage::Get(const std::string& key, int default_value) const {
float ParamPackage::Get(const std::string& key, float default_value) const { float ParamPackage::Get(const std::string& key, float default_value) const {
auto pair = data.find(key); auto pair = data.find(key);
if (pair == data.end()) { if (pair == data.end()) {
NGLOG_DEBUG(Common, "key {} not found", key); LOG_DEBUG(Common, "key {} not found", key);
return default_value; return default_value;
} }
try { try {
return std::stof(pair->second); return std::stof(pair->second);
} catch (const std::logic_error&) { } catch (const std::logic_error&) {
NGLOG_ERROR(Common, "failed to convert {} to float", pair->second); LOG_ERROR(Common, "failed to convert {} to float", pair->second);
return default_value; return default_value;
} }
} }

View File

@ -281,7 +281,7 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>&
iconv_t const conv_desc = iconv_open("UTF-8", fromcode); iconv_t const conv_desc = iconv_open("UTF-8", fromcode);
if ((iconv_t)(-1) == conv_desc) { if ((iconv_t)(-1) == conv_desc) {
NGLOG_ERROR(Common, "Iconv initialization failure [{}]: {}", fromcode, strerror(errno)); LOG_ERROR(Common, "Iconv initialization failure [{}]: {}", fromcode, strerror(errno));
iconv_close(conv_desc); iconv_close(conv_desc);
return {}; return {};
} }
@ -310,7 +310,7 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>&
++src_buffer; ++src_buffer;
} }
} else { } else {
NGLOG_ERROR(Common, "iconv failure [{}]: {}", fromcode, strerror(errno)); LOG_ERROR(Common, "iconv failure [{}]: {}", fromcode, strerror(errno));
break; break;
} }
} }
@ -329,7 +329,7 @@ std::u16string UTF8ToUTF16(const std::string& input) {
iconv_t const conv_desc = iconv_open("UTF-16LE", "UTF-8"); iconv_t const conv_desc = iconv_open("UTF-16LE", "UTF-8");
if ((iconv_t)(-1) == conv_desc) { if ((iconv_t)(-1) == conv_desc) {
NGLOG_ERROR(Common, "Iconv initialization failure [UTF-8]: {}", strerror(errno)); LOG_ERROR(Common, "Iconv initialization failure [UTF-8]: {}", strerror(errno));
iconv_close(conv_desc); iconv_close(conv_desc);
return {}; return {};
} }
@ -358,7 +358,7 @@ std::u16string UTF8ToUTF16(const std::string& input) {
++src_buffer; ++src_buffer;
} }
} else { } else {
NGLOG_ERROR(Common, "iconv failure [UTF-8]: {}", strerror(errno)); LOG_ERROR(Common, "iconv failure [UTF-8]: {}", strerror(errno));
break; break;
} }
} }

View File

@ -55,8 +55,8 @@ public:
} }
void InterpreterFallback(u64 pc, size_t num_instructions) override { void InterpreterFallback(u64 pc, size_t num_instructions) override {
NGLOG_INFO(Core_ARM, "Unicorn fallback @ 0x{:X} for {} instructions (instr = {:08X})", pc, LOG_INFO(Core_ARM, "Unicorn fallback @ 0x{:X} for {} instructions (instr = {:08X})", pc,
num_instructions, MemoryReadCode(pc)); num_instructions, MemoryReadCode(pc));
ARM_Interface::ThreadContext ctx; ARM_Interface::ThreadContext ctx;
parent.SaveContext(ctx); parent.SaveContext(ctx);

View File

@ -87,15 +87,15 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file
app_loader = Loader::GetLoader(filepath); app_loader = Loader::GetLoader(filepath);
if (!app_loader) { if (!app_loader) {
NGLOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath); LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);
return ResultStatus::ErrorGetLoader; return ResultStatus::ErrorGetLoader;
} }
std::pair<boost::optional<u32>, Loader::ResultStatus> system_mode = std::pair<boost::optional<u32>, Loader::ResultStatus> system_mode =
app_loader->LoadKernelSystemMode(); app_loader->LoadKernelSystemMode();
if (system_mode.second != Loader::ResultStatus::Success) { if (system_mode.second != Loader::ResultStatus::Success) {
NGLOG_CRITICAL(Core, "Failed to determine system mode (Error {})!", LOG_CRITICAL(Core, "Failed to determine system mode (Error {})!",
static_cast<int>(system_mode.second)); static_cast<int>(system_mode.second));
switch (system_mode.second) { switch (system_mode.second) {
case Loader::ResultStatus::ErrorEncrypted: case Loader::ResultStatus::ErrorEncrypted:
@ -111,15 +111,15 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file
ResultStatus init_result{Init(emu_window, system_mode.first.get())}; ResultStatus init_result{Init(emu_window, system_mode.first.get())};
if (init_result != ResultStatus::Success) { if (init_result != ResultStatus::Success) {
NGLOG_CRITICAL(Core, "Failed to initialize system (Error {})!", LOG_CRITICAL(Core, "Failed to initialize system (Error {})!",
static_cast<int>(init_result)); static_cast<int>(init_result));
System::Shutdown(); System::Shutdown();
return init_result; return init_result;
} }
const Loader::ResultStatus load_result{app_loader->Load(current_process)}; const Loader::ResultStatus load_result{app_loader->Load(current_process)};
if (Loader::ResultStatus::Success != load_result) { if (Loader::ResultStatus::Success != load_result) {
NGLOG_CRITICAL(Core, "Failed to load ROM (Error {})!", static_cast<int>(load_result)); LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", static_cast<int>(load_result));
System::Shutdown(); System::Shutdown();
switch (load_result) { switch (load_result) {
@ -161,7 +161,7 @@ Cpu& System::CpuCore(size_t core_index) {
} }
System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
NGLOG_DEBUG(HW_Memory, "initialized OK"); LOG_DEBUG(HW_Memory, "initialized OK");
CoreTiming::Init(); CoreTiming::Init();
@ -196,7 +196,7 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
} }
} }
NGLOG_DEBUG(Core, "Initialized OK"); LOG_DEBUG(Core, "Initialized OK");
// Reset counters and set time origin to current frame // Reset counters and set time origin to current frame
GetAndResetPerfStats(); GetAndResetPerfStats();
@ -245,7 +245,7 @@ void System::Shutdown() {
// Close app loader // Close app loader
app_loader.reset(); app_loader.reset();
NGLOG_DEBUG(Core, "Shutdown OK"); LOG_DEBUG(Core, "Shutdown OK");
} }
Service::SM::ServiceManager& System::ServiceManager() { Service::SM::ServiceManager& System::ServiceManager() {

View File

@ -56,7 +56,7 @@ Cpu::Cpu(std::shared_ptr<CpuBarrier> cpu_barrier, size_t core_index)
arm_interface = std::make_shared<ARM_Dynarmic>(); arm_interface = std::make_shared<ARM_Dynarmic>();
#else #else
cpu_core = std::make_shared<ARM_Unicorn>(); cpu_core = std::make_shared<ARM_Unicorn>();
NGLOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available"); LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
#endif #endif
} else { } else {
arm_interface = std::make_shared<ARM_Unicorn>(); arm_interface = std::make_shared<ARM_Unicorn>();
@ -75,7 +75,7 @@ void Cpu::RunLoop(bool tight_loop) {
// If we don't have a currently active thread then don't execute instructions, // If we don't have a currently active thread then don't execute instructions,
// instead advance to the next event and try to yield to the next thread // instead advance to the next event and try to yield to the next thread
if (Kernel::GetCurrentThread() == nullptr) { if (Kernel::GetCurrentThread() == nullptr) {
NGLOG_TRACE(Core, "Core-{} idling", core_index); LOG_TRACE(Core, "Core-{} idling", core_index);
if (IsMainCore()) { if (IsMainCore()) {
CoreTiming::Idle(); CoreTiming::Idle();

View File

@ -74,11 +74,11 @@ static void EmptyTimedCallback(u64 userdata, s64 cyclesLate) {}
s64 usToCycles(s64 us) { s64 usToCycles(s64 us) {
if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) { if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
NGLOG_ERROR(Core_Timing, "Integer overflow, use max value"); LOG_ERROR(Core_Timing, "Integer overflow, use max value");
return std::numeric_limits<s64>::max(); return std::numeric_limits<s64>::max();
} }
if (us > MAX_VALUE_TO_MULTIPLY) { if (us > MAX_VALUE_TO_MULTIPLY) {
NGLOG_DEBUG(Core_Timing, "Time very big, do rounding"); LOG_DEBUG(Core_Timing, "Time very big, do rounding");
return BASE_CLOCK_RATE * (us / 1000000); return BASE_CLOCK_RATE * (us / 1000000);
} }
return (BASE_CLOCK_RATE * us) / 1000000; return (BASE_CLOCK_RATE * us) / 1000000;
@ -86,11 +86,11 @@ s64 usToCycles(s64 us) {
s64 usToCycles(u64 us) { s64 usToCycles(u64 us) {
if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) { if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
NGLOG_ERROR(Core_Timing, "Integer overflow, use max value"); LOG_ERROR(Core_Timing, "Integer overflow, use max value");
return std::numeric_limits<s64>::max(); return std::numeric_limits<s64>::max();
} }
if (us > MAX_VALUE_TO_MULTIPLY) { if (us > MAX_VALUE_TO_MULTIPLY) {
NGLOG_DEBUG(Core_Timing, "Time very big, do rounding"); LOG_DEBUG(Core_Timing, "Time very big, do rounding");
return BASE_CLOCK_RATE * static_cast<s64>(us / 1000000); return BASE_CLOCK_RATE * static_cast<s64>(us / 1000000);
} }
return (BASE_CLOCK_RATE * static_cast<s64>(us)) / 1000000; return (BASE_CLOCK_RATE * static_cast<s64>(us)) / 1000000;
@ -98,11 +98,11 @@ s64 usToCycles(u64 us) {
s64 nsToCycles(s64 ns) { s64 nsToCycles(s64 ns) {
if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) { if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
NGLOG_ERROR(Core_Timing, "Integer overflow, use max value"); LOG_ERROR(Core_Timing, "Integer overflow, use max value");
return std::numeric_limits<s64>::max(); return std::numeric_limits<s64>::max();
} }
if (ns > MAX_VALUE_TO_MULTIPLY) { if (ns > MAX_VALUE_TO_MULTIPLY) {
NGLOG_DEBUG(Core_Timing, "Time very big, do rounding"); LOG_DEBUG(Core_Timing, "Time very big, do rounding");
return BASE_CLOCK_RATE * (ns / 1000000000); return BASE_CLOCK_RATE * (ns / 1000000000);
} }
return (BASE_CLOCK_RATE * ns) / 1000000000; return (BASE_CLOCK_RATE * ns) / 1000000000;
@ -110,11 +110,11 @@ s64 nsToCycles(s64 ns) {
s64 nsToCycles(u64 ns) { s64 nsToCycles(u64 ns) {
if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) { if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
NGLOG_ERROR(Core_Timing, "Integer overflow, use max value"); LOG_ERROR(Core_Timing, "Integer overflow, use max value");
return std::numeric_limits<s64>::max(); return std::numeric_limits<s64>::max();
} }
if (ns > MAX_VALUE_TO_MULTIPLY) { if (ns > MAX_VALUE_TO_MULTIPLY) {
NGLOG_DEBUG(Core_Timing, "Time very big, do rounding"); LOG_DEBUG(Core_Timing, "Time very big, do rounding");
return BASE_CLOCK_RATE * (static_cast<s64>(ns) / 1000000000); return BASE_CLOCK_RATE * (static_cast<s64>(ns) / 1000000000);
} }
return (BASE_CLOCK_RATE * static_cast<s64>(ns)) / 1000000000; return (BASE_CLOCK_RATE * static_cast<s64>(ns)) / 1000000000;

View File

@ -80,19 +80,19 @@ ResultCode Disk_FileSystem::RenameFile(const std::string& src_path,
} }
ResultCode Disk_FileSystem::DeleteDirectory(const Path& path) const { ResultCode Disk_FileSystem::DeleteDirectory(const Path& path) const {
NGLOG_WARNING(Service_FS, "(STUBBED) called"); LOG_WARNING(Service_FS, "(STUBBED) called");
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return ResultCode(-1); return ResultCode(-1);
} }
ResultCode Disk_FileSystem::DeleteDirectoryRecursively(const Path& path) const { ResultCode Disk_FileSystem::DeleteDirectoryRecursively(const Path& path) const {
NGLOG_WARNING(Service_FS, "(STUBBED) called"); LOG_WARNING(Service_FS, "(STUBBED) called");
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return ResultCode(-1); return ResultCode(-1);
} }
ResultCode Disk_FileSystem::CreateFile(const std::string& path, u64 size) const { ResultCode Disk_FileSystem::CreateFile(const std::string& path, u64 size) const {
NGLOG_WARNING(Service_FS, "(STUBBED) called"); LOG_WARNING(Service_FS, "(STUBBED) called");
std::string full_path = base_directory + path; std::string full_path = base_directory + path;
if (size == 0) { if (size == 0) {
@ -107,7 +107,7 @@ ResultCode Disk_FileSystem::CreateFile(const std::string& path, u64 size) const
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
NGLOG_ERROR(Service_FS, "Too large file"); LOG_ERROR(Service_FS, "Too large file");
// TODO(Subv): Find out the correct error code // TODO(Subv): Find out the correct error code
return ResultCode(-1); return ResultCode(-1);
} }
@ -120,13 +120,13 @@ ResultCode Disk_FileSystem::CreateDirectory(const std::string& path) const {
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", full_path); LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", full_path);
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return ResultCode(-1); return ResultCode(-1);
} }
ResultCode Disk_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const { ResultCode Disk_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const {
NGLOG_WARNING(Service_FS, "(STUBBED) called"); LOG_WARNING(Service_FS, "(STUBBED) called");
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return ResultCode(-1); return ResultCode(-1);
} }
@ -146,7 +146,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> Disk_FileSystem::OpenDirectory(
} }
u64 Disk_FileSystem::GetFreeSpaceSize() const { u64 Disk_FileSystem::GetFreeSpaceSize() const {
NGLOG_WARNING(Service_FS, "(STUBBED) called"); LOG_WARNING(Service_FS, "(STUBBED) called");
return 0; 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 { ResultVal<size_t> Disk_Storage::Read(const u64 offset, const size_t length, u8* buffer) const {
NGLOG_TRACE(Service_FS, "called offset={}, length={}", offset, length); LOG_TRACE(Service_FS, "called offset={}, length={}", offset, length);
file->Seek(offset, SEEK_SET); file->Seek(offset, SEEK_SET);
return MakeResult<size_t>(file->ReadBytes(buffer, length)); return MakeResult<size_t>(file->ReadBytes(buffer, length));
} }
ResultVal<size_t> Disk_Storage::Write(const u64 offset, const size_t length, const bool flush, ResultVal<size_t> Disk_Storage::Write(const u64 offset, const size_t length, const bool flush,
const u8* buffer) const { const u8* buffer) const {
NGLOG_WARNING(Service_FS, "(STUBBED) called"); LOG_WARNING(Service_FS, "(STUBBED) called");
file->Seek(offset, SEEK_SET); file->Seek(offset, SEEK_SET);
size_t written = file->WriteBytes(buffer, length); size_t written = file->WriteBytes(buffer, length);
if (flush) { if (flush) {
@ -204,7 +204,7 @@ u64 Disk_Directory::Read(const u64 count, Entry* entries) {
const std::string& filename = file.virtualName; const std::string& filename = file.virtualName;
Entry& entry = entries[entries_read]; Entry& entry = entries[entries_read];
NGLOG_TRACE(Service_FS, "File {}: size={} dir={}", filename, file.size, file.isDirectory); LOG_TRACE(Service_FS, "File {}: size={} dir={}", filename, file.size, file.isDirectory);
// TODO(Link Mauve): use a proper conversion to UTF-16. // TODO(Link Mauve): use a proper conversion to UTF-16.
for (size_t j = 0; j < FILENAME_LENGTH; ++j) { for (size_t j = 0; j < FILENAME_LENGTH; ++j) {

View File

@ -71,7 +71,7 @@ std::string Path::AsString() const {
case Binary: case Binary:
default: default:
// TODO(yuriks): Add assert // TODO(yuriks): Add assert
NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to string!"); LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!");
return {}; return {};
} }
} }
@ -87,7 +87,7 @@ std::u16string Path::AsU16Str() const {
case Invalid: case Invalid:
case Binary: case Binary:
// TODO(yuriks): Add assert // TODO(yuriks): Add assert
NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!"); LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
return {}; return {};
} }
@ -115,7 +115,7 @@ std::vector<u8> Path::AsBinary() const {
case Invalid: case Invalid:
default: default:
// TODO(yuriks): Add assert // TODO(yuriks): Add assert
NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!"); LOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!");
return {}; return {};
} }
} }

View File

@ -46,7 +46,7 @@ Loader::ResultStatus PartitionFilesystem::Load(const std::string& file_path, siz
Loader::ResultStatus result = Load(file_data); Loader::ResultStatus result = Load(file_data);
if (result != Loader::ResultStatus::Success) if (result != Loader::ResultStatus::Success)
NGLOG_ERROR(Service_FS, "Failed to load PFS from file {}!", file_path); LOG_ERROR(Service_FS, "Failed to load PFS from file {}!", file_path);
return result; return result;
} }
@ -125,12 +125,12 @@ u64 PartitionFilesystem::GetFileSize(const std::string& name) const {
} }
void PartitionFilesystem::Print() const { void PartitionFilesystem::Print() const {
NGLOG_DEBUG(Service_FS, "Magic: {}", pfs_header.magic); LOG_DEBUG(Service_FS, "Magic: {}", pfs_header.magic);
NGLOG_DEBUG(Service_FS, "Files: {}", pfs_header.num_entries); LOG_DEBUG(Service_FS, "Files: {}", pfs_header.num_entries);
for (u32 i = 0; i < pfs_header.num_entries; i++) { for (u32 i = 0; i < pfs_header.num_entries; i++) {
NGLOG_DEBUG(Service_FS, " > File {}: {} (0x{:X} bytes, at 0x{:X})", i, LOG_DEBUG(Service_FS, " > File {}: {} (0x{:X} bytes, at 0x{:X})", i,
pfs_entries[i].name.c_str(), pfs_entries[i].fs_entry.size, pfs_entries[i].name.c_str(), pfs_entries[i].fs_entry.size,
GetFileOffset(pfs_entries[i].name)); GetFileOffset(pfs_entries[i].name));
} }
} }
} // namespace FileSys } // namespace FileSys

View File

@ -21,7 +21,7 @@ Loader::ResultStatus ProgramMetadata::Load(const std::string& file_path) {
Loader::ResultStatus result = Load(file_data); Loader::ResultStatus result = Load(file_data);
if (result != Loader::ResultStatus::Success) if (result != Loader::ResultStatus::Success)
NGLOG_ERROR(Service_FS, "Failed to load NPDM from file {}!", file_path); LOG_ERROR(Service_FS, "Failed to load NPDM from file {}!", file_path);
return result; return result;
} }
@ -76,14 +76,14 @@ u64 ProgramMetadata::GetFilesystemPermissions() const {
} }
void ProgramMetadata::Print() const { void ProgramMetadata::Print() const {
NGLOG_DEBUG(Service_FS, "Magic: {:.4}", npdm_header.magic.data()); LOG_DEBUG(Service_FS, "Magic: {:.4}", npdm_header.magic.data());
NGLOG_DEBUG(Service_FS, "Main thread priority: 0x{:02X}", npdm_header.main_thread_priority); LOG_DEBUG(Service_FS, "Main thread priority: 0x{:02X}", npdm_header.main_thread_priority);
NGLOG_DEBUG(Service_FS, "Main thread core: {}", npdm_header.main_thread_cpu); LOG_DEBUG(Service_FS, "Main thread core: {}", npdm_header.main_thread_cpu);
NGLOG_DEBUG(Service_FS, "Main thread stack size: 0x{:X} bytes", npdm_header.main_stack_size); LOG_DEBUG(Service_FS, "Main thread stack size: 0x{:X} bytes", npdm_header.main_stack_size);
NGLOG_DEBUG(Service_FS, "Process category: {}", npdm_header.process_category); LOG_DEBUG(Service_FS, "Process category: {}", npdm_header.process_category);
NGLOG_DEBUG(Service_FS, "Flags: 0x{:02X}", npdm_header.flags); LOG_DEBUG(Service_FS, "Flags: 0x{:02X}", npdm_header.flags);
NGLOG_DEBUG(Service_FS, " > 64-bit instructions: {}", LOG_DEBUG(Service_FS, " > 64-bit instructions: {}",
npdm_header.has_64_bit_instructions ? "YES" : "NO"); npdm_header.has_64_bit_instructions ? "YES" : "NO");
auto address_space = "Unknown"; auto address_space = "Unknown";
switch (npdm_header.address_space_type) { switch (npdm_header.address_space_type) {
@ -95,19 +95,19 @@ void ProgramMetadata::Print() const {
break; break;
} }
NGLOG_DEBUG(Service_FS, " > Address space: {}\n", address_space); LOG_DEBUG(Service_FS, " > Address space: {}\n", address_space);
// Begin ACID printing (potential perms, signed) // Begin ACID printing (potential perms, signed)
NGLOG_DEBUG(Service_FS, "Magic: {:.4}", acid_header.magic.data()); LOG_DEBUG(Service_FS, "Magic: {:.4}", acid_header.magic.data());
NGLOG_DEBUG(Service_FS, "Flags: 0x{:02X}", acid_header.flags); LOG_DEBUG(Service_FS, "Flags: 0x{:02X}", acid_header.flags);
NGLOG_DEBUG(Service_FS, " > Is Retail: {}", acid_header.is_retail ? "YES" : "NO"); LOG_DEBUG(Service_FS, " > Is Retail: {}", acid_header.is_retail ? "YES" : "NO");
NGLOG_DEBUG(Service_FS, "Title ID Min: 0x{:016X}", acid_header.title_id_min); LOG_DEBUG(Service_FS, "Title ID Min: 0x{:016X}", acid_header.title_id_min);
NGLOG_DEBUG(Service_FS, "Title ID Max: 0x{:016X}", acid_header.title_id_max); LOG_DEBUG(Service_FS, "Title ID Max: 0x{:016X}", acid_header.title_id_max);
NGLOG_DEBUG(Service_FS, "Filesystem Access: 0x{:016X}\n", acid_file_access.permissions); LOG_DEBUG(Service_FS, "Filesystem Access: 0x{:016X}\n", acid_file_access.permissions);
// Begin ACI0 printing (actual perms, unsigned) // Begin ACI0 printing (actual perms, unsigned)
NGLOG_DEBUG(Service_FS, "Magic: {:.4}", aci_header.magic.data()); LOG_DEBUG(Service_FS, "Magic: {:.4}", aci_header.magic.data());
NGLOG_DEBUG(Service_FS, "Title ID: 0x{:016X}", aci_header.title_id); LOG_DEBUG(Service_FS, "Title ID: 0x{:016X}", aci_header.title_id);
NGLOG_DEBUG(Service_FS, "Filesystem Access: 0x{:016X}\n", aci_file_access.permissions); LOG_DEBUG(Service_FS, "Filesystem Access: 0x{:016X}\n", aci_file_access.permissions);
} }
} // namespace FileSys } // namespace FileSys

View File

@ -14,7 +14,7 @@ namespace FileSys {
RomFS_Factory::RomFS_Factory(Loader::AppLoader& app_loader) { RomFS_Factory::RomFS_Factory(Loader::AppLoader& app_loader) {
// Load the RomFS from the app // Load the RomFS from the app
if (Loader::ResultStatus::Success != app_loader.ReadRomFS(romfs_file, data_offset, data_size)) { if (Loader::ResultStatus::Success != app_loader.ReadRomFS(romfs_file, data_offset, data_size)) {
NGLOG_ERROR(Service_FS, "Unable to read RomFS!"); LOG_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) { ResultCode RomFS_Factory::Format(const Path& path) {
NGLOG_ERROR(Service_FS, "Unimplemented Format archive {}", GetName()); LOG_ERROR(Service_FS, "Unimplemented Format archive {}", GetName());
// TODO(bunnei): Find the right error code for this // TODO(bunnei): Find the right error code for this
return ResultCode(-1); return ResultCode(-1);
} }
ResultVal<ArchiveFormatInfo> RomFS_Factory::GetFormatInfo(const Path& path) const { ResultVal<ArchiveFormatInfo> RomFS_Factory::GetFormatInfo(const Path& path) const {
NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName()); LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
// TODO(bunnei): Find the right error code for this // TODO(bunnei): Find the right error code for this
return ResultCode(-1); return ResultCode(-1);
} }

View File

@ -21,72 +21,70 @@ ResultVal<std::unique_ptr<StorageBackend>> RomFS_FileSystem::OpenFile(const std:
} }
ResultCode RomFS_FileSystem::DeleteFile(const std::string& path) const { ResultCode RomFS_FileSystem::DeleteFile(const std::string& path) const {
NGLOG_CRITICAL(Service_FS, "Attempted to delete a file from an ROMFS archive ({}).", GetName()); LOG_CRITICAL(Service_FS, "Attempted to delete a file from an ROMFS archive ({}).", GetName());
// TODO(bunnei): Use correct error code // TODO(bunnei): Use correct error code
return ResultCode(-1); return ResultCode(-1);
} }
ResultCode RomFS_FileSystem::RenameFile(const std::string& src_path, ResultCode RomFS_FileSystem::RenameFile(const std::string& src_path,
const std::string& dest_path) const { const std::string& dest_path) const {
NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive ({}).", LOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive ({}).", GetName());
GetName());
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return ResultCode(-1); return ResultCode(-1);
} }
ResultCode RomFS_FileSystem::DeleteDirectory(const Path& path) const { ResultCode RomFS_FileSystem::DeleteDirectory(const Path& path) const {
NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive ({}).", LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive ({}).",
GetName()); GetName());
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return ResultCode(-1); return ResultCode(-1);
} }
ResultCode RomFS_FileSystem::DeleteDirectoryRecursively(const Path& path) const { ResultCode RomFS_FileSystem::DeleteDirectoryRecursively(const Path& path) const {
NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive ({}).", LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive ({}).",
GetName()); GetName());
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return ResultCode(-1); return ResultCode(-1);
} }
ResultCode RomFS_FileSystem::CreateFile(const std::string& path, u64 size) const { ResultCode RomFS_FileSystem::CreateFile(const std::string& path, u64 size) const {
NGLOG_CRITICAL(Service_FS, "Attempted to create a file in an ROMFS archive ({}).", GetName()); LOG_CRITICAL(Service_FS, "Attempted to create a file in an ROMFS archive ({}).", GetName());
// TODO(bunnei): Use correct error code // TODO(bunnei): Use correct error code
return ResultCode(-1); return ResultCode(-1);
} }
ResultCode RomFS_FileSystem::CreateDirectory(const std::string& path) const { ResultCode RomFS_FileSystem::CreateDirectory(const std::string& path) const {
NGLOG_CRITICAL(Service_FS, "Attempted to create a directory in an ROMFS archive ({}).", LOG_CRITICAL(Service_FS, "Attempted to create a directory in an ROMFS archive ({}).",
GetName()); GetName());
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return ResultCode(-1); return ResultCode(-1);
} }
ResultCode RomFS_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const { ResultCode RomFS_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const {
NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive ({}).", LOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive ({}).", GetName());
GetName());
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return ResultCode(-1); return ResultCode(-1);
} }
ResultVal<std::unique_ptr<DirectoryBackend>> RomFS_FileSystem::OpenDirectory( ResultVal<std::unique_ptr<DirectoryBackend>> RomFS_FileSystem::OpenDirectory(
const std::string& path) const { const std::string& path) const {
NGLOG_WARNING(Service_FS, "Opening Directory in a ROMFS archive"); LOG_WARNING(Service_FS, "Opening Directory in a ROMFS archive");
return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<ROMFSDirectory>()); return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<ROMFSDirectory>());
} }
u64 RomFS_FileSystem::GetFreeSpaceSize() const { u64 RomFS_FileSystem::GetFreeSpaceSize() const {
NGLOG_WARNING(Service_FS, "Attempted to get the free space in an ROMFS archive"); LOG_WARNING(Service_FS, "Attempted to get the free space in an ROMFS archive");
return 0; return 0;
} }
ResultVal<FileSys::EntryType> RomFS_FileSystem::GetEntryType(const std::string& path) const { ResultVal<FileSys::EntryType> RomFS_FileSystem::GetEntryType(const std::string& path) const {
NGLOG_CRITICAL(Service_FS, "Called within an ROMFS archive (path {}).", path); LOG_CRITICAL(Service_FS, "Called within an ROMFS archive (path {}).", path);
// TODO(wwylele): Use correct error code // TODO(wwylele): Use correct error code
return ResultCode(-1); return ResultCode(-1);
} }
ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8* buffer) const { ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8* buffer) const {
NGLOG_TRACE(Service_FS, "called offset={}, length={}", offset, length); LOG_TRACE(Service_FS, "called offset={}, length={}", offset, length);
romfs_file->Seek(data_offset + offset, SEEK_SET); romfs_file->Seek(data_offset + offset, SEEK_SET);
size_t read_length = (size_t)std::min((u64)length, data_size - offset); size_t read_length = (size_t)std::min((u64)length, data_size - offset);
@ -95,7 +93,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, ResultVal<size_t> RomFS_Storage::Write(const u64 offset, const size_t length, const bool flush,
const u8* buffer) const { const u8* buffer) const {
NGLOG_ERROR(Service_FS, "Attempted to write to ROMFS file"); LOG_ERROR(Service_FS, "Attempted to write to ROMFS file");
// TODO(Subv): Find error code // TODO(Subv): Find error code
return MakeResult<size_t>(0); return MakeResult<size_t>(0);
} }
@ -105,7 +103,7 @@ u64 RomFS_Storage::GetSize() const {
} }
bool RomFS_Storage::SetSize(const u64 size) const { bool RomFS_Storage::SetSize(const u64 size) const {
NGLOG_ERROR(Service_FS, "Attempted to set the size of an ROMFS file"); LOG_ERROR(Service_FS, "Attempted to set the size of an ROMFS file");
return false; return false;
} }

View File

@ -28,7 +28,7 @@ ResultVal<std::unique_ptr<FileSystemBackend>> SaveData_Factory::Open(const Path&
} }
ResultCode SaveData_Factory::Format(const Path& path) { ResultCode SaveData_Factory::Format(const Path& path) {
NGLOG_WARNING(Service_FS, "Format archive {}", GetName()); LOG_WARNING(Service_FS, "Format archive {}", GetName());
// Create the save data directory. // Create the save data directory.
if (!FileUtil::CreateFullPath(GetFullPath())) { if (!FileUtil::CreateFullPath(GetFullPath())) {
// TODO(Subv): Find the correct error code. // TODO(Subv): Find the correct error code.
@ -39,7 +39,7 @@ ResultCode SaveData_Factory::Format(const Path& path) {
} }
ResultVal<ArchiveFormatInfo> SaveData_Factory::GetFormatInfo(const Path& path) const { ResultVal<ArchiveFormatInfo> SaveData_Factory::GetFormatInfo(const Path& path) const {
NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName()); LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
// TODO(bunnei): Find the right error code for this // TODO(bunnei): Find the right error code for this
return ResultCode(-1); return ResultCode(-1);
} }

View File

@ -25,13 +25,13 @@ ResultVal<std::unique_ptr<FileSystemBackend>> SDMC_Factory::Open(const Path& pat
} }
ResultCode SDMC_Factory::Format(const Path& path) { ResultCode SDMC_Factory::Format(const Path& path) {
NGLOG_ERROR(Service_FS, "Unimplemented Format archive {}", GetName()); LOG_ERROR(Service_FS, "Unimplemented Format archive {}", GetName());
// TODO(Subv): Find the right error code for this // TODO(Subv): Find the right error code for this
return ResultCode(-1); return ResultCode(-1);
} }
ResultVal<ArchiveFormatInfo> SDMC_Factory::GetFormatInfo(const Path& path) const { ResultVal<ArchiveFormatInfo> SDMC_Factory::GetFormatInfo(const Path& path) const {
NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName()); LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
// TODO(bunnei): Find the right error code for this // TODO(bunnei): Find the right error code for this
return ResultCode(-1); return ResultCode(-1);
} }

View File

@ -59,7 +59,7 @@ template <typename InputDeviceType>
void RegisterFactory(const std::string& name, std::shared_ptr<Factory<InputDeviceType>> factory) { void RegisterFactory(const std::string& name, std::shared_ptr<Factory<InputDeviceType>> factory) {
auto pair = std::make_pair(name, std::move(factory)); auto pair = std::make_pair(name, std::move(factory));
if (!Impl::FactoryList<InputDeviceType>::list.insert(std::move(pair)).second) { if (!Impl::FactoryList<InputDeviceType>::list.insert(std::move(pair)).second) {
NGLOG_ERROR(Input, "Factory '{}' already registered", name); LOG_ERROR(Input, "Factory '{}' already registered", name);
} }
} }
@ -71,7 +71,7 @@ void RegisterFactory(const std::string& name, std::shared_ptr<Factory<InputDevic
template <typename InputDeviceType> template <typename InputDeviceType>
void UnregisterFactory(const std::string& name) { void UnregisterFactory(const std::string& name) {
if (Impl::FactoryList<InputDeviceType>::list.erase(name) == 0) { if (Impl::FactoryList<InputDeviceType>::list.erase(name) == 0) {
NGLOG_ERROR(Input, "Factory '{}' not registered", name); LOG_ERROR(Input, "Factory '{}' not registered", name);
} }
} }
@ -88,7 +88,7 @@ std::unique_ptr<InputDeviceType> CreateDevice(const std::string& params) {
const auto pair = factory_list.find(engine); const auto pair = factory_list.find(engine);
if (pair == factory_list.end()) { if (pair == factory_list.end()) {
if (engine != "null") { if (engine != "null") {
NGLOG_ERROR(Input, "Unknown engine name: {}", engine); LOG_ERROR(Input, "Unknown engine name: {}", engine);
} }
return std::make_unique<InputDeviceType>(); return std::make_unique<InputDeviceType>();
} }

View File

@ -232,7 +232,7 @@ static u8 HexCharToValue(u8 hex) {
return hex - 'A' + 0xA; return hex - 'A' + 0xA;
} }
NGLOG_ERROR(Debug_GDBStub, "Invalid nibble: {} ({:02X})", hex, hex); LOG_ERROR(Debug_GDBStub, "Invalid nibble: {} ({:02X})", hex, hex);
return 0; return 0;
} }
@ -372,7 +372,7 @@ static u8 ReadByte() {
u8 c; u8 c;
size_t received_size = recv(gdbserver_socket, reinterpret_cast<char*>(&c), 1, MSG_WAITALL); size_t received_size = recv(gdbserver_socket, reinterpret_cast<char*>(&c), 1, MSG_WAITALL);
if (received_size != 1) { if (received_size != 1) {
NGLOG_ERROR(Debug_GDBStub, "recv failed: {}", received_size); LOG_ERROR(Debug_GDBStub, "recv failed: {}", received_size);
Shutdown(); Shutdown();
} }
@ -413,8 +413,8 @@ static void RemoveBreakpoint(BreakpointType type, PAddr addr) {
auto bp = p.find(static_cast<u64>(addr)); auto bp = p.find(static_cast<u64>(addr));
if (bp != p.end()) { if (bp != p.end()) {
NGLOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: {:016X} bytes at {:016X} of type {}", LOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: {:016X} bytes at {:016X} of type {}",
bp->second.len, bp->second.addr, static_cast<int>(type)); bp->second.len, bp->second.addr, static_cast<int>(type));
p.erase(static_cast<u64>(addr)); p.erase(static_cast<u64>(addr));
} }
} }
@ -459,10 +459,10 @@ bool CheckBreakpoint(PAddr addr, BreakpointType type) {
} }
if (bp->second.active && (addr >= bp->second.addr && addr < bp->second.addr + len)) { if (bp->second.active && (addr >= bp->second.addr && addr < bp->second.addr + len)) {
NGLOG_DEBUG(Debug_GDBStub, LOG_DEBUG(Debug_GDBStub,
"Found breakpoint type {} @ {:016X}, range: {:016X}" "Found breakpoint type {} @ {:016X}, range: {:016X}"
" - {:016X} ({:X} bytes)", " - {:016X} ({:X} bytes)",
static_cast<int>(type), addr, bp->second.addr, bp->second.addr + len, len); static_cast<int>(type), addr, bp->second.addr, bp->second.addr + len, len);
return true; return true;
} }
} }
@ -478,7 +478,7 @@ bool CheckBreakpoint(PAddr addr, BreakpointType type) {
static void SendPacket(const char packet) { static void SendPacket(const char packet) {
size_t sent_size = send(gdbserver_socket, &packet, 1, 0); size_t sent_size = send(gdbserver_socket, &packet, 1, 0);
if (sent_size != 1) { if (sent_size != 1) {
NGLOG_ERROR(Debug_GDBStub, "send failed"); LOG_ERROR(Debug_GDBStub, "send failed");
} }
} }
@ -492,13 +492,13 @@ static void SendReply(const char* reply) {
return; return;
} }
NGLOG_DEBUG(Debug_GDBStub, "Reply: {}", reply); LOG_DEBUG(Debug_GDBStub, "Reply: {}", reply);
memset(command_buffer, 0, sizeof(command_buffer)); memset(command_buffer, 0, sizeof(command_buffer));
command_length = static_cast<u32>(strlen(reply)); command_length = static_cast<u32>(strlen(reply));
if (command_length + 4 > sizeof(command_buffer)) { if (command_length + 4 > sizeof(command_buffer)) {
NGLOG_ERROR(Debug_GDBStub, "command_buffer overflow in SendReply"); LOG_ERROR(Debug_GDBStub, "command_buffer overflow in SendReply");
return; return;
} }
@ -515,7 +515,7 @@ static void SendReply(const char* reply) {
while (left > 0) { while (left > 0) {
int sent_size = send(gdbserver_socket, reinterpret_cast<char*>(ptr), left, 0); int sent_size = send(gdbserver_socket, reinterpret_cast<char*>(ptr), left, 0);
if (sent_size < 0) { if (sent_size < 0) {
NGLOG_ERROR(Debug_GDBStub, "gdb: send failed"); LOG_ERROR(Debug_GDBStub, "gdb: send failed");
return Shutdown(); return Shutdown();
} }
@ -526,7 +526,7 @@ static void SendReply(const char* reply) {
/// Handle query command from gdb client. /// Handle query command from gdb client.
static void HandleQuery() { static void HandleQuery() {
NGLOG_DEBUG(Debug_GDBStub, "gdb: query '{}'", command_buffer + 1); LOG_DEBUG(Debug_GDBStub, "gdb: query '{}'", command_buffer + 1);
const char* query = reinterpret_cast<const char*>(command_buffer + 1); const char* query = reinterpret_cast<const char*>(command_buffer + 1);
@ -634,18 +634,18 @@ static void ReadCommand() {
// ignore ack // ignore ack
return; return;
} else if (c == 0x03) { } else if (c == 0x03) {
NGLOG_INFO(Debug_GDBStub, "gdb: found break command"); LOG_INFO(Debug_GDBStub, "gdb: found break command");
halt_loop = true; halt_loop = true;
SendSignal(current_thread, SIGTRAP); SendSignal(current_thread, SIGTRAP);
return; return;
} else if (c != GDB_STUB_START) { } else if (c != GDB_STUB_START) {
NGLOG_DEBUG(Debug_GDBStub, "gdb: read invalid byte {:02X}", c); LOG_DEBUG(Debug_GDBStub, "gdb: read invalid byte {:02X}", c);
return; return;
} }
while ((c = ReadByte()) != GDB_STUB_END) { while ((c = ReadByte()) != GDB_STUB_END) {
if (command_length >= sizeof(command_buffer)) { if (command_length >= sizeof(command_buffer)) {
NGLOG_ERROR(Debug_GDBStub, "gdb: command_buffer overflow"); LOG_ERROR(Debug_GDBStub, "gdb: command_buffer overflow");
SendPacket(GDB_STUB_NACK); SendPacket(GDB_STUB_NACK);
return; return;
} }
@ -658,10 +658,9 @@ static void ReadCommand() {
u8 checksum_calculated = CalculateChecksum(command_buffer, command_length); u8 checksum_calculated = CalculateChecksum(command_buffer, command_length);
if (checksum_received != checksum_calculated) { if (checksum_received != checksum_calculated) {
NGLOG_ERROR( LOG_ERROR(Debug_GDBStub,
Debug_GDBStub, "gdb: invalid checksum: calculated {:02X} and read {:02X} for ${}# (length: {})",
"gdb: invalid checksum: calculated {:02X} and read {:02X} for ${}# (length: {})", checksum_calculated, checksum_received, command_buffer, command_length);
checksum_calculated, checksum_received, command_buffer, command_length);
command_length = 0; command_length = 0;
@ -688,7 +687,7 @@ static bool IsDataAvailable() {
t.tv_usec = 0; t.tv_usec = 0;
if (select(gdbserver_socket + 1, &fd_socket, nullptr, nullptr, &t) < 0) { if (select(gdbserver_socket + 1, &fd_socket, nullptr, nullptr, &t) < 0) {
NGLOG_ERROR(Debug_GDBStub, "select failed"); LOG_ERROR(Debug_GDBStub, "select failed");
return false; return false;
} }
@ -801,7 +800,7 @@ static void ReadMemory() {
u64 len = u64 len =
HexToLong(start_offset, static_cast<u64>((command_buffer + command_length) - start_offset)); HexToLong(start_offset, static_cast<u64>((command_buffer + command_length) - start_offset));
NGLOG_DEBUG(Debug_GDBStub, "gdb: addr: {:016X} len: {:016X}", addr, len); LOG_DEBUG(Debug_GDBStub, "gdb: addr: {:016X} len: {:016X}", addr, len);
if (len * 2 > sizeof(reply)) { if (len * 2 > sizeof(reply)) {
SendReply("E01"); SendReply("E01");
@ -888,8 +887,8 @@ static bool CommitBreakpoint(BreakpointType type, PAddr addr, u64 len) {
breakpoint.len = len; breakpoint.len = len;
p.insert({addr, breakpoint}); p.insert({addr, breakpoint});
NGLOG_DEBUG(Debug_GDBStub, "gdb: added {} breakpoint: {:016X} bytes at {:016X}", LOG_DEBUG(Debug_GDBStub, "gdb: added {} breakpoint: {:016X} bytes at {:016X}",
static_cast<int>(type), breakpoint.len, breakpoint.addr); static_cast<int>(type), breakpoint.len, breakpoint.addr);
return true; return true;
} }
@ -996,7 +995,7 @@ void HandlePacket() {
return; return;
} }
NGLOG_DEBUG(Debug_GDBStub, "Packet: {}", command_buffer); LOG_DEBUG(Debug_GDBStub, "Packet: {}", command_buffer);
switch (command_buffer[0]) { switch (command_buffer[0]) {
case 'q': case 'q':
@ -1010,7 +1009,7 @@ void HandlePacket() {
break; break;
case 'k': case 'k':
Shutdown(); Shutdown();
NGLOG_INFO(Debug_GDBStub, "killed by gdb"); LOG_INFO(Debug_GDBStub, "killed by gdb");
return; return;
case 'g': case 'g':
ReadRegisters(); ReadRegisters();
@ -1092,7 +1091,7 @@ static void Init(u16 port) {
breakpoints_write.clear(); breakpoints_write.clear();
// Start gdb server // Start gdb server
NGLOG_INFO(Debug_GDBStub, "Starting GDB server on port {}...", port); LOG_INFO(Debug_GDBStub, "Starting GDB server on port {}...", port);
sockaddr_in saddr_server = {}; sockaddr_in saddr_server = {};
saddr_server.sin_family = AF_INET; saddr_server.sin_family = AF_INET;
@ -1105,28 +1104,28 @@ static void Init(u16 port) {
int tmpsock = static_cast<int>(socket(PF_INET, SOCK_STREAM, 0)); int tmpsock = static_cast<int>(socket(PF_INET, SOCK_STREAM, 0));
if (tmpsock == -1) { if (tmpsock == -1) {
NGLOG_ERROR(Debug_GDBStub, "Failed to create gdb socket"); LOG_ERROR(Debug_GDBStub, "Failed to create gdb socket");
} }
// Set socket to SO_REUSEADDR so it can always bind on the same port // Set socket to SO_REUSEADDR so it can always bind on the same port
int reuse_enabled = 1; int reuse_enabled = 1;
if (setsockopt(tmpsock, SOL_SOCKET, SO_REUSEADDR, (const char*)&reuse_enabled, if (setsockopt(tmpsock, SOL_SOCKET, SO_REUSEADDR, (const char*)&reuse_enabled,
sizeof(reuse_enabled)) < 0) { sizeof(reuse_enabled)) < 0) {
NGLOG_ERROR(Debug_GDBStub, "Failed to set gdb socket option"); LOG_ERROR(Debug_GDBStub, "Failed to set gdb socket option");
} }
const sockaddr* server_addr = reinterpret_cast<const sockaddr*>(&saddr_server); const sockaddr* server_addr = reinterpret_cast<const sockaddr*>(&saddr_server);
socklen_t server_addrlen = sizeof(saddr_server); socklen_t server_addrlen = sizeof(saddr_server);
if (bind(tmpsock, server_addr, server_addrlen) < 0) { if (bind(tmpsock, server_addr, server_addrlen) < 0) {
NGLOG_ERROR(Debug_GDBStub, "Failed to bind gdb socket"); LOG_ERROR(Debug_GDBStub, "Failed to bind gdb socket");
} }
if (listen(tmpsock, 1) < 0) { if (listen(tmpsock, 1) < 0) {
NGLOG_ERROR(Debug_GDBStub, "Failed to listen to gdb socket"); LOG_ERROR(Debug_GDBStub, "Failed to listen to gdb socket");
} }
// Wait for gdb to connect // Wait for gdb to connect
NGLOG_INFO(Debug_GDBStub, "Waiting for gdb to connect..."); LOG_INFO(Debug_GDBStub, "Waiting for gdb to connect...");
sockaddr_in saddr_client; sockaddr_in saddr_client;
sockaddr* client_addr = reinterpret_cast<sockaddr*>(&saddr_client); sockaddr* client_addr = reinterpret_cast<sockaddr*>(&saddr_client);
socklen_t client_addrlen = sizeof(saddr_client); socklen_t client_addrlen = sizeof(saddr_client);
@ -1137,9 +1136,9 @@ static void Init(u16 port) {
halt_loop = false; halt_loop = false;
step_loop = false; step_loop = false;
NGLOG_ERROR(Debug_GDBStub, "Failed to accept gdb client"); LOG_ERROR(Debug_GDBStub, "Failed to accept gdb client");
} else { } else {
NGLOG_INFO(Debug_GDBStub, "Client connected."); LOG_INFO(Debug_GDBStub, "Client connected.");
saddr_client.sin_addr.s_addr = ntohl(saddr_client.sin_addr.s_addr); saddr_client.sin_addr.s_addr = ntohl(saddr_client.sin_addr.s_addr);
} }
@ -1158,7 +1157,7 @@ void Shutdown() {
return; return;
} }
NGLOG_INFO(Debug_GDBStub, "Stopping GDB ..."); LOG_INFO(Debug_GDBStub, "Stopping GDB ...");
if (gdbserver_socket != -1) { if (gdbserver_socket != -1) {
shutdown(gdbserver_socket, SHUT_RDWR); shutdown(gdbserver_socket, SHUT_RDWR);
gdbserver_socket = -1; gdbserver_socket = -1;
@ -1168,7 +1167,7 @@ void Shutdown() {
WSACleanup(); WSACleanup();
#endif #endif
NGLOG_INFO(Debug_GDBStub, "GDB stopped."); LOG_INFO(Debug_GDBStub, "GDB stopped.");
} }
bool IsServerEnabled() { bool IsServerEnabled() {

View File

@ -26,7 +26,7 @@ ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) {
u16 slot = next_free_slot; u16 slot = next_free_slot;
if (slot >= generations.size()) { if (slot >= generations.size()) {
NGLOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use."); LOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use.");
return ERR_OUT_OF_HANDLES; return ERR_OUT_OF_HANDLES;
} }
next_free_slot = generations[slot]; next_free_slot = generations[slot];
@ -48,7 +48,7 @@ ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) {
ResultVal<Handle> HandleTable::Duplicate(Handle handle) { ResultVal<Handle> HandleTable::Duplicate(Handle handle) {
SharedPtr<Object> object = GetGeneric(handle); SharedPtr<Object> object = GetGeneric(handle);
if (object == nullptr) { if (object == nullptr) {
NGLOG_ERROR(Kernel, "Tried to duplicate invalid handle: {:08X}", handle); LOG_ERROR(Kernel, "Tried to duplicate invalid handle: {:08X}", handle);
return ERR_INVALID_HANDLE; return ERR_INVALID_HANDLE;
} }
return Create(std::move(object)); return Create(std::move(object));

View File

@ -120,7 +120,7 @@ void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming) {
std::make_shared<IPC::DomainMessageHeader>(rp.PopRaw<IPC::DomainMessageHeader>()); std::make_shared<IPC::DomainMessageHeader>(rp.PopRaw<IPC::DomainMessageHeader>());
} else { } else {
if (Session()->IsDomain()) if (Session()->IsDomain())
NGLOG_WARNING(IPC, "Domain request has no DomainMessageHeader!"); LOG_WARNING(IPC, "Domain request has no DomainMessageHeader!");
} }
} }
@ -272,15 +272,15 @@ std::vector<u8> HLERequestContext::ReadBuffer(int buffer_index) const {
size_t HLERequestContext::WriteBuffer(const void* buffer, size_t size, int buffer_index) const { size_t HLERequestContext::WriteBuffer(const void* buffer, size_t size, int buffer_index) const {
if (size == 0) { if (size == 0) {
NGLOG_WARNING(Core, "skip empty buffer write"); LOG_WARNING(Core, "skip empty buffer write");
return 0; return 0;
} }
const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[buffer_index].Size()}; const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[buffer_index].Size()};
const size_t buffer_size{GetWriteBufferSize(buffer_index)}; const size_t buffer_size{GetWriteBufferSize(buffer_index)};
if (size > buffer_size) { if (size > buffer_size) {
NGLOG_CRITICAL(Core, "size ({:016X}) is greater than buffer_size ({:016X})", size, LOG_CRITICAL(Core, "size ({:016X}) is greater than buffer_size ({:016X})", size,
buffer_size); buffer_size);
size = buffer_size; // TODO(bunnei): This needs to be HW tested size = buffer_size; // TODO(bunnei): This needs to be HW tested
} }

View File

@ -54,7 +54,7 @@ void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) {
continue; continue;
} else if ((type & 0xF00) == 0xE00) { // 0x0FFF } else if ((type & 0xF00) == 0xE00) { // 0x0FFF
// Allowed interrupts list // Allowed interrupts list
NGLOG_WARNING(Loader, "ExHeader allowed interrupts list ignored"); LOG_WARNING(Loader, "ExHeader allowed interrupts list ignored");
} else if ((type & 0xF80) == 0xF00) { // 0x07FF } else if ((type & 0xF80) == 0xF00) { // 0x07FF
// Allowed syscalls mask // Allowed syscalls mask
unsigned int index = ((descriptor >> 24) & 7) * 24; unsigned int index = ((descriptor >> 24) & 7) * 24;
@ -74,7 +74,7 @@ void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) {
} else if ((type & 0xFFE) == 0xFF8) { // 0x001F } else if ((type & 0xFFE) == 0xFF8) { // 0x001F
// Mapped memory range // Mapped memory range
if (i + 1 >= len || ((kernel_caps[i + 1] >> 20) & 0xFFE) != 0xFF8) { if (i + 1 >= len || ((kernel_caps[i + 1] >> 20) & 0xFFE) != 0xFF8) {
NGLOG_WARNING(Loader, "Incomplete exheader memory range descriptor ignored."); LOG_WARNING(Loader, "Incomplete exheader memory range descriptor ignored.");
continue; continue;
} }
u32 end_desc = kernel_caps[i + 1]; u32 end_desc = kernel_caps[i + 1];
@ -109,9 +109,9 @@ void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) {
int minor = kernel_version & 0xFF; int minor = kernel_version & 0xFF;
int major = (kernel_version >> 8) & 0xFF; int major = (kernel_version >> 8) & 0xFF;
NGLOG_INFO(Loader, "ExHeader kernel version: {}.{}", major, minor); LOG_INFO(Loader, "ExHeader kernel version: {}.{}", major, minor);
} else { } else {
NGLOG_ERROR(Loader, "Unhandled kernel caps descriptor: 0x{:08X}", descriptor); LOG_ERROR(Loader, "Unhandled kernel caps descriptor: 0x{:08X}", descriptor);
} }
} }
} }

View File

@ -29,7 +29,7 @@ SharedPtr<ResourceLimit> ResourceLimit::GetForCategory(ResourceLimitCategory cat
case ResourceLimitCategory::OTHER: case ResourceLimitCategory::OTHER:
return resource_limits[static_cast<u8>(category)]; return resource_limits[static_cast<u8>(category)];
default: default:
NGLOG_CRITICAL(Kernel, "Unknown resource limit category"); LOG_CRITICAL(Kernel, "Unknown resource limit category");
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -55,7 +55,7 @@ s32 ResourceLimit::GetCurrentResourceValue(ResourceType resource) const {
case ResourceType::CPUTime: case ResourceType::CPUTime:
return current_cpu_time; return current_cpu_time;
default: default:
NGLOG_ERROR(Kernel, "Unknown resource type={:08X}", static_cast<u32>(resource)); LOG_ERROR(Kernel, "Unknown resource type={:08X}", static_cast<u32>(resource));
UNIMPLEMENTED(); UNIMPLEMENTED();
return 0; return 0;
} }
@ -84,7 +84,7 @@ u32 ResourceLimit::GetMaxResourceValue(ResourceType resource) const {
case ResourceType::CPUTime: case ResourceType::CPUTime:
return max_cpu_time; return max_cpu_time;
default: default:
NGLOG_ERROR(Kernel, "Unknown resource type={:08X}", static_cast<u32>(resource)); LOG_ERROR(Kernel, "Unknown resource type={:08X}", static_cast<u32>(resource));
UNIMPLEMENTED(); UNIMPLEMENTED();
return 0; return 0;
} }

View File

@ -99,11 +99,11 @@ void Scheduler::Reschedule() {
Thread* next = PopNextReadyThread(); Thread* next = PopNextReadyThread();
if (cur && next) { if (cur && next) {
NGLOG_TRACE(Kernel, "context switch {} -> {}", cur->GetObjectId(), next->GetObjectId()); LOG_TRACE(Kernel, "context switch {} -> {}", cur->GetObjectId(), next->GetObjectId());
} else if (cur) { } else if (cur) {
NGLOG_TRACE(Kernel, "context switch {} -> idle", cur->GetObjectId()); LOG_TRACE(Kernel, "context switch {} -> idle", cur->GetObjectId());
} else if (next) { } else if (next) {
NGLOG_TRACE(Kernel, "context switch idle -> {}", next->GetObjectId()); LOG_TRACE(Kernel, "context switch idle -> {}", next->GetObjectId());
} }
SwitchContext(next); SwitchContext(next);

View File

@ -71,7 +71,7 @@ ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& con
return domain_request_handlers[object_id - 1]->HandleSyncRequest(context); return domain_request_handlers[object_id - 1]->HandleSyncRequest(context);
case IPC::DomainMessageHeader::CommandType::CloseVirtualHandle: { case IPC::DomainMessageHeader::CommandType::CloseVirtualHandle: {
NGLOG_DEBUG(IPC, "CloseVirtualHandle, object_id=0x{:08X}", object_id); LOG_DEBUG(IPC, "CloseVirtualHandle, object_id=0x{:08X}", object_id);
domain_request_handlers[object_id - 1] = nullptr; domain_request_handlers[object_id - 1] = nullptr;
@ -81,8 +81,8 @@ ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& con
} }
} }
NGLOG_CRITICAL(IPC, "Unknown domain command={}", LOG_CRITICAL(IPC, "Unknown domain command={}",
static_cast<int>(domain_message_header->command.Value())); static_cast<int>(domain_message_header->command.Value()));
ASSERT(false); ASSERT(false);
} }

View File

@ -107,16 +107,16 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi
// Error out if the requested permissions don't match what the creator process allows. // Error out if the requested permissions don't match what the creator process allows.
if (static_cast<u32>(permissions) & ~static_cast<u32>(own_other_permissions)) { if (static_cast<u32>(permissions) & ~static_cast<u32>(own_other_permissions)) {
NGLOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match", LOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match",
GetObjectId(), address, name); GetObjectId(), address, name);
return ERR_INVALID_COMBINATION; return ERR_INVALID_COMBINATION;
} }
// Error out if the provided permissions are not compatible with what the creator process needs. // Error out if the provided permissions are not compatible with what the creator process needs.
if (other_permissions != MemoryPermission::DontCare && if (other_permissions != MemoryPermission::DontCare &&
static_cast<u32>(this->permissions) & ~static_cast<u32>(other_permissions)) { static_cast<u32>(this->permissions) & ~static_cast<u32>(other_permissions)) {
NGLOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match", LOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match",
GetObjectId(), address, name); GetObjectId(), address, name);
return ERR_WRONG_PERMISSION; return ERR_WRONG_PERMISSION;
} }
@ -131,7 +131,7 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi
auto result = target_process->vm_manager.MapMemoryBlock( auto result = target_process->vm_manager.MapMemoryBlock(
target_address, backing_block, backing_block_offset, size, MemoryState::Shared); target_address, backing_block, backing_block_offset, size, MemoryState::Shared);
if (result.Failed()) { if (result.Failed()) {
NGLOG_ERROR( LOG_ERROR(
Kernel, Kernel,
"cannot map id={}, target_address=0x{:X} name={}, error mapping to virtual memory", "cannot map id={}, target_address=0x{:X} name={}, error mapping to virtual memory",
GetObjectId(), target_address, name); GetObjectId(), target_address, name);

View File

@ -32,7 +32,7 @@ namespace Kernel {
/// Set the process heap to a given Size. It can both extend and shrink the heap. /// Set the process heap to a given Size. It can both extend and shrink the heap.
static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) {
NGLOG_TRACE(Kernel_SVC, "called, heap_size=0x{:X}", heap_size); LOG_TRACE(Kernel_SVC, "called, heap_size=0x{:X}", heap_size);
auto& process = *Core::CurrentProcess(); auto& process = *Core::CurrentProcess();
CASCADE_RESULT(*heap_addr, CASCADE_RESULT(*heap_addr,
process.HeapAllocate(Memory::HEAP_VADDR, heap_size, VMAPermission::ReadWrite)); process.HeapAllocate(Memory::HEAP_VADDR, heap_size, VMAPermission::ReadWrite));
@ -40,21 +40,21 @@ static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) {
} }
static ResultCode SetMemoryAttribute(VAddr addr, u64 size, u32 state0, u32 state1) { static ResultCode SetMemoryAttribute(VAddr addr, u64 size, u32 state0, u32 state1) {
NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, addr=0x{:X}", addr); LOG_WARNING(Kernel_SVC, "(STUBBED) called, addr=0x{:X}", addr);
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
/// Maps a memory range into a different range. /// Maps a memory range into a different range.
static ResultCode MapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { static ResultCode MapMemory(VAddr dst_addr, VAddr src_addr, u64 size) {
NGLOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr,
src_addr, size); src_addr, size);
return Core::CurrentProcess()->MirrorMemory(dst_addr, src_addr, size); return Core::CurrentProcess()->MirrorMemory(dst_addr, src_addr, size);
} }
/// Unmaps a region that was previously mapped with svcMapMemory /// Unmaps a region that was previously mapped with svcMapMemory
static ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { static ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size) {
NGLOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr,
src_addr, size); src_addr, size);
return Core::CurrentProcess()->UnmapMemory(dst_addr, src_addr, size); return Core::CurrentProcess()->UnmapMemory(dst_addr, src_addr, size);
} }
@ -69,11 +69,11 @@ static ResultCode ConnectToNamedPort(Handle* out_handle, VAddr port_name_address
if (port_name.size() > PortNameMaxLength) if (port_name.size() > PortNameMaxLength)
return ERR_PORT_NAME_TOO_LONG; return ERR_PORT_NAME_TOO_LONG;
NGLOG_TRACE(Kernel_SVC, "called port_name={}", port_name); LOG_TRACE(Kernel_SVC, "called port_name={}", port_name);
auto it = Service::g_kernel_named_ports.find(port_name); auto it = Service::g_kernel_named_ports.find(port_name);
if (it == Service::g_kernel_named_ports.end()) { if (it == Service::g_kernel_named_ports.end()) {
NGLOG_WARNING(Kernel_SVC, "tried to connect to unknown port: {}", port_name); LOG_WARNING(Kernel_SVC, "tried to connect to unknown port: {}", port_name);
return ERR_NOT_FOUND; return ERR_NOT_FOUND;
} }
@ -91,11 +91,11 @@ static ResultCode ConnectToNamedPort(Handle* out_handle, VAddr port_name_address
static ResultCode SendSyncRequest(Handle handle) { static ResultCode SendSyncRequest(Handle handle) {
SharedPtr<ClientSession> session = g_handle_table.Get<ClientSession>(handle); SharedPtr<ClientSession> session = g_handle_table.Get<ClientSession>(handle);
if (!session) { if (!session) {
NGLOG_ERROR(Kernel_SVC, "called with invalid handle=0x{:08X}", handle); LOG_ERROR(Kernel_SVC, "called with invalid handle=0x{:08X}", handle);
return ERR_INVALID_HANDLE; return ERR_INVALID_HANDLE;
} }
NGLOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName()); LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName());
Core::System::GetInstance().PrepareReschedule(); Core::System::GetInstance().PrepareReschedule();
@ -106,7 +106,7 @@ static ResultCode SendSyncRequest(Handle handle) {
/// Get the ID for the specified thread. /// Get the ID for the specified thread.
static ResultCode GetThreadId(u32* thread_id, Handle thread_handle) { static ResultCode GetThreadId(u32* thread_id, Handle thread_handle) {
NGLOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle); LOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle);
const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle);
if (!thread) { if (!thread) {
@ -119,7 +119,7 @@ static ResultCode GetThreadId(u32* thread_id, Handle thread_handle) {
/// Get the ID of the specified process /// Get the ID of the specified process
static ResultCode GetProcessId(u32* process_id, Handle process_handle) { static ResultCode GetProcessId(u32* process_id, Handle process_handle) {
NGLOG_TRACE(Kernel_SVC, "called process=0x{:08X}", process_handle); LOG_TRACE(Kernel_SVC, "called process=0x{:08X}", process_handle);
const SharedPtr<Process> process = g_handle_table.Get<Process>(process_handle); const SharedPtr<Process> process = g_handle_table.Get<Process>(process_handle);
if (!process) { if (!process) {
@ -149,8 +149,8 @@ static bool DefaultThreadWakeupCallback(ThreadWakeupReason reason, SharedPtr<Thr
/// Wait for the given handles to synchronize, timeout after the specified nanoseconds /// Wait for the given handles to synchronize, timeout after the specified nanoseconds
static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64 handle_count, static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64 handle_count,
s64 nano_seconds) { s64 nano_seconds) {
NGLOG_TRACE(Kernel_SVC, "called handles_address=0x{:X}, handle_count={}, nano_seconds={}", LOG_TRACE(Kernel_SVC, "called handles_address=0x{:X}, handle_count={}, nano_seconds={}",
handles_address, handle_count, nano_seconds); handles_address, handle_count, nano_seconds);
if (!Memory::IsValidVirtualAddress(handles_address)) if (!Memory::IsValidVirtualAddress(handles_address))
return ERR_INVALID_POINTER; return ERR_INVALID_POINTER;
@ -210,7 +210,7 @@ static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64
/// Resumes a thread waiting on WaitSynchronization /// Resumes a thread waiting on WaitSynchronization
static ResultCode CancelSynchronization(Handle thread_handle) { static ResultCode CancelSynchronization(Handle thread_handle) {
NGLOG_TRACE(Kernel_SVC, "called thread=0x{:X}", thread_handle); LOG_TRACE(Kernel_SVC, "called thread=0x{:X}", thread_handle);
const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle);
if (!thread) { if (!thread) {
@ -227,24 +227,24 @@ static ResultCode CancelSynchronization(Handle thread_handle) {
/// Attempts to locks a mutex, creating it if it does not already exist /// Attempts to locks a mutex, creating it if it does not already exist
static ResultCode ArbitrateLock(Handle holding_thread_handle, VAddr mutex_addr, static ResultCode ArbitrateLock(Handle holding_thread_handle, VAddr mutex_addr,
Handle requesting_thread_handle) { Handle requesting_thread_handle) {
NGLOG_TRACE(Kernel_SVC, LOG_TRACE(Kernel_SVC,
"called holding_thread_handle=0x{:08X}, mutex_addr=0x{:X}, " "called holding_thread_handle=0x{:08X}, mutex_addr=0x{:X}, "
"requesting_current_thread_handle=0x{:08X}", "requesting_current_thread_handle=0x{:08X}",
holding_thread_handle, mutex_addr, requesting_thread_handle); holding_thread_handle, mutex_addr, requesting_thread_handle);
return Mutex::TryAcquire(mutex_addr, holding_thread_handle, requesting_thread_handle); return Mutex::TryAcquire(mutex_addr, holding_thread_handle, requesting_thread_handle);
} }
/// Unlock a mutex /// Unlock a mutex
static ResultCode ArbitrateUnlock(VAddr mutex_addr) { static ResultCode ArbitrateUnlock(VAddr mutex_addr) {
NGLOG_TRACE(Kernel_SVC, "called mutex_addr=0x{:X}", mutex_addr); LOG_TRACE(Kernel_SVC, "called mutex_addr=0x{:X}", mutex_addr);
return Mutex::Release(mutex_addr); return Mutex::Release(mutex_addr);
} }
/// Break program execution /// Break program execution
static void Break(u64 unk_0, u64 unk_1, u64 unk_2) { static void Break(u64 unk_0, u64 unk_1, u64 unk_2) {
NGLOG_CRITICAL(Debug_Emulated, "Emulated program broke execution!"); LOG_CRITICAL(Debug_Emulated, "Emulated program broke execution!");
ASSERT(false); ASSERT(false);
} }
@ -252,13 +252,13 @@ static void Break(u64 unk_0, u64 unk_1, u64 unk_2) {
static void OutputDebugString(VAddr address, s32 len) { static void OutputDebugString(VAddr address, s32 len) {
std::string str(len, '\0'); std::string str(len, '\0');
Memory::ReadBlock(address, str.data(), str.size()); Memory::ReadBlock(address, str.data(), str.size());
NGLOG_DEBUG(Debug_Emulated, "{}", str); LOG_DEBUG(Debug_Emulated, "{}", str);
} }
/// Gets system/memory information for the current process /// Gets system/memory information for the current process
static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) { static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) {
NGLOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id, LOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id,
info_sub_id, handle); info_sub_id, handle);
auto& vm_manager = Core::CurrentProcess()->vm_manager; auto& vm_manager = Core::CurrentProcess()->vm_manager;
@ -309,17 +309,17 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
*result = Core::CurrentProcess()->is_virtual_address_memory_enabled; *result = Core::CurrentProcess()->is_virtual_address_memory_enabled;
break; break;
case GetInfoType::TitleId: case GetInfoType::TitleId:
NGLOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query titleid, returned 0"); LOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query titleid, returned 0");
*result = 0; *result = 0;
break; break;
case GetInfoType::PrivilegedProcessId: case GetInfoType::PrivilegedProcessId:
NGLOG_WARNING(Kernel_SVC, LOG_WARNING(Kernel_SVC,
"(STUBBED) Attempted to query privileged process id bounds, returned 0"); "(STUBBED) Attempted to query privileged process id bounds, returned 0");
*result = 0; *result = 0;
break; break;
case GetInfoType::UserExceptionContextAddr: case GetInfoType::UserExceptionContextAddr:
NGLOG_WARNING(Kernel_SVC, LOG_WARNING(Kernel_SVC,
"(STUBBED) Attempted to query user exception context address, returned 0"); "(STUBBED) Attempted to query user exception context address, returned 0");
*result = 0; *result = 0;
break; break;
default: default:
@ -331,14 +331,13 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
/// Sets the thread activity /// Sets the thread activity
static ResultCode SetThreadActivity(Handle handle, u32 unknown) { static ResultCode SetThreadActivity(Handle handle, u32 unknown) {
NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x{:08X}, unknown=0x{:08X}", handle, LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x{:08X}, unknown=0x{:08X}", handle, unknown);
unknown);
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
/// Gets the thread context /// Gets the thread context
static ResultCode GetThreadContext(Handle handle, VAddr addr) { static ResultCode GetThreadContext(Handle handle, VAddr addr) {
NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x{:08X}, addr=0x{:X}", handle, addr); LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x{:08X}, addr=0x{:X}", handle, addr);
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
@ -377,16 +376,15 @@ static ResultCode SetThreadPriority(Handle handle, u32 priority) {
/// Get which CPU core is executing the current thread /// Get which CPU core is executing the current thread
static u32 GetCurrentProcessorNumber() { static u32 GetCurrentProcessorNumber() {
NGLOG_TRACE(Kernel_SVC, "called"); LOG_TRACE(Kernel_SVC, "called");
return GetCurrentThread()->processor_id; return GetCurrentThread()->processor_id;
} }
static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 size, static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 size,
u32 permissions) { u32 permissions) {
NGLOG_TRACE( LOG_TRACE(Kernel_SVC,
Kernel_SVC, "called, shared_memory_handle=0x{:X}, addr=0x{:X}, size=0x{:X}, permissions=0x{:08X}",
"called, shared_memory_handle=0x{:X}, addr=0x{:X}, size=0x{:X}, permissions=0x{:08X}", shared_memory_handle, addr, size, permissions);
shared_memory_handle, addr, size, permissions);
SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle); SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle);
if (!shared_memory) { if (!shared_memory) {
@ -406,15 +404,15 @@ static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 s
return shared_memory->Map(Core::CurrentProcess().get(), addr, permissions_type, return shared_memory->Map(Core::CurrentProcess().get(), addr, permissions_type,
MemoryPermission::DontCare); MemoryPermission::DontCare);
default: default:
NGLOG_ERROR(Kernel_SVC, "unknown permissions=0x{:08X}", permissions); LOG_ERROR(Kernel_SVC, "unknown permissions=0x{:08X}", permissions);
} }
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
static ResultCode UnmapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 size) { static ResultCode UnmapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 size) {
NGLOG_WARNING(Kernel_SVC, "called, shared_memory_handle=0x{:08X}, addr=0x{:X}, size=0x{:X}", LOG_WARNING(Kernel_SVC, "called, shared_memory_handle=0x{:08X}, addr=0x{:X}, size=0x{:X}",
shared_memory_handle, addr, size); shared_memory_handle, addr, size);
SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle); SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle);
@ -442,19 +440,19 @@ static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* /*page_i
memory_info->type = static_cast<u32>(vma->second.meminfo_state); memory_info->type = static_cast<u32>(vma->second.meminfo_state);
} }
NGLOG_TRACE(Kernel_SVC, "called process=0x{:08X} addr={:X}", process_handle, addr); LOG_TRACE(Kernel_SVC, "called process=0x{:08X} addr={:X}", process_handle, addr);
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
/// Query memory /// Query memory
static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, VAddr addr) { static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, VAddr addr) {
NGLOG_TRACE(Kernel_SVC, "called, addr={:X}", addr); LOG_TRACE(Kernel_SVC, "called, addr={:X}", addr);
return QueryProcessMemory(memory_info, page_info, CurrentProcess, addr); return QueryProcessMemory(memory_info, page_info, CurrentProcess, addr);
} }
/// Exits the current process /// Exits the current process
static void ExitProcess() { static void ExitProcess() {
NGLOG_INFO(Kernel_SVC, "Process {} exiting", Core::CurrentProcess()->process_id); LOG_INFO(Kernel_SVC, "Process {} exiting", Core::CurrentProcess()->process_id);
ASSERT_MSG(Core::CurrentProcess()->status == ProcessStatus::Running, ASSERT_MSG(Core::CurrentProcess()->status == ProcessStatus::Running,
"Process has already exited"); "Process has already exited");
@ -530,17 +528,17 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V
Core::System::GetInstance().PrepareReschedule(); Core::System::GetInstance().PrepareReschedule();
Core::System::GetInstance().CpuCore(thread->processor_id).PrepareReschedule(); Core::System::GetInstance().CpuCore(thread->processor_id).PrepareReschedule();
NGLOG_TRACE(Kernel_SVC, LOG_TRACE(Kernel_SVC,
"called entrypoint=0x{:08X} ({}), arg=0x{:08X}, stacktop=0x{:08X}, " "called entrypoint=0x{:08X} ({}), arg=0x{:08X}, stacktop=0x{:08X}, "
"threadpriority=0x{:08X}, processorid=0x{:08X} : created handle=0x{:08X}", "threadpriority=0x{:08X}, processorid=0x{:08X} : created handle=0x{:08X}",
entry_point, name, arg, stack_top, priority, processor_id, *out_handle); entry_point, name, arg, stack_top, priority, processor_id, *out_handle);
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
/// Starts the thread for the provided handle /// Starts the thread for the provided handle
static ResultCode StartThread(Handle thread_handle) { static ResultCode StartThread(Handle thread_handle) {
NGLOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle); LOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle);
const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle);
if (!thread) { if (!thread) {
@ -557,7 +555,7 @@ static ResultCode StartThread(Handle thread_handle) {
/// Called when a thread exits /// Called when a thread exits
static void ExitThread() { static void ExitThread() {
NGLOG_TRACE(Kernel_SVC, "called, pc=0x{:08X}", Core::CurrentArmInterface().GetPC()); LOG_TRACE(Kernel_SVC, "called, pc=0x{:08X}", Core::CurrentArmInterface().GetPC());
ExitCurrentThread(); ExitCurrentThread();
Core::System::GetInstance().PrepareReschedule(); Core::System::GetInstance().PrepareReschedule();
@ -565,7 +563,7 @@ static void ExitThread() {
/// Sleep the current thread /// Sleep the current thread
static void SleepThread(s64 nanoseconds) { static void SleepThread(s64 nanoseconds) {
NGLOG_TRACE(Kernel_SVC, "called nanoseconds={}", nanoseconds); LOG_TRACE(Kernel_SVC, "called nanoseconds={}", nanoseconds);
// Don't attempt to yield execution if there are no available threads to run, // Don't attempt to yield execution if there are no available threads to run,
// this way we avoid a useless reschedule to the idle thread. // this way we avoid a useless reschedule to the idle thread.
@ -584,7 +582,7 @@ static void SleepThread(s64 nanoseconds) {
/// Wait process wide key atomic /// Wait process wide key atomic
static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_variable_addr, static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_variable_addr,
Handle thread_handle, s64 nano_seconds) { Handle thread_handle, s64 nano_seconds) {
NGLOG_TRACE( LOG_TRACE(
Kernel_SVC, Kernel_SVC,
"called mutex_addr={:X}, condition_variable_addr={:X}, thread_handle=0x{:08X}, timeout={}", "called mutex_addr={:X}, condition_variable_addr={:X}, thread_handle=0x{:08X}, timeout={}",
mutex_addr, condition_variable_addr, thread_handle, nano_seconds); mutex_addr, condition_variable_addr, thread_handle, nano_seconds);
@ -611,8 +609,8 @@ static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_var
/// Signal process wide key /// Signal process wide key
static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target) { static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target) {
NGLOG_TRACE(Kernel_SVC, "called, condition_variable_addr=0x{:X}, target=0x{:08X}", LOG_TRACE(Kernel_SVC, "called, condition_variable_addr=0x{:X}, target=0x{:08X}",
condition_variable_addr, target); condition_variable_addr, target);
auto RetrieveWaitingThreads = auto RetrieveWaitingThreads =
[](size_t core_index, std::vector<SharedPtr<Thread>>& waiting_threads, VAddr condvar_addr) { [](size_t core_index, std::vector<SharedPtr<Thread>>& waiting_threads, VAddr condvar_addr) {
@ -692,8 +690,8 @@ static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target
// Wait for an address (via Address Arbiter) // Wait for an address (via Address Arbiter)
static ResultCode WaitForAddress(VAddr address, u32 type, s32 value, s64 timeout) { static ResultCode WaitForAddress(VAddr address, u32 type, s32 value, s64 timeout) {
NGLOG_WARNING(Kernel_SVC, "called, address=0x{:X}, type=0x{:X}, value=0x{:X}, timeout={}", LOG_WARNING(Kernel_SVC, "called, address=0x{:X}, type=0x{:X}, value=0x{:X}, timeout={}",
address, type, value, timeout); address, type, value, timeout);
// If the passed address is a kernel virtual address, return invalid memory state. // If the passed address is a kernel virtual address, return invalid memory state.
if (Memory::IsKernelVirtualAddress(address)) { if (Memory::IsKernelVirtualAddress(address)) {
return ERR_INVALID_ADDRESS_STATE; return ERR_INVALID_ADDRESS_STATE;
@ -717,9 +715,8 @@ static ResultCode WaitForAddress(VAddr address, u32 type, s32 value, s64 timeout
// Signals to an address (via Address Arbiter) // Signals to an address (via Address Arbiter)
static ResultCode SignalToAddress(VAddr address, u32 type, s32 value, s32 num_to_wake) { static ResultCode SignalToAddress(VAddr address, u32 type, s32 value, s32 num_to_wake) {
NGLOG_WARNING(Kernel_SVC, LOG_WARNING(Kernel_SVC, "called, address=0x{:X}, type=0x{:X}, value=0x{:X}, num_to_wake=0x{:X}",
"called, address=0x{:X}, type=0x{:X}, value=0x{:X}, num_to_wake=0x{:X}", address, address, type, value, num_to_wake);
type, value, num_to_wake);
// If the passed address is a kernel virtual address, return invalid memory state. // If the passed address is a kernel virtual address, return invalid memory state.
if (Memory::IsKernelVirtualAddress(address)) { if (Memory::IsKernelVirtualAddress(address)) {
return ERR_INVALID_ADDRESS_STATE; return ERR_INVALID_ADDRESS_STATE;
@ -754,13 +751,13 @@ static u64 GetSystemTick() {
/// Close a handle /// Close a handle
static ResultCode CloseHandle(Handle handle) { static ResultCode CloseHandle(Handle handle) {
NGLOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle); LOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle);
return g_handle_table.Close(handle); return g_handle_table.Close(handle);
} }
/// Reset an event /// Reset an event
static ResultCode ResetSignal(Handle handle) { static ResultCode ResetSignal(Handle handle) {
NGLOG_WARNING(Kernel_SVC, "(STUBBED) called handle 0x{:08X}", handle); LOG_WARNING(Kernel_SVC, "(STUBBED) called handle 0x{:08X}", handle);
auto event = g_handle_table.Get<Event>(handle); auto event = g_handle_table.Get<Event>(handle);
ASSERT(event != nullptr); ASSERT(event != nullptr);
event->Clear(); event->Clear();
@ -769,14 +766,14 @@ static ResultCode ResetSignal(Handle handle) {
/// Creates a TransferMemory object /// Creates a TransferMemory object
static ResultCode CreateTransferMemory(Handle* handle, VAddr addr, u64 size, u32 permissions) { static ResultCode CreateTransferMemory(Handle* handle, VAddr addr, u64 size, u32 permissions) {
NGLOG_WARNING(Kernel_SVC, "(STUBBED) called addr=0x{:X}, size=0x{:X}, perms=0x{:08X}", addr, LOG_WARNING(Kernel_SVC, "(STUBBED) called addr=0x{:X}, size=0x{:X}, perms=0x{:08X}", addr, size,
size, permissions); permissions);
*handle = 0; *handle = 0;
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
static ResultCode GetThreadCoreMask(Handle thread_handle, u32* core, u64* mask) { static ResultCode GetThreadCoreMask(Handle thread_handle, u32* core, u64* mask) {
NGLOG_TRACE(Kernel_SVC, "called, handle=0x{:08X}", thread_handle); LOG_TRACE(Kernel_SVC, "called, handle=0x{:08X}", thread_handle);
const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle);
if (!thread) { if (!thread) {
@ -790,8 +787,8 @@ static ResultCode GetThreadCoreMask(Handle thread_handle, u32* core, u64* mask)
} }
static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) { static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) {
NGLOG_DEBUG(Kernel_SVC, "called, handle=0x{:08X}, mask=0x{:16X}, core=0x{:X}", thread_handle, LOG_DEBUG(Kernel_SVC, "called, handle=0x{:08X}, mask=0x{:16X}, core=0x{:X}", thread_handle,
mask, core); mask, core);
const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle);
if (!thread) { if (!thread) {
@ -830,8 +827,8 @@ static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) {
static ResultCode CreateSharedMemory(Handle* handle, u64 size, u32 local_permissions, static ResultCode CreateSharedMemory(Handle* handle, u64 size, u32 local_permissions,
u32 remote_permissions) { u32 remote_permissions) {
NGLOG_TRACE(Kernel_SVC, "called, size=0x{:X}, localPerms=0x{:08X}, remotePerms=0x{:08X}", size, LOG_TRACE(Kernel_SVC, "called, size=0x{:X}, localPerms=0x{:08X}, remotePerms=0x{:08X}", size,
local_permissions, remote_permissions); local_permissions, remote_permissions);
auto sharedMemHandle = auto sharedMemHandle =
SharedMemory::Create(g_handle_table.Get<Process>(KernelHandle::CurrentProcess), size, SharedMemory::Create(g_handle_table.Get<Process>(KernelHandle::CurrentProcess), size,
static_cast<MemoryPermission>(local_permissions), static_cast<MemoryPermission>(local_permissions),
@ -842,7 +839,7 @@ static ResultCode CreateSharedMemory(Handle* handle, u64 size, u32 local_permiss
} }
static ResultCode ClearEvent(Handle handle) { static ResultCode ClearEvent(Handle handle) {
NGLOG_TRACE(Kernel_SVC, "called, event=0x{:08X}", handle); LOG_TRACE(Kernel_SVC, "called, event=0x{:08X}", handle);
SharedPtr<Event> evt = g_handle_table.Get<Event>(handle); SharedPtr<Event> evt = g_handle_table.Get<Event>(handle);
if (evt == nullptr) if (evt == nullptr)
@ -994,7 +991,7 @@ static const FunctionDef SVC_Table[] = {
static const FunctionDef* GetSVCInfo(u32 func_num) { static const FunctionDef* GetSVCInfo(u32 func_num) {
if (func_num >= std::size(SVC_Table)) { if (func_num >= std::size(SVC_Table)) {
NGLOG_ERROR(Kernel_SVC, "Unknown svc=0x{:02X}", func_num); LOG_ERROR(Kernel_SVC, "Unknown svc=0x{:02X}", func_num);
return nullptr; return nullptr;
} }
return &SVC_Table[func_num]; return &SVC_Table[func_num];
@ -1013,10 +1010,10 @@ void CallSVC(u32 immediate) {
if (info->func) { if (info->func) {
info->func(); info->func();
} else { } else {
NGLOG_CRITICAL(Kernel_SVC, "Unimplemented SVC function {}(..)", info->name); LOG_CRITICAL(Kernel_SVC, "Unimplemented SVC function {}(..)", info->name);
} }
} else { } else {
NGLOG_CRITICAL(Kernel_SVC, "Unknown SVC function 0x{:X}", immediate); LOG_CRITICAL(Kernel_SVC, "Unknown SVC function 0x{:X}", immediate);
} }
} }

View File

@ -104,7 +104,7 @@ static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) {
const auto proper_handle = static_cast<Handle>(thread_handle); const auto proper_handle = static_cast<Handle>(thread_handle);
SharedPtr<Thread> thread = wakeup_callback_handle_table.Get<Thread>(proper_handle); SharedPtr<Thread> thread = wakeup_callback_handle_table.Get<Thread>(proper_handle);
if (thread == nullptr) { if (thread == nullptr) {
NGLOG_CRITICAL(Kernel, "Callback fired for invalid thread {:08X}", proper_handle); LOG_CRITICAL(Kernel, "Callback fired for invalid thread {:08X}", proper_handle);
return; return;
} }
@ -290,19 +290,19 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
SharedPtr<Process> owner_process) { SharedPtr<Process> owner_process) {
// Check if priority is in ranged. Lowest priority -> highest priority id. // Check if priority is in ranged. Lowest priority -> highest priority id.
if (priority > THREADPRIO_LOWEST) { if (priority > THREADPRIO_LOWEST) {
NGLOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority); LOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority);
return ERR_OUT_OF_RANGE; return ERR_OUT_OF_RANGE;
} }
if (processor_id > THREADPROCESSORID_MAX) { if (processor_id > THREADPROCESSORID_MAX) {
NGLOG_ERROR(Kernel_SVC, "Invalid processor id: {}", processor_id); LOG_ERROR(Kernel_SVC, "Invalid processor id: {}", processor_id);
return ERR_OUT_OF_RANGE_KERNEL; return ERR_OUT_OF_RANGE_KERNEL;
} }
// TODO(yuriks): Other checks, returning 0xD9001BEA // TODO(yuriks): Other checks, returning 0xD9001BEA
if (!Memory::IsValidVirtualAddress(*owner_process, entry_point)) { if (!Memory::IsValidVirtualAddress(*owner_process, entry_point)) {
NGLOG_ERROR(Kernel_SVC, "(name={}): invalid entry {:016X}", name, entry_point); LOG_ERROR(Kernel_SVC, "(name={}): invalid entry {:016X}", name, entry_point);
// TODO (bunnei): Find the correct error code to use here // TODO (bunnei): Find the correct error code to use here
return ResultCode(-1); return ResultCode(-1);
} }
@ -343,8 +343,8 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
auto& linheap_memory = memory_region->linear_heap_memory; auto& linheap_memory = memory_region->linear_heap_memory;
if (linheap_memory->size() + Memory::PAGE_SIZE > memory_region->size) { if (linheap_memory->size() + Memory::PAGE_SIZE > memory_region->size) {
NGLOG_ERROR(Kernel_SVC, LOG_ERROR(Kernel_SVC,
"Not enough space in region to allocate a new TLS page for thread"); "Not enough space in region to allocate a new TLS page for thread");
return ERR_OUT_OF_MEMORY; return ERR_OUT_OF_MEMORY;
} }

View File

@ -78,7 +78,7 @@ void Timer::WakeupAllWaitingThreads() {
} }
void Timer::Signal(int cycles_late) { void Timer::Signal(int cycles_late) {
NGLOG_TRACE(Kernel, "Timer {} fired", GetObjectId()); LOG_TRACE(Kernel, "Timer {} fired", GetObjectId());
signaled = true; signaled = true;
@ -98,7 +98,7 @@ static void TimerCallback(u64 timer_handle, int cycles_late) {
timer_callback_handle_table.Get<Timer>(static_cast<Handle>(timer_handle)); timer_callback_handle_table.Get<Timer>(static_cast<Handle>(timer_handle));
if (timer == nullptr) { if (timer == nullptr) {
NGLOG_CRITICAL(Kernel, "Callback fired for invalid timer {:016X}", timer_handle); LOG_CRITICAL(Kernel, "Callback fired for invalid timer {:016X}", timer_handle);
return; return;
} }

View File

@ -242,12 +242,12 @@ void VMManager::RefreshMemoryBlockMappings(const std::vector<u8>* block) {
void VMManager::LogLayout() const { void VMManager::LogLayout() const {
for (const auto& p : vma_map) { for (const auto& p : vma_map) {
const VirtualMemoryArea& vma = p.second; const VirtualMemoryArea& vma = p.second;
NGLOG_DEBUG(Kernel, "{:016X} - {:016X} size: {:016X} {}{}{} {}", vma.base, LOG_DEBUG(Kernel, "{:016X} - {:016X} size: {:016X} {}{}{} {}", vma.base,
vma.base + vma.size, vma.size, vma.base + vma.size, vma.size,
(u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-', (u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-',
(u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-', (u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-',
(u8)vma.permissions & (u8)VMAPermission::Execute ? 'X' : '-', (u8)vma.permissions & (u8)VMAPermission::Execute ? 'X' : '-',
GetMemoryStateName(vma.meminfo_state)); GetMemoryStateName(vma.meminfo_state));
} }
} }
@ -392,22 +392,22 @@ void VMManager::UpdatePageTableForVMA(const VirtualMemoryArea& vma) {
} }
u64 VMManager::GetTotalMemoryUsage() { u64 VMManager::GetTotalMemoryUsage() {
NGLOG_WARNING(Kernel, "(STUBBED) called"); LOG_WARNING(Kernel, "(STUBBED) called");
return 0xF8000000; return 0xF8000000;
} }
u64 VMManager::GetTotalHeapUsage() { u64 VMManager::GetTotalHeapUsage() {
NGLOG_WARNING(Kernel, "(STUBBED) called"); LOG_WARNING(Kernel, "(STUBBED) called");
return 0x0; return 0x0;
} }
VAddr VMManager::GetAddressSpaceBaseAddr() { VAddr VMManager::GetAddressSpaceBaseAddr() {
NGLOG_WARNING(Kernel, "(STUBBED) called"); LOG_WARNING(Kernel, "(STUBBED) called");
return 0x8000000; return 0x8000000;
} }
u64 VMManager::GetAddressSpaceSize() { u64 VMManager::GetAddressSpaceSize() {
NGLOG_WARNING(Kernel, "(STUBBED) called"); LOG_WARNING(Kernel, "(STUBBED) called");
return MAX_ADDRESS; return MAX_ADDRESS;
} }

View File

@ -47,7 +47,7 @@ public:
private: private:
void GetBase(Kernel::HLERequestContext& ctx) { void GetBase(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_ACC, "(STUBBED) called"); LOG_WARNING(Service_ACC, "(STUBBED) called");
ProfileBase profile_base{}; ProfileBase profile_base{};
IPC::ResponseBuilder rb{ctx, 16}; IPC::ResponseBuilder rb{ctx, 16};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -72,14 +72,14 @@ public:
private: private:
void CheckAvailability(Kernel::HLERequestContext& ctx) { void CheckAvailability(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_ACC, "(STUBBED) called"); LOG_WARNING(Service_ACC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(true); // TODO: Check when this is supposed to return true and when not rb.Push(true); // TODO: Check when this is supposed to return true and when not
} }
void GetAccountId(Kernel::HLERequestContext& ctx) { void GetAccountId(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_ACC, "(STUBBED) called"); LOG_WARNING(Service_ACC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u64>(0x12345678ABCDEF); rb.Push<u64>(0x12345678ABCDEF);
@ -87,14 +87,14 @@ private:
}; };
void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) { void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_ACC, "(STUBBED) called"); LOG_WARNING(Service_ACC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(true); // TODO: Check when this is supposed to return true and when not rb.Push(true); // TODO: Check when this is supposed to return true and when not
} }
void Module::Interface::ListAllUsers(Kernel::HLERequestContext& ctx) { void Module::Interface::ListAllUsers(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_ACC, "(STUBBED) called"); LOG_WARNING(Service_ACC, "(STUBBED) called");
constexpr std::array<u128, 10> user_ids{DEFAULT_USER_ID}; constexpr std::array<u128, 10> user_ids{DEFAULT_USER_ID};
ctx.WriteBuffer(user_ids.data(), user_ids.size()); ctx.WriteBuffer(user_ids.data(), user_ids.size());
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
@ -102,7 +102,7 @@ void Module::Interface::ListAllUsers(Kernel::HLERequestContext& ctx) {
} }
void Module::Interface::ListOpenUsers(Kernel::HLERequestContext& ctx) { void Module::Interface::ListOpenUsers(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_ACC, "(STUBBED) called"); LOG_WARNING(Service_ACC, "(STUBBED) called");
constexpr std::array<u128, 10> user_ids{DEFAULT_USER_ID}; constexpr std::array<u128, 10> user_ids{DEFAULT_USER_ID};
ctx.WriteBuffer(user_ids.data(), user_ids.size()); ctx.WriteBuffer(user_ids.data(), user_ids.size());
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
@ -113,11 +113,11 @@ void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IProfile>(); rb.PushIpcInterface<IProfile>();
NGLOG_DEBUG(Service_ACC, "called"); LOG_DEBUG(Service_ACC, "called");
} }
void Module::Interface::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) { void Module::Interface::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_ACC, "(STUBBED) called"); LOG_WARNING(Service_ACC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
@ -126,11 +126,11 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IManagerForApplication>(); rb.PushIpcInterface<IManagerForApplication>();
NGLOG_DEBUG(Service_ACC, "called"); LOG_DEBUG(Service_ACC, "called");
} }
void Module::Interface::GetLastOpenedUser(Kernel::HLERequestContext& ctx) { void Module::Interface::GetLastOpenedUser(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_ACC, "(STUBBED) called"); LOG_WARNING(Service_ACC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 6}; IPC::ResponseBuilder rb{ctx, 6};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushRaw(DEFAULT_USER_ID); rb.PushRaw(DEFAULT_USER_ID);

View File

@ -30,14 +30,14 @@ IWindowController::IWindowController() : ServiceFramework("IWindowController") {
} }
void IWindowController::GetAppletResourceUserId(Kernel::HLERequestContext& ctx) { void IWindowController::GetAppletResourceUserId(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u64>(0); rb.Push<u64>(0);
} }
void IWindowController::AcquireForegroundRights(Kernel::HLERequestContext& ctx) { void IWindowController::AcquireForegroundRights(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
@ -56,20 +56,20 @@ IAudioController::IAudioController() : ServiceFramework("IAudioController") {
} }
void IAudioController::SetExpectedMasterVolume(Kernel::HLERequestContext& ctx) { void IAudioController::SetExpectedMasterVolume(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
void IAudioController::GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) { void IAudioController::GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(volume); rb.Push(volume);
} }
void IAudioController::GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) { void IAudioController::GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(volume); rb.Push(volume);
@ -174,14 +174,14 @@ void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void ISelfController::SetRestartMessageEnabled(Kernel::HLERequestContext& ctx) { void ISelfController::SetRestartMessageEnabled(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void ISelfController::SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx) { void ISelfController::SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx) {
@ -192,14 +192,14 @@ void ISelfController::SetPerformanceModeChangedNotification(Kernel::HLERequestCo
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag); LOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag);
} }
void ISelfController::SetScreenShotPermission(Kernel::HLERequestContext& ctx) { void ISelfController::SetScreenShotPermission(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void ISelfController::SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx) { void ISelfController::SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx) {
@ -210,7 +210,7 @@ void ISelfController::SetOperationModeChangedNotification(Kernel::HLERequestCont
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag); LOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag);
} }
void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx) { void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx) {
@ -223,21 +223,21 @@ void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext&
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_AM, "(STUBBED) called enabled={}", enabled); LOG_WARNING(Service_AM, "(STUBBED) called enabled={}", enabled);
} }
void ISelfController::LockExit(Kernel::HLERequestContext& ctx) { void ISelfController::LockExit(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) { void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) { void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) {
@ -247,7 +247,7 @@ void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext&
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(launchable_event); rb.PushCopyObjects(launchable_event);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void ISelfController::CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx) { void ISelfController::CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx) {
@ -260,14 +260,14 @@ void ISelfController::CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx)
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(layer_id); rb.Push(layer_id);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void ISelfController::SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx) { void ISelfController::SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
ICommonStateGetter::ICommonStateGetter() : ServiceFramework("ICommonStateGetter") { ICommonStateGetter::ICommonStateGetter() : ServiceFramework("ICommonStateGetter") {
@ -311,7 +311,7 @@ void ICommonStateGetter::GetEventHandle(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(event); rb.PushCopyObjects(event);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) { void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) {
@ -319,7 +319,7 @@ void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(15); rb.Push<u32>(15);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) { void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) {
@ -327,7 +327,7 @@ void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(static_cast<u8>(FocusState::InFocus)); rb.Push(static_cast<u8>(FocusState::InFocus));
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) { void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) {
@ -336,7 +336,7 @@ void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(static_cast<u8>(use_docked_mode ? OperationMode::Docked : OperationMode::Handheld)); rb.Push(static_cast<u8>(use_docked_mode ? OperationMode::Docked : OperationMode::Handheld));
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) { void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) {
@ -346,7 +346,7 @@ void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) {
rb.Push(static_cast<u32>(use_docked_mode ? APM::PerformanceMode::Docked rb.Push(static_cast<u32>(use_docked_mode ? APM::PerformanceMode::Docked
: APM::PerformanceMode::Handheld)); : APM::PerformanceMode::Handheld));
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
class IStorageAccessor final : public ServiceFramework<IStorageAccessor> { class IStorageAccessor final : public ServiceFramework<IStorageAccessor> {
@ -370,7 +370,7 @@ private:
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(static_cast<u64>(buffer.size())); rb.Push(static_cast<u64>(buffer.size()));
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void Write(Kernel::HLERequestContext& ctx) { void Write(Kernel::HLERequestContext& ctx) {
@ -386,7 +386,7 @@ private:
IPC::ResponseBuilder rb{rp.MakeBuilder(2, 0, 0)}; IPC::ResponseBuilder rb{rp.MakeBuilder(2, 0, 0)};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_DEBUG(Service_AM, "called, offset={}", offset); LOG_DEBUG(Service_AM, "called, offset={}", offset);
} }
void Read(Kernel::HLERequestContext& ctx) { void Read(Kernel::HLERequestContext& ctx) {
@ -402,7 +402,7 @@ private:
IPC::ResponseBuilder rb{rp.MakeBuilder(2, 0, 0)}; IPC::ResponseBuilder rb{rp.MakeBuilder(2, 0, 0)};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_DEBUG(Service_AM, "called, offset={}", offset); LOG_DEBUG(Service_AM, "called, offset={}", offset);
} }
}; };
@ -426,7 +426,7 @@ private:
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<AM::IStorageAccessor>(buffer); rb.PushIpcInterface<AM::IStorageAccessor>(buffer);
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
}; };
@ -467,21 +467,21 @@ private:
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(state_changed_event); rb.PushCopyObjects(state_changed_event);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void GetResult(Kernel::HLERequestContext& ctx) { void GetResult(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void Start(Kernel::HLERequestContext& ctx) { void Start(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void PushInData(Kernel::HLERequestContext& ctx) { void PushInData(Kernel::HLERequestContext& ctx) {
@ -491,7 +491,7 @@ private:
IPC::ResponseBuilder rb{rp.MakeBuilder(2, 0, 0)}; IPC::ResponseBuilder rb{rp.MakeBuilder(2, 0, 0)};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void PopOutData(Kernel::HLERequestContext& ctx) { void PopOutData(Kernel::HLERequestContext& ctx) {
@ -501,7 +501,7 @@ private:
storage_stack.pop(); storage_stack.pop();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
std::stack<std::shared_ptr<AM::IStorage>> storage_stack; std::stack<std::shared_ptr<AM::IStorage>> storage_stack;
@ -526,7 +526,7 @@ void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx)
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<AM::ILibraryAppletAccessor>(); rb.PushIpcInterface<AM::ILibraryAppletAccessor>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) { void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) {
@ -538,7 +538,7 @@ void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<AM::IStorage>(std::move(buffer)); rb.PushIpcInterface<AM::IStorage>(std::move(buffer));
NGLOG_DEBUG(Service_AM, "called, size={}", size); LOG_DEBUG(Service_AM, "called, size={}", size);
} }
IApplicationFunctions::IApplicationFunctions() : ServiceFramework("IApplicationFunctions") { IApplicationFunctions::IApplicationFunctions() : ServiceFramework("IApplicationFunctions") {
@ -602,21 +602,21 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<AM::IStorage>(buffer); rb.PushIpcInterface<AM::IStorage>(buffer);
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest( void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest(
Kernel::HLERequestContext& ctx) { Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) { void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
u128 uid = rp.PopRaw<u128>(); u128 uid = rp.PopRaw<u128>();
NGLOG_WARNING(Service, "(STUBBED) called uid = {:016X}{:016X}", uid[1], uid[0]); LOG_WARNING(Service, "(STUBBED) called uid = {:016X}{:016X}", uid[1], uid[0]);
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
@ -644,7 +644,7 @@ void IApplicationFunctions::SetTerminateResult(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_AM, "(STUBBED) called, result=0x{:08X}", result); LOG_WARNING(Service_AM, "(STUBBED) called, result=0x{:08X}", result);
} }
void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) { void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) {
@ -652,7 +652,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u64>(1); rb.Push<u64>(1);
rb.Push<u64>(0); rb.Push<u64>(0);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
@ -660,20 +660,20 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(static_cast<u64>(Service::Set::LanguageCode::EN_US)); rb.Push(static_cast<u64>(Service::Set::LanguageCode::EN_US));
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void IApplicationFunctions::InitializeGamePlayRecording(Kernel::HLERequestContext& ctx) { void IApplicationFunctions::InitializeGamePlayRecording(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void IApplicationFunctions::SetGamePlayRecordingState(Kernel::HLERequestContext& ctx) { void IApplicationFunctions::SetGamePlayRecordingState(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void IApplicationFunctions::NotifyRunning(Kernel::HLERequestContext& ctx) { void IApplicationFunctions::NotifyRunning(Kernel::HLERequestContext& ctx) {
@ -681,7 +681,7 @@ void IApplicationFunctions::NotifyRunning(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u8>(0); // Unknown, seems to be ignored by official processes rb.Push<u8>(0); // Unknown, seems to be ignored by official processes
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void IApplicationFunctions::GetPseudoDeviceId(Kernel::HLERequestContext& ctx) { void IApplicationFunctions::GetPseudoDeviceId(Kernel::HLERequestContext& ctx) {
@ -692,7 +692,7 @@ void IApplicationFunctions::GetPseudoDeviceId(Kernel::HLERequestContext& ctx) {
rb.Push<u64>(0); rb.Push<u64>(0);
rb.Push<u64>(0); rb.Push<u64>(0);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void InstallInterfaces(SM::ServiceManager& service_manager, void InstallInterfaces(SM::ServiceManager& service_manager,
@ -717,7 +717,7 @@ IHomeMenuFunctions::IHomeMenuFunctions() : ServiceFramework("IHomeMenuFunctions"
void IHomeMenuFunctions::RequestToGetForeground(Kernel::HLERequestContext& ctx) { void IHomeMenuFunctions::RequestToGetForeground(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
IGlobalStateController::IGlobalStateController() : ServiceFramework("IGlobalStateController") { IGlobalStateController::IGlobalStateController() : ServiceFramework("IGlobalStateController") {

View File

@ -33,63 +33,63 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ICommonStateGetter>(); rb.PushIpcInterface<ICommonStateGetter>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetSelfController(Kernel::HLERequestContext& ctx) { void GetSelfController(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ISelfController>(nvflinger); rb.PushIpcInterface<ISelfController>(nvflinger);
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetWindowController(Kernel::HLERequestContext& ctx) { void GetWindowController(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IWindowController>(); rb.PushIpcInterface<IWindowController>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetAudioController(Kernel::HLERequestContext& ctx) { void GetAudioController(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IAudioController>(); rb.PushIpcInterface<IAudioController>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetDisplayController(Kernel::HLERequestContext& ctx) { void GetDisplayController(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDisplayController>(); rb.PushIpcInterface<IDisplayController>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetProcessWindingController(Kernel::HLERequestContext& ctx) { void GetProcessWindingController(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IProcessWindingController>(); rb.PushIpcInterface<IProcessWindingController>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetDebugFunctions(Kernel::HLERequestContext& ctx) { void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDebugFunctions>(); rb.PushIpcInterface<IDebugFunctions>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ILibraryAppletCreator>(); rb.PushIpcInterface<ILibraryAppletCreator>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetApplicationFunctions(Kernel::HLERequestContext& ctx) { void GetApplicationFunctions(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IApplicationFunctions>(); rb.PushIpcInterface<IApplicationFunctions>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
std::shared_ptr<NVFlinger::NVFlinger> nvflinger; std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
@ -120,70 +120,70 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ICommonStateGetter>(); rb.PushIpcInterface<ICommonStateGetter>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetSelfController(Kernel::HLERequestContext& ctx) { void GetSelfController(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ISelfController>(nvflinger); rb.PushIpcInterface<ISelfController>(nvflinger);
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetWindowController(Kernel::HLERequestContext& ctx) { void GetWindowController(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IWindowController>(); rb.PushIpcInterface<IWindowController>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetAudioController(Kernel::HLERequestContext& ctx) { void GetAudioController(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IAudioController>(); rb.PushIpcInterface<IAudioController>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetDisplayController(Kernel::HLERequestContext& ctx) { void GetDisplayController(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDisplayController>(); rb.PushIpcInterface<IDisplayController>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetDebugFunctions(Kernel::HLERequestContext& ctx) { void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDebugFunctions>(); rb.PushIpcInterface<IDebugFunctions>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ILibraryAppletCreator>(); rb.PushIpcInterface<ILibraryAppletCreator>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetHomeMenuFunctions(Kernel::HLERequestContext& ctx) { void GetHomeMenuFunctions(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IHomeMenuFunctions>(); rb.PushIpcInterface<IHomeMenuFunctions>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetGlobalStateController(Kernel::HLERequestContext& ctx) { void GetGlobalStateController(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IGlobalStateController>(); rb.PushIpcInterface<IGlobalStateController>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetApplicationCreator(Kernel::HLERequestContext& ctx) { void GetApplicationCreator(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IApplicationCreator>(); rb.PushIpcInterface<IApplicationCreator>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
std::shared_ptr<NVFlinger::NVFlinger> nvflinger; std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
}; };
@ -192,21 +192,21 @@ void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ISystemAppletProxy>(nvflinger); rb.PushIpcInterface<ISystemAppletProxy>(nvflinger);
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void AppletAE::OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx) { void AppletAE::OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger); rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger);
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) { void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger); rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger);
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
AppletAE::AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger) AppletAE::AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)

View File

@ -33,56 +33,56 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IAudioController>(); rb.PushIpcInterface<IAudioController>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetDisplayController(Kernel::HLERequestContext& ctx) { void GetDisplayController(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDisplayController>(); rb.PushIpcInterface<IDisplayController>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetDebugFunctions(Kernel::HLERequestContext& ctx) { void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDebugFunctions>(); rb.PushIpcInterface<IDebugFunctions>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetWindowController(Kernel::HLERequestContext& ctx) { void GetWindowController(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IWindowController>(); rb.PushIpcInterface<IWindowController>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetSelfController(Kernel::HLERequestContext& ctx) { void GetSelfController(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ISelfController>(nvflinger); rb.PushIpcInterface<ISelfController>(nvflinger);
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetCommonStateGetter(Kernel::HLERequestContext& ctx) { void GetCommonStateGetter(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ICommonStateGetter>(); rb.PushIpcInterface<ICommonStateGetter>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ILibraryAppletCreator>(); rb.PushIpcInterface<ILibraryAppletCreator>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
void GetApplicationFunctions(Kernel::HLERequestContext& ctx) { void GetApplicationFunctions(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IApplicationFunctions>(); rb.PushIpcInterface<IApplicationFunctions>();
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
std::shared_ptr<NVFlinger::NVFlinger> nvflinger; std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
@ -92,7 +92,7 @@ void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IApplicationProxy>(nvflinger); rb.PushIpcInterface<IApplicationProxy>(nvflinger);
NGLOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
} }
AppletOE::AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger) AppletOE::AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)

View File

@ -27,14 +27,14 @@ void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u64>(0); rb.Push<u64>(0);
NGLOG_WARNING(Service_AOC, "(STUBBED) called"); LOG_WARNING(Service_AOC, "(STUBBED) called");
} }
void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) { void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u64>(0); rb.Push<u64>(0);
NGLOG_WARNING(Service_AOC, "(STUBBED) called"); LOG_WARNING(Service_AOC, "(STUBBED) called");
} }
void InstallInterfaces(SM::ServiceManager& service_manager) { void InstallInterfaces(SM::ServiceManager& service_manager) {

View File

@ -29,8 +29,8 @@ private:
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_APM, "(STUBBED) called mode={} config={}", static_cast<u32>(mode), LOG_WARNING(Service_APM, "(STUBBED) called mode={} config={}", static_cast<u32>(mode),
config); config);
} }
void GetPerformanceConfiguration(Kernel::HLERequestContext& ctx) { void GetPerformanceConfiguration(Kernel::HLERequestContext& ctx) {
@ -42,7 +42,7 @@ private:
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(0); // Performance configuration rb.Push<u32>(0); // Performance configuration
NGLOG_WARNING(Service_APM, "(STUBBED) called mode={}", static_cast<u32>(mode)); LOG_WARNING(Service_APM, "(STUBBED) called mode={}", static_cast<u32>(mode));
} }
}; };

View File

@ -60,14 +60,14 @@ public:
private: private:
void GetAudioOutState(Kernel::HLERequestContext& ctx) { void GetAudioOutState(Kernel::HLERequestContext& ctx) {
NGLOG_DEBUG(Service_Audio, "called"); LOG_DEBUG(Service_Audio, "called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(static_cast<u32>(audio_out_state)); rb.Push(static_cast<u32>(audio_out_state));
} }
void StartAudioOut(Kernel::HLERequestContext& ctx) { void StartAudioOut(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
// Start audio // Start audio
audio_out_state = AudioState::Started; audio_out_state = AudioState::Started;
@ -77,7 +77,7 @@ private:
} }
void StopAudioOut(Kernel::HLERequestContext& ctx) { void StopAudioOut(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
// Stop audio // Stop audio
audio_out_state = AudioState::Stopped; audio_out_state = AudioState::Stopped;
@ -89,7 +89,7 @@ private:
} }
void RegisterBufferEvent(Kernel::HLERequestContext& ctx) { void RegisterBufferEvent(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 1}; IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -97,7 +97,7 @@ private:
} }
void AppendAudioOutBuffer(Kernel::HLERequestContext& ctx) { void AppendAudioOutBuffer(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const u64 key{rp.Pop<u64>()}; const u64 key{rp.Pop<u64>()};
@ -108,7 +108,7 @@ private:
} }
void GetReleasedAudioOutBuffer(Kernel::HLERequestContext& ctx) { void GetReleasedAudioOutBuffer(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
// TODO(st4rk): This is how libtransistor currently implements the // TODO(st4rk): This is how libtransistor currently implements the
// GetReleasedAudioOutBuffer, it should return the key (a VAddr) to the app and this address // GetReleasedAudioOutBuffer, it should return the key (a VAddr) to the app and this address
@ -164,7 +164,7 @@ private:
}; };
void AudOutU::ListAudioOuts(Kernel::HLERequestContext& ctx) { void AudOutU::ListAudioOuts(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const std::string audio_interface = "AudioInterface"; const std::string audio_interface = "AudioInterface";
@ -180,7 +180,7 @@ void AudOutU::ListAudioOuts(Kernel::HLERequestContext& ctx) {
} }
void AudOutU::OpenAudioOut(Kernel::HLERequestContext& ctx) { void AudOutU::OpenAudioOut(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
if (!audio_out_interface) { if (!audio_out_interface) {
audio_out_interface = std::make_shared<IAudioOut>(); audio_out_interface = std::make_shared<IAudioOut>();

View File

@ -91,7 +91,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
} }
void StartAudioRenderer(Kernel::HLERequestContext& ctx) { void StartAudioRenderer(Kernel::HLERequestContext& ctx) {
@ -99,7 +99,7 @@ private:
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
} }
void StopAudioRenderer(Kernel::HLERequestContext& ctx) { void StopAudioRenderer(Kernel::HLERequestContext& ctx) {
@ -107,7 +107,7 @@ private:
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
} }
void QuerySystemEvent(Kernel::HLERequestContext& ctx) { void QuerySystemEvent(Kernel::HLERequestContext& ctx) {
@ -117,7 +117,7 @@ private:
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(system_event); rb.PushCopyObjects(system_event);
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
} }
enum class MemoryPoolStates : u32 { // Should be LE enum class MemoryPoolStates : u32 { // Should be LE
@ -208,7 +208,7 @@ public:
private: private:
void ListAudioDeviceName(Kernel::HLERequestContext& ctx) { void ListAudioDeviceName(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const std::string audio_interface = "AudioInterface"; const std::string audio_interface = "AudioInterface";
@ -220,7 +220,7 @@ private:
} }
void SetAudioDeviceOutputVolume(Kernel::HLERequestContext& ctx) { void SetAudioDeviceOutputVolume(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
f32 volume = static_cast<f32>(rp.Pop<u32>()); f32 volume = static_cast<f32>(rp.Pop<u32>());
@ -233,7 +233,7 @@ private:
} }
void GetActiveAudioDeviceName(Kernel::HLERequestContext& ctx) { void GetActiveAudioDeviceName(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const std::string audio_interface = "AudioDevice"; const std::string audio_interface = "AudioDevice";
@ -245,7 +245,7 @@ private:
} }
void QueryAudioDeviceSystemEvent(Kernel::HLERequestContext& ctx) { void QueryAudioDeviceSystemEvent(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
buffer_event->Signal(); buffer_event->Signal();
@ -255,7 +255,7 @@ private:
} }
void GetActiveChannelCount(Kernel::HLERequestContext& ctx) { void GetActiveChannelCount(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(1); rb.Push<u32>(1);
@ -284,7 +284,7 @@ void AudRenU::OpenAudioRenderer(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<Audio::IAudioRenderer>(std::move(params)); rb.PushIpcInterface<Audio::IAudioRenderer>(std::move(params));
NGLOG_DEBUG(Service_Audio, "called"); LOG_DEBUG(Service_Audio, "called");
} }
void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) { void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) {
@ -343,7 +343,7 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u64>(output_sz); rb.Push<u64>(output_sz);
NGLOG_DEBUG(Service_Audio, "called, buffer_size=0x{:X}", output_sz); LOG_DEBUG(Service_Audio, "called, buffer_size=0x{:X}", output_sz);
} }
void AudRenU::GetAudioDevice(Kernel::HLERequestContext& ctx) { void AudRenU::GetAudioDevice(Kernel::HLERequestContext& ctx) {
@ -352,7 +352,7 @@ void AudRenU::GetAudioDevice(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<Audio::IAudioDevice>(); rb.PushIpcInterface<Audio::IAudioDevice>();
NGLOG_DEBUG(Service_Audio, "called"); LOG_DEBUG(Service_Audio, "called");
} }
bool AudRenU::IsFeatureSupported(AudioFeatures feature, u32_le revision) const { bool AudRenU::IsFeatureSupported(AudioFeatures feature, u32_le revision) const {

View File

@ -10,7 +10,7 @@
namespace Service::Audio { namespace Service::Audio {
void HwOpus::GetWorkBufferSize(Kernel::HLERequestContext& ctx) { void HwOpus::GetWorkBufferSize(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(0x4000); rb.Push<u32>(0x4000);

View File

@ -36,7 +36,7 @@ void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IBcatService>(); rb.PushIpcInterface<IBcatService>();
NGLOG_DEBUG(Service_BCAT, "called"); LOG_DEBUG(Service_BCAT, "called");
} }
Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)

View File

@ -16,13 +16,13 @@ Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
void Module::Interface::ThrowFatalWithPolicy(Kernel::HLERequestContext& ctx) { void Module::Interface::ThrowFatalWithPolicy(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx); IPC::RequestParser rp(ctx);
u32 error_code = rp.Pop<u32>(); u32 error_code = rp.Pop<u32>();
NGLOG_WARNING(Service_Fatal, "(STUBBED) called, error_code=0x{:X}", error_code); LOG_WARNING(Service_Fatal, "(STUBBED) called, error_code=0x{:X}", error_code);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
void Module::Interface::ThrowFatalWithCpuContext(Kernel::HLERequestContext& ctx) { void Module::Interface::ThrowFatalWithCpuContext(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Fatal, "(STUBBED) called"); LOG_WARNING(Service_Fatal, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }

View File

@ -25,14 +25,14 @@ ResultCode RegisterFileSystem(std::unique_ptr<FileSys::FileSystemFactory>&& fact
ASSERT_MSG(inserted, "Tried to register more than one system with same id code"); ASSERT_MSG(inserted, "Tried to register more than one system with same id code");
auto& filesystem = result.first->second; auto& filesystem = result.first->second;
NGLOG_DEBUG(Service_FS, "Registered file system {} with id code 0x{:08X}", LOG_DEBUG(Service_FS, "Registered file system {} with id code 0x{:08X}", filesystem->GetName(),
filesystem->GetName(), static_cast<u32>(type)); static_cast<u32>(type));
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenFileSystem(Type type, ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenFileSystem(Type type,
FileSys::Path& path) { FileSys::Path& path) {
NGLOG_TRACE(Service_FS, "Opening FileSystem with type={}", static_cast<u32>(type)); LOG_TRACE(Service_FS, "Opening FileSystem with type={}", static_cast<u32>(type));
auto itr = filesystem_map.find(type); auto itr = filesystem_map.find(type);
if (itr == filesystem_map.end()) { if (itr == filesystem_map.end()) {
@ -44,7 +44,7 @@ ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenFileSystem(Type type,
} }
ResultCode FormatFileSystem(Type type) { ResultCode FormatFileSystem(Type type) {
NGLOG_TRACE(Service_FS, "Formatting FileSystem with type={}", static_cast<u32>(type)); LOG_TRACE(Service_FS, "Formatting FileSystem with type={}", static_cast<u32>(type));
auto itr = filesystem_map.find(type); auto itr = filesystem_map.find(type);
if (itr == filesystem_map.end()) { if (itr == filesystem_map.end()) {

View File

@ -36,7 +36,7 @@ private:
const s64 offset = rp.Pop<s64>(); const s64 offset = rp.Pop<s64>();
const s64 length = rp.Pop<s64>(); const s64 length = rp.Pop<s64>();
NGLOG_DEBUG(Service_FS, "called, offset=0x{:X}, length={}", offset, length); LOG_DEBUG(Service_FS, "called, offset=0x{:X}, length={}", offset, length);
// Error checking // Error checking
if (length < 0) { if (length < 0) {
@ -88,7 +88,7 @@ private:
const s64 offset = rp.Pop<s64>(); const s64 offset = rp.Pop<s64>();
const s64 length = rp.Pop<s64>(); const s64 length = rp.Pop<s64>();
NGLOG_DEBUG(Service_FS, "called, offset=0x{:X}, length={}", offset, length); LOG_DEBUG(Service_FS, "called, offset=0x{:X}, length={}", offset, length);
// Error checking // Error checking
if (length < 0) { if (length < 0) {
@ -125,7 +125,7 @@ private:
const s64 offset = rp.Pop<s64>(); const s64 offset = rp.Pop<s64>();
const s64 length = rp.Pop<s64>(); const s64 length = rp.Pop<s64>();
NGLOG_DEBUG(Service_FS, "called, offset=0x{:X}, length={}", offset, length); LOG_DEBUG(Service_FS, "called, offset=0x{:X}, length={}", offset, length);
// Error checking // Error checking
if (length < 0) { if (length < 0) {
@ -153,7 +153,7 @@ private:
} }
void Flush(Kernel::HLERequestContext& ctx) { void Flush(Kernel::HLERequestContext& ctx) {
NGLOG_DEBUG(Service_FS, "called"); LOG_DEBUG(Service_FS, "called");
backend->Flush(); backend->Flush();
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
@ -164,7 +164,7 @@ private:
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const u64 size = rp.Pop<u64>(); const u64 size = rp.Pop<u64>();
backend->SetSize(size); backend->SetSize(size);
NGLOG_DEBUG(Service_FS, "called, size={}", size); LOG_DEBUG(Service_FS, "called, size={}", size);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -172,7 +172,7 @@ private:
void GetSize(Kernel::HLERequestContext& ctx) { void GetSize(Kernel::HLERequestContext& ctx) {
const u64 size = backend->GetSize(); const u64 size = backend->GetSize();
NGLOG_DEBUG(Service_FS, "called, size={}", size); LOG_DEBUG(Service_FS, "called, size={}", size);
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -198,7 +198,7 @@ private:
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const u64 unk = rp.Pop<u64>(); const u64 unk = rp.Pop<u64>();
NGLOG_DEBUG(Service_FS, "called, unk=0x{:X}", unk); LOG_DEBUG(Service_FS, "called, unk=0x{:X}", unk);
// Calculate how many entries we can fit in the output buffer // Calculate how many entries we can fit in the output buffer
u64 count_entries = ctx.GetWriteBufferSize() / sizeof(FileSys::Entry); u64 count_entries = ctx.GetWriteBufferSize() / sizeof(FileSys::Entry);
@ -220,7 +220,7 @@ private:
} }
void GetEntryCount(Kernel::HLERequestContext& ctx) { void GetEntryCount(Kernel::HLERequestContext& ctx) {
NGLOG_DEBUG(Service_FS, "called"); LOG_DEBUG(Service_FS, "called");
u64 count = backend->GetEntryCount(); u64 count = backend->GetEntryCount();
@ -264,7 +264,7 @@ public:
u64 mode = rp.Pop<u64>(); u64 mode = rp.Pop<u64>();
u32 size = rp.Pop<u32>(); u32 size = rp.Pop<u32>();
NGLOG_DEBUG(Service_FS, "called file {} mode 0x{:X} size 0x{:08X}", name, mode, size); LOG_DEBUG(Service_FS, "called file {} mode 0x{:X} size 0x{:08X}", name, mode, size);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(backend->CreateFile(name, size)); rb.Push(backend->CreateFile(name, size));
@ -276,7 +276,7 @@ public:
auto file_buffer = ctx.ReadBuffer(); auto file_buffer = ctx.ReadBuffer();
std::string name = Common::StringFromBuffer(file_buffer); std::string name = Common::StringFromBuffer(file_buffer);
NGLOG_DEBUG(Service_FS, "called file {}", name); LOG_DEBUG(Service_FS, "called file {}", name);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(backend->DeleteFile(name)); rb.Push(backend->DeleteFile(name));
@ -288,7 +288,7 @@ public:
auto file_buffer = ctx.ReadBuffer(); auto file_buffer = ctx.ReadBuffer();
std::string name = Common::StringFromBuffer(file_buffer); std::string name = Common::StringFromBuffer(file_buffer);
NGLOG_DEBUG(Service_FS, "called directory {}", name); LOG_DEBUG(Service_FS, "called directory {}", name);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(backend->CreateDirectory(name)); rb.Push(backend->CreateDirectory(name));
@ -306,7 +306,7 @@ public:
Memory::ReadBlock(ctx.BufferDescriptorX()[1].Address(), buffer.data(), buffer.size()); Memory::ReadBlock(ctx.BufferDescriptorX()[1].Address(), buffer.data(), buffer.size());
std::string dst_name = Common::StringFromBuffer(buffer); std::string dst_name = Common::StringFromBuffer(buffer);
NGLOG_DEBUG(Service_FS, "called file '{}' to file '{}'", src_name, dst_name); LOG_DEBUG(Service_FS, "called file '{}' to file '{}'", src_name, dst_name);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(backend->RenameFile(src_name, dst_name)); rb.Push(backend->RenameFile(src_name, dst_name));
@ -320,7 +320,7 @@ public:
auto mode = static_cast<FileSys::Mode>(rp.Pop<u32>()); auto mode = static_cast<FileSys::Mode>(rp.Pop<u32>());
NGLOG_DEBUG(Service_FS, "called file {} mode {}", name, static_cast<u32>(mode)); LOG_DEBUG(Service_FS, "called file {} mode {}", name, static_cast<u32>(mode));
auto result = backend->OpenFile(name, mode); auto result = backend->OpenFile(name, mode);
if (result.Failed()) { if (result.Failed()) {
@ -345,7 +345,7 @@ public:
// TODO(Subv): Implement this filter. // TODO(Subv): Implement this filter.
u32 filter_flags = rp.Pop<u32>(); u32 filter_flags = rp.Pop<u32>();
NGLOG_DEBUG(Service_FS, "called directory {} filter {}", name, filter_flags); LOG_DEBUG(Service_FS, "called directory {} filter {}", name, filter_flags);
auto result = backend->OpenDirectory(name); auto result = backend->OpenDirectory(name);
if (result.Failed()) { if (result.Failed()) {
@ -367,7 +367,7 @@ public:
auto file_buffer = ctx.ReadBuffer(); auto file_buffer = ctx.ReadBuffer();
std::string name = Common::StringFromBuffer(file_buffer); std::string name = Common::StringFromBuffer(file_buffer);
NGLOG_DEBUG(Service_FS, "called file {}", name); LOG_DEBUG(Service_FS, "called file {}", name);
auto result = backend->GetEntryType(name); auto result = backend->GetEntryType(name);
if (result.Failed()) { if (result.Failed()) {
@ -382,7 +382,7 @@ public:
} }
void Commit(Kernel::HLERequestContext& ctx) { void Commit(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_FS, "(STUBBED) called"); LOG_WARNING(Service_FS, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -498,14 +498,14 @@ void FSP_SRV::TryLoadRomFS() {
} }
void FSP_SRV::Initialize(Kernel::HLERequestContext& ctx) { void FSP_SRV::Initialize(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_FS, "(STUBBED) called"); LOG_WARNING(Service_FS, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
void FSP_SRV::MountSdCard(Kernel::HLERequestContext& ctx) { void FSP_SRV::MountSdCard(Kernel::HLERequestContext& ctx) {
NGLOG_DEBUG(Service_FS, "called"); LOG_DEBUG(Service_FS, "called");
FileSys::Path unused; FileSys::Path unused;
auto filesystem = OpenFileSystem(Type::SDMC, unused).Unwrap(); auto filesystem = OpenFileSystem(Type::SDMC, unused).Unwrap();
@ -522,14 +522,14 @@ void FSP_SRV::CreateSaveData(Kernel::HLERequestContext& ctx) {
auto save_create_struct = rp.PopRaw<std::array<u8, 0x40>>(); auto save_create_struct = rp.PopRaw<std::array<u8, 0x40>>();
u128 uid = rp.PopRaw<u128>(); u128 uid = rp.PopRaw<u128>();
NGLOG_WARNING(Service_FS, "(STUBBED) called uid = {:016X}{:016X}", uid[1], uid[0]); LOG_WARNING(Service_FS, "(STUBBED) called uid = {:016X}{:016X}", uid[1], uid[0]);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) { void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_FS, "(STUBBED) called"); LOG_WARNING(Service_FS, "(STUBBED) called");
FileSys::Path unused; FileSys::Path unused;
auto filesystem = OpenFileSystem(Type::SaveData, unused).Unwrap(); auto filesystem = OpenFileSystem(Type::SaveData, unused).Unwrap();
@ -540,7 +540,7 @@ void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) {
} }
void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) { void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_FS, "(STUBBED) called"); LOG_WARNING(Service_FS, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -548,12 +548,12 @@ void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {
} }
void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) { void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
NGLOG_DEBUG(Service_FS, "called"); LOG_DEBUG(Service_FS, "called");
TryLoadRomFS(); TryLoadRomFS();
if (!romfs) { if (!romfs) {
// TODO (bunnei): Find the right error code to use here // TODO (bunnei): Find the right error code to use here
NGLOG_CRITICAL(Service_FS, "no file system interface available!"); LOG_CRITICAL(Service_FS, "no file system interface available!");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultCode(-1)); rb.Push(ResultCode(-1));
return; return;
@ -562,7 +562,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
// Attempt to open a StorageBackend interface to the RomFS // Attempt to open a StorageBackend interface to the RomFS
auto storage = romfs->OpenFile({}, {}); auto storage = romfs->OpenFile({}, {});
if (storage.Failed()) { if (storage.Failed()) {
NGLOG_CRITICAL(Service_FS, "no storage interface available!"); LOG_CRITICAL(Service_FS, "no storage interface available!");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(storage.Code()); rb.Push(storage.Code());
return; return;
@ -574,7 +574,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
} }
void FSP_SRV::OpenRomStorage(Kernel::HLERequestContext& ctx) { void FSP_SRV::OpenRomStorage(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_FS, "(STUBBED) called, using OpenDataStorageByCurrentProcess"); LOG_WARNING(Service_FS, "(STUBBED) called, using OpenDataStorageByCurrentProcess");
OpenDataStorageByCurrentProcess(ctx); OpenDataStorageByCurrentProcess(ctx);
} }

View File

@ -13,7 +13,7 @@ namespace Service::Friend {
void Module::Interface::CreateFriendService(Kernel::HLERequestContext& ctx) { void Module::Interface::CreateFriendService(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_Friend, "(STUBBED) called"); LOG_WARNING(Service_Friend, "(STUBBED) called");
} }
Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)

View File

@ -53,7 +53,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 1}; IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(shared_mem); rb.PushCopyObjects(shared_mem);
NGLOG_DEBUG(Service_HID, "called"); LOG_DEBUG(Service_HID, "called");
} }
void LoadInputDevices() { void LoadInputDevices() {
@ -267,7 +267,7 @@ private:
void ActivateVibrationDevice(Kernel::HLERequestContext& ctx) { void ActivateVibrationDevice(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
}; };
@ -399,144 +399,144 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IAppletResource>(applet_resource); rb.PushIpcInterface<IAppletResource>(applet_resource);
NGLOG_DEBUG(Service_HID, "called"); LOG_DEBUG(Service_HID, "called");
} }
void ActivateDebugPad(Kernel::HLERequestContext& ctx) { void ActivateDebugPad(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void ActivateTouchScreen(Kernel::HLERequestContext& ctx) { void ActivateTouchScreen(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void ActivateMouse(Kernel::HLERequestContext& ctx) { void ActivateMouse(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void ActivateKeyboard(Kernel::HLERequestContext& ctx) { void ActivateKeyboard(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void StartSixAxisSensor(Kernel::HLERequestContext& ctx) { void StartSixAxisSensor(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void SetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) { void SetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void SetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) { void SetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void GetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) { void GetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(0); rb.Push<u32>(0);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void SetSupportedNpadIdType(Kernel::HLERequestContext& ctx) { void SetSupportedNpadIdType(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void ActivateNpad(Kernel::HLERequestContext& ctx) { void ActivateNpad(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void AcquireNpadStyleSetUpdateEventHandle(Kernel::HLERequestContext& ctx) { void AcquireNpadStyleSetUpdateEventHandle(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 1}; IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(event); rb.PushCopyObjects(event);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void GetPlayerLedPattern(Kernel::HLERequestContext& ctx) { void GetPlayerLedPattern(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void SetNpadJoyHoldType(Kernel::HLERequestContext& ctx) { void SetNpadJoyHoldType(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void GetNpadJoyHoldType(Kernel::HLERequestContext& ctx) { void GetNpadJoyHoldType(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(joy_hold_type); rb.Push(joy_hold_type);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void SetNpadJoyAssignmentModeSingleByDefault(Kernel::HLERequestContext& ctx) { void SetNpadJoyAssignmentModeSingleByDefault(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void SendVibrationValue(Kernel::HLERequestContext& ctx) { void SendVibrationValue(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void GetActualVibrationValue(Kernel::HLERequestContext& ctx) { void GetActualVibrationValue(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void SetNpadJoyAssignmentModeDual(Kernel::HLERequestContext& ctx) { void SetNpadJoyAssignmentModeDual(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void SetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx) { void SetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) { void GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u64>(0); rb.Push<u64>(0);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
void CreateActiveVibrationDeviceList(Kernel::HLERequestContext& ctx) { void CreateActiveVibrationDeviceList(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IActiveVibrationDeviceList>(); rb.PushIpcInterface<IActiveVibrationDeviceList>();
NGLOG_DEBUG(Service_HID, "called"); LOG_DEBUG(Service_HID, "called");
} }
void SendVibrationValues(Kernel::HLERequestContext& ctx) { void SendVibrationValues(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }
}; };

View File

@ -141,19 +141,19 @@ private:
if (header.IsTailLog()) { if (header.IsTailLog()) {
switch (header.severity) { switch (header.severity) {
case MessageHeader::Severity::Trace: case MessageHeader::Severity::Trace:
NGLOG_TRACE(Debug_Emulated, "{}", log_stream.str()); LOG_TRACE(Debug_Emulated, "{}", log_stream.str());
break; break;
case MessageHeader::Severity::Info: case MessageHeader::Severity::Info:
NGLOG_INFO(Debug_Emulated, "{}", log_stream.str()); LOG_INFO(Debug_Emulated, "{}", log_stream.str());
break; break;
case MessageHeader::Severity::Warning: case MessageHeader::Severity::Warning:
NGLOG_WARNING(Debug_Emulated, "{}", log_stream.str()); LOG_WARNING(Debug_Emulated, "{}", log_stream.str());
break; break;
case MessageHeader::Severity::Error: case MessageHeader::Severity::Error:
NGLOG_ERROR(Debug_Emulated, "{}", log_stream.str()); LOG_ERROR(Debug_Emulated, "{}", log_stream.str());
break; break;
case MessageHeader::Severity::Critical: case MessageHeader::Severity::Critical:
NGLOG_CRITICAL(Debug_Emulated, "{}", log_stream.str()); LOG_CRITICAL(Debug_Emulated, "{}", log_stream.str());
break; break;
} }
} }
@ -178,7 +178,7 @@ void LM::Initialize(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<Logger>(); rb.PushIpcInterface<Logger>();
NGLOG_DEBUG(Service_LM, "called"); LOG_DEBUG(Service_LM, "called");
} }
LM::LM() : ServiceFramework("lm") { LM::LM() : ServiceFramework("lm") {

View File

@ -14,7 +14,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager) {
} }
void MM_U::Initialize(Kernel::HLERequestContext& ctx) { void MM_U::Initialize(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_MM, "(STUBBED) called"); LOG_WARNING(Service_MM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
@ -25,13 +25,13 @@ void MM_U::SetAndWait(Kernel::HLERequestContext& ctx) {
max = rp.Pop<u32>(); max = rp.Pop<u32>();
current = min; current = min;
NGLOG_WARNING(Service_MM, "(STUBBED) called, min=0x{:X}, max=0x{:X}", min, max); LOG_WARNING(Service_MM, "(STUBBED) called, min=0x{:X}, max=0x{:X}", min, max);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
void MM_U::Get(Kernel::HLERequestContext& ctx) { void MM_U::Get(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_MM, "(STUBBED) called"); LOG_WARNING(Service_MM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(current); rb.Push(current);

View File

@ -64,7 +64,7 @@ private:
}; };
void Initialize(Kernel::HLERequestContext& ctx) { void Initialize(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_NFP, "(STUBBED) called"); LOG_WARNING(Service_NFP, "(STUBBED) called");
state = State::Initialized; state = State::Initialized;
@ -78,7 +78,7 @@ private:
ctx.WriteBuffer(&device_handle, sizeof(device_handle)); ctx.WriteBuffer(&device_handle, sizeof(device_handle));
NGLOG_WARNING(Service_NFP, "(STUBBED) called, array_size={}", array_size); LOG_WARNING(Service_NFP, "(STUBBED) called, array_size={}", array_size);
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -88,7 +88,7 @@ private:
void AttachActivateEvent(Kernel::HLERequestContext& ctx) { void AttachActivateEvent(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const u64 dev_handle = rp.Pop<u64>(); const u64 dev_handle = rp.Pop<u64>();
NGLOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle); LOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle);
IPC::ResponseBuilder rb{ctx, 2, 1}; IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -98,7 +98,7 @@ private:
void AttachDeactivateEvent(Kernel::HLERequestContext& ctx) { void AttachDeactivateEvent(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const u64 dev_handle = rp.Pop<u64>(); const u64 dev_handle = rp.Pop<u64>();
NGLOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle); LOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle);
IPC::ResponseBuilder rb{ctx, 2, 1}; IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -106,14 +106,14 @@ private:
} }
void GetState(Kernel::HLERequestContext& ctx) { void GetState(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_NFP, "(STUBBED) called"); LOG_WARNING(Service_NFP, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(static_cast<u32>(state)); rb.Push<u32>(static_cast<u32>(state));
} }
void GetDeviceState(Kernel::HLERequestContext& ctx) { void GetDeviceState(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_NFP, "(STUBBED) called"); LOG_WARNING(Service_NFP, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(static_cast<u32>(device_state)); rb.Push<u32>(static_cast<u32>(device_state));
@ -122,7 +122,7 @@ private:
void GetNpadId(Kernel::HLERequestContext& ctx) { void GetNpadId(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const u64 dev_handle = rp.Pop<u64>(); const u64 dev_handle = rp.Pop<u64>();
NGLOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle); LOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle);
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(npad_id); rb.Push<u32>(npad_id);
@ -131,7 +131,7 @@ private:
void AttachAvailabilityChangeEvent(Kernel::HLERequestContext& ctx) { void AttachAvailabilityChangeEvent(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const u64 dev_handle = rp.Pop<u64>(); const u64 dev_handle = rp.Pop<u64>();
NGLOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle); LOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle);
IPC::ResponseBuilder rb{ctx, 2, 1}; IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -148,7 +148,7 @@ private:
}; };
void Module::Interface::CreateUserInterface(Kernel::HLERequestContext& ctx) { void Module::Interface::CreateUserInterface(Kernel::HLERequestContext& ctx) {
NGLOG_DEBUG(Service_NFP, "called"); LOG_DEBUG(Service_NFP, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IUser>(); rb.PushIpcInterface<IUser>();

View File

@ -62,33 +62,33 @@ public:
private: private:
void GetRequestState(Kernel::HLERequestContext& ctx) { void GetRequestState(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_NIFM, "(STUBBED) called"); LOG_WARNING(Service_NIFM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(0); rb.Push<u32>(0);
} }
void GetResult(Kernel::HLERequestContext& ctx) { void GetResult(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_NIFM, "(STUBBED) called"); LOG_WARNING(Service_NIFM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
void GetSystemEventReadableHandles(Kernel::HLERequestContext& ctx) { void GetSystemEventReadableHandles(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_NIFM, "(STUBBED) called"); LOG_WARNING(Service_NIFM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 2}; IPC::ResponseBuilder rb{ctx, 2, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(event1, event2); rb.PushCopyObjects(event1, event2);
} }
void Cancel(Kernel::HLERequestContext& ctx) { void Cancel(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_NIFM, "(STUBBED) called"); LOG_WARNING(Service_NIFM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
void SetConnectionConfirmationOption(Kernel::HLERequestContext& ctx) { void SetConnectionConfirmationOption(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_NIFM, "(STUBBED) called"); LOG_WARNING(Service_NIFM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
@ -114,7 +114,7 @@ public:
private: private:
void GetClientId(Kernel::HLERequestContext& ctx) { void GetClientId(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_NIFM, "(STUBBED) called"); LOG_WARNING(Service_NIFM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u64>(0); rb.Push<u64>(0);
@ -125,7 +125,7 @@ private:
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IScanRequest>(); rb.PushIpcInterface<IScanRequest>();
NGLOG_DEBUG(Service_NIFM, "called"); LOG_DEBUG(Service_NIFM, "called");
} }
void CreateRequest(Kernel::HLERequestContext& ctx) { void CreateRequest(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@ -133,10 +133,10 @@ private:
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IRequest>(); rb.PushIpcInterface<IRequest>();
NGLOG_DEBUG(Service_NIFM, "called"); LOG_DEBUG(Service_NIFM, "called");
} }
void RemoveNetworkProfile(Kernel::HLERequestContext& ctx) { void RemoveNetworkProfile(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_NIFM, "(STUBBED) called"); LOG_WARNING(Service_NIFM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
@ -146,7 +146,7 @@ private:
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<INetworkProfile>(); rb.PushIpcInterface<INetworkProfile>();
NGLOG_DEBUG(Service_NIFM, "called"); LOG_DEBUG(Service_NIFM, "called");
} }
}; };
@ -196,14 +196,14 @@ void Module::Interface::CreateGeneralServiceOld(Kernel::HLERequestContext& ctx)
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IGeneralService>(); rb.PushIpcInterface<IGeneralService>();
NGLOG_DEBUG(Service_NIFM, "called"); LOG_DEBUG(Service_NIFM, "called");
} }
void Module::Interface::CreateGeneralService(Kernel::HLERequestContext& ctx) { void Module::Interface::CreateGeneralService(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IGeneralService>(); rb.PushIpcInterface<IGeneralService>();
NGLOG_DEBUG(Service_NIFM, "called"); LOG_DEBUG(Service_NIFM, "called");
} }
Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)

View File

@ -52,7 +52,7 @@ PL_U::PL_U() : ServiceFramework("pl:u") {
ASSERT(file.GetSize() == SHARED_FONT_MEM_SIZE); ASSERT(file.GetSize() == SHARED_FONT_MEM_SIZE);
file.ReadBytes(shared_font->data(), shared_font->size()); file.ReadBytes(shared_font->data(), shared_font->size());
} else { } else {
NGLOG_WARNING(Service_NS, "Unable to load shared font: {}", filepath); LOG_WARNING(Service_NS, "Unable to load shared font: {}", filepath);
} }
} }
@ -60,7 +60,7 @@ void PL_U::RequestLoad(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const u32 shared_font_type{rp.Pop<u32>()}; const u32 shared_font_type{rp.Pop<u32>()};
NGLOG_DEBUG(Service_NS, "called, shared_font_type={}", shared_font_type); LOG_DEBUG(Service_NS, "called, shared_font_type={}", shared_font_type);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
@ -69,7 +69,7 @@ void PL_U::GetLoadState(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const u32 font_id{rp.Pop<u32>()}; const u32 font_id{rp.Pop<u32>()};
NGLOG_DEBUG(Service_NS, "called, font_id={}", font_id); LOG_DEBUG(Service_NS, "called, font_id={}", font_id);
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(static_cast<u32>(LoadState::Done)); rb.Push<u32>(static_cast<u32>(LoadState::Done));
@ -79,7 +79,7 @@ void PL_U::GetSize(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const u32 font_id{rp.Pop<u32>()}; const u32 font_id{rp.Pop<u32>()};
NGLOG_DEBUG(Service_NS, "called, font_id={}", font_id); LOG_DEBUG(Service_NS, "called, font_id={}", font_id);
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(SHARED_FONT_REGIONS[font_id].size); rb.Push<u32>(SHARED_FONT_REGIONS[font_id].size);
@ -89,7 +89,7 @@ void PL_U::GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const u32 font_id{rp.Pop<u32>()}; const u32 font_id{rp.Pop<u32>()};
NGLOG_DEBUG(Service_NS, "called, font_id={}", font_id); LOG_DEBUG(Service_NS, "called, font_id={}", font_id);
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(SHARED_FONT_REGIONS[font_id].offset); rb.Push<u32>(SHARED_FONT_REGIONS[font_id].offset);
@ -110,7 +110,7 @@ void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) {
Kernel::MemoryPermission::Read, SHARED_FONT_MEM_VADDR, Kernel::MemoryRegion::BASE, Kernel::MemoryPermission::Read, SHARED_FONT_MEM_VADDR, Kernel::MemoryRegion::BASE,
"PL_U:shared_font_mem"); "PL_U:shared_font_mem");
NGLOG_DEBUG(Service_NS, "called"); LOG_DEBUG(Service_NS, "called");
IPC::ResponseBuilder rb{ctx, 2, 1}; IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(shared_font_mem); rb.PushCopyObjects(shared_font_mem);
@ -119,7 +119,7 @@ void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) {
void PL_U::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) { void PL_U::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const u64 language_code{rp.Pop<u64>()}; // TODO(ogniK): Find out what this is used for const u64 language_code{rp.Pop<u64>()}; // TODO(ogniK): Find out what this is used for
NGLOG_DEBUG(Service_NS, "called, language_code=%lx", language_code); LOG_DEBUG(Service_NS, "called, language_code=%lx", language_code);
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
std::vector<u32> font_codes; std::vector<u32> font_codes;
std::vector<u32> font_offsets; std::vector<u32> font_offsets;

View File

@ -20,9 +20,9 @@ u32 nvdisp_disp0::ioctl(Ioctl command, const std::vector<u8>& input, std::vector
void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height,
u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform) { u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform) {
VAddr addr = nvmap_dev->GetObjectAddress(buffer_handle); VAddr addr = nvmap_dev->GetObjectAddress(buffer_handle);
NGLOG_WARNING(Service, LOG_WARNING(Service,
"Drawing from address {:X} offset {:08X} Width {} Height {} Stride {} Format {}", "Drawing from address {:X} offset {:08X} Width {} Height {} Stride {} Format {}",
addr, offset, width, height, stride, format); addr, offset, width, height, stride, format);
using PixelFormat = Tegra::FramebufferConfig::PixelFormat; using PixelFormat = Tegra::FramebufferConfig::PixelFormat;
const Tegra::FramebufferConfig framebuffer{ const Tegra::FramebufferConfig framebuffer{

View File

@ -14,8 +14,8 @@
namespace Service::Nvidia::Devices { namespace Service::Nvidia::Devices {
u32 nvhost_as_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_as_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
NGLOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}",
command.raw, input.size(), output.size()); command.raw, input.size(), output.size());
switch (static_cast<IoctlCommand>(command.raw)) { switch (static_cast<IoctlCommand>(command.raw)) {
case IoctlCommand::IocInitalizeExCommand: case IoctlCommand::IocInitalizeExCommand:
@ -42,15 +42,15 @@ u32 nvhost_as_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vecto
u32 nvhost_as_gpu::InitalizeEx(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_as_gpu::InitalizeEx(const std::vector<u8>& input, std::vector<u8>& output) {
IoctlInitalizeEx params{}; IoctlInitalizeEx params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, big_page_size=0x{:X}", params.big_page_size); LOG_WARNING(Service_NVDRV, "(STUBBED) called, big_page_size=0x{:X}", params.big_page_size);
return 0; return 0;
} }
u32 nvhost_as_gpu::AllocateSpace(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_as_gpu::AllocateSpace(const std::vector<u8>& input, std::vector<u8>& output) {
IoctlAllocSpace params{}; IoctlAllocSpace params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
NGLOG_DEBUG(Service_NVDRV, "called, pages={:X}, page_size={:X}, flags={:X}", params.pages, LOG_DEBUG(Service_NVDRV, "called, pages={:X}, page_size={:X}, flags={:X}", params.pages,
params.page_size, params.flags); params.page_size, params.flags);
auto& gpu = Core::System::GetInstance().GPU(); auto& gpu = Core::System::GetInstance().GPU();
const u64 size{static_cast<u64>(params.pages) * static_cast<u64>(params.page_size)}; const u64 size{static_cast<u64>(params.pages) * static_cast<u64>(params.page_size)};
@ -67,7 +67,7 @@ u32 nvhost_as_gpu::AllocateSpace(const std::vector<u8>& input, std::vector<u8>&
u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output) {
size_t num_entries = input.size() / sizeof(IoctlRemapEntry); size_t num_entries = input.size() / sizeof(IoctlRemapEntry);
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, num_entries=0x{:X}", num_entries); LOG_WARNING(Service_NVDRV, "(STUBBED) called, num_entries=0x{:X}", num_entries);
std::vector<IoctlRemapEntry> entries(num_entries); std::vector<IoctlRemapEntry> entries(num_entries);
std::memcpy(entries.data(), input.data(), input.size()); std::memcpy(entries.data(), input.data(), input.size());
@ -75,8 +75,8 @@ u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output)
auto& gpu = Core::System::GetInstance().GPU(); auto& gpu = Core::System::GetInstance().GPU();
for (const auto& entry : entries) { for (const auto& entry : entries) {
NGLOG_WARNING(Service_NVDRV, "remap entry, offset=0x{:X} handle=0x{:X} pages=0x{:X}", LOG_WARNING(Service_NVDRV, "remap entry, offset=0x{:X} handle=0x{:X} pages=0x{:X}",
entry.offset, entry.nvmap_handle, entry.pages); entry.offset, entry.nvmap_handle, entry.pages);
Tegra::GPUVAddr offset = static_cast<Tegra::GPUVAddr>(entry.offset) << 0x10; Tegra::GPUVAddr offset = static_cast<Tegra::GPUVAddr>(entry.offset) << 0x10;
auto object = nvmap_dev->GetObject(entry.nvmap_handle); auto object = nvmap_dev->GetObject(entry.nvmap_handle);
@ -98,11 +98,11 @@ u32 nvhost_as_gpu::MapBufferEx(const std::vector<u8>& input, std::vector<u8>& ou
IoctlMapBufferEx params{}; IoctlMapBufferEx params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
NGLOG_DEBUG(Service_NVDRV, LOG_DEBUG(Service_NVDRV,
"called, flags={:X}, nvmap_handle={:X}, buffer_offset={}, mapping_size={}" "called, flags={:X}, nvmap_handle={:X}, buffer_offset={}, mapping_size={}"
", offset={}", ", offset={}",
params.flags, params.nvmap_handle, params.buffer_offset, params.mapping_size, params.flags, params.nvmap_handle, params.buffer_offset, params.mapping_size,
params.offset); params.offset);
if (!params.nvmap_handle) { if (!params.nvmap_handle) {
return 0; return 0;
@ -148,7 +148,7 @@ u32 nvhost_as_gpu::UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& ou
IoctlUnmapBuffer params{}; IoctlUnmapBuffer params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
NGLOG_DEBUG(Service_NVDRV, "called, offset=0x{:X}", params.offset); LOG_DEBUG(Service_NVDRV, "called, offset=0x{:X}", params.offset);
auto& gpu = Core::System::GetInstance().GPU(); auto& gpu = Core::System::GetInstance().GPU();
@ -170,7 +170,7 @@ u32 nvhost_as_gpu::UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& ou
u32 nvhost_as_gpu::BindChannel(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_as_gpu::BindChannel(const std::vector<u8>& input, std::vector<u8>& output) {
IoctlBindChannel params{}; IoctlBindChannel params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
NGLOG_DEBUG(Service_NVDRV, "called, fd={:X}", params.fd); LOG_DEBUG(Service_NVDRV, "called, fd={:X}", params.fd);
channel = params.fd; channel = params.fd;
return 0; return 0;
} }
@ -178,8 +178,8 @@ u32 nvhost_as_gpu::BindChannel(const std::vector<u8>& input, std::vector<u8>& ou
u32 nvhost_as_gpu::GetVARegions(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_as_gpu::GetVARegions(const std::vector<u8>& input, std::vector<u8>& output) {
IoctlGetVaRegions params{}; IoctlGetVaRegions params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, buf_addr={:X}, buf_size={:X}", params.buf_addr, LOG_WARNING(Service_NVDRV, "(STUBBED) called, buf_addr={:X}, buf_size={:X}", params.buf_addr,
params.buf_size); params.buf_size);
params.buf_size = 0x30; params.buf_size = 0x30;
params.regions[0].offset = 0x04000000; params.regions[0].offset = 0x04000000;

View File

@ -9,8 +9,8 @@
namespace Service::Nvidia::Devices { namespace Service::Nvidia::Devices {
u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
NGLOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}",
command.raw, input.size(), output.size()); command.raw, input.size(), output.size());
switch (static_cast<IoctlCommand>(command.raw)) { switch (static_cast<IoctlCommand>(command.raw)) {
case IoctlCommand::IocGetConfigCommand: case IoctlCommand::IocGetConfigCommand:
@ -29,8 +29,8 @@ u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<
u32 nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) {
IocGetConfigParams params{}; IocGetConfigParams params{};
std::memcpy(&params, input.data(), sizeof(params)); std::memcpy(&params, input.data(), sizeof(params));
NGLOG_DEBUG(Service_NVDRV, "called, setting={}!{}", params.domain_str.data(), LOG_DEBUG(Service_NVDRV, "called, setting={}!{}", params.domain_str.data(),
params.param_str.data()); params.param_str.data());
if (!strcmp(params.domain_str.data(), "nv")) { if (!strcmp(params.domain_str.data(), "nv")) {
if (!strcmp(params.param_str.data(), "NV_MEMORY_PROFILER")) { if (!strcmp(params.param_str.data(), "NV_MEMORY_PROFILER")) {
@ -53,9 +53,9 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>&
bool is_async) { bool is_async) {
IocCtrlEventWaitParams params{}; IocCtrlEventWaitParams params{};
std::memcpy(&params, input.data(), sizeof(params)); std::memcpy(&params, input.data(), sizeof(params));
NGLOG_WARNING(Service_NVDRV, LOG_WARNING(Service_NVDRV,
"(STUBBED) called, syncpt_id={}, threshold={}, timeout={}, is_async={}", "(STUBBED) called, syncpt_id={}, threshold={}, timeout={}, is_async={}",
params.syncpt_id, params.threshold, params.timeout, is_async); params.syncpt_id, params.threshold, params.timeout, is_async);
// TODO(Subv): Implement actual syncpt waiting. // TODO(Subv): Implement actual syncpt waiting.
params.value = 0; params.value = 0;
@ -64,7 +64,7 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>&
} }
u32 nvhost_ctrl::IocCtrlEventRegister(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_ctrl::IocCtrlEventRegister(const std::vector<u8>& input, std::vector<u8>& output) {
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called"); LOG_WARNING(Service_NVDRV, "(STUBBED) called");
// TODO(bunnei): Implement this. // TODO(bunnei): Implement this.
return 0; return 0;
} }

View File

@ -10,8 +10,8 @@
namespace Service::Nvidia::Devices { namespace Service::Nvidia::Devices {
u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
NGLOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}",
command.raw, input.size(), output.size()); command.raw, input.size(), output.size());
switch (static_cast<IoctlCommand>(command.raw)) { switch (static_cast<IoctlCommand>(command.raw)) {
case IoctlCommand::IocGetCharacteristicsCommand: case IoctlCommand::IocGetCharacteristicsCommand:
@ -36,7 +36,7 @@ u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vec
} }
u32 nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, std::vector<u8>& output) {
NGLOG_DEBUG(Service_NVDRV, "called"); LOG_DEBUG(Service_NVDRV, "called");
IoctlCharacteristics params{}; IoctlCharacteristics params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
params.gc.arch = 0x120; params.gc.arch = 0x120;
@ -83,8 +83,8 @@ u32 nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, std::vecto
u32 nvhost_ctrl_gpu::GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_ctrl_gpu::GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output) {
IoctlGpuGetTpcMasksArgs params{}; IoctlGpuGetTpcMasksArgs params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
NGLOG_INFO(Service_NVDRV, "called, mask=0x{:X}, mask_buf_addr=0x{:X}", params.mask_buf_size, LOG_INFO(Service_NVDRV, "called, mask=0x{:X}, mask_buf_addr=0x{:X}", params.mask_buf_size,
params.mask_buf_addr); params.mask_buf_addr);
// TODO(ogniK): Confirm value on hardware // TODO(ogniK): Confirm value on hardware
if (params.mask_buf_size) if (params.mask_buf_size)
params.tpc_mask_size = 4 * 1; // 4 * num_gpc params.tpc_mask_size = 4 * 1; // 4 * num_gpc
@ -95,7 +95,7 @@ u32 nvhost_ctrl_gpu::GetTPCMasks(const std::vector<u8>& input, std::vector<u8>&
} }
u32 nvhost_ctrl_gpu::GetActiveSlotMask(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_ctrl_gpu::GetActiveSlotMask(const std::vector<u8>& input, std::vector<u8>& output) {
NGLOG_DEBUG(Service_NVDRV, "called"); LOG_DEBUG(Service_NVDRV, "called");
IoctlActiveSlotMask params{}; IoctlActiveSlotMask params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
params.slot = 0x07; params.slot = 0x07;
@ -105,7 +105,7 @@ u32 nvhost_ctrl_gpu::GetActiveSlotMask(const std::vector<u8>& input, std::vector
} }
u32 nvhost_ctrl_gpu::ZCullGetCtxSize(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_ctrl_gpu::ZCullGetCtxSize(const std::vector<u8>& input, std::vector<u8>& output) {
NGLOG_DEBUG(Service_NVDRV, "called"); LOG_DEBUG(Service_NVDRV, "called");
IoctlZcullGetCtxSize params{}; IoctlZcullGetCtxSize params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
params.size = 0x1; params.size = 0x1;
@ -114,7 +114,7 @@ u32 nvhost_ctrl_gpu::ZCullGetCtxSize(const std::vector<u8>& input, std::vector<u
} }
u32 nvhost_ctrl_gpu::ZCullGetInfo(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_ctrl_gpu::ZCullGetInfo(const std::vector<u8>& input, std::vector<u8>& output) {
NGLOG_DEBUG(Service_NVDRV, "called"); LOG_DEBUG(Service_NVDRV, "called");
IoctlNvgpuGpuZcullGetInfoArgs params{}; IoctlNvgpuGpuZcullGetInfoArgs params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
params.width_align_pixels = 0x20; params.width_align_pixels = 0x20;
@ -132,7 +132,7 @@ u32 nvhost_ctrl_gpu::ZCullGetInfo(const std::vector<u8>& input, std::vector<u8>&
} }
u32 nvhost_ctrl_gpu::ZBCSetTable(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_ctrl_gpu::ZBCSetTable(const std::vector<u8>& input, std::vector<u8>& output) {
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called"); LOG_WARNING(Service_NVDRV, "(STUBBED) called");
IoctlZbcSetTable params{}; IoctlZbcSetTable params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
// TODO(ogniK): What does this even actually do? // TODO(ogniK): What does this even actually do?
@ -141,7 +141,7 @@ u32 nvhost_ctrl_gpu::ZBCSetTable(const std::vector<u8>& input, std::vector<u8>&
} }
u32 nvhost_ctrl_gpu::ZBCQueryTable(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_ctrl_gpu::ZBCQueryTable(const std::vector<u8>& input, std::vector<u8>& output) {
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called"); LOG_WARNING(Service_NVDRV, "(STUBBED) called");
IoctlZbcQueryTable params{}; IoctlZbcQueryTable params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
// TODO : To implement properly // TODO : To implement properly
@ -150,7 +150,7 @@ u32 nvhost_ctrl_gpu::ZBCQueryTable(const std::vector<u8>& input, std::vector<u8>
} }
u32 nvhost_ctrl_gpu::FlushL2(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_ctrl_gpu::FlushL2(const std::vector<u8>& input, std::vector<u8>& output) {
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called"); LOG_WARNING(Service_NVDRV, "(STUBBED) called");
IoctlFlushL2 params{}; IoctlFlushL2 params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
// TODO : To implement properly // TODO : To implement properly

View File

@ -12,8 +12,8 @@
namespace Service::Nvidia::Devices { namespace Service::Nvidia::Devices {
u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
NGLOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}",
command.raw, input.size(), output.size()); command.raw, input.size(), output.size());
switch (static_cast<IoctlCommand>(command.raw)) { switch (static_cast<IoctlCommand>(command.raw)) {
case IoctlCommand::IocSetNVMAPfdCommand: case IoctlCommand::IocSetNVMAPfdCommand:
@ -51,13 +51,13 @@ u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u
u32 nvhost_gpu::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_gpu::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) {
IoctlSetNvmapFD params{}; IoctlSetNvmapFD params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
NGLOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd);
nvmap_fd = params.nvmap_fd; nvmap_fd = params.nvmap_fd;
return 0; return 0;
} }
u32 nvhost_gpu::SetClientData(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_gpu::SetClientData(const std::vector<u8>& input, std::vector<u8>& output) {
NGLOG_DEBUG(Service_NVDRV, "called"); LOG_DEBUG(Service_NVDRV, "called");
IoctlClientData params{}; IoctlClientData params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
user_data = params.data; user_data = params.data;
@ -65,7 +65,7 @@ u32 nvhost_gpu::SetClientData(const std::vector<u8>& input, std::vector<u8>& out
} }
u32 nvhost_gpu::GetClientData(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_gpu::GetClientData(const std::vector<u8>& input, std::vector<u8>& output) {
NGLOG_DEBUG(Service_NVDRV, "called"); LOG_DEBUG(Service_NVDRV, "called");
IoctlClientData params{}; IoctlClientData params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
params.data = user_data; params.data = user_data;
@ -75,8 +75,8 @@ u32 nvhost_gpu::GetClientData(const std::vector<u8>& input, std::vector<u8>& out
u32 nvhost_gpu::ZCullBind(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_gpu::ZCullBind(const std::vector<u8>& input, std::vector<u8>& output) {
std::memcpy(&zcull_params, input.data(), input.size()); std::memcpy(&zcull_params, input.data(), input.size());
NGLOG_DEBUG(Service_NVDRV, "called, gpu_va={:X}, mode={:X}", zcull_params.gpu_va, LOG_DEBUG(Service_NVDRV, "called, gpu_va={:X}, mode={:X}", zcull_params.gpu_va,
zcull_params.mode); zcull_params.mode);
std::memcpy(output.data(), &zcull_params, output.size()); std::memcpy(output.data(), &zcull_params, output.size());
return 0; return 0;
} }
@ -84,26 +84,26 @@ u32 nvhost_gpu::ZCullBind(const std::vector<u8>& input, std::vector<u8>& output)
u32 nvhost_gpu::SetErrorNotifier(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_gpu::SetErrorNotifier(const std::vector<u8>& input, std::vector<u8>& output) {
IoctlSetErrorNotifier params{}; IoctlSetErrorNotifier params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, offset={:X}, size={:X}, mem={:X}", LOG_WARNING(Service_NVDRV, "(STUBBED) called, offset={:X}, size={:X}, mem={:X}", params.offset,
params.offset, params.size, params.mem); params.size, params.mem);
std::memcpy(output.data(), &params, output.size()); std::memcpy(output.data(), &params, output.size());
return 0; return 0;
} }
u32 nvhost_gpu::SetChannelPriority(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_gpu::SetChannelPriority(const std::vector<u8>& input, std::vector<u8>& output) {
std::memcpy(&channel_priority, input.data(), input.size()); std::memcpy(&channel_priority, input.data(), input.size());
NGLOG_DEBUG(Service_NVDRV, "(STUBBED) called, priority={:X}", channel_priority); LOG_DEBUG(Service_NVDRV, "(STUBBED) called, priority={:X}", channel_priority);
return 0; return 0;
} }
u32 nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& output) {
IoctlAllocGpfifoEx2 params{}; IoctlAllocGpfifoEx2 params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
NGLOG_WARNING(Service_NVDRV, LOG_WARNING(Service_NVDRV,
"(STUBBED) called, num_entries={:X}, flags={:X}, unk0={:X}, " "(STUBBED) called, num_entries={:X}, flags={:X}, unk0={:X}, "
"unk1={:X}, unk2={:X}, unk3={:X}", "unk1={:X}, unk2={:X}, unk3={:X}",
params.num_entries, params.flags, params.unk0, params.unk1, params.unk2, params.num_entries, params.flags, params.unk0, params.unk1, params.unk2,
params.unk3); params.unk3);
params.fence_out.id = 0; params.fence_out.id = 0;
params.fence_out.value = 0; params.fence_out.value = 0;
std::memcpy(output.data(), &params, output.size()); std::memcpy(output.data(), &params, output.size());
@ -113,8 +113,8 @@ u32 nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& ou
u32 nvhost_gpu::AllocateObjectContext(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_gpu::AllocateObjectContext(const std::vector<u8>& input, std::vector<u8>& output) {
IoctlAllocObjCtx params{}; IoctlAllocObjCtx params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, class_num={:X}, flags={:X}", params.class_num, LOG_WARNING(Service_NVDRV, "(STUBBED) called, class_num={:X}, flags={:X}", params.class_num,
params.flags); params.flags);
params.obj_id = 0x0; params.obj_id = 0x0;
std::memcpy(output.data(), &params, output.size()); std::memcpy(output.data(), &params, output.size());
return 0; return 0;
@ -126,8 +126,8 @@ u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& outp
} }
IoctlSubmitGpfifo params{}; IoctlSubmitGpfifo params{};
std::memcpy(&params, input.data(), sizeof(IoctlSubmitGpfifo)); std::memcpy(&params, input.data(), sizeof(IoctlSubmitGpfifo));
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo={:X}, num_entries={:X}, flags={:X}", LOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo={:X}, num_entries={:X}, flags={:X}",
params.gpfifo, params.num_entries, params.flags); params.gpfifo, params.num_entries, params.flags);
auto entries = std::vector<IoctlGpfifoEntry>(); auto entries = std::vector<IoctlGpfifoEntry>();
entries.resize(params.num_entries); entries.resize(params.num_entries);
@ -146,7 +146,7 @@ u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& outp
u32 nvhost_gpu::GetWaitbase(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_gpu::GetWaitbase(const std::vector<u8>& input, std::vector<u8>& output) {
IoctlGetWaitbase params{}; IoctlGetWaitbase params{};
std::memcpy(&params, input.data(), sizeof(IoctlGetWaitbase)); std::memcpy(&params, input.data(), sizeof(IoctlGetWaitbase));
NGLOG_INFO(Service_NVDRV, "called, unknown=0x{:X}", params.unknown); LOG_INFO(Service_NVDRV, "called, unknown=0x{:X}", params.unknown);
params.value = 0; // Seems to be hard coded at 0 params.value = 0; // Seems to be hard coded at 0
std::memcpy(output.data(), &params, output.size()); std::memcpy(output.data(), &params, output.size());
return 0; return 0;
@ -155,7 +155,7 @@ u32 nvhost_gpu::GetWaitbase(const std::vector<u8>& input, std::vector<u8>& outpu
u32 nvhost_gpu::ChannelSetTimeout(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_gpu::ChannelSetTimeout(const std::vector<u8>& input, std::vector<u8>& output) {
IoctlChannelSetTimeout params{}; IoctlChannelSetTimeout params{};
std::memcpy(&params, input.data(), sizeof(IoctlChannelSetTimeout)); std::memcpy(&params, input.data(), sizeof(IoctlChannelSetTimeout));
NGLOG_INFO(Service_NVDRV, "called, timeout=0x{:X}", params.timeout); LOG_INFO(Service_NVDRV, "called, timeout=0x{:X}", params.timeout);
return 0; return 0;
} }

View File

@ -9,8 +9,8 @@
namespace Service::Nvidia::Devices { namespace Service::Nvidia::Devices {
u32 nvhost_nvdec::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_nvdec::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
NGLOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}",
command.raw, input.size(), output.size()); command.raw, input.size(), output.size());
switch (static_cast<IoctlCommand>(command.raw)) { switch (static_cast<IoctlCommand>(command.raw)) {
case IoctlCommand::IocSetNVMAPfdCommand: case IoctlCommand::IocSetNVMAPfdCommand:
@ -24,7 +24,7 @@ u32 nvhost_nvdec::ioctl(Ioctl command, const std::vector<u8>& input, std::vector
u32 nvhost_nvdec::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_nvdec::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) {
IoctlSetNvmapFD params{}; IoctlSetNvmapFD params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, input.data(), input.size());
NGLOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd);
nvmap_fd = params.nvmap_fd; nvmap_fd = params.nvmap_fd;
return 0; return 0;
} }

View File

@ -52,7 +52,7 @@ u32 nvmap::IocCreate(const std::vector<u8>& input, std::vector<u8>& output) {
u32 handle = next_handle++; u32 handle = next_handle++;
handles[handle] = std::move(object); handles[handle] = std::move(object);
NGLOG_DEBUG(Service_NVDRV, "size=0x{:08X}", params.size); LOG_DEBUG(Service_NVDRV, "size=0x{:08X}", params.size);
params.handle = handle; params.handle = handle;
@ -73,7 +73,7 @@ u32 nvmap::IocAlloc(const std::vector<u8>& input, std::vector<u8>& output) {
object->addr = params.addr; object->addr = params.addr;
object->status = Object::Status::Allocated; object->status = Object::Status::Allocated;
NGLOG_DEBUG(Service_NVDRV, "called, addr={:X}", params.addr); LOG_DEBUG(Service_NVDRV, "called, addr={:X}", params.addr);
std::memcpy(output.data(), &params, sizeof(params)); std::memcpy(output.data(), &params, sizeof(params));
return 0; return 0;
@ -83,7 +83,7 @@ u32 nvmap::IocGetId(const std::vector<u8>& input, std::vector<u8>& output) {
IocGetIdParams params; IocGetIdParams params;
std::memcpy(&params, input.data(), sizeof(params)); std::memcpy(&params, input.data(), sizeof(params));
NGLOG_WARNING(Service_NVDRV, "called"); LOG_WARNING(Service_NVDRV, "called");
auto object = GetObject(params.handle); auto object = GetObject(params.handle);
ASSERT(object); ASSERT(object);
@ -98,7 +98,7 @@ u32 nvmap::IocFromId(const std::vector<u8>& input, std::vector<u8>& output) {
IocFromIdParams params; IocFromIdParams params;
std::memcpy(&params, input.data(), sizeof(params)); std::memcpy(&params, input.data(), sizeof(params));
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called"); LOG_WARNING(Service_NVDRV, "(STUBBED) called");
auto itr = std::find_if(handles.begin(), handles.end(), auto itr = std::find_if(handles.begin(), handles.end(),
[&](const auto& entry) { return entry.second->id == params.id; }); [&](const auto& entry) { return entry.second->id == params.id; });
@ -119,7 +119,7 @@ u32 nvmap::IocParam(const std::vector<u8>& input, std::vector<u8>& output) {
IocParamParams params; IocParamParams params;
std::memcpy(&params, input.data(), sizeof(params)); std::memcpy(&params, input.data(), sizeof(params));
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called type={}", params.param); LOG_WARNING(Service_NVDRV, "(STUBBED) called type={}", params.param);
auto object = GetObject(params.handle); auto object = GetObject(params.handle);
ASSERT(object); ASSERT(object);
@ -157,7 +157,7 @@ u32 nvmap::IocFree(const std::vector<u8>& input, std::vector<u8>& output) {
IocFreeParams params; IocFreeParams params;
std::memcpy(&params, input.data(), sizeof(params)); std::memcpy(&params, input.data(), sizeof(params));
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called"); LOG_WARNING(Service_NVDRV, "(STUBBED) called");
auto itr = handles.find(params.handle); auto itr = handles.find(params.handle);
ASSERT(itr != handles.end()); ASSERT(itr != handles.end());

View File

@ -12,7 +12,7 @@
namespace Service::Nvidia { namespace Service::Nvidia {
void NVDRV::Open(Kernel::HLERequestContext& ctx) { void NVDRV::Open(Kernel::HLERequestContext& ctx) {
NGLOG_DEBUG(Service_NVDRV, "called"); LOG_DEBUG(Service_NVDRV, "called");
const auto& buffer = ctx.ReadBuffer(); const auto& buffer = ctx.ReadBuffer();
std::string device_name(buffer.begin(), buffer.end()); std::string device_name(buffer.begin(), buffer.end());
@ -25,7 +25,7 @@ void NVDRV::Open(Kernel::HLERequestContext& ctx) {
} }
void NVDRV::Ioctl(Kernel::HLERequestContext& ctx) { void NVDRV::Ioctl(Kernel::HLERequestContext& ctx) {
NGLOG_DEBUG(Service_NVDRV, "called"); LOG_DEBUG(Service_NVDRV, "called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
u32 fd = rp.Pop<u32>(); u32 fd = rp.Pop<u32>();
@ -41,7 +41,7 @@ void NVDRV::Ioctl(Kernel::HLERequestContext& ctx) {
} }
void NVDRV::Close(Kernel::HLERequestContext& ctx) { void NVDRV::Close(Kernel::HLERequestContext& ctx) {
NGLOG_DEBUG(Service_NVDRV, "called"); LOG_DEBUG(Service_NVDRV, "called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
u32 fd = rp.Pop<u32>(); u32 fd = rp.Pop<u32>();
@ -53,7 +53,7 @@ void NVDRV::Close(Kernel::HLERequestContext& ctx) {
} }
void NVDRV::Initialize(Kernel::HLERequestContext& ctx) { void NVDRV::Initialize(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called"); LOG_WARNING(Service_NVDRV, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(0); rb.Push<u32>(0);
@ -63,7 +63,7 @@ void NVDRV::QueryEvent(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
u32 fd = rp.Pop<u32>(); u32 fd = rp.Pop<u32>();
u32 event_id = rp.Pop<u32>(); u32 event_id = rp.Pop<u32>();
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, fd={:X}, event_id={:X}", fd, event_id); LOG_WARNING(Service_NVDRV, "(STUBBED) called, fd={:X}, event_id={:X}", fd, event_id);
IPC::ResponseBuilder rb{ctx, 3, 1}; IPC::ResponseBuilder rb{ctx, 3, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -75,14 +75,14 @@ void NVDRV::SetClientPID(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
pid = rp.Pop<u64>(); pid = rp.Pop<u64>();
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, pid=0x{:X}", pid); LOG_WARNING(Service_NVDRV, "(STUBBED) called, pid=0x{:X}", pid);
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(0); rb.Push<u32>(0);
} }
void NVDRV::FinishInitialize(Kernel::HLERequestContext& ctx) { void NVDRV::FinishInitialize(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called"); LOG_WARNING(Service_NVDRV, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }

View File

@ -23,7 +23,7 @@ void BufferQueue::SetPreallocatedBuffer(u32 slot, IGBPBuffer& igbp_buffer) {
buffer.igbp_buffer = igbp_buffer; buffer.igbp_buffer = igbp_buffer;
buffer.status = Buffer::Status::Free; buffer.status = Buffer::Status::Free;
NGLOG_WARNING(Service, "Adding graphics buffer {}", slot); LOG_WARNING(Service, "Adding graphics buffer {}", slot);
queue.emplace_back(buffer); queue.emplace_back(buffer);
@ -94,7 +94,7 @@ void BufferQueue::ReleaseBuffer(u32 slot) {
} }
u32 BufferQueue::Query(QueryType type) { u32 BufferQueue::Query(QueryType type) {
NGLOG_WARNING(Service, "(STUBBED) called type={}", static_cast<u32>(type)); LOG_WARNING(Service, "(STUBBED) called type={}", static_cast<u32>(type));
switch (type) { switch (type) {
case QueryType::NativeWindowFormat: case QueryType::NativeWindowFormat:
// TODO(Subv): Use an enum for this // TODO(Subv): Use an enum for this

View File

@ -48,7 +48,7 @@ NVFlinger::~NVFlinger() {
} }
u64 NVFlinger::OpenDisplay(const std::string& name) { u64 NVFlinger::OpenDisplay(const std::string& name) {
NGLOG_WARNING(Service, "Opening display {}", name); LOG_WARNING(Service, "Opening display {}", name);
// TODO(Subv): Currently we only support the Default display. // TODO(Subv): Currently we only support the Default display.
ASSERT(name == "Default"); ASSERT(name == "Default");

View File

@ -112,7 +112,7 @@ public:
private: private:
void Initialize(Kernel::HLERequestContext& ctx) { void Initialize(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_PCTL, "(STUBBED) called"); LOG_WARNING(Service_PCTL, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 0, 0}; IPC::ResponseBuilder rb{ctx, 2, 0, 0};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
@ -122,14 +122,14 @@ void Module::Interface::CreateService(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IParentalControlService>(); rb.PushIpcInterface<IParentalControlService>();
NGLOG_DEBUG(Service_PCTL, "called"); LOG_DEBUG(Service_PCTL, "called");
} }
void Module::Interface::CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx) { void Module::Interface::CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IParentalControlService>(); rb.PushIpcInterface<IParentalControlService>();
NGLOG_DEBUG(Service_PCTL, "called"); LOG_DEBUG(Service_PCTL, "called");
} }
Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)

View File

@ -27,7 +27,7 @@ PlayReport::PlayReport(const char* name) : ServiceFramework(name) {
void PlayReport::SaveReportWithUser(Kernel::HLERequestContext& ctx) { void PlayReport::SaveReportWithUser(Kernel::HLERequestContext& ctx) {
// TODO(ogniK): Do we want to add play report? // TODO(ogniK): Do we want to add play report?
NGLOG_WARNING(Service_PREPO, "(STUBBED) called"); LOG_WARNING(Service_PREPO, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);

View File

@ -122,7 +122,7 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(Kernel::HLERequestContext
} }
buf.push_back('}'); buf.push_back('}');
NGLOG_ERROR(Service, "unknown / unimplemented {}", fmt::to_string(buf)); LOG_ERROR(Service, "unknown / unimplemented {}", fmt::to_string(buf));
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
@ -133,7 +133,7 @@ void ServiceFrameworkBase::InvokeRequest(Kernel::HLERequestContext& ctx) {
return ReportUnimplementedFunction(ctx, info); return ReportUnimplementedFunction(ctx, info);
} }
NGLOG_TRACE( LOG_TRACE(
Service, "{}", Service, "{}",
MakeFunctionString(info->name, GetServiceName().c_str(), ctx.CommandBuffer()).c_str()); MakeFunctionString(info->name, GetServiceName().c_str(), ctx.CommandBuffer()).c_str());
handler_invoker(this, info->handler_callback, ctx); handler_invoker(this, info->handler_callback, ctx);
@ -206,12 +206,12 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) {
VI::InstallInterfaces(*sm, nv_flinger); VI::InstallInterfaces(*sm, nv_flinger);
Set::InstallInterfaces(*sm); Set::InstallInterfaces(*sm);
NGLOG_DEBUG(Service, "initialized OK"); LOG_DEBUG(Service, "initialized OK");
} }
/// Shutdown ServiceManager /// Shutdown ServiceManager
void Shutdown() { void Shutdown() {
g_kernel_named_ports.clear(); g_kernel_named_ports.clear();
NGLOG_DEBUG(Service, "shutdown OK"); LOG_DEBUG(Service, "shutdown OK");
} }
} // namespace Service } // namespace Service

View File

@ -37,7 +37,7 @@ void SET::GetAvailableLanguageCodes(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(static_cast<u64>(available_language_codes.size())); rb.Push(static_cast<u64>(available_language_codes.size()));
NGLOG_DEBUG(Service_SET, "called"); LOG_DEBUG(Service_SET, "called");
} }
SET::SET() : ServiceFramework("set") { SET::SET() : ServiceFramework("set") {

View File

@ -16,7 +16,7 @@ void SET_SYS::GetColorSetId(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(0); rb.Push<u32>(0);
NGLOG_WARNING(Service_SET, "(STUBBED) called"); LOG_WARNING(Service_SET, "(STUBBED) called");
} }
SET_SYS::SET_SYS() : ServiceFramework("set:sys") { SET_SYS::SET_SYS() : ServiceFramework("set:sys") {

View File

@ -17,7 +17,7 @@ void Controller::ConvertSessionToDomain(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(1); // Converted sessions start with 1 request handler rb.Push<u32>(1); // Converted sessions start with 1 request handler
NGLOG_DEBUG(Service, "called, server_session={}", ctx.Session()->GetObjectId()); LOG_DEBUG(Service, "called, server_session={}", ctx.Session()->GetObjectId());
} }
void Controller::DuplicateSession(Kernel::HLERequestContext& ctx) { void Controller::DuplicateSession(Kernel::HLERequestContext& ctx) {
@ -29,11 +29,11 @@ void Controller::DuplicateSession(Kernel::HLERequestContext& ctx) {
Kernel::SharedPtr<Kernel::ClientSession> session{ctx.Session()->parent->client}; Kernel::SharedPtr<Kernel::ClientSession> session{ctx.Session()->parent->client};
rb.PushMoveObjects(session); rb.PushMoveObjects(session);
NGLOG_DEBUG(Service, "called, session={}", session->GetObjectId()); LOG_DEBUG(Service, "called, session={}", session->GetObjectId());
} }
void Controller::DuplicateSessionEx(Kernel::HLERequestContext& ctx) { void Controller::DuplicateSessionEx(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service, "(STUBBED) called, using DuplicateSession"); LOG_WARNING(Service, "(STUBBED) called, using DuplicateSession");
DuplicateSession(ctx); DuplicateSession(ctx);
} }
@ -43,7 +43,7 @@ void Controller::QueryPointerBufferSize(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(0x500); rb.Push<u32>(0x500);
NGLOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called");
} }
Controller::Controller() : ServiceFramework("IpcController") { Controller::Controller() : ServiceFramework("IpcController") {

View File

@ -86,7 +86,7 @@ SM::~SM() = default;
void SM::Initialize(Kernel::HLERequestContext& ctx) { void SM::Initialize(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_DEBUG(Service_SM, "called"); LOG_DEBUG(Service_SM, "called");
} }
void SM::GetService(Kernel::HLERequestContext& ctx) { void SM::GetService(Kernel::HLERequestContext& ctx) {
@ -102,8 +102,7 @@ void SM::GetService(Kernel::HLERequestContext& ctx) {
if (client_port.Failed()) { if (client_port.Failed()) {
IPC::ResponseBuilder rb = rp.MakeBuilder(2, 0, 0); IPC::ResponseBuilder rb = rp.MakeBuilder(2, 0, 0);
rb.Push(client_port.Code()); rb.Push(client_port.Code());
NGLOG_ERROR(Service_SM, "called service={} -> error 0x{:08X}", name, LOG_ERROR(Service_SM, "called service={} -> error 0x{:08X}", name, client_port.Code().raw);
client_port.Code().raw);
if (name.length() == 0) if (name.length() == 0)
return; // LibNX Fix return; // LibNX Fix
UNIMPLEMENTED(); UNIMPLEMENTED();
@ -113,7 +112,7 @@ void SM::GetService(Kernel::HLERequestContext& ctx) {
auto session = client_port.Unwrap()->Connect(); auto session = client_port.Unwrap()->Connect();
ASSERT(session.Succeeded()); ASSERT(session.Succeeded());
if (session.Succeeded()) { if (session.Succeeded()) {
NGLOG_DEBUG(Service_SM, "called service={} -> session={}", name, (*session)->GetObjectId()); LOG_DEBUG(Service_SM, "called service={} -> session={}", name, (*session)->GetObjectId());
IPC::ResponseBuilder rb = IPC::ResponseBuilder rb =
rp.MakeBuilder(2, 0, 1, IPC::ResponseBuilder::Flags::AlwaysMoveHandles); rp.MakeBuilder(2, 0, 1, IPC::ResponseBuilder::Flags::AlwaysMoveHandles);
rb.Push(session.Code()); rb.Push(session.Code());

View File

@ -8,7 +8,7 @@
namespace Service::Sockets { namespace Service::Sockets {
void BSD::RegisterClient(Kernel::HLERequestContext& ctx) { void BSD::RegisterClient(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
@ -17,7 +17,7 @@ void BSD::RegisterClient(Kernel::HLERequestContext& ctx) {
} }
void BSD::StartMonitoring(Kernel::HLERequestContext& ctx) { void BSD::StartMonitoring(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
@ -32,8 +32,7 @@ void BSD::Socket(Kernel::HLERequestContext& ctx) {
u32 type = rp.Pop<u32>(); u32 type = rp.Pop<u32>();
u32 protocol = rp.Pop<u32>(); u32 protocol = rp.Pop<u32>();
NGLOG_WARNING(Service, "(STUBBED) called domain={} type={} protocol={}", domain, type, LOG_WARNING(Service, "(STUBBED) called domain={} type={} protocol={}", domain, type, protocol);
protocol);
u32 fd = next_fd++; u32 fd = next_fd++;
@ -45,7 +44,7 @@ void BSD::Socket(Kernel::HLERequestContext& ctx) {
} }
void BSD::Connect(Kernel::HLERequestContext& ctx) { void BSD::Connect(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
@ -55,7 +54,7 @@ void BSD::Connect(Kernel::HLERequestContext& ctx) {
} }
void BSD::SendTo(Kernel::HLERequestContext& ctx) { void BSD::SendTo(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
@ -65,7 +64,7 @@ void BSD::SendTo(Kernel::HLERequestContext& ctx) {
} }
void BSD::Close(Kernel::HLERequestContext& ctx) { void BSD::Close(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};

View File

@ -10,7 +10,7 @@ namespace Service::Sockets {
void SFDNSRES::GetAddrInfo(Kernel::HLERequestContext& ctx) { void SFDNSRES::GetAddrInfo(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
NGLOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};

View File

@ -28,7 +28,7 @@ void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_DEBUG(Service_SPL, "called"); LOG_DEBUG(Service_SPL, "called");
} }
void InstallInterfaces(SM::ServiceManager& service_manager) { void InstallInterfaces(SM::ServiceManager& service_manager) {

View File

@ -65,7 +65,7 @@ public:
private: private:
void SetOption(Kernel::HLERequestContext& ctx) { void SetOption(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_SSL, "(STUBBED) called"); LOG_WARNING(Service_SSL, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
IPC::ResponseBuilder rb = rp.MakeBuilder(2, 0, 0); IPC::ResponseBuilder rb = rp.MakeBuilder(2, 0, 0);
@ -73,7 +73,7 @@ private:
} }
void CreateConnection(Kernel::HLERequestContext& ctx) { void CreateConnection(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_SSL, "(STUBBED) called"); LOG_WARNING(Service_SSL, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -82,7 +82,7 @@ private:
}; };
void SSL::CreateContext(Kernel::HLERequestContext& ctx) { void SSL::CreateContext(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_SSL, "(STUBBED) called"); LOG_WARNING(Service_SSL, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -103,7 +103,7 @@ SSL::SSL() : ServiceFramework("ssl") {
} }
void SSL::SetInterfaceVersion(Kernel::HLERequestContext& ctx) { void SSL::SetInterfaceVersion(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_SSL, "(STUBBED) called"); LOG_WARNING(Service_SSL, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
u32 unk1 = rp.Pop<u32>(); // Probably minor/major? u32 unk1 = rp.Pop<u32>(); // Probably minor/major?
u32 unk2 = rp.Pop<u32>(); // TODO(ogniK): Figure out what this does u32 unk2 = rp.Pop<u32>(); // TODO(ogniK): Figure out what this does

View File

@ -33,14 +33,14 @@ private:
const s64 time_since_epoch{std::chrono::duration_cast<std::chrono::seconds>( const s64 time_since_epoch{std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch()) std::chrono::system_clock::now().time_since_epoch())
.count()}; .count()};
NGLOG_DEBUG(Service_Time, "called"); LOG_DEBUG(Service_Time, "called");
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u64>(time_since_epoch); rb.Push<u64>(time_since_epoch);
} }
void GetSystemClockContext(Kernel::HLERequestContext& ctx) { void GetSystemClockContext(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Time, "(STUBBED) called"); LOG_WARNING(Service_Time, "(STUBBED) called");
SystemClockContext system_clock_ontext{}; SystemClockContext system_clock_ontext{};
IPC::ResponseBuilder rb{ctx, (sizeof(SystemClockContext) / 4) + 2}; IPC::ResponseBuilder rb{ctx, (sizeof(SystemClockContext) / 4) + 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -59,7 +59,7 @@ public:
private: private:
void GetCurrentTimePoint(Kernel::HLERequestContext& ctx) { void GetCurrentTimePoint(Kernel::HLERequestContext& ctx) {
NGLOG_DEBUG(Service_Time, "called"); LOG_DEBUG(Service_Time, "called");
SteadyClockTimePoint steady_clock_time_point{ SteadyClockTimePoint steady_clock_time_point{
CoreTiming::cyclesToMs(CoreTiming::GetTicks()) / 1000}; CoreTiming::cyclesToMs(CoreTiming::GetTicks()) / 1000};
IPC::ResponseBuilder rb{ctx, (sizeof(SteadyClockTimePoint) / 4) + 2}; IPC::ResponseBuilder rb{ctx, (sizeof(SteadyClockTimePoint) / 4) + 2};
@ -91,21 +91,21 @@ private:
TimeZoneRule my_time_zone_rule{}; TimeZoneRule my_time_zone_rule{};
void GetDeviceLocationName(Kernel::HLERequestContext& ctx) { void GetDeviceLocationName(Kernel::HLERequestContext& ctx) {
NGLOG_DEBUG(Service_Time, "called"); LOG_DEBUG(Service_Time, "called");
IPC::ResponseBuilder rb{ctx, (sizeof(LocationName) / 4) + 2}; IPC::ResponseBuilder rb{ctx, (sizeof(LocationName) / 4) + 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushRaw(location_name); rb.PushRaw(location_name);
} }
void GetTotalLocationNameCount(Kernel::HLERequestContext& ctx) { void GetTotalLocationNameCount(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Time, "(STUBBED) called"); LOG_WARNING(Service_Time, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(0); rb.Push<u32>(0);
} }
void LoadTimeZoneRule(Kernel::HLERequestContext& ctx) { void LoadTimeZoneRule(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_Time, "(STUBBED) called"); LOG_WARNING(Service_Time, "(STUBBED) called");
ctx.WriteBuffer(&my_time_zone_rule, sizeof(TimeZoneRule)); ctx.WriteBuffer(&my_time_zone_rule, sizeof(TimeZoneRule));
@ -117,7 +117,7 @@ private:
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const u64 posix_time = rp.Pop<u64>(); const u64 posix_time = rp.Pop<u64>();
NGLOG_WARNING(Service_Time, "(STUBBED) called, posix_time=0x{:016X}", posix_time); LOG_WARNING(Service_Time, "(STUBBED) called, posix_time=0x{:016X}", posix_time);
TimeZoneRule time_zone_rule{}; TimeZoneRule time_zone_rule{};
auto buffer = ctx.ReadBuffer(); auto buffer = ctx.ReadBuffer();
@ -138,7 +138,7 @@ private:
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const u64 posix_time = rp.Pop<u64>(); const u64 posix_time = rp.Pop<u64>();
NGLOG_WARNING(Service_Time, "(STUBBED) called, posix_time=0x{:016X}", posix_time); LOG_WARNING(Service_Time, "(STUBBED) called, posix_time=0x{:016X}", posix_time);
CalendarTime calendar_time{2018, 1, 1, 0, 0, 0}; CalendarTime calendar_time{2018, 1, 1, 0, 0, 0};
CalendarAdditionalInfo additional_info{}; CalendarAdditionalInfo additional_info{};
@ -176,35 +176,35 @@ void Module::Interface::GetStandardUserSystemClock(Kernel::HLERequestContext& ct
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ISystemClock>(); rb.PushIpcInterface<ISystemClock>();
NGLOG_DEBUG(Service_Time, "called"); LOG_DEBUG(Service_Time, "called");
} }
void Module::Interface::GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx) { void Module::Interface::GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ISystemClock>(); rb.PushIpcInterface<ISystemClock>();
NGLOG_DEBUG(Service_Time, "called"); LOG_DEBUG(Service_Time, "called");
} }
void Module::Interface::GetStandardSteadyClock(Kernel::HLERequestContext& ctx) { void Module::Interface::GetStandardSteadyClock(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ISteadyClock>(); rb.PushIpcInterface<ISteadyClock>();
NGLOG_DEBUG(Service_Time, "called"); LOG_DEBUG(Service_Time, "called");
} }
void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) { void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ITimeZoneService>(); rb.PushIpcInterface<ITimeZoneService>();
NGLOG_DEBUG(Service_Time, "called"); LOG_DEBUG(Service_Time, "called");
} }
void Module::Interface::GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx) { void Module::Interface::GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ISystemClock>(); rb.PushIpcInterface<ISystemClock>();
NGLOG_DEBUG(Service_Time, "called"); LOG_DEBUG(Service_Time, "called");
} }
Module::Interface::Interface(std::shared_ptr<Module> time, const char* name) Module::Interface::Interface(std::shared_ptr<Module> time, const char* name)

View File

@ -470,7 +470,7 @@ private:
u32 flags = rp.Pop<u32>(); u32 flags = rp.Pop<u32>();
auto buffer_queue = nv_flinger->GetBufferQueue(id); auto buffer_queue = nv_flinger->GetBufferQueue(id);
NGLOG_DEBUG(Service_VI, "called, transaction={:X}", static_cast<u32>(transaction)); LOG_DEBUG(Service_VI, "called, transaction={:X}", static_cast<u32>(transaction));
if (transaction == TransactionId::Connect) { if (transaction == TransactionId::Connect) {
IGBPConnectRequestParcel request{ctx.ReadBuffer()}; IGBPConnectRequestParcel request{ctx.ReadBuffer()};
@ -532,7 +532,7 @@ private:
IGBPQueryResponseParcel response{value}; IGBPQueryResponseParcel response{value};
ctx.WriteBuffer(response.Serialize()); ctx.WriteBuffer(response.Serialize());
} else if (transaction == TransactionId::CancelBuffer) { } else if (transaction == TransactionId::CancelBuffer) {
NGLOG_WARNING(Service_VI, "(STUBBED) called, transaction=CancelBuffer"); LOG_WARNING(Service_VI, "(STUBBED) called, transaction=CancelBuffer");
} else { } else {
ASSERT_MSG(false, "Unimplemented"); ASSERT_MSG(false, "Unimplemented");
} }
@ -547,8 +547,8 @@ private:
s32 addval = rp.PopRaw<s32>(); s32 addval = rp.PopRaw<s32>();
u32 type = rp.Pop<u32>(); u32 type = rp.Pop<u32>();
NGLOG_WARNING(Service_VI, "(STUBBED) called id={}, addval={:08X}, type={:08X}", id, addval, LOG_WARNING(Service_VI, "(STUBBED) called id={}, addval={:08X}, type={:08X}", id, addval,
type); type);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
@ -562,7 +562,7 @@ private:
// TODO(Subv): Find out what this actually is. // TODO(Subv): Find out what this actually is.
NGLOG_WARNING(Service_VI, "(STUBBED) called id={}, unknown={:08X}", id, unknown); LOG_WARNING(Service_VI, "(STUBBED) called id={}, unknown={:08X}", id, unknown);
IPC::ResponseBuilder rb{ctx, 2, 1}; IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(buffer_queue->GetNativeHandle()); rb.PushCopyObjects(buffer_queue->GetNativeHandle());
@ -625,7 +625,7 @@ public:
private: private:
void SetLayerZ(Kernel::HLERequestContext& ctx) { void SetLayerZ(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
u64 layer_id = rp.Pop<u64>(); u64 layer_id = rp.Pop<u64>();
u64 z_value = rp.Pop<u64>(); u64 z_value = rp.Pop<u64>();
@ -640,8 +640,8 @@ private:
bool visibility = rp.Pop<bool>(); bool visibility = rp.Pop<bool>();
IPC::ResponseBuilder rb = rp.MakeBuilder(2, 0, 0); IPC::ResponseBuilder rb = rp.MakeBuilder(2, 0, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_VI, "(STUBBED) called, layer_id=0x{:08X}, visibility={}", layer_id, LOG_WARNING(Service_VI, "(STUBBED) called, layer_id=0x{:08X}, visibility={}", layer_id,
visibility); visibility);
} }
}; };
@ -723,7 +723,7 @@ public:
private: private:
void CloseDisplay(Kernel::HLERequestContext& ctx) { void CloseDisplay(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
u64 display = rp.Pop<u64>(); u64 display = rp.Pop<u64>();
@ -732,7 +732,7 @@ private:
} }
void CreateManagedLayer(Kernel::HLERequestContext& ctx) { void CreateManagedLayer(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
u32 unknown = rp.Pop<u32>(); u32 unknown = rp.Pop<u32>();
rp.Skip(1, false); rp.Skip(1, false);
@ -747,7 +747,7 @@ private:
} }
void AddToLayerStack(Kernel::HLERequestContext& ctx) { void AddToLayerStack(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
u32 stack = rp.Pop<u32>(); u32 stack = rp.Pop<u32>();
u64 layer_id = rp.Pop<u64>(); u64 layer_id = rp.Pop<u64>();
@ -762,8 +762,8 @@ private:
bool visibility = rp.Pop<bool>(); bool visibility = rp.Pop<bool>();
IPC::ResponseBuilder rb = rp.MakeBuilder(2, 0, 0); IPC::ResponseBuilder rb = rp.MakeBuilder(2, 0, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
NGLOG_WARNING(Service_VI, "(STUBBED) called, layer_id=0x{:X}, visibility={}", layer_id, LOG_WARNING(Service_VI, "(STUBBED) called, layer_id=0x{:X}, visibility={}", layer_id,
visibility); visibility);
} }
std::shared_ptr<NVFlinger::NVFlinger> nv_flinger; std::shared_ptr<NVFlinger::NVFlinger> nv_flinger;
@ -776,7 +776,7 @@ public:
private: private:
void GetRelayService(Kernel::HLERequestContext& ctx) { void GetRelayService(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -784,7 +784,7 @@ private:
} }
void GetSystemDisplayService(Kernel::HLERequestContext& ctx) { void GetSystemDisplayService(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -792,7 +792,7 @@ private:
} }
void GetManagerDisplayService(Kernel::HLERequestContext& ctx) { void GetManagerDisplayService(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -800,7 +800,7 @@ private:
} }
void GetIndirectDisplayTransactionService(Kernel::HLERequestContext& ctx) { void GetIndirectDisplayTransactionService(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -808,7 +808,7 @@ private:
} }
void OpenDisplay(Kernel::HLERequestContext& ctx) { void OpenDisplay(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
auto name_buf = rp.PopRaw<std::array<u8, 0x40>>(); auto name_buf = rp.PopRaw<std::array<u8, 0x40>>();
auto end = std::find(name_buf.begin(), name_buf.end(), '\0'); auto end = std::find(name_buf.begin(), name_buf.end(), '\0');
@ -823,7 +823,7 @@ private:
} }
void CloseDisplay(Kernel::HLERequestContext& ctx) { void CloseDisplay(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
u64 display_id = rp.Pop<u64>(); u64 display_id = rp.Pop<u64>();
@ -832,7 +832,7 @@ private:
} }
void GetDisplayResolution(Kernel::HLERequestContext& ctx) { void GetDisplayResolution(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
u64 display_id = rp.Pop<u64>(); u64 display_id = rp.Pop<u64>();
@ -849,7 +849,7 @@ private:
} }
void SetLayerScalingMode(Kernel::HLERequestContext& ctx) { void SetLayerScalingMode(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
u32 scaling_mode = rp.Pop<u32>(); u32 scaling_mode = rp.Pop<u32>();
u64 unknown = rp.Pop<u64>(); u64 unknown = rp.Pop<u64>();
@ -865,11 +865,11 @@ private:
IPC::ResponseBuilder rb = rp.MakeBuilder(4, 0, 0); IPC::ResponseBuilder rb = rp.MakeBuilder(4, 0, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u64>(1); rb.Push<u64>(1);
NGLOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
} }
void OpenLayer(Kernel::HLERequestContext& ctx) { void OpenLayer(Kernel::HLERequestContext& ctx) {
NGLOG_DEBUG(Service_VI, "called"); LOG_DEBUG(Service_VI, "called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
auto name_buf = rp.PopRaw<std::array<u8, 0x40>>(); auto name_buf = rp.PopRaw<std::array<u8, 0x40>>();
auto end = std::find(name_buf.begin(), name_buf.end(), '\0'); auto end = std::find(name_buf.begin(), name_buf.end(), '\0');
@ -889,7 +889,7 @@ private:
} }
void CreateStrayLayer(Kernel::HLERequestContext& ctx) { void CreateStrayLayer(Kernel::HLERequestContext& ctx) {
NGLOG_DEBUG(Service_VI, "called"); LOG_DEBUG(Service_VI, "called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
u32 flags = rp.Pop<u32>(); u32 flags = rp.Pop<u32>();
@ -909,7 +909,7 @@ private:
} }
void DestroyStrayLayer(Kernel::HLERequestContext& ctx) { void DestroyStrayLayer(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
u64 layer_id = rp.Pop<u64>(); u64 layer_id = rp.Pop<u64>();
@ -919,7 +919,7 @@ private:
} }
void GetDisplayVsyncEvent(Kernel::HLERequestContext& ctx) { void GetDisplayVsyncEvent(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
u64 display_id = rp.Pop<u64>(); u64 display_id = rp.Pop<u64>();
@ -968,7 +968,7 @@ Module::Interface::Interface(std::shared_ptr<Module> module, const char* name,
: ServiceFramework(name), module(std::move(module)), nv_flinger(std::move(nv_flinger)) {} : ServiceFramework(name), module(std::move(module)), nv_flinger(std::move(nv_flinger)) {}
void Module::Interface::GetDisplayService(Kernel::HLERequestContext& ctx) { void Module::Interface::GetDisplayService(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);

View File

@ -33,7 +33,7 @@ inline void Read(T& var, const u32 addr) {
LCD::Read(var, addr); LCD::Read(var, addr);
break; break;
default: default:
NGLOG_ERROR(HW_Memory, "Unknown Read{} @ 0x{:08X}", sizeof(var) * 8, addr); LOG_ERROR(HW_Memory, "Unknown Read{} @ 0x{:08X}", sizeof(var) * 8, addr);
break; break;
} }
} }
@ -62,7 +62,7 @@ inline void Write(u32 addr, const T data) {
LCD::Write(addr, data); LCD::Write(addr, data);
break; break;
default: default:
NGLOG_ERROR(HW_Memory, "Unknown Write{} 0x{:08X} @ 0x{:08X}", sizeof(data) * 8, data, addr); LOG_ERROR(HW_Memory, "Unknown Write{} 0x{:08X} @ 0x{:08X}", sizeof(data) * 8, data, addr);
break; break;
} }
} }
@ -85,12 +85,12 @@ void Update() {}
/// Initialize hardware /// Initialize hardware
void Init() { void Init() {
LCD::Init(); LCD::Init();
NGLOG_DEBUG(HW, "Initialized OK"); LOG_DEBUG(HW, "Initialized OK");
} }
/// Shutdown hardware /// Shutdown hardware
void Shutdown() { void Shutdown() {
LCD::Shutdown(); LCD::Shutdown();
NGLOG_DEBUG(HW, "Shutdown OK"); LOG_DEBUG(HW, "Shutdown OK");
} }
} // namespace HW } // namespace HW

View File

@ -20,7 +20,7 @@ inline void Read(T& var, const u32 raw_addr) {
// Reads other than u32 are untested, so I'd rather have them abort than silently fail // Reads other than u32 are untested, so I'd rather have them abort than silently fail
if (index >= 0x400 || !std::is_same<T, u32>::value) { if (index >= 0x400 || !std::is_same<T, u32>::value) {
NGLOG_ERROR(HW_LCD, "Unknown Read{} @ 0x{:08X}", sizeof(var) * 8, addr); LOG_ERROR(HW_LCD, "Unknown Read{} @ 0x{:08X}", sizeof(var) * 8, addr);
return; return;
} }
@ -34,7 +34,7 @@ inline void Write(u32 addr, const T data) {
// Writes other than u32 are untested, so I'd rather have them abort than silently fail // Writes other than u32 are untested, so I'd rather have them abort than silently fail
if (index >= 0x400 || !std::is_same<T, u32>::value) { if (index >= 0x400 || !std::is_same<T, u32>::value) {
NGLOG_ERROR(HW_LCD, "Unknown Write{} 0x{:08X} @ 0x{:08X}", sizeof(data) * 8, data, addr); LOG_ERROR(HW_LCD, "Unknown Write{} 0x{:08X} @ 0x{:08X}", sizeof(data) * 8, data, addr);
return; return;
} }
@ -56,12 +56,12 @@ template void Write<u8>(u32 addr, const u8 data);
/// Initialize hardware /// Initialize hardware
void Init() { void Init() {
memset(&g_regs, 0, sizeof(g_regs)); memset(&g_regs, 0, sizeof(g_regs));
NGLOG_DEBUG(HW_LCD, "Initialized OK"); LOG_DEBUG(HW_LCD, "Initialized OK");
} }
/// Shutdown hardware /// Shutdown hardware
void Shutdown() { void Shutdown() {
NGLOG_DEBUG(HW_LCD, "Shutdown OK"); LOG_DEBUG(HW_LCD, "Shutdown OK");
} }
} // namespace LCD } // namespace LCD

View File

@ -132,7 +132,7 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(
const VAddr load_addr = next_load_addr; const VAddr load_addr = next_load_addr;
next_load_addr = AppLoader_NSO::LoadModule(path, load_addr); next_load_addr = AppLoader_NSO::LoadModule(path, load_addr);
if (next_load_addr) { if (next_load_addr) {
NGLOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", module, load_addr); LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", module, load_addr);
} else { } else {
next_load_addr = load_addr; next_load_addr = load_addr;
} }
@ -163,7 +163,7 @@ ResultStatus AppLoader_DeconstructedRomDirectory::ReadRomFS(
std::shared_ptr<FileUtil::IOFile>& romfs_file, u64& offset, u64& size) { std::shared_ptr<FileUtil::IOFile>& romfs_file, u64& offset, u64& size) {
if (filepath_romfs.empty()) { if (filepath_romfs.empty()) {
NGLOG_DEBUG(Loader, "No RomFS available"); LOG_DEBUG(Loader, "No RomFS available");
return ResultStatus::ErrorNotUsed; return ResultStatus::ErrorNotUsed;
} }
@ -176,8 +176,8 @@ ResultStatus AppLoader_DeconstructedRomDirectory::ReadRomFS(
offset = 0; offset = 0;
size = romfs_file->GetSize(); size = romfs_file->GetSize();
NGLOG_DEBUG(Loader, "RomFS offset: 0x{:016X}", offset); LOG_DEBUG(Loader, "RomFS offset: 0x{:016X}", offset);
NGLOG_DEBUG(Loader, "RomFS size: 0x{:016X}", size); LOG_DEBUG(Loader, "RomFS size: 0x{:016X}", size);
// Reset read pointer // Reset read pointer
file.Seek(0, SEEK_SET); file.Seek(0, SEEK_SET);

View File

@ -273,18 +273,18 @@ const char* ElfReader::GetSectionName(int section) const {
} }
SharedPtr<CodeSet> ElfReader::LoadInto(u32 vaddr) { SharedPtr<CodeSet> ElfReader::LoadInto(u32 vaddr) {
NGLOG_DEBUG(Loader, "String section: {}", header->e_shstrndx); LOG_DEBUG(Loader, "String section: {}", header->e_shstrndx);
// Should we relocate? // Should we relocate?
relocate = (header->e_type != ET_EXEC); relocate = (header->e_type != ET_EXEC);
if (relocate) { if (relocate) {
NGLOG_DEBUG(Loader, "Relocatable module"); LOG_DEBUG(Loader, "Relocatable module");
entryPoint += vaddr; entryPoint += vaddr;
} else { } else {
NGLOG_DEBUG(Loader, "Prerelocated executable"); LOG_DEBUG(Loader, "Prerelocated executable");
} }
NGLOG_DEBUG(Loader, "{} segments:", header->e_phnum); LOG_DEBUG(Loader, "{} segments:", header->e_phnum);
// First pass : Get the bits into RAM // First pass : Get the bits into RAM
u32 base_addr = relocate ? vaddr : 0; u32 base_addr = relocate ? vaddr : 0;
@ -304,8 +304,8 @@ SharedPtr<CodeSet> ElfReader::LoadInto(u32 vaddr) {
for (unsigned int i = 0; i < header->e_phnum; ++i) { for (unsigned int i = 0; i < header->e_phnum; ++i) {
Elf32_Phdr* p = &segments[i]; Elf32_Phdr* p = &segments[i];
NGLOG_DEBUG(Loader, "Type: {} Vaddr: {:08X} Filesz: {:08X} Memsz: {:08X} ", p->p_type, LOG_DEBUG(Loader, "Type: {} Vaddr: {:08X} Filesz: {:08X} Memsz: {:08X} ", p->p_type,
p->p_vaddr, p->p_filesz, p->p_memsz); p->p_vaddr, p->p_filesz, p->p_memsz);
if (p->p_type == PT_LOAD) { if (p->p_type == PT_LOAD) {
CodeSet::Segment* codeset_segment; CodeSet::Segment* codeset_segment;
@ -317,16 +317,16 @@ SharedPtr<CodeSet> ElfReader::LoadInto(u32 vaddr) {
} else if (permission_flags == (PF_R | PF_W)) { } else if (permission_flags == (PF_R | PF_W)) {
codeset_segment = &codeset->data; codeset_segment = &codeset->data;
} else { } else {
NGLOG_ERROR(Loader, "Unexpected ELF PT_LOAD segment id {} with flags {:X}", i, LOG_ERROR(Loader, "Unexpected ELF PT_LOAD segment id {} with flags {:X}", i,
p->p_flags); p->p_flags);
continue; continue;
} }
if (codeset_segment->size != 0) { if (codeset_segment->size != 0) {
NGLOG_ERROR(Loader, LOG_ERROR(Loader,
"ELF has more than one segment of the same type. Skipping extra " "ELF has more than one segment of the same type. Skipping extra "
"segment (id {})", "segment (id {})",
i); i);
continue; continue;
} }
@ -345,7 +345,7 @@ SharedPtr<CodeSet> ElfReader::LoadInto(u32 vaddr) {
codeset->entrypoint = base_addr + header->e_entry; codeset->entrypoint = base_addr + header->e_entry;
codeset->memory = std::make_shared<std::vector<u8>>(std::move(program_image)); codeset->memory = std::make_shared<std::vector<u8>>(std::move(program_image));
NGLOG_DEBUG(Loader, "Done loading."); LOG_DEBUG(Loader, "Done loading.");
return codeset; return codeset;
} }

View File

@ -84,7 +84,7 @@ void Linker::WriteRelocations(std::vector<u8>& program_image, const std::vector<
} }
break; break;
default: default:
NGLOG_CRITICAL(Loader, "Unknown relocation type: {}", static_cast<int>(rela.type)); LOG_CRITICAL(Loader, "Unknown relocation type: {}", static_cast<int>(rela.type));
break; break;
} }
} }
@ -141,7 +141,7 @@ void Linker::ResolveImports() {
if (search != exports.end()) { if (search != exports.end()) {
Memory::Write64(import.second.ea, search->second + import.second.addend); Memory::Write64(import.second.ea, search->second + import.second.addend);
} else { } else {
NGLOG_ERROR(Loader, "Unresolved import: {}", import.first); LOG_ERROR(Loader, "Unresolved import: {}", import.first);
} }
} }
} }

View File

@ -43,7 +43,7 @@ FileType IdentifyFile(FileUtil::IOFile& file, const std::string& filepath) {
FileType IdentifyFile(const std::string& file_name) { FileType IdentifyFile(const std::string& file_name) {
FileUtil::IOFile file(file_name, "rb"); FileUtil::IOFile file(file_name, "rb");
if (!file.IsOpen()) { if (!file.IsOpen()) {
NGLOG_ERROR(Loader, "Failed to load file {}", file_name); LOG_ERROR(Loader, "Failed to load file {}", file_name);
return FileType::Unknown; return FileType::Unknown;
} }
@ -126,7 +126,7 @@ static std::unique_ptr<AppLoader> GetFileLoader(FileUtil::IOFile&& file, FileTyp
std::unique_ptr<AppLoader> GetLoader(const std::string& filename) { std::unique_ptr<AppLoader> GetLoader(const std::string& filename) {
FileUtil::IOFile file(filename, "rb"); FileUtil::IOFile file(filename, "rb");
if (!file.IsOpen()) { if (!file.IsOpen()) {
NGLOG_ERROR(Loader, "Failed to load file {}", filename); LOG_ERROR(Loader, "Failed to load file {}", filename);
return nullptr; return nullptr;
} }
@ -137,12 +137,12 @@ std::unique_ptr<AppLoader> GetLoader(const std::string& filename) {
FileType filename_type = GuessFromExtension(filename_extension); FileType filename_type = GuessFromExtension(filename_extension);
if (type != filename_type) { if (type != filename_type) {
NGLOG_WARNING(Loader, "File {} has a different type than its extension.", filename); LOG_WARNING(Loader, "File {} has a different type than its extension.", filename);
if (FileType::Unknown == type) if (FileType::Unknown == type)
type = filename_type; type = filename_type;
} }
NGLOG_DEBUG(Loader, "Loading file {} as {}...", filename, GetFileTypeString(type)); LOG_DEBUG(Loader, "Loading file {} as {}...", filename, GetFileTypeString(type));
return GetFileLoader(std::move(file), type, filename_filename, filename); return GetFileLoader(std::move(file), type, filename_filename, filename);
} }

View File

@ -123,7 +123,7 @@ ResultStatus Nca::Load(FileUtil::IOFile&& in_file, std::string in_path) {
file.Seek(0, SEEK_SET); file.Seek(0, SEEK_SET);
std::array<u8, sizeof(NcaHeader)> header_array{}; std::array<u8, sizeof(NcaHeader)> header_array{};
if (sizeof(NcaHeader) != file.ReadBytes(header_array.data(), sizeof(NcaHeader))) if (sizeof(NcaHeader) != file.ReadBytes(header_array.data(), sizeof(NcaHeader)))
NGLOG_CRITICAL(Loader, "File reader errored out during header read."); LOG_CRITICAL(Loader, "File reader errored out during header read.");
NcaHeader header{}; NcaHeader header{};
std::memcpy(&header, header_array.data(), sizeof(NcaHeader)); std::memcpy(&header, header_array.data(), sizeof(NcaHeader));
@ -140,7 +140,7 @@ ResultStatus Nca::Load(FileUtil::IOFile&& in_file, std::string in_path) {
std::array<u8, sizeof(NcaSectionHeaderBlock)> array{}; std::array<u8, sizeof(NcaSectionHeaderBlock)> array{};
if (sizeof(NcaSectionHeaderBlock) != if (sizeof(NcaSectionHeaderBlock) !=
file.ReadBytes(array.data(), sizeof(NcaSectionHeaderBlock))) file.ReadBytes(array.data(), sizeof(NcaSectionHeaderBlock)))
NGLOG_CRITICAL(Loader, "File reader errored out during header read."); LOG_CRITICAL(Loader, "File reader errored out during header read.");
NcaSectionHeaderBlock block{}; NcaSectionHeaderBlock block{};
std::memcpy(&block, array.data(), sizeof(NcaSectionHeaderBlock)); std::memcpy(&block, array.data(), sizeof(NcaSectionHeaderBlock));
@ -154,7 +154,7 @@ ResultStatus Nca::Load(FileUtil::IOFile&& in_file, std::string in_path) {
// Seek back to beginning of this section. // Seek back to beginning of this section.
file.Seek(SECTION_HEADER_OFFSET + i * SECTION_HEADER_SIZE, SEEK_SET); file.Seek(SECTION_HEADER_OFFSET + i * SECTION_HEADER_SIZE, SEEK_SET);
if (sizeof(Pfs0Superblock) != file.ReadBytes(&sb, sizeof(Pfs0Superblock))) if (sizeof(Pfs0Superblock) != file.ReadBytes(&sb, sizeof(Pfs0Superblock)))
NGLOG_CRITICAL(Loader, "File reader errored out during header read."); LOG_CRITICAL(Loader, "File reader errored out during header read.");
u64 offset = (static_cast<u64>(header.section_tables[i].media_offset) * u64 offset = (static_cast<u64>(header.section_tables[i].media_offset) *
MEDIA_OFFSET_MULTIPLIER) + MEDIA_OFFSET_MULTIPLIER) +
@ -258,7 +258,7 @@ ResultStatus AppLoader_NCA::Load(Kernel::SharedPtr<Kernel::Process>& process) {
const VAddr load_addr = next_load_addr; const VAddr load_addr = next_load_addr;
next_load_addr = AppLoader_NSO::LoadModule(module, nca->GetExeFsFile(module), load_addr); next_load_addr = AppLoader_NSO::LoadModule(module, nca->GetExeFsFile(module), load_addr);
if (next_load_addr) { if (next_load_addr) {
NGLOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", module, load_addr); LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", module, load_addr);
} else { } else {
next_load_addr = load_addr; next_load_addr = load_addr;
} }
@ -283,7 +283,7 @@ ResultStatus AppLoader_NCA::Load(Kernel::SharedPtr<Kernel::Process>& process) {
ResultStatus AppLoader_NCA::ReadRomFS(std::shared_ptr<FileUtil::IOFile>& romfs_file, u64& offset, ResultStatus AppLoader_NCA::ReadRomFS(std::shared_ptr<FileUtil::IOFile>& romfs_file, u64& offset,
u64& size) { u64& size) {
if (nca->GetRomFsSize() == 0) { if (nca->GetRomFsSize() == 0) {
NGLOG_DEBUG(Loader, "No RomFS available"); LOG_DEBUG(Loader, "No RomFS available");
return ResultStatus::ErrorNotUsed; return ResultStatus::ErrorNotUsed;
} }
@ -292,8 +292,8 @@ ResultStatus AppLoader_NCA::ReadRomFS(std::shared_ptr<FileUtil::IOFile>& romfs_f
offset = nca->GetRomFsOffset(); offset = nca->GetRomFsOffset();
size = nca->GetRomFsSize(); size = nca->GetRomFsSize();
NGLOG_DEBUG(Loader, "RomFS offset: 0x{:016X}", offset); LOG_DEBUG(Loader, "RomFS offset: 0x{:016X}", offset);
NGLOG_DEBUG(Loader, "RomFS size: 0x{:016X}", size); LOG_DEBUG(Loader, "RomFS size: 0x{:016X}", size);
return ResultStatus::Success; return ResultStatus::Success;
} }

View File

@ -87,7 +87,7 @@ static std::vector<u8> ReadSegment(FileUtil::IOFile& file, const NsoSegmentHeade
file.Seek(header.offset, SEEK_SET); file.Seek(header.offset, SEEK_SET);
if (compressed_size != file.ReadBytes(compressed_data.data(), compressed_size)) { if (compressed_size != file.ReadBytes(compressed_data.data(), compressed_size)) {
NGLOG_CRITICAL(Loader, "Failed to read {} NSO LZ4 compressed bytes", compressed_size); LOG_CRITICAL(Loader, "Failed to read {} NSO LZ4 compressed bytes", compressed_size);
return {}; return {};
} }
@ -215,7 +215,7 @@ ResultStatus AppLoader_NSO::Load(Kernel::SharedPtr<Kernel::Process>& process) {
// Load module // Load module
LoadModule(filepath, Memory::PROCESS_IMAGE_VADDR); LoadModule(filepath, Memory::PROCESS_IMAGE_VADDR);
NGLOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", filepath, Memory::PROCESS_IMAGE_VADDR); LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", filepath, Memory::PROCESS_IMAGE_VADDR);
process->svc_access_mask.set(); process->svc_access_mask.set();
process->address_mappings = default_address_mappings; process->address_mappings = default_address_mappings;

View File

@ -43,8 +43,8 @@ PageTable* GetCurrentPageTable() {
} }
static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, PageType type) { static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, PageType type) {
NGLOG_DEBUG(HW_Memory, "Mapping {} onto {:016X}-{:016X}", fmt::ptr(memory), base * PAGE_SIZE, LOG_DEBUG(HW_Memory, "Mapping {} onto {:016X}-{:016X}", fmt::ptr(memory), base * PAGE_SIZE,
(base + size) * PAGE_SIZE); (base + size) * PAGE_SIZE);
RasterizerFlushVirtualRegion(base << PAGE_BITS, size * PAGE_SIZE, RasterizerFlushVirtualRegion(base << PAGE_BITS, size * PAGE_SIZE,
FlushMode::FlushAndInvalidate); FlushMode::FlushAndInvalidate);
@ -173,7 +173,7 @@ T Read(const VAddr vaddr) {
PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
switch (type) { switch (type) {
case PageType::Unmapped: case PageType::Unmapped:
NGLOG_ERROR(HW_Memory, "Unmapped Read{} @ 0x{:08X}", sizeof(T) * 8, vaddr); LOG_ERROR(HW_Memory, "Unmapped Read{} @ 0x{:08X}", sizeof(T) * 8, vaddr);
return 0; return 0;
case PageType::Memory: case PageType::Memory:
ASSERT_MSG(false, "Mapped memory page without a pointer @ {:016X}", vaddr); ASSERT_MSG(false, "Mapped memory page without a pointer @ {:016X}", vaddr);
@ -205,8 +205,8 @@ void Write(const VAddr vaddr, const T data) {
PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
switch (type) { switch (type) {
case PageType::Unmapped: case PageType::Unmapped:
NGLOG_ERROR(HW_Memory, "Unmapped Write{} 0x{:08X} @ 0x{:016X}", sizeof(data) * 8, LOG_ERROR(HW_Memory, "Unmapped Write{} 0x{:08X} @ 0x{:016X}", sizeof(data) * 8,
static_cast<u32>(data), vaddr); static_cast<u32>(data), vaddr);
return; return;
case PageType::Memory: case PageType::Memory:
ASSERT_MSG(false, "Mapped memory page without a pointer @ {:016X}", vaddr); ASSERT_MSG(false, "Mapped memory page without a pointer @ {:016X}", vaddr);
@ -259,7 +259,7 @@ u8* GetPointer(const VAddr vaddr) {
return GetPointerFromVMA(vaddr); return GetPointerFromVMA(vaddr);
} }
NGLOG_ERROR(HW_Memory, "Unknown GetPointer @ 0x{:016X}", vaddr); LOG_ERROR(HW_Memory, "Unknown GetPointer @ 0x{:016X}", vaddr);
return nullptr; return nullptr;
} }
@ -296,12 +296,12 @@ u8* GetPhysicalPointer(PAddr address) {
}); });
if (area == std::end(memory_areas)) { if (area == std::end(memory_areas)) {
NGLOG_ERROR(HW_Memory, "Unknown GetPhysicalPointer @ 0x{:016X}", address); LOG_ERROR(HW_Memory, "Unknown GetPhysicalPointer @ 0x{:016X}", address);
return nullptr; return nullptr;
} }
if (area->paddr_base == IO_AREA_PADDR) { if (area->paddr_base == IO_AREA_PADDR) {
NGLOG_ERROR(HW_Memory, "MMIO mappings are not supported yet. phys_addr={:016X}", address); LOG_ERROR(HW_Memory, "MMIO mappings are not supported yet. phys_addr={:016X}", address);
return nullptr; return nullptr;
} }
@ -348,9 +348,9 @@ void RasterizerMarkRegionCached(Tegra::GPUVAddr gpu_addr, u64 size, bool cached)
Core::System::GetInstance().GPU().memory_manager->GpuToCpuAddress(gpu_addr); Core::System::GetInstance().GPU().memory_manager->GpuToCpuAddress(gpu_addr);
// The GPU <-> CPU virtual memory mapping is not 1:1 // The GPU <-> CPU virtual memory mapping is not 1:1
if (!maybe_vaddr) { if (!maybe_vaddr) {
NGLOG_ERROR(HW_Memory, LOG_ERROR(HW_Memory,
"Trying to flush a cached region to an invalid physical address {:016X}", "Trying to flush a cached region to an invalid physical address {:016X}",
gpu_addr); gpu_addr);
continue; continue;
} }
VAddr vaddr = *maybe_vaddr; VAddr vaddr = *maybe_vaddr;
@ -484,9 +484,9 @@ void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_
switch (page_table.attributes[page_index]) { switch (page_table.attributes[page_index]) {
case PageType::Unmapped: { case PageType::Unmapped: {
NGLOG_ERROR(HW_Memory, LOG_ERROR(HW_Memory,
"Unmapped ReadBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})", "Unmapped ReadBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})",
current_vaddr, src_addr, size); current_vaddr, src_addr, size);
std::memset(dest_buffer, 0, copy_amount); std::memset(dest_buffer, 0, copy_amount);
break; break;
} }
@ -548,9 +548,9 @@ void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const voi
switch (page_table.attributes[page_index]) { switch (page_table.attributes[page_index]) {
case PageType::Unmapped: { case PageType::Unmapped: {
NGLOG_ERROR(HW_Memory, LOG_ERROR(HW_Memory,
"Unmapped WriteBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})", "Unmapped WriteBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})",
current_vaddr, dest_addr, size); current_vaddr, dest_addr, size);
break; break;
} }
case PageType::Memory: { case PageType::Memory: {
@ -596,9 +596,9 @@ void ZeroBlock(const Kernel::Process& process, const VAddr dest_addr, const size
switch (page_table.attributes[page_index]) { switch (page_table.attributes[page_index]) {
case PageType::Unmapped: { case PageType::Unmapped: {
NGLOG_ERROR(HW_Memory, LOG_ERROR(HW_Memory,
"Unmapped ZeroBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})", "Unmapped ZeroBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})",
current_vaddr, dest_addr, size); current_vaddr, dest_addr, size);
break; break;
} }
case PageType::Memory: { case PageType::Memory: {
@ -637,9 +637,9 @@ void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr,
switch (page_table.attributes[page_index]) { switch (page_table.attributes[page_index]) {
case PageType::Unmapped: { case PageType::Unmapped: {
NGLOG_ERROR(HW_Memory, LOG_ERROR(HW_Memory,
"Unmapped CopyBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})", "Unmapped CopyBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})",
current_vaddr, src_addr, size); current_vaddr, src_addr, size);
ZeroBlock(process, dest_addr, copy_amount); ZeroBlock(process, dest_addr, copy_amount);
break; break;
} }
@ -692,7 +692,7 @@ boost::optional<PAddr> TryVirtualToPhysicalAddress(const VAddr addr) {
PAddr VirtualToPhysicalAddress(const VAddr addr) { PAddr VirtualToPhysicalAddress(const VAddr addr) {
auto paddr = TryVirtualToPhysicalAddress(addr); auto paddr = TryVirtualToPhysicalAddress(addr);
if (!paddr) { if (!paddr) {
NGLOG_ERROR(HW_Memory, "Unknown virtual address @ 0x{:016X}", addr); LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x{:016X}", addr);
// To help with debugging, set bit on address so that it's obviously invalid. // To help with debugging, set bit on address so that it's obviously invalid.
return addr | 0x80000000; return addr | 0x80000000;
} }

View File

@ -42,14 +42,14 @@ u64 GetTelemetryId() {
if (FileUtil::Exists(filename)) { if (FileUtil::Exists(filename)) {
FileUtil::IOFile file(filename, "rb"); FileUtil::IOFile file(filename, "rb");
if (!file.IsOpen()) { if (!file.IsOpen()) {
NGLOG_ERROR(Core, "failed to open telemetry_id: {}", filename); LOG_ERROR(Core, "failed to open telemetry_id: {}", filename);
return {}; return {};
} }
file.ReadBytes(&telemetry_id, sizeof(u64)); file.ReadBytes(&telemetry_id, sizeof(u64));
} else { } else {
FileUtil::IOFile file(filename, "wb"); FileUtil::IOFile file(filename, "wb");
if (!file.IsOpen()) { if (!file.IsOpen()) {
NGLOG_ERROR(Core, "failed to open telemetry_id: {}", filename); LOG_ERROR(Core, "failed to open telemetry_id: {}", filename);
return {}; return {};
} }
telemetry_id = GenerateTelemetryId(); telemetry_id = GenerateTelemetryId();
@ -65,7 +65,7 @@ u64 RegenerateTelemetryId() {
FileUtil::IOFile file(filename, "wb"); FileUtil::IOFile file(filename, "wb");
if (!file.IsOpen()) { if (!file.IsOpen()) {
NGLOG_ERROR(Core, "failed to open telemetry_id: {}", filename); LOG_ERROR(Core, "failed to open telemetry_id: {}", filename);
return {}; return {};
} }
file.WriteBytes(&new_telemetry_id, sizeof(u64)); file.WriteBytes(&new_telemetry_id, sizeof(u64));

View File

@ -159,7 +159,7 @@ void Recorder::Finish(const std::string& filename) {
throw "Failed to write stream element"; throw "Failed to write stream element";
} }
} catch (const char* str) { } catch (const char* str) {
NGLOG_ERROR(HW_GPU, "Writing CiTrace file failed: {}", str); LOG_ERROR(HW_GPU, "Writing CiTrace file failed: {}", str);
} }
} }

View File

@ -32,7 +32,7 @@ public:
explicit SDLJoystick(int joystick_index) explicit SDLJoystick(int joystick_index)
: joystick{SDL_JoystickOpen(joystick_index), SDL_JoystickClose} { : joystick{SDL_JoystickOpen(joystick_index), SDL_JoystickClose} {
if (!joystick) { if (!joystick) {
NGLOG_ERROR(Input, "failed to open joystick {}", joystick_index); LOG_ERROR(Input, "failed to open joystick {}", joystick_index);
} }
} }
@ -204,7 +204,7 @@ public:
trigger_if_greater = false; trigger_if_greater = false;
} else { } else {
trigger_if_greater = true; trigger_if_greater = true;
NGLOG_ERROR(Input, "Unknown direction '{}'", direction_name); LOG_ERROR(Input, "Unknown direction '{}'", direction_name);
} }
return std::make_unique<SDLAxisButton>(GetJoystick(joystick_index), axis, threshold, return std::make_unique<SDLAxisButton>(GetJoystick(joystick_index), axis, threshold,
trigger_if_greater); trigger_if_greater);
@ -235,7 +235,7 @@ public:
void Init() { void Init() {
if (SDL_Init(SDL_INIT_JOYSTICK) < 0) { if (SDL_Init(SDL_INIT_JOYSTICK) < 0) {
NGLOG_CRITICAL(Input, "SDL_Init(SDL_INIT_JOYSTICK) failed with: {}", SDL_GetError()); LOG_CRITICAL(Input, "SDL_Init(SDL_INIT_JOYSTICK) failed with: {}", SDL_GetError());
} else { } else {
using namespace Input; using namespace Input;
RegisterFactory<ButtonDevice>("sdl", std::make_shared<SDLButtonFactory>()); RegisterFactory<ButtonDevice>("sdl", std::make_shared<SDLButtonFactory>());

View File

@ -29,21 +29,21 @@ enum class BufferMethods {
}; };
void GPU::WriteReg(u32 method, u32 subchannel, u32 value, u32 remaining_params) { void GPU::WriteReg(u32 method, u32 subchannel, u32 value, u32 remaining_params) {
NGLOG_WARNING(HW_GPU, LOG_WARNING(HW_GPU,
"Processing method {:08X} on subchannel {} value " "Processing method {:08X} on subchannel {} value "
"{:08X} remaining params {}", "{:08X} remaining params {}",
method, subchannel, value, remaining_params); method, subchannel, value, remaining_params);
if (method == static_cast<u32>(BufferMethods::BindObject)) { if (method == static_cast<u32>(BufferMethods::BindObject)) {
// Bind the current subchannel to the desired engine id. // Bind the current subchannel to the desired engine id.
NGLOG_DEBUG(HW_GPU, "Binding subchannel {} to engine {}", subchannel, value); LOG_DEBUG(HW_GPU, "Binding subchannel {} to engine {}", subchannel, value);
bound_engines[subchannel] = static_cast<EngineID>(value); bound_engines[subchannel] = static_cast<EngineID>(value);
return; return;
} }
if (method < static_cast<u32>(BufferMethods::CountBufferMethods)) { if (method < static_cast<u32>(BufferMethods::CountBufferMethods)) {
// TODO(Subv): Research and implement these methods. // TODO(Subv): Research and implement these methods.
NGLOG_ERROR(HW_GPU, "Special buffer methods other than Bind are not implemented"); LOG_ERROR(HW_GPU, "Special buffer methods other than Bind are not implemented");
return; return;
} }

View File

@ -26,8 +26,8 @@ void Fermi2D::WriteReg(u32 method, u32 value) {
} }
void Fermi2D::HandleSurfaceCopy() { void Fermi2D::HandleSurfaceCopy() {
NGLOG_WARNING(HW_GPU, "Requested a surface copy with operation {}", LOG_WARNING(HW_GPU, "Requested a surface copy with operation {}",
static_cast<u32>(regs.operation)); static_cast<u32>(regs.operation));
const GPUVAddr source = regs.src.Address(); const GPUVAddr source = regs.src.Address();
const GPUVAddr dest = regs.dst.Address(); const GPUVAddr dest = regs.dst.Address();

View File

@ -207,8 +207,8 @@ void Maxwell3D::ProcessQueryGet() {
} }
void Maxwell3D::DrawArrays() { void Maxwell3D::DrawArrays() {
NGLOG_DEBUG(HW_GPU, "called, topology={}, count={}", LOG_DEBUG(HW_GPU, "called, topology={}, count={}", static_cast<u32>(regs.draw.topology.Value()),
static_cast<u32>(regs.draw.topology.Value()), regs.vertex_buffer.count); regs.vertex_buffer.count);
ASSERT_MSG(!(regs.index_array.count && regs.vertex_buffer.count), "Both indexed and direct?"); ASSERT_MSG(!(regs.index_array.count && regs.vertex_buffer.count), "Both indexed and direct?");
auto debug_context = Core::System::GetInstance().GetGPUDebugContext(); auto debug_context = Core::System::GetInstance().GetGPUDebugContext();

View File

@ -31,7 +31,7 @@ void MaxwellDMA::WriteReg(u32 method, u32 value) {
} }
void MaxwellDMA::HandleCopy() { void MaxwellDMA::HandleCopy() {
NGLOG_WARNING(HW_GPU, "Requested a DMA copy"); LOG_WARNING(HW_GPU, "Requested a DMA copy");
const GPUVAddr source = regs.src_address.Address(); const GPUVAddr source = regs.src_address.Address();
const GPUVAddr dest = regs.dst_address.Address(); const GPUVAddr dest = regs.dst_address.Address();

View File

@ -112,7 +112,7 @@ RasterizerOpenGL::RasterizerOpenGL() {
glEnable(GL_BLEND); glEnable(GL_BLEND);
NGLOG_CRITICAL(Render_OpenGL, "Sync fixed function OpenGL state here!"); LOG_CRITICAL(Render_OpenGL, "Sync fixed function OpenGL state here!");
} }
RasterizerOpenGL::~RasterizerOpenGL() { RasterizerOpenGL::~RasterizerOpenGL() {
@ -165,9 +165,9 @@ std::pair<u8*, GLintptr> RasterizerOpenGL::SetupVertexArrays(u8* array_ptr,
// assume every shader uses them all. // assume every shader uses them all.
for (unsigned index = 0; index < 16; ++index) { for (unsigned index = 0; index < 16; ++index) {
auto& attrib = regs.vertex_attrib_format[index]; auto& attrib = regs.vertex_attrib_format[index];
NGLOG_DEBUG(HW_GPU, "vertex attrib {}, count={}, size={}, type={}, offset={}, normalize={}", LOG_DEBUG(HW_GPU, "vertex attrib {}, count={}, size={}, type={}, offset={}, normalize={}",
index, attrib.ComponentCount(), attrib.SizeString(), attrib.TypeString(), index, attrib.ComponentCount(), attrib.SizeString(), attrib.TypeString(),
attrib.offset.Value(), attrib.IsNormalized()); attrib.offset.Value(), attrib.IsNormalized());
auto& buffer = regs.vertex_array[attrib.buffer]; auto& buffer = regs.vertex_array[attrib.buffer];
ASSERT(buffer.IsEnabled()); ASSERT(buffer.IsEnabled());
@ -251,8 +251,8 @@ void RasterizerOpenGL::SetupShaders(u8* buffer_ptr, GLintptr buffer_offset) {
break; break;
} }
default: default:
NGLOG_CRITICAL(HW_GPU, "Unimplemented shader index={}, enable={}, offset=0x{:08X}", LOG_CRITICAL(HW_GPU, "Unimplemented shader index={}, enable={}, offset=0x{:08X}", index,
index, shader_config.enable.Value(), shader_config.offset); shader_config.enable.Value(), shader_config.offset);
UNREACHABLE(); UNREACHABLE();
} }
@ -587,8 +587,8 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint progr
size = buffer.size * sizeof(float); size = buffer.size * sizeof(float);
if (size > MaxConstbufferSize) { if (size > MaxConstbufferSize) {
NGLOG_ERROR(HW_GPU, "indirect constbuffer size {} exceeds maximum {}", size, LOG_ERROR(HW_GPU, "indirect constbuffer size {} exceeds maximum {}", size,
MaxConstbufferSize); MaxConstbufferSize);
size = MaxConstbufferSize; size = MaxConstbufferSize;
} }
} else { } else {

View File

@ -117,7 +117,7 @@ static std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) {
case PixelFormat::ASTC_2D_4X4: case PixelFormat::ASTC_2D_4X4:
return {4, 4}; return {4, 4};
default: default:
NGLOG_CRITICAL(HW_GPU, "Unhandled format: {}", static_cast<u32>(format)); LOG_CRITICAL(HW_GPU, "Unhandled format: {}", static_cast<u32>(format));
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -159,7 +159,7 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, Tegra::
} else { } else {
// TODO(bunnei): Assumes the default rendering GOB size of 16 (128 lines). We should // TODO(bunnei): Assumes the default rendering GOB size of 16 (128 lines). We should
// check the configuration for this and perform more generic un/swizzle // check the configuration for this and perform more generic un/swizzle
NGLOG_WARNING(Render_OpenGL, "need to use correct swizzle/GOB parameters!"); LOG_WARNING(Render_OpenGL, "need to use correct swizzle/GOB parameters!");
VideoCore::MortonCopyPixels128( VideoCore::MortonCopyPixels128(
stride, height, bytes_per_pixel, gl_bytes_per_pixel, stride, height, bytes_per_pixel, gl_bytes_per_pixel,
Memory::GetPointer(*gpu.memory_manager->GpuToCpuAddress(addr)), gl_buffer, Memory::GetPointer(*gpu.memory_manager->GpuToCpuAddress(addr)), gl_buffer,
@ -396,7 +396,7 @@ SurfaceSurfaceRect_Tuple RasterizerCacheOpenGL::GetFramebufferSurfaces(
const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs;
// TODO(bunnei): This is hard corded to use just the first render buffer // TODO(bunnei): This is hard corded to use just the first render buffer
NGLOG_WARNING(Render_OpenGL, "hard-coded for render target 0!"); LOG_WARNING(Render_OpenGL, "hard-coded for render target 0!");
// get color and depth surfaces // get color and depth surfaces
const SurfaceParams color_params{SurfaceParams::CreateForFramebuffer(regs.rt[0])}; const SurfaceParams color_params{SurfaceParams::CreateForFramebuffer(regs.rt[0])};

View File

@ -131,7 +131,7 @@ struct SurfaceParams {
case Tegra::DepthFormat::Z24_S8_UNORM: case Tegra::DepthFormat::Z24_S8_UNORM:
return PixelFormat::Z24S8; return PixelFormat::Z24S8;
default: default:
NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -150,7 +150,7 @@ struct SurfaceParams {
case Tegra::RenderTargetFormat::RGBA32_UINT: case Tegra::RenderTargetFormat::RGBA32_UINT:
return PixelFormat::RGBA32UI; return PixelFormat::RGBA32UI;
default: default:
NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -185,7 +185,7 @@ struct SurfaceParams {
case Tegra::Texture::TextureFormat::ASTC_2D_4X4: case Tegra::Texture::TextureFormat::ASTC_2D_4X4:
return PixelFormat::ASTC_2D_4X4; return PixelFormat::ASTC_2D_4X4;
default: default:
NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -239,7 +239,7 @@ struct SurfaceParams {
case Tegra::Texture::ComponentType::UNORM: case Tegra::Texture::ComponentType::UNORM:
return ComponentType::UNorm; return ComponentType::UNorm;
default: default:
NGLOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type)); LOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type));
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -257,7 +257,7 @@ struct SurfaceParams {
case Tegra::RenderTargetFormat::RGBA32_UINT: case Tegra::RenderTargetFormat::RGBA32_UINT:
return ComponentType::UInt; return ComponentType::UInt;
default: default:
NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -267,7 +267,7 @@ struct SurfaceParams {
case Tegra::FramebufferConfig::PixelFormat::ABGR8: case Tegra::FramebufferConfig::PixelFormat::ABGR8:
return PixelFormat::ABGR8; return PixelFormat::ABGR8;
default: default:
NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -277,7 +277,7 @@ struct SurfaceParams {
case Tegra::DepthFormat::Z24_S8_UNORM: case Tegra::DepthFormat::Z24_S8_UNORM:
return ComponentType::UNorm; return ComponentType::UNorm;
default: default:
NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
UNREACHABLE(); UNREACHABLE();
} }
} }

View File

@ -283,7 +283,7 @@ public:
// Default - do nothing // Default - do nothing
return value; return value;
default: default:
NGLOG_CRITICAL(HW_GPU, "Unimplemented conversion size {}", static_cast<u32>(size)); LOG_CRITICAL(HW_GPU, "Unimplemented conversion size {}", static_cast<u32>(size));
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -581,7 +581,7 @@ private:
return "input_attribute_" + std::to_string(index); return "input_attribute_" + std::to_string(index);
} }
NGLOG_CRITICAL(HW_GPU, "Unhandled input attribute: {}", index); LOG_CRITICAL(HW_GPU, "Unhandled input attribute: {}", index);
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -599,7 +599,7 @@ private:
return "output_attribute_" + std::to_string(index); return "output_attribute_" + std::to_string(index);
} }
NGLOG_CRITICAL(HW_GPU, "Unhandled output attribute: {}", index); LOG_CRITICAL(HW_GPU, "Unhandled output attribute: {}", index);
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -797,7 +797,7 @@ private:
break; break;
} }
default: default:
NGLOG_CRITICAL(HW_GPU, "Unimplemented logic operation: {}", static_cast<u32>(logic_op)); LOG_CRITICAL(HW_GPU, "Unimplemented logic operation: {}", static_cast<u32>(logic_op));
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -819,7 +819,7 @@ private:
// Decoding failure // Decoding failure
if (!opcode) { if (!opcode) {
NGLOG_CRITICAL(HW_GPU, "Unhandled instruction: {0:x}", instr.value); LOG_CRITICAL(HW_GPU, "Unhandled instruction: {0:x}", instr.value);
UNREACHABLE(); UNREACHABLE();
return offset + 1; return offset + 1;
} }
@ -922,8 +922,8 @@ private:
instr.alu.saturate_d); instr.alu.saturate_d);
break; break;
default: default:
NGLOG_CRITICAL(HW_GPU, "Unhandled MUFU sub op: {0:x}", LOG_CRITICAL(HW_GPU, "Unhandled MUFU sub op: {0:x}",
static_cast<unsigned>(instr.sub_op.Value())); static_cast<unsigned>(instr.sub_op.Value()));
UNREACHABLE(); UNREACHABLE();
} }
break; break;
@ -946,11 +946,11 @@ private:
// Currently RRO is only implemented as a register move. // Currently RRO is only implemented as a register move.
// Usage of `abs_b` and `negate_b` here should also be correct. // Usage of `abs_b` and `negate_b` here should also be correct.
regs.SetRegisterToFloat(instr.gpr0, 0, op_b, 1, 1); regs.SetRegisterToFloat(instr.gpr0, 0, op_b, 1, 1);
NGLOG_WARNING(HW_GPU, "RRO instruction is incomplete"); LOG_WARNING(HW_GPU, "RRO instruction is incomplete");
break; break;
} }
default: { default: {
NGLOG_CRITICAL(HW_GPU, "Unhandled arithmetic instruction: {}", opcode->GetName()); LOG_CRITICAL(HW_GPU, "Unhandled arithmetic instruction: {}", opcode->GetName());
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -989,7 +989,7 @@ private:
break; break;
} }
default: { default: {
NGLOG_CRITICAL(HW_GPU, "Unhandled BFE instruction: {}", opcode->GetName()); LOG_CRITICAL(HW_GPU, "Unhandled BFE instruction: {}", opcode->GetName());
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -1032,7 +1032,7 @@ private:
regs.SetRegisterToInteger(instr.gpr0, true, 0, op_a + " << " + op_b, 1, 1); regs.SetRegisterToInteger(instr.gpr0, true, 0, op_a + " << " + op_b, 1, 1);
break; break;
default: { default: {
NGLOG_CRITICAL(HW_GPU, "Unhandled shift instruction: {}", opcode->GetName()); LOG_CRITICAL(HW_GPU, "Unhandled shift instruction: {}", opcode->GetName());
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -1062,8 +1062,8 @@ private:
break; break;
} }
default: { default: {
NGLOG_CRITICAL(HW_GPU, "Unhandled ArithmeticIntegerImmediate instruction: {}", LOG_CRITICAL(HW_GPU, "Unhandled ArithmeticIntegerImmediate instruction: {}",
opcode->GetName()); opcode->GetName());
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -1128,8 +1128,8 @@ private:
break; break;
} }
default: { default: {
NGLOG_CRITICAL(HW_GPU, "Unhandled ArithmeticInteger instruction: {}", LOG_CRITICAL(HW_GPU, "Unhandled ArithmeticInteger instruction: {}",
opcode->GetName()); opcode->GetName());
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -1165,7 +1165,7 @@ private:
break; break;
} }
default: { default: {
NGLOG_CRITICAL(HW_GPU, "Unhandled FFMA instruction: {}", opcode->GetName()); LOG_CRITICAL(HW_GPU, "Unhandled FFMA instruction: {}", opcode->GetName());
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -1223,8 +1223,8 @@ private:
op_a = "trunc(" + op_a + ')'; op_a = "trunc(" + op_a + ')';
break; break;
default: default:
NGLOG_CRITICAL(HW_GPU, "Unimplemented f2f rounding mode {}", LOG_CRITICAL(HW_GPU, "Unimplemented f2f rounding mode {}",
static_cast<u32>(instr.conversion.f2f.rounding.Value())); static_cast<u32>(instr.conversion.f2f.rounding.Value()));
UNREACHABLE(); UNREACHABLE();
break; break;
} }
@ -1257,8 +1257,8 @@ private:
op_a = "trunc(" + op_a + ')'; op_a = "trunc(" + op_a + ')';
break; break;
default: default:
NGLOG_CRITICAL(HW_GPU, "Unimplemented f2i rounding mode {}", LOG_CRITICAL(HW_GPU, "Unimplemented f2i rounding mode {}",
static_cast<u32>(instr.conversion.f2i.rounding.Value())); static_cast<u32>(instr.conversion.f2i.rounding.Value()));
UNREACHABLE(); UNREACHABLE();
break; break;
} }
@ -1274,7 +1274,7 @@ private:
break; break;
} }
default: { default: {
NGLOG_CRITICAL(HW_GPU, "Unhandled conversion instruction: {}", opcode->GetName()); LOG_CRITICAL(HW_GPU, "Unhandled conversion instruction: {}", opcode->GetName());
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -1309,8 +1309,8 @@ private:
break; break;
default: default:
NGLOG_CRITICAL(HW_GPU, "Unhandled type: {}", LOG_CRITICAL(HW_GPU, "Unhandled type: {}",
static_cast<unsigned>(instr.ld_c.type.Value())); static_cast<unsigned>(instr.ld_c.type.Value()));
UNREACHABLE(); UNREACHABLE();
} }
break; break;
@ -1383,7 +1383,7 @@ private:
break; break;
} }
default: { default: {
NGLOG_CRITICAL(HW_GPU, "Unhandled memory instruction: {}", opcode->GetName()); LOG_CRITICAL(HW_GPU, "Unhandled memory instruction: {}", opcode->GetName());
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -1600,7 +1600,7 @@ private:
break; break;
} }
default: { default: {
NGLOG_CRITICAL(HW_GPU, "Unhandled instruction: {}", opcode->GetName()); LOG_CRITICAL(HW_GPU, "Unhandled instruction: {}", opcode->GetName());
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -1740,7 +1740,7 @@ boost::optional<ProgramResult> DecompileProgram(const ProgramCode& program_code,
GLSLGenerator generator(subroutines, program_code, main_offset, stage); GLSLGenerator generator(subroutines, program_code, main_offset, stage);
return ProgramResult{generator.GetShaderCode(), generator.GetEntries()}; return ProgramResult{generator.GetShaderCode(), generator.GetEntries()};
} catch (const DecompileFail& exception) { } catch (const DecompileFail& exception) {
NGLOG_ERROR(HW_GPU, "Shader decompilation failed: {}", exception.what()); LOG_ERROR(HW_GPU, "Shader decompilation failed: {}", exception.what());
} }
return boost::none; return boost::none;
} }

View File

@ -27,7 +27,7 @@ GLuint LoadShader(const char* source, GLenum type) {
} }
GLuint shader_id = glCreateShader(type); GLuint shader_id = glCreateShader(type);
glShaderSource(shader_id, 1, &source, nullptr); glShaderSource(shader_id, 1, &source, nullptr);
NGLOG_DEBUG(Render_OpenGL, "Compiling {} shader...", debug_type); LOG_DEBUG(Render_OpenGL, "Compiling {} shader...", debug_type);
glCompileShader(shader_id); glCompileShader(shader_id);
GLint result = GL_FALSE; GLint result = GL_FALSE;
@ -39,9 +39,9 @@ GLuint LoadShader(const char* source, GLenum type) {
std::string shader_error(info_log_length, ' '); std::string shader_error(info_log_length, ' ');
glGetShaderInfoLog(shader_id, info_log_length, nullptr, &shader_error[0]); glGetShaderInfoLog(shader_id, info_log_length, nullptr, &shader_error[0]);
if (result == GL_TRUE) { if (result == GL_TRUE) {
NGLOG_DEBUG(Render_OpenGL, "{}", shader_error); LOG_DEBUG(Render_OpenGL, "{}", shader_error);
} else { } else {
NGLOG_ERROR(Render_OpenGL, "Error compiling {} shader:\n{}", debug_type, shader_error); LOG_ERROR(Render_OpenGL, "Error compiling {} shader:\n{}", debug_type, shader_error);
} }
} }
return shader_id; return shader_id;

Some files were not shown because too many files have changed in this diff Show More