diff --git a/include/d/d_stage.h b/include/d/d_stage.h index fdaea03826..7b29b2b193 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -7,6 +7,7 @@ #include "dusk/offset_ptr.h" #include "f_op/f_op_actor_mng.h" #include "global.h" +#include "os_report.h" enum StageType { /* 0x0 */ ST_FIELD, diff --git a/include/os_report.h b/include/os_report.h new file mode 100644 index 0000000000..1fcf08bc57 --- /dev/null +++ b/include/os_report.h @@ -0,0 +1,34 @@ +#ifndef _OS_REPORT_H +#define _OS_REPORT_H + +#include + +DECL_WEAK void OSAttention(const char* msg, ...); +DECL_WEAK void OSReport_Error(const char* fmt, ...); +DECL_WEAK void OSReport_FatalError(const char* fmt, ...); +DECL_WEAK void OSReport_System(const char* fmt, ...); +DECL_WEAK void OSReport_Warning(const char* fmt, ...); +DECL_WEAK void OSReportDisable(void); +DECL_WEAK void OSReportEnable(void); +DECL_WEAK void OSReportForceEnableOff(void); +DECL_WEAK void OSReportForceEnableOn(void); + +#if DEBUG +#define OS_REPORT(...) OSReport(__VA_ARGS__) +#define OS_WARNING(...) OSReport_Warning(__VA_ARGS__) +#define OS_REPORT_ERROR(...) OSReport_Error(__VA_ARGS__) +#define OS_PANIC(line, msg) OSPanic(__FILE__, line, msg) +#else +#define OS_REPORT(...) +#define OS_WARNING(...) +#define OS_REPORT_ERROR(...) +#define OS_PANIC(...) +#endif + +extern u8 __OSReport_disable; +extern u8 __OSReport_Error_disable; +extern u8 __OSReport_Warning_disable; +extern u8 __OSReport_System_disable; +extern u8 __OSReport_enable; + +#endif // _OS_REPORT_H diff --git a/libs/JSystem/include/JSystem/JSystem.h b/libs/JSystem/include/JSystem/JSystem.h index 2b2f1143d0..7b50fbc78f 100644 --- a/libs/JSystem/include/JSystem/JSystem.h +++ b/libs/JSystem/include/JSystem/JSystem.h @@ -7,4 +7,6 @@ #include "JSystem/JSystem.pch" // IWYU pragma: export #endif +#include "os_report.h" + #endif // JSYSTEM_H diff --git a/libs/JSystem/src/J2DGraph/J2DAnmLoader.cpp b/libs/JSystem/src/J2DGraph/J2DAnmLoader.cpp index 46c6764684..da177cd854 100644 --- a/libs/JSystem/src/J2DGraph/J2DAnmLoader.cpp +++ b/libs/JSystem/src/J2DGraph/J2DAnmLoader.cpp @@ -6,6 +6,7 @@ #include "JSystem/J2DGraph/J2DAnmLoader.h" #include "JSystem/JSupport/JSupport.h" +#include "os_report.h" J2DAnmBase* J2DAnmLoaderDataBase::load(void const* p_data) { const J3DAnmDataHeader* hdr = (const J3DAnmDataHeader*)p_data; diff --git a/libs/JSystem/src/J2DGraph/J2DMaterial.cpp b/libs/JSystem/src/J2DGraph/J2DMaterial.cpp index 57cccf8255..10381ade24 100644 --- a/libs/JSystem/src/J2DGraph/J2DMaterial.cpp +++ b/libs/JSystem/src/J2DGraph/J2DMaterial.cpp @@ -5,6 +5,7 @@ #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JUtility/JUTPalette.h" #include "JSystem/JUtility/JUTTexture.h" +#include "os_report.h" J2DMaterial::J2DMaterial() { field_0x4 = 0; diff --git a/libs/JSystem/src/JAudio2/dspproc.cpp b/libs/JSystem/src/JAudio2/dspproc.cpp index 8d4dd26dfe..a9c08e37ff 100644 --- a/libs/JSystem/src/JAudio2/dspproc.cpp +++ b/libs/JSystem/src/JAudio2/dspproc.cpp @@ -3,6 +3,7 @@ #include "JSystem/JAudio2/dspproc.h" #include "JSystem/JAudio2/dsptask.h" #include "JSystem/JAudio2/JASDSPInterface.h" +#include "os_report.h" void DSPReleaseHalt2(u32 msg) { u32 msgs[2]; diff --git a/libs/JSystem/src/JAudio2/dsptask.cpp b/libs/JSystem/src/JAudio2/dsptask.cpp index bbdf47d64a..86d6323333 100644 --- a/libs/JSystem/src/JAudio2/dsptask.cpp +++ b/libs/JSystem/src/JAudio2/dsptask.cpp @@ -3,6 +3,7 @@ #include "JSystem/JAudio2/dsptask.h" #include "JSystem/JAudio2/osdsp.h" #include "global.h" +#include "os_report.h" static void DspInitWork(); static void DspHandShake(void* param_0); diff --git a/libs/JSystem/src/JKernel/JKRAramArchive.cpp b/libs/JSystem/src/JKernel/JKRAramArchive.cpp index 5ed1bc181c..e318f41a64 100644 --- a/libs/JSystem/src/JKernel/JKRAramArchive.cpp +++ b/libs/JSystem/src/JKernel/JKRAramArchive.cpp @@ -9,6 +9,7 @@ #include "JSystem/JUtility/JUTException.h" #include #include +#include "os_report.h" JKRAramArchive::JKRAramArchive() {} diff --git a/libs/JSystem/src/JKernel/JKRAramHeap.cpp b/libs/JSystem/src/JKernel/JKRAramHeap.cpp index a1ea01f816..051a5a5c01 100644 --- a/libs/JSystem/src/JKernel/JKRAramHeap.cpp +++ b/libs/JSystem/src/JKernel/JKRAramHeap.cpp @@ -4,6 +4,7 @@ #include "JSystem/JKernel/JKRHeap.h" #include "global.h" #include +#include "os_report.h" JSUList JKRAramHeap::sAramList; diff --git a/libs/JSystem/src/JKernel/JKRDvdArchive.cpp b/libs/JSystem/src/JKernel/JKRDvdArchive.cpp index 77f0553844..67fca69658 100644 --- a/libs/JSystem/src/JKernel/JKRDvdArchive.cpp +++ b/libs/JSystem/src/JKernel/JKRDvdArchive.cpp @@ -10,6 +10,7 @@ #include #include "global.h" #include +#include "os_report.h" JKRDvdArchive::JKRDvdArchive(s32 entryNum, JKRArchive::EMountDirection mountDirection) : JKRArchive(entryNum, MOUNT_DVD) { diff --git a/libs/JSystem/src/JKernel/JKRHeap.cpp b/libs/JSystem/src/JKernel/JKRHeap.cpp index 14a719f3f7..87473072c4 100644 --- a/libs/JSystem/src/JKernel/JKRHeap.cpp +++ b/libs/JSystem/src/JKernel/JKRHeap.cpp @@ -22,6 +22,7 @@ #endif #include #include +#include "os_report.h" #if DEBUG u8 JKRValue_DEBUGFILL_NOTUSE = 0xFD; diff --git a/libs/JSystem/src/JKernel/JKRMemArchive.cpp b/libs/JSystem/src/JKernel/JKRMemArchive.cpp index 028139746c..d3b17d8a63 100644 --- a/libs/JSystem/src/JKernel/JKRMemArchive.cpp +++ b/libs/JSystem/src/JKernel/JKRMemArchive.cpp @@ -8,6 +8,7 @@ #include #include "global.h" #include +#include "os_report.h" JKRMemArchive::JKRMemArchive(s32 entryNum, JKRArchive::EMountDirection mountDirection) : JKRArchive(entryNum, MOUNT_MEM) { diff --git a/libs/JSystem/src/JParticle/JPAResourceLoader.cpp b/libs/JSystem/src/JParticle/JPAResourceLoader.cpp index 17b156964d..bb772448cc 100644 --- a/libs/JSystem/src/JParticle/JPAResourceLoader.cpp +++ b/libs/JSystem/src/JParticle/JPAResourceLoader.cpp @@ -11,6 +11,7 @@ #include "JSystem/JParticle/JPAKeyBlock.h" #include "JSystem/JParticle/JPAResource.h" #include "JSystem/JParticle/JPAResourceManager.h" +#include "os_report.h" static void dummy1() { JUT_WARN(0, "JPA : wrong version file %s\n"); diff --git a/libs/JSystem/src/JSupport/JSUInputStream.cpp b/libs/JSystem/src/JSupport/JSUInputStream.cpp index 10db7bdc96..30663eaa6a 100644 --- a/libs/JSystem/src/JSupport/JSUInputStream.cpp +++ b/libs/JSystem/src/JSupport/JSUInputStream.cpp @@ -7,6 +7,7 @@ #else #include #endif +#include "os_report.h" JSUInputStream::~JSUInputStream() { if (!isGood()) { diff --git a/libs/JSystem/src/JSupport/JSUOutputStream.cpp b/libs/JSystem/src/JSupport/JSUOutputStream.cpp index d9f4a78100..b254405e8b 100644 --- a/libs/JSystem/src/JSupport/JSUOutputStream.cpp +++ b/libs/JSystem/src/JSupport/JSUOutputStream.cpp @@ -8,6 +8,7 @@ #include #endif #include +#include "os_report.h" JSUOutputStream::~JSUOutputStream() { if (!isGood()) { diff --git a/libs/JSystem/src/JUtility/JUTGamePad.cpp b/libs/JSystem/src/JUtility/JUTGamePad.cpp index 71b5dbd24e..31b8d59f1a 100644 --- a/libs/JSystem/src/JUtility/JUTGamePad.cpp +++ b/libs/JSystem/src/JUtility/JUTGamePad.cpp @@ -2,6 +2,7 @@ #include "JSystem/JUtility/JUTGamePad.h" #include +#include "os_report.h" u32 JUTGamePad::CRumble::sChannelMask[4] = { PAD_CHAN0_BIT, diff --git a/libs/JSystem/src/JUtility/JUTTexture.cpp b/libs/JSystem/src/JUtility/JUTTexture.cpp index 271f036ba3..880895c880 100644 --- a/libs/JSystem/src/JUtility/JUTTexture.cpp +++ b/libs/JSystem/src/JUtility/JUTTexture.cpp @@ -3,6 +3,7 @@ #include "JSystem/JUtility/JUTTexture.h" #include "JSystem/JUtility/JUTPalette.h" #include +#include "os_report.h" JUTTexture::~JUTTexture() { if (getCaptureFlag()) { diff --git a/src/DynamicLink.cpp b/src/DynamicLink.cpp index f224eb43cf..969c485f55 100644 --- a/src/DynamicLink.cpp +++ b/src/DynamicLink.cpp @@ -11,6 +11,7 @@ #include #include "m_Do/m_Do_dvd_thread.h" #include "m_Do/m_Do_ext.h" +#include "os_report.h" DynamicModuleControlBase* DynamicModuleControlBase::mFirst; diff --git a/src/SSystem/SComponent/c_cc_s.cpp b/src/SSystem/SComponent/c_cc_s.cpp index 2690d49dbc..72df9625d8 100644 --- a/src/SSystem/SComponent/c_cc_s.cpp +++ b/src/SSystem/SComponent/c_cc_s.cpp @@ -6,6 +6,7 @@ #include "SSystem/SComponent/c_cc_s.h" #include "JSystem/JUtility/JUTAssert.h" #include +#include "os_report.h" #define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(line, !std::isnan(x)); #define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(line, -1.0e32f < x && x < 1.0e32f); diff --git a/src/SSystem/SComponent/c_m2d.cpp b/src/SSystem/SComponent/c_m2d.cpp index 9629819e55..6a11d01e2f 100644 --- a/src/SSystem/SComponent/c_m2d.cpp +++ b/src/SSystem/SComponent/c_m2d.cpp @@ -7,6 +7,7 @@ #include "SSystem/SComponent/c_m3d.h" #include "SSystem/SComponent/c_m3d_g_cir.h" #include "JSystem/JUtility/JUTAssert.h" +#include "os_report.h" void cM2d_CrossCirLin(cM2dGCir& param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4, f32* param_5, f32* param_6) { diff --git a/src/Z2AudioLib/Z2Creature.cpp b/src/Z2AudioLib/Z2Creature.cpp index 14b0d31023..ab1ea715d6 100644 --- a/src/Z2AudioLib/Z2Creature.cpp +++ b/src/Z2AudioLib/Z2Creature.cpp @@ -2,6 +2,7 @@ #include "Z2AudioLib/Z2Param.h" #include "Z2AudioLib/Z2Calc.h" #include "Z2AudioLib/Z2AudioMgr.h" +#include "os_report.h" static void Z2_E_sw_modPitch(Z2SoundHandlePool*, u32); static void Z2_E_ms_modVol(Z2SoundHandlePool*, u32); diff --git a/src/Z2AudioLib/Z2FxLineMgr.cpp b/src/Z2AudioLib/Z2FxLineMgr.cpp index 61d37c6785..55f54b99fa 100644 --- a/src/Z2AudioLib/Z2FxLineMgr.cpp +++ b/src/Z2AudioLib/Z2FxLineMgr.cpp @@ -4,6 +4,7 @@ #include "JSystem/JKernel/JKRArchive.h" #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JSupport/JSUMemoryStream.h" +#include "os_report.h" Z2FxLineMgr::Z2FxLineMgr() : JASGlobalInstance(true) { mConfig = NULL; diff --git a/src/Z2AudioLib/Z2SeqMgr.cpp b/src/Z2AudioLib/Z2SeqMgr.cpp index a9cad68b5e..da56da734e 100644 --- a/src/Z2AudioLib/Z2SeqMgr.cpp +++ b/src/Z2AudioLib/Z2SeqMgr.cpp @@ -8,6 +8,7 @@ #include "Z2AudioLib/Z2Calc.h" #include "JSystem/JAudio2/JAISoundChild.h" #include "JSystem/JAudio2/JAISeq.h" +#include "os_report.h" static const char* sSpotName[] = { "F_SP00", diff --git a/src/Z2AudioLib/Z2SoundObject.cpp b/src/Z2AudioLib/Z2SoundObject.cpp index 69b0dc3bad..5b6a768215 100644 --- a/src/Z2AudioLib/Z2SoundObject.cpp +++ b/src/Z2AudioLib/Z2SoundObject.cpp @@ -17,6 +17,7 @@ #if PLATFORM_WII || PLATFORM_SHIELD #include "Z2AudioCS/Z2AudioCS.h" #endif +#include "os_report.h" Z2SoundObjBase::Z2SoundObjBase() #if DEBUG diff --git a/src/Z2AudioLib/Z2WolfHowlMgr.cpp b/src/Z2AudioLib/Z2WolfHowlMgr.cpp index 5f34fab19c..7214ab20cf 100644 --- a/src/Z2AudioLib/Z2WolfHowlMgr.cpp +++ b/src/Z2AudioLib/Z2WolfHowlMgr.cpp @@ -6,6 +6,7 @@ #include "Z2AudioLib/Z2SoundMgr.h" #include "Z2AudioLib/Z2Audience.h" #include "d/d_demo.h" +#include "os_report.h" static f32 cPitchDown = 0.8909f; diff --git a/src/f_pc/f_pc_stdcreate_req.cpp b/src/f_pc/f_pc_stdcreate_req.cpp index 6d5ffd151c..fa8ac20ae6 100644 --- a/src/f_pc/f_pc_stdcreate_req.cpp +++ b/src/f_pc/f_pc_stdcreate_req.cpp @@ -15,6 +15,7 @@ #include #endif #include +#include "os_report.h" typedef struct standard_create_request_class { /* 0x00 */ create_request base; diff --git a/src/m_Do/m_Do_MemCard.cpp b/src/m_Do/m_Do_MemCard.cpp index 7832906589..0241677e6e 100644 --- a/src/m_Do/m_Do_MemCard.cpp +++ b/src/m_Do/m_Do_MemCard.cpp @@ -9,6 +9,7 @@ #include "m_Do/m_Do_ext.h" #include "m_Do/m_Do_MemCardRWmng.h" #include "m_Do/m_Do_Reset.h" +#include "os_report.h" #if PLATFORM_WII || PLATFORM_SHIELD #include diff --git a/src/m_Do/m_Do_Reset.cpp b/src/m_Do/m_Do_Reset.cpp index 88f840bbcd..c3a5fea739 100644 --- a/src/m_Do/m_Do_Reset.cpp +++ b/src/m_Do/m_Do_Reset.cpp @@ -17,6 +17,7 @@ #if !PLATFORM_GCN #include #endif +#include "os_report.h" static void my_OSCancelAlarmAll() {} diff --git a/src/m_Do/m_Do_dvd_thread.cpp b/src/m_Do/m_Do_dvd_thread.cpp index 999e01bb38..6a7e4a8bcf 100644 --- a/src/m_Do/m_Do_dvd_thread.cpp +++ b/src/m_Do/m_Do_dvd_thread.cpp @@ -13,6 +13,7 @@ #include "m_Do/m_Do_Reset.h" #include "m_Do/m_Do_controller_pad.h" #include "m_Do/m_Do_ext.h" +#include "os_report.h" s32 mDoDvdThd::main(void* param_0) { JKRThread(OSGetCurrentThread(), 0); diff --git a/src/m_Do/m_Do_machine.cpp b/src/m_Do/m_Do_machine.cpp index 9fbf2ae305..13c55de871 100644 --- a/src/m_Do/m_Do_machine.cpp +++ b/src/m_Do/m_Do_machine.cpp @@ -27,6 +27,7 @@ #include "m_Do/m_Do_machine_exception.h" #include "m_Do/m_Do_main.h" #include "DynamicLink.h" +#include "os_report.h" #if !PLATFORM_GCN #include diff --git a/src/m_Do/m_Do_mtx.cpp b/src/m_Do/m_Do_mtx.cpp index 3b8bcd137e..e0df166e8e 100644 --- a/src/m_Do/m_Do_mtx.cpp +++ b/src/m_Do/m_Do_mtx.cpp @@ -10,6 +10,7 @@ #include "SSystem/SComponent/c_m3d.h" #include "SSystem/SComponent/c_math.h" #include "global.h" +#include "os_report.h" Mtx mDoMtx_stack_c::now;