Misc: wire up and refactor trace logging

This commit is contained in:
Ty Lamontagne 2024-10-13 16:04:33 -04:00 committed by Ty
parent 0a599e7337
commit ab21d22514
22 changed files with 850 additions and 618 deletions

View File

@ -77,7 +77,6 @@ target_sources(common PRIVATE
Timer.h
TextureDecompress.h
Threading.h
TraceLog.h
VectorIntrin.h
WAVWriter.h
WindowInfo.h

View File

@ -364,6 +364,7 @@ bool Log::SetFileOutputLevel(LOGLEVEL level, std::string path)
}
s_file_level = s_file_handle ? level : LOGLEVEL_NONE;
UpdateMaxLevel();
return IsFileOutputEnabled();
}

View File

@ -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;
}
};

View File

@ -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

View File

@ -20,6 +20,9 @@ public:
private Q_SLOTS:
void onDrawDumpingChanged();
#ifdef PCSX2_DEVBUILD
void onLoggingEnableChanged();
#endif
private:
SettingsWindow* m_dialog;

View File

@ -24,7 +24,7 @@
<number>0</number>
</property>
<item>
<widget class="QTabWidget" name="tabs">
<widget class="QTabWidget" name="debugTabs">
<property name="currentIndex">
<number>0</number>
</property>
@ -35,7 +35,7 @@
<attribute name="title">
<string>Analysis</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="leftMargin">
<number>0</number>
</property>
@ -289,6 +289,300 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="traceLogTabWidget">
<attribute name="title">
<string>Trace Logging</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QCheckBox" name="chkEnable">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="traceLogHorizontalLayout">
<item>
<widget class="QGroupBox" name="grpEELogging">
<property name="title">
<string>EE</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QGridLayout" name="grpEELoggingGrid">
<item row="4" column="1">
<widget class="QCheckBox" name="chkEEDMACTRL">
<property name="text">
<string>DMA Control</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="chkEEMFIFO">
<property name="text">
<string>SPR / MFIFO</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QCheckBox" name="chkEEVIF">
<property name="text">
<string>VIF</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="chkEECOP1">
<property name="text">
<string>COP1 (FPU)</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="chkEEMSKPATH3">
<property name="text">
<string>MSKPATH3</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="chkEECache">
<property name="text">
<string>Cache</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QCheckBox" name="chkEEGIF">
<property name="text">
<string>GIF</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="chkEER5900">
<property name="text">
<string>R5900</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="chkEECOP0">
<property name="text">
<string>COP0</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="chkEEMMIO">
<property name="text">
<string>HW Regs (MMIO)</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QCheckBox" name="chkEECounters">
<property name="text">
<string>Counters</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QCheckBox" name="chkEESIF">
<property name="text">
<string>SIF</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="chkEECOP2">
<property name="text">
<string>COP2 (VU0 Macro)</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="chkEEVIFCodes">
<property name="text">
<string>VIFCodes</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="chkEEMemory">
<property name="text">
<string>Memory</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="chkEEUNKNWNMMIO">
<property name="text">
<string>Unknown MMIO</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="chkEEIPU">
<property name="text">
<string>IPU</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QCheckBox" name="chkEEBIOS">
<property name="text">
<string>BIOS</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="chkEEDMARegs">
<property name="text">
<string>DMA Registers</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QCheckBox" name="chkEEGIFTags">
<property name="text">
<string>GIFTags</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="eeLoggingSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="grpIOPLogging">
<property name="title">
<string>IOP</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QGridLayout" name="grpIOPLoggingGrid">
<item row="4" column="0">
<widget class="QCheckBox" name="chkIOPCounters">
<property name="text">
<string>Counters</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="chkIOPUNKNWNMMIO">
<property name="text">
<string>Unknown MMIO</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="chkIOPMMIO">
<property name="text">
<string>HW Regs (MMIO)</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="chkIOPCDVD">
<property name="text">
<string>CDVD</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="chkIOPR3000A">
<property name="text">
<string>R3000A</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="chkIOPMemcards">
<property name="text">
<string>Memcards</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="chkIOPDMARegs">
<property name="text">
<string>DMA Registers</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="chkIOPPad">
<property name="text">
<string>Pad</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="chkIOPBIOS">
<property name="text">
<string>BIOS</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="chkIOPMDEC">
<property name="text">
<string>MDEC</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="chkIOPDMACTRL">
<property name="text">
<string>DMA Control</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="chkIOPCOP2">
<property name="text">
<string>COP2 (GPU)</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="iopLoggingSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

View File

@ -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;
};

View File

@ -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)

View File

@ -3,15 +3,12 @@
#pragma once
#include "common/TraceLog.h"
#include "common/Console.h"
#include "Config.h"
#include "Memory.h"
#include <string>
// 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);
@ -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
struct LogDescriptor
{
TraceLogDescriptor base;
const char* Prefix;
std::string Prefix;
std::string Name;
std::string Description;
};
struct LogBase
{
const LogDescriptor& Descriptor;
ConsoleColors Color;
bool Enabled = false;
LogBase(const LogDescriptor& descriptor, ConsoleColors color = Color_Gray)
: Descriptor(descriptor)
, Color(color) {};
};
// --------------------------------------------------------------------------------------
// SysTraceLog
// TraceLog
// --------------------------------------------------------------------------------------
// 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 TraceLog : public LogBase
{
public:
// Pass me a NULL and you *will* suffer! Muahahaha.
SysTraceLog( const SysTraceLogDescriptor* desc )
: TextFileTraceLog( &desc->base ) {}
TraceLog(const LogDescriptor& descriptor, ConsoleColors color = Color_Gray)
: LogBase(descriptor, color) {};
void DoWrite( const char *fmt ) const override;
bool IsActive() const override
bool Write(const char* fmt, ...) const;
bool Write(ConsoleColors color, const char* fmt, ...) const;
bool IsActive() const
{
return EmuConfig.Trace.Enabled && Enabled;
}
};
class SysTraceLog_EE : public SysTraceLog
struct ConsoleLog : public LogBase
{
typedef SysTraceLog _parent;
ConsoleLog(const LogDescriptor& descriptor, ConsoleColors color = Color_Gray)
: LogBase(descriptor, color) {};
public:
SysTraceLog_EE( const SysTraceLogDescriptor* desc ) : _parent( desc ) {}
void ApplyPrefix( std::string& ascii ) const override;
bool IsActive() const override
bool Write(const char* fmt, ...) const;
bool Write(ConsoleColors color, const char* fmt, ...) const;
bool IsActive() const
{
return SysTraceLog::IsActive() && EmuConfig.Trace.EE.m_EnableAll;
return Enabled;
}
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"; }
};
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
{
typedef SysTraceLog_IOP _parent;
public:
SysTraceLog_IOP_Registers( const SysTraceLogDescriptor* desc ) : _parent( desc ) {}
bool IsActive() const override
{
return _parent::IsActive() && EmuConfig.Trace.IOP.m_EnableRegisters;
}
std::string GetCategory() const override { return _parent::GetCategory() + ".Registers"; }
};
class SysTraceLog_IOP_Events : public SysTraceLog_IOP
{
typedef SysTraceLog_IOP _parent;
public:
SysTraceLog_IOP_Events( const SysTraceLogDescriptor* desc ) : _parent( desc ) {}
bool IsActive() const override
{
return _parent::IsActive() && EmuConfig.Trace.IOP.m_EnableEvents;
}
std::string GetCategory() const override { return _parent::GetCategory() + ".Events"; }
};
// --------------------------------------------------------------------------------------
@ -209,12 +93,10 @@ public:
// 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 @@ public:
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;
TraceLog Bios;
TraceLog Memory;
TraceLog GIFtag;
TraceLog VIFcode;
TraceLog MSKPATH3;
SysTraceLog_EE_Disasm R5900;
SysTraceLog_EE_Disasm COP0;
SysTraceLog_EE_Disasm COP1;
SysTraceLog_EE_Disasm COP2;
SysTraceLog_EE_Disasm Cache;
TraceLog R5900;
TraceLog COP0;
TraceLog COP1;
TraceLog COP2;
TraceLog Cache;
SysTraceLog_EE_Registers KnownHw;
SysTraceLog_EE_Registers UnknownHw;
SysTraceLog_EE_Registers DMAhw;
SysTraceLog_EE_Registers IPU;
TraceLog KnownHw;
TraceLog UnknownHw;
TraceLog DMAhw;
TraceLog IPU;
SysTraceLog_EE_Events DMAC;
SysTraceLog_EE_Events Counters;
SysTraceLog_EE_Events SPR;
TraceLog DMAC;
TraceLog Counters;
TraceLog SPR;
SysTraceLog_EE_Events VIF;
SysTraceLog_EE_Events GIF;
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<Color_Cyan> eeConsole;
ConsoleLogFromVM<Color_Yellow> iopConsole;
@ -325,26 +210,24 @@ struct SysConsoleLogPack
ConsoleLogFromVM<Color_StrongMagenta> recordingConsole;
ConsoleLogFromVM<Color_Red> 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

