From ef24e72b2618806f64345544fa46c84f3f494890 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 20 Jan 2015 17:16:47 -0800 Subject: [PATCH] Asserts: break/crash program, fit to style guide; log.h->assert.h Involves making asserts use printf instead of the log functions (log functions are asynchronous and, as such, the log won't be printed in time) As such, the log type argument was removed (printf obviously can't use it, and it's made obsolete by the file and line printing) Also removed some GEKKO cruft. --- externals/boost | 2 +- src/citra/emu_window/emu_window_glfw.cpp | 10 ++-- src/citra_qt/config/controller_config.cpp | 2 +- .../debugger/graphics_breakpoints.cpp | 2 +- src/citra_qt/debugger/ramview.cpp | 2 +- src/citra_qt/util/spinbox.cpp | 5 +- src/common/CMakeLists.txt | 2 +- src/common/assert.h | 36 ++++++++++++ src/common/break_points.cpp | 1 + src/common/chunk_file.h | 9 ++- src/common/common.h | 3 +- src/common/common_funcs.h | 35 +++++------- src/common/common_types.h | 6 ++ src/common/concurrent_ring_buffer.h | 5 +- src/common/log.h | 56 ------------------- src/common/logging/backend.cpp | 4 +- src/common/msg_handler.h | 14 ----- src/common/scope_exit.h | 1 + src/common/symbols.cpp | 2 +- src/common/utf8.cpp | 2 +- src/common/utf8.h | 2 +- src/core/arm/disassembler/arm_disasm.cpp | 2 +- src/core/arm/dyncom/arm_dyncom_run.cpp | 1 + src/core/core_timing.cpp | 2 +- src/core/hle/config_mem.cpp | 2 +- src/core/hle/hle.cpp | 2 +- src/core/hle/kernel/event.cpp | 2 +- src/core/hle/kernel/kernel.cpp | 4 +- src/core/hle/kernel/mutex.cpp | 2 +- src/core/hle/kernel/semaphore.cpp | 2 +- src/core/hle/kernel/session.h | 2 +- src/core/hle/kernel/thread.cpp | 14 ++--- src/core/hle/kernel/timer.cpp | 2 +- src/core/hle/result.h | 2 +- src/core/hle/service/ac_u.cpp | 2 +- src/core/hle/service/act_u.cpp | 1 - src/core/hle/service/am_app.cpp | 1 - src/core/hle/service/am_net.cpp | 1 - src/core/hle/service/am_sys.cpp | 1 - src/core/hle/service/apt_a.cpp | 1 - src/core/hle/service/apt_u.cpp | 2 +- src/core/hle/service/boss_p.cpp | 1 - src/core/hle/service/boss_u.cpp | 1 - src/core/hle/service/cam_u.cpp | 1 - src/core/hle/service/cecd_s.cpp | 1 - src/core/hle/service/cecd_u.cpp | 1 - src/core/hle/service/cfg/cfg.cpp | 3 +- src/core/hle/service/cfg/cfg_i.cpp | 1 - src/core/hle/service/cfg/cfg_s.cpp | 1 - src/core/hle/service/cfg/cfg_u.cpp | 3 +- src/core/hle/service/csnd_snd.cpp | 1 - src/core/hle/service/dsp_dsp.cpp | 1 - src/core/hle/service/err_f.cpp | 1 - src/core/hle/service/frd_a.cpp | 1 - src/core/hle/service/frd_u.cpp | 1 - src/core/hle/service/fs/archive.cpp | 2 +- src/core/hle/service/gsp_gpu.cpp | 6 +- src/core/hle/service/gsp_lcd.cpp | 2 - src/core/hle/service/hid/hid_spvr.cpp | 1 - src/core/hle/service/hid/hid_user.cpp | 2 - src/core/hle/service/http_c.cpp | 1 - src/core/hle/service/ir_rst.cpp | 1 - src/core/hle/service/ir_u.cpp | 1 - src/core/hle/service/ldr_ro.cpp | 1 - src/core/hle/service/mic_u.cpp | 1 - src/core/hle/service/news_s.cpp | 1 - src/core/hle/service/news_u.cpp | 1 - src/core/hle/service/nim_aoc.cpp | 1 - src/core/hle/service/nwm_uds.cpp | 1 - src/core/hle/service/pm_app.cpp | 1 - src/core/hle/service/ptm_play.cpp | 1 - src/core/hle/service/ptm_sysm.cpp | 1 - src/core/hle/service/ptm_u.cpp | 3 +- src/core/hle/service/soc_u.cpp | 5 +- src/core/hle/service/ssl_c.cpp | 1 - src/core/hle/service/y2r_u.cpp | 1 - src/core/hle/shared_page.cpp | 1 - src/core/hle/svc.cpp | 2 +- src/core/hw/hw.cpp | 2 +- src/core/mem_map_funcs.cpp | 4 +- src/video_core/debug_utils/debug_utils.cpp | 6 +- src/video_core/gpu_debugger.h | 2 - src/video_core/primitive_assembly.cpp | 1 + src/video_core/rasterizer.cpp | 10 ++-- .../renderer_opengl/gl_shader_util.cpp | 2 +- .../renderer_opengl/renderer_opengl.cpp | 6 +- src/video_core/vertex_shader.cpp | 13 ++--- src/video_core/video_core.cpp | 1 - 88 files changed, 135 insertions(+), 217 deletions(-) create mode 100644 src/common/assert.h delete mode 100644 src/common/log.h diff --git a/externals/boost b/externals/boost index 728a4d7d1c..a1afc91d3a 160000 --- a/externals/boost +++ b/externals/boost @@ -1 +1 @@ -Subproject commit 728a4d7d1c8b28355544ae829df9c4b5f28373c5 +Subproject commit a1afc91d3aaa3da06bdbc13c78613e1466653405 diff --git a/src/citra/emu_window/emu_window_glfw.cpp b/src/citra/emu_window/emu_window_glfw.cpp index 9d1adc2fa2..8a3ee64a8b 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_(Frontend, width > 0); - _dbg_assert_(Frontend, height > 0); + ASSERT(width > 0); + ASSERT(height > 0); GetEmuWindow(win)->NotifyFramebufferSizeChanged(std::pair(width, height)); } void EmuWindow_GLFW::OnClientAreaResizeEvent(GLFWwindow* win, int width, int height) { - _dbg_assert_(Frontend, width > 0); - _dbg_assert_(Frontend, height > 0); + ASSERT(width > 0); + ASSERT(height > 0); // NOTE: GLFW provides no proper way to set a minimal window size. // Hence, we just ignore the corresponding EmuWindow hint. @@ -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_(Frontend, (int)minimal_size.first > 0 && (int)minimal_size.second > 0); + DEBUG_ASSERT((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/config/controller_config.cpp b/src/citra_qt/config/controller_config.cpp index 892995bb26..512879f1be 100644 --- a/src/citra_qt/config/controller_config.cpp +++ b/src/citra_qt/config/controller_config.cpp @@ -92,4 +92,4 @@ void GControllerConfigDialog::EnableChanges() } } -*/ \ No newline at end of file +*/ diff --git a/src/citra_qt/debugger/graphics_breakpoints.cpp b/src/citra_qt/debugger/graphics_breakpoints.cpp index 262e2e770c..92348be347 100644 --- a/src/citra_qt/debugger/graphics_breakpoints.cpp +++ b/src/citra_qt/debugger/graphics_breakpoints.cpp @@ -47,7 +47,7 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const { Pica::DebugContext::Event::VertexLoaded, tr("Vertex loaded") } }; - _dbg_assert_(Debug_GPU, map.size() == static_cast(Pica::DebugContext::Event::NumEvents)); + DEBUG_ASSERT(map.size() == static_cast(Pica::DebugContext::Event::NumEvents)); return (map.find(event) != map.end()) ? map.at(event) : QString(); } diff --git a/src/citra_qt/debugger/ramview.cpp b/src/citra_qt/debugger/ramview.cpp index 2b199bad14..88570f2cdc 100644 --- a/src/citra_qt/debugger/ramview.cpp +++ b/src/citra_qt/debugger/ramview.cpp @@ -14,4 +14,4 @@ void GRamView::OnCPUStepped() { // TODO: QHexEdit doesn't show vertical scroll bars for > 10MB data streams... //setData(QByteArray((const char*)Mem_RAM,sizeof(Mem_RAM)/8)); -} \ No newline at end of file +} diff --git a/src/citra_qt/util/spinbox.cpp b/src/citra_qt/util/spinbox.cpp index 1e3767c188..2e2076a27d 100644 --- a/src/citra_qt/util/spinbox.cpp +++ b/src/citra_qt/util/spinbox.cpp @@ -32,8 +32,7 @@ #include #include -#include "common/log.h" - +#include "common/assert.h" #include "spinbox.h" CSpinBox::CSpinBox(QWidget* parent) : QAbstractSpinBox(parent), min_value(-100), max_value(100), value(0), base(10), num_digits(0) @@ -244,7 +243,7 @@ QValidator::State CSpinBox::validate(QString& input, int& pos) const if (strpos >= input.length() - HasSign() - suffix.length()) return QValidator::Intermediate; - _dbg_assert_(Frontend, base <= 10 || base == 16); + DEBUG_ASSERT(base <= 10 || base == 16); QString regexp; // Demand sign character for negative ranges diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 3c3419bbc8..8c87deaa45 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -26,6 +26,7 @@ set(SRCS ) set(HEADERS + assert.h bit_field.h break_points.h chunk_file.h @@ -44,7 +45,6 @@ set(HEADERS hash.h key_map.h linear_disk_cache.h - log.h logging/text_formatter.h logging/filter.h logging/log.h diff --git a/src/common/assert.h b/src/common/assert.h new file mode 100644 index 0000000000..3b2232a7ea --- /dev/null +++ b/src/common/assert.h @@ -0,0 +1,36 @@ +// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "common/common_funcs.h" + +// TODO (yuriks) allow synchronous logging so we don't need printf +#define ASSERT(_a_) \ + do if (!(_a_)) {\ + fprintf(stderr, "Assertion Failed!\n\n Line: %d\n File: %s\n Time: %s\n", \ + __LINE__, __FILE__, __TIME__); \ + Crash(); \ + } while (0) + +#define ASSERT_MSG(_a_, ...) \ + do if (!(_a_)) {\ + fprintf(stderr, "Assertion Failed!\n\n Line: %d\n File: %s\n Time: %s\n", \ + __LINE__, __FILE__, __TIME__); \ + fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, "\n"); \ + Crash(); \ + } while (0) + +#define UNREACHABLE() ASSERT_MSG(false, "Unreachable code!") + +#ifdef _DEBUG +#define DEBUG_ASSERT(_a_) ASSERT(_a_) +#define DEBUG_ASSERT_MSG(_a_, ...) ASSERT_MSG(_a_, __VA_ARGS__) +#else // not debug +#define DEBUG_ASSERT(_a_) +#define DEBUG_ASSERT_MSG(_a_, _desc_, ...) +#endif + +#define UNIMPLEMENTED() DEBUG_ASSERT_MSG(false, "Unimplemented code!") diff --git a/src/common/break_points.cpp b/src/common/break_points.cpp index 6696935fa9..2655d3ce96 100644 --- a/src/common/break_points.cpp +++ b/src/common/break_points.cpp @@ -5,6 +5,7 @@ #include "common/common.h" #include "common/debug_interface.h" #include "common/break_points.h" +#include "common/logging/log.h" #include #include diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h index 39a14dc813..dc27da088c 100644 --- a/src/common/chunk_file.h +++ b/src/common/chunk_file.h @@ -180,7 +180,7 @@ public: 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], + DEBUG_ASSERT_MSG(((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]); @@ -200,7 +200,7 @@ public: 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], + DEBUG_ASSERT_MSG(((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]); @@ -505,8 +505,7 @@ public: 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), + DEBUG_ASSERT_MSG((x == (char*)*ptr), "Savestate verification failure: \"%s\" != \"%s\" (at %p).\n", x.c_str(), (char*)*ptr, ptr); break; @@ -524,7 +523,7 @@ public: 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, + DEBUG_ASSERT_MSG((x == (wchar_t*)*ptr), "Savestate verification failure: \"%ls\" != \"%ls\" (at %p).\n", x.c_str(), (wchar_t*)*ptr, ptr); break; diff --git a/src/common/common.h b/src/common/common.h index 3246c77975..ad2de6f2eb 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -25,7 +25,8 @@ private: NonCopyable& operator=(NonCopyable& other); }; -#include "common/log.h" +#include "common/assert.h" +#include "common/logging/log.h" #include "common/common_types.h" #include "common/msg_handler.h" #include "common/common_funcs.h" diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 229eb74c96..44d8ae11fe 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -44,15 +44,14 @@ template<> struct CompileTimeAssert {}; #include #endif -// go to debugger mode - #ifdef GEKKO - #define Crash() - #elif defined _M_GENERIC - #define Crash() { exit(1); } - #else - #define Crash() {asm ("int $3");} - #endif - #define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) +#if defined(__x86_64__) || defined(_M_X64) +#define Crash() __asm__ __volatile__("int $3") +#elif defined(_M_ARM) +#define Crash() __asm__ __volatile__("trap") +#else +#define Crash() exit(1) +#endif + // GCC 4.8 defines all the rotate functions now // Small issue with GCC's lrotl/lrotr intrinsics is they are still 32bit while we require 64bit #ifndef _rotl @@ -97,10 +96,10 @@ inline u64 _rotr64(u64 x, unsigned int shift){ #define LC_GLOBAL_LOCALE ((locale_t)-1) #define LC_ALL_MASK LC_ALL #define LC_COLLATE_MASK LC_COLLATE - #define LC_CTYPE_MASK LC_CTYPE - #define LC_MONETARY_MASK LC_MONETARY + #define LC_CTYPE_MASK LC_CTYPE + #define LC_MONETARY_MASK LC_MONETARY #define LC_NUMERIC_MASK LC_NUMERIC - #define LC_TIME_MASK LC_TIME + #define LC_TIME_MASK LC_TIME inline locale_t uselocale(locale_t new_locale) { @@ -136,14 +135,10 @@ inline u64 _rotr64(u64 x, unsigned int shift){ #define fstat64 _fstat64 #define fileno _fileno - #if _M_IX86 - #define Crash() {__asm int 3} - #else -extern "C" { - __declspec(dllimport) void __stdcall DebugBreak(void); -} - #define Crash() {DebugBreak();} - #endif // M_IX86 + extern "C" { + __declspec(dllimport) void __stdcall DebugBreak(void); + } + #define Crash() {DebugBreak();} #endif // _MSC_VER ndef // Dolphin's min and max functions diff --git a/src/common/common_types.h b/src/common/common_types.h index 94e1406b1c..1b453e7f58 100644 --- a/src/common/common_types.h +++ b/src/common/common_types.h @@ -28,6 +28,12 @@ #include #include +#ifdef _MSC_VER +#ifndef __func__ +#define __func__ __FUNCTION__ +#endif +#endif + typedef std::uint8_t u8; ///< 8-bit unsigned byte typedef std::uint16_t u16; ///< 16-bit unsigned short typedef std::uint32_t u32; ///< 32-bit unsigned word diff --git a/src/common/concurrent_ring_buffer.h b/src/common/concurrent_ring_buffer.h index 311bb01f47..fc18e6c860 100644 --- a/src/common/concurrent_ring_buffer.h +++ b/src/common/concurrent_ring_buffer.h @@ -11,7 +11,6 @@ #include #include "common/common.h" // for NonCopyable -#include "common/log.h" // for _dbg_assert_ namespace Common { @@ -93,7 +92,7 @@ public: return QUEUE_CLOSED; } } - _dbg_assert_(Common, CanRead()); + DEBUG_ASSERT(CanRead()); return PopInternal(dest, dest_len); } @@ -119,7 +118,7 @@ private: size_t PopInternal(T* dest, size_t dest_len) { size_t output_count = 0; while (output_count < dest_len && CanRead()) { - _dbg_assert_(Common, CanRead()); + DEBUG_ASSERT(CanRead()); T* item = &Data()[reader_index]; T out_val = std::move(*item); diff --git a/src/common/log.h b/src/common/log.h deleted file mode 100644 index b397cf14df..0000000000 --- a/src/common/log.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#pragma once - -#include "common/common_funcs.h" -#include "common/msg_handler.h" -#include "common/logging/log.h" - -#ifdef _MSC_VER -#ifndef __func__ -#define __func__ __FUNCTION__ -#endif -#endif - -#ifdef _DEBUG -#define _dbg_assert_(_t_, _a_) \ - if (!(_a_)) {\ - 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_)) {\ - LOG_CRITICAL(_t_, __VA_ARGS__); \ - if (!PanicYesNo(__VA_ARGS__)) {Crash();} \ - } -#define _dbg_update_() Host_UpdateLogDisplay(); - -#else // not debug -#define _dbg_update_() ; - -#ifndef _dbg_assert_ -#define _dbg_assert_(_t_, _a_) {} -#define _dbg_assert_msg_(_t_, _a_, _desc_, ...) {} -#endif // dbg_assert -#endif - -#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_) - -#ifndef GEKKO -#ifdef _MSC_VER -#define _assert_msg_(_t_, _a_, _fmt_, ...) \ - if (!(_a_)) {\ - if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \ - } -#else // not msvc -#define _assert_msg_(_t_, _a_, _fmt_, ...) \ - if (!(_a_)) {\ - if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \ - } -#endif // _WIN32 -#else // GEKKO -#define _assert_msg_(_t_, _a_, _fmt_, ...) -#endif \ No newline at end of file diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 83ebb42d9f..459b44135c 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -4,7 +4,7 @@ #include -#include "common/log.h" // For _dbg_assert_ +#include "common/assert.h" #include "common/logging/backend.h" #include "common/logging/log.h" @@ -67,7 +67,7 @@ Logger::Logger() { #undef SUB // Ensures that ALL_LOG_CLASSES isn't missing any entries. - _dbg_assert_(Log, all_classes.size() == (size_t)Class::Count); + DEBUG_ASSERT(all_classes.size() == (size_t)Class::Count); } // GetClassName is a macro defined by Windows.h, grrr... diff --git a/src/common/msg_handler.h b/src/common/msg_handler.h index 5a483ddb41..421f93e23e 100644 --- a/src/common/msg_handler.h +++ b/src/common/msg_handler.h @@ -29,7 +29,6 @@ extern bool MsgAlert(bool yes_no, int Style, const char* format, ...) ; void SetEnableAlert(bool enable); -#ifndef GEKKO #ifdef _MSC_VER #define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__) #define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__) @@ -55,16 +54,3 @@ void SetEnableAlert(bool enable); #define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__) #define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, ##__VA_ARGS__) #endif -#else -// GEKKO - #define SuccessAlert(format, ...) ; - #define PanicAlert(format, ...) ; - #define PanicYesNo(format, ...) ; - #define AskYesNo(format, ...) ; - #define CriticalAlert(format, ...) ; - #define SuccessAlertT(format, ...) ; - #define PanicAlertT(format, ...) ; - #define PanicYesNoT(format, ...) ; - #define AskYesNoT(format, ...) ; - #define CriticalAlertT(format, ...) ; -#endif diff --git a/src/common/scope_exit.h b/src/common/scope_exit.h index 77dcbaa223..08f09a8c86 100644 --- a/src/common/scope_exit.h +++ b/src/common/scope_exit.h @@ -5,6 +5,7 @@ #pragma once #include "common/common_funcs.h" +#include namespace detail { template diff --git a/src/common/symbols.cpp b/src/common/symbols.cpp index 9e4dccfb3c..f23e51c9da 100644 --- a/src/common/symbols.cpp +++ b/src/common/symbols.cpp @@ -54,4 +54,4 @@ namespace Symbols { g_symbols.clear(); } -} \ No newline at end of file +} diff --git a/src/common/utf8.cpp b/src/common/utf8.cpp index 66a2f6339f..56609634c0 100644 --- a/src/common/utf8.cpp +++ b/src/common/utf8.cpp @@ -456,4 +456,4 @@ std::wstring ConvertUTF8ToWString(const std::string &source) { return str; } -#endif \ No newline at end of file +#endif diff --git a/src/common/utf8.h b/src/common/utf8.h index 6479ec5ad0..a6e84913bd 100644 --- a/src/common/utf8.h +++ b/src/common/utf8.h @@ -64,4 +64,4 @@ std::string ConvertWStringToUTF8(const wchar_t *wstr); void ConvertUTF8ToWString(wchar_t *dest, size_t destSize, const std::string &source); std::wstring ConvertUTF8ToWString(const std::string &source); -#endif \ No newline at end of file +#endif diff --git a/src/core/arm/disassembler/arm_disasm.cpp b/src/core/arm/disassembler/arm_disasm.cpp index 45c720e16a..f7c7451e97 100644 --- a/src/core/arm/disassembler/arm_disasm.cpp +++ b/src/core/arm/disassembler/arm_disasm.cpp @@ -963,4 +963,4 @@ Opcode ARM_Disasm::DecodeALU(uint32_t insn) { } // Unreachable return OP_INVALID; -} \ No newline at end of file +} diff --git a/src/core/arm/dyncom/arm_dyncom_run.cpp b/src/core/arm/dyncom/arm_dyncom_run.cpp index d457d0ac59..15677da270 100644 --- a/src/core/arm/dyncom/arm_dyncom_run.cpp +++ b/src/core/arm/dyncom/arm_dyncom_run.cpp @@ -4,6 +4,7 @@ #include +#include "common/logging/log.h" #include "core/arm/skyeye_common/armdefs.h" void switch_mode(arm_core_t *core, uint32_t mode) { diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 3aebd7e9dd..d96d3fe168 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -7,8 +7,8 @@ #include #include +#include "common/assert.h" #include "common/chunk_file.h" -#include "common/log.h" #include "core/arm/arm_interface.h" #include "core/core.h" diff --git a/src/core/hle/config_mem.cpp b/src/core/hle/config_mem.cpp index 721a600b53..68d3071f5c 100644 --- a/src/core/hle/config_mem.cpp +++ b/src/core/hle/config_mem.cpp @@ -3,7 +3,7 @@ // Refer to the license.txt file included. #include "common/common_types.h" -#include "common/log.h" +#include "common/logging/log.h" #include "core/hle/config_mem.h" diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp index 5a2edeb4a9..97d73781fd 100644 --- a/src/core/hle/hle.cpp +++ b/src/core/hle/hle.cpp @@ -45,7 +45,7 @@ void CallSVC(u32 opcode) { } void Reschedule(const char *reason) { - _dbg_assert_msg_(Kernel, reason != 0 && strlen(reason) < 256, "Reschedule: Invalid or too long reason."); + DEBUG_ASSERT_MSG(reason != nullptr && strlen(reason) < 256, "Reschedule: Invalid or too long reason."); // TODO(bunnei): It seems that games depend on some CPU execution time elapsing during HLE // routines. This simulates that time by artificially advancing the number of CPU "ticks". diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index 898e1c98fd..420906ec08 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp @@ -32,7 +32,7 @@ bool Event::ShouldWait() { } void Event::Acquire() { - _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); + ASSERT_MSG(!ShouldWait(), "object unavailable!"); // Release the event if it's not sticky... if (reset_type != RESETTYPE_STICKY) diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index a2ffbcdb7f..eb61d8ef37 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -52,7 +52,7 @@ void WaitObject::WakeupAllWaitingThreads() { for (auto thread : waiting_threads_copy) thread->ReleaseWaitObject(this); - _assert_msg_(Kernel, waiting_threads.empty(), "failed to awaken all waiting threads!"); + ASSERT_MSG(waiting_threads.empty(), "failed to awaken all waiting threads!"); } HandleTable::HandleTable() { @@ -61,7 +61,7 @@ HandleTable::HandleTable() { } ResultVal HandleTable::Create(SharedPtr obj) { - _dbg_assert_(Kernel, obj != nullptr); + DEBUG_ASSERT(obj != nullptr); u16 slot = next_free_slot; if (slot >= generations.size()) { diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index a811db392c..be2c49706a 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -64,7 +64,7 @@ void Mutex::Acquire() { } void Mutex::Acquire(SharedPtr thread) { - _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); + ASSERT_MSG(!ShouldWait(), "object unavailable!"); // Actually "acquire" the mutex only if we don't already have it... if (lock_count == 0) { diff --git a/src/core/hle/kernel/semaphore.cpp b/src/core/hle/kernel/semaphore.cpp index c8cf8b9a22..6aecc24aa6 100644 --- a/src/core/hle/kernel/semaphore.cpp +++ b/src/core/hle/kernel/semaphore.cpp @@ -36,7 +36,7 @@ bool Semaphore::ShouldWait() { } void Semaphore::Acquire() { - _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); + ASSERT_MSG(!ShouldWait(), "object unavailable!"); --available_count; } diff --git a/src/core/hle/kernel/session.h b/src/core/hle/kernel/session.h index 7cc9332c97..9e9288e0f3 100644 --- a/src/core/hle/kernel/session.h +++ b/src/core/hle/kernel/session.h @@ -66,7 +66,7 @@ public: } void Acquire() override { - _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); + ASSERT_MSG(!ShouldWait(), "object unavailable!"); } }; diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 7f629c20ec..f8c834a8d5 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -29,7 +29,7 @@ bool Thread::ShouldWait() { } void Thread::Acquire() { - _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); + ASSERT_MSG(!ShouldWait(), "object unavailable!"); } // Lists all thread ids that aren't deleted/etc. @@ -144,7 +144,7 @@ void ArbitrateAllThreads(u32 address) { * @param new_thread The thread to switch to */ static void SwitchContext(Thread* new_thread) { - _dbg_assert_msg_(Kernel, new_thread->status == THREADSTATUS_READY, "Thread must be ready to become running."); + DEBUG_ASSERT_MSG(new_thread->status == THREADSTATUS_READY, "Thread must be ready to become running."); Thread* previous_thread = GetCurrentThread(); @@ -304,14 +304,12 @@ void Thread::ResumeFromWait() { break; case THREADSTATUS_RUNNING: case THREADSTATUS_READY: - LOG_ERROR(Kernel, "Thread with object id %u has already resumed.", GetObjectId()); - _dbg_assert_(Kernel, false); + DEBUG_ASSERT_MSG(false, "Thread with object id %u has already resumed.", GetObjectId()); return; case THREADSTATUS_DEAD: // This should never happen, as threads must complete before being stopped. - LOG_CRITICAL(Kernel, "Thread with object id %u cannot be resumed because it's DEAD.", + DEBUG_ASSERT_MSG(false, "Thread with object id %u cannot be resumed because it's DEAD.", GetObjectId()); - _dbg_assert_(Kernel, false); return; } @@ -387,7 +385,7 @@ ResultVal> Thread::Create(std::string name, VAddr entry_point, // TODO(peachum): Remove this. Range checking should be done, and an appropriate error should be returned. static void ClampPriority(const Thread* thread, s32* priority) { if (*priority < THREADPRIO_HIGHEST || *priority > THREADPRIO_LOWEST) { - _dbg_assert_msg_(Kernel, false, "Application passed an out of range priority. An error should be returned."); + DEBUG_ASSERT_MSG(false, "Application passed an out of range priority. An error should be returned."); s32 new_priority = CLAMP(*priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST); LOG_WARNING(Kernel_SVC, "(name=%s): invalid priority=%d, clamping to %d", @@ -425,7 +423,7 @@ SharedPtr SetupIdleThread() { } SharedPtr SetupMainThread(u32 stack_size, u32 entry_point, s32 priority) { - _dbg_assert_(Kernel, !GetCurrentThread()); + DEBUG_ASSERT(!GetCurrentThread()); // Initialize new "main" thread auto thread_res = Thread::Create("main", entry_point, priority, 0, diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp index 4352fc99c9..aa0afb796d 100644 --- a/src/core/hle/kernel/timer.cpp +++ b/src/core/hle/kernel/timer.cpp @@ -38,7 +38,7 @@ bool Timer::ShouldWait() { } void Timer::Acquire() { - _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); + ASSERT_MSG( !ShouldWait(), "object unavailable!"); } void Timer::Set(s64 initial, s64 interval) { diff --git a/src/core/hle/result.h b/src/core/hle/result.h index 9c6ca29e57..9dbd5a9144 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h @@ -363,7 +363,7 @@ public: /// Asserts that the result succeeded and returns a reference to it. T& Unwrap() { // TODO(yuriks): Should be a release assert - _assert_msg_(Common, Succeeded(), "Tried to Unwrap empty ResultVal"); + ASSERT_MSG(Succeeded(), "Tried to Unwrap empty ResultVal"); return **this; } diff --git a/src/core/hle/service/ac_u.cpp b/src/core/hle/service/ac_u.cpp index 53d920de13..50644816b2 100644 --- a/src/core/hle/service/ac_u.cpp +++ b/src/core/hle/service/ac_u.cpp @@ -2,7 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" +#include "common/logging/log.h" #include "core/hle/hle.h" #include "core/hle/service/ac_u.h" diff --git a/src/core/hle/service/act_u.cpp b/src/core/hle/service/act_u.cpp index 4ea7a9fb29..57f49c91f4 100644 --- a/src/core/hle/service/act_u.cpp +++ b/src/core/hle/service/act_u.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/act_u.h" diff --git a/src/core/hle/service/am_app.cpp b/src/core/hle/service/am_app.cpp index df10db87fa..684b753f06 100644 --- a/src/core/hle/service/am_app.cpp +++ b/src/core/hle/service/am_app.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/am_app.h" diff --git a/src/core/hle/service/am_net.cpp b/src/core/hle/service/am_net.cpp index c74012d9d8..ba2a499f1a 100644 --- a/src/core/hle/service/am_net.cpp +++ b/src/core/hle/service/am_net.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/am_net.h" diff --git a/src/core/hle/service/am_sys.cpp b/src/core/hle/service/am_sys.cpp index c5df8abdaa..7ab89569ff 100644 --- a/src/core/hle/service/am_sys.cpp +++ b/src/core/hle/service/am_sys.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/am_sys.h" diff --git a/src/core/hle/service/apt_a.cpp b/src/core/hle/service/apt_a.cpp index e1dd2a5fb3..1c1d92572e 100644 --- a/src/core/hle/service/apt_a.cpp +++ b/src/core/hle/service/apt_a.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/apt_a.h" diff --git a/src/core/hle/service/apt_u.cpp b/src/core/hle/service/apt_u.cpp index ccfd045911..12af5e9f7f 100644 --- a/src/core/hle/service/apt_u.cpp +++ b/src/core/hle/service/apt_u.cpp @@ -79,7 +79,7 @@ void Initialize(Service::Interface* self) { notification_event->Clear(); pause_event->Signal(); // Fire start event - _assert_msg_(KERNEL, (nullptr != lock), "Cannot initialize without lock"); + ASSERT_MSG((nullptr != lock), "Cannot initialize without lock"); lock->Release(); cmd_buff[1] = RESULT_SUCCESS.raw; // No error diff --git a/src/core/hle/service/boss_p.cpp b/src/core/hle/service/boss_p.cpp index b3aa6acee0..8280830e5d 100644 --- a/src/core/hle/service/boss_p.cpp +++ b/src/core/hle/service/boss_p.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/boss_p.h" diff --git a/src/core/hle/service/boss_u.cpp b/src/core/hle/service/boss_u.cpp index 50bb5d426f..2c322bdfd3 100644 --- a/src/core/hle/service/boss_u.cpp +++ b/src/core/hle/service/boss_u.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/boss_u.h" diff --git a/src/core/hle/service/cam_u.cpp b/src/core/hle/service/cam_u.cpp index cf3b276649..fcfd877150 100644 --- a/src/core/hle/service/cam_u.cpp +++ b/src/core/hle/service/cam_u.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/cam_u.h" diff --git a/src/core/hle/service/cecd_s.cpp b/src/core/hle/service/cecd_s.cpp index 2c707baff3..b298f151d2 100644 --- a/src/core/hle/service/cecd_s.cpp +++ b/src/core/hle/service/cecd_s.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/cecd_s.h" diff --git a/src/core/hle/service/cecd_u.cpp b/src/core/hle/service/cecd_u.cpp index b7ea3a1861..9125364bc8 100644 --- a/src/core/hle/service/cecd_u.cpp +++ b/src/core/hle/service/cecd_u.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/cecd_u.h" diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index 8812c49efb..1a2104b486 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp @@ -3,7 +3,6 @@ // Refer to the license.txt file included. #include -#include "common/log.h" #include "common/make_unique.h" #include "core/file_sys/archive_systemsavedata.h" #include "core/hle/service/cfg/cfg.h" @@ -109,7 +108,7 @@ ResultCode UpdateConfigNANDSavegame() { mode.create_flag = 1; FileSys::Path path("config"); auto file = cfg_system_save_data->OpenFile(path, mode); - _assert_msg_(Service_CFG, file != nullptr, "could not open file"); + ASSERT_MSG(file != nullptr, "could not open file"); file->Write(0, CONFIG_SAVEFILE_SIZE, 1, cfg_config_file_buffer.data()); return RESULT_SUCCESS; } diff --git a/src/core/hle/service/cfg/cfg_i.cpp b/src/core/hle/service/cfg/cfg_i.cpp index 555b7884a5..20b09a8cb9 100644 --- a/src/core/hle/service/cfg/cfg_i.cpp +++ b/src/core/hle/service/cfg/cfg_i.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/cfg/cfg.h" #include "core/hle/service/cfg/cfg_i.h" diff --git a/src/core/hle/service/cfg/cfg_s.cpp b/src/core/hle/service/cfg/cfg_s.cpp index 2170894d6b..d80aeae8df 100644 --- a/src/core/hle/service/cfg/cfg_s.cpp +++ b/src/core/hle/service/cfg/cfg_s.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/cfg/cfg.h" #include "core/hle/service/cfg/cfg_s.h" diff --git a/src/core/hle/service/cfg/cfg_u.cpp b/src/core/hle/service/cfg/cfg_u.cpp index 5aa53cf759..4c5eac3826 100644 --- a/src/core/hle/service/cfg/cfg_u.cpp +++ b/src/core/hle/service/cfg/cfg_u.cpp @@ -3,7 +3,6 @@ // Refer to the license.txt file included. #include "common/file_util.h" -#include "common/log.h" #include "common/string_util.h" #include "core/settings.h" #include "core/file_sys/archive_systemsavedata.h" @@ -84,7 +83,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_(Service_CFG, country_codes[0] == 0); + DEBUG_ASSERT(country_codes[0] == 0); for (size_t id = 0; id < country_codes.size(); ++id) { if (country_codes[id] == country_code) { diff --git a/src/core/hle/service/csnd_snd.cpp b/src/core/hle/service/csnd_snd.cpp index 39b00982cc..6a1d961acb 100644 --- a/src/core/hle/service/csnd_snd.cpp +++ b/src/core/hle/service/csnd_snd.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/csnd_snd.h" diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp index a720b63f39..db1e3b5fd8 100644 --- a/src/core/hle/service/dsp_dsp.cpp +++ b/src/core/hle/service/dsp_dsp.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/kernel/event.h" #include "core/hle/service/dsp_dsp.h" diff --git a/src/core/hle/service/err_f.cpp b/src/core/hle/service/err_f.cpp index 962de21704..8d765acb5a 100644 --- a/src/core/hle/service/err_f.cpp +++ b/src/core/hle/service/err_f.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/err_f.h" diff --git a/src/core/hle/service/frd_a.cpp b/src/core/hle/service/frd_a.cpp index 79140a756d..569979319c 100644 --- a/src/core/hle/service/frd_a.cpp +++ b/src/core/hle/service/frd_a.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/frd_a.h" diff --git a/src/core/hle/service/frd_u.cpp b/src/core/hle/service/frd_u.cpp index 59faca77ae..6d2ff1e219 100644 --- a/src/core/hle/service/frd_u.cpp +++ b/src/core/hle/service/frd_u.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/frd_u.h" diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index e197d35997..37bcec2198 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -261,7 +261,7 @@ ResultCode RegisterArchiveType(std::unique_ptr&& factor auto result = id_code_map.emplace(id_code, std::move(factory)); bool inserted = result.second; - _assert_msg_(Service_FS, inserted, "Tried to register more than one archive with same id code"); + ASSERT_MSG(inserted, "Tried to register more than one archive with same id code"); auto& archive = result.first->second; LOG_DEBUG(Service_FS, "Registered archive %s with id code 0x%08X", archive->GetName().c_str(), id_code); diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index 359e41dd1d..4c3ac845b7 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp @@ -2,8 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. - -#include "common/log.h" #include "common/bit_field.h" #include "core/mem_map.h" @@ -36,7 +34,7 @@ static inline u8* GetCommandBuffer(u32 thread_id) { } static inline FrameBufferUpdate* GetFrameBufferInfo(u32 thread_id, u32 screen_index) { - _dbg_assert_msg_(Service_GSP, screen_index < 2, "Invalid screen index"); + DEBUG_ASSERT_MSG(screen_index < 2, "Invalid screen index"); // For each thread there are two FrameBufferUpdate fields u32 offset = 0x200 + (2 * thread_id + screen_index) * sizeof(FrameBufferUpdate); @@ -186,7 +184,7 @@ static void RegisterInterruptRelayQueue(Service::Interface* self) { u32 flags = cmd_buff[1]; g_interrupt_event = Kernel::g_handle_table.Get(cmd_buff[3]); - _assert_msg_(GSP, (g_interrupt_event != nullptr), "handle is not valid!"); + ASSERT_MSG((g_interrupt_event != nullptr), "handle is not valid!"); g_shared_memory = Kernel::SharedMemory::Create("GSPSharedMem"); Handle shmem_handle = Kernel::g_handle_table.Create(g_shared_memory).MoveFrom(); diff --git a/src/core/hle/service/gsp_lcd.cpp b/src/core/hle/service/gsp_lcd.cpp index d63fa1ee2f..9e36732b4c 100644 --- a/src/core/hle/service/gsp_lcd.cpp +++ b/src/core/hle/service/gsp_lcd.cpp @@ -2,8 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. - -#include "common/log.h" #include "common/bit_field.h" #include "core/hle/service/gsp_lcd.h" diff --git a/src/core/hle/service/hid/hid_spvr.cpp b/src/core/hle/service/hid/hid_spvr.cpp index 054aa8b59f..8f06b224db 100644 --- a/src/core/hle/service/hid/hid_spvr.cpp +++ b/src/core/hle/service/hid/hid_spvr.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/hid/hid_spvr.h" diff --git a/src/core/hle/service/hid/hid_user.cpp b/src/core/hle/service/hid/hid_user.cpp index 68edafebbd..7f464705f8 100644 --- a/src/core/hle/service/hid/hid_user.cpp +++ b/src/core/hle/service/hid/hid_user.cpp @@ -2,8 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" - #include "core/hle/hle.h" #include "core/hle/kernel/event.h" #include "core/hle/kernel/shared_memory.h" diff --git a/src/core/hle/service/http_c.cpp b/src/core/hle/service/http_c.cpp index 6595ca5728..0a3aba0a05 100644 --- a/src/core/hle/service/http_c.cpp +++ b/src/core/hle/service/http_c.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/http_c.h" diff --git a/src/core/hle/service/ir_rst.cpp b/src/core/hle/service/ir_rst.cpp index 31da8e1608..4c26c2f03b 100644 --- a/src/core/hle/service/ir_rst.cpp +++ b/src/core/hle/service/ir_rst.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/ir_rst.h" diff --git a/src/core/hle/service/ir_u.cpp b/src/core/hle/service/ir_u.cpp index 7fa233048b..608ed3c06a 100644 --- a/src/core/hle/service/ir_u.cpp +++ b/src/core/hle/service/ir_u.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/ir_u.h" diff --git a/src/core/hle/service/ldr_ro.cpp b/src/core/hle/service/ldr_ro.cpp index ea96f64afe..c0c4a23445 100644 --- a/src/core/hle/service/ldr_ro.cpp +++ b/src/core/hle/service/ldr_ro.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/ldr_ro.h" diff --git a/src/core/hle/service/mic_u.cpp b/src/core/hle/service/mic_u.cpp index af967b5b65..25e70d321d 100644 --- a/src/core/hle/service/mic_u.cpp +++ b/src/core/hle/service/mic_u.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/mic_u.h" diff --git a/src/core/hle/service/news_s.cpp b/src/core/hle/service/news_s.cpp index d7537875b8..302d588c7c 100644 --- a/src/core/hle/service/news_s.cpp +++ b/src/core/hle/service/news_s.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/news_s.h" diff --git a/src/core/hle/service/news_u.cpp b/src/core/hle/service/news_u.cpp index a9e161c234..7d835aa302 100644 --- a/src/core/hle/service/news_u.cpp +++ b/src/core/hle/service/news_u.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/news_u.h" diff --git a/src/core/hle/service/nim_aoc.cpp b/src/core/hle/service/nim_aoc.cpp index ab2ef44294..7a6aea91a6 100644 --- a/src/core/hle/service/nim_aoc.cpp +++ b/src/core/hle/service/nim_aoc.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/nim_aoc.h" diff --git a/src/core/hle/service/nwm_uds.cpp b/src/core/hle/service/nwm_uds.cpp index 61fcb54cee..88be6c8d9a 100644 --- a/src/core/hle/service/nwm_uds.cpp +++ b/src/core/hle/service/nwm_uds.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/nwm_uds.h" diff --git a/src/core/hle/service/pm_app.cpp b/src/core/hle/service/pm_app.cpp index d61eaf80fa..7420a62f40 100644 --- a/src/core/hle/service/pm_app.cpp +++ b/src/core/hle/service/pm_app.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/pm_app.h" diff --git a/src/core/hle/service/ptm_play.cpp b/src/core/hle/service/ptm_play.cpp index b357057fdb..f21d9088ea 100644 --- a/src/core/hle/service/ptm_play.cpp +++ b/src/core/hle/service/ptm_play.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/ptm_play.h" diff --git a/src/core/hle/service/ptm_sysm.cpp b/src/core/hle/service/ptm_sysm.cpp index b6f688de37..96ef2dce05 100644 --- a/src/core/hle/service/ptm_sysm.cpp +++ b/src/core/hle/service/ptm_sysm.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "common/make_unique.h" #include "core/file_sys/archive_extsavedata.h" #include "core/hle/hle.h" diff --git a/src/core/hle/service/ptm_u.cpp b/src/core/hle/service/ptm_u.cpp index 7c8d9ce8cc..7121d837c2 100644 --- a/src/core/hle/service/ptm_u.cpp +++ b/src/core/hle/service/ptm_u.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "common/make_unique.h" #include "core/hle/hle.h" @@ -148,7 +147,7 @@ Interface::Interface() { Service::FS::FormatArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path); // Open it again to get a valid archive now that the folder exists archive_result = Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path); - _assert_msg_(Service_PTM, archive_result.Succeeded(), "Could not open the PTM SharedExtSaveData archive!"); + ASSERT_MSG(archive_result.Succeeded(), "Could not open the PTM SharedExtSaveData archive!"); FileSys::Path gamecoin_path("gamecoin.dat"); FileSys::Mode open_mode = {}; diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp index 414c53c548..231ead1850 100644 --- a/src/core/hle/service/soc_u.cpp +++ b/src/core/hle/service/soc_u.cpp @@ -29,7 +29,6 @@ #include #endif -#include "common/log.h" #include "common/scope_exit.h" #include "core/hle/hle.h" #include "core/hle/service/soc_u.h" @@ -259,7 +258,7 @@ union CTRSockAddr { break; } default: - _dbg_assert_msg_(Service_SOC, false, "Unhandled address family (sa_family) in CTRSockAddr::ToPlatform"); + ASSERT_MSG(false, "Unhandled address family (sa_family) in CTRSockAddr::ToPlatform"); break; } return result; @@ -280,7 +279,7 @@ union CTRSockAddr { break; } default: - _dbg_assert_msg_(Service_SOC, false, "Unhandled address family (sa_family) in CTRSockAddr::ToPlatform"); + ASSERT_MSG(false, "Unhandled address family (sa_family) in CTRSockAddr::ToPlatform"); break; } return result; diff --git a/src/core/hle/service/ssl_c.cpp b/src/core/hle/service/ssl_c.cpp index 3f49c1c973..e634276fc5 100644 --- a/src/core/hle/service/ssl_c.cpp +++ b/src/core/hle/service/ssl_c.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/service/ssl_c.h" diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp index fc76d27219..a58e04d6dd 100644 --- a/src/core/hle/service/y2r_u.cpp +++ b/src/core/hle/service/y2r_u.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/log.h" #include "core/hle/hle.h" #include "core/hle/kernel/event.h" #include "core/hle/service/y2r_u.h" diff --git a/src/core/hle/shared_page.cpp b/src/core/hle/shared_page.cpp index 6033a53b4f..f5f2a68588 100644 --- a/src/core/hle/shared_page.cpp +++ b/src/core/hle/shared_page.cpp @@ -3,7 +3,6 @@ // Refer to the license.txt file included. #include "common/common_types.h" -#include "common/log.h" #include "core/core.h" #include "core/mem_map.h" diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 96da299234..17385f9b2f 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -175,7 +175,7 @@ static ResultCode WaitSynchronizationN(s32* out, Handle* handles, s32 handle_cou // NOTE: on real hardware, there is no nullptr check for 'out' (tested with firmware 4.4). If // this happens, the running application will crash. - _assert_msg_(Kernel, out != nullptr, "invalid output pointer specified!"); + ASSERT_MSG(out != nullptr, "invalid output pointer specified!"); // Check if 'handle_count' is invalid if (handle_count < 0) diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp index 5032006292..a63ba6eeb0 100644 --- a/src/core/hw/hw.cpp +++ b/src/core/hw/hw.cpp @@ -88,4 +88,4 @@ void Shutdown() { LOG_DEBUG(HW, "shutdown OK"); } -} \ No newline at end of file +} diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp index 0e3b81b28d..4f93c0e646 100644 --- a/src/core/mem_map_funcs.cpp +++ b/src/core/mem_map_funcs.cpp @@ -136,9 +136,9 @@ inline void Write(const VAddr vaddr, const T data) { *(T*)&g_dsp_mem[vaddr - DSP_MEMORY_VADDR] = data; //} else if ((vaddr & 0xFFFF0000) == 0x1FF80000) { - // _assert_msg_(MEMMAP, false, "umimplemented write to Configuration Memory"); + // ASSERT_MSG(MEMMAP, false, "umimplemented write to Configuration Memory"); //} else if ((vaddr & 0xFFFFF000) == 0x1FF81000) { - // _assert_msg_(MEMMAP, false, "umimplemented write to shared page"); + // ASSERT_MSG(MEMMAP, false, "umimplemented write to shared page"); // Error out... } else { diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index 12f0009bd2..8c4ec10444 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp @@ -16,7 +16,7 @@ #include -#include "common/log.h" +#include "common/assert.h" #include "common/file_util.h" #include "common/math_util.h" @@ -197,7 +197,7 @@ 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_(HW_GPU, 0, "Unknown output attribute mapping"); + DEBUG_ASSERT_MSG(false, "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(), @@ -571,7 +571,7 @@ const Math::Vec4 LookupTexture(const u8* source, int x, int y, const Texture default: LOG_ERROR(HW_GPU, "Unknown texture format: %x", (u32)info.format); - _dbg_assert_(HW_GPU, 0); + DEBUG_ASSERT(false); return {}; } } diff --git a/src/video_core/gpu_debugger.h b/src/video_core/gpu_debugger.h index a51d49c926..c2c8989920 100644 --- a/src/video_core/gpu_debugger.h +++ b/src/video_core/gpu_debugger.h @@ -8,8 +8,6 @@ #include #include -#include "common/log.h" - #include "core/hle/service/gsp_gpu.h" #include "command_processor.h" diff --git a/src/video_core/primitive_assembly.cpp b/src/video_core/primitive_assembly.cpp index 242a07e267..1776a19259 100644 --- a/src/video_core/primitive_assembly.cpp +++ b/src/video_core/primitive_assembly.cpp @@ -6,6 +6,7 @@ #include "primitive_assembly.h" #include "vertex_shader.h" +#include "common/logging/log.h" #include "video_core/debug_utils/debug_utils.h" namespace Pica { diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index 06fd8d1402..617c767e7a 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -216,7 +216,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, if (!texture.enabled) continue; - _dbg_assert_(HW_GPU, 0 != texture.config.address); + DEBUG_ASSERT(0 != texture.config.address); int s = (int)(uv[i].u() * float24::FromFloat32(static_cast(texture.config.width))).ToFloat32(); int t = (int)(uv[i].v() * float24::FromFloat32(static_cast(texture.config.height))).ToFloat32(); @@ -232,7 +232,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, default: LOG_ERROR(HW_GPU, "Unknown texture coordinate wrapping mode %x\n", (int)mode); - _dbg_assert_(HW_GPU, 0); + UNIMPLEMENTED(); return 0; } }; @@ -282,7 +282,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, default: LOG_ERROR(HW_GPU, "Unknown color combiner source %d\n", (int)source); - _dbg_assert_(HW_GPU, 0); + UNIMPLEMENTED(); return {}; } }; @@ -380,7 +380,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, default: LOG_ERROR(HW_GPU, "Unknown color combiner operation %d\n", (int)op); - _dbg_assert_(HW_GPU, 0); + UNIMPLEMENTED(); return {}; } }; @@ -404,7 +404,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, default: LOG_ERROR(HW_GPU, "Unknown alpha combiner operation %d\n", (int)op); - _dbg_assert_(HW_GPU, 0); + UNIMPLEMENTED(); 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 e982e3746d..42d0e597cd 100644 --- a/src/video_core/renderer_opengl/gl_shader_util.cpp +++ b/src/video_core/renderer_opengl/gl_shader_util.cpp @@ -3,7 +3,7 @@ // Refer to the license.txt file included. #include "gl_shader_util.h" -#include "common/log.h" +#include "common/logging/log.h" #include #include diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index aa47bd6167..735c0cf455 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -99,15 +99,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_OpenGL, framebuffer.color_format == GPU::Regs::PixelFormat::RGB8, + ASSERT_MSG(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_OpenGL, pixel_stride * 3 == framebuffer.stride); + ASSERT(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_OpenGL, pixel_stride % 4 == 0); + ASSERT(pixel_stride % 4 == 0); glBindTexture(GL_TEXTURE_2D, texture.handle); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint)pixel_stride); diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp index 48977380ef..0bd52231bf 100644 --- a/src/video_core/vertex_shader.cpp +++ b/src/video_core/vertex_shader.cpp @@ -146,13 +146,10 @@ static void ProcessShaderCode(VertexShaderState& state) { case Instruction::OpCodeType::Arithmetic: { bool is_inverted = 0 != (instr.opcode.GetInfo().subtype & Instruction::OpCodeInfo::SrcInversed); - if (is_inverted) { - // TODO: We don't really support this properly: For instance, the address register - // offset needs to be applied to SRC2 instead, etc. - // For now, we just abort in this situation. - LOG_CRITICAL(HW_GPU, "Bad condition..."); - exit(0); - } + // TODO: We don't really support this properly: For instance, the address register + // offset needs to be applied to SRC2 instead, etc. + // For now, we just abort in this situation. + ASSERT_MSG(!is_inverted, "Bad condition..."); const int address_offset = (instr.common.address_register_index == 0) ? 0 : state.address_registers[instr.common.address_register_index - 1]; @@ -342,7 +339,7 @@ static void ProcessShaderCode(VertexShaderState& state) { default: LOG_ERROR(HW_GPU, "Unhandled arithmetic instruction: 0x%02x (%s): 0x%08x", (int)instr.opcode.Value(), instr.opcode.GetInfo().name, instr.hex); - _dbg_assert_(HW_GPU, 0); + DEBUG_ASSERT(false); break; } diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index c9707e5f16..0a236595c0 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -4,7 +4,6 @@ #include "common/common.h" #include "common/emu_window.h" -#include "common/log.h" #include "core/core.h"