2019-12-11 14:52:12 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-02-02 18:18:12 +00:00
|
|
|
#include <QWidget>
|
2019-12-11 14:52:12 +00:00
|
|
|
#include <QTableView>
|
2024-03-21 14:24:08 -04:00
|
|
|
#include "DisAsmTableModel.h"
|
2019-12-11 14:52:12 +00:00
|
|
|
|
2019-12-19 22:20:32 +00:00
|
|
|
#include "signal/Signal.h"
|
|
|
|
#include "MIPS.h"
|
2019-12-11 14:52:12 +00:00
|
|
|
#include "VirtualMachineStateView.h"
|
|
|
|
|
2020-02-05 21:35:11 +00:00
|
|
|
class CDisAsmWnd : public QTableView, public CVirtualMachineStateView
|
2019-12-11 14:52:12 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-12-19 22:20:32 +00:00
|
|
|
typedef Framework::CSignal<void(uint32)> FindCallersRequestedEvent;
|
2019-12-11 14:52:12 +00:00
|
|
|
|
2024-03-21 14:24:08 -04:00
|
|
|
CDisAsmWnd(QWidget*, CVirtualMachine&, CMIPS*, const char*, uint64, CDisAsmTableModel::DISASM_TYPE);
|
2020-02-06 14:12:26 +00:00
|
|
|
virtual ~CDisAsmWnd() = default;
|
2019-12-11 14:52:12 +00:00
|
|
|
|
|
|
|
void HandleMachineStateChange() override;
|
|
|
|
void HandleRunningStateChange(CVirtualMachine::STATUS) override;
|
|
|
|
|
2019-12-19 22:20:32 +00:00
|
|
|
void SetAddress(uint32);
|
|
|
|
void SetCenterAtAddress(uint32);
|
|
|
|
void SetSelectedAddress(uint32);
|
|
|
|
|
|
|
|
FindCallersRequestedEvent FindCallersRequested;
|
|
|
|
|
2021-02-11 10:43:52 -05:00
|
|
|
protected:
|
|
|
|
int sizeHintForColumn(int) const override;
|
2021-02-12 08:50:39 -05:00
|
|
|
void verticalScrollbarValueChanged(int) override;
|
2021-02-11 10:43:52 -05:00
|
|
|
|
2019-12-11 14:52:12 +00:00
|
|
|
private:
|
2019-12-19 22:20:32 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
HISTORY_STACK_MAX = 20
|
|
|
|
};
|
|
|
|
typedef std::pair<uint32, uint32> SelectionRangeType;
|
|
|
|
|
2021-02-13 11:51:05 -05:00
|
|
|
int ComputeNumericalCellWidth() const;
|
|
|
|
|
2019-12-19 22:20:32 +00:00
|
|
|
uint32 GetInstruction(uint32);
|
|
|
|
|
|
|
|
void GotoAddress();
|
|
|
|
void GotoPC();
|
|
|
|
void GotoEA();
|
|
|
|
void EditComment();
|
|
|
|
void FindCallers();
|
|
|
|
void ToggleBreakpoint(uint32);
|
|
|
|
SelectionRangeType GetSelectionRange();
|
|
|
|
void HistoryReset();
|
|
|
|
void HistorySave(uint32);
|
|
|
|
void HistoryGoBack();
|
|
|
|
void HistoryGoForward();
|
|
|
|
uint32 HistoryGetPrevious();
|
|
|
|
uint32 HistoryGetNext();
|
|
|
|
bool HistoryHasPrevious();
|
|
|
|
bool HistoryHasNext();
|
2019-12-19 22:08:55 +00:00
|
|
|
void ShowContextMenu(const QPoint&);
|
2019-12-11 23:41:09 +00:00
|
|
|
void selectionChanged();
|
2019-12-12 00:20:49 +00:00
|
|
|
void OnCopy();
|
2019-12-19 22:20:32 +00:00
|
|
|
|
2019-12-12 00:20:49 +00:00
|
|
|
std::string GetInstructionDetailsText(uint32);
|
|
|
|
std::string GetInstructionDetailsTextVu(uint32);
|
2019-12-19 22:20:32 +00:00
|
|
|
|
2019-12-12 01:18:27 +00:00
|
|
|
void OnListDblClick();
|
|
|
|
|
2020-07-03 23:30:36 +01:00
|
|
|
bool isAddressInView(QModelIndex& index) const;
|
|
|
|
|
2019-12-19 22:20:32 +00:00
|
|
|
CVirtualMachine& m_virtualMachine;
|
|
|
|
CMIPS* m_ctx;
|
2021-01-26 19:19:00 -05:00
|
|
|
int32 m_instructionSize = 0;
|
2024-03-21 14:24:08 -04:00
|
|
|
CDisAsmTableModel::DISASM_TYPE m_disAsmType;
|
2019-12-19 22:20:32 +00:00
|
|
|
|
2021-02-13 11:51:05 -05:00
|
|
|
int m_numericalCellWidth = 0;
|
2021-01-26 19:19:00 -05:00
|
|
|
uint32 m_address = 0;
|
|
|
|
uint32 m_selected = MIPS_INVALID_PC;
|
|
|
|
uint32 m_selectionEnd = -1;
|
2019-12-19 22:20:32 +00:00
|
|
|
|
|
|
|
uint32 m_history[HISTORY_STACK_MAX];
|
|
|
|
unsigned int m_historyPosition;
|
|
|
|
unsigned int m_historySize;
|
|
|
|
|
2024-03-21 14:24:08 -04:00
|
|
|
CDisAsmTableModel* m_model = nullptr;
|
2019-12-11 14:52:12 +00:00
|
|
|
};
|