mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-23 19:42:40 +00:00
meh
This commit is contained in:
parent
2c393d35f0
commit
98c174edc4
520 changed files with 74815 additions and 58942 deletions
|
@ -38,6 +38,7 @@
|
|||
#include "DolphinQt/Debugger/AssembleInstructionDialog.h"
|
||||
#include "DolphinQt/Debugger/PatchInstructionDialog.h"
|
||||
#include "DolphinQt/Host.h"
|
||||
#include "DolphinQt/QtUtils/FromStdString.h"
|
||||
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
|
||||
#include "DolphinQt/Resources.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
@ -138,7 +139,8 @@ constexpr int CODE_VIEW_COLUMN_DESCRIPTION = 4;
|
|||
constexpr int CODE_VIEW_COLUMN_BRANCH_ARROWS = 5;
|
||||
constexpr int CODE_VIEW_COLUMNCOUNT = 6;
|
||||
|
||||
CodeViewWidget::CodeViewWidget() : m_system(Core::System::GetInstance())
|
||||
CodeViewWidget::CodeViewWidget()
|
||||
: m_system(Core::System::GetInstance()), m_ppc_symbol_db(m_system.GetPPCSymbolDB())
|
||||
{
|
||||
setColumnCount(CODE_VIEW_COLUMNCOUNT);
|
||||
setShowGrid(false);
|
||||
|
@ -171,9 +173,8 @@ CodeViewWidget::CodeViewWidget() : m_system(Core::System::GetInstance())
|
|||
|
||||
connect(this, &CodeViewWidget::customContextMenuRequested, this, &CodeViewWidget::OnContextMenu);
|
||||
connect(this, &CodeViewWidget::itemSelectionChanged, this, &CodeViewWidget::OnSelectionChanged);
|
||||
connect(&Settings::Instance(), &Settings::DebugFontChanged, this, &QWidget::setFont);
|
||||
connect(&Settings::Instance(), &Settings::DebugFontChanged, this,
|
||||
&CodeViewWidget::FontBasedSizing);
|
||||
&CodeViewWidget::OnDebugFontChanged);
|
||||
|
||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this] {
|
||||
m_address = m_system.GetPPCState().pc;
|
||||
|
@ -183,6 +184,8 @@ CodeViewWidget::CodeViewWidget() : m_system(Core::System::GetInstance())
|
|||
m_address = m_system.GetPPCState().pc;
|
||||
Update();
|
||||
});
|
||||
connect(Host::GetInstance(), &Host::PPCSymbolsChanged, this,
|
||||
qOverload<>(&CodeViewWidget::Update));
|
||||
|
||||
connect(&Settings::Instance(), &Settings::ThemeChanged, this,
|
||||
qOverload<>(&CodeViewWidget::Update));
|
||||
|
@ -207,7 +210,7 @@ void CodeViewWidget::FontBasedSizing()
|
|||
// just text width is too small with some fonts, so increase by a bit
|
||||
constexpr int extra_text_width = 8;
|
||||
|
||||
const QFontMetrics fm(Settings::Instance().GetDebugFont());
|
||||
const QFontMetrics fm(font());
|
||||
|
||||
const int rowh = fm.height() + 1;
|
||||
verticalHeader()->setMaximumSectionSize(rowh);
|
||||
|
@ -265,7 +268,7 @@ void CodeViewWidget::Update()
|
|||
if (m_updating)
|
||||
return;
|
||||
|
||||
if (Core::GetState() == Core::State::Paused)
|
||||
if (Core::GetState(m_system) == Core::State::Paused)
|
||||
{
|
||||
Core::CPUThreadGuard guard(m_system);
|
||||
Update(&guard);
|
||||
|
@ -324,7 +327,7 @@ void CodeViewWidget::Update(const Core::CPUThreadGuard* guard)
|
|||
|
||||
std::string ins = (split == std::string::npos ? disas : disas.substr(0, split));
|
||||
std::string param = (split == std::string::npos ? "" : disas.substr(split + 1));
|
||||
std::string desc = debug_interface.GetDescription(addr);
|
||||
const std::string_view desc = debug_interface.GetDescription(addr);
|
||||
|
||||
// Adds whitespace and a minimum size to ins and param. Helps to prevent frequent resizing while
|
||||
// scrolling.
|
||||
|
@ -332,7 +335,7 @@ void CodeViewWidget::Update(const Core::CPUThreadGuard* guard)
|
|||
QStringLiteral("%1").arg(QString::fromStdString(ins), -7, QLatin1Char(' '));
|
||||
const QString param_formatted =
|
||||
QStringLiteral("%1").arg(QString::fromStdString(param), -19, QLatin1Char(' '));
|
||||
const QString desc_formatted = QStringLiteral("%1 ").arg(QString::fromStdString(desc));
|
||||
const QString desc_formatted = QStringLiteral("%1 ").arg(QtUtils::FromStdString(desc));
|
||||
|
||||
auto* ins_item = new QTableWidgetItem(ins_formatted);
|
||||
auto* param_item = new QTableWidgetItem(param_formatted);
|
||||
|
@ -372,7 +375,7 @@ void CodeViewWidget::Update(const Core::CPUThreadGuard* guard)
|
|||
branch.is_link = IsBranchInstructionWithLink(ins);
|
||||
|
||||
description_item->setText(
|
||||
tr("--> %1").arg(QString::fromStdString(debug_interface.GetDescription(branch_addr))));
|
||||
tr("--> %1").arg(QtUtils::FromStdString(debug_interface.GetDescription(branch_addr))));
|
||||
param_item->setForeground(dark_theme ? QColor(255, 135, 255) : Qt::magenta);
|
||||
}
|
||||
|
||||
|
@ -382,7 +385,7 @@ void CodeViewWidget::Update(const Core::CPUThreadGuard* guard)
|
|||
if (debug_interface.IsBreakpoint(addr))
|
||||
{
|
||||
auto icon = Resources::GetThemeIcon("debugger_breakpoint").pixmap(QSize(rowh - 2, rowh - 2));
|
||||
if (!m_system.GetPowerPC().GetBreakPoints().IsBreakPointEnable(addr))
|
||||
if (!power_pc.GetBreakPoints().IsBreakPointEnable(addr))
|
||||
{
|
||||
QPixmap disabled_icon(icon.size());
|
||||
disabled_icon.fill(Qt::transparent);
|
||||
|
@ -410,7 +413,7 @@ void CodeViewWidget::Update(const Core::CPUThreadGuard* guard)
|
|||
|
||||
CalculateBranchIndentation();
|
||||
|
||||
g_symbolDB.FillInCallers();
|
||||
m_ppc_symbol_db.FillInCallers();
|
||||
|
||||
repaint();
|
||||
m_updating = false;
|
||||
|
@ -555,13 +558,14 @@ void CodeViewWidget::ReplaceAddress(u32 address, ReplaceWith replace)
|
|||
void CodeViewWidget::OnContextMenu()
|
||||
{
|
||||
QMenu* menu = new QMenu(this);
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
const bool running = Core::GetState() != Core::State::Uninitialized;
|
||||
const bool paused = Core::GetState() == Core::State::Paused;
|
||||
const bool running = Core::GetState(m_system) != Core::State::Uninitialized;
|
||||
const bool paused = Core::GetState(m_system) == Core::State::Paused;
|
||||
|
||||
const u32 addr = GetContextAddress();
|
||||
|
||||
bool has_symbol = g_symbolDB.GetSymbolFromAddr(addr);
|
||||
const bool has_symbol = m_ppc_symbol_db.GetSymbolFromAddr(addr);
|
||||
|
||||
auto* follow_branch_action =
|
||||
menu->addAction(tr("Follow &branch"), this, &CodeViewWidget::OnFollowBranch);
|
||||
|
@ -744,6 +748,12 @@ void CodeViewWidget::AutoStep(CodeTrace::AutoStop option)
|
|||
} while (msgbox.clickedButton() == (QAbstractButton*)run_button);
|
||||
}
|
||||
|
||||
void CodeViewWidget::OnDebugFontChanged(const QFont& font)
|
||||
{
|
||||
setFont(font);
|
||||
FontBasedSizing();
|
||||
}
|
||||
|
||||
void CodeViewWidget::OnCopyAddress()
|
||||
{
|
||||
const u32 addr = GetContextAddress();
|
||||
|
@ -753,7 +763,7 @@ void CodeViewWidget::OnCopyAddress()
|
|||
|
||||
void CodeViewWidget::OnCopyTargetAddress()
|
||||
{
|
||||
if (Core::GetState() != Core::State::Paused)
|
||||
if (Core::GetState(m_system) != Core::State::Paused)
|
||||
return;
|
||||
|
||||
const u32 addr = GetContextAddress();
|
||||
|
@ -783,7 +793,7 @@ void CodeViewWidget::OnShowInMemory()
|
|||
|
||||
void CodeViewWidget::OnShowTargetInMemory()
|
||||
{
|
||||
if (Core::GetState() != Core::State::Paused)
|
||||
if (Core::GetState(m_system) != Core::State::Paused)
|
||||
return;
|
||||
|
||||
const u32 addr = GetContextAddress();
|
||||
|
@ -819,7 +829,7 @@ void CodeViewWidget::OnCopyFunction()
|
|||
{
|
||||
const u32 address = GetContextAddress();
|
||||
|
||||
const Common::Symbol* symbol = g_symbolDB.GetSymbolFromAddr(address);
|
||||
const Common::Symbol* const symbol = m_ppc_symbol_db.GetSymbolFromAddr(address);
|
||||
if (!symbol)
|
||||
return;
|
||||
|
||||
|
@ -877,9 +887,8 @@ void CodeViewWidget::OnAddFunction()
|
|||
|
||||
Core::CPUThreadGuard guard(m_system);
|
||||
|
||||
g_symbolDB.AddFunction(guard, addr);
|
||||
emit SymbolsChanged();
|
||||
Update(&guard);
|
||||
m_ppc_symbol_db.AddFunction(guard, addr);
|
||||
emit Host::GetInstance()->PPCSymbolsChanged();
|
||||
}
|
||||
|
||||
void CodeViewWidget::OnInsertBLR()
|
||||
|
@ -915,7 +924,7 @@ void CodeViewWidget::OnRenameSymbol()
|
|||
{
|
||||
const u32 addr = GetContextAddress();
|
||||
|
||||
Common::Symbol* const symbol = g_symbolDB.GetSymbolFromAddr(addr);
|
||||
Common::Symbol* const symbol = m_ppc_symbol_db.GetSymbolFromAddr(addr);
|
||||
|
||||
if (!symbol)
|
||||
return;
|
||||
|
@ -928,8 +937,7 @@ void CodeViewWidget::OnRenameSymbol()
|
|||
if (good && !name.isEmpty())
|
||||
{
|
||||
symbol->Rename(name.toStdString());
|
||||
emit SymbolsChanged();
|
||||
Update();
|
||||
emit Host::GetInstance()->PPCSymbolsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -950,7 +958,7 @@ void CodeViewWidget::OnSetSymbolSize()
|
|||
{
|
||||
const u32 addr = GetContextAddress();
|
||||
|
||||
Common::Symbol* const symbol = g_symbolDB.GetSymbolFromAddr(addr);
|
||||
Common::Symbol* const symbol = m_ppc_symbol_db.GetSymbolFromAddr(addr);
|
||||
|
||||
if (!symbol)
|
||||
return;
|
||||
|
@ -967,15 +975,14 @@ void CodeViewWidget::OnSetSymbolSize()
|
|||
Core::CPUThreadGuard guard(m_system);
|
||||
|
||||
PPCAnalyst::ReanalyzeFunction(guard, symbol->address, *symbol, size);
|
||||
emit SymbolsChanged();
|
||||
Update(&guard);
|
||||
emit Host::GetInstance()->PPCSymbolsChanged();
|
||||
}
|
||||
|
||||
void CodeViewWidget::OnSetSymbolEndAddress()
|
||||
{
|
||||
const u32 addr = GetContextAddress();
|
||||
|
||||
Common::Symbol* const symbol = g_symbolDB.GetSymbolFromAddr(addr);
|
||||
Common::Symbol* const symbol = m_ppc_symbol_db.GetSymbolFromAddr(addr);
|
||||
|
||||
if (!symbol)
|
||||
return;
|
||||
|
@ -995,8 +1002,7 @@ void CodeViewWidget::OnSetSymbolEndAddress()
|
|||
Core::CPUThreadGuard guard(m_system);
|
||||
|
||||
PPCAnalyst::ReanalyzeFunction(guard, symbol->address, *symbol, address - symbol->address);
|
||||
emit SymbolsChanged();
|
||||
Update(&guard);
|
||||
emit Host::GetInstance()->PPCSymbolsChanged();
|
||||
}
|
||||
|
||||
void CodeViewWidget::OnReplaceInstruction()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue