diff --git a/include/os_report.h b/include/os_report.h index 1fcf08bc57..78177a199d 100644 --- a/include/os_report.h +++ b/include/os_report.h @@ -31,4 +31,10 @@ extern u8 __OSReport_Warning_disable; extern u8 __OSReport_System_disable; extern u8 __OSReport_enable; +#if TARGET_PC +namespace dusk { + extern bool OSReportReallyForceEnable; +} +#endif + #endif // _OS_REPORT_H diff --git a/src/dusk/imgui/ImGuiMenuTools.cpp b/src/dusk/imgui/ImGuiMenuTools.cpp index e2537a264a..313d398498 100644 --- a/src/dusk/imgui/ImGuiMenuTools.cpp +++ b/src/dusk/imgui/ImGuiMenuTools.cpp @@ -45,6 +45,7 @@ namespace dusk { ImGui::MenuItem("Player Info", nullptr, &m_showPlayerInfo); ImGui::MenuItem("Save Editor", nullptr, &m_showSaveEditor); ImGui::MenuItem("Audio Debug", "F7", &m_showAudioDebug); + ImGui::MenuItem("OSReport Force", nullptr, &OSReportReallyForceEnable); ImGui::EndMenu(); } diff --git a/src/m_Do/m_Do_printf.cpp b/src/m_Do/m_Do_printf.cpp index f4ef1fad00..3cacece77d 100644 --- a/src/m_Do/m_Do_printf.cpp +++ b/src/m_Do/m_Do_printf.cpp @@ -21,6 +21,10 @@ u8 __OSReport_System_disable; u8 __OSReport_enable; +#if TARGET_PC +bool dusk::OSReportReallyForceEnable = false; +#endif + #ifdef __GEKKO__ asm void OSSwitchFiberEx(__REGISTER u32 param_0, __REGISTER u32 param_1, __REGISTER u32 param_2, __REGISTER u32 param_3, __REGISTER u32 code, __REGISTER u32 stack) { nofralloc @@ -153,6 +157,9 @@ void mDoPrintf_vprintf_Thread(char const* fmt, va_list args) { #endif vprintf(fmt, args); + if (dusk::OSReportReallyForceEnable) { + fflush(stdout); + } #if DEBUG if (thread != NULL) { @@ -170,12 +177,16 @@ void mDoPrintf_vprintf(char const* fmt, va_list args) { #if DEBUG mDoPrintf_vprintf_Thread(fmt, args); #else +#if !TARGET_PC u8* stackPtr = (u8*)OSGetStackPointer(); if (stackPtr < (u8*)currentThread->stackEnd + 0xA00 || stackPtr > currentThread->stackBase) { mDoPrintf_vprintf_Interrupt(fmt, args); } else { +#endif mDoPrintf_vprintf_Thread(fmt, args); +#if !TARGET_PC } +#endif #endif } } @@ -184,7 +195,11 @@ void mDoPrintf_VReport(const char* fmt, va_list args) { if (!print_initialized) { OSReportInit(); } +#if TARGET_PC + if (dusk::OSReportReallyForceEnable || __OSReport_enable || !__OSReport_disable) { +#else if (__OSReport_enable || !__OSReport_disable) { +#endif OSThread* currentThread = mDoExt_GetCurrentRunningThread(); if (__OSReport_MonopolyThread == NULL || __OSReport_MonopolyThread == currentThread) { mDoPrintf_vprintf(fmt, args);