View File

@ -7,7 +7,7 @@
#include "DisassemblyManager.h"
#include "Memory.h"
#include "Debug.h"
#include "common/StringUtil.h"
#include "MIPSAnalyst.h"
int DisassemblyManager::maxParamChars = 29;

View File

@ -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"

View File

@ -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];

View File

@ -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:
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);
SettingsWrapEntry(EE.bitset);
SettingsWrapEntry(IOP.bitset);
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

View File

@ -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;

View File

@ -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"

View File

@ -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);
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);
if (emuLog != NULL)
{
std::vfprintf(emuLog, fmt, list);
fputs("\n", emuLog);
fflush(emuLog);
return false;
}
va_end(list);
bool TraceLog::Write(ConsoleColors color, const char* fmt, ...) const
{
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);
return false;
}
void SysTraceLog::DoWrite(const char* msg) const
bool ConsoleLog::Write(const char* fmt, ...) const
{
if (emuLog == NULL)
return;
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);
fputs(msg, emuLog);
fputs("\n", emuLog);
fflush(emuLog);
return false;
}
void SysTraceLog_EE::ApplyPrefix(std::string& ascii) const
bool ConsoleLog::Write(ConsoleColors color, 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);
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);
}
va_list args;
va_start(args, fmt);
Console.WriteLn(color, prefixed_str.c_str(), args);
va_end(args);
void SysTraceLog_VIFcode::ApplyPrefix(std::string& ascii) const
{
_parent::ApplyPrefix(ascii);
ascii.append("vifCode_");
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)
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(&TLD_EE_R5900)
, COP0(&TLD_EE_COP0)
, COP1(&TLD_EE_COP1)
, COP2(&TLD_EE_COP2)
, Cache(&TLD_EE_Cache)
, R5900(LD_EE_R5900)
, COP0(LD_EE_COP0)
, COP1(LD_EE_COP1)
, COP2(LD_EE_COP2)
, Cache(LD_EE_Cache)
, KnownHw(&TLD_EE_KnownHw)
, UnknownHw(&TLD_EE_UnknownHw)
, DMAhw(&TLD_EE_DMAhw)
, IPU(&TLD_EE_IPU)
, KnownHw(LD_EE_KnownHw)
, UnknownHw(LD_EE_UnknownHw)
, DMAhw(LD_EE_DMAhw)
, IPU(LD_EE_IPU)
, DMAC(&TLD_EE_DMAC)
, Counters(&TLD_EE_Counters)
, SPR(&TLD_EE_SPR)
, DMAC(LD_EE_DMAC)
, Counters(LD_EE_Counters)
, SPR(LD_EE_SPR)
, VIF(&TLD_EE_VIF)
, GIF(&TLD_EE_GIF)
, 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)
{
}

View File

@ -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()

View File

@ -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);
}

View File

@ -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;

View File

@ -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;

View File

@ -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));

View File

@ -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);