2018-02-14 22:25:01 +00:00
|
|
|
// Copyright 2018 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2018-02-14 22:25:01 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <QTableWidget>
|
|
|
|
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
|
|
|
|
class QKeyEvent;
|
|
|
|
class QMouseEvent;
|
|
|
|
class QResizeEvent;
|
2019-07-06 08:50:11 +00:00
|
|
|
class QShowEvent;
|
2018-02-14 22:25:01 +00:00
|
|
|
|
2020-02-23 17:57:08 +00:00
|
|
|
struct CodeViewBranch;
|
|
|
|
class BranchDisplayDelegate;
|
|
|
|
|
2018-02-14 22:25:01 +00:00
|
|
|
class CodeViewWidget : public QTableWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2018-05-05 22:17:06 +00:00
|
|
|
enum class SetAddressUpdate
|
|
|
|
{
|
|
|
|
WithUpdate,
|
2021-02-14 12:01:32 +00:00
|
|
|
WithoutUpdate,
|
|
|
|
WithDetailedUpdate
|
2018-05-05 22:17:06 +00:00
|
|
|
};
|
|
|
|
|
2018-02-14 22:25:01 +00:00
|
|
|
explicit CodeViewWidget();
|
2020-02-23 17:57:08 +00:00
|
|
|
~CodeViewWidget() override;
|
2018-02-14 22:25:01 +00:00
|
|
|
|
|
|
|
u32 GetAddress() const;
|
|
|
|
u32 GetContextAddress() const;
|
2018-05-05 22:17:06 +00:00
|
|
|
void SetAddress(u32 address, SetAddressUpdate update);
|
2018-02-14 22:25:01 +00:00
|
|
|
|
2019-01-12 01:25:28 +00:00
|
|
|
// Set tighter row height. Set BP column sizing. This needs to run when font type changes.
|
|
|
|
void FontBasedSizing();
|
2018-02-14 22:25:01 +00:00
|
|
|
void Update();
|
|
|
|
|
|
|
|
void ToggleBreakpoint();
|
|
|
|
void AddBreakpoint();
|
2018-12-28 18:12:30 +00:00
|
|
|
|
2020-02-23 17:57:08 +00:00
|
|
|
u32 AddressForRow(int row) const;
|
|
|
|
|
2018-02-14 22:25:01 +00:00
|
|
|
signals:
|
|
|
|
void RequestPPCComparison(u32 addr);
|
2018-12-28 18:12:30 +00:00
|
|
|
void ShowMemory(u32 address);
|
2018-02-14 22:25:01 +00:00
|
|
|
void SymbolsChanged();
|
|
|
|
void BreakpointsChanged();
|
2021-02-14 12:01:32 +00:00
|
|
|
void UpdateCodeWidget();
|
2018-02-14 22:25:01 +00:00
|
|
|
|
|
|
|
private:
|
2018-05-13 22:24:30 +00:00
|
|
|
enum class ReplaceWith
|
|
|
|
{
|
|
|
|
BLR,
|
|
|
|
NOP
|
|
|
|
};
|
|
|
|
|
|
|
|
void ReplaceAddress(u32 address, ReplaceWith replace);
|
2018-02-14 22:25:01 +00:00
|
|
|
|
|
|
|
void resizeEvent(QResizeEvent*) override;
|
|
|
|
void keyPressEvent(QKeyEvent* event) override;
|
|
|
|
void mousePressEvent(QMouseEvent* event) override;
|
|
|
|
void wheelEvent(QWheelEvent* event) override;
|
2019-07-06 08:50:11 +00:00
|
|
|
void showEvent(QShowEvent* event) override;
|
2018-02-14 22:25:01 +00:00
|
|
|
|
|
|
|
void OnContextMenu();
|
|
|
|
|
|
|
|
void OnFollowBranch();
|
|
|
|
void OnCopyAddress();
|
2018-12-28 18:12:30 +00:00
|
|
|
void OnShowInMemory();
|
2018-02-14 22:25:01 +00:00
|
|
|
void OnCopyFunction();
|
|
|
|
void OnCopyCode();
|
|
|
|
void OnCopyHex();
|
|
|
|
void OnRenameSymbol();
|
2018-05-05 08:21:15 +00:00
|
|
|
void OnSelectionChanged();
|
2018-02-14 22:25:01 +00:00
|
|
|
void OnSetSymbolSize();
|
|
|
|
void OnSetSymbolEndAddress();
|
|
|
|
void OnRunToHere();
|
|
|
|
void OnAddFunction();
|
|
|
|
void OnPPCComparison();
|
|
|
|
void OnInsertBLR();
|
|
|
|
void OnInsertNOP();
|
|
|
|
void OnReplaceInstruction();
|
2018-05-21 14:46:03 +00:00
|
|
|
void OnRestoreInstruction();
|
2018-02-14 22:25:01 +00:00
|
|
|
|
2020-02-26 20:33:43 +00:00
|
|
|
void CalculateBranchIndentation();
|
|
|
|
|
2018-02-14 22:25:01 +00:00
|
|
|
bool m_updating = false;
|
|
|
|
|
|
|
|
u32 m_address = 0;
|
|
|
|
u32 m_context_address = 0;
|
2020-02-23 17:57:08 +00:00
|
|
|
|
|
|
|
std::vector<CodeViewBranch> m_branches;
|
|
|
|
|
|
|
|
friend class BranchDisplayDelegate;
|
2018-02-14 22:25:01 +00:00
|
|
|
};
|