2015-01-04 18:36:57 +01:00
|
|
|
// Copyright 2014 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2015-02-03 20:45:33 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
2014-04-01 04:26:50 +02:00
|
|
|
#include <QDockWidget>
|
2014-04-11 02:50:10 +02:00
|
|
|
#include "common/break_points.h"
|
2015-05-06 09:06:12 +02:00
|
|
|
#include "common/common_types.h"
|
2016-09-20 17:21:23 +02:00
|
|
|
#include "ui_disassembler.h"
|
2014-04-01 04:26:50 +02:00
|
|
|
|
|
|
|
class QAction;
|
2015-04-29 06:01:41 +02:00
|
|
|
class EmuThread;
|
2014-04-01 04:26:50 +02:00
|
|
|
|
2016-09-18 02:38:01 +02:00
|
|
|
class DisassemblerModel : public QAbstractListModel {
|
2014-07-02 21:16:36 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
DisassemblerModel(QObject* parent);
|
|
|
|
|
|
|
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
|
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
|
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
|
|
|
|
|
|
|
QModelIndex IndexFromAbsoluteAddress(unsigned int address) const;
|
|
|
|
const BreakPoints& GetBreakPoints() const;
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void ParseFromAddress(unsigned int address);
|
|
|
|
void OnSelectionChanged(const QModelIndex&);
|
|
|
|
void OnSetOrUnsetBreakpoint();
|
|
|
|
void SetNextInstruction(unsigned int address);
|
|
|
|
|
|
|
|
private:
|
|
|
|
unsigned int base_address;
|
|
|
|
unsigned int code_size;
|
|
|
|
unsigned int program_counter;
|
|
|
|
|
|
|
|
QModelIndex selection;
|
|
|
|
|
|
|
|
// TODO: Make BreakPoints less crappy (i.e. const-correct) so that this needn't be mutable.
|
|
|
|
mutable BreakPoints breakpoints;
|
|
|
|
};
|
|
|
|
|
2016-09-18 02:38:01 +02:00
|
|
|
class DisassemblerWidget : public QDockWidget {
|
2014-04-01 04:26:50 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2015-04-29 06:01:41 +02:00
|
|
|
DisassemblerWidget(QWidget* parent, EmuThread* emu_thread);
|
2014-04-01 04:26:50 +02:00
|
|
|
|
2014-04-04 03:24:07 +02:00
|
|
|
void Init();
|
|
|
|
|
2014-04-01 04:26:50 +02:00
|
|
|
public slots:
|
2014-04-04 03:24:07 +02:00
|
|
|
void OnContinue();
|
2014-04-01 04:26:50 +02:00
|
|
|
void OnStep();
|
2014-04-04 03:24:07 +02:00
|
|
|
void OnStepInto();
|
2014-04-01 04:26:50 +02:00
|
|
|
void OnPause();
|
2014-04-04 03:24:07 +02:00
|
|
|
void OnToggleStartStop();
|
2014-04-01 04:26:50 +02:00
|
|
|
|
2015-01-07 12:14:23 +01:00
|
|
|
void OnDebugModeEntered();
|
|
|
|
void OnDebugModeLeft();
|
2014-04-01 04:26:50 +02:00
|
|
|
|
2015-05-01 01:46:50 +02:00
|
|
|
void OnEmulationStarting(EmuThread* emu_thread);
|
|
|
|
void OnEmulationStopping();
|
2015-04-29 06:01:41 +02:00
|
|
|
|
2014-04-01 04:26:50 +02:00
|
|
|
private:
|
|
|
|
// returns -1 if no row is selected
|
|
|
|
int SelectedRow();
|
|
|
|
|
|
|
|
Ui::DockWidget disasm_ui;
|
|
|
|
|
2014-07-02 21:16:36 +02:00
|
|
|
DisassemblerModel* model;
|
2014-04-01 04:26:50 +02:00
|
|
|
|
2014-07-02 21:16:36 +02:00
|
|
|
u32 base_addr;
|
2014-04-01 04:26:50 +02:00
|
|
|
|
2015-04-29 06:01:41 +02:00
|
|
|
EmuThread* emu_thread;
|
2014-04-01 04:26:50 +02:00
|
|
|
};
|