Fix report_fatal_error duplicate messages

This commit is contained in:
Eladash 2024-01-01 19:52:20 +02:00 committed by Elad Ashkenazi
parent 2a1330083d
commit 4f06024d9f

View file

@ -86,7 +86,8 @@ static semaphore<> s_qt_init;
static atomic_t<bool> s_headless = false; static atomic_t<bool> s_headless = false;
static atomic_t<bool> s_no_gui = false; static atomic_t<bool> s_no_gui = false;
static atomic_t<char*> s_argv0; static atomic_t<char*> s_argv0 = nullptr;
static bool s_is_error_launch = false;
std::string g_input_config_override; std::string g_input_config_override;
@ -105,7 +106,11 @@ LOG_CHANNEL(q_debug, "QDEBUG");
#ifdef __linux__ #ifdef __linux__
extern void jit_announce(uptr, usz, std::string_view); extern void jit_announce(uptr, usz, std::string_view);
#endif #endif
std::string buf(_text); std::string buf;
if (!s_is_error_launch)
{
buf = std::string(_text);
// Check if thread id is in string // Check if thread id is in string
if (_text.find("\nThread id = "sv) == umax && !thread_ctrl::is_main()) if (_text.find("\nThread id = "sv) == umax && !thread_ctrl::is_main())
@ -122,8 +127,9 @@ LOG_CHANNEL(q_debug, "QDEBUG");
fmt::append(buf, "\nTitle: \"%s\" (emulation is %s)", Emu.GetTitleAndTitleID(), Emu.IsStopped() ? "stopped" : "running"); fmt::append(buf, "\nTitle: \"%s\" (emulation is %s)", Emu.GetTitleAndTitleID(), Emu.IsStopped() ? "stopped" : "running");
fmt::append(buf, "\nBuild: \"%s\"", rpcs3::get_verbose_version()); fmt::append(buf, "\nBuild: \"%s\"", rpcs3::get_verbose_version());
fmt::append(buf, "\nDate: \"%s\"", std::chrono::system_clock::now()); fmt::append(buf, "\nDate: \"%s\"", std::chrono::system_clock::now());
}
std::string_view text = buf; std::string_view text = s_is_error_launch ? _text : buf;
if (s_headless) if (s_headless)
{ {
@ -457,6 +463,7 @@ int main(int argc, char** argv)
error += argv[i]; error += argv[i];
} }
s_is_error_launch = true;
report_fatal_error(error); report_fatal_error(error);
} }