1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

Don't log "always" messages in fatal_error_listener until enabled

Opening the console breaks Qt cli popups
This commit is contained in:
Megamouse 2024-10-25 09:39:15 +02:00
parent 3ecb14dcda
commit 431221f172
2 changed files with 28 additions and 6 deletions

View File

@ -4790,7 +4790,7 @@ bool spu_thread::process_mfc_cmd()
getllar_spin_count = 0;
getllar_busy_waiting_switch = umax;
u64 ntime;
u64 ntime = 0;
rsx::reservation_lock rsx_lock(addr, 128);
for (u64 i = 0; i != umax; [&]()
@ -4896,7 +4896,7 @@ bool spu_thread::process_mfc_cmd()
// Avoid logging useless commands if there is no reservation
const bool dump = g_cfg.core.mfc_debug && raddr;
const bool is_spurs_task_wait = pc == 0x11e4 && spurs_addr != -0x80u;
const bool is_spurs_task_wait = pc == 0x11e4 && spurs_addr != 0u - 0x80u;
if (!is_spurs_task_wait || spurs_addr != raddr || spurs_waited)
{
@ -5570,6 +5570,8 @@ s64 spu_thread::get_ch_value(u32 ch)
thread_ctrl::wait_on(state, old);
}
fmt::throw_exception("Unreachable"); // Fix unannotated fallthrough warning
}
case MFC_RdTagStat:

View File

@ -252,11 +252,12 @@ LOG_CHANNEL(q_debug, "QDEBUG");
struct fatal_error_listener final : logs::listener
{
public:
~fatal_error_listener() override = default;
void log(u64 /*stamp*/, const logs::message& msg, const std::string& prefix, const std::string& text) override
{
if (msg <= logs::level::fatal)
if (msg == logs::level::fatal || (msg == logs::level::always && m_log_always))
{
std::string _msg = "RPCS3: ";
@ -276,10 +277,17 @@ struct fatal_error_listener final : logs::listener
_msg += '\n';
// If launched from CMD
utils::attach_console(utils::console_stream::std_err, false);
utils::attach_console(msg == logs::level::fatal ? utils::console_stream::std_err : utils::console_stream::std_out, false);
// Output to error stream as is
utils::output_stderr(_msg);
if (msg == logs::level::fatal)
{
utils::output_stderr(_msg);
}
else
{
std::cout << _msg;
}
#ifdef _WIN32
if (IsDebuggerPresent())
@ -295,6 +303,14 @@ struct fatal_error_listener final : logs::listener
}
}
}
void log_always(bool enabled)
{
m_log_always = enabled;
}
private:
bool m_log_always = false;
};
// Arguments that force a headless application (need to be checked in create_application)
@ -572,7 +588,7 @@ int main(int argc, char** argv)
log_file = logs::make_file_listener(log_name, stats.avail_free / 4);
}
static std::unique_ptr<logs::listener> fatal_listener = std::make_unique<fatal_error_listener>();
static std::unique_ptr<fatal_error_listener> fatal_listener = std::make_unique<fatal_error_listener>();
logs::listener::add(fatal_listener.get());
{
@ -1000,6 +1016,10 @@ int main(int argc, char** argv)
return 0;
}
// Enable console output of "always" log messages.
// Do this after parsing any Qt cli args that might open a window.
fatal_listener->log_always(true);
// Log unique ID
gui::utils::log_uuid();