dolphin/Source/Core/DolphinQt2/Debugger/CodeViewWidget.h
Lioncash d7a3ce26de CodeViewWidget: Get rid of magic values in OnInsertBLR() and OnInsertNOP()
A call like ReplaceAddress(address, 0) is pretty ambiguous; so is
ReplaceAddress(address, false), so use an enum class that tells people
straight-up what the replacer is.

This also gets rid of the really weird naming, where if 'blr' is true,
we'd be replacing the address with a NOP, rather than an actual BLR
instruction, so we invert that so it actually makes sense. There's no
actual bug fixed here though, considering the OnInsert functions
specified the correct values; it's literally just weird naming.
2018-05-13 18:33:51 -04:00

86 lines
1.6 KiB
C++

// Copyright 2018 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <vector>
#include <QTableWidget>
#include "Common/CommonTypes.h"
class QKeyEvent;
class QMouseEvent;
class QResizeEvent;
class CodeViewWidget : public QTableWidget
{
Q_OBJECT
public:
enum class SetAddressUpdate
{
WithUpdate,
WithoutUpdate
};
explicit CodeViewWidget();
u32 GetAddress() const;
u32 GetContextAddress() const;
void SetAddress(u32 address, SetAddressUpdate update);
void Update();
void ToggleBreakpoint();
void AddBreakpoint();
signals:
void RequestPPCComparison(u32 addr);
void SymbolsChanged();
void BreakpointsChanged();
private:
enum class ReplaceWith
{
BLR,
NOP
};
void ReplaceAddress(u32 address, ReplaceWith replace);
void resizeEvent(QResizeEvent*) override;
void keyPressEvent(QKeyEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;
void wheelEvent(QWheelEvent* event) override;
void OnContextMenu();
void OnFollowBranch();
void OnCopyAddress();
void OnCopyFunction();
void OnCopyCode();
void OnCopyHex();
void OnRenameSymbol();
void OnSelectionChanged();
void OnSetSymbolSize();
void OnSetSymbolEndAddress();
void OnRunToHere();
void OnAddFunction();
void OnPPCComparison();
void OnInsertBLR();
void OnInsertNOP();
void OnReplaceInstruction();
struct ReplStruct
{
u32 address;
u32 old_value;
};
std::vector<ReplStruct> m_repl_list;
bool m_updating = false;
u32 m_address = 0;
u32 m_context_address = 0;
};