From 0600e2d8b5b30bd68c8b19cb1f2051e096e7caa9 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Fri, 5 Dec 2014 23:53:49 -0200 Subject: [PATCH] Convert old logging calls to new logging macros --- src/citra/citra.cpp | 4 +- src/citra/config.cpp | 6 +- src/citra/emu_window/emu_window_glfw.cpp | 16 +- src/citra_qt/bootmanager.cpp | 8 +- .../debugger/graphics_breakpoints.cpp | 2 +- src/citra_qt/main.cpp | 6 +- src/citra_qt/util/spinbox.cpp | 2 +- src/common/break_points.cpp | 2 +- src/common/chunk_file.h | 35 ++- src/common/file_util.cpp | 84 ++++---- src/common/log.h | 16 +- src/common/mem_arena.cpp | 14 +- src/common/memory_util.cpp | 2 +- src/common/msg_handler.cpp | 2 +- src/common/string_util.cpp | 10 +- .../arm/dyncom/arm_dyncom_interpreter.cpp | 200 +++++++++--------- src/core/arm/interpreter/armemu.cpp | 4 +- src/core/arm/interpreter/armsupp.cpp | 8 +- src/core/arm/interpreter/thumbemu.cpp | 2 +- src/core/arm/skyeye_common/armemu.h | 4 +- src/core/core.cpp | 4 +- src/core/core_timing.cpp | 8 +- src/core/file_sys/archive.h | 12 +- src/core/file_sys/archive_romfs.cpp | 18 +- src/core/file_sys/archive_sdmc.cpp | 18 +- src/core/file_sys/directory_sdmc.cpp | 2 +- src/core/file_sys/file_sdmc.cpp | 2 +- src/core/hle/config_mem.cpp | 2 +- src/core/hle/hle.cpp | 12 +- src/core/hle/kernel/address_arbiter.cpp | 8 +- src/core/hle/kernel/archive.cpp | 50 ++--- src/core/hle/kernel/kernel.cpp | 8 +- src/core/hle/kernel/kernel.h | 17 +- src/core/hle/kernel/shared_memory.cpp | 10 +- src/core/hle/kernel/thread.cpp | 24 +-- src/core/hle/service/ac_u.cpp | 2 +- src/core/hle/service/apt_u.cpp | 20 +- src/core/hle/service/cfg_u.cpp | 6 +- src/core/hle/service/dsp_dsp.cpp | 14 +- src/core/hle/service/fs_user.cpp | 54 ++--- src/core/hle/service/gsp_gpu.cpp | 18 +- src/core/hle/service/hid_user.cpp | 2 +- src/core/hle/service/ptm_u.cpp | 8 +- src/core/hle/service/service.cpp | 4 +- src/core/hle/service/service.h | 8 +- src/core/hle/service/srv.cpp | 8 +- src/core/hle/svc.cpp | 54 ++--- src/core/hw/gpu.cpp | 16 +- src/core/hw/hw.cpp | 8 +- src/core/loader/3dsx.cpp | 14 +- src/core/loader/elf.cpp | 16 +- src/core/loader/loader.cpp | 6 +- src/core/loader/ncch.cpp | 34 +-- src/core/mem_map.cpp | 4 +- src/core/mem_map_funcs.cpp | 12 +- src/video_core/clipper.cpp | 2 +- src/video_core/command_processor.cpp | 6 +- src/video_core/debug_utils/debug_utils.cpp | 18 +- src/video_core/gpu_debugger.h | 2 +- src/video_core/primitive_assembly.cpp | 2 +- src/video_core/rasterizer.cpp | 12 +- .../renderer_opengl/gl_shader_util.cpp | 24 ++- .../renderer_opengl/renderer_opengl.cpp | 12 +- src/video_core/vertex_shader.cpp | 6 +- src/video_core/video_core.cpp | 4 +- 65 files changed, 502 insertions(+), 516 deletions(-) diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index 7c031ce8d..d192428e9 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp @@ -27,7 +27,7 @@ int __cdecl main(int argc, char **argv) { }); if (argc < 2) { - ERROR_LOG(BOOT, "Failed to load ROM: No ROM specified"); + LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified"); return -1; } @@ -40,7 +40,7 @@ int __cdecl main(int argc, char **argv) { Loader::ResultStatus load_result = Loader::LoadFile(boot_filename); if (Loader::ResultStatus::Success != load_result) { - ERROR_LOG(BOOT, "Failed to load ROM (Error %i)!", load_result); + LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result); return -1; } diff --git a/src/citra/config.cpp b/src/citra/config.cpp index 1f8f5922b..fe0ebe5a8 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp @@ -22,17 +22,17 @@ Config::Config() { bool Config::LoadINI(INIReader* config, const char* location, const std::string& default_contents, bool retry) { if (config->ParseError() < 0) { if (retry) { - ERROR_LOG(CONFIG, "Failed to load %s. Creating file from defaults...", location); + LOG_WARNING(Config, "Failed to load %s. Creating file from defaults...", location); FileUtil::CreateFullPath(location); FileUtil::WriteStringToFile(true, default_contents, location); *config = INIReader(location); // Reopen file return LoadINI(config, location, default_contents, false); } - ERROR_LOG(CONFIG, "Failed."); + LOG_ERROR(Config, "Failed."); return false; } - INFO_LOG(CONFIG, "Successfully loaded %s", location); + LOG_INFO(Config, "Successfully loaded %s", location); return true; } diff --git a/src/citra/emu_window/emu_window_glfw.cpp b/src/citra/emu_window/emu_window_glfw.cpp index 982619126..929e09f43 100644 --- a/src/citra/emu_window/emu_window_glfw.cpp +++ b/src/citra/emu_window/emu_window_glfw.cpp @@ -36,15 +36,15 @@ const bool EmuWindow_GLFW::IsOpen() { } void EmuWindow_GLFW::OnFramebufferResizeEvent(GLFWwindow* win, int width, int height) { - _dbg_assert_(GUI, width > 0); - _dbg_assert_(GUI, height > 0); + _dbg_assert_(Frontend, width > 0); + _dbg_assert_(Frontend, height > 0); GetEmuWindow(win)->NotifyFramebufferSizeChanged(std::pair(width, height)); } void EmuWindow_GLFW::OnClientAreaResizeEvent(GLFWwindow* win, int width, int height) { - _dbg_assert_(GUI, width > 0); - _dbg_assert_(GUI, height > 0); + _dbg_assert_(Frontend, width > 0); + _dbg_assert_(Frontend, height > 0); // NOTE: GLFW provides no proper way to set a minimal window size. // Hence, we just ignore the corresponding EmuWindow hint. @@ -59,12 +59,12 @@ EmuWindow_GLFW::EmuWindow_GLFW() { ReloadSetKeymaps(); glfwSetErrorCallback([](int error, const char *desc){ - ERROR_LOG(GUI, "GLFW 0x%08x: %s", error, desc); + LOG_ERROR(Frontend, "GLFW 0x%08x: %s", error, desc); }); // Initialize the window if(glfwInit() != GL_TRUE) { - ERROR_LOG(GUI, "Failed to initialize GLFW! Exiting..."); + LOG_CRITICAL(Frontend, "Failed to initialize GLFW! Exiting..."); exit(1); } glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); @@ -79,7 +79,7 @@ EmuWindow_GLFW::EmuWindow_GLFW() { window_title.c_str(), nullptr, nullptr); if (m_render_window == nullptr) { - ERROR_LOG(GUI, "Failed to create GLFW window! Exiting..."); + LOG_CRITICAL(Frontend, "Failed to create GLFW window! Exiting..."); exit(1); } @@ -149,7 +149,7 @@ void EmuWindow_GLFW::OnMinimalClientAreaChangeRequest(const std::pair current_size; glfwGetWindowSize(m_render_window, ¤t_size.first, ¤t_size.second); - _dbg_assert_(GUI, (int)minimal_size.first > 0 && (int)minimal_size.second > 0); + _dbg_assert_(Frontend, (int)minimal_size.first > 0 && (int)minimal_size.second > 0); int new_width = std::max(current_size.first, (int)minimal_size.first); int new_height = std::max(current_size.second, (int)minimal_size.second); diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index b53206be6..6d08d6afc 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -62,7 +62,7 @@ void EmuThread::Stop() { if (!isRunning()) { - INFO_LOG(MASTER_LOG, "EmuThread::Stop called while emu thread wasn't running, returning..."); + LOG_WARNING(Frontend, "EmuThread::Stop called while emu thread wasn't running, returning..."); return; } stop_run = true; @@ -76,7 +76,7 @@ void EmuThread::Stop() wait(1000); if (isRunning()) { - WARN_LOG(MASTER_LOG, "EmuThread still running, terminating..."); + LOG_WARNING(Frontend, "EmuThread still running, terminating..."); quit(); // TODO: Waiting 50 seconds can be necessary if the logging subsystem has a lot of spam @@ -84,11 +84,11 @@ void EmuThread::Stop() wait(50000); if (isRunning()) { - WARN_LOG(MASTER_LOG, "EmuThread STILL running, something is wrong here..."); + LOG_CRITICAL(Frontend, "EmuThread STILL running, something is wrong here..."); terminate(); } } - INFO_LOG(MASTER_LOG, "EmuThread stopped"); + LOG_INFO(Frontend, "EmuThread stopped"); } diff --git a/src/citra_qt/debugger/graphics_breakpoints.cpp b/src/citra_qt/debugger/graphics_breakpoints.cpp index df5579e15..53394b6e6 100644 --- a/src/citra_qt/debugger/graphics_breakpoints.cpp +++ b/src/citra_qt/debugger/graphics_breakpoints.cpp @@ -45,7 +45,7 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const map.insert({Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incoming primitive batch")}); map.insert({Pica::DebugContext::Event::FinishedPrimitiveBatch, tr("Finished primitive batch")}); - _dbg_assert_(GUI, map.size() == static_cast(Pica::DebugContext::Event::NumEvents)); + _dbg_assert_(Debug_GPU, map.size() == static_cast(Pica::DebugContext::Event::NumEvents)); return map[event]; } diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 2e3025295..5293263cd 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -158,18 +158,18 @@ GMainWindow::~GMainWindow() void GMainWindow::BootGame(std::string filename) { - NOTICE_LOG(MASTER_LOG, "Citra starting...\n"); + LOG_INFO(Frontend, "Citra starting...\n"); System::Init(render_window); if (Core::Init()) { - ERROR_LOG(MASTER_LOG, "Core initialization failed, exiting..."); + LOG_CRITICAL(Frontend, "Core initialization failed, exiting..."); Core::Stop(); exit(1); } // Load a game or die... if (Loader::ResultStatus::Success != Loader::LoadFile(filename)) { - ERROR_LOG(BOOT, "Failed to load ROM!"); + LOG_CRITICAL(Frontend, "Failed to load ROM!"); } disasmWidget->Init(); diff --git a/src/citra_qt/util/spinbox.cpp b/src/citra_qt/util/spinbox.cpp index 80dc67d7d..9672168f5 100644 --- a/src/citra_qt/util/spinbox.cpp +++ b/src/citra_qt/util/spinbox.cpp @@ -244,7 +244,7 @@ QValidator::State CSpinBox::validate(QString& input, int& pos) const if (strpos >= input.length() - HasSign() - suffix.length()) return QValidator::Intermediate; - _dbg_assert_(GUI, base <= 10 || base == 16); + _dbg_assert_(Frontend, base <= 10 || base == 16); QString regexp; // Demand sign character for negative ranges diff --git a/src/common/break_points.cpp b/src/common/break_points.cpp index 25528b864..587dbf40a 100644 --- a/src/common/break_points.cpp +++ b/src/common/break_points.cpp @@ -180,7 +180,7 @@ void TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr, { if (Log) { - INFO_LOG(MEMMAP, "CHK %08x (%s) %s%i %0*x at %08x (%s)", + LOG_DEBUG(Debug_Breakpoint, "CHK %08x (%s) %s%i %0*x at %08x (%s)", pc, debug_interface->getDescription(pc).c_str(), write ? "Write" : "Read", size*8, size*2, iValue, addr, debug_interface->getDescription(addr).c_str() diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h index 32af74594..39a14dc81 100644 --- a/src/common/chunk_file.h +++ b/src/common/chunk_file.h @@ -154,7 +154,7 @@ public: Do(foundVersion); if (error == ERROR_FAILURE || foundVersion < minVer || foundVersion > ver) { - WARN_LOG(COMMON, "Savestate failure: wrong version %d found for %s", foundVersion, title); + LOG_ERROR(Common, "Savestate failure: wrong version %d found for %s", foundVersion, title); SetError(ERROR_FAILURE); return PointerWrapSection(*this, -1, title); } @@ -178,7 +178,14 @@ public: case MODE_READ: if (memcmp(data, *ptr, size) != 0) return false; break; case MODE_WRITE: memcpy(*ptr, data, size); break; case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything - case MODE_VERIFY: for(int i = 0; i < size; i++) _dbg_assert_msg_(COMMON, ((u8*)data)[i] == (*ptr)[i], "Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n", ((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i], (*ptr)[i], (*ptr)[i], &(*ptr)[i]); break; + case MODE_VERIFY: + for (int i = 0; i < size; i++) { + _dbg_assert_msg_(Common, ((u8*)data)[i] == (*ptr)[i], + "Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n", + ((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i], + (*ptr)[i], (*ptr)[i], &(*ptr)[i]); + } + break; default: break; // throw an error? } (*ptr) += size; @@ -191,7 +198,14 @@ public: case MODE_READ: memcpy(data, *ptr, size); break; case MODE_WRITE: memcpy(*ptr, data, size); break; case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything - case MODE_VERIFY: for(int i = 0; i < size; i++) _dbg_assert_msg_(COMMON, ((u8*)data)[i] == (*ptr)[i], "Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n", ((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i], (*ptr)[i], (*ptr)[i], &(*ptr)[i]); break; + case MODE_VERIFY: + for (int i = 0; i < size; i++) { + _dbg_assert_msg_(Common, ((u8*)data)[i] == (*ptr)[i], + "Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n", + ((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i], + (*ptr)[i], (*ptr)[i], &(*ptr)[i]); + } + break; default: break; // throw an error? } (*ptr) += size; @@ -476,7 +490,7 @@ public: break; default: - ERROR_LOG(COMMON, "Savestate error: invalid mode %d.", mode); + LOG_ERROR(Common, "Savestate error: invalid mode %d.", mode); } } @@ -490,7 +504,12 @@ public: case MODE_READ: x = (char*)*ptr; break; case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; case MODE_MEASURE: break; - case MODE_VERIFY: _dbg_assert_msg_(COMMON, !strcmp(x.c_str(), (char*)*ptr), "Savestate verification failure: \"%s\" != \"%s\" (at %p).\n", x.c_str(), (char*)*ptr, ptr); break; + case MODE_VERIFY: + _dbg_assert_msg_(Common, + !strcmp(x.c_str(), (char*)*ptr), + "Savestate verification failure: \"%s\" != \"%s\" (at %p).\n", + x.c_str(), (char*)*ptr, ptr); + break; } (*ptr) += stringLen; } @@ -504,7 +523,11 @@ public: case MODE_READ: x = (wchar_t*)*ptr; break; case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; case MODE_MEASURE: break; - case MODE_VERIFY: _dbg_assert_msg_(COMMON, x == (wchar_t*)*ptr, "Savestate verification failure: \"%ls\" != \"%ls\" (at %p).\n", x.c_str(), (wchar_t*)*ptr, ptr); break; + case MODE_VERIFY: + _dbg_assert_msg_(Common, x == (wchar_t*)*ptr, + "Savestate verification failure: \"%ls\" != \"%ls\" (at %p).\n", + x.c_str(), (wchar_t*)*ptr, ptr); + break; } (*ptr) += stringLen; } diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 7579d8c0f..88c46c117 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -88,7 +88,7 @@ bool IsDirectory(const std::string &filename) #endif if (result < 0) { - WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s", + LOG_WARNING(Common_Filesystem, "stat failed on %s: %s", filename.c_str(), GetLastErrorMsg()); return false; } @@ -100,33 +100,33 @@ bool IsDirectory(const std::string &filename) // Doesn't supports deleting a directory bool Delete(const std::string &filename) { - INFO_LOG(COMMON, "Delete: file %s", filename.c_str()); + LOG_INFO(Common_Filesystem, "file %s", filename.c_str()); // Return true because we care about the file no // being there, not the actual delete. if (!Exists(filename)) { - WARN_LOG(COMMON, "Delete: %s does not exist", filename.c_str()); + LOG_WARNING(Common_Filesystem, "%s does not exist", filename.c_str()); return true; } // We can't delete a directory if (IsDirectory(filename)) { - WARN_LOG(COMMON, "Delete failed: %s is a directory", filename.c_str()); + LOG_ERROR(Common_Filesystem, "Failed: %s is a directory", filename.c_str()); return false; } #ifdef _WIN32 if (!DeleteFile(Common::UTF8ToTStr(filename).c_str())) { - WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", + LOG_ERROR(Common_Filesystem, "DeleteFile failed on %s: %s", filename.c_str(), GetLastErrorMsg()); return false; } #else if (unlink(filename.c_str()) == -1) { - WARN_LOG(COMMON, "Delete: unlink failed on %s: %s", + LOG_ERROR(Common_Filesystem, "unlink failed on %s: %s", filename.c_str(), GetLastErrorMsg()); return false; } @@ -138,17 +138,17 @@ bool Delete(const std::string &filename) // Returns true if successful, or path already exists. bool CreateDir(const std::string &path) { - INFO_LOG(COMMON, "CreateDir: directory %s", path.c_str()); + LOG_TRACE(Common_Filesystem, "directory %s", path.c_str()); #ifdef _WIN32 if (::CreateDirectory(Common::UTF8ToTStr(path).c_str(), nullptr)) return true; DWORD error = GetLastError(); if (error == ERROR_ALREADY_EXISTS) { - WARN_LOG(COMMON, "CreateDir: CreateDirectory failed on %s: already exists", path.c_str()); + LOG_WARNING(Common_Filesystem, "CreateDirectory failed on %s: already exists", path.c_str()); return true; } - ERROR_LOG(COMMON, "CreateDir: CreateDirectory failed on %s: %i", path.c_str(), error); + LOG_ERROR(Common_Filesystem, "CreateDirectory failed on %s: %i", path.c_str(), error); return false; #else if (mkdir(path.c_str(), 0755) == 0) @@ -158,11 +158,11 @@ bool CreateDir(const std::string &path) if (err == EEXIST) { - WARN_LOG(COMMON, "CreateDir: mkdir failed on %s: already exists", path.c_str()); + LOG_WARNING(Common_Filesystem, "mkdir failed on %s: already exists", path.c_str()); return true; } - ERROR_LOG(COMMON, "CreateDir: mkdir failed on %s: %s", path.c_str(), strerror(err)); + LOG_ERROR(Common_Filesystem, "mkdir failed on %s: %s", path.c_str(), strerror(err)); return false; #endif } @@ -171,11 +171,11 @@ bool CreateDir(const std::string &path) bool CreateFullPath(const std::string &fullPath) { int panicCounter = 100; - INFO_LOG(COMMON, "CreateFullPath: path %s", fullPath.c_str()); + LOG_TRACE(Common_Filesystem, "path %s", fullPath.c_str()); if (FileUtil::Exists(fullPath)) { - INFO_LOG(COMMON, "CreateFullPath: path exists %s", fullPath.c_str()); + LOG_WARNING(Common_Filesystem, "path exists %s", fullPath.c_str()); return true; } @@ -192,7 +192,7 @@ bool CreateFullPath(const std::string &fullPath) // Include the '/' so the first call is CreateDir("/") rather than CreateDir("") std::string const subPath(fullPath.substr(0, position + 1)); if (!FileUtil::IsDirectory(subPath) && !FileUtil::CreateDir(subPath)) { - ERROR_LOG(COMMON, "CreateFullPath: directory creation failed"); + LOG_ERROR(Common, "CreateFullPath: directory creation failed"); return false; } @@ -200,7 +200,7 @@ bool CreateFullPath(const std::string &fullPath) panicCounter--; if (panicCounter <= 0) { - ERROR_LOG(COMMON, "CreateFullPath: directory structure is too deep"); + LOG_ERROR(Common, "CreateFullPath: directory structure is too deep"); return false; } position++; @@ -211,12 +211,12 @@ bool CreateFullPath(const std::string &fullPath) // Deletes a directory filename, returns true on success bool DeleteDir(const std::string &filename) { - INFO_LOG(COMMON, "DeleteDir: directory %s", filename.c_str()); + LOG_INFO(Common_Filesystem, "directory %s", filename.c_str()); // check if a directory if (!FileUtil::IsDirectory(filename)) { - ERROR_LOG(COMMON, "DeleteDir: Not a directory %s", filename.c_str()); + LOG_ERROR(Common_Filesystem, "Not a directory %s", filename.c_str()); return false; } @@ -227,7 +227,7 @@ bool DeleteDir(const std::string &filename) if (rmdir(filename.c_str()) == 0) return true; #endif - ERROR_LOG(COMMON, "DeleteDir: %s: %s", filename.c_str(), GetLastErrorMsg()); + LOG_ERROR(Common_Filesystem, "failed %s: %s", filename.c_str(), GetLastErrorMsg()); return false; } @@ -235,11 +235,11 @@ bool DeleteDir(const std::string &filename) // renames file srcFilename to destFilename, returns true on success bool Rename(const std::string &srcFilename, const std::string &destFilename) { - INFO_LOG(COMMON, "Rename: %s --> %s", + LOG_TRACE(Common_Filesystem, "%s --> %s", srcFilename.c_str(), destFilename.c_str()); if (rename(srcFilename.c_str(), destFilename.c_str()) == 0) return true; - ERROR_LOG(COMMON, "Rename: failed %s --> %s: %s", + LOG_ERROR(Common_Filesystem, "failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); return false; } @@ -247,13 +247,13 @@ bool Rename(const std::string &srcFilename, const std::string &destFilename) // copies file srcFilename to destFilename, returns true on success bool Copy(const std::string &srcFilename, const std::string &destFilename) { - INFO_LOG(COMMON, "Copy: %s --> %s", + LOG_TRACE(Common_Filesystem, "%s --> %s", srcFilename.c_str(), destFilename.c_str()); #ifdef _WIN32 if (CopyFile(Common::UTF8ToTStr(srcFilename).c_str(), Common::UTF8ToTStr(destFilename).c_str(), FALSE)) return true; - ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s", + LOG_ERROR(Common_Filesystem, "failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); return false; #else @@ -267,7 +267,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) FILE *input = fopen(srcFilename.c_str(), "rb"); if (!input) { - ERROR_LOG(COMMON, "Copy: input failed %s --> %s: %s", + LOG_ERROR(Common_Filesystem, "opening input failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); return false; } @@ -277,7 +277,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) if (!output) { fclose(input); - ERROR_LOG(COMMON, "Copy: output failed %s --> %s: %s", + LOG_ERROR(Common_Filesystem, "opening output failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); return false; } @@ -291,8 +291,8 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) { if (ferror(input) != 0) { - ERROR_LOG(COMMON, - "Copy: failed reading from source, %s --> %s: %s", + LOG_ERROR(Common_Filesystem, + "failed reading from source, %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); goto bail; } @@ -302,8 +302,8 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) int wnum = fwrite(buffer, sizeof(char), rnum, output); if (wnum != rnum) { - ERROR_LOG(COMMON, - "Copy: failed writing to output, %s --> %s: %s", + LOG_ERROR(Common_Filesystem, + "failed writing to output, %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); goto bail; } @@ -326,13 +326,13 @@ u64 GetSize(const std::string &filename) { if (!Exists(filename)) { - WARN_LOG(COMMON, "GetSize: failed %s: No such file", filename.c_str()); + LOG_ERROR(Common_Filesystem, "failed %s: No such file", filename.c_str()); return 0; } if (IsDirectory(filename)) { - WARN_LOG(COMMON, "GetSize: failed %s: is a directory", filename.c_str()); + LOG_ERROR(Common_Filesystem, "failed %s: is a directory", filename.c_str()); return 0; } @@ -343,12 +343,12 @@ u64 GetSize(const std::string &filename) if (stat64(filename.c_str(), &buf) == 0) #endif { - DEBUG_LOG(COMMON, "GetSize: %s: %lld", + LOG_TRACE(Common_Filesystem, "%s: %lld", filename.c_str(), (long long)buf.st_size); return buf.st_size; } - ERROR_LOG(COMMON, "GetSize: Stat failed %s: %s", + LOG_ERROR(Common_Filesystem, "Stat failed %s: %s", filename.c_str(), GetLastErrorMsg()); return 0; } @@ -358,7 +358,7 @@ u64 GetSize(const int fd) { struct stat64 buf; if (fstat64(fd, &buf) != 0) { - ERROR_LOG(COMMON, "GetSize: stat failed %i: %s", + LOG_ERROR(Common_Filesystem, "GetSize: stat failed %i: %s", fd, GetLastErrorMsg()); return 0; } @@ -371,13 +371,13 @@ u64 GetSize(FILE *f) // can't use off_t here because it can be 32-bit u64 pos = ftello(f); if (fseeko(f, 0, SEEK_END) != 0) { - ERROR_LOG(COMMON, "GetSize: seek failed %p: %s", + LOG_ERROR(Common_Filesystem, "GetSize: seek failed %p: %s", f, GetLastErrorMsg()); return 0; } u64 size = ftello(f); if ((size != pos) && (fseeko(f, pos, SEEK_SET) != 0)) { - ERROR_LOG(COMMON, "GetSize: seek failed %p: %s", + LOG_ERROR(Common_Filesystem, "GetSize: seek failed %p: %s", f, GetLastErrorMsg()); return 0; } @@ -387,11 +387,11 @@ u64 GetSize(FILE *f) // creates an empty file filename, returns true on success bool CreateEmptyFile(const std::string &filename) { - INFO_LOG(COMMON, "CreateEmptyFile: %s", filename.c_str()); + LOG_TRACE(Common_Filesystem, "%s", filename.c_str()); if (!FileUtil::IOFile(filename, "wb")) { - ERROR_LOG(COMMON, "CreateEmptyFile: failed %s: %s", + LOG_ERROR(Common_Filesystem, "failed %s: %s", filename.c_str(), GetLastErrorMsg()); return false; } @@ -404,7 +404,7 @@ bool CreateEmptyFile(const std::string &filename) // results into parentEntry. Returns the number of files+directories found u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry) { - INFO_LOG(COMMON, "ScanDirectoryTree: directory %s", directory.c_str()); + LOG_TRACE(Common_Filesystem, "directory %s", directory.c_str()); // How many files + directories we found u32 foundEntries = 0; #ifdef _WIN32 @@ -474,7 +474,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry) // Deletes the given directory and anything under it. Returns true on success. bool DeleteDirRecursively(const std::string &directory) { - INFO_LOG(COMMON, "DeleteDirRecursively: %s", directory.c_str()); + LOG_TRACE(Common_Filesystem, "%s", directory.c_str()); #ifdef _WIN32 // Find the first file in the directory. WIN32_FIND_DATA ffd; @@ -588,7 +588,7 @@ std::string GetCurrentDir() // Get the current working directory (getcwd uses malloc) if (!(dir = __getcwd(nullptr, 0))) { - ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", + LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: %s", GetLastErrorMsg()); return nullptr; } @@ -647,7 +647,7 @@ std::string GetSysDirectory() #endif sysDir += DIR_SEP; - INFO_LOG(COMMON, "GetSysDirectory: Setting to %s:", sysDir.c_str()); + LOG_DEBUG(Common_Filesystem, "Setting to %s:", sysDir.c_str()); return sysDir; } @@ -695,7 +695,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new { if (!FileUtil::IsDirectory(newPath)) { - WARN_LOG(COMMON, "Invalid path specified %s", newPath.c_str()); + LOG_ERROR(Common_Filesystem, "Invalid path specified %s", newPath.c_str()); return paths[DirIDX]; } else diff --git a/src/common/log.h b/src/common/log.h index 105db9802..c0f7ca2df 100644 --- a/src/common/log.h +++ b/src/common/log.h @@ -126,23 +126,23 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int //#define INFO_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) } while (0) //#define DEBUG_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) } while (0) -#define OS_LOG(t,...) LOG_INFO(Common, __VA_ARGS__) -#define ERROR_LOG(t,...) LOG_ERROR(Common_Filesystem, __VA_ARGS__) -#define WARN_LOG(t,...) LOG_WARNING(Kernel_SVC, __VA_ARGS__) -#define NOTICE_LOG(t,...) LOG_INFO(Service, __VA_ARGS__) -#define INFO_LOG(t,...) LOG_INFO(Service_FS, __VA_ARGS__) -#define DEBUG_LOG(t,...) LOG_DEBUG(Common, __VA_ARGS__) +//#define OS_LOG(t,...) LOG_INFO(Common, __VA_ARGS__) +//#define ERROR_LOG(t,...) LOG_ERROR(Common_Filesystem, __VA_ARGS__) +//#define WARN_LOG(t,...) LOG_WARNING(Kernel_SVC, __VA_ARGS__) +//#define NOTICE_LOG(t,...) LOG_INFO(Service, __VA_ARGS__) +//#define INFO_LOG(t,...) LOG_INFO(Service_FS, __VA_ARGS__) +//#define DEBUG_LOG(t,...) LOG_DEBUG(Common, __VA_ARGS__) #if MAX_LOGLEVEL >= DEBUG_LEVEL #define _dbg_assert_(_t_, _a_) \ if (!(_a_)) {\ - ERROR_LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \ + LOG_CRITICAL(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \ __LINE__, __FILE__, __TIME__); \ if (!PanicYesNo("*** Assertion (see log)***\n")) {Crash();} \ } #define _dbg_assert_msg_(_t_, _a_, ...)\ if (!(_a_)) {\ - ERROR_LOG(_t_, __VA_ARGS__); \ + LOG_CRITICAL(_t_, __VA_ARGS__); \ if (!PanicYesNo(__VA_ARGS__)) {Crash();} \ } #define _dbg_update_() Host_UpdateLogDisplay(); diff --git a/src/common/mem_arena.cpp b/src/common/mem_arena.cpp index 7d4fda0e2..9904d2472 100644 --- a/src/common/mem_arena.cpp +++ b/src/common/mem_arena.cpp @@ -71,7 +71,7 @@ int ashmem_create_region(const char *name, size_t size) return fd; error: - ERROR_LOG(MEMMAP, "NASTY ASHMEM ERROR: ret = %08x", ret); + LOG_ERROR(Common_Memory, "NASTY ASHMEM ERROR: ret = %08x", ret); close(fd); return ret; } @@ -130,7 +130,7 @@ void MemArena::GrabLowMemSpace(size_t size) // Note that it appears that ashmem is pinned by default, so no need to pin. if (fd < 0) { - ERROR_LOG(MEMMAP, "Failed to grab ashmem space of size: %08x errno: %d", (int)size, (int)(errno)); + LOG_ERROR(Common_Memory, "Failed to grab ashmem space of size: %08x errno: %d", (int)size, (int)(errno)); return; } #else @@ -148,12 +148,12 @@ void MemArena::GrabLowMemSpace(size_t size) } else if (errno != EEXIST) { - ERROR_LOG(MEMMAP, "shm_open failed: %s", strerror(errno)); + LOG_ERROR(Common_Memory, "shm_open failed: %s", strerror(errno)); return; } } if (ftruncate(fd, size) < 0) - ERROR_LOG(MEMMAP, "Failed to allocate low memory space"); + LOG_ERROR(Common_Memory, "Failed to allocate low memory space"); #endif } @@ -197,7 +197,7 @@ void *MemArena::CreateView(s64 offset, size_t size, void *base) if (retval == MAP_FAILED) { - NOTICE_LOG(MEMMAP, "mmap failed"); + LOG_ERROR(Common_Memory, "mmap failed"); return nullptr; } return retval; @@ -423,7 +423,7 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena base = (u8 *)base_addr; if (Memory_TryBase(base, views, num_views, flags, arena)) { - INFO_LOG(MEMMAP, "Found valid memory base at %p after %i tries.", base, base_attempts); + LOG_DEBUG(Common_Memory, "Found valid memory base at %p after %i tries.", base, base_attempts); base_attempts = 0; break; } @@ -442,7 +442,7 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena u8 *base = MemArena::Find4GBBase(); if (!Memory_TryBase(base, views, num_views, flags, arena)) { - ERROR_LOG(MEMMAP, "MemoryMap_Setup: Failed finding a memory base."); + LOG_ERROR(Common_Memory, "MemoryMap_Setup: Failed finding a memory base."); PanicAlert("MemoryMap_Setup: Failed finding a memory base."); return 0; } diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp index 93da5500b..ca8a2a9e4 100644 --- a/src/common/memory_util.cpp +++ b/src/common/memory_util.cpp @@ -109,7 +109,7 @@ void* AllocateAlignedMemory(size_t size,size_t alignment) ptr = memalign(alignment, size); #else if (posix_memalign(&ptr, alignment, size) != 0) - ERROR_LOG(MEMMAP, "Failed to allocate aligned memory"); + LOG_ERROR(Common_Memory, "Failed to allocate aligned memory"); #endif #endif diff --git a/src/common/msg_handler.cpp b/src/common/msg_handler.cpp index b3556aaa8..7ffedc45a 100644 --- a/src/common/msg_handler.cpp +++ b/src/common/msg_handler.cpp @@ -75,7 +75,7 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...) Common::CharArrayFromFormatV(buffer, sizeof(buffer)-1, str_translator(format).c_str(), args); va_end(args); - ERROR_LOG(MASTER_LOG, "%s: %s", caption.c_str(), buffer); + LOG_INFO(Common, "%s: %s", caption.c_str(), buffer); // Don't ignore questions, especially AskYesNo, PanicYesNo could be ignored if (msg_handler && (AlertEnabled || Style == QUESTION || Style == CRITICAL)) diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 7a8274a91..6d9612fb5 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -107,7 +107,7 @@ std::string StringFromFormat(const char* format, ...) #else va_start(args, format); if (vasprintf(&buf, format, args) < 0) - ERROR_LOG(COMMON, "Unable to allocate memory for string"); + LOG_ERROR(Common, "Unable to allocate memory for string"); va_end(args); std::string temp = buf; @@ -475,7 +475,7 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string& iconv_t const conv_desc = iconv_open("UTF-8", fromcode); if ((iconv_t)(-1) == conv_desc) { - ERROR_LOG(COMMON, "Iconv initialization failure [%s]: %s", fromcode, strerror(errno)); + LOG_ERROR(Common, "Iconv initialization failure [%s]: %s", fromcode, strerror(errno)); iconv_close(conv_desc); return {}; } @@ -510,7 +510,7 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string& } else { - ERROR_LOG(COMMON, "iconv failure [%s]: %s", fromcode, strerror(errno)); + LOG_ERROR(Common, "iconv failure [%s]: %s", fromcode, strerror(errno)); break; } } @@ -531,7 +531,7 @@ std::u16string UTF8ToUTF16(const std::string& input) iconv_t const conv_desc = iconv_open("UTF-16LE", "UTF-8"); if ((iconv_t)(-1) == conv_desc) { - ERROR_LOG(COMMON, "Iconv initialization failure [UTF-8]: %s", strerror(errno)); + LOG_ERROR(Common, "Iconv initialization failure [UTF-8]: %s", strerror(errno)); iconv_close(conv_desc); return {}; } @@ -566,7 +566,7 @@ std::u16string UTF8ToUTF16(const std::string& input) } else { - ERROR_LOG(COMMON, "iconv failure [UTF-8]: %s", strerror(errno)); + LOG_ERROR(Common, "iconv failure [UTF-8]: %s", strerror(errno)); break; } } diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index 233cd3e3a..68012bffd 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp @@ -433,9 +433,7 @@ typedef struct _ldst_inst { unsigned int inst; get_addr_fp_t get_addr; } ldst_inst; -#define DEBUG_MSG DEBUG_LOG(ARM11, "in %s %d\n", __FUNCTION__, __LINE__); \ - DEBUG_LOG(ARM11, "inst is %x\n", inst); \ - CITRA_IGNORE_EXIT(0) +#define DEBUG_MSG LOG_DEBUG(Core_ARM11, "inst is %x", inst); CITRA_IGNORE_EXIT(0) int CondPassed(arm_processor *cpu, unsigned int cond); #define LnSWoUB(s) glue(LnSWoUB, s) @@ -1423,7 +1421,7 @@ inline void *AllocBuffer(unsigned int size) int start = top; top += size; if (top > CACHE_BUFFER_SIZE) { - DEBUG_LOG(ARM11, "inst_buf is full\n"); + LOG_ERROR(Core_ARM11, "inst_buf is full"); CITRA_IGNORE_EXIT(-1); } return (void *)&inst_buf[start]; @@ -1609,6 +1607,10 @@ get_addr_fp_t get_calc_addr_op(unsigned int inst) #define CHECK_RM (inst_cream->Rm == 15) #define CHECK_RS (inst_cream->Rs == 15) +#define UNIMPLEMENTED_INSTRUCTION(mnemonic) \ + LOG_ERROR(Core_ARM11, "unimplemented instruction: %s", mnemonic); \ + CITRA_IGNORE_EXIT(-1); \ + return nullptr; ARM_INST_PTR INTERPRETER_TRANSLATE(adc)(unsigned int inst, int index) { @@ -1723,7 +1725,7 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(bic)(unsigned int inst, int index) inst_base->br = INDIRECT_BRANCH; return inst_base; } -ARM_INST_PTR INTERPRETER_TRANSLATE(bkpt)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} +ARM_INST_PTR INTERPRETER_TRANSLATE(bkpt)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("BKPT"); } ARM_INST_PTR INTERPRETER_TRANSLATE(blx)(unsigned int inst, int index) { arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(blx_inst)); @@ -1758,7 +1760,7 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(bx)(unsigned int inst, int index) return inst_base; } -ARM_INST_PTR INTERPRETER_TRANSLATE(bxj)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} +ARM_INST_PTR INTERPRETER_TRANSLATE(bxj)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("BXJ"); } ARM_INST_PTR INTERPRETER_TRANSLATE(cdp)(unsigned int inst, int index){ arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(cdp_inst)); cdp_inst *inst_cream = (cdp_inst *)inst_base->component; @@ -1775,7 +1777,7 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(cdp)(unsigned int inst, int index){ inst_cream->opcode_1 = BITS(inst, 20, 23); inst_cream->inst = inst; - DEBUG_LOG(ARM11, "in func %s inst %x index %x\n", __FUNCTION__, inst, index); + LOG_TRACE(Core_ARM11, "inst %x index %x", inst, index); return inst_base; } ARM_INST_PTR INTERPRETER_TRANSLATE(clrex)(unsigned int inst, int index) @@ -2205,7 +2207,7 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(mcr)(unsigned int inst, int index) inst_cream->inst = inst; return inst_base; } -ARM_INST_PTR INTERPRETER_TRANSLATE(mcrr)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} +ARM_INST_PTR INTERPRETER_TRANSLATE(mcrr)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("MCRR"); } ARM_INST_PTR INTERPRETER_TRANSLATE(mla)(unsigned int inst, int index) { arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(mla_inst)); @@ -2264,7 +2266,7 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(mrc)(unsigned int inst, int index) inst_cream->inst = inst; return inst_base; } -ARM_INST_PTR INTERPRETER_TRANSLATE(mrrc)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} +ARM_INST_PTR INTERPRETER_TRANSLATE(mrrc)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("MRRC"); } ARM_INST_PTR INTERPRETER_TRANSLATE(mrs)(unsigned int inst, int index) { arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(mrs_inst)); @@ -2358,8 +2360,8 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(orr)(unsigned int inst, int index) } return inst_base; } -ARM_INST_PTR INTERPRETER_TRANSLATE(pkhbt)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(pkhtb)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} +ARM_INST_PTR INTERPRETER_TRANSLATE(pkhbt)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("PKHBT"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(pkhtb)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("PKHTB"); } ARM_INST_PTR INTERPRETER_TRANSLATE(pld)(unsigned int inst, int index) { arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(pld_inst)); @@ -2371,16 +2373,16 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(pld)(unsigned int inst, int index) return inst_base; } -ARM_INST_PTR INTERPRETER_TRANSLATE(qadd)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(qadd16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(qadd8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(qaddsubx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(qdadd)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(qdsub)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(qsub)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(qsub16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(qsub8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(qsubaddx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} +ARM_INST_PTR INTERPRETER_TRANSLATE(qadd)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QADD"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(qadd16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QADD16"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(qadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QADD8"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(qaddsubx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QADDSUBX"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(qdadd)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QDADD"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(qdsub)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QDSUB"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(qsub)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QSUB"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(qsub16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QSUB16"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(qsub8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QSUB8"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(qsubaddx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QSUBADDX"); } ARM_INST_PTR INTERPRETER_TRANSLATE(rev)(unsigned int inst, int index) { arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(rev_inst)); @@ -2410,8 +2412,8 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(rev16)(unsigned int inst, int index){ return inst_base; } -ARM_INST_PTR INTERPRETER_TRANSLATE(revsh)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(rfe)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} +ARM_INST_PTR INTERPRETER_TRANSLATE(revsh)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("REVSH"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(rfe)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("RFE"); } ARM_INST_PTR INTERPRETER_TRANSLATE(rsb)(unsigned int inst, int index) { arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(rsb_inst)); @@ -2460,9 +2462,9 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(rsc)(unsigned int inst, int index) } return inst_base; } -ARM_INST_PTR INTERPRETER_TRANSLATE(sadd16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(sadd8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(saddsubx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} +ARM_INST_PTR INTERPRETER_TRANSLATE(sadd16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SADD16"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(sadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SADD8"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(saddsubx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SADDSUBX"); } ARM_INST_PTR INTERPRETER_TRANSLATE(sbc)(unsigned int inst, int index) { arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(sbc_inst)); @@ -2487,14 +2489,14 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(sbc)(unsigned int inst, int index) } return inst_base; } -ARM_INST_PTR INTERPRETER_TRANSLATE(sel)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(setend)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(shadd16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(shadd8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(shaddsubx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(shsub16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(shsub8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(shsubaddx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} +ARM_INST_PTR INTERPRETER_TRANSLATE(sel)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SEL"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(setend)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SETEND"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(shadd16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SHADD16"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(shadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SHADD8"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(shaddsubx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SHADDSUBX"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(shsub16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SHSUB16"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(shsub8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SHSUB8"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(shsubaddx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SHSUBADDX"); } ARM_INST_PTR INTERPRETER_TRANSLATE(smla)(unsigned int inst, int index) { arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(smla_inst)); @@ -2553,15 +2555,15 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(smlal)(unsigned int inst, int index) inst_base->load_r15 = 1; return inst_base; } -ARM_INST_PTR INTERPRETER_TRANSLATE(smlalxy)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(smlald)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(smlaw)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(smlsd)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(smlsld)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(smmla)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(smmls)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(smmul)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(smuad)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} +ARM_INST_PTR INTERPRETER_TRANSLATE(smlalxy)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLALXY"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(smlald)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLALD"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(smlaw)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLAW"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(smlsd)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLSD"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(smlsld)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLSLD"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(smmla)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMMLA"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(smmls)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMMLS"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(smmul)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMMUL"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(smuad)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMUAD"); } ARM_INST_PTR INTERPRETER_TRANSLATE(smul)(unsigned int inst, int index) { arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(smul_inst)); @@ -2624,13 +2626,13 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(smulw)(unsigned int inst, int index) inst_base->load_r15 = 1; return inst_base; } -ARM_INST_PTR INTERPRETER_TRANSLATE(smusd)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(srs)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(ssat)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(ssat16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(ssub16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(ssub8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(ssubaddx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} +ARM_INST_PTR INTERPRETER_TRANSLATE(smusd)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMUSD"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(srs)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SRS"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(ssat)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSAT"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(ssat16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSAT16"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(ssub16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSUB16"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(ssub8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSUB8"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(ssubaddx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSUBADDX"); } ARM_INST_PTR INTERPRETER_TRANSLATE(stc)(unsigned int inst, int index) { arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(stc_inst)); @@ -2937,9 +2939,9 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(sxtab)(unsigned int inst, int index){ return inst_base; } -ARM_INST_PTR INTERPRETER_TRANSLATE(sxtab16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} +ARM_INST_PTR INTERPRETER_TRANSLATE(sxtab16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SXTAB16"); } ARM_INST_PTR INTERPRETER_TRANSLATE(sxtah)(unsigned int inst, int index){ - DEBUG_LOG(ARM11, "in func %s, SXTAH untested\n", __func__); + LOG_WARNING(Core_ARM11, "SXTAH untested"); arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(sxtah_inst)); sxtah_inst *inst_cream = (sxtah_inst *)inst_base->component; @@ -2955,7 +2957,7 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(sxtah)(unsigned int inst, int index){ return inst_base; } -ARM_INST_PTR INTERPRETER_TRANSLATE(sxtb16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} +ARM_INST_PTR INTERPRETER_TRANSLATE(sxtb16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SXTB16"); } ARM_INST_PTR INTERPRETER_TRANSLATE(teq)(unsigned int inst, int index) { arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(teq_inst)); @@ -2999,16 +3001,16 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(tst)(unsigned int inst, int index) inst_base->load_r15 = 1; return inst_base; } -ARM_INST_PTR INTERPRETER_TRANSLATE(uadd16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(uadd8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(uaddsubx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(uhadd16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(uhadd8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(uhaddsubx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(uhsub16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(uhsub8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(uhsubaddx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(umaal)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} +ARM_INST_PTR INTERPRETER_TRANSLATE(uadd16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UADD16"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(uadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UADD8"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(uaddsubx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UADDSUBX"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(uhadd16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UHADD16"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(uhadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UHADD8"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(uhaddsubx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UHADDSUBX"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(uhsub16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UHSUB16"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(uhsub8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UHSUB8"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(uhsubaddx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UHSUBADDX"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(umaal)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UMAAL"); } ARM_INST_PTR INTERPRETER_TRANSLATE(umlal)(unsigned int inst, int index) { arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(umlal_inst)); @@ -3111,21 +3113,21 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(blx_1_thumb)(unsigned int tinst, int index) return inst_base; } -ARM_INST_PTR INTERPRETER_TRANSLATE(uqadd16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(uqadd8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(uqaddsubx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(uqsub16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(uqsub8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(uqsubaddx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(usad8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(usada8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(usat)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(usat16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(usub16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(usub8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(usubaddx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(uxtab16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} -ARM_INST_PTR INTERPRETER_TRANSLATE(uxtb16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} +ARM_INST_PTR INTERPRETER_TRANSLATE(uqadd16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UQADD16"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(uqadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UQADD8"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(uqaddsubx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UQADDSUBX"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(uqsub16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UQSUB16"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(uqsub8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UQSUB8"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(uqsubaddx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UQSUBADDX"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(usad8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("USAD8"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(usada8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("USADA8"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(usat)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("USAT"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(usat16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("USAT16"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(usub16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("USUB16"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(usub8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("USUB8"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(usubaddx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("USUBADDX"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(uxtab16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UXTAB16"); } +ARM_INST_PTR INTERPRETER_TRANSLATE(uxtb16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UXTB16"); } @@ -3391,7 +3393,7 @@ static tdstate decode_thumb_instr(arm_processor *cpu, uint32_t inst, addr_t addr } else{ /* something wrong */ - DEBUG_LOG(ARM11, "In %s, thumb decoder error\n", __FUNCTION__); + LOG_ERROR(Core_ARM11, "thumb decoder error"); } break; case 28: @@ -3599,7 +3601,7 @@ int InterpreterTranslate(arm_processor *cpu, int &bb_start, addr_t addr) bank->bank_read(32, phys_addr, &inst); } else { - DEBUG_LOG(ARM11, "SKYEYE: Read physical addr 0x%x error!!\n", phys_addr); + LOG_ERROR(Core_ARM11, "SKYEYE: Read physical addr 0x%x error!!\n", phys_addr); return FETCH_FAILURE; } #else @@ -3629,8 +3631,8 @@ int InterpreterTranslate(arm_processor *cpu, int &bb_start, addr_t addr) ret = decode_arm_instr(inst, &idx); if (ret == DECODE_FAILURE) { - DEBUG_LOG(ARM11, "[info] : Decode failure.\tPC : [0x%x]\tInstruction : [%x]\n", phys_addr, inst); - DEBUG_LOG(ARM11, "cpsr=0x%x, cpu->TFlag=%d, r15=0x%x\n", cpu->Cpsr, cpu->TFlag, cpu->Reg[15]); + LOG_ERROR(Core_ARM11, "Decode failure.\tPC : [0x%x]\tInstruction : [%x]", phys_addr, inst); + LOG_ERROR(Core_ARM11, "cpsr=0x%x, cpu->TFlag=%d, r15=0x%x", cpu->Cpsr, cpu->TFlag, cpu->Reg[15]); CITRA_IGNORE_EXIT(-1); } // DEBUG_LOG(ARM11, "PC : [0x%x] INST : %s\n", cpu->translate_pc, arm_instruction[idx].name); @@ -3674,7 +3676,7 @@ void InterpreterInitInstLength(unsigned long long int *ptr, size_t size) } } for (int i = 0; i < array_size - 4; i ++) - DEBUG_LOG(ARM11, "[%d]:%d\n", i, InstLength[i]); + LOG_DEBUG(Core_ARM11, "[%d]:%d", i, InstLength[i]); } int clz(unsigned int x) @@ -3721,7 +3723,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) //if (debug_function(core)) \ if (core->check_int_flag) \ goto END - //DEBUG_LOG(ARM11, "icounter is %llx line is %d pc is %x\n", cpu->icounter, __LINE__, cpu->Reg[15]) + //LOG_TRACE(Core_ARM11, "icounter is %llx pc is %x\n", cpu->icounter, cpu->Reg[15]) #else #define INC_ICOUNTER ; #endif @@ -4348,7 +4350,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) bx_inst *inst_cream = (bx_inst *)inst_base->component; if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { if (inst_cream->Rm == 15) - DEBUG_LOG(ARM11, "In %s, BX at pc %x: use of Rm = R15 is discouraged\n", __FUNCTION__, cpu->Reg[15]); + LOG_WARNING(Core_ARM11, "BX at pc %x: use of Rm = R15 is discouraged", cpu->Reg[15]); cpu->TFlag = cpu->Reg[inst_cream->Rm] & 0x1; cpu->Reg[15] = cpu->Reg[inst_cream->Rm] & 0xfffffffe; // cpu->TFlag = cpu->Reg[inst_cream->Rm] & 0x1; @@ -4373,10 +4375,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) cpu->NumInstrsToExecute = 0; return num_instrs; } - ERROR_LOG(ARM11, "CDP insn inst=0x%x, pc=0x%x\n", inst_cream->inst, cpu->Reg[15]); + LOG_ERROR(Core_ARM11, "CDP insn inst=0x%x, pc=0x%x\n", inst_cream->inst, cpu->Reg[15]); unsigned cpab = (cpu->CDP[inst_cream->cp_num]) (cpu, ARMul_FIRST, inst_cream->inst); if(cpab != ARMul_DONE){ - ERROR_LOG(ARM11, "CDP insn wrong, inst=0x%x, cp_num=0x%x\n", inst_cream->inst, inst_cream->cp_num); + LOG_ERROR(Core_ARM11, "CDP insn wrong, inst=0x%x, cp_num=0x%x\n", inst_cream->inst, inst_cream->cp_num); //CITRA_IGNORE_EXIT(-1); } } @@ -4803,7 +4805,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) & 0xffff; RD = RN + operand2; if (inst_cream->Rn == 15 || inst_cream->Rm == 15) { - DEBUG_LOG(ARM11, "in line %d\n", __LINE__); + LOG_ERROR(Core_ARM11, "invalid operands for UXTAH"); CITRA_IGNORE_EXIT(-1); } } @@ -4866,7 +4868,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) uint32_t rear_phys_addr; fault = check_address_validity(cpu, addr + 4, &rear_phys_addr, 1); if(fault){ - ERROR_LOG(ARM11, "mmu fault , should rollback the above get_addr\n"); + LOG_ERROR(Core_ARM11, "mmu fault , should rollback the above get_addr\n"); CITRA_IGNORE_EXIT(-1); goto MMU_EXCEPTION; } @@ -5089,7 +5091,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) switch(OPCODE_2){ case 0: /* invalidate all */ //invalidate_all_tlb(state); - DEBUG_LOG(ARM11, "{TLB} [INSN] invalidate all\n"); + LOG_DEBUG(Core_ARM11, "{TLB} [INSN] invalidate all"); //remove_tlb(INSN_TLB); //erase_all(core, INSN_TLB); break; @@ -5115,7 +5117,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) //invalidate_all_tlb(state); //remove_tlb(DATA_TLB); //erase_all(core, DATA_TLB); - DEBUG_LOG(ARM11, "{TLB} [DATA] invalidate all\n"); + LOG_DEBUG(Core_ARM11, "{TLB} [DATA] invalidate all"); break; case 1: /* invalidate by MVA */ //invalidate_by_mva(state, value); @@ -5147,13 +5149,13 @@ unsigned InterpreterMainLoop(ARMul_State* state) //invalidate_by_mva(state, value); //erase_by_mva(core, RD, DATA_TLB); //erase_by_mva(core, RD, INSN_TLB); - DEBUG_LOG(ARM11, "{TLB} [UNIFILED] invalidate by mva\n"); + LOG_DEBUG(Core_ARM11, "{TLB} [UNIFILED] invalidate by mva"); break; case 2: /* invalidate by asid */ //invalidate_by_asid(state, value); //erase_by_asid(core, RD, DATA_TLB); //erase_by_asid(core, RD, INSN_TLB); - DEBUG_LOG(ARM11, "{TLB} [UNIFILED] invalidate by asid\n"); + LOG_DEBUG(Core_ARM11, "{TLB} [UNIFILED] invalidate by asid"); break; default: break; @@ -5175,7 +5177,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) } } else { - DEBUG_LOG(ARM11, "mcr is not implementated. CRn is %d, CRm is %d, OPCODE_2 is %d\n", CRn, CRm, OPCODE_2); + LOG_ERROR(Core_ARM11, "mcr CRn=%d, CRm=%d OP2=%d is not implemented", CRn, CRm, OPCODE_2); } } } @@ -5195,7 +5197,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) uint64_t rs = RS; uint64_t rn = RN; if (inst_cream->Rm == 15 || inst_cream->Rs == 15 || inst_cream->Rn == 15) { - DEBUG_LOG(ARM11, "in __line__\n", __LINE__); + LOG_ERROR(Core_ARM11, "invalid operands for MLA"); CITRA_IGNORE_EXIT(-1); } // RD = dst = RM * RS + RN; @@ -5309,7 +5311,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) } } else { - DEBUG_LOG(ARM11, "mrc is not implementated. CRn is %d, CRm is %d, OPCODE_2 is %d\n", CRn, CRm, OPCODE_2); + LOG_ERROR(Core_ARM11, "mrc CRn=%d, CRm=%d, OP2=%d is not implemented", CRn, CRm, OPCODE_2); } } //DEBUG_LOG(ARM11, "mrc is not implementated. CRn is %d, CRm is %d, OPCODE_2 is %d\n", CRn, CRm, OPCODE_2); @@ -5500,7 +5502,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) (((RM >> 16) & 0xff) << 8) | ((RM >> 24) & 0xff); if (inst_cream->Rm == 15) { - DEBUG_LOG(ARM11, "in line %d\n", __LINE__); + LOG_ERROR(Core_ARM11, "invalid operand for REV"); CITRA_IGNORE_EXIT(-1); } } @@ -5953,7 +5955,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) sxtb_inst *inst_cream = (sxtb_inst *)inst_base->component; if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { if (inst_cream->Rm == 15) { - DEBUG_LOG(ARM11, "line is %d\n", __LINE__); + LOG_ERROR(Core_ARM11, "invalid operand for SXTB"); CITRA_IGNORE_EXIT(-1); } unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate); @@ -6059,7 +6061,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) uint32_t rear_phys_addr; fault = check_address_validity(cpu, addr + 4, &rear_phys_addr, 0); if (fault){ - ERROR_LOG(ARM11, "mmu fault , should rollback the above get_addr\n"); + LOG_ERROR(Core_ARM11, "mmu fault , should rollback the above get_addr\n"); CITRA_IGNORE_EXIT(-1); goto MMU_EXCEPTION; } diff --git a/src/core/arm/interpreter/armemu.cpp b/src/core/arm/interpreter/armemu.cpp index d717bd2c8..825955ade 100644 --- a/src/core/arm/interpreter/armemu.cpp +++ b/src/core/arm/interpreter/armemu.cpp @@ -949,7 +949,7 @@ ARMul_Emulate26 (ARMul_State * state) //printf("t decode %04lx -> %08lx\n", instr & 0xffff, armOp); if (armOp == 0xDEADC0DE) { - DEBUG("Failed to decode thumb opcode %04X at %08X\n", instr, pc); + LOG_ERROR(Core_ARM11, "Failed to decode thumb opcode %04X at %08X", instr, pc); } instr = armOp; @@ -3437,7 +3437,7 @@ mainswitch: case 0x7f: /* Load Byte, WriteBack, Pre Inc, Reg. */ if (BIT (4)) { - DEBUG("got unhandled special breakpoint\n"); + LOG_DEBUG(Core_ARM11, "got unhandled special breakpoint"); return 1; } UNDEF_LSRBaseEQOffWb; diff --git a/src/core/arm/interpreter/armsupp.cpp b/src/core/arm/interpreter/armsupp.cpp index 2568b93ef..30519f216 100644 --- a/src/core/arm/interpreter/armsupp.cpp +++ b/src/core/arm/interpreter/armsupp.cpp @@ -665,7 +665,7 @@ ARMul_MCR (ARMul_State * state, ARMword instr, ARMword source) //if (!CP_ACCESS_ALLOWED (state, CPNum)) { if (!state->MCR[CPNum]) { //chy 2004-07-19 should fix in the future ????!!!! - DEBUG("SKYEYE ARMul_MCR, ACCESS_not ALLOWed, UndefinedInstr CPnum is %x, source %x\n",CPNum, source); + LOG_ERROR(Core_ARM11, "SKYEYE ARMul_MCR, ACCESS_not ALLOWed, UndefinedInstr CPnum is %x, source %x",CPNum, source); ARMul_UndefInstr (state, instr); return; } @@ -690,7 +690,7 @@ ARMul_MCR (ARMul_State * state, ARMword instr, ARMword source) } if (cpab == ARMul_CANT) { - DEBUG("SKYEYE ARMul_MCR, CANT, UndefinedInstr %x CPnum is %x, source %x\n", instr, CPNum, source); //ichfly todo + LOG_ERROR(Core_ARM11, "SKYEYE ARMul_MCR, CANT, UndefinedInstr %x CPnum is %x, source %x", instr, CPNum, source); //ichfly todo //ARMul_Abort (state, ARMul_UndefinedInstrV); } else { BUSUSEDINCPCN; @@ -762,7 +762,7 @@ ARMword ARMul_MRC (ARMul_State * state, ARMword instr) //if (!CP_ACCESS_ALLOWED (state, CPNum)) { if (!state->MRC[CPNum]) { //chy 2004-07-19 should fix in the future????!!!! - DEBUG("SKYEYE ARMul_MRC,NOT ALLOWed UndefInstr CPnum is %x, instr %x\n", CPNum, instr); + LOG_ERROR(Core_ARM11, "SKYEYE ARMul_MRC,NOT ALLOWed UndefInstr CPnum is %x, instr %x", CPNum, instr); ARMul_UndefInstr (state, instr); return -1; } @@ -865,7 +865,7 @@ void ARMul_UndefInstr (ARMul_State * state, ARMword instr) { std::string disasm = ARM_Disasm::Disassemble(state->pc, instr); - ERROR_LOG(ARM11, "Undefined instruction!! Disasm: %s Opcode: 0x%x", disasm.c_str(), instr); + LOG_ERROR(Core_ARM11, "Undefined instruction!! Disasm: %s Opcode: 0x%x", disasm.c_str(), instr); ARMul_Abort (state, ARMul_UndefinedInstrV); } diff --git a/src/core/arm/interpreter/thumbemu.cpp b/src/core/arm/interpreter/thumbemu.cpp index f7f11f714..9cf80672d 100644 --- a/src/core/arm/interpreter/thumbemu.cpp +++ b/src/core/arm/interpreter/thumbemu.cpp @@ -467,7 +467,7 @@ ARMul_ThumbDecode ( (state->Reg[14] + ((tinstr & 0x07FF) << 1)) & 0xFFFFFFFC; state->Reg[14] = (tmp | 1); CLEART; - DEBUG_LOG(ARM11, "In %s, After BLX(1),LR=0x%x,PC=0x%x, offset=0x%x\n", __FUNCTION__, state->Reg[14], state->Reg[15], (tinstr &0x7FF) << 1); + LOG_DEBUG(Core_ARM11, "After BLX(1),LR=0x%x,PC=0x%x, offset=0x%x", state->Reg[14], state->Reg[15], (tinstr &0x7FF) << 1); valid = t_branch; FLUSHPIPE; } diff --git a/src/core/arm/skyeye_common/armemu.h b/src/core/arm/skyeye_common/armemu.h index 075fc7e9e..7f7c0e682 100644 --- a/src/core/arm/skyeye_common/armemu.h +++ b/src/core/arm/skyeye_common/armemu.h @@ -23,8 +23,6 @@ //extern ARMword isize; -#define DEBUG(...) DEBUG_LOG(ARM11, __VA_ARGS__) - /* Shift Opcodes. */ #define LSL 0 #define LSR 1 @@ -485,7 +483,7 @@ tdstate; * out-of-updated with the newer ISA. * -- Michael.Kang ********************************************************************************/ -#define UNDEF_WARNING WARN_LOG(ARM11, "undefined or unpredicted behavior for arm instruction.\n"); +#define UNDEF_WARNING LOG_WARNING(Core_ARM11, "undefined or unpredicted behavior for arm instruction."); /* Macros to scrutinize instructions. */ #define UNDEF_Test UNDEF_WARNING diff --git a/src/core/core.cpp b/src/core/core.cpp index 865898b24..64de0cbba 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -47,7 +47,7 @@ void Stop() { /// Initialize the core int Init() { - NOTICE_LOG(MASTER_LOG, "initialized OK"); + LOG_DEBUG(Core, "initialized OK"); disasm = new ARM_Disasm(); g_sys_core = new ARM_Interpreter(); @@ -72,7 +72,7 @@ void Shutdown() { delete g_app_core; delete g_sys_core; - NOTICE_LOG(MASTER_LOG, "shutdown OK"); + LOG_DEBUG(Core, "shutdown OK"); } } // namespace diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index bf8acf41f..1a0b2724a 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -124,7 +124,7 @@ int RegisterEvent(const char *name, TimedCallback callback) void AntiCrashCallback(u64 userdata, int cyclesLate) { - ERROR_LOG(TIME, "Savestate broken: an unregistered event was called."); + LOG_CRITICAL(Core, "Savestate broken: an unregistered event was called."); Core::Halt("invalid timing events"); } @@ -176,7 +176,7 @@ void Shutdown() u64 GetTicks() { - ERROR_LOG(TIME, "Unimplemented function!"); + LOG_ERROR(Core, "Unimplemented function!"); return 0; //return (u64)globalTimer + slicelength - currentMIPS->downcount; } @@ -510,7 +510,7 @@ void MoveEvents() void Advance() { - ERROR_LOG(TIME, "Unimplemented function!"); + LOG_ERROR(Core, "Unimplemented function!"); //int cyclesExecuted = slicelength - currentMIPS->downcount; //globalTimer += cyclesExecuted; //currentMIPS->downcount = slicelength; @@ -547,7 +547,7 @@ void LogPendingEvents() void Idle(int maxIdle) { - ERROR_LOG(TIME, "Unimplemented function!"); + LOG_ERROR(Core, "Unimplemented function!"); //int cyclesDown = currentMIPS->downcount; //if (maxIdle != 0 && cyclesDown > maxIdle) // cyclesDown = maxIdle; diff --git a/src/core/file_sys/archive.h b/src/core/file_sys/archive.h index f3cb11133..27ed23cd0 100644 --- a/src/core/file_sys/archive.h +++ b/src/core/file_sys/archive.h @@ -100,7 +100,8 @@ public: case Wchar: return "[Wchar: " + AsString() + ']'; default: - ERROR_LOG(KERNEL, "LowPathType cannot be converted to string!"); + // TODO(yuriks): Add assert + LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!"); return {}; } } @@ -114,7 +115,8 @@ public: case Empty: return {}; default: - ERROR_LOG(KERNEL, "LowPathType cannot be converted to string!"); + // TODO(yuriks): Add assert + LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!"); return {}; } } @@ -128,7 +130,8 @@ public: case Empty: return {}; default: - ERROR_LOG(KERNEL, "LowPathType cannot be converted to u16string!"); + // TODO(yuriks): Add assert + LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!"); return {}; } } @@ -144,7 +147,8 @@ public: case Empty: return {}; default: - ERROR_LOG(KERNEL, "LowPathType cannot be converted to binary!"); + // TODO(yuriks): Add assert + LOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!"); return {}; } } diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp index 8c2dbeda5..74974c2df 100644 --- a/src/core/file_sys/archive_romfs.cpp +++ b/src/core/file_sys/archive_romfs.cpp @@ -16,7 +16,7 @@ namespace FileSys { Archive_RomFS::Archive_RomFS(const Loader::AppLoader& app_loader) { // Load the RomFS from the app if (Loader::ResultStatus::Success != app_loader.ReadRomFS(raw_data)) { - WARN_LOG(FILESYS, "Unable to read RomFS!"); + LOG_ERROR(Service_FS, "Unable to read RomFS!"); } } @@ -39,12 +39,12 @@ std::unique_ptr Archive_RomFS::OpenFile(const Path& path, const Mode mode) * @return Whether the file could be deleted */ bool Archive_RomFS::DeleteFile(const FileSys::Path& path) const { - ERROR_LOG(FILESYS, "Attempted to delete a file from ROMFS."); + LOG_WARNING(Service_FS, "Attempted to delete a file from ROMFS."); return false; } bool Archive_RomFS::RenameFile(const FileSys::Path& src_path, const FileSys::Path& dest_path) const { - ERROR_LOG(FILESYS, "Attempted to rename a file within ROMFS."); + LOG_WARNING(Service_FS, "Attempted to rename a file within ROMFS."); return false; } @@ -54,7 +54,7 @@ bool Archive_RomFS::RenameFile(const FileSys::Path& src_path, const FileSys::Pat * @return Whether the directory could be deleted */ bool Archive_RomFS::DeleteDirectory(const FileSys::Path& path) const { - ERROR_LOG(FILESYS, "Attempted to delete a directory from ROMFS."); + LOG_WARNING(Service_FS, "Attempted to delete a directory from ROMFS."); return false; } @@ -64,12 +64,12 @@ bool Archive_RomFS::DeleteDirectory(const FileSys::Path& path) const { * @return Whether the directory could be created */ bool Archive_RomFS::CreateDirectory(const Path& path) const { - ERROR_LOG(FILESYS, "Attempted to create a directory in ROMFS."); + LOG_WARNING(Service_FS, "Attempted to create a directory in ROMFS."); return false; } bool Archive_RomFS::RenameDirectory(const FileSys::Path& src_path, const FileSys::Path& dest_path) const { - ERROR_LOG(FILESYS, "Attempted to rename a file within ROMFS."); + LOG_WARNING(Service_FS, "Attempted to rename a file within ROMFS."); return false; } @@ -90,7 +90,7 @@ std::unique_ptr Archive_RomFS::OpenDirectory(const Path& path) const * @return Number of bytes read */ size_t Archive_RomFS::Read(const u64 offset, const u32 length, u8* buffer) const { - DEBUG_LOG(FILESYS, "called offset=%llu, length=%d", offset, length); + LOG_TRACE(Service_FS, "called offset=%llu, length=%d", offset, length); memcpy(buffer, &raw_data[(u32)offset], length); return length; } @@ -104,7 +104,7 @@ size_t Archive_RomFS::Read(const u64 offset, const u32 length, u8* buffer) const * @return Number of bytes written */ size_t Archive_RomFS::Write(const u64 offset, const u32 length, const u32 flush, u8* buffer) { - ERROR_LOG(FILESYS, "Attempted to write to ROMFS."); + LOG_WARNING(Service_FS, "Attempted to write to ROMFS."); return 0; } @@ -120,7 +120,7 @@ size_t Archive_RomFS::GetSize() const { * Set the size of the archive in bytes */ void Archive_RomFS::SetSize(const u64 size) { - ERROR_LOG(FILESYS, "Attempted to set the size of ROMFS"); + LOG_WARNING(Service_FS, "Attempted to set the size of ROMFS"); } } // namespace FileSys diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp index fc0b9b72d..9e524b60e 100644 --- a/src/core/file_sys/archive_sdmc.cpp +++ b/src/core/file_sys/archive_sdmc.cpp @@ -19,7 +19,7 @@ namespace FileSys { Archive_SDMC::Archive_SDMC(const std::string& mount_point) { this->mount_point = mount_point; - DEBUG_LOG(FILESYS, "Directory %s set as SDMC.", mount_point.c_str()); + LOG_INFO(Service_FS, "Directory %s set as SDMC.", mount_point.c_str()); } Archive_SDMC::~Archive_SDMC() { @@ -31,12 +31,12 @@ Archive_SDMC::~Archive_SDMC() { */ bool Archive_SDMC::Initialize() { if (!Settings::values.use_virtual_sd) { - WARN_LOG(FILESYS, "SDMC disabled by config."); + LOG_WARNING(Service_FS, "SDMC disabled by config."); return false; } if (!FileUtil::CreateFullPath(mount_point)) { - WARN_LOG(FILESYS, "Unable to create SDMC path."); + LOG_ERROR(Service_FS, "Unable to create SDMC path."); return false; } @@ -50,7 +50,7 @@ bool Archive_SDMC::Initialize() { * @return Opened file, or nullptr */ std::unique_ptr Archive_SDMC::OpenFile(const Path& path, const Mode mode) const { - DEBUG_LOG(FILESYS, "called path=%s mode=%u", path.DebugStr().c_str(), mode.hex); + LOG_DEBUG(Service_FS, "called path=%s mode=%u", path.DebugStr().c_str(), mode.hex); File_SDMC* file = new File_SDMC(this, path, mode); if (!file->Open()) return nullptr; @@ -98,7 +98,7 @@ bool Archive_SDMC::RenameDirectory(const FileSys::Path& src_path, const FileSys: * @return Opened directory, or nullptr */ std::unique_ptr Archive_SDMC::OpenDirectory(const Path& path) const { - DEBUG_LOG(FILESYS, "called path=%s", path.DebugStr().c_str()); + LOG_DEBUG(Service_FS, "called path=%s", path.DebugStr().c_str()); Directory_SDMC* directory = new Directory_SDMC(this, path); if (!directory->Open()) return nullptr; @@ -113,7 +113,7 @@ std::unique_ptr Archive_SDMC::OpenDirectory(const Path& path) const { * @return Number of bytes read */ size_t Archive_SDMC::Read(const u64 offset, const u32 length, u8* buffer) const { - ERROR_LOG(FILESYS, "(UNIMPLEMENTED)"); + LOG_ERROR(Service_FS, "(UNIMPLEMENTED)"); return -1; } @@ -126,7 +126,7 @@ size_t Archive_SDMC::Read(const u64 offset, const u32 length, u8* buffer) const * @return Number of bytes written */ size_t Archive_SDMC::Write(const u64 offset, const u32 length, const u32 flush, u8* buffer) { - ERROR_LOG(FILESYS, "(UNIMPLEMENTED)"); + LOG_ERROR(Service_FS, "(UNIMPLEMENTED)"); return -1; } @@ -135,7 +135,7 @@ size_t Archive_SDMC::Write(const u64 offset, const u32 length, const u32 flush, * @return Size of the archive in bytes */ size_t Archive_SDMC::GetSize() const { - ERROR_LOG(FILESYS, "(UNIMPLEMENTED)"); + LOG_ERROR(Service_FS, "(UNIMPLEMENTED)"); return 0; } @@ -143,7 +143,7 @@ size_t Archive_SDMC::GetSize() const { * Set the size of the archive in bytes */ void Archive_SDMC::SetSize(const u64 size) { - ERROR_LOG(FILESYS, "(UNIMPLEMENTED)"); + LOG_ERROR(Service_FS, "(UNIMPLEMENTED)"); } /** diff --git a/src/core/file_sys/directory_sdmc.cpp b/src/core/file_sys/directory_sdmc.cpp index 0f156a127..519787641 100644 --- a/src/core/file_sys/directory_sdmc.cpp +++ b/src/core/file_sys/directory_sdmc.cpp @@ -49,7 +49,7 @@ u32 Directory_SDMC::Read(const u32 count, Entry* entries) { const std::string& filename = file.virtualName; Entry& entry = entries[entries_read]; - WARN_LOG(FILESYS, "File %s: size=%llu dir=%d", filename.c_str(), file.size, file.isDirectory); + LOG_TRACE(Service_FS, "File %s: size=%llu dir=%d", filename.c_str(), file.size, file.isDirectory); // TODO(Link Mauve): use a proper conversion to UTF-16. for (size_t j = 0; j < FILENAME_LENGTH; ++j) { diff --git a/src/core/file_sys/file_sdmc.cpp b/src/core/file_sys/file_sdmc.cpp index b01d96e3d..46c29900b 100644 --- a/src/core/file_sys/file_sdmc.cpp +++ b/src/core/file_sys/file_sdmc.cpp @@ -33,7 +33,7 @@ File_SDMC::~File_SDMC() { */ bool File_SDMC::Open() { if (!mode.create_flag && !FileUtil::Exists(path)) { - ERROR_LOG(FILESYS, "Non-existing file %s can’t be open without mode create.", path.c_str()); + LOG_ERROR(Service_FS, "Non-existing file %s can’t be open without mode create.", path.c_str()); return false; } diff --git a/src/core/hle/config_mem.cpp b/src/core/hle/config_mem.cpp index 1c9b89227..d8ba9e6cf 100644 --- a/src/core/hle/config_mem.cpp +++ b/src/core/hle/config_mem.cpp @@ -55,7 +55,7 @@ inline void Read(T &var, const u32 addr) { break; default: - ERROR_LOG(HLE, "unknown addr=0x%08X", addr); + LOG_ERROR(Kernel, "unknown addr=0x%08X", addr); } } diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp index b8ac186f6..3f73b5538 100644 --- a/src/core/hle/hle.cpp +++ b/src/core/hle/hle.cpp @@ -20,7 +20,7 @@ bool g_reschedule = false; ///< If true, immediately reschedules the CPU to a n const FunctionDef* GetSVCInfo(u32 opcode) { u32 func_num = opcode & 0xFFFFFF; // 8 bits if (func_num > 0xFF) { - ERROR_LOG(HLE,"unknown svc=0x%02X", func_num); + LOG_ERROR(Kernel_SVC,"unknown svc=0x%02X", func_num); return nullptr; } return &g_module_db[0].func_table[func_num]; @@ -35,14 +35,12 @@ void CallSVC(u32 opcode) { if (info->func) { info->func(); } else { - ERROR_LOG(HLE, "unimplemented SVC function %s(..)", info->name.c_str()); + LOG_ERROR(Kernel_SVC, "unimplemented SVC function %s(..)", info->name.c_str()); } } void Reschedule(const char *reason) { -#ifdef _DEBUG - _dbg_assert_msg_(HLE, reason != 0 && strlen(reason) < 256, "Reschedule: Invalid or too long reason."); -#endif + _dbg_assert_msg_(Kernel, reason != 0 && strlen(reason) < 256, "Reschedule: Invalid or too long reason."); Core::g_app_core->PrepareReschedule(); g_reschedule = true; } @@ -61,7 +59,7 @@ void Init() { RegisterAllModules(); - NOTICE_LOG(HLE, "initialized OK"); + LOG_DEBUG(Kernel, "initialized OK"); } void Shutdown() { @@ -69,7 +67,7 @@ void Shutdown() { g_module_db.clear(); - NOTICE_LOG(HLE, "shutdown OK"); + LOG_DEBUG(Kernel, "shutdown OK"); } } // namespace diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index ce4f3c854..9a921108d 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp @@ -24,12 +24,6 @@ public: Kernel::HandleType GetHandleType() const override { return HandleType::AddressArbiter; } std::string name; ///< Name of address arbiter object (optional) - - ResultVal WaitSynchronization() override { - // TODO(bunnei): ImplementMe - ERROR_LOG(OSHLE, "(UNIMPLEMENTED)"); - return UnimplementedFunction(ErrorModule::OS); - } }; //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -59,7 +53,7 @@ ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s3 break; default: - ERROR_LOG(KERNEL, "unknown type=%d", type); + LOG_ERROR(Kernel, "unknown type=%d", type); return ResultCode(ErrorDescription::InvalidEnumValue, ErrorModule::Kernel, ErrorSummary::WrongArgument, ErrorLevel::Usage); } return RESULT_SUCCESS; diff --git a/src/core/hle/kernel/archive.cpp b/src/core/hle/kernel/archive.cpp index a875fa7ff..ddc09e13b 100644 --- a/src/core/hle/kernel/archive.cpp +++ b/src/core/hle/kernel/archive.cpp @@ -94,26 +94,20 @@ public: } case FileCommand::Close: { - DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); + LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); CloseArchive(backend->GetIdCode()); break; } // Unknown command... default: { - ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd); + LOG_ERROR(Service_FS, "Unknown command=0x%08X", cmd); return UnimplementedFunction(ErrorModule::FS); } } cmd_buff[1] = 0; // No error return MakeResult(false); } - - ResultVal WaitSynchronization() override { - // TODO(bunnei): ImplementMe - ERROR_LOG(OSHLE, "(UNIMPLEMENTED)"); - return UnimplementedFunction(ErrorModule::FS); - } }; class File : public Object { @@ -138,7 +132,7 @@ public: u64 offset = cmd_buff[1] | ((u64) cmd_buff[2]) << 32; u32 length = cmd_buff[3]; u32 address = cmd_buff[5]; - DEBUG_LOG(KERNEL, "Read %s %s: offset=0x%llx length=%d address=0x%x", + LOG_TRACE(Service_FS, "Read %s %s: offset=0x%llx length=%d address=0x%x", GetTypeName().c_str(), GetName().c_str(), offset, length, address); cmd_buff[2] = backend->Read(offset, length, Memory::GetPointer(address)); break; @@ -151,7 +145,7 @@ public: u32 length = cmd_buff[3]; u32 flush = cmd_buff[4]; u32 address = cmd_buff[6]; - DEBUG_LOG(KERNEL, "Write %s %s: offset=0x%llx length=%d address=0x%x, flush=0x%x", + LOG_TRACE(Service_FS, "Write %s %s: offset=0x%llx length=%d address=0x%x, flush=0x%x", GetTypeName().c_str(), GetName().c_str(), offset, length, address, flush); cmd_buff[2] = backend->Write(offset, length, flush, Memory::GetPointer(address)); break; @@ -159,7 +153,7 @@ public: case FileCommand::GetSize: { - DEBUG_LOG(KERNEL, "GetSize %s %s", GetTypeName().c_str(), GetName().c_str()); + LOG_TRACE(Service_FS, "GetSize %s %s", GetTypeName().c_str(), GetName().c_str()); u64 size = backend->GetSize(); cmd_buff[2] = (u32)size; cmd_buff[3] = size >> 32; @@ -169,7 +163,7 @@ public: case FileCommand::SetSize: { u64 size = cmd_buff[1] | ((u64)cmd_buff[2] << 32); - DEBUG_LOG(KERNEL, "SetSize %s %s size=%llu", + LOG_TRACE(Service_FS, "SetSize %s %s size=%llu", GetTypeName().c_str(), GetName().c_str(), size); backend->SetSize(size); break; @@ -177,14 +171,14 @@ public: case FileCommand::Close: { - DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); + LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); Kernel::g_object_pool.Destroy(GetHandle()); break; } // Unknown command... default: - ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd); + LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd); ResultCode error = UnimplementedFunction(ErrorModule::FS); cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that. return error; @@ -192,12 +186,6 @@ public: cmd_buff[1] = 0; // No error return MakeResult(false); } - - ResultVal WaitSynchronization() override { - // TODO(bunnei): ImplementMe - ERROR_LOG(OSHLE, "(UNIMPLEMENTED)"); - return UnimplementedFunction(ErrorModule::FS); - } }; class Directory : public Object { @@ -222,7 +210,7 @@ public: u32 count = cmd_buff[1]; u32 address = cmd_buff[3]; auto entries = reinterpret_cast(Memory::GetPointer(address)); - DEBUG_LOG(KERNEL, "Read %s %s: count=%d", + LOG_TRACE(Service_FS, "Read %s %s: count=%d", GetTypeName().c_str(), GetName().c_str(), count); // Number of entries actually read @@ -232,14 +220,14 @@ public: case DirectoryCommand::Close: { - DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); + LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); Kernel::g_object_pool.Destroy(GetHandle()); break; } // Unknown command... default: - ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd); + LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd); ResultCode error = UnimplementedFunction(ErrorModule::FS); cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that. return error; @@ -247,12 +235,6 @@ public: cmd_buff[1] = 0; // No error return MakeResult(false); } - - ResultVal WaitSynchronization() override { - // TODO(bunnei): ImplementMe - ERROR_LOG(OSHLE, "(UNIMPLEMENTED)"); - return UnimplementedFunction(ErrorModule::FS); - } }; //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -272,11 +254,11 @@ ResultVal OpenArchive(FileSys::Archive::IdCode id_code) { ResultCode CloseArchive(FileSys::Archive::IdCode id_code) { auto itr = g_archive_map.find(id_code); if (itr == g_archive_map.end()) { - ERROR_LOG(KERNEL, "Cannot close archive %d, does not exist!", (int)id_code); + LOG_ERROR(Service_FS, "Cannot close archive %d, does not exist!", (int)id_code); return InvalidHandle(ErrorModule::FS); } - INFO_LOG(KERNEL, "Closed archive %d", (int) id_code); + LOG_TRACE(Service_FS, "Closed archive %d", (int) id_code); return RESULT_SUCCESS; } @@ -288,11 +270,11 @@ ResultCode MountArchive(Archive* archive) { FileSys::Archive::IdCode id_code = archive->backend->GetIdCode(); ResultVal archive_handle = OpenArchive(id_code); if (archive_handle.Succeeded()) { - ERROR_LOG(KERNEL, "Cannot mount two archives with the same ID code! (%d)", (int) id_code); + LOG_ERROR(Service_FS, "Cannot mount two archives with the same ID code! (%d)", (int) id_code); return archive_handle.Code(); } g_archive_map[id_code] = archive->GetHandle(); - INFO_LOG(KERNEL, "Mounted archive %s", archive->GetName().c_str()); + LOG_TRACE(Service_FS, "Mounted archive %s", archive->GetName().c_str()); return RESULT_SUCCESS; } @@ -442,7 +424,7 @@ void ArchiveInit() { if (archive->Initialize()) CreateArchive(archive, "SDMC"); else - ERROR_LOG(KERNEL, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str()); + LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str()); } /// Shutdown archives diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 80a34c2d5..b38be0a49 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -35,7 +35,7 @@ Handle ObjectPool::Create(Object* obj, int range_bottom, int range_top) { return i + HANDLE_OFFSET; } } - ERROR_LOG(HLE, "Unable to allocate kernel object, too many objects slots in use."); + LOG_ERROR(Kernel, "Unable to allocate kernel object, too many objects slots in use."); return 0; } @@ -62,7 +62,7 @@ void ObjectPool::Clear() { Object* &ObjectPool::operator [](Handle handle) { - _dbg_assert_msg_(KERNEL, IsValid(handle), "GRABBING UNALLOCED KERNEL OBJ"); + _dbg_assert_msg_(Kernel, IsValid(handle), "GRABBING UNALLOCED KERNEL OBJ"); return pool[handle - HANDLE_OFFSET]; } @@ -70,7 +70,7 @@ void ObjectPool::List() { for (int i = 0; i < MAX_COUNT; i++) { if (occupied[i]) { if (pool[i]) { - INFO_LOG(KERNEL, "KO %i: %s \"%s\"", i + HANDLE_OFFSET, pool[i]->GetTypeName().c_str(), + LOG_DEBUG(Kernel, "KO %i: %s \"%s\"", i + HANDLE_OFFSET, pool[i]->GetTypeName().c_str(), pool[i]->GetName().c_str()); } } @@ -82,7 +82,7 @@ int ObjectPool::GetCount() const { } Object* ObjectPool::CreateByIDType(int type) { - ERROR_LOG(COMMON, "Unimplemented: %d.", type); + LOG_ERROR(Kernel, "Unimplemented: %d.", type); return nullptr; } diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 00a2228bf..00f9b57fc 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -57,7 +57,7 @@ public: * @return True if the current thread should wait as a result of the sync */ virtual ResultVal SyncRequest() { - ERROR_LOG(KERNEL, "(UNIMPLEMENTED)"); + LOG_ERROR(Kernel, "(UNIMPLEMENTED)"); return UnimplementedFunction(ErrorModule::Kernel); } @@ -65,7 +65,10 @@ public: * Wait for kernel object to synchronize. * @return True if the current thread should wait as a result of the wait */ - virtual ResultVal WaitSynchronization() = 0; + virtual ResultVal WaitSynchronization() { + LOG_ERROR(Kernel, "(UNIMPLEMENTED)"); + return UnimplementedFunction(ErrorModule::Kernel); + } }; class ObjectPool : NonCopyable { @@ -92,13 +95,13 @@ public: T* Get(Handle handle) { if (handle < HANDLE_OFFSET || handle >= HANDLE_OFFSET + MAX_COUNT || !occupied[handle - HANDLE_OFFSET]) { if (handle != 0) { - WARN_LOG(KERNEL, "Kernel: Bad object handle %i (%08x)", handle, handle); + LOG_ERROR(Kernel, "Bad object handle %08x", handle, handle); } return nullptr; } else { Object* t = pool[handle - HANDLE_OFFSET]; if (t->GetHandleType() != T::GetStaticHandleType()) { - WARN_LOG(KERNEL, "Kernel: Wrong object type for %i (%08x)", handle, handle); + LOG_ERROR(Kernel, "Wrong object type for %08x", handle, handle); return nullptr; } return static_cast(t); @@ -109,7 +112,7 @@ public: template T *GetFast(Handle handle) { const Handle realHandle = handle - HANDLE_OFFSET; - _dbg_assert_(KERNEL, realHandle >= 0 && realHandle < MAX_COUNT && occupied[realHandle]); + _dbg_assert_(Kernel, realHandle >= 0 && realHandle < MAX_COUNT && occupied[realHandle]); return static_cast(pool[realHandle]); } @@ -130,8 +133,8 @@ public: bool GetIDType(Handle handle, HandleType* type) const { if ((handle < HANDLE_OFFSET) || (handle >= HANDLE_OFFSET + MAX_COUNT) || - !occupied[handle - HANDLE_OFFSET]) { - ERROR_LOG(KERNEL, "Kernel: Bad object handle %i (%08x)", handle, handle); + !occupied[handle - HANDLE_OFFSET]) { + LOG_ERROR(Kernel, "Bad object handle %08X", handle, handle); return false; } Object* t = pool[handle - HANDLE_OFFSET]; diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index cfcc0e0b7..3c8c502c6 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -16,12 +16,6 @@ public: static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::SharedMemory; } Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::SharedMemory; } - ResultVal WaitSynchronization() override { - // TODO(bunnei): ImplementMe - ERROR_LOG(OSHLE, "(UNIMPLEMENTED)"); - return UnimplementedFunction(ErrorModule::OS); - } - u32 base_address; ///< Address of shared memory block in RAM MemoryPermission permissions; ///< Permissions of shared memory block (SVC field) MemoryPermission other_permissions; ///< Other permissions of shared memory block (SVC field) @@ -61,7 +55,7 @@ ResultCode MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions MemoryPermission other_permissions) { if (address < Memory::SHARED_MEMORY_VADDR || address >= Memory::SHARED_MEMORY_VADDR_END) { - ERROR_LOG(KERNEL, "cannot map handle=0x%08X, address=0x%08X outside of shared mem bounds!", + LOG_ERROR(Kernel_SVC, "cannot map handle=0x%08X, address=0x%08X outside of shared mem bounds!", handle, address); return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel, ErrorSummary::InvalidArgument, ErrorLevel::Permanent); @@ -83,7 +77,7 @@ ResultVal GetSharedMemoryPointer(Handle handle, u32 offset) { if (0 != shared_memory->base_address) return MakeResult(Memory::GetPointer(shared_memory->base_address + offset)); - ERROR_LOG(KERNEL, "memory block handle=0x%08X not mapped!", handle); + LOG_ERROR(Kernel_SVC, "memory block handle=0x%08X not mapped!", handle); // TODO(yuriks): Verify error code. return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel, ErrorSummary::InvalidState, ErrorLevel::Permanent); diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 492b917e1..1c04701de 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -150,13 +150,13 @@ void ChangeReadyState(Thread* t, bool ready) { /// Verify that a thread has not been released from waiting static bool VerifyWait(const Thread* thread, WaitType type, Handle wait_handle) { - _dbg_assert_(KERNEL, thread != nullptr); + _dbg_assert_(Kernel, thread != nullptr); return (type == thread->wait_type) && (wait_handle == thread->wait_handle) && (thread->IsWaiting()); } /// Verify that a thread has not been released from waiting (with wait address) static bool VerifyWait(const Thread* thread, WaitType type, Handle wait_handle, VAddr wait_address) { - _dbg_assert_(KERNEL, thread != nullptr); + _dbg_assert_(Kernel, thread != nullptr); return VerifyWait(thread, type, wait_handle) && (wait_address == thread->wait_address); } @@ -196,7 +196,7 @@ void ChangeThreadState(Thread* t, ThreadStatus new_status) { if (new_status == THREADSTATUS_WAIT) { if (t->wait_type == WAITTYPE_NONE) { - ERROR_LOG(KERNEL, "Waittype none not allowed"); + LOG_ERROR(Kernel, "Waittype none not allowed"); } } } @@ -318,12 +318,12 @@ void DebugThreadQueue() { if (!thread) { return; } - INFO_LOG(KERNEL, "0x%02X 0x%08X (current)", thread->current_priority, GetCurrentThreadHandle()); + LOG_DEBUG(Kernel, "0x%02X 0x%08X (current)", thread->current_priority, GetCurrentThreadHandle()); for (u32 i = 0; i < thread_queue.size(); i++) { Handle handle = thread_queue[i]; s32 priority = thread_ready_queue.contains(handle); if (priority != -1) { - INFO_LOG(KERNEL, "0x%02X 0x%08X", priority, handle); + LOG_DEBUG(Kernel, "0x%02X 0x%08X", priority, handle); } } } @@ -333,7 +333,7 @@ Thread* CreateThread(Handle& handle, const char* name, u32 entry_point, s32 prio s32 processor_id, u32 stack_top, int stack_size) { _assert_msg_(KERNEL, (priority >= THREADPRIO_HIGHEST && priority <= THREADPRIO_LOWEST), - "CreateThread priority=%d, outside of allowable range!", priority) + "priority=%d, outside of allowable range!", priority) Thread* thread = new Thread; @@ -362,24 +362,24 @@ Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s3 u32 stack_top, int stack_size) { if (name == nullptr) { - ERROR_LOG(KERNEL, "CreateThread(): nullptr name"); + LOG_ERROR(Kernel_SVC, "nullptr name"); return -1; } if ((u32)stack_size < 0x200) { - ERROR_LOG(KERNEL, "CreateThread(name=%s): invalid stack_size=0x%08X", name, + LOG_ERROR(Kernel_SVC, "(name=%s): invalid stack_size=0x%08X", name, stack_size); return -1; } if (priority < THREADPRIO_HIGHEST || priority > THREADPRIO_LOWEST) { s32 new_priority = CLAMP(priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST); - WARN_LOG(KERNEL, "CreateThread(name=%s): invalid priority=0x%08X, clamping to %08X", + LOG_WARNING(Kernel_SVC, "(name=%s): invalid priority=%d, clamping to %d", name, priority, new_priority); // TODO(bunnei): Clamping to a valid priority is not necessarily correct behavior... Confirm // validity of this priority = new_priority; } if (!Memory::GetPointer(entry_point)) { - ERROR_LOG(KERNEL, "CreateThread(name=%s): invalid entry %08x", name, entry_point); + LOG_ERROR(Kernel_SVC, "(name=%s): invalid entry %08x", name, entry_point); return -1; } Handle handle; @@ -416,7 +416,7 @@ ResultCode SetThreadPriority(Handle handle, s32 priority) { // If priority is invalid, clamp to valid range if (priority < THREADPRIO_HIGHEST || priority > THREADPRIO_LOWEST) { s32 new_priority = CLAMP(priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST); - WARN_LOG(KERNEL, "invalid priority=0x%08X, clamping to %08X", priority, new_priority); + LOG_WARNING(Kernel_SVC, "invalid priority=%d, clamping to %d", priority, new_priority); // TODO(bunnei): Clamping to a valid priority is not necessarily correct behavior... Confirm // validity of this priority = new_priority; @@ -470,7 +470,7 @@ void Reschedule() { Thread* next = NextThread(); HLE::g_reschedule = false; if (next > 0) { - INFO_LOG(KERNEL, "context switch 0x%08X -> 0x%08X", prev->GetHandle(), next->GetHandle()); + LOG_TRACE(Kernel, "context switch 0x%08X -> 0x%08X", prev->GetHandle(), next->GetHandle()); SwitchContext(next); diff --git a/src/core/hle/service/ac_u.cpp b/src/core/hle/service/ac_u.cpp index 46aee40d6..4130feb9d 100644 --- a/src/core/hle/service/ac_u.cpp +++ b/src/core/hle/service/ac_u.cpp @@ -26,7 +26,7 @@ void GetWifiStatus(Service::Interface* self) { cmd_buff[1] = 0; // No error cmd_buff[2] = 0; // Connection type set to none - WARN_LOG(KERNEL, "(STUBBED) called"); + LOG_WARNING(Service_AC, "(STUBBED) called"); } const Interface::FunctionInfo FunctionTable[] = { diff --git a/src/core/hle/service/apt_u.cpp b/src/core/hle/service/apt_u.cpp index 181763724..b6d5d101f 100644 --- a/src/core/hle/service/apt_u.cpp +++ b/src/core/hle/service/apt_u.cpp @@ -53,7 +53,7 @@ void Initialize(Service::Interface* self) { cmd_buff[1] = 0; // No error - DEBUG_LOG(KERNEL, "called"); + LOG_DEBUG(Service_APT, "called"); } void GetLockHandle(Service::Interface* self) { @@ -74,14 +74,14 @@ void GetLockHandle(Service::Interface* self) { cmd_buff[4] = 0; cmd_buff[5] = lock_handle; - DEBUG_LOG(KERNEL, "called handle=0x%08X", cmd_buff[5]); + LOG_TRACE(Service_APT, "called handle=0x%08X", cmd_buff[5]); } void Enable(Service::Interface* self) { u32* cmd_buff = Service::GetCommandBuffer(); u32 unk = cmd_buff[1]; // TODO(bunnei): What is this field used for? cmd_buff[1] = 0; // No error - WARN_LOG(KERNEL, "(STUBBED) called unk=0x%08X", unk); + LOG_WARNING(Service_APT, "(STUBBED) called unk=0x%08X", unk); } void InquireNotification(Service::Interface* self) { @@ -89,7 +89,7 @@ void InquireNotification(Service::Interface* self) { u32 app_id = cmd_buff[2]; cmd_buff[1] = 0; // No error cmd_buff[2] = static_cast(SignalType::None); // Signal type - WARN_LOG(KERNEL, "(STUBBED) called app_id=0x%08X", app_id); + LOG_WARNING(Service_APT, "(STUBBED) called app_id=0x%08X", app_id); } /** @@ -122,7 +122,7 @@ void ReceiveParameter(Service::Interface* self) { cmd_buff[5] = 0; cmd_buff[6] = 0; cmd_buff[7] = 0; - WARN_LOG(KERNEL, "(STUBBED) called app_id=0x%08X, buffer_size=0x%08X", app_id, buffer_size); + LOG_WARNING(Service_APT, "(STUBBED) called app_id=0x%08X, buffer_size=0x%08X", app_id, buffer_size); } /** @@ -155,7 +155,7 @@ void GlanceParameter(Service::Interface* self) { cmd_buff[6] = 0; cmd_buff[7] = 0; - WARN_LOG(KERNEL, "(STUBBED) called app_id=0x%08X, buffer_size=0x%08X", app_id, buffer_size); + LOG_WARNING(Service_APT, "(STUBBED) called app_id=0x%08X, buffer_size=0x%08X", app_id, buffer_size); } /** @@ -181,7 +181,7 @@ void AppletUtility(Service::Interface* self) { cmd_buff[1] = 0; // No error - WARN_LOG(KERNEL, "(STUBBED) called unk=0x%08X, buffer1_size=0x%08x, buffer2_size=0x%08x, " + LOG_WARNING(Service_APT, "(STUBBED) called unk=0x%08X, buffer1_size=0x%08x, buffer2_size=0x%08x, " "buffer1_addr=0x%08x, buffer2_addr=0x%08x", unk, buffer1_size, buffer2_size, buffer1_addr, buffer2_addr); } @@ -194,7 +194,7 @@ void AppletUtility(Service::Interface* self) { * 4 : Handle to shared font memory */ void GetSharedFont(Service::Interface* self) { - DEBUG_LOG(KERNEL, "called"); + LOG_TRACE(Kernel_SVC, "called"); u32* cmd_buff = Service::GetCommandBuffer(); @@ -210,7 +210,7 @@ void GetSharedFont(Service::Interface* self) { cmd_buff[4] = shared_font_mem; } else { cmd_buff[1] = -1; // Generic error (not really possible to verify this on hardware) - ERROR_LOG(KERNEL, "called, but %s has not been loaded!", SHARED_FONT); + LOG_ERROR(Kernel_SVC, "called, but %s has not been loaded!", SHARED_FONT); } } @@ -321,7 +321,7 @@ Interface::Interface() { // Create shared font memory object shared_font_mem = Kernel::CreateSharedMemory("APT_U:shared_font_mem"); } else { - WARN_LOG(KERNEL, "Unable to load shared font: %s", filepath.c_str()); + LOG_WARNING(Service_APT, "Unable to load shared font: %s", filepath.c_str()); shared_font_mem = 0; } diff --git a/src/core/hle/service/cfg_u.cpp b/src/core/hle/service/cfg_u.cpp index 82bab5797..972cc0534 100644 --- a/src/core/hle/service/cfg_u.cpp +++ b/src/core/hle/service/cfg_u.cpp @@ -56,7 +56,7 @@ static void GetCountryCodeString(Service::Interface* self) { u32 country_code_id = cmd_buffer[1]; if (country_code_id >= country_codes.size() || 0 == country_codes[country_code_id]) { - ERROR_LOG(KERNEL, "requested country code id=%d is invalid", country_code_id); + LOG_ERROR(Service_CFG, "requested country code id=%d is invalid", country_code_id); cmd_buffer[1] = ResultCode(ErrorDescription::NotFound, ErrorModule::Config, ErrorSummary::WrongArgument, ErrorLevel::Permanent).raw; return; } @@ -79,7 +79,7 @@ static void GetCountryCodeID(Service::Interface* self) { u16 country_code_id = 0; // The following algorithm will fail if the first country code isn't 0. - _dbg_assert_(HLE, country_codes[0] == 0); + _dbg_assert_(Service_CFG, country_codes[0] == 0); for (size_t id = 0; id < country_codes.size(); ++id) { if (country_codes[id] == country_code) { @@ -89,7 +89,7 @@ static void GetCountryCodeID(Service::Interface* self) { } if (0 == country_code_id) { - ERROR_LOG(KERNEL, "requested country code name=%c%c is invalid", country_code & 0xff, country_code >> 8); + LOG_ERROR(Service_CFG, "requested country code name=%c%c is invalid", country_code & 0xff, country_code >> 8); cmd_buffer[1] = ResultCode(ErrorDescription::NotFound, ErrorModule::Config, ErrorSummary::WrongArgument, ErrorLevel::Permanent).raw; cmd_buffer[2] = 0xFFFF; return; diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp index e89c8aae3..ce1c9938d 100644 --- a/src/core/hle/service/dsp_dsp.cpp +++ b/src/core/hle/service/dsp_dsp.cpp @@ -32,7 +32,7 @@ void ConvertProcessAddressFromDspDram(Service::Interface* self) { cmd_buff[1] = 0; // No error cmd_buff[2] = (addr << 1) + (Memory::DSP_MEMORY_VADDR + 0x40000); - DEBUG_LOG(KERNEL, "(STUBBED) called with address %u", addr); + LOG_WARNING(Service_DSP, "(STUBBED) called with address %u", addr); } /** @@ -55,7 +55,7 @@ void LoadComponent(Service::Interface* self) { // TODO(bunnei): Implement real DSP firmware loading - DEBUG_LOG(KERNEL, "(STUBBED) called"); + LOG_WARNING(Service_DSP, "(STUBBED) called"); } /** @@ -70,7 +70,7 @@ void GetSemaphoreEventHandle(Service::Interface* self) { cmd_buff[1] = 0; // No error cmd_buff[3] = semaphore_event; // Event handle - DEBUG_LOG(KERNEL, "(STUBBED) called"); + LOG_WARNING(Service_DSP, "(STUBBED) called"); } /** @@ -89,7 +89,7 @@ void RegisterInterruptEvents(Service::Interface* self) { cmd_buff[1] = 0; // No error - DEBUG_LOG(KERNEL, "(STUBBED) called"); + LOG_WARNING(Service_DSP, "(STUBBED) called"); } /** @@ -106,7 +106,7 @@ void WriteReg0x10(Service::Interface* self) { cmd_buff[1] = 0; // No error - DEBUG_LOG(KERNEL, "(STUBBED) called"); + LOG_WARNING(Service_DSP, "(STUBBED) called"); } /** @@ -140,7 +140,7 @@ void ReadPipeIfPossible(Service::Interface* self) { Memory::Write16(addr + offset, canned_read_pipe[read_pipe_count]); read_pipe_count++; } else { - ERROR_LOG(KERNEL, "canned read pipe log exceeded!"); + LOG_ERROR(Service_DSP, "canned read pipe log exceeded!"); break; } } @@ -148,7 +148,7 @@ void ReadPipeIfPossible(Service::Interface* self) { cmd_buff[1] = 0; // No error cmd_buff[2] = (read_pipe_count - initial_size) * sizeof(u16); - DEBUG_LOG(KERNEL, "(STUBBED) called size=0x%08X, buffer=0x%08X", size, addr); + LOG_WARNING(Service_DSP, "(STUBBED) called size=0x%08X, buffer=0x%08X", size, addr); } const Interface::FunctionInfo FunctionTable[] = { diff --git a/src/core/hle/service/fs_user.cpp b/src/core/hle/service/fs_user.cpp index 51e8b579e..9bda4fe8a 100644 --- a/src/core/hle/service/fs_user.cpp +++ b/src/core/hle/service/fs_user.cpp @@ -23,7 +23,7 @@ static void Initialize(Service::Interface* self) { // http://3dbrew.org/wiki/FS:Initialize#Request cmd_buff[1] = RESULT_SUCCESS.raw; - DEBUG_LOG(KERNEL, "called"); + LOG_DEBUG(Service_FS, "called"); } /** @@ -55,17 +55,15 @@ static void OpenFile(Service::Interface* self) { u32 filename_ptr = cmd_buff[9]; FileSys::Path file_path(filename_type, filename_size, filename_ptr); - DEBUG_LOG(KERNEL, "path=%s, mode=%d attrs=%u", file_path.DebugStr().c_str(), mode.hex, attributes); + LOG_DEBUG(Service_FS, "path=%s, mode=%d attrs=%u", file_path.DebugStr().c_str(), mode.hex, attributes); ResultVal handle = Kernel::OpenFileFromArchive(archive_handle, file_path, mode); cmd_buff[1] = handle.Code().raw; if (handle.Succeeded()) { cmd_buff[3] = *handle; } else { - ERROR_LOG(KERNEL, "failed to get a handle for file %s", file_path.DebugStr().c_str()); + LOG_ERROR(Service_FS, "failed to get a handle for file %s", file_path.DebugStr().c_str()); } - - DEBUG_LOG(KERNEL, "called"); } /** @@ -102,11 +100,11 @@ static void OpenFileDirectly(Service::Interface* self) { FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr); FileSys::Path file_path(filename_type, filename_size, filename_ptr); - DEBUG_LOG(KERNEL, "archive_path=%s file_path=%s, mode=%u attributes=%d", + LOG_DEBUG(Service_FS, "archive_path=%s file_path=%s, mode=%u attributes=%d", archive_path.DebugStr().c_str(), file_path.DebugStr().c_str(), mode.hex, attributes); if (archive_path.GetType() != FileSys::Empty) { - ERROR_LOG(KERNEL, "archive LowPath type other than empty is currently unsupported"); + LOG_ERROR(Service_FS, "archive LowPath type other than empty is currently unsupported"); cmd_buff[1] = UnimplementedFunction(ErrorModule::FS).raw; return; } @@ -116,7 +114,7 @@ static void OpenFileDirectly(Service::Interface* self) { ResultVal archive_handle = Kernel::OpenArchive(archive_id); cmd_buff[1] = archive_handle.Code().raw; if (archive_handle.Failed()) { - ERROR_LOG(KERNEL, "failed to get a handle for archive"); + LOG_ERROR(Service_FS, "failed to get a handle for archive"); return; } // cmd_buff[2] isn't used according to 3dmoo's implementation. @@ -127,10 +125,8 @@ static void OpenFileDirectly(Service::Interface* self) { if (handle.Succeeded()) { cmd_buff[3] = *handle; } else { - ERROR_LOG(KERNEL, "failed to get a handle for file %s", file_path.DebugStr().c_str()); + LOG_ERROR(Service_FS, "failed to get a handle for file %s", file_path.DebugStr().c_str()); } - - DEBUG_LOG(KERNEL, "called"); } /* @@ -156,12 +152,10 @@ void DeleteFile(Service::Interface* self) { FileSys::Path file_path(filename_type, filename_size, filename_ptr); - DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", + LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", filename_type, filename_size, file_path.DebugStr().c_str()); cmd_buff[1] = Kernel::DeleteFileFromArchive(archive_handle, file_path).raw; - - DEBUG_LOG(KERNEL, "called"); } /* @@ -197,13 +191,11 @@ void RenameFile(Service::Interface* self) { FileSys::Path src_file_path(src_filename_type, src_filename_size, src_filename_ptr); FileSys::Path dest_file_path(dest_filename_type, dest_filename_size, dest_filename_ptr); - DEBUG_LOG(KERNEL, "src_type=%d src_size=%d src_data=%s dest_type=%d dest_size=%d dest_data=%s", + LOG_DEBUG(Service_FS, "src_type=%d src_size=%d src_data=%s dest_type=%d dest_size=%d dest_data=%s", src_filename_type, src_filename_size, src_file_path.DebugStr().c_str(), dest_filename_type, dest_filename_size, dest_file_path.DebugStr().c_str()); cmd_buff[1] = Kernel::RenameFileBetweenArchives(src_archive_handle, src_file_path, dest_archive_handle, dest_file_path).raw; - - DEBUG_LOG(KERNEL, "called"); } /* @@ -229,12 +221,10 @@ void DeleteDirectory(Service::Interface* self) { FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr); - DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", + LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str()); cmd_buff[1] = Kernel::DeleteDirectoryFromArchive(archive_handle, dir_path).raw; - - DEBUG_LOG(KERNEL, "called"); } /* @@ -260,11 +250,9 @@ static void CreateDirectory(Service::Interface* self) { FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr); - DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str()); + LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str()); cmd_buff[1] = Kernel::CreateDirectoryFromArchive(archive_handle, dir_path).raw; - - DEBUG_LOG(KERNEL, "called"); } /* @@ -300,13 +288,11 @@ void RenameDirectory(Service::Interface* self) { FileSys::Path src_dir_path(src_dirname_type, src_dirname_size, src_dirname_ptr); FileSys::Path dest_dir_path(dest_dirname_type, dest_dirname_size, dest_dirname_ptr); - DEBUG_LOG(KERNEL, "src_type=%d src_size=%d src_data=%s dest_type=%d dest_size=%d dest_data=%s", + LOG_DEBUG(Service_FS, "src_type=%d src_size=%d src_data=%s dest_type=%d dest_size=%d dest_data=%s", src_dirname_type, src_dirname_size, src_dir_path.DebugStr().c_str(), dest_dirname_type, dest_dirname_size, dest_dir_path.DebugStr().c_str()); cmd_buff[1] = Kernel::RenameDirectoryBetweenArchives(src_archive_handle, src_dir_path, dest_archive_handle, dest_dir_path).raw; - - DEBUG_LOG(KERNEL, "called"); } static void OpenDirectory(Service::Interface* self) { @@ -321,17 +307,15 @@ static void OpenDirectory(Service::Interface* self) { FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr); - DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str()); + LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str()); ResultVal handle = Kernel::OpenDirectoryFromArchive(archive_handle, dir_path); cmd_buff[1] = handle.Code().raw; if (handle.Succeeded()) { cmd_buff[3] = *handle; } else { - ERROR_LOG(KERNEL, "failed to get a handle for directory"); + LOG_ERROR(Service_FS, "failed to get a handle for directory"); } - - DEBUG_LOG(KERNEL, "called"); } /** @@ -356,10 +340,10 @@ static void OpenArchive(Service::Interface* self) { u32 archivename_ptr = cmd_buff[5]; FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr); - DEBUG_LOG(KERNEL, "archive_path=%s", archive_path.DebugStr().c_str()); + LOG_DEBUG(Service_FS, "archive_path=%s", archive_path.DebugStr().c_str()); if (archive_path.GetType() != FileSys::Empty) { - ERROR_LOG(KERNEL, "archive LowPath type other than empty is currently unsupported"); + LOG_ERROR(Service_FS, "archive LowPath type other than empty is currently unsupported"); cmd_buff[1] = UnimplementedFunction(ErrorModule::FS).raw; return; } @@ -370,10 +354,8 @@ static void OpenArchive(Service::Interface* self) { // cmd_buff[2] isn't used according to 3dmoo's implementation. cmd_buff[3] = *handle; } else { - ERROR_LOG(KERNEL, "failed to get a handle for archive"); + LOG_ERROR(Service_FS, "failed to get a handle for archive"); } - - DEBUG_LOG(KERNEL, "called"); } /* @@ -388,7 +370,7 @@ static void IsSdmcDetected(Service::Interface* self) { cmd_buff[1] = 0; cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0; - DEBUG_LOG(KERNEL, "called"); + LOG_DEBUG(Service_FS, "called"); } const Interface::FunctionInfo FunctionTable[] = { diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index 34eabac45..223800560 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp @@ -33,7 +33,7 @@ static inline u8* GetCommandBuffer(u32 thread_id) { } static inline FrameBufferUpdate* GetFrameBufferInfo(u32 thread_id, u32 screen_index) { - _dbg_assert_msg_(GSP, screen_index < 2, "Invalid screen index"); + _dbg_assert_msg_(Service_GSP, screen_index < 2, "Invalid screen index"); // For each thread there are two FrameBufferUpdate fields u32 offset = 0x200 + (2 * thread_id + screen_index) * sizeof(FrameBufferUpdate); @@ -50,14 +50,14 @@ static inline InterruptRelayQueue* GetInterruptRelayQueue(u32 thread_id) { static void WriteHWRegs(u32 base_address, u32 size_in_bytes, const u32* data) { // TODO: Return proper error codes if (base_address + size_in_bytes >= 0x420000) { - ERROR_LOG(GPU, "Write address out of range! (address=0x%08x, size=0x%08x)", + LOG_ERROR(Service_GSP, "Write address out of range! (address=0x%08x, size=0x%08x)", base_address, size_in_bytes); return; } // size should be word-aligned if ((size_in_bytes % 4) != 0) { - ERROR_LOG(GPU, "Invalid size 0x%08x", size_in_bytes); + LOG_ERROR(Service_GSP, "Invalid size 0x%08x", size_in_bytes); return; } @@ -89,13 +89,13 @@ static void ReadHWRegs(Service::Interface* self) { // TODO: Return proper error codes if (reg_addr + size >= 0x420000) { - ERROR_LOG(GPU, "Read address out of range! (address=0x%08x, size=0x%08x)", reg_addr, size); + LOG_ERROR(Service_GSP, "Read address out of range! (address=0x%08x, size=0x%08x)", reg_addr, size); return; } // size should be word-aligned if ((size % 4) != 0) { - ERROR_LOG(GPU, "Invalid size 0x%08x", size); + LOG_ERROR(Service_GSP, "Invalid size 0x%08x", size); return; } @@ -177,11 +177,11 @@ static void RegisterInterruptRelayQueue(Service::Interface* self) { */ void SignalInterrupt(InterruptId interrupt_id) { if (0 == g_interrupt_event) { - WARN_LOG(GSP, "cannot synchronize until GSP event has been created!"); + LOG_WARNING(Service_GSP, "cannot synchronize until GSP event has been created!"); return; } if (0 == g_shared_memory) { - WARN_LOG(GSP, "cannot synchronize until GSP shared memory has been created!"); + LOG_WARNING(Service_GSP, "cannot synchronize until GSP shared memory has been created!"); return; } for (int thread_id = 0; thread_id < 0x4; ++thread_id) { @@ -298,14 +298,14 @@ static void ExecuteCommand(const Command& command, u32 thread_id) { } default: - ERROR_LOG(GSP, "unknown command 0x%08X", (int)command.id.Value()); + LOG_ERROR(Service_GSP, "unknown command 0x%08X", (int)command.id.Value()); } } /// This triggers handling of the GX command written to the command buffer in shared memory. static void TriggerCmdReqQueue(Service::Interface* self) { - DEBUG_LOG(GSP, "called"); + LOG_TRACE(Service_GSP, "called"); // Iterate through each thread's command queue... for (unsigned thread_id = 0; thread_id < 0x4; ++thread_id) { diff --git a/src/core/hle/service/hid_user.cpp b/src/core/hle/service/hid_user.cpp index 2abaf0f2f..5772199d4 100644 --- a/src/core/hle/service/hid_user.cpp +++ b/src/core/hle/service/hid_user.cpp @@ -163,7 +163,7 @@ static void GetIPCHandles(Service::Interface* self) { cmd_buff[7] = event_gyroscope; cmd_buff[8] = event_debug_pad; - DEBUG_LOG(KERNEL, "called"); + LOG_TRACE(Service_HID, "called"); } const Interface::FunctionInfo FunctionTable[] = { diff --git a/src/core/hle/service/ptm_u.cpp b/src/core/hle/service/ptm_u.cpp index 941df467b..559f148dd 100644 --- a/src/core/hle/service/ptm_u.cpp +++ b/src/core/hle/service/ptm_u.cpp @@ -42,7 +42,7 @@ static void GetAdapterState(Service::Interface* self) { cmd_buff[1] = 0; // No error cmd_buff[2] = battery_is_charging ? 1 : 0; - WARN_LOG(KERNEL, "(STUBBED) called"); + LOG_WARNING(Service_PTM, "(STUBBED) called"); } /* @@ -57,7 +57,7 @@ static void GetShellState(Service::Interface* self) { cmd_buff[1] = 0; cmd_buff[2] = shell_open ? 1 : 0; - DEBUG_LOG(KERNEL, "PTM_U::GetShellState called"); + LOG_TRACE(Service_PTM, "PTM_U::GetShellState called"); } /** @@ -76,7 +76,7 @@ static void GetBatteryLevel(Service::Interface* self) { cmd_buff[1] = 0; // No error cmd_buff[2] = static_cast(ChargeLevels::CompletelyFull); // Set to a completely full battery - WARN_LOG(KERNEL, "(STUBBED) called"); + LOG_WARNING(Service_PTM, "(STUBBED) called"); } /** @@ -94,7 +94,7 @@ static void GetBatteryChargeState(Service::Interface* self) { cmd_buff[1] = 0; // No error cmd_buff[2] = battery_is_charging ? 1 : 0; - WARN_LOG(KERNEL, "(STUBBED) called"); + LOG_WARNING(Service_PTM, "(STUBBED) called"); } const Interface::FunctionInfo FunctionTable[] = { diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index fed2268a0..e6973572b 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -106,13 +106,13 @@ void Init() { g_manager->AddService(new SOC_U::Interface); g_manager->AddService(new SSL_C::Interface); - NOTICE_LOG(HLE, "initialized OK"); + LOG_DEBUG(Service, "initialized OK"); } /// Shutdown ServiceManager void Shutdown() { delete g_manager; - NOTICE_LOG(HLE, "shutdown OK"); + LOG_DEBUG(Service, "shutdown OK"); } diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 3a7d6c469..baae910a1 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -91,7 +91,7 @@ public: std::string name = (itr == m_functions.end()) ? Common::StringFromFormat("0x%08X", cmd_buff[0]) : itr->second.name; - ERROR_LOG(OSHLE, error.c_str(), name.c_str(), GetPortName().c_str()); + LOG_ERROR(Service, error.c_str(), name.c_str(), GetPortName().c_str()); // TODO(bunnei): Hack - ignore error cmd_buff[1] = 0; @@ -103,12 +103,6 @@ public: return MakeResult(false); // TODO: Implement return from actual function } - ResultVal WaitSynchronization() override { - // TODO(bunnei): ImplementMe - ERROR_LOG(OSHLE, "unimplemented function"); - return UnimplementedFunction(ErrorModule::OS); - } - protected: /** diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index 0e7fa9e3b..24a846533 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp @@ -14,7 +14,7 @@ namespace SRV { static Handle g_event_handle = 0; static void Initialize(Service::Interface* self) { - DEBUG_LOG(OSHLE, "called"); + LOG_DEBUG(Service_SRV, "called"); u32* cmd_buff = Service::GetCommandBuffer(); @@ -22,7 +22,7 @@ static void Initialize(Service::Interface* self) { } static void GetProcSemaphore(Service::Interface* self) { - DEBUG_LOG(OSHLE, "called"); + LOG_TRACE(Service_SRV, "called"); u32* cmd_buff = Service::GetCommandBuffer(); @@ -43,9 +43,9 @@ static void GetServiceHandle(Service::Interface* self) { if (nullptr != service) { cmd_buff[3] = service->GetHandle(); - DEBUG_LOG(OSHLE, "called port=%s, handle=0x%08X", port_name.c_str(), cmd_buff[3]); + LOG_TRACE(Service_SRV, "called port=%s, handle=0x%08X", port_name.c_str(), cmd_buff[3]); } else { - ERROR_LOG(OSHLE, "(UNIMPLEMENTED) called port=%s", port_name.c_str()); + LOG_ERROR(Service_SRV, "(UNIMPLEMENTED) called port=%s", port_name.c_str()); res = UnimplementedFunction(ErrorModule::SRV); } cmd_buff[1] = res.raw; diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index b99c301d4..db0c42e74 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -31,7 +31,7 @@ enum ControlMemoryOperation { /// Map application or GSP heap memory static Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) { - DEBUG_LOG(SVC,"called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X", + LOG_TRACE(Kernel_SVC,"called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X", operation, addr0, addr1, size, permissions); switch (operation) { @@ -48,14 +48,14 @@ static Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, // Unknown ControlMemory operation default: - ERROR_LOG(SVC, "unknown operation=0x%08X", operation); + LOG_ERROR(Kernel_SVC, "unknown operation=0x%08X", operation); } return 0; } /// Maps a memory block to specified address static Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) { - DEBUG_LOG(SVC, "called memblock=0x%08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d", + LOG_TRACE(Kernel_SVC, "called memblock=0x%08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d", handle, addr, permissions, other_permissions); Kernel::MemoryPermission permissions_type = static_cast(permissions); @@ -68,7 +68,7 @@ static Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other static_cast(other_permissions)); break; default: - ERROR_LOG(OSHLE, "unknown permissions=0x%08X", permissions); + LOG_ERROR(Kernel_SVC, "unknown permissions=0x%08X", permissions); } return 0; } @@ -77,7 +77,7 @@ static Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other static Result ConnectToPort(Handle* out, const char* port_name) { Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); - DEBUG_LOG(SVC, "called port_name=%s", port_name); + LOG_TRACE(Kernel_SVC, "called port_name=%s", port_name); _assert_msg_(KERNEL, (service != nullptr), "called, but service is not implemented!"); *out = service->GetHandle(); @@ -95,7 +95,7 @@ static Result SendSyncRequest(Handle handle) { Kernel::Object* object = Kernel::g_object_pool.GetFast(handle); _assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!"); - DEBUG_LOG(SVC, "called handle=0x%08X(%s)", handle, object->GetTypeName().c_str()); + LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s)", handle, object->GetTypeName().c_str()); ResultVal wait = object->SyncRequest(); if (wait.Succeeded() && *wait) { @@ -108,7 +108,7 @@ static Result SendSyncRequest(Handle handle) { /// Close a handle static Result CloseHandle(Handle handle) { // ImplementMe - ERROR_LOG(SVC, "(UNIMPLEMENTED) called handle=0x%08X", handle); + LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called handle=0x%08X", handle); return 0; } @@ -121,9 +121,9 @@ static Result WaitSynchronization1(Handle handle, s64 nano_seconds) { return InvalidHandle(ErrorModule::Kernel).raw; } Kernel::Object* object = Kernel::g_object_pool.GetFast(handle); - _dbg_assert_(KERNEL, object != nullptr); + _dbg_assert_(Kernel, object != nullptr); - DEBUG_LOG(SVC, "called handle=0x%08X(%s:%s), nanoseconds=%lld", handle, object->GetTypeName().c_str(), + LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s:%s), nanoseconds=%lld", handle, object->GetTypeName().c_str(), object->GetName().c_str(), nano_seconds); ResultVal wait = object->WaitSynchronization(); @@ -143,7 +143,7 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, bool unlock_all = true; bool wait_infinite = (nano_seconds == -1); // Used to wait until a thread has terminated - DEBUG_LOG(SVC, "called handle_count=%d, wait_all=%s, nanoseconds=%lld", + LOG_TRACE(Kernel_SVC, "called handle_count=%d, wait_all=%s, nanoseconds=%lld", handle_count, (wait_all ? "true" : "false"), nano_seconds); // Iterate through each handle, synchronize kernel object @@ -153,7 +153,7 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, } Kernel::Object* object = Kernel::g_object_pool.GetFast(handles[i]); - DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName().c_str(), + LOG_TRACE(Kernel_SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName().c_str(), object->GetName().c_str()); // TODO(yuriks): Verify how the real function behaves when an error happens here @@ -181,7 +181,7 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, /// Create an address arbiter (to allocate access to shared resources) static Result CreateAddressArbiter(u32* arbiter) { - DEBUG_LOG(SVC, "called"); + LOG_TRACE(Kernel_SVC, "called"); Handle handle = Kernel::CreateAddressArbiter(); *arbiter = handle; return 0; @@ -189,7 +189,7 @@ static Result CreateAddressArbiter(u32* arbiter) { /// Arbitrate address static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, s64 nanoseconds) { - DEBUG_LOG(SVC, "called handle=0x%08X, address=0x%08X, type=0x%08X, value=0x%08X", arbiter, + LOG_TRACE(Kernel_SVC, "called handle=0x%08X, address=0x%08X, type=0x%08X, value=0x%08X", arbiter, address, type, value); return Kernel::ArbitrateAddress(arbiter, static_cast(type), address, value).raw; @@ -197,7 +197,7 @@ static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, /// Used to output a message on a debug hardware unit - does nothing on a retail unit static void OutputDebugString(const char* string) { - OS_LOG(SVC, "%s", string); + LOG_DEBUG(Debug_Emulated, "%s", string); } /// Get resource limit @@ -206,14 +206,14 @@ static Result GetResourceLimit(Handle* resource_limit, Handle process) { // 0xFFFF8001 is a handle alias for the current KProcess, and 0xFFFF8000 is a handle alias for // the current KThread. *resource_limit = 0xDEADBEEF; - ERROR_LOG(SVC, "(UNIMPLEMENTED) called process=0x%08X", process); + LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called process=0x%08X", process); return 0; } /// Get resource limit current values static Result GetResourceLimitCurrentValues(s64* values, Handle resource_limit, void* names, s32 name_count) { - ERROR_LOG(SVC, "(UNIMPLEMENTED) called resource_limit=%08X, names=%s, name_count=%d", + LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called resource_limit=%08X, names=%s, name_count=%d", resource_limit, names, name_count); Memory::Write32(Core::g_app_core->GetReg(0), 0); // Normmatt: Set used memory to 0 for now return 0; @@ -234,7 +234,7 @@ static Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top Core::g_app_core->SetReg(1, thread); - DEBUG_LOG(SVC, "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, " + LOG_TRACE(Kernel_SVC, "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, " "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", entry_point, name.c_str(), arg, stack_top, priority, processor_id, thread); @@ -245,7 +245,7 @@ static Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top static u32 ExitThread() { Handle thread = Kernel::GetCurrentThreadHandle(); - DEBUG_LOG(SVC, "called, pc=0x%08X", Core::g_app_core->GetPC()); // PC = 0x0010545C + LOG_TRACE(Kernel_SVC, "called, pc=0x%08X", Core::g_app_core->GetPC()); // PC = 0x0010545C Kernel::StopThread(thread, __func__); HLE::Reschedule(__func__); @@ -269,42 +269,42 @@ static Result SetThreadPriority(Handle handle, s32 priority) { /// Create a mutex static Result CreateMutex(Handle* mutex, u32 initial_locked) { *mutex = Kernel::CreateMutex((initial_locked != 0)); - DEBUG_LOG(SVC, "called initial_locked=%s : created handle=0x%08X", + LOG_TRACE(Kernel_SVC, "called initial_locked=%s : created handle=0x%08X", initial_locked ? "true" : "false", *mutex); return 0; } /// Release a mutex static Result ReleaseMutex(Handle handle) { - DEBUG_LOG(SVC, "called handle=0x%08X", handle); + LOG_TRACE(Kernel_SVC, "called handle=0x%08X", handle); ResultCode res = Kernel::ReleaseMutex(handle); return res.raw; } /// Get the ID for the specified thread. static Result GetThreadId(u32* thread_id, Handle handle) { - DEBUG_LOG(SVC, "called thread=0x%08X", handle); + LOG_TRACE(Kernel_SVC, "called thread=0x%08X", handle); ResultCode result = Kernel::GetThreadId(thread_id, handle); return result.raw; } /// Query memory static Result QueryMemory(void* info, void* out, u32 addr) { - ERROR_LOG(SVC, "(UNIMPLEMENTED) called addr=0x%08X", addr); + LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called addr=0x%08X", addr); return 0; } /// Create an event static Result CreateEvent(Handle* evt, u32 reset_type) { *evt = Kernel::CreateEvent((ResetType)reset_type); - DEBUG_LOG(SVC, "called reset_type=0x%08X : created handle=0x%08X", + LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", reset_type, *evt); return 0; } /// Duplicates a kernel handle static Result DuplicateHandle(Handle* out, Handle handle) { - DEBUG_LOG(SVC, "called handle=0x%08X", handle); + LOG_WARNING(Kernel_SVC, "(STUBBED) called handle=0x%08X", handle); // Translate kernel handles -> real handles if (handle == Kernel::CurrentThread) { @@ -321,19 +321,19 @@ static Result DuplicateHandle(Handle* out, Handle handle) { /// Signals an event static Result SignalEvent(Handle evt) { - DEBUG_LOG(SVC, "called event=0x%08X", evt); + LOG_TRACE(Kernel_SVC, "called event=0x%08X", evt); return Kernel::SignalEvent(evt).raw; } /// Clears an event static Result ClearEvent(Handle evt) { - DEBUG_LOG(SVC, "called event=0x%08X", evt); + LOG_TRACE(Kernel_SVC, "called event=0x%08X", evt); return Kernel::ClearEvent(evt).raw; } /// Sleep the current thread static void SleepThread(s64 nanoseconds) { - DEBUG_LOG(SVC, "called nanoseconds=%lld", nanoseconds); + LOG_TRACE(Kernel_SVC, "called nanoseconds=%lld", nanoseconds); // Check for next thread to schedule HLE::Reschedule(__func__); diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp index 77557e582..da78b85e5 100644 --- a/src/core/hw/gpu.cpp +++ b/src/core/hw/gpu.cpp @@ -35,7 +35,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 if (index >= Regs::NumIds() || !std::is_same::value) { - ERROR_LOG(GPU, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, addr); + LOG_ERROR(HW_GPU, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, addr); return; } @@ -49,7 +49,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 if (index >= Regs::NumIds() || !std::is_same::value) { - ERROR_LOG(GPU, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, addr); + LOG_ERROR(HW_GPU, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, addr); return; } @@ -73,7 +73,7 @@ inline void Write(u32 addr, const T data) { for (u32* ptr = start; ptr < end; ++ptr) *ptr = bswap32(config.value); // TODO: This is just a workaround to missing framebuffer format emulation - DEBUG_LOG(GPU, "MemoryFill from 0x%08x to 0x%08x", config.GetStartAddress(), config.GetEndAddress()); + LOG_TRACE(HW_GPU, "MemoryFill from 0x%08x to 0x%08x", config.GetStartAddress(), config.GetEndAddress()); } break; } @@ -105,7 +105,7 @@ inline void Write(u32 addr, const T data) { } default: - ERROR_LOG(GPU, "Unknown source framebuffer format %x", config.input_format.Value()); + LOG_ERROR(HW_GPU, "Unknown source framebuffer format %x", config.input_format.Value()); break; } @@ -132,13 +132,13 @@ inline void Write(u32 addr, const T data) { } default: - ERROR_LOG(GPU, "Unknown destination framebuffer format %x", config.output_format.Value()); + LOG_ERROR(HW_GPU, "Unknown destination framebuffer format %x", config.output_format.Value()); break; } } } - DEBUG_LOG(GPU, "DisplayTriggerTransfer: 0x%08x bytes from 0x%08x(%ux%u)-> 0x%08x(%ux%u), dst format %x", + LOG_TRACE(HW_GPU, "DisplayTriggerTransfer: 0x%08x bytes from 0x%08x(%ux%u)-> 0x%08x(%ux%u), dst format %x", config.output_height * config.output_width * 4, config.GetPhysicalInputAddress(), (u32)config.input_width, (u32)config.input_height, config.GetPhysicalOutputAddress(), (u32)config.output_width, (u32)config.output_height, @@ -251,12 +251,12 @@ void Init() { framebuffer_sub.color_format = Regs::PixelFormat::RGB8; framebuffer_sub.active_fb = 0; - NOTICE_LOG(GPU, "initialized OK"); + LOG_DEBUG(HW_GPU, "initialized OK"); } /// Shutdown hardware void Shutdown() { - NOTICE_LOG(GPU, "shutdown OK"); + LOG_DEBUG(HW_GPU, "shutdown OK"); } } // namespace diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp index 73a4f1e53..af42b41fb 100644 --- a/src/core/hw/hw.cpp +++ b/src/core/hw/hw.cpp @@ -44,7 +44,7 @@ inline void Read(T &var, const u32 addr) { break; default: - ERROR_LOG(HW, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, addr); + LOG_ERROR(HW_Memory, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, addr); } } @@ -57,7 +57,7 @@ inline void Write(u32 addr, const T data) { break; default: - ERROR_LOG(HW, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, addr); + LOG_ERROR(HW_Memory, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, addr); } } @@ -81,12 +81,12 @@ void Update() { /// Initialize hardware void Init() { GPU::Init(); - NOTICE_LOG(HW, "initialized OK"); + LOG_DEBUG(HW, "initialized OK"); } /// Shutdown hardware void Shutdown() { - NOTICE_LOG(HW, "shutdown OK"); + LOG_DEBUG(HW, "shutdown OK"); } } \ No newline at end of file diff --git a/src/core/loader/3dsx.cpp b/src/core/loader/3dsx.cpp index 7ef146359..f48d13530 100644 --- a/src/core/loader/3dsx.cpp +++ b/src/core/loader/3dsx.cpp @@ -174,14 +174,14 @@ int THREEDSXReader::Load3DSXFile(const std::string& filename, u32 base_addr) return ERROR_READ; for (u32 current_inprogress = 0; current_inprogress < remaining && pos < end_pos; current_inprogress++) { - DEBUG_LOG(LOADER, "(t=%d,skip=%u,patch=%u)\n", + LOG_TRACE(Loader, "(t=%d,skip=%u,patch=%u)\n", current_segment_reloc_table, (u32)reloc_table[current_inprogress].skip, (u32)reloc_table[current_inprogress].patch); pos += reloc_table[current_inprogress].skip; s32 num_patches = reloc_table[current_inprogress].patch; while (0 < num_patches && pos < end_pos) { u32 in_addr = (char*)pos - (char*)&all_mem[0]; u32 addr = TranslateAddr(*pos, &loadinfo, offsets); - DEBUG_LOG(LOADER, "Patching %08X <-- rel(%08X,%d) (%08X)\n", + LOG_TRACE(Loader, "Patching %08X <-- rel(%08X,%d) (%08X)\n", base_addr + in_addr, addr, current_segment_reloc_table, *pos); switch (current_segment_reloc_table) { case 0: *pos = (addr); break; @@ -199,10 +199,10 @@ int THREEDSXReader::Load3DSXFile(const std::string& filename, u32 base_addr) // Write the data memcpy(Memory::GetPointer(base_addr), &all_mem[0], loadinfo.seg_sizes[0] + loadinfo.seg_sizes[1] + loadinfo.seg_sizes[2]); - DEBUG_LOG(LOADER, "CODE: %u pages\n", loadinfo.seg_sizes[0] / 0x1000); - DEBUG_LOG(LOADER, "RODATA: %u pages\n", loadinfo.seg_sizes[1] / 0x1000); - DEBUG_LOG(LOADER, "DATA: %u pages\n", data_load_size / 0x1000); - DEBUG_LOG(LOADER, "BSS: %u pages\n", bss_load_size / 0x1000); + LOG_DEBUG(Loader, "CODE: %u pages\n", loadinfo.seg_sizes[0] / 0x1000); + LOG_DEBUG(Loader, "RODATA: %u pages\n", loadinfo.seg_sizes[1] / 0x1000); + LOG_DEBUG(Loader, "DATA: %u pages\n", data_load_size / 0x1000); + LOG_DEBUG(Loader, "BSS: %u pages\n", bss_load_size / 0x1000); return ERROR_NONE; } @@ -220,7 +220,7 @@ int THREEDSXReader::Load3DSXFile(const std::string& filename, u32 base_addr) * @return Success on success, otherwise Error */ ResultStatus AppLoader_THREEDSX::Load() { - INFO_LOG(LOADER, "Loading 3DSX file %s...", filename.c_str()); + LOG_INFO(Loader, "Loading 3DSX file %s...", filename.c_str()); FileUtil::IOFile file(filename, "rb"); if (file.IsOpen()) { diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp index 63d2496ed..c95882f4a 100644 --- a/src/core/loader/elf.cpp +++ b/src/core/loader/elf.cpp @@ -254,18 +254,18 @@ const char *ElfReader::GetSectionName(int section) const { } bool ElfReader::LoadInto(u32 vaddr) { - DEBUG_LOG(MASTER_LOG, "String section: %i", header->e_shstrndx); + LOG_DEBUG(Loader, "String section: %i", header->e_shstrndx); // Should we relocate? relocate = (header->e_type != ET_EXEC); if (relocate) { - DEBUG_LOG(MASTER_LOG, "Relocatable module"); + LOG_DEBUG(Loader, "Relocatable module"); entryPoint += vaddr; } else { - DEBUG_LOG(MASTER_LOG, "Prerelocated executable"); + LOG_DEBUG(Loader, "Prerelocated executable"); } - INFO_LOG(MASTER_LOG, "%i segments:", header->e_phnum); + LOG_DEBUG(Loader, "%i segments:", header->e_phnum); // First pass : Get the bits into RAM u32 segment_addr[32]; @@ -273,17 +273,17 @@ bool ElfReader::LoadInto(u32 vaddr) { for (int i = 0; i < header->e_phnum; i++) { Elf32_Phdr *p = segments + i; - INFO_LOG(MASTER_LOG, "Type: %i Vaddr: %08x Filesz: %i Memsz: %i ", p->p_type, p->p_vaddr, + LOG_DEBUG(Loader, "Type: %i Vaddr: %08x Filesz: %i Memsz: %i ", p->p_type, p->p_vaddr, p->p_filesz, p->p_memsz); if (p->p_type == PT_LOAD) { segment_addr[i] = base_addr + p->p_vaddr; memcpy(Memory::GetPointer(segment_addr[i]), GetSegmentPtr(i), p->p_filesz); - INFO_LOG(MASTER_LOG, "Loadable Segment Copied to %08x, size %08x", segment_addr[i], + LOG_DEBUG(Loader, "Loadable Segment Copied to %08x, size %08x", segment_addr[i], p->p_memsz); } } - INFO_LOG(MASTER_LOG, "Done loading."); + LOG_DEBUG(Loader, "Done loading."); return true; } @@ -346,7 +346,7 @@ AppLoader_ELF::~AppLoader_ELF() { * @return True on success, otherwise false */ ResultStatus AppLoader_ELF::Load() { - INFO_LOG(LOADER, "Loading ELF file %s...", filename.c_str()); + LOG_INFO(Loader, "Loading ELF file %s...", filename.c_str()); if (is_loaded) return ResultStatus::ErrorAlreadyLoaded; diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index 174397b05..3883e1307 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp @@ -23,7 +23,7 @@ namespace Loader { */ FileType IdentifyFile(const std::string &filename) { if (filename.size() == 0) { - ERROR_LOG(LOADER, "invalid filename %s", filename.c_str()); + LOG_ERROR(Loader, "invalid filename %s", filename.c_str()); return FileType::Error; } @@ -55,7 +55,7 @@ FileType IdentifyFile(const std::string &filename) { * @return ResultStatus result of function */ ResultStatus LoadFile(const std::string& filename) { - INFO_LOG(LOADER, "Loading file %s...", filename.c_str()); + LOG_INFO(Loader, "Loading file %s...", filename.c_str()); switch (IdentifyFile(filename)) { @@ -83,7 +83,7 @@ ResultStatus LoadFile(const std::string& filename) { // Raw BIN file format... case FileType::BIN: { - INFO_LOG(LOADER, "Loading BIN file %s...", filename.c_str()); + LOG_INFO(Loader, "Loading BIN file %s...", filename.c_str()); FileUtil::IOFile file(filename, "rb"); diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index 343bb7523..ba9ba00c0 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp @@ -140,13 +140,13 @@ ResultStatus AppLoader_NCCH::LoadSectionExeFS(const char* name, std::vector& // Iterate through the ExeFs archive until we find the .code file... FileUtil::IOFile file(filename, "rb"); if (file.IsOpen()) { + LOG_DEBUG(Loader, "%d sections:", kMaxSections); for (int i = 0; i < kMaxSections; i++) { // Load the specified section... if (strcmp((const char*)exefs_header.section[i].name, name) == 0) { - INFO_LOG(LOADER, "ExeFS section %d:", i); - INFO_LOG(LOADER, " name: %s", exefs_header.section[i].name); - INFO_LOG(LOADER, " offset: 0x%08X", exefs_header.section[i].offset); - INFO_LOG(LOADER, " size: 0x%08X", exefs_header.section[i].size); + LOG_DEBUG(Loader, "%d - offset: 0x%08X, size: 0x%08X, name: %s", i, + exefs_header.section[i].offset, exefs_header.section[i].size, + exefs_header.section[i].name); s64 section_offset = (exefs_header.section[i].offset + exefs_offset + sizeof(ExeFs_Header)+ncch_offset); @@ -181,7 +181,7 @@ ResultStatus AppLoader_NCCH::LoadSectionExeFS(const char* name, std::vector& } } } else { - ERROR_LOG(LOADER, "Unable to read file %s!", filename.c_str()); + LOG_ERROR(Loader, "Unable to read file %s!", filename.c_str()); return ResultStatus::Error; } return ResultStatus::ErrorNotUsed; @@ -194,7 +194,7 @@ ResultStatus AppLoader_NCCH::LoadSectionExeFS(const char* name, std::vector& * @return True on success, otherwise false */ ResultStatus AppLoader_NCCH::Load() { - INFO_LOG(LOADER, "Loading NCCH file %s...", filename.c_str()); + LOG_INFO(Loader, "Loading NCCH file %s...", filename.c_str()); if (is_loaded) return ResultStatus::ErrorAlreadyLoaded; @@ -205,7 +205,7 @@ ResultStatus AppLoader_NCCH::Load() { // Skip NCSD header and load first NCCH (NCSD is just a container of NCCH files)... if (0 == memcmp(&ncch_header.magic, "NCSD", 4)) { - WARN_LOG(LOADER, "Only loading the first (bootable) NCCH within the NCSD file!"); + LOG_WARNING(Loader, "Only loading the first (bootable) NCCH within the NCSD file!"); ncch_offset = 0x4000; file.Seek(ncch_offset, 0); file.ReadBytes(&ncch_header, sizeof(NCCH_Header)); @@ -222,17 +222,17 @@ ResultStatus AppLoader_NCCH::Load() { is_compressed = (exheader_header.codeset_info.flags.flag & 1) == 1; entry_point = exheader_header.codeset_info.text.address; - INFO_LOG(LOADER, "Name: %s", exheader_header.codeset_info.name); - INFO_LOG(LOADER, "Code compressed: %s", is_compressed ? "yes" : "no"); - INFO_LOG(LOADER, "Entry point: 0x%08X", entry_point); + LOG_INFO(Loader, "Name: %s", exheader_header.codeset_info.name); + LOG_DEBUG(Loader, "Code compressed: %s", is_compressed ? "yes" : "no"); + LOG_DEBUG(Loader, "Entry point: 0x%08X", entry_point); // Read ExeFS... exefs_offset = ncch_header.exefs_offset * kBlockSize; u32 exefs_size = ncch_header.exefs_size * kBlockSize; - INFO_LOG(LOADER, "ExeFS offset: 0x%08X", exefs_offset); - INFO_LOG(LOADER, "ExeFS size: 0x%08X", exefs_size); + LOG_DEBUG(Loader, "ExeFS offset: 0x%08X", exefs_offset); + LOG_DEBUG(Loader, "ExeFS size: 0x%08X", exefs_size); file.Seek(exefs_offset + ncch_offset, 0); file.ReadBytes(&exefs_header, sizeof(ExeFs_Header)); @@ -243,7 +243,7 @@ ResultStatus AppLoader_NCCH::Load() { return ResultStatus::Success; } else { - ERROR_LOG(LOADER, "Unable to read file %s!", filename.c_str()); + LOG_ERROR(Loader, "Unable to read file %s!", filename.c_str()); } return ResultStatus::Error; } @@ -297,8 +297,8 @@ ResultStatus AppLoader_NCCH::ReadRomFS(std::vector& buffer) const { u32 romfs_offset = ncch_offset + (ncch_header.romfs_offset * kBlockSize) + 0x1000; u32 romfs_size = (ncch_header.romfs_size * kBlockSize) - 0x1000; - INFO_LOG(LOADER, "RomFS offset: 0x%08X", romfs_offset); - INFO_LOG(LOADER, "RomFS size: 0x%08X", romfs_size); + LOG_DEBUG(Loader, "RomFS offset: 0x%08X", romfs_offset); + LOG_DEBUG(Loader, "RomFS size: 0x%08X", romfs_size); buffer.resize(romfs_size); @@ -307,10 +307,10 @@ ResultStatus AppLoader_NCCH::ReadRomFS(std::vector& buffer) const { return ResultStatus::Success; } - NOTICE_LOG(LOADER, "RomFS unused"); + LOG_DEBUG(Loader, "NCCH has no RomFS"); return ResultStatus::ErrorNotUsed; } else { - ERROR_LOG(LOADER, "Unable to read file %s!", filename.c_str()); + LOG_ERROR(Loader, "Unable to read file %s!", filename.c_str()); } return ResultStatus::Error; } diff --git a/src/core/mem_map.cpp b/src/core/mem_map.cpp index e1c2580ff..d1c44ed24 100644 --- a/src/core/mem_map.cpp +++ b/src/core/mem_map.cpp @@ -71,7 +71,7 @@ void Init() { g_base = MemoryMap_Setup(g_views, kNumMemViews, flags, &arena); - NOTICE_LOG(MEMMAP, "initialized OK, RAM at %p (mirror at 0 @ %p)", g_heap, + LOG_DEBUG(HW_Memory, "initialized OK, RAM at %p (mirror at 0 @ %p)", g_heap, physical_fcram); } @@ -82,7 +82,7 @@ void Shutdown() { arena.ReleaseSpace(); g_base = nullptr; - NOTICE_LOG(MEMMAP, "shutdown OK"); + LOG_DEBUG(HW_Memory, "shutdown OK"); } } // namespace diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp index b78821a3b..7f7e77233 100644 --- a/src/core/mem_map_funcs.cpp +++ b/src/core/mem_map_funcs.cpp @@ -28,7 +28,7 @@ VAddr PhysicalToVirtualAddress(const PAddr addr) { return addr - FCRAM_PADDR + FCRAM_VADDR; } - ERROR_LOG(MEMMAP, "Unknown physical address @ 0x%08x", addr); + LOG_ERROR(HW_Memory, "Unknown physical address @ 0x%08x", addr); return addr; } @@ -44,7 +44,7 @@ PAddr VirtualToPhysicalAddress(const VAddr addr) { return addr - FCRAM_VADDR + FCRAM_PADDR; } - ERROR_LOG(MEMMAP, "Unknown virtual address @ 0x%08x", addr); + LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x%08x", addr); return addr; } @@ -92,7 +92,7 @@ inline void Read(T &var, const VAddr vaddr) { var = *((const T*)&g_vram[vaddr - VRAM_VADDR]); } else { - ERROR_LOG(MEMMAP, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, vaddr); + LOG_ERROR(HW_Memory, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, vaddr); } } @@ -141,7 +141,7 @@ inline void Write(const VAddr vaddr, const T data) { // Error out... } else { - ERROR_LOG(MEMMAP, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, vaddr); + LOG_ERROR(HW_Memory, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, vaddr); } } @@ -175,7 +175,7 @@ u8 *GetPointer(const VAddr vaddr) { return g_vram + (vaddr - VRAM_VADDR); } else { - ERROR_LOG(MEMMAP, "unknown GetPointer @ 0x%08x", vaddr); + LOG_ERROR(HW_Memory, "unknown GetPointer @ 0x%08x", vaddr); return 0; } } @@ -239,7 +239,7 @@ u16 Read16(const VAddr addr) { // Check for 16-bit unaligned memory reads... if (addr & 1) { // TODO(bunnei): Implement 16-bit unaligned memory reads - ERROR_LOG(MEMMAP, "16-bit unaligned memory reads are not implemented!"); + LOG_ERROR(HW_Memory, "16-bit unaligned memory reads are not implemented!"); } return (u16)data; diff --git a/src/video_core/clipper.cpp b/src/video_core/clipper.cpp index fbe4047ce..632fb959a 100644 --- a/src/video_core/clipper.cpp +++ b/src/video_core/clipper.cpp @@ -157,7 +157,7 @@ void ProcessTriangle(OutputVertex &v0, OutputVertex &v1, OutputVertex &v2) { InitScreenCoordinates(vtx2); - DEBUG_LOG(GPU, + LOG_TRACE(Render_Software, "Triangle %lu/%lu (%lu buffer vertices) at position (%.3f, %.3f, %.3f, %.3f), " "(%.3f, %.3f, %.3f, %.3f), (%.3f, %.3f, %.3f, %.3f) and " "screen position (%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f)", diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 431139cc2..b74cd3261 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp @@ -114,7 +114,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) { (vertex_attribute_formats[i] == 2) ? *(s16*)srcdata : *(float*)srcdata; input.attr[i][comp] = float24::FromFloat32(srcval); - DEBUG_LOG(GPU, "Loaded component %x of attribute %x for vertex %x (index %x) from 0x%08x + 0x%08lx + 0x%04lx: %f", + LOG_TRACE(HW_GPU, "Loaded component %x of attribute %x for vertex %x (index %x) from 0x%08x + 0x%08lx + 0x%04lx: %f", comp, i, vertex, index, attribute_config.GetBaseAddress(), vertex_attribute_sources[i] - base_address, @@ -176,7 +176,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) { auto& uniform = VertexShader::GetFloatUniform(uniform_setup.index); if (uniform_setup.index > 95) { - ERROR_LOG(GPU, "Invalid VS uniform index %d", (int)uniform_setup.index); + LOG_ERROR(HW_GPU, "Invalid VS uniform index %d", (int)uniform_setup.index); break; } @@ -192,7 +192,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) { uniform.x = float24::FromRawFloat24(uniform_write_buffer[2] & 0xFFFFFF); } - DEBUG_LOG(GPU, "Set uniform %x to (%f %f %f %f)", (int)uniform_setup.index, + LOG_TRACE(HW_GPU, "Set uniform %x to (%f %f %f %f)", (int)uniform_setup.index, uniform.x.ToFloat32(), uniform.y.ToFloat32(), uniform.z.ToFloat32(), uniform.w.ToFloat32()); diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index 71b03f31c..1a20f19ec 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp @@ -248,8 +248,8 @@ void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data it->component_mask = it->component_mask | component_mask; } } catch (const std::out_of_range& ) { - _dbg_assert_msg_(GPU, 0, "Unknown output attribute mapping"); - ERROR_LOG(GPU, "Unknown output attribute mapping: %03x, %03x, %03x, %03x", + _dbg_assert_msg_(HW_GPU, 0, "Unknown output attribute mapping"); + LOG_ERROR(HW_GPU, "Unknown output attribute mapping: %03x, %03x, %03x, %03x", (int)output_attributes[i].map_x.Value(), (int)output_attributes[i].map_y.Value(), (int)output_attributes[i].map_z.Value(), @@ -309,7 +309,7 @@ static int is_pica_tracing = false; void StartPicaTracing() { if (is_pica_tracing) { - ERROR_LOG(GPU, "StartPicaTracing called even though tracing already running!"); + LOG_WARNING(HW_GPU, "StartPicaTracing called even though tracing already running!"); return; } @@ -342,7 +342,7 @@ void OnPicaRegWrite(u32 id, u32 value) std::unique_ptr FinishPicaTracing() { if (!is_pica_tracing) { - ERROR_LOG(GPU, "FinishPicaTracing called even though tracing already running!"); + LOG_WARNING(HW_GPU, "FinishPicaTracing called even though tracing isn't running!"); return {}; } @@ -357,7 +357,7 @@ std::unique_ptr FinishPicaTracing() } const Math::Vec4 LookupTexture(const u8* source, int x, int y, const TextureInfo& info) { - _dbg_assert_(GPU, info.format == Pica::Regs::TextureFormat::RGB8); + _dbg_assert_(Debug_GPU, info.format == Pica::Regs::TextureFormat::RGB8); // Cf. rasterizer code for an explanation of this algorithm. int texel_index_within_tile = 0; @@ -421,7 +421,7 @@ void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) { // Initialize write structure png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); if (png_ptr == nullptr) { - ERROR_LOG(GPU, "Could not allocate write struct\n"); + LOG_ERROR(Debug_GPU, "Could not allocate write struct\n"); goto finalise; } @@ -429,13 +429,13 @@ void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) { // Initialize info structure info_ptr = png_create_info_struct(png_ptr); if (info_ptr == nullptr) { - ERROR_LOG(GPU, "Could not allocate info struct\n"); + LOG_ERROR(Debug_GPU, "Could not allocate info struct\n"); goto finalise; } // Setup Exception handling if (setjmp(png_jmpbuf(png_ptr))) { - ERROR_LOG(GPU, "Error during png creation\n"); + LOG_ERROR(Debug_GPU, "Error during png creation\n"); goto finalise; } @@ -582,7 +582,7 @@ void DumpTevStageConfig(const std::array& stages) stage_info += "Stage " + std::to_string(index) + ": " + GetColorCombinerStr(tev_stage) + " " + GetAlphaCombinerStr(tev_stage) + "\n"; } - DEBUG_LOG(GPU, "%s", stage_info.c_str()); + LOG_TRACE(HW_GPU, "%s", stage_info.c_str()); } } // namespace diff --git a/src/video_core/gpu_debugger.h b/src/video_core/gpu_debugger.h index 1242eb58f..16b1656bb 100644 --- a/src/video_core/gpu_debugger.h +++ b/src/video_core/gpu_debugger.h @@ -39,7 +39,7 @@ public: virtual void GXCommandProcessed(int total_command_count) { const GSP_GPU::Command& cmd = observed->ReadGXCommandHistory(total_command_count-1); - ERROR_LOG(GSP, "Received command: id=%x", (int)cmd.id.Value()); + LOG_TRACE(Debug_GPU, "Received command: id=%x", (int)cmd.id.Value()); } protected: diff --git a/src/video_core/primitive_assembly.cpp b/src/video_core/primitive_assembly.cpp index dabf2d1a3..102693ed9 100644 --- a/src/video_core/primitive_assembly.cpp +++ b/src/video_core/primitive_assembly.cpp @@ -43,7 +43,7 @@ void PrimitiveAssembler::SubmitVertex(VertexType& vtx, TriangleHandl break; default: - ERROR_LOG(GPU, "Unknown triangle topology %x:", (int)topology); + LOG_ERROR(Render_Software, "Unknown triangle topology %x:", (int)topology); break; } } diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index a35f0c0d8..b7e04a560 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -252,7 +252,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, return combiner_output.rgb(); default: - ERROR_LOG(GPU, "Unknown color combiner source %d\n", (int)source); + LOG_ERROR(HW_GPU, "Unknown color combiner source %d\n", (int)source); return {}; } }; @@ -272,7 +272,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, return combiner_output.a(); default: - ERROR_LOG(GPU, "Unknown alpha combiner source %d\n", (int)source); + LOG_ERROR(HW_GPU, "Unknown alpha combiner source %d\n", (int)source); return 0; } }; @@ -283,7 +283,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, case ColorModifier::SourceColor: return values; default: - ERROR_LOG(GPU, "Unknown color factor %d\n", (int)factor); + LOG_ERROR(HW_GPU, "Unknown color factor %d\n", (int)factor); return {}; } }; @@ -293,7 +293,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, case AlphaModifier::SourceAlpha: return value; default: - ERROR_LOG(GPU, "Unknown color factor %d\n", (int)factor); + LOG_ERROR(HW_GPU, "Unknown color factor %d\n", (int)factor); return 0; } }; @@ -307,7 +307,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, return ((input[0] * input[1]) / 255).Cast(); default: - ERROR_LOG(GPU, "Unknown color combiner operation %d\n", (int)op); + LOG_ERROR(HW_GPU, "Unknown color combiner operation %d\n", (int)op); return {}; } }; @@ -321,7 +321,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, return input[0] * input[1] / 255; default: - ERROR_LOG(GPU, "Unknown alpha combiner operation %d\n", (int)op); + LOG_ERROR(HW_GPU, "Unknown alpha combiner operation %d\n", (int)op); return 0; } }; diff --git a/src/video_core/renderer_opengl/gl_shader_util.cpp b/src/video_core/renderer_opengl/gl_shader_util.cpp index fdac9ae1a..d0f82e6cd 100644 --- a/src/video_core/renderer_opengl/gl_shader_util.cpp +++ b/src/video_core/renderer_opengl/gl_shader_util.cpp @@ -20,7 +20,7 @@ GLuint LoadShaders(const char* vertex_shader, const char* fragment_shader) { int info_log_length; // Compile Vertex Shader - DEBUG_LOG(GPU, "Compiling vertex shader."); + LOG_DEBUG(Render_OpenGL, "Compiling vertex shader..."); glShaderSource(vertex_shader_id, 1, &vertex_shader, nullptr); glCompileShader(vertex_shader_id); @@ -32,11 +32,15 @@ GLuint LoadShaders(const char* vertex_shader, const char* fragment_shader) { if (info_log_length > 1) { std::vector vertex_shader_error(info_log_length); glGetShaderInfoLog(vertex_shader_id, info_log_length, nullptr, &vertex_shader_error[0]); - DEBUG_LOG(GPU, "%s", &vertex_shader_error[0]); + if (result) { + LOG_DEBUG(Render_OpenGL, "%s", &vertex_shader_error[0]); + } else { + LOG_ERROR(Render_OpenGL, "Error compiling vertex shader:\n%s", &vertex_shader_error[0]); + } } // Compile Fragment Shader - DEBUG_LOG(GPU, "Compiling fragment shader."); + LOG_DEBUG(Render_OpenGL, "Compiling fragment shader..."); glShaderSource(fragment_shader_id, 1, &fragment_shader, nullptr); glCompileShader(fragment_shader_id); @@ -48,11 +52,15 @@ GLuint LoadShaders(const char* vertex_shader, const char* fragment_shader) { if (info_log_length > 1) { std::vector fragment_shader_error(info_log_length); glGetShaderInfoLog(fragment_shader_id, info_log_length, nullptr, &fragment_shader_error[0]); - DEBUG_LOG(GPU, "%s", &fragment_shader_error[0]); + if (result) { + LOG_DEBUG(Render_OpenGL, "%s", &fragment_shader_error[0]); + } else { + LOG_ERROR(Render_OpenGL, "Error compiling fragment shader:\n%s", &fragment_shader_error[0]); + } } // Link the program - DEBUG_LOG(GPU, "Linking program."); + LOG_DEBUG(Render_OpenGL, "Linking program..."); GLuint program_id = glCreateProgram(); glAttachShader(program_id, vertex_shader_id); @@ -66,7 +74,11 @@ GLuint LoadShaders(const char* vertex_shader, const char* fragment_shader) { if (info_log_length > 1) { std::vector program_error(info_log_length); glGetProgramInfoLog(program_id, info_log_length, nullptr, &program_error[0]); - DEBUG_LOG(GPU, "%s", &program_error[0]); + if (result) { + LOG_DEBUG(Render_OpenGL, "%s", &program_error[0]); + } else { + LOG_ERROR(Render_OpenGL, "Error linking shader:\n%s", &program_error[0]); + } } glDeleteShader(vertex_shader_id); diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 06de6afbd..e2caeeb8f 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -90,7 +90,7 @@ void RendererOpenGL::LoadFBToActiveGLTexture(const GPU::Regs::FramebufferConfig& const VAddr framebuffer_vaddr = Memory::PhysicalToVirtualAddress( framebuffer.active_fb == 1 ? framebuffer.address_left2 : framebuffer.address_left1); - DEBUG_LOG(GPU, "0x%08x bytes from 0x%08x(%dx%d), fmt %x", + LOG_TRACE(Render_OpenGL, "0x%08x bytes from 0x%08x(%dx%d), fmt %x", framebuffer.stride * framebuffer.height, framebuffer_vaddr, (int)framebuffer.width, (int)framebuffer.height, (int)framebuffer.format); @@ -98,15 +98,15 @@ void RendererOpenGL::LoadFBToActiveGLTexture(const GPU::Regs::FramebufferConfig& const u8* framebuffer_data = Memory::GetPointer(framebuffer_vaddr); // TODO: Handle other pixel formats - _dbg_assert_msg_(RENDER, framebuffer.color_format == GPU::Regs::PixelFormat::RGB8, + _dbg_assert_msg_(Render_OpenGL, framebuffer.color_format == GPU::Regs::PixelFormat::RGB8, "Unsupported 3DS pixel format."); size_t pixel_stride = framebuffer.stride / 3; // OpenGL only supports specifying a stride in units of pixels, not bytes, unfortunately - _dbg_assert_(RENDER, pixel_stride * 3 == framebuffer.stride); + _dbg_assert_(Render_OpenGL, pixel_stride * 3 == framebuffer.stride); // Ensure no bad interactions with GL_UNPACK_ALIGNMENT, which by default // only allows rows to have a memory alignement of 4. - _dbg_assert_(RENDER, pixel_stride % 4 == 0); + _dbg_assert_(Render_OpenGL, pixel_stride % 4 == 0); glBindTexture(GL_TEXTURE_2D, texture.handle); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint)pixel_stride); @@ -263,11 +263,11 @@ void RendererOpenGL::Init() { int err = ogl_LoadFunctions(); if (ogl_LOAD_SUCCEEDED != err) { - ERROR_LOG(RENDER, "Failed to initialize GL functions! Exiting..."); + LOG_CRITICAL(Render_OpenGL, "Failed to initialize GL functions! Exiting..."); exit(-1); } - NOTICE_LOG(RENDER, "GL_VERSION: %s\n", glGetString(GL_VERSION)); + LOG_INFO(Render_OpenGL, "GL_VERSION: %s", glGetString(GL_VERSION)); InitOpenGLObjects(); } diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp index 0dff11a0f..477e78cfe 100644 --- a/src/video_core/vertex_shader.cpp +++ b/src/video_core/vertex_shader.cpp @@ -206,7 +206,7 @@ static void ProcessShaderCode(VertexShaderState& state) { case Instruction::OpCode::CALL: increment_pc = false; - _dbg_assert_(GPU, state.call_stack_pointer - state.call_stack < sizeof(state.call_stack)); + _dbg_assert_(HW_GPU, state.call_stack_pointer - state.call_stack < sizeof(state.call_stack)); *++state.call_stack_pointer = state.program_counter - shader_memory; // TODO: Does this offset refer to the beginning of shader memory? @@ -218,7 +218,7 @@ static void ProcessShaderCode(VertexShaderState& state) { break; default: - ERROR_LOG(GPU, "Unhandled instruction: 0x%02x (%s): 0x%08x", + LOG_ERROR(HW_GPU, "Unhandled instruction: 0x%02x (%s): 0x%08x", (int)instr.opcode.Value(), instr.GetOpCodeName().c_str(), instr.hex); break; } @@ -285,7 +285,7 @@ OutputVertex RunShader(const InputVertex& input, int num_attributes) state.debug.max_opdesc_id, registers.vs_main_offset, registers.vs_output_attributes); - DEBUG_LOG(GPU, "Output vertex: pos (%.2f, %.2f, %.2f, %.2f), col(%.2f, %.2f, %.2f, %.2f), tc0(%.2f, %.2f)", + LOG_TRACE(Render_Software, "Output vertex: pos (%.2f, %.2f, %.2f, %.2f), col(%.2f, %.2f, %.2f, %.2f), tc0(%.2f, %.2f)", ret.pos.x.ToFloat32(), ret.pos.y.ToFloat32(), ret.pos.z.ToFloat32(), ret.pos.w.ToFloat32(), ret.color.x.ToFloat32(), ret.color.y.ToFloat32(), ret.color.z.ToFloat32(), ret.color.w.ToFloat32(), ret.tc0.u().ToFloat32(), ret.tc0.v().ToFloat32()); diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index b581ff4da..6791e4007 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -30,13 +30,13 @@ void Init(EmuWindow* emu_window) { g_current_frame = 0; - NOTICE_LOG(VIDEO, "initialized OK"); + LOG_DEBUG(Render, "initialized OK"); } /// Shutdown the video core void Shutdown() { delete g_renderer; - NOTICE_LOG(VIDEO, "shutdown OK"); + LOG_DEBUG(Render, "shutdown OK"); } } // namespace