diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 8f3c90071ebdb..5c079715c40f0 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -77,7 +77,6 @@ target_sources(common PRIVATE
Timer.h
TextureDecompress.h
Threading.h
- TraceLog.h
VectorIntrin.h
WAVWriter.h
WindowInfo.h
diff --git a/common/Console.cpp b/common/Console.cpp
index 85091ad6a3908..b8f4cd5b81473 100644
--- a/common/Console.cpp
+++ b/common/Console.cpp
@@ -364,6 +364,7 @@ bool Log::SetFileOutputLevel(LOGLEVEL level, std::string path)
}
s_file_level = s_file_handle ? level : LOGLEVEL_NONE;
+ UpdateMaxLevel();
return IsFileOutputEnabled();
}
diff --git a/common/TraceLog.h b/common/TraceLog.h
deleted file mode 100644
index 02e76fbbf519b..0000000000000
--- a/common/TraceLog.h
+++ /dev/null
@@ -1,197 +0,0 @@
-// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
-// SPDX-License-Identifier: GPL-3.0+
-
-#pragma once
-
-#include "common/Assertions.h"
-#include "common/Console.h"
-#include "common/StringUtil.h"
-
-// --------------------------------------------------------------------------------------
-// TraceLogDescriptor
-// --------------------------------------------------------------------------------------
-// Provides textual information for use by UIs; to give the end user a selection screen for
-// enabling/disabling logs, and also for saving the log settings to INI.
-//
-struct TraceLogDescriptor
-{
- // short name, alphanumerics only: used for saving/loading options.
- const char* ShortName;
-
- // Standard UI name for this log source. Used in menus, options dialogs.
- const char* Name;
-
- // Length description for use as a tooltip or menu item description.
- const char* Description;
-
- const char* GetShortName() const
- {
- pxAssumeMsg(Name, "Tracelog descriptors require a valid name!");
- return ShortName ? ShortName : Name;
- }
-};
-
-// --------------------------------------------------------------------------------------
-// BaseTraceLogSource
-// --------------------------------------------------------------------------------------
-// This class houses the base attributes for any trace log (to file or to console), which
-// only includes the logfile's name, description, and enabled bit (for UIs and ini files),
-// and an IsActive() method for determining if the log should be written or not.
-//
-// Derived classes then provide their own Write/DoWrite functions that format and write
-// the log to the intended target(s).
-//
-// All individual calls to log write functions should be responsible for checking the
-// status of the log via the IsActive() method manually (typically done via macro). This
-// is done in favor of internal checks because most logs include detailed/formatted
-// information, which itself can take a lot of cpu power to prepare. If the IsActive()
-// check is done top-level, the parameters' calculations can be skipped. If the IsActive()
-// check is done internally as part of the Write/Format calls, all parameters have to be
-// resolved regardless of if the log is actually active.
-//
-class BaseTraceLogSource
-{
-protected:
- const TraceLogDescriptor* m_Descriptor;
-
-public:
- // Indicates if the user has enabled this specific log. This boolean only represents
- // the configured status of this log, and does *NOT* actually mean the log is active
- // even when TRUE. Because many tracelogs have master enablers that act on a group
- // of logs, logging checks should always use IsActive() instead to determine if a log
- // should be processed or not.
- bool Enabled;
-
-protected:
- BaseTraceLogSource()
- : m_Descriptor(NULL)
- , Enabled(false)
- {
- }
-
-public:
- BaseTraceLogSource(const TraceLogDescriptor* desc)
- {
- pxAssumeMsg(desc, "Trace logs must have a valid (non-NULL) descriptor.");
- Enabled = false;
- m_Descriptor = desc;
- }
-
- // Provides a categorical identifier, typically in "group.subgroup.subgroup" form.
- // (use periods in favor of colons, since they do not require escape characters when
- // written to ini/config files).
- virtual std::string GetCategory() const { return std::string(); }
-
- // This method should be used to determine if a log should be generated or not.
- // See the class overview comments for details on how and why this method should
- // be used.
- virtual bool IsActive() const { return Enabled; }
-
- virtual const char* GetShortName() const { return m_Descriptor->GetShortName(); }
- virtual const char* GetName() const { return m_Descriptor->Name; }
- virtual const char* GetDescription() const
- {
- return (m_Descriptor->Description != NULL) ? m_Descriptor->Description : "";
- }
-
- virtual bool HasDescription() const { return m_Descriptor->Description != NULL; }
-};
-
-// --------------------------------------------------------------------------------------
-// TextFileTraceLog
-// --------------------------------------------------------------------------------------
-// This class is tailored for performance logging to file. It does not support console
-// colors or wide/unicode text conversion.
-//
-class TextFileTraceLog : public BaseTraceLogSource
-{
-public:
- TextFileTraceLog(const TraceLogDescriptor* desc)
- : BaseTraceLogSource(desc)
- {
- }
-
- bool Write(const char* fmt, ...) const
- {
- va_list list;
- va_start(list, fmt);
- WriteV(fmt, list);
- va_end(list);
-
- return false;
- }
-
- bool WriteV(const char* fmt, va_list list) const
- {
- std::string ascii;
- ApplyPrefix(ascii);
- ascii += StringUtil::StdStringFromFormatV(fmt, list);
- DoWrite(ascii.c_str());
- return false;
- }
-
- virtual void ApplyPrefix(std::string& ascii) const {}
- virtual void DoWrite(const char* fmt) const = 0;
-};
-
-// --------------------------------------------------------------------------------------
-// ConsoleLogSource
-// --------------------------------------------------------------------------------------
-// This class is tailored for logging to console. It applies default console color attributes
-// to all writes, and supports both char and wxChar (Ascii and UF8/16) formatting.
-//
-class ConsoleLogSource : public BaseTraceLogSource
-{
-public:
- ConsoleColors DefaultColor;
-
-protected:
- ConsoleLogSource()
- : DefaultColor(Color_Gray)
- {
- }
-
-public:
- ConsoleLogSource(const TraceLogDescriptor* desc, ConsoleColors defaultColor = Color_Gray)
- : BaseTraceLogSource(desc)
- {
- DefaultColor = defaultColor;
- }
-
- // Writes to the console using the source's default color. Note that the source's default
- // color will always be used, thus ConsoleColorScope() will not be effectual unless the
- // console's default color is Color_Default.
- bool Write(const char* fmt, ...) const
- {
- va_list list;
- va_start(list, fmt);
- WriteV(fmt, list);
- va_end(list);
-
- return false;
- }
-
- // Writes to the console using the specified color. This overrides the default color setting
- // for this log.
- bool Write(ConsoleColors color, const char* fmt, ...) const
- {
- va_list list;
- va_start(list, fmt);
- WriteV(color, fmt, list);
- va_end(list);
-
- return false;
- }
-
- bool WriteV(const char* fmt, va_list list) const
- {
- Console.FormatV(fmt, list);
- return false;
- }
-
- bool WriteV(ConsoleColors color, const char* fmt, va_list list) const
- {
- Console.FormatV(color, fmt, list);
- return false;
- }
-};
diff --git a/pcsx2-qt/Settings/DebugSettingsWidget.cpp b/pcsx2-qt/Settings/DebugSettingsWidget.cpp
index ad811926d4cef..2d575c5aa7209 100644
--- a/pcsx2-qt/Settings/DebugSettingsWidget.cpp
+++ b/pcsx2-qt/Settings/DebugSettingsWidget.cpp
@@ -58,6 +58,88 @@ DebugSettingsWidget::DebugSettingsWidget(SettingsWindow* dialog, QWidget* parent
connect(m_ui.dumpGSDraws, &QCheckBox::checkStateChanged, this, &DebugSettingsWidget::onDrawDumpingChanged);
onDrawDumpingChanged();
+
+#ifdef PCSX2_DEVBUILD
+ //////////////////////////////////////////////////////////////////////////
+ // Trace Logging Settings
+ //////////////////////////////////////////////////////////////////////////
+
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEnable, "EmuCore/TraceLog", "Enabled", false);
+ dialog->registerWidgetHelp(m_ui.chkEnable, tr("Enable Trace Logging"), tr("Unchecked"), tr("Globally enable / disable trace logging."));
+
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEEBIOS, "EmuCore/TraceLog", "EE.bios", false);
+ dialog->registerWidgetHelp(m_ui.chkEEBIOS, tr("EE BIOS"), tr("Unchecked"), tr("Log SYSCALL and DECI2 activity."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEEMemory, "EmuCore/TraceLog", "EE.memory", false);
+ dialog->registerWidgetHelp(m_ui.chkEEMemory, tr("EE Memory"), tr("Unchecked"), tr("Log memory access to unknown or unmapped EE memory."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEER5900, "EmuCore/TraceLog", "EE.r5900", false);
+ dialog->registerWidgetHelp(m_ui.chkEER5900, tr("EE R5900"), tr("Unchecked"), tr("Log R5900 core instructions (excluding COPs). Requires modifying the PCSX2 source and enabling the interpreter."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEECOP0, "EmuCore/TraceLog", "EE.cop0", false);
+ dialog->registerWidgetHelp(m_ui.chkEECOP0, tr("EE COP0"), tr("Unchecked"), tr("Log COP0 (MMU, CPU status, etc) instructions."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEECOP1, "EmuCore/TraceLog", "EE.cop1", false);
+ dialog->registerWidgetHelp(m_ui.chkEECOP1, tr("EE COP1"), tr("Unchecked"), tr("Log COP1 (FPU) instructions."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEECOP2, "EmuCore/TraceLog", "EE.cop2", false);
+ dialog->registerWidgetHelp(m_ui.chkEECOP2, tr("EE COP2"), tr("Unchecked"), tr("Log COP2 (VU0 Macro mode) instructions."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEECache, "EmuCore/TraceLog", "EE.cache", false);
+ dialog->registerWidgetHelp(m_ui.chkEECache, tr("EE Cache"), tr("Unchecked"), tr("Log EE cache activity."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEEMMIO, "EmuCore/TraceLog", "EE.knownhw", false);
+ dialog->registerWidgetHelp(m_ui.chkEEMMIO, tr("EE Known MMIO"), tr("Unchecked"), tr("Log known MMIO accesses."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEEUNKNWNMMIO, "EmuCore/TraceLog", "EE.unknownhw", false);
+ dialog->registerWidgetHelp(m_ui.chkEEUNKNWNMMIO, tr("EE Unknown MMIO"), tr("Unchecked"), tr("Log unknown or unimplemented MMIO accesses."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEEDMARegs, "EmuCore/TraceLog", "EE.dmahw", false);
+ dialog->registerWidgetHelp(m_ui.chkEEDMARegs, tr("EE DMA Registers"), tr("Unchecked"), tr("Log DMA-related MMIO accesses."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEEIPU, "EmuCore/TraceLog", "EE.ipu", false);
+ dialog->registerWidgetHelp(m_ui.chkEEIPU, tr("EE IPU"), tr("Unchecked"), tr("Log IPU activity; MMIO, decoding operations, DMA status, etc."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEEGIFTags, "EmuCore/TraceLog", "EE.giftag", false);
+ dialog->registerWidgetHelp(m_ui.chkEEGIFTags, tr("EE GIF Tags"), tr("Unchecked"), tr("Log GIFtag parsing activity."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEEVIFCodes, "EmuCore/TraceLog", "EE.vifcode", false);
+ dialog->registerWidgetHelp(m_ui.chkEEVIFCodes, tr("EE VIF Codes"), tr("Unchecked"), tr("Log VIFcode processing; command, tag style, interrupts."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEEMSKPATH3, "EmuCore/TraceLog", "EE.mskpath3", false);
+ dialog->registerWidgetHelp(m_ui.chkEEMSKPATH3, tr("EE MSKPATH3"), tr("Unchecked"), tr("Log Path3 Masking processing."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEEMFIFO, "EmuCore/TraceLog", "EE.spr", false);
+ dialog->registerWidgetHelp(m_ui.chkEEMFIFO, tr("EE MFIFO"), tr("Unchecked"), tr("Log Scratchpad MFIFO activity."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEEDMACTRL, "EmuCore/TraceLog", "EE.dmac", false);
+ dialog->registerWidgetHelp(m_ui.chkEEDMACTRL, tr("EE DMA Controller"), tr("Unchecked"), tr("Log DMA transfer activity. Stalls, bus right arbitration, etc."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEECounters, "EmuCore/TraceLog", "EE.counters", false);
+ dialog->registerWidgetHelp(m_ui.chkEECounters, tr("EE Counters"), tr("Unchecked"), tr("Log all EE counters events and some counter register activity."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEEVIF, "EmuCore/TraceLog", "EE.vif", false);
+ dialog->registerWidgetHelp(m_ui.chkEEVIF, tr("EE VIF"), tr("Unchecked"), tr("Log various VIF and VIFcode processing data."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEEGIF, "EmuCore/TraceLog", "EE.gif", false);
+ dialog->registerWidgetHelp(m_ui.chkEEGIF, tr("EE GIF"), tr("Unchecked"), tr("Log various GIF and GIFtag parsing data."));
+
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkIOPBIOS, "EmuCore/TraceLog", "IOP.Bios", false);
+ dialog->registerWidgetHelp(m_ui.chkIOPBIOS, tr("IOP BIOS"), tr("Unchecked"), tr("Log SYSCALL and IRX activity."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkIOPMemcards, "EmuCore/TraceLog", "IOP.memcards", false);
+ dialog->registerWidgetHelp(m_ui.chkIOPMemcards, tr("IOP Memcards"), tr("Unchecked"), tr("Log memory card activity. Reads, Writes, erases, etc."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkIOPR3000A, "EmuCore/TraceLog", "IOP.r3000a", false);
+ dialog->registerWidgetHelp(m_ui.chkIOPR3000A, tr("IOP R3000A"), tr("Unchecked"), tr("Log R3000A core instructions (excluding COPs)."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkIOPCOP2, "EmuCore/TraceLog", "IOP.cop2", false);
+ dialog->registerWidgetHelp(m_ui.chkIOPCOP2, tr("IOP COP2"), tr("Unchecked"), tr("Log IOP GPU co-processor instructions."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkIOPMMIO, "EmuCore/TraceLog", "IOP.knownhw", false);
+ dialog->registerWidgetHelp(m_ui.chkIOPMMIO, tr("IOP Known MMIO"), tr("Unchecked"), tr("Log known MMIO accesses."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkIOPUNKNWNMMIO, "EmuCore/TraceLog", "IOP.unknownhw", false);
+ dialog->registerWidgetHelp(m_ui.chkIOPUNKNWNMMIO, tr("IOP Unknown MMIO"), tr("Unchecked"), tr("Log unknown or unimplemented MMIO accesses."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkIOPDMARegs, "EmuCore/TraceLog", "IOP.dmahw", false);
+ dialog->registerWidgetHelp(m_ui.chkIOPDMARegs, tr("IOP DMA Registers"), tr("Unchecked"), tr("Log DMA-related MMIO accesses."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkIOPPad, "EmuCore/TraceLog", "IOP.pad", false);
+ dialog->registerWidgetHelp(m_ui.chkIOPPad, tr("IOP PAD"), tr("Unchecked"), tr("Log PAD activity."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkIOPDMACTRL, "EmuCore/TraceLog", "IOP.dmac", false);
+ dialog->registerWidgetHelp(m_ui.chkIOPDMACTRL, tr("IOP DMA Controller"), tr("Unchecked"), tr("Log DMA transfer activity. Stalls, bus right arbitration, etc."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkIOPCounters, "EmuCore/TraceLog", "IOP.counters", false);
+ dialog->registerWidgetHelp(m_ui.chkIOPCounters, tr("IOP Counters"), tr("Unchecked"), tr("Log all IOP counters events and some counter register activity."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkIOPCDVD, "EmuCore/TraceLog", "IOP.cdvd", false);
+ dialog->registerWidgetHelp(m_ui.chkIOPCDVD, tr("IOP CDVD"), tr("Unchecked"), tr("Log CDVD hardware activity."));
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkIOPMDEC, "EmuCore/TraceLog", "IOP.mdec", false);
+ dialog->registerWidgetHelp(m_ui.chkIOPMDEC, tr("IOP MDEC"), tr("Unchecked"), tr("Log Motion (FMV) Decoder hardware unit activity."));
+
+ SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.chkEESIF, "EmuCore/TraceLog", "MDEC.sif", false);
+ dialog->registerWidgetHelp(m_ui.chkEESIF, tr("EE SIF"), tr("Unchecked"), tr("Log SIF (EE <-> IOP) activity."));
+
+ connect(m_ui.chkEnable, &QCheckBox::checkStateChanged, this, &DebugSettingsWidget::onLoggingEnableChanged);
+ onLoggingEnableChanged();
+
+ #else
+ m_ui.debugTabs->removeTab(m_ui.debugTabs->indexOf(m_ui.traceLogTabWidget));
+ #endif
}
DebugSettingsWidget::~DebugSettingsWidget() = default;
@@ -70,3 +152,47 @@ void DebugSettingsWidget::onDrawDumpingChanged()
m_ui.saveTexture->setEnabled(enabled);
m_ui.saveDepth->setEnabled(enabled);
}
+
+#ifdef PCSX2_DEVBUILD
+void DebugSettingsWidget::onLoggingEnableChanged()
+{
+ const bool enabled = m_dialog->getEffectiveBoolValue("EmuCore/TraceLog", "Enabled", false);
+
+ m_ui.chkEEBIOS->setEnabled(enabled);
+ m_ui.chkEEMemory->setEnabled(enabled);
+ m_ui.chkEER5900->setEnabled(enabled);
+ m_ui.chkEECOP0->setEnabled(enabled);
+ m_ui.chkEECOP1->setEnabled(enabled);
+ m_ui.chkEECOP2->setEnabled(enabled);
+ m_ui.chkEECache->setEnabled(enabled);
+ m_ui.chkEEMMIO->setEnabled(enabled);
+ m_ui.chkEEUNKNWNMMIO->setEnabled(enabled);
+ m_ui.chkEEDMARegs->setEnabled(enabled);
+ m_ui.chkEEIPU->setEnabled(enabled);
+ m_ui.chkEEGIFTags->setEnabled(enabled);
+ m_ui.chkEEVIFCodes->setEnabled(enabled);
+ m_ui.chkEEMSKPATH3->setEnabled(enabled);
+ m_ui.chkEEMFIFO->setEnabled(enabled);
+ m_ui.chkEEDMACTRL->setEnabled(enabled);
+ m_ui.chkEECounters->setEnabled(enabled);
+ m_ui.chkEEVIF->setEnabled(enabled);
+ m_ui.chkEEGIF->setEnabled(enabled);
+ m_ui.chkEESIF->setEnabled(enabled);
+
+ m_ui.chkIOPBIOS->setEnabled(enabled);
+ m_ui.chkIOPMemcards->setEnabled(enabled);
+ m_ui.chkIOPR3000A->setEnabled(enabled);
+ m_ui.chkIOPCOP2->setEnabled(enabled);
+ m_ui.chkIOPMMIO->setEnabled(enabled);
+ m_ui.chkIOPUNKNWNMMIO->setEnabled(enabled);
+ m_ui.chkIOPDMARegs->setEnabled(enabled);
+ m_ui.chkIOPMemcards->setEnabled(enabled);
+ m_ui.chkIOPPad->setEnabled(enabled);
+ m_ui.chkIOPDMACTRL->setEnabled(enabled);
+ m_ui.chkIOPCounters->setEnabled(enabled);
+ m_ui.chkIOPCDVD->setEnabled(enabled);
+ m_ui.chkIOPMDEC->setEnabled(enabled);
+
+ g_emu_thread->applySettings();
+}
+#endif
diff --git a/pcsx2-qt/Settings/DebugSettingsWidget.h b/pcsx2-qt/Settings/DebugSettingsWidget.h
index 114df0656fb95..c8999e9839c6c 100644
--- a/pcsx2-qt/Settings/DebugSettingsWidget.h
+++ b/pcsx2-qt/Settings/DebugSettingsWidget.h
@@ -20,6 +20,9 @@ class DebugSettingsWidget : public QWidget
private Q_SLOTS:
void onDrawDumpingChanged();
+#ifdef PCSX2_DEVBUILD
+ void onLoggingEnableChanged();
+#endif
private:
SettingsWindow* m_dialog;
diff --git a/pcsx2-qt/Settings/DebugSettingsWidget.ui b/pcsx2-qt/Settings/DebugSettingsWidget.ui
index a2d60f979ed9f..b242da8be4e2c 100644
--- a/pcsx2-qt/Settings/DebugSettingsWidget.ui
+++ b/pcsx2-qt/Settings/DebugSettingsWidget.ui
@@ -24,7 +24,7 @@
0
-
-
+
0
@@ -35,7 +35,7 @@
Analysis
-
+
0
@@ -289,6 +289,300 @@
+
+
+ Trace Logging
+
+
+ -
+
+
+ Enable
+
+
+
+ -
+
+
-
+
+
+ EE
+
+
+
-
+
+
-
+
+
+ DMA Control
+
+
+
+ -
+
+
+ SPR / MFIFO
+
+
+
+ -
+
+
+ VIF
+
+
+
+ -
+
+
+ COP1 (FPU)
+
+
+
+ -
+
+
+ MSKPATH3
+
+
+
+ -
+
+
+ Cache
+
+
+
+ -
+
+
+ GIF
+
+
+
+ -
+
+
+ R5900
+
+
+
+ -
+
+
+ COP0
+
+
+
+ -
+
+
+ HW Regs (MMIO)
+
+
+
+ -
+
+
+ Counters
+
+
+
+ -
+
+
+ SIF
+
+
+
+ -
+
+
+ COP2 (VU0 Macro)
+
+
+
+ -
+
+
+ VIFCodes
+
+
+
+ -
+
+
+ Memory
+
+
+
+ -
+
+
+ Unknown MMIO
+
+
+
+ -
+
+
+ IPU
+
+
+
+ -
+
+
+ BIOS
+
+
+
+ -
+
+
+ DMA Registers
+
+
+
+ -
+
+
+ GIFTags
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 0
+
+
+
+
+
+
+
+ -
+
+
+ IOP
+
+
+
-
+
+
-
+
+
+ Counters
+
+
+
+ -
+
+
+ Unknown MMIO
+
+
+
+ -
+
+
+ HW Regs (MMIO)
+
+
+
+ -
+
+
+ CDVD
+
+
+
+ -
+
+
+ R3000A
+
+
+
+ -
+
+
+ Memcards
+
+
+
+ -
+
+
+ DMA Registers
+
+
+
+ -
+
+
+ Pad
+
+
+
+ -
+
+
+ BIOS
+
+
+
+ -
+
+
+ MDEC
+
+
+
+ -
+
+
+ DMA Control
+
+
+
+ -
+
+
+ COP2 (GPU)
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pcsx2/Config.h b/pcsx2/Config.h
index 94d54409b6859..88f4da719ce00 100644
--- a/pcsx2/Config.h
+++ b/pcsx2/Config.h
@@ -450,41 +450,82 @@ enum class GSNativeScaling : u8
};
// --------------------------------------------------------------------------------------
-// TraceFiltersEE
+// TraceLogsEE
// --------------------------------------------------------------------------------------
-struct TraceFiltersEE
+struct TraceLogsEE
{
+ // EE
BITFIELD32()
bool
- m_EnableAll : 1, // Master Enable switch (if false, no logs at all)
- m_EnableDisasm : 1,
- m_EnableRegisters : 1,
- m_EnableEvents : 1; // Enables logging of event-driven activity -- counters, DMAs, etc.
+ bios : 1,
+ memory : 1,
+ giftag : 1,
+ vifcode : 1,
+ mskpath3 : 1,
+ r5900 : 1,
+ cop0 : 1,
+ cop1 : 1,
+ cop2 : 1,
+ cache : 1,
+ knownhw : 1,
+ unknownhw : 1,
+ dmahw : 1,
+ ipu : 1,
+ dmac : 1,
+ counters : 1,
+ spr : 1,
+ vif : 1,
+ gif : 1;
BITFIELD_END
- TraceFiltersEE();
+ TraceLogsEE();
- bool operator==(const TraceFiltersEE& right) const;
- bool operator!=(const TraceFiltersEE& right) const;
+ bool operator==(const TraceLogsEE& right) const;
+ bool operator!=(const TraceLogsEE& right) const;
};
// --------------------------------------------------------------------------------------
-// TraceFiltersIOP
+// TraceLogsIOP
// --------------------------------------------------------------------------------------
-struct TraceFiltersIOP
+struct TraceLogsIOP
{
BITFIELD32()
bool
- m_EnableAll : 1, // Master Enable switch (if false, no logs at all)
- m_EnableDisasm : 1,
- m_EnableRegisters : 1,
- m_EnableEvents : 1; // Enables logging of event-driven activity -- counters, DMAs, etc.
+ bios : 1,
+ memcards : 1,
+ pad : 1,
+ r3000a : 1,
+ cop2 : 1,
+ memory : 1,
+ knownhw : 1,
+ unknownhw : 1,
+ dmahw : 1,
+ dmac : 1,
+ counters : 1,
+ cdvd : 1,
+ mdec : 1;
BITFIELD_END
- TraceFiltersIOP();
+ TraceLogsIOP();
- bool operator==(const TraceFiltersIOP& right) const;
- bool operator!=(const TraceFiltersIOP& right) const;
+ bool operator==(const TraceLogsIOP& right) const;
+ bool operator!=(const TraceLogsIOP& right) const;
+};
+
+// --------------------------------------------------------------------------------------
+// TraceLogsMISC
+// --------------------------------------------------------------------------------------
+struct TraceLogsMISC
+{
+ BITFIELD32()
+ bool
+ sif : 1;
+ BITFIELD_END
+
+ TraceLogsMISC();
+
+ bool operator==(const TraceLogsMISC& right) const;
+ bool operator!=(const TraceLogsMISC& right) const;
};
// --------------------------------------------------------------------------------------
@@ -492,21 +533,18 @@ struct TraceFiltersIOP
// --------------------------------------------------------------------------------------
struct TraceLogFilters
{
- // Enabled - global toggle for high volume logging. This is effectively the equivalent to
- // (EE.Enabled() || IOP.Enabled() || SIF) -- it's cached so that we can use the macros
- // below to inline the conditional check. This is desirable because these logs are
- // *very* high volume, and debug builds get noticably slower if they have to invoke
- // methods/accessors to test the log enable bits. Debug builds are slow enough already,
- // so I prefer this to help keep them usable.
bool Enabled;
- TraceFiltersEE EE;
- TraceFiltersIOP IOP;
+ TraceLogsEE EE;
+ TraceLogsIOP IOP;
+ TraceLogsMISC MISC;
TraceLogFilters();
void LoadSave(SettingsWrapper& ini);
-
+ // When logging, the tracelogpack is checked, not was in the config.
+ // Call this to sync the tracelogpack values with the config values.
+ void SyncToConfig() const;
bool operator==(const TraceLogFilters& right) const;
bool operator!=(const TraceLogFilters& right) const;
};
diff --git a/pcsx2/Counters.cpp b/pcsx2/Counters.cpp
index 7b12f3acd16ff..432a0f72d89e3 100644
--- a/pcsx2/Counters.cpp
+++ b/pcsx2/Counters.cpp
@@ -499,8 +499,7 @@ static __fi void VSyncStart(u32 sCycle)
// Poll input after MTGS frame push, just in case it has to stall to catch up.
VMManager::Internal::PollInputOnCPUThread();
- if (EmuConfig.Trace.Enabled && EmuConfig.Trace.EE.m_EnableAll)
- SysTrace.EE.Counters.Write(" ================ EE COUNTER VSYNC START (frame: %d) ================", g_FrameCount);
+ EECNT_LOG(" ================ EE COUNTER VSYNC START (frame: %d) ================", g_FrameCount);
// Memcard auto ejection - Uses a tick system timed off of real time, decrementing one tick per frame.
AutoEject::CountDownTicks();
@@ -564,8 +563,7 @@ static __fi void GSVSync()
static __fi void VSyncEnd(u32 sCycle)
{
- if (EmuConfig.Trace.Enabled && EmuConfig.Trace.EE.m_EnableAll)
- SysTrace.EE.Counters.Write(" ================ EE COUNTER VSYNC END (frame: %d) ================", g_FrameCount);
+ EECNT_LOG(" ================ EE COUNTER VSYNC END (frame: %d) ================", g_FrameCount);
g_FrameCount++;
if (!GSSMODE1reg.SINT)
diff --git a/pcsx2/DebugTools/Debug.h b/pcsx2/DebugTools/Debug.h
index 5172eaf89b8fb..1263fa711d9c0 100644
--- a/pcsx2/DebugTools/Debug.h
+++ b/pcsx2/DebugTools/Debug.h
@@ -3,15 +3,12 @@
#pragma once
-#include "common/TraceLog.h"
+#include "common/Console.h"
#include "Config.h"
#include "Memory.h"
#include
-// TODO: Purge emuLog and all this other nonsense, just go through Log with LOGLEVEL_TRACE.
-extern FILE *emuLog;
-
extern char* disVU0MicroUF(u32 code, u32 pc);
extern char* disVU0MicroLF(u32 code, u32 pc);
extern char* disVU1MicroUF(u32 code, u32 pc);
@@ -19,16 +16,16 @@ extern char* disVU1MicroLF(u32 code, u32 pc);
namespace R5900
{
- void disR5900Fasm( std::string& output, u32 code, u32 pc, bool simplify = false);
-
- extern const char * const GPR_REG[32];
- extern const char * const COP0_REG[32];
- extern const char * const COP1_REG_FP[32];
- extern const char * const COP1_REG_FCR[32];
- extern const char * const COP2_REG_FP[32];
- extern const char * const COP2_REG_CTL[32];
- extern const char * const COP2_VFnames[4];
- extern const char * const GS_REG_PRIV[19];
+ void disR5900Fasm(std::string& output, u32 code, u32 pc, bool simplify = false);
+
+ extern const char* const GPR_REG[32];
+ extern const char* const COP0_REG[32];
+ extern const char* const COP1_REG_FP[32];
+ extern const char* const COP1_REG_FCR[32];
+ extern const char* const COP2_REG_FP[32];
+ extern const char* const COP2_REG_CTL[32];
+ extern const char* const COP2_VFnames[4];
+ extern const char* const GS_REG_PRIV[19];
extern const u32 GS_REG_PRIV_ADDR[19];
}
@@ -40,163 +37,50 @@ namespace R3000A
extern char* disR3000AF(u32 code, u32 pc);
}
-// this structure uses old fashioned C-style "polymorphism". The base struct TraceLogDescriptor
-// must always be the first member in the struct.
-struct SysTraceLogDescriptor
-{
- TraceLogDescriptor base;
- const char* Prefix;
-};
-
-// --------------------------------------------------------------------------------------
-// SysTraceLog
-// --------------------------------------------------------------------------------------
-// Default trace log for high volume VM/System logging.
-// This log dumps to emuLog.txt directly and has no ability to pipe output
-// to the console (due to the console's inability to handle extremely high
-// logging volume).
-class SysTraceLog : public TextFileTraceLog
+struct LogDescriptor
{
-public:
- // Pass me a NULL and you *will* suffer! Muahahaha.
- SysTraceLog( const SysTraceLogDescriptor* desc )
- : TextFileTraceLog( &desc->base ) {}
-
- void DoWrite( const char *fmt ) const override;
- bool IsActive() const override
- {
- return EmuConfig.Trace.Enabled && Enabled;
- }
+ std::string Prefix;
+ std::string Name;
+ std::string Description;
};
-class SysTraceLog_EE : public SysTraceLog
+struct LogBase
{
- typedef SysTraceLog _parent;
-
-public:
- SysTraceLog_EE( const SysTraceLogDescriptor* desc ) : _parent( desc ) {}
-
- void ApplyPrefix( std::string& ascii ) const override;
- bool IsActive() const override
- {
- return SysTraceLog::IsActive() && EmuConfig.Trace.EE.m_EnableAll;
- }
-
- std::string GetCategory() const override { return "EE"; }
-};
-
-class SysTraceLog_VIFcode : public SysTraceLog_EE
-{
- typedef SysTraceLog_EE _parent;
-
-public:
- SysTraceLog_VIFcode( const SysTraceLogDescriptor* desc ) : _parent( desc ) {}
-
- void ApplyPrefix(std::string& ascii ) const override;
-};
-
-class SysTraceLog_EE_Disasm : public SysTraceLog_EE
-{
- typedef SysTraceLog_EE _parent;
-
-public:
- SysTraceLog_EE_Disasm( const SysTraceLogDescriptor* desc ) : _parent( desc ) {}
-
- bool IsActive() const override
- {
- return _parent::IsActive() && EmuConfig.Trace.EE.m_EnableDisasm;
- }
-
- std::string GetCategory() const override { return _parent::GetCategory() + ".Disasm"; }
-};
-
-class SysTraceLog_EE_Registers : public SysTraceLog_EE
-{
- typedef SysTraceLog_EE _parent;
-
-public:
- SysTraceLog_EE_Registers( const SysTraceLogDescriptor* desc ) : _parent( desc ) {}
-
- bool IsActive() const override
- {
- return _parent::IsActive() && EmuConfig.Trace.EE.m_EnableRegisters;
- }
-
- std::string GetCategory() const override { return _parent::GetCategory() + ".Registers"; }
+ const LogDescriptor& Descriptor;
+ ConsoleColors Color;
+ bool Enabled = false;
+ LogBase(const LogDescriptor& descriptor, ConsoleColors color = Color_Gray)
+ : Descriptor(descriptor)
+ , Color(color) {};
};
-class SysTraceLog_EE_Events : public SysTraceLog_EE
-{
- typedef SysTraceLog_EE _parent;
-
-public:
- SysTraceLog_EE_Events( const SysTraceLogDescriptor* desc ) : _parent( desc ) {}
-
- bool IsActive() const override
- {
- return _parent::IsActive() && EmuConfig.Trace.EE.m_EnableEvents;
- }
-
- std::string GetCategory() const override { return _parent::GetCategory() + ".Events"; }
-};
-
-
-class SysTraceLog_IOP : public SysTraceLog
-{
- typedef SysTraceLog _parent;
-
-public:
- SysTraceLog_IOP( const SysTraceLogDescriptor* desc ) : _parent( desc ) {}
-
- void ApplyPrefix( std::string& ascii ) const override;
- bool IsActive() const override
- {
- return SysTraceLog::IsActive() && EmuConfig.Trace.IOP.m_EnableAll;
- }
-
- std::string GetCategory() const override { return "IOP"; }
-};
-
-class SysTraceLog_IOP_Disasm : public SysTraceLog_IOP
-{
- typedef SysTraceLog_IOP _parent;
-
-public:
- SysTraceLog_IOP_Disasm( const SysTraceLogDescriptor* desc ) : _parent( desc ) {}
- bool IsActive() const override
- {
- return _parent::IsActive() && EmuConfig.Trace.IOP.m_EnableDisasm;
- }
-
- std::string GetCategory() const override { return _parent::GetCategory() + ".Disasm"; }
-};
-
-class SysTraceLog_IOP_Registers : public SysTraceLog_IOP
+// --------------------------------------------------------------------------------------
+// TraceLog
+// --------------------------------------------------------------------------------------
+struct TraceLog : public LogBase
{
- typedef SysTraceLog_IOP _parent;
+ TraceLog(const LogDescriptor& descriptor, ConsoleColors color = Color_Gray)
+ : LogBase(descriptor, color) {};
-public:
- SysTraceLog_IOP_Registers( const SysTraceLogDescriptor* desc ) : _parent( desc ) {}
- bool IsActive() const override
+ bool Write(const char* fmt, ...) const;
+ bool Write(ConsoleColors color, const char* fmt, ...) const;
+ bool IsActive() const
{
- return _parent::IsActive() && EmuConfig.Trace.IOP.m_EnableRegisters;
+ return EmuConfig.Trace.Enabled && Enabled;
}
-
- std::string GetCategory() const override { return _parent::GetCategory() + ".Registers"; }
};
-class SysTraceLog_IOP_Events : public SysTraceLog_IOP
+struct ConsoleLog : public LogBase
{
- typedef SysTraceLog_IOP _parent;
+ ConsoleLog(const LogDescriptor& descriptor, ConsoleColors color = Color_Gray)
+ : LogBase(descriptor, color) {};
-public:
- SysTraceLog_IOP_Events( const SysTraceLogDescriptor* desc ) : _parent( desc ) {}
- bool IsActive() const override
+ bool Write(const char* fmt, ...) const;
+ bool Write(ConsoleColors color, const char* fmt, ...) const;
+ bool IsActive() const
{
- return _parent::IsActive() && EmuConfig.Trace.IOP.m_EnableEvents;
+ return Enabled;
}
-
- std::string GetCategory() const override { return _parent::GetCategory() + ".Events"; }
};
// --------------------------------------------------------------------------------------
@@ -209,12 +93,10 @@ class SysTraceLog_IOP_Events : public SysTraceLog_IOP
// string data. (otherwise %'s would get mis-interpreted).
//
template< ConsoleColors conColor >
-class ConsoleLogFromVM : public BaseTraceLogSource
+class ConsoleLogFromVM : public LogBase
{
- typedef BaseTraceLogSource _parent;
-
public:
- ConsoleLogFromVM( const TraceLogDescriptor* desc ) : _parent( desc ) {}
+ ConsoleLogFromVM(const LogDescriptor& descriptor) : LogBase(descriptor, conColor) {};
bool Write(std::string_view msg)
{
@@ -242,82 +124,85 @@ class ConsoleLogFromVM : public BaseTraceLogSource
return false;
}
+ bool IsActive()
+ {
+ return Enabled;
+ }
+
private:
std::string m_buffer;
};
// --------------------------------------------------------------------------------------
-// SysTraceLogPack
+// TraceLogPack
// --------------------------------------------------------------------------------------
-struct SysTraceLogPack
+struct TraceLogPack
{
- // TODO : Sif has special logging needs.. ?
- SysTraceLog SIF;
-
+ TraceLog SIF;
struct EE_PACK
{
- SysTraceLog_EE Bios;
- SysTraceLog_EE Memory;
- SysTraceLog_EE GIFtag;
- SysTraceLog_VIFcode VIFcode;
- SysTraceLog_EE MSKPATH3;
-
- SysTraceLog_EE_Disasm R5900;
- SysTraceLog_EE_Disasm COP0;
- SysTraceLog_EE_Disasm COP1;
- SysTraceLog_EE_Disasm COP2;
- SysTraceLog_EE_Disasm Cache;
-
- SysTraceLog_EE_Registers KnownHw;
- SysTraceLog_EE_Registers UnknownHw;
- SysTraceLog_EE_Registers DMAhw;
- SysTraceLog_EE_Registers IPU;
-
- SysTraceLog_EE_Events DMAC;
- SysTraceLog_EE_Events Counters;
- SysTraceLog_EE_Events SPR;
-
- SysTraceLog_EE_Events VIF;
- SysTraceLog_EE_Events GIF;
+ TraceLog Bios;
+ TraceLog Memory;
+ TraceLog GIFtag;
+ TraceLog VIFcode;
+ TraceLog MSKPATH3;
+
+ TraceLog R5900;
+ TraceLog COP0;
+ TraceLog COP1;
+ TraceLog COP2;
+ TraceLog Cache;
+
+ TraceLog KnownHw;
+ TraceLog UnknownHw;
+ TraceLog DMAhw;
+ TraceLog IPU;
+
+ TraceLog DMAC;
+ TraceLog Counters;
+ TraceLog SPR;
+
+ TraceLog VIF;
+ TraceLog GIF;
EE_PACK();
} EE;
struct IOP_PACK
{
- SysTraceLog_IOP Bios;
- SysTraceLog_IOP Memcards;
- SysTraceLog_IOP PAD;
+ TraceLog Bios;
+ TraceLog Memcards;
+ TraceLog PAD;
- SysTraceLog_IOP_Disasm R3000A;
- SysTraceLog_IOP_Disasm COP2;
- SysTraceLog_IOP_Disasm Memory;
+ TraceLog R3000A;
+ TraceLog COP2;
+ TraceLog Memory;
- SysTraceLog_IOP_Registers KnownHw;
- SysTraceLog_IOP_Registers UnknownHw;
- SysTraceLog_IOP_Registers DMAhw;
+ TraceLog KnownHw;
+ TraceLog UnknownHw;
+ TraceLog DMAhw;
// TODO items to be added, or removed? I can't remember which! --air
- //SysTraceLog_IOP_Registers SPU2;
- //SysTraceLog_IOP_Registers USB;
- //SysTraceLog_IOP_Registers FW;
+ //TraceLog_IOP_Registers SPU2;
+ //TraceLog_IOP_Registers USB;
+ //TraceLog_IOP_Registers FW;
- SysTraceLog_IOP_Events DMAC;
- SysTraceLog_IOP_Events Counters;
- SysTraceLog_IOP_Events CDVD;
- SysTraceLog_IOP_Events MDEC;
+ TraceLog DMAC;
+ TraceLog Counters;
+ TraceLog CDVD;
+ TraceLog MDEC;
IOP_PACK();
} IOP;
- SysTraceLogPack();
+ TraceLogPack();
};
-struct SysConsoleLogPack
+struct ConsoleLogPack
{
- ConsoleLogSource ELF;
- ConsoleLogSource eeRecPerf;
- ConsoleLogSource pgifLog;
+ ConsoleLog ELF;
+ ConsoleLog eeRecPerf;
+ ConsoleLog pgifLog;
ConsoleLogFromVM eeConsole;
ConsoleLogFromVM iopConsole;
@@ -325,26 +210,24 @@ struct SysConsoleLogPack
ConsoleLogFromVM recordingConsole;
ConsoleLogFromVM controlInfo;
- SysConsoleLogPack();
+ ConsoleLogPack();
};
-extern SysTraceLogPack SysTrace;
-extern SysConsoleLogPack SysConsole;
-
-extern void __Log( const char* fmt, ... );
+extern TraceLogPack TraceLogging;
+extern ConsoleLogPack ConsoleLogging;
// Helper macro for cut&paste. Note that we intentionally use a top-level *inline* bitcheck
// against Trace.Enabled, to avoid extra overhead in Debug builds when logging is disabled.
// (specifically this allows debug builds to skip havingto resolve all the parameters being
// passed into the function)
#ifdef PCSX2_DEVBUILD
-# define SysTraceActive(trace) SysTrace.trace.IsActive()
+# define TraceActive(trace) TraceLogging.trace.IsActive()
#else
-# define SysTraceActive(trace) (false)
+# define TraceActive(trace) (false)
#endif
-#define macTrace(trace) SysTraceActive(trace) && SysTrace.trace.Write
+#define macTrace(trace) TraceActive(trace) && TraceLogging.trace.Write
#define SIF_LOG macTrace(SIF)
@@ -381,11 +264,11 @@ extern void __Log( const char* fmt, ... );
#define MDEC_LOG macTrace(IOP.MDEC)
-#define ELF_LOG SysConsole.ELF.IsActive() && SysConsole.ELF.Write
-#define eeRecPerfLog SysConsole.eeRecPerf.IsActive() && SysConsole.eeRecPerf
-#define eeConLog SysConsole.eeConsole.IsActive() && SysConsole.eeConsole.Write
-#define eeDeci2Log SysConsole.deci2.IsActive() && SysConsole.deci2.Write
-#define iopConLog SysConsole.iopConsole.IsActive() && SysConsole.iopConsole.Write
-#define pgifConLog SysConsole.pgifLog.IsActive() && SysConsole.pgifLog.Write
-#define recordingConLog SysConsole.recordingConsole.IsActive() && SysConsole.recordingConsole.Write
-#define controlLog SysConsole.controlInfo.IsActive() && SysConsole.controlInfo.Write
+#define ELF_LOG ConsoleLogging.ELF.IsActive() && ConsoleLogging.ELF.Write
+#define eeRecPerfLog ConsoleLogging.eeRecPerf.IsActive() && ConsoleLogging.eeRecPerf
+#define eeConLog ConsoleLogging.eeConsole.IsActive() && ConsoleLogging.eeConsole.Write
+#define eeDeci2Log ConsoleLogging.deci2.IsActive() && ConsoleLogging.deci2.Write
+#define iopConLog ConsoleLogging.iopConsole.IsActive() && ConsoleLogging.iopConsole.Write
+#define pgifConLog ConsoleLogging.pgifLog.IsActive() && ConsoleLogging.pgifLog.Write
+#define recordingConLog ConsoleLogging.recordingConsole.IsActive() && ConsoleLogging.recordingConsole.Write
+#define controlLog ConsoleLogging.controlInfo.IsActive() && ConsoleLogging.controlInfo.Write
diff --git a/pcsx2/DebugTools/DisassemblyManager.cpp b/pcsx2/DebugTools/DisassemblyManager.cpp
index 3c6443deeec6c..de1aa48ae9a52 100644
--- a/pcsx2/DebugTools/DisassemblyManager.cpp
+++ b/pcsx2/DebugTools/DisassemblyManager.cpp
@@ -7,7 +7,7 @@
#include "DisassemblyManager.h"
#include "Memory.h"
-#include "Debug.h"
+#include "common/StringUtil.h"
#include "MIPSAnalyst.h"
int DisassemblyManager::maxParamChars = 29;
diff --git a/pcsx2/DebugTools/MIPSAnalyst.cpp b/pcsx2/DebugTools/MIPSAnalyst.cpp
index 75ba50e230f9d..5dcfe7f9d4c5b 100644
--- a/pcsx2/DebugTools/MIPSAnalyst.cpp
+++ b/pcsx2/DebugTools/MIPSAnalyst.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0+
#include "MIPSAnalyst.h"
+#include "common/StringUtil.h"
#include "Debug.h"
#include "DebugInterface.h"
#include "DebugInterface.h"
diff --git a/pcsx2/IopBios.cpp b/pcsx2/IopBios.cpp
index 62ff199bc57f2..ee81e9f6db767 100644
--- a/pcsx2/IopBios.cpp
+++ b/pcsx2/IopBios.cpp
@@ -936,7 +936,7 @@ namespace R3000A
// printf-style formatting processing. This part can be skipped if the user has the
// console disabled.
- if (!SysConsole.iopConsole.IsActive())
+ if (!ConsoleLogging.iopConsole.IsActive())
return 1;
char tmp[1024], tmp2[1024];
diff --git a/pcsx2/Pcsx2Config.cpp b/pcsx2/Pcsx2Config.cpp
index 3800d5f147334..be60b540fe6b3 100644
--- a/pcsx2/Pcsx2Config.cpp
+++ b/pcsx2/Pcsx2Config.cpp
@@ -173,32 +173,47 @@ namespace EmuFolders
static std::string GetPortableModePath();
} // namespace EmuFolders
-TraceFiltersEE::TraceFiltersEE()
+TraceLogsEE::TraceLogsEE()
{
bitset = 0;
}
-bool TraceFiltersEE::operator==(const TraceFiltersEE& right) const
+bool TraceLogsEE::operator==(const TraceLogsEE& right) const
{
return OpEqu(bitset);
}
-bool TraceFiltersEE::operator!=(const TraceFiltersEE& right) const
+bool TraceLogsEE::operator!=(const TraceLogsEE& right) const
{
return !this->operator==(right);
}
-TraceFiltersIOP::TraceFiltersIOP()
+TraceLogsIOP::TraceLogsIOP()
{
bitset = 0;
}
-bool TraceFiltersIOP::operator==(const TraceFiltersIOP& right) const
+bool TraceLogsIOP::operator==(const TraceLogsIOP& right) const
{
return OpEqu(bitset);
}
-bool TraceFiltersIOP::operator!=(const TraceFiltersIOP& right) const
+bool TraceLogsIOP::operator!=(const TraceLogsIOP& right) const
+{
+ return !this->operator==(right);
+}
+
+TraceLogsMISC::TraceLogsMISC()
+{
+ bitset = 0;
+}
+
+bool TraceLogsMISC::operator==(const TraceLogsMISC& right) const
+{
+ return OpEqu(bitset);
+}
+
+bool TraceLogsMISC::operator!=(const TraceLogsMISC& right) const
{
return !this->operator==(right);
}
@@ -214,16 +229,88 @@ void TraceLogFilters::LoadSave(SettingsWrapper& wrap)
SettingsWrapEntry(Enabled);
- // Retaining backwards compat of the trace log enablers isn't really important, and
- // doing each one by hand would be murder. So let's cheat and just save it as an int:
-
- SettingsWrapEntry(EE.bitset);
- SettingsWrapEntry(IOP.bitset);
+ SettingsWrapBitBool(EE.bios);
+ SettingsWrapBitBool(EE.memory);
+ SettingsWrapBitBool(EE.giftag);
+ SettingsWrapBitBool(EE.vifcode);
+ SettingsWrapBitBool(EE.mskpath3);
+ SettingsWrapBitBool(EE.r5900);
+ SettingsWrapBitBool(EE.cop0);
+ SettingsWrapBitBool(EE.cop1);
+ SettingsWrapBitBool(EE.cop2);
+ SettingsWrapBitBool(EE.cache);
+ SettingsWrapBitBool(EE.knownhw);
+ SettingsWrapBitBool(EE.unknownhw);
+ SettingsWrapBitBool(EE.dmahw);
+ SettingsWrapBitBool(EE.ipu);
+ SettingsWrapBitBool(EE.dmac);
+ SettingsWrapBitBool(EE.counters);
+ SettingsWrapBitBool(EE.spr);
+ SettingsWrapBitBool(EE.vif);
+ SettingsWrapBitBool(EE.gif);
+
+ SettingsWrapBitBool(IOP.bios);
+ SettingsWrapBitBool(IOP.memcards);
+ SettingsWrapBitBool(IOP.pad);
+ SettingsWrapBitBool(IOP.r3000a);
+ SettingsWrapBitBool(IOP.cop2);
+ SettingsWrapBitBool(IOP.memory);
+ SettingsWrapBitBool(IOP.knownhw);
+ SettingsWrapBitBool(IOP.unknownhw);
+ SettingsWrapBitBool(IOP.dmahw);
+ SettingsWrapBitBool(IOP.dmac);
+ SettingsWrapBitBool(IOP.counters);
+ SettingsWrapBitBool(IOP.cdvd);
+ SettingsWrapBitBool(IOP.mdec);
+
+ SettingsWrapBitBool(MISC.sif);
+}
+
+void TraceLogFilters::SyncToConfig() const
+{
+ auto& ee = TraceLogging.EE;
+ ee.Bios.Enabled = EE.bios;
+ ee.Memory.Enabled = EE.memory;
+ ee.GIFtag.Enabled = EE.giftag;
+ ee.VIFcode.Enabled = EE.vifcode;
+ ee.MSKPATH3.Enabled = EE.mskpath3;
+ ee.R5900.Enabled = EE.r5900;
+ ee.COP0.Enabled = EE.cop0;
+ ee.COP1.Enabled = EE.cop1;
+ ee.COP2.Enabled = EE.cop2;
+ ee.KnownHw.Enabled = EE.knownhw;
+ ee.UnknownHw.Enabled = EE.unknownhw;
+ ee.DMAhw.Enabled = EE.dmahw;
+ ee.IPU.Enabled = EE.ipu;
+ ee.DMAC.Enabled = EE.dmac;
+ ee.Counters.Enabled = EE.counters;
+ ee.SPR.Enabled = EE.spr;
+ ee.VIF.Enabled = EE.vif;
+ ee.GIF.Enabled = EE.gif;
+
+ auto& iop = TraceLogging.IOP;
+ iop.Bios.Enabled = IOP.bios;
+ iop.Memcards.Enabled = IOP.memcards;
+ iop.PAD.Enabled = IOP.pad;
+ iop.R3000A.Enabled = IOP.r3000a;
+ iop.COP2.Enabled = IOP.cop2;
+ iop.Memory.Enabled = IOP.memory;
+ iop.KnownHw.Enabled = IOP.knownhw;
+ iop.UnknownHw.Enabled = IOP.unknownhw;
+ iop.DMAhw.Enabled = IOP.dmahw;
+ iop.DMAC.Enabled = IOP.dmac;
+ iop.Counters.Enabled = IOP.counters;
+ iop.CDVD.Enabled = IOP.cdvd;
+ iop.MDEC.Enabled = IOP.mdec;
+
+ TraceLogging.SIF.Enabled = MISC.sif;
+
+ EmuConfig.Trace.Enabled = Enabled;
}
bool TraceLogFilters::operator==(const TraceLogFilters& right) const
{
- return OpEqu(Enabled) && OpEqu(EE) && OpEqu(IOP);
+ return OpEqu(Enabled) && OpEqu(EE) && OpEqu(IOP) && OpEqu(MISC);
}
bool TraceLogFilters::operator!=(const TraceLogFilters& right) const
diff --git a/pcsx2/R5900OpcodeImpl.cpp b/pcsx2/R5900OpcodeImpl.cpp
index 004a380007276..81e1dc6065e6d 100644
--- a/pcsx2/R5900OpcodeImpl.cpp
+++ b/pcsx2/R5900OpcodeImpl.cpp
@@ -1066,7 +1066,7 @@ void SYSCALL()
break;
case Syscall::sceSifSetDma:
// The only thing this code is used for is the one log message, so don't execute it if we aren't logging bios messages.
- if (SysTraceActive(EE.Bios))
+ if (TraceActive(EE.Bios))
{
//struct t_sif_cmd_header *hdr;
//struct t_sif_rpc_bind *bind;
diff --git a/pcsx2/Recording/InputRecordingFile.cpp b/pcsx2/Recording/InputRecordingFile.cpp
index ca9baf5ae65aa..9adb43f42df96 100644
--- a/pcsx2/Recording/InputRecordingFile.cpp
+++ b/pcsx2/Recording/InputRecordingFile.cpp
@@ -6,6 +6,7 @@
#include "Utilities/InputRecordingLogger.h"
#include "common/FileSystem.h"
+#include "common/StringUtil.h"
#include "DebugTools/Debug.h"
#include "MemoryTypes.h"
#include "svnrev.h"
diff --git a/pcsx2/SourceLog.cpp b/pcsx2/SourceLog.cpp
index 7fad9c86bd31a..582a70cd1445b 100644
--- a/pcsx2/SourceLog.cpp
+++ b/pcsx2/SourceLog.cpp
@@ -24,226 +24,217 @@
using namespace R5900;
-FILE* emuLog;
+TraceLogPack TraceLogging;
+ConsoleLogPack ConsoleLogging;
-SysTraceLogPack SysTrace;
-SysConsoleLogPack SysConsole;
-
-// writes text directly to the logfile, no newlines appended.
-void __Log(const char* fmt, ...)
+bool TraceLog::Write(const char* fmt, ...) const
{
- va_list list;
- va_start(list, fmt);
-
- if (emuLog != NULL)
- {
- std::vfprintf(emuLog, fmt, list);
- fputs("\n", emuLog);
- fflush(emuLog);
- }
+ auto prefixed_str = fmt::format("{:<8}: {}", Descriptor.Prefix, fmt);
+ va_list args;
+ va_start(args, fmt);
+ Log::Writev(LOGLEVEL_TRACE, Color, prefixed_str.c_str(), args);
+ va_end(args);
- va_end(list);
+ return false;
}
-void SysTraceLog::DoWrite(const char* msg) const
+bool TraceLog::Write(ConsoleColors color, const char* fmt, ...) const
{
- if (emuLog == NULL)
- return;
+ auto prefixed_str = fmt::format("{:<8}: {}", Descriptor.Prefix, fmt);
+ va_list args;
+ va_start(args, fmt);
+ Log::Writev(LOGLEVEL_TRACE, color, prefixed_str.c_str(), args);
+ va_end(args);
- fputs(msg, emuLog);
- fputs("\n", emuLog);
- fflush(emuLog);
+ return false;
}
-void SysTraceLog_EE::ApplyPrefix(std::string& ascii) const
+bool ConsoleLog::Write(const char* fmt, ...) const
{
- fmt::format_to(std::back_inserter(ascii), "{:<4}({:08x} {:08x}): ", ((SysTraceLogDescriptor*)m_Descriptor)->Prefix, cpuRegs.pc, cpuRegs.cycle);
-}
+ auto prefixed_str = fmt::format("{:<8}: {}", Descriptor.Prefix, fmt);
+ va_list args;
+ va_start(args, fmt);
+ Console.WriteLn(Color, prefixed_str.c_str(), args);
+ va_end(args);
-void SysTraceLog_IOP::ApplyPrefix(std::string& ascii) const
-{
- fmt::format_to(std::back_inserter(ascii), "{:<4}({:08x} {:08x}): ", ((SysTraceLogDescriptor*)m_Descriptor)->Prefix, psxRegs.pc, psxRegs.cycle);
+ return false;
}
-void SysTraceLog_VIFcode::ApplyPrefix(std::string& ascii) const
+bool ConsoleLog::Write(ConsoleColors color, const char* fmt, ...) const
{
- _parent::ApplyPrefix(ascii);
- ascii.append("vifCode_");
+ auto prefixed_str = fmt::format("{:<8}: {}", Descriptor.Prefix, fmt);
+
+ va_list args;
+ va_start(args, fmt);
+ Console.WriteLn(color, prefixed_str.c_str(), args);
+ va_end(args);
+
+ return false;
}
// --------------------------------------------------------------------------------------
-// SysConsoleLogPack (descriptions)
+// ConsoleLogPack (descriptions)
// --------------------------------------------------------------------------------------
-static const TraceLogDescriptor
+static const LogDescriptor
- TLD_ELF = {
+ LD_ELF = {
"ELF", "E&LF",
"Dumps detailed information for PS2 executables (ELFs)."},
- TLD_eeRecPerf = {"EErecPerf", "EErec &Performance", "Logs manual protection, split blocks, and other things that might impact performance."},
+ LD_eeRecPerf = {"EErecPerf", "EErec &Performance", "Logs manual protection, split blocks, and other things that might impact performance."},
- TLD_eeConsole = {"EEout", "EE C&onsole", "Shows the game developer's logging text (EE processor)."},
+ LD_eeConsole = {"EEout", "EE C&onsole", "Shows the game developer's logging text (EE processor)."},
- TLD_iopConsole = {"IOPout", "&IOP Console", "Shows the game developer's logging text (IOP processor)."},
+ LD_iopConsole = {"IOPout", "&IOP Console", "Shows the game developer's logging text (IOP processor)."},
- TLD_deci2 = {"DECI2", "DECI&2 Console", "Shows DECI2 debugging logs (EE processor)."},
+ LD_deci2 = {"DECI2", "DECI&2 Console", "Shows DECI2 debugging logs (EE processor)."},
- TLD_Pgif = {"PGIFout", "&PGIF Console", "Shows output from pgif the emulated ps1 gpu"},
+ LD_Pgif = {"PGIFout", "&PGIF Console", "Shows output from pgif the emulated ps1 gpu"},
- TLD_recordingConsole = {"Input Recording", "Input Recording Console", "Shows recording related logs and information."},
+ LD_recordingConsole = {"Input Recording", "Input Recording Console", "Shows recording related logs and information."},
- TLD_controlInfo = {"Controller Info", "Controller Info", "Shows detailed controller input values for port 1, every frame."}
-; // End init of TraceLogDescriptors
+ LD_controlInfo = {"Controller Info", "Controller Info", "Shows detailed controller input values for port 1, every frame."};
-SysConsoleLogPack::SysConsoleLogPack()
- : ELF(&TLD_ELF, Color_Gray)
- , eeRecPerf(&TLD_eeRecPerf, Color_Gray)
- , pgifLog(&TLD_Pgif)
- , eeConsole(&TLD_eeConsole)
- , iopConsole(&TLD_iopConsole)
- , deci2(&TLD_deci2)
- , recordingConsole(&TLD_recordingConsole)
- , controlInfo(&TLD_controlInfo)
+ConsoleLogPack::ConsoleLogPack()
+ : ELF(LD_ELF, Color_Gray)
+ , eeRecPerf(LD_eeRecPerf, Color_Gray)
+ , pgifLog(LD_Pgif)
+ , eeConsole(LD_eeConsole)
+ , iopConsole(LD_iopConsole)
+ , deci2(LD_deci2)
+ , recordingConsole(LD_recordingConsole)
+ , controlInfo(LD_controlInfo)
{
}
// --------------------------------------------------------------------------------------
-// SysTraceLogPack (descriptions)
+// TraceLogPack (descriptions)
// --------------------------------------------------------------------------------------
-static const SysTraceLogDescriptor
- TLD_SIF = {
- {"SIF", "SIF (EE <-> IOP)",
- ""},
- "SIF"};
+static const LogDescriptor
+ LD_SIF = {"SIF", "SIF (EE <-> IOP)", ""};
// ----------------------------
// EmotionEngine (EE/R5900)
// ----------------------------
-static const SysTraceLogDescriptor
- TLD_EE_Bios = {
- {"Bios", "Bios",
- "SYSCALL and DECI2 activity."},
- "EE"},
+static const LogDescriptor
+ LD_EE_Bios = {"Bios", "Bios", "SYSCALL and DECI2 activity."},
- TLD_EE_Memory = {{"Memory", "Memory", "Direct memory accesses to unknown or unmapped EE memory space."}, "eMem"},
+ LD_EE_Memory = {"Memory", "Memory", "Direct memory accesses to unknown or unmapped EE memory space."},
- TLD_EE_R5900 = {{"R5900", "R5900 Core", "Disasm of executing core instructions (excluding COPs and CACHE)."}, "eDis"},
+ LD_EE_R5900 = {"R5900", "R5900 Core", "Disasm of executing core instructions (excluding COPs and CACHE)."},
- TLD_EE_COP0 = {{"COP0", "COP0", "Disasm of COP0 instructions (MMU, cpu and dma status, etc)."}, "eDis"},
+ LD_EE_COP0 = {"COP0", "COP0", "Disasm of COP0 instructions (MMU, cpu and dma status, etc)."},
- TLD_EE_COP1 = {{"FPU", "COP1/FPU", "Disasm of the EE's floating point unit (FPU) only."}, "eDis"},
+ LD_EE_COP1 = {"FPU", "COP1/FPU", "Disasm of the EE's floating point unit (FPU) only."},
- TLD_EE_COP2 = {{"VUmacro", "COP2/VUmacro", "Disasm of the EE's VU0macro co-processor instructions."}, "eDis"},
+ LD_EE_COP2 = {"VUmacro", "COP2/VUmacro", "Disasm of the EE's VU0macro co-processor instructions."},
- TLD_EE_Cache = {{"Cache", "Cache", "Execution of EE cache instructions."}, "eDis"},
+ LD_EE_Cache = {"Cache", "Cache", "Execution of EE cache instructions."},
- TLD_EE_KnownHw = {{"HwRegs", "Hardware Regs", "All known hardware register accesses (very slow!); not including sub filter options below."}, "eReg"},
+ LD_EE_KnownHw = {"HwRegs", "Hardware Regs", "All known hardware register accesses (very slow!); not including sub filter options below."},
- TLD_EE_UnknownHw = {{"UnknownRegs", "Unknown Regs", "Logs only unknown, unmapped, or unimplemented register accesses."}, "eReg"},
+ LD_EE_UnknownHw = {"UnknownRegs", "Unknown Regs", "Logs only unknown, unmapped, or unimplemented register accesses."},
- TLD_EE_DMAhw = {{"DmaRegs", "DMA Regs", "Logs only DMA-related registers."}, "eReg"},
+ LD_EE_DMAhw = {"DmaRegs", "DMA Regs", "Logs only DMA-related registers."},
- TLD_EE_IPU = {{"IPU", "IPU", "IPU activity: hardware registers, decoding operations, DMA status, etc."}, "IPU"},
+ LD_EE_IPU = {"IPU", "IPU", "IPU activity: hardware registers, decoding operations, DMA status, etc."},
- TLD_EE_GIFtag = {{"GIFtags", "GIFtags", "All GIFtag parse activity; path index, tag type, etc."}, "GIF"},
+ LD_EE_GIFtag = {"GIFtags", "GIFtags", "All GIFtag parse activity; path index, tag type, etc."},
- TLD_EE_VIFcode = {{"VIFcodes", "VIFcodes", "All VIFcode processing; command, tag style, interrupts."}, "VIF"},
+ LD_EE_VIFcode = {"VIFcodes", "VIFcodes", "All VIFcode processing; command, tag style, interrupts."},
- TLD_EE_MSKPATH3 = {{"MSKPATH3", "MSKPATH3", "All processing involved in Path3 Masking."}, "MSKPATH3"},
+ LD_EE_MSKPATH3 = {"MSKPATH3", "MSKPATH3", "All processing involved in Path3 Masking."},
- TLD_EE_SPR = {{"MFIFO", "Scratchpad MFIFO", "Scratchpad's MFIFO activity."}, "SPR"},
+ LD_EE_SPR = {"MFIFO", "Scratchpad MFIFO", "Scratchpad's MFIFO activity."},
- TLD_EE_DMAC = {{"DmaCtrl", "DMA Controller", "Actual data transfer logs, bus right arbitration, stalls, etc."}, "eDmaC"},
+ LD_EE_DMAC = {"DmaCtrl", "DMA Controller", "Actual data transfer logs, bus right arbitration, stalls, etc."},
- TLD_EE_Counters = {{"Counters", "Counters", "Tracks all EE counters events and some counter register activity."}, "eCnt"},
+ LD_EE_Counters = {"Counters", "Counters", "Tracks all EE counters events and some counter register activity."},
- TLD_EE_VIF = {{"VIF", "VIF", "Dumps various VIF and VIFcode processing data."}, "VIF"},
+ LD_EE_VIF = {"VIF", "VIF", "Dumps various VIF and VIFcode processing data."},
- TLD_EE_GIF = {{"GIF", "GIF", "Dumps various GIF and GIFtag parsing data."}, "GIF"};
+ LD_EE_GIF = {"GIF", "GIF", "Dumps various GIF and GIFtag parsing data."};
// ----------------------------------
// IOP - Input / Output Processor
// ----------------------------------
-static const SysTraceLogDescriptor
- TLD_IOP_Bios = {
- {"Bios", "Bios",
- "SYSCALL and IRX activity."},
- "IOP"},
+static const LogDescriptor
+ LD_IOP_Bios = {"Bios", "Bios", "SYSCALL and IRX activity."},
- TLD_IOP_Memory = {{"Memory", "Memory", "Direct memory accesses to unknown or unmapped IOP memory space."}, "iMem"},
+ LD_IOP_Memory = {"Memory", "Memory", "Direct memory accesses to unknown or unmapped IOP memory space."},
- TLD_IOP_R3000A = {{"R3000A", "R3000A Core", "Disasm of executing core instructions (excluding COPs and CACHE)."}, "iDis"},
+ LD_IOP_R3000A = {"R3000A", "R3000A Core", "Disasm of executing core instructions (excluding COPs and CACHE)."},
- TLD_IOP_COP2 = {{"COP2/GPU", "COP2", "Disasm of the IOP's GPU co-processor instructions."}, "iDis"},
+ LD_IOP_COP2 = {"COP2/GPU", "COP2", "Disasm of the IOP's GPU co-processor instructions."},
- TLD_IOP_KnownHw = {{"HwRegs", "Hardware Regs", "All known hardware register accesses, not including the sub-filters below."}, "iReg"},
+ LD_IOP_KnownHw = {"HwRegs", "Hardware Regs", "All known hardware register accesses, not including the sub-filters below."},
- TLD_IOP_UnknownHw = {{"UnknownRegs", "Unknown Regs", "Logs only unknown, unmapped, or unimplemented register accesses."}, "iReg"},
+ LD_IOP_UnknownHw = {"UnknownRegs", "Unknown Regs", "Logs only unknown, unmapped, or unimplemented register accesses."},
- TLD_IOP_DMAhw = {{"DmaRegs", "DMA Regs", "Logs only DMA-related registers."}, "iReg"},
+ LD_IOP_DMAhw = {"DmaRegs", "DMA Regs", "Logs only DMA-related registers."},
- TLD_IOP_Memcards = {{"Memorycards", "Memorycards", "Memorycard reads, writes, erases, terminators, and other processing."}, "Mcd"},
+ LD_IOP_Memcards = {"Memorycards", "Memorycards", "Memorycard reads, writes, erases, terminators, and other processing."},
- TLD_IOP_PAD = {{"Pad", "Pad", "Gamepad activity on the SIO."}, "Pad"},
+ LD_IOP_PAD = {"Pad", "Pad", "Gamepad activity on the SIO."},
- TLD_IOP_DMAC = {{"DmaCrl", "DMA Controller", "Actual DMA event processing and data transfer logs."}, "iDmaC"},
+ LD_IOP_DMAC = {"DmaCtrl", "DMA Controller", "Actual DMA event processing and data transfer logs."},
- TLD_IOP_Counters = {{"Counters", "Counters", "Tracks all IOP counters events and some counter register activity."}, "iCnt"},
+ LD_IOP_Counters = {"Counters", "Counters", "Tracks all IOP counters events and some counter register activity."},
- TLD_IOP_CDVD = {{"CDVD", "CDVD", "Detailed logging of CDVD hardware."}, "CDVD"},
+ LD_IOP_CDVD = {"CDVD", "CDVD", "Detailed logging of CDVD hardware."},
- TLD_IOP_MDEC = {{"MDEC", "MDEC", "Detailed logging of the Motion (FMV) Decoder hardware unit."}, "MDEC"};
+ LD_IOP_MDEC = {"MDEC", "MDEC", "Detailed logging of the Motion (FMV) Decoder hardware unit."};
-SysTraceLogPack::SysTraceLogPack()
- : SIF(&TLD_SIF)
+TraceLogPack::TraceLogPack()
+ : SIF(LD_SIF)
{
}
-SysTraceLogPack::EE_PACK::EE_PACK()
- : Bios(&TLD_EE_Bios)
- , Memory(&TLD_EE_Memory)
- , GIFtag(&TLD_EE_GIFtag)
- , VIFcode(&TLD_EE_VIFcode)
- , MSKPATH3(&TLD_EE_MSKPATH3)
-
- , R5900(&TLD_EE_R5900)
- , COP0(&TLD_EE_COP0)
- , COP1(&TLD_EE_COP1)
- , COP2(&TLD_EE_COP2)
- , Cache(&TLD_EE_Cache)
-
- , KnownHw(&TLD_EE_KnownHw)
- , UnknownHw(&TLD_EE_UnknownHw)
- , DMAhw(&TLD_EE_DMAhw)
- , IPU(&TLD_EE_IPU)
-
- , DMAC(&TLD_EE_DMAC)
- , Counters(&TLD_EE_Counters)
- , SPR(&TLD_EE_SPR)
-
- , VIF(&TLD_EE_VIF)
- , GIF(&TLD_EE_GIF)
+TraceLogPack::EE_PACK::EE_PACK()
+ : Bios(LD_EE_Bios)
+ , Memory(LD_EE_Memory)
+ , GIFtag(LD_EE_GIFtag)
+ , VIFcode(LD_EE_VIFcode)
+ , MSKPATH3(LD_EE_MSKPATH3)
+
+ , R5900(LD_EE_R5900)
+ , COP0(LD_EE_COP0)
+ , COP1(LD_EE_COP1)
+ , COP2(LD_EE_COP2)
+ , Cache(LD_EE_Cache)
+
+ , KnownHw(LD_EE_KnownHw)
+ , UnknownHw(LD_EE_UnknownHw)
+ , DMAhw(LD_EE_DMAhw)
+ , IPU(LD_EE_IPU)
+
+ , DMAC(LD_EE_DMAC)
+ , Counters(LD_EE_Counters)
+ , SPR(LD_EE_SPR)
+
+ , VIF(LD_EE_VIF)
+ , GIF(LD_EE_GIF)
{
}
-SysTraceLogPack::IOP_PACK::IOP_PACK()
- : Bios(&TLD_IOP_Bios)
- , Memcards(&TLD_IOP_Memcards)
- , PAD(&TLD_IOP_PAD)
+TraceLogPack::IOP_PACK::IOP_PACK()
+ : Bios(LD_IOP_Bios)
+ , Memcards(LD_IOP_Memcards)
+ , PAD(LD_IOP_PAD)
- , R3000A(&TLD_IOP_R3000A)
- , COP2(&TLD_IOP_COP2)
- , Memory(&TLD_IOP_Memory)
+ , R3000A(LD_IOP_R3000A)
+ , COP2(LD_IOP_COP2)
+ , Memory(LD_IOP_Memory)
- , KnownHw(&TLD_IOP_KnownHw)
- , UnknownHw(&TLD_IOP_UnknownHw)
- , DMAhw(&TLD_IOP_DMAhw)
+ , KnownHw(LD_IOP_KnownHw)
+ , UnknownHw(LD_IOP_UnknownHw)
+ , DMAhw(LD_IOP_DMAhw)
- , DMAC(&TLD_IOP_DMAC)
- , Counters(&TLD_IOP_Counters)
- , CDVD(&TLD_IOP_CDVD)
- , MDEC(&TLD_IOP_MDEC)
+ , DMAC(LD_IOP_DMAC)
+ , Counters(LD_IOP_Counters)
+ , CDVD(LD_IOP_CDVD)
+ , MDEC(LD_IOP_MDEC)
{
}
diff --git a/pcsx2/VMManager.cpp b/pcsx2/VMManager.cpp
index c2a08c1189251..1d32f792ae96f 100644
--- a/pcsx2/VMManager.cpp
+++ b/pcsx2/VMManager.cpp
@@ -453,7 +453,6 @@ void VMManager::Internal::CPUThreadShutdown()
void VMManager::Internal::SetFileLogPath(std::string path)
{
s_log_force_file_log = Log::SetFileOutputLevel(LOGLEVEL_DEBUG, std::move(path));
- emuLog = Log::GetFileLogHandle();
}
void VMManager::Internal::SetBlockSystemConsole(bool block)
@@ -476,12 +475,6 @@ void VMManager::UpdateLoggingSettings(SettingsInterface& si)
if (system_console_enabled != Log::IsConsoleOutputEnabled())
Log::SetConsoleOutputLevel(system_console_enabled ? level : LOGLEVEL_NONE);
- if (file_logging_enabled != Log::IsFileOutputEnabled())
- {
- std::string path = Path::Combine(EmuFolders::Logs, "emulog.txt");
- Log::SetFileOutputLevel(file_logging_enabled ? level : LOGLEVEL_NONE, std::move(path));
- }
-
// Debug console only exists on Windows.
#ifdef _WIN32
const bool debug_console_enabled = IsDebuggerPresent() && si.GetBoolValue("Logging", "EnableDebugConsole", false);
@@ -496,17 +489,26 @@ void VMManager::UpdateLoggingSettings(SettingsInterface& si)
const bool any_logging_sinks = system_console_enabled || log_window_enabled || file_logging_enabled || debug_console_enabled;
const bool ee_console_enabled = any_logging_sinks && si.GetBoolValue("Logging", "EnableEEConsole", false);
- SysConsole.eeConsole.Enabled = ee_console_enabled;
+ ConsoleLogging.eeConsole.Enabled = ee_console_enabled;
- SysConsole.iopConsole.Enabled = any_logging_sinks && si.GetBoolValue("Logging", "EnableIOPConsole", false);
- SysTrace.IOP.R3000A.Enabled = true;
- SysTrace.IOP.COP2.Enabled = true;
- SysTrace.IOP.Memory.Enabled = true;
- SysTrace.SIF.Enabled = true;
+ ConsoleLogging.iopConsole.Enabled = any_logging_sinks && si.GetBoolValue("Logging", "EnableIOPConsole", false);
+ TraceLogging.IOP.R3000A.Enabled = true;
+ TraceLogging.IOP.COP2.Enabled = true;
+ TraceLogging.IOP.Memory.Enabled = true;
+ TraceLogging.SIF.Enabled = true;
// Input Recording Logs
- SysConsole.recordingConsole.Enabled = any_logging_sinks && si.GetBoolValue("Logging", "EnableInputRecordingLogs", true);
- SysConsole.controlInfo.Enabled = any_logging_sinks && si.GetBoolValue("Logging", "EnableControllerLogs", false);
+ ConsoleLogging.recordingConsole.Enabled = any_logging_sinks && si.GetBoolValue("Logging", "EnableInputRecordingLogs", true);
+ ConsoleLogging.controlInfo.Enabled = any_logging_sinks && si.GetBoolValue("Logging", "EnableControllerLogs", false);
+
+ // Sync the trace settings with the config.
+ EmuConfig.Trace.SyncToConfig();
+ // Set the output level if file logging or trace logs have changed.
+ if (file_logging_enabled != Log::IsFileOutputEnabled() || (EmuConfig.Trace.Enabled && Log::GetMaxLevel() < LOGLEVEL_TRACE))
+ {
+ std::string path = Path::Combine(EmuFolders::Logs, "emulog.txt");
+ Log::SetFileOutputLevel(file_logging_enabled ? EmuConfig.Trace.Enabled ? LOGLEVEL_TRACE : level : LOGLEVEL_NONE, std::move(path));
+ }
}
void VMManager::SetDefaultLoggingSettings(SettingsInterface& si)
@@ -519,6 +521,11 @@ void VMManager::SetDefaultLoggingSettings(SettingsInterface& si)
si.SetBoolValue("Logging", "EnableIOPConsole", false);
si.SetBoolValue("Logging", "EnableInputRecordingLogs", true);
si.SetBoolValue("Logging", "EnableControllerLogs", false);
+
+ EmuConfig.Trace.Enabled = false;
+ EmuConfig.Trace.EE.bitset = 0;
+ EmuConfig.Trace.IOP.bitset = 0;
+ EmuConfig.Trace.MISC.bitset = 0;
}
bool VMManager::Internal::CheckSettingsVersion()
diff --git a/pcsx2/Vif_Transfer.cpp b/pcsx2/Vif_Transfer.cpp
index 8bb02d0c5ab27..e7c51758bc93a 100644
--- a/pcsx2/Vif_Transfer.cpp
+++ b/pcsx2/Vif_Transfer.cpp
@@ -37,7 +37,7 @@ _vifT void vifTransferLoop(u32* &data) {
VIF_LOG("New VifCMD %x tagsize %x irq %d", vifX.cmd, vifX.tag.size, vifX.irq);
- if (IsDevBuild && SysTrace.EE.VIFcode.IsActive()) {
+ if (IsDevBuild && TraceLogging.EE.VIFcode.IsActive()) {
// Pass 2 means "log it"
vifCmdHandler[idx][vifX.cmd & 0x7f](2, data);
}
diff --git a/pcsx2/ps2/Iop/IopHwWrite.cpp b/pcsx2/ps2/Iop/IopHwWrite.cpp
index 732424e18c699..d8ad5e2311b14 100644
--- a/pcsx2/ps2/Iop/IopHwWrite.cpp
+++ b/pcsx2/ps2/Iop/IopHwWrite.cpp
@@ -128,7 +128,7 @@ void iopHwWrite8_Page3( u32 addr, mem8_t val )
// all addresses are assumed to be prefixed with 0x1f803xxx:
pxAssert( (addr >> 12) == 0x1f803 );
- if( SysConsole.iopConsole.IsActive() && (addr == 0x1f80380c) ) // STDOUT
+ if(ConsoleLogging.iopConsole.IsActive() && (addr == 0x1f80380c)) // STDOUT
{
static char pbuf[1024];
static int pidx;
diff --git a/pcsx2/ps2/Iop/IopHw_Internal.h b/pcsx2/ps2/Iop/IopHw_Internal.h
index 0052877845cbe..66baa54191d90 100644
--- a/pcsx2/ps2/Iop/IopHw_Internal.h
+++ b/pcsx2/ps2/Iop/IopHw_Internal.h
@@ -197,7 +197,7 @@ template< typename T>
static __ri void IopHwTraceLog( u32 addr, T val, bool mode )
{
if (!IsDevBuild) return;
- if (!EmuConfig.Trace.Enabled || !EmuConfig.Trace.IOP.m_EnableAll || !EmuConfig.Trace.IOP.m_EnableRegisters) return;
+ if (!EmuConfig.Trace.Enabled) return;
std::string labelStr(fmt::format("Hw{}{}", mode ? "Read" : "Write", sizeof(T) * 8));
std::string valStr;
diff --git a/pcsx2/ps2/eeHwTraceLog.inl b/pcsx2/ps2/eeHwTraceLog.inl
index 7db4552cb7522..ebd3fd94c3e45 100644
--- a/pcsx2/ps2/eeHwTraceLog.inl
+++ b/pcsx2/ps2/eeHwTraceLog.inl
@@ -256,7 +256,7 @@ template< typename T>
static __ri void eeHwTraceLog( u32 addr, T val, bool mode )
{
if (!IsDevBuild) return;
- if (!EmuConfig.Trace.Enabled || !EmuConfig.Trace.EE.m_EnableAll || !EmuConfig.Trace.EE.m_EnableRegisters) return;
+ if (!EmuConfig.Trace.Enabled) return;
if (!_eelog_enabled(addr)) return;
std::string labelStr(fmt::format("Hw{}{}", mode ? "Read" : "Write", sizeof(T) * 8));
diff --git a/pcsx2/x86/iR3000A.cpp b/pcsx2/x86/iR3000A.cpp
index 291428a203928..1e23c45da63b5 100644
--- a/pcsx2/x86/iR3000A.cpp
+++ b/pcsx2/x86/iR3000A.cpp
@@ -662,14 +662,14 @@ static void psxRecompileIrxImport()
const char* funcname = nullptr;
#endif
- if (!hle && !debug && (!SysTraceActive(IOP.Bios) || !funcname))
+ if (!hle && !debug && (!TraceActive(IOP.Bios) || !funcname))
return;
xMOV(ptr32[&psxRegs.code], psxRegs.code);
xMOV(ptr32[&psxRegs.pc], psxpc);
_psxFlushCall(FLUSH_NODESTROY);
- if (SysTraceActive(IOP.Bios))
+ if (TraceActive(IOP.Bios))
{
xMOV64(arg3reg, (uptr)funcname);