diff --git a/Core/MIPS/MIPSTracer.cpp b/Core/MIPS/MIPSTracer.cpp index 20289a5d92..628f58adeb 100644 --- a/Core/MIPS/MIPSTracer.cpp +++ b/Core/MIPS/MIPSTracer.cpp @@ -100,6 +100,11 @@ void MIPSTracer::prepare_block(const MIPSComp::IRBlock* block, MIPSComp::IRBlock } bool MIPSTracer::flush_to_file() { + if (logging_path.empty()) { + WARN_LOG(Log::JIT, "The path is empty, cannot flush the trace!"); + return false; + } + INFO_LOG(Log::JIT, "Flushing the trace to a file..."); output = File::OpenCFile(logging_path, "w"); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 2545438e71..0199a7d2d7 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1894,16 +1894,16 @@ void DeveloperToolsScreen::CreateViews() { list->Add(new ItemHeader(dev->T("MIPSTracer"))); MIPSTracerEnabled_ = mipsTracer.tracing_enabled; - CheckBox *MIPSLoggerEnabled = new CheckBox(&MIPSTracerEnabled_, dev->T("MIPSTracer enabled")); - list->Add(MIPSLoggerEnabled)->OnClick.Handle(this, &DeveloperToolsScreen::OnMIPSTracerEnabled); - MIPSLoggerEnabled->SetEnabledFunc([]() { + CheckBox *MIPSTracerEnabled = new CheckBox(&MIPSTracerEnabled_, dev->T("MIPSTracer enabled")); + list->Add(MIPSTracerEnabled)->OnClick.Handle(this, &DeveloperToolsScreen::OnMIPSTracerEnabled); + MIPSTracerEnabled->SetEnabledFunc([]() { bool temp = g_Config.iCpuCore == static_cast(CPUCore::IR_INTERPRETER) && PSP_IsInited(); return temp && Core_IsStepping() && coreState != CORE_POWERDOWN; }); - Choice *MIPSlogging_path = list->Add(new Choice(dev->T("Select the output logging file"))); - MIPSlogging_path->OnClick.Handle(this, &DeveloperToolsScreen::OnMIPSTracerPathChanged); - MIPSlogging_path->SetEnabledFunc([]() { + Choice *TraceDumpPath = list->Add(new Choice(dev->T("Select the file path for the trace"))); + TraceDumpPath->OnClick.Handle(this, &DeveloperToolsScreen::OnMIPSTracerPathChanged); + TraceDumpPath->SetEnabledFunc([]() { if (!PSP_IsInited()) return false; return true; @@ -2159,10 +2159,9 @@ UI::EventReturn DeveloperToolsScreen::OnMIPSTracerPathChanged(UI::EventParams &e } UI::EventReturn DeveloperToolsScreen::OnMIPSTracerFlushTrace(UI::EventParams &e) { - bool success = mipsTracer.flush_to_file(); - if (!success) { - WARN_LOG(Log::JIT, "Error: cannot flush the trace to the specified file!"); - } + mipsTracer.flush_to_file(); + // The error logs are emitted inside the tracer + return UI::EVENT_DONE; }