From cf33e852ef790a68ee9443eb5838a8a2489afa51 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 3 Jun 2018 11:20:59 -0700 Subject: [PATCH] Qt Debugger: Remove memory viewer. Being replaced by WebSocket based debugger. --- CMakeLists.txt | 5 - Qt/Debugger/ctrlmemview.cpp | 259 -------------------------------- Qt/Debugger/ctrlmemview.h | 91 ----------- Qt/Debugger/debugger_memory.cpp | 89 ----------- Qt/Debugger/debugger_memory.h | 45 ------ Qt/Debugger/debugger_memory.ui | 92 ------------ Qt/QtHost.h | 2 - Qt/mainwindow.cpp | 30 ---- Qt/mainwindow.h | 6 - Windows/PPSSPP.vcxproj | 15 -- Windows/PPSSPP.vcxproj.filters | 15 -- 11 files changed, 649 deletions(-) delete mode 100644 Qt/Debugger/ctrlmemview.cpp delete mode 100644 Qt/Debugger/ctrlmemview.h delete mode 100644 Qt/Debugger/debugger_memory.cpp delete mode 100644 Qt/Debugger/debugger_memory.h delete mode 100644 Qt/Debugger/debugger_memory.ui diff --git a/CMakeLists.txt b/CMakeLists.txt index 187fc2e21c4b..351d0e9381fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -757,7 +757,6 @@ elseif(USING_QT_UI) find_package(Qt5 COMPONENTS Multimedia) endif(NOT SDL2_FOUND) set(Qt_UI - Qt/Debugger/debugger_memory.ui Qt/Debugger/debugger_memorytex.ui ) qt5_wrap_ui(QT_UI_GEN ${Qt_UI}) @@ -769,10 +768,6 @@ elseif(USING_QT_UI) Qt/QtHost.h Qt/mainwindow.cpp Qt/mainwindow.h - Qt/Debugger/ctrlmemview.cpp - Qt/Debugger/ctrlmemview.h - Qt/Debugger/debugger_memory.cpp - Qt/Debugger/debugger_memory.h Qt/Debugger/debugger_memorytex.cpp Qt/Debugger/debugger_memorytex.h ) diff --git a/Qt/Debugger/ctrlmemview.cpp b/Qt/Debugger/ctrlmemview.cpp deleted file mode 100644 index 65079a0a0449..000000000000 --- a/Qt/Debugger/ctrlmemview.cpp +++ /dev/null @@ -1,259 +0,0 @@ -#include "ctrlmemview.h" - -#include -#include -#include -#include -#include -#include -#include - -#include "math.h" - -#include "Core/MemMap.h" -#include "Core/Debugger/SymbolMap.h" - -CtrlMemView::CtrlMemView(QWidget *parent) : - QWidget(parent) -{ - curAddress=0; - rowHeight=14; - align=4; - alignMul=4; - selecting=false; - mode=MV_NORMAL; - debugger = 0; - - setMinimumWidth(500); -} - -void CtrlMemView::redraw() -{ - update(); -} - -void CtrlMemView::wheelEvent(QWheelEvent* e) -{ - int numDegrees = e->delta() / 8; - int numSteps = numDegrees / 15; - if (e->orientation() == Qt::Vertical) - { - curAddress -= numSteps*align*alignMul; - redraw(); - } -} - -void CtrlMemView::keyPressEvent(QKeyEvent *e) -{ - int page=(rect().bottom()/rowHeight)/2-1; - - switch (e->key()) - { - case Qt::Key_Up: curAddress -= align*alignMul; break; - case Qt::Key_Down: curAddress += align*alignMul; break; - case Qt::Key_PageUp: curAddress -= page*align*alignMul; break; - case Qt::Key_PageDown: curAddress += page*align*alignMul; break; - default: QWidget::keyPressEvent(e); break; - } - - redraw(); -} - -void CtrlMemView::paintEvent(QPaintEvent *) -{ - QPainter painter(this); - painter.setBrush(Qt::white); - painter.setPen(Qt::white); - painter.drawRect(rect()); - - if (!debugger) - return; - - int width = rect().width(); - int numRows=(rect().bottom()/rowHeight)/2+1; - - QPen nullPen(0xFFFFFF); - QPen currentPen(0xFF000000); - QPen selPen(0x808080); - QBrush lbr(0xFFFFFF); - QBrush nullBrush(0xFFFFFF); - QBrush currentBrush(0xFFEFE8); - QBrush pcBrush(0x70FF70); - QPen textPen; - - QFont normalFont("Arial", 10); - QFont alignedFont("Monospace", 10); - alignedFont.setStyleHint(QFont::Monospace); - painter.setFont(normalFont); - - int i; - curAddress&=~(align-1); - for (i=-numRows; i<=numRows; i++) - { - unsigned int address=curAddress + i*align*alignMul; - - int rowY1 = rect().bottom()/2 + rowHeight*i - rowHeight/2; - int rowY2 = rect().bottom()/2 + rowHeight*i + rowHeight/2; - - char temp[256]; - - painter.setBrush(currentBrush); - - if (selecting && address == (unsigned int)selection) - painter.setPen(selPen); - else - painter.setPen(i==0 ? currentPen : nullPen); - painter.drawRect(0, rowY1, 16-1, rowY2 - rowY1 - 1); - - painter.drawRect(16, rowY1, width - 16 -1, rowY2 - rowY1 - 1); - painter.setBrush(nullBrush); - textPen.setColor(0x600000); - painter.setPen(textPen); - painter.setFont(alignedFont); - painter.drawText(17,rowY1-2+rowHeight, QString("%1").arg(address,8,16,QChar('0'))); - textPen.setColor(0xFF000000); - painter.setPen(textPen); - if (debugger->isAlive()) - { - - switch(mode) { - case MV_NORMAL: - { - const char *m = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; - if (Memory::IsValidAddress(address)) - { - u32 memory[4] = { - debugger->readMemory(address), - debugger->readMemory(address+4), - debugger->readMemory(address+8), - debugger->readMemory(address+12) - }; - m = (const char*)memory; - sprintf(temp, "%08x %08x %08x %08x ................", - memory[0],memory[1],memory[2],memory[3]); - } - for (int i=0; i<16; i++) - { - int c = (unsigned char)m[i]; - if (c>=32 && c<255) - temp[i+37]=c; - } - } - painter.setFont(alignedFont); - painter.drawText(85,rowY1 - 2 + rowHeight, temp); - break; - - case MV_SYMBOLS: - { -/* textPen.setColor(0x0000FF); - painter.setPen(textPen); - int fn = g_symbolMap->GetSymbolNum(address); - if (fn==-1) - { - sprintf(temp, "%s (ns)", Memory::GetAddressName(address)); - } - else - sprintf(temp, "%s (0x%x b)", g_symbolMap->GetSymbolName(fn),g_symbolMap->GetSymbolSize(fn)); - painter.drawText(205,rowY1 - 2 + rowHeight, temp); - - textPen.setColor(0xFF000000); - painter.setPen(textPen); - - if (align==4) - { - u32 value = Memory::ReadUnchecked_U32(address); - int symbolnum = g_symbolMap->GetSymbolNum(value); - if(symbolnum>=0) - sprintf(temp, "%08x [%s]", value, g_symbolMap->GetSymbolName(symbolnum)); - } - else if (align==2) - { - u16 value = Memory::ReadUnchecked_U16(address); - int symbolnum = g_symbolMap->GetSymbolNum(value); - if(symbolnum>=0) - sprintf(temp, "%04x [%s]", value, g_symbolMap->GetSymbolName(symbolnum)); - } - - painter.drawText(85,rowY1 - 2 + rowHeight, temp);*/ - break; - } - case MV_MAX: break; - } - } - } -} - -void CtrlMemView::mousePressEvent(QMouseEvent *e) -{ - int x = e->pos().x(); - int y = e->pos().y(); - if (x>16) - { - oldSelection=selection; - selection=yToAddress(y); - bool oldselecting=selecting; - selecting=true; - if (!oldselecting || (selection!=oldSelection)) - redraw(); - } -} - -void CtrlMemView::contextMenu(const QPoint &pos) -{ - QMenu menu(this); - - QAction *gotoDisAsm = new QAction(tr("Go to in &disasm"), this); - //connect(gotoDisAsm, SIGNAL(triggered()), this, SLOT(GotoDisAsm())); - menu.addAction(gotoDisAsm); - - menu.addSeparator(); - - QAction *copyValue = new QAction(tr("&Copy value"), this); - connect(copyValue, SIGNAL(triggered()), this, SLOT(CopyValue())); - menu.addAction(copyValue); - - QAction *changeValue = new QAction(tr("C&hange value"), this); - connect(changeValue, SIGNAL(triggered()), this, SLOT(Change())); - menu.addAction(changeValue); - - QAction *dump = new QAction(tr("Dump..."), this); - connect(dump, SIGNAL(triggered()), this, SLOT(Dump())); - menu.addAction(dump); - - menu.exec( mapToGlobal(pos)); -} - -void CtrlMemView::CopyValue() -{ - QApplication::clipboard()->setText(QString("%1").arg(Memory::ReadUnchecked_U32(selection),8,16,QChar('0'))); -} - -void CtrlMemView::Dump() -{ - QMessageBox::information(this,"Sorry","This feature has not been implemented.",QMessageBox::Ok); -} - - -void CtrlMemView::Change() -{ - QString curVal = QString("%1").arg(Memory::ReadUnchecked_U32(selection),8,16,QChar('0')); - - bool ok; - QString text = QInputDialog::getText(this, tr("Set new value"), - tr("Set new value:"), QLineEdit::Normal, - curVal, &ok); - if (ok && !text.isEmpty()) - { - Memory::WriteUnchecked_U32(text.toUInt(0,16),selection); - redraw(); - } -} - - -int CtrlMemView::yToAddress(int y) -{ - int ydiff=y-rect().bottom()/2-rowHeight/2; - ydiff=(int)(floor((float)ydiff / (float)rowHeight))+1; - return curAddress + ydiff * align*alignMul; -} - diff --git a/Qt/Debugger/ctrlmemview.h b/Qt/Debugger/ctrlmemview.h deleted file mode 100644 index e4b52cfe6360..000000000000 --- a/Qt/Debugger/ctrlmemview.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef CTRLMEMVIEW_H -#define CTRLMEMVIEW_H - -#include "Core/Debugger/DebugInterface.h" -#include - -enum MemViewMode -{ - MV_NORMAL, - MV_SYMBOLS, - MV_MAX -}; - -class CtrlMemView : public QWidget -{ - Q_OBJECT -public: - explicit CtrlMemView(QWidget *parent = 0); - - void setDebugger(DebugInterface *deb) - { - debugger=deb; - if (debugger) - align=debugger->getInstructionSize(0); - } - DebugInterface *getDebugger() - { - return debugger; - } - void redraw(); - - void setMode(MemViewMode m) - { - mode=m; - switch(mode) { - case MV_NORMAL: - alignMul=4; - break; - case MV_SYMBOLS: - alignMul=1; - break; - default: - break; - } - redraw(); - } - - void setAlign(int l) - { - align=l; - } - int yToAddress(int y); - - void gotoAddr(unsigned int addr) - { - curAddress=addr&(~(align-1)); - redraw(); - } - - unsigned int getSelection() - { - return curAddress; - } - void contextMenu(const QPoint &pos); -protected: - void paintEvent(QPaintEvent *); - void keyPressEvent(QKeyEvent *e); - void wheelEvent(QWheelEvent *e); - void mousePressEvent(QMouseEvent *e); - -public slots: - void CopyValue(); - void Dump(); - void Change(); -private: - int curAddress; - int align; - int alignMul; - int rowHeight; - - int selection; - int oldSelection; - bool selectionChanged; - bool selecting; - bool hasFocus; - - DebugInterface *debugger; - MemViewMode mode; -}; - -#endif // CTRLMEMVIEW_H diff --git a/Qt/Debugger/debugger_memory.cpp b/Qt/Debugger/debugger_memory.cpp deleted file mode 100644 index 706fd8dcfd4d..000000000000 --- a/Qt/Debugger/debugger_memory.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include "debugger_memory.h" -#include "ui_debugger_memory.h" -#include "Core/Debugger/SymbolMap.h" -#include - -Debugger_Memory::Debugger_Memory(DebugInterface *_cpu, MainWindow* mainWindow_, QWidget *parent) : - QDialog(parent), - ui(new Ui::Debugger_Memory), - cpu(_cpu), - mainWindow(mainWindow_) -{ - ui->setupUi(this); - - setWindowTitle(tr("Memory Viewer - %1").arg(cpu->GetName())); - - ui->memView->setDebugger(_cpu); -} - -Debugger_Memory::~Debugger_Memory() -{ - delete ui; -} - -void Debugger_Memory::Update() -{ - ui->memView->redraw(); -} - -void Debugger_Memory::Goto(u32 addr) -{ - show(); - ui->memView->gotoAddr(addr & ~3); -} - -void Debugger_Memory::on_editAddress_textChanged(const QString &arg1) -{ - ui->memView->gotoAddr(arg1.toUInt(0,16) & ~3); -} - -void Debugger_Memory::on_normalBtn_clicked() -{ - ui->memView->setMode(MV_NORMAL); -} - -void Debugger_Memory::on_symbolsBtn_clicked() -{ - ui->memView->setMode(MV_SYMBOLS); -} - -void Debugger_Memory::on_memView_customContextMenuRequested(const QPoint &pos) -{ - ui->memView->contextMenu(pos); -} - -void Debugger_Memory::NotifyMapLoaded() -{ - QListWidgetItem* item = new QListWidgetItem(); - item->setText("(0x80000000)"); - item->setData(Qt::UserRole, 0x80000000); - ui->symbols->addItem(item); - - std::vector symbols = g_symbolMap->GetAllSymbols(ST_DATA); - for(int i = 0; i < (int)symbols.size(); i++) - { - QListWidgetItem* item = new QListWidgetItem(); - item->setText(QString("%1 (%2)").arg(QString::fromStdString(symbols[i].name)).arg(symbols[i].size)); - item->setData(Qt::UserRole, symbols[i].address); - ui->symbols->addItem(item); - } - - ui->regions->clear(); - /* - for (int i = 0; i < cpu->getMemMap()->numRegions; i++) - { - int n = ComboBox_AddString(lb,cpu->getMemMap()->regions[i].name); - ComboBox_SetItemData(lb,n,cpu->getMemMap()->regions[i].start); - } - */ -} - -void Debugger_Memory::on_regions_currentIndexChanged(int index) -{ - ui->memView->gotoAddr(ui->regions->itemData(index,Qt::UserRole).toInt()); -} - -void Debugger_Memory::on_symbols_itemClicked(QListWidgetItem *item) -{ - ui->memView->gotoAddr(item->data(Qt::UserRole).toInt()); -} diff --git a/Qt/Debugger/debugger_memory.h b/Qt/Debugger/debugger_memory.h deleted file mode 100644 index c4593a5fef33..000000000000 --- a/Qt/Debugger/debugger_memory.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef DEBUGGER_MEMORY_H -#define DEBUGGER_MEMORY_H - -#include "Core/Debugger/DebugInterface.h" -#include -#include - -class MainWindow; -namespace Ui { -class Debugger_Memory; -} - -class Debugger_Memory : public QDialog -{ - Q_OBJECT - -public: - explicit Debugger_Memory(DebugInterface *_cpu, MainWindow* mainWindow_, QWidget *parent = 0); - ~Debugger_Memory(); - - void Update(); - void Goto(u32 addr); - - void NotifyMapLoaded(); -private slots: - void on_editAddress_textChanged(const QString &arg1); - - void on_normalBtn_clicked(); - - void on_symbolsBtn_clicked(); - - void on_memView_customContextMenuRequested(const QPoint &pos); - - void on_regions_currentIndexChanged(int index); - - void on_symbols_itemClicked(QListWidgetItem *item); - -private: - Ui::Debugger_Memory *ui; - DebugInterface* cpu; - MainWindow* mainWindow; - -}; - -#endif // DEBUGGER_MEMORY_H diff --git a/Qt/Debugger/debugger_memory.ui b/Qt/Debugger/debugger_memory.ui deleted file mode 100644 index abb94dcf3252..000000000000 --- a/Qt/Debugger/debugger_memory.ui +++ /dev/null @@ -1,92 +0,0 @@ - - - Debugger_Memory - - - - 0 - 0 - 611 - 384 - - - - Dialog - - - - - - - - Goto: - - - - - - - - - - - - - Mode - - - - - - Normal - - - - - - - Symbols - - - - - - - - - - - - - - - - - - 0 - 0 - - - - Qt::StrongFocus - - - Qt::CustomContextMenu - - - - - - - - - - CtrlMemView - QWidget -
ctrlmemview.h
- 1 -
-
- - -
diff --git a/Qt/QtHost.h b/Qt/QtHost.h index 8557bef3e4c5..fbad0aa7eaac 100644 --- a/Qt/QtHost.h +++ b/Qt/QtHost.h @@ -35,8 +35,6 @@ class QtHost : public Host { } virtual void UpdateMemView() override { - if(mainWindow->GetDialogMemory()) - mainWindow->GetDialogMemory()->Update(); } virtual void UpdateDisassembly() override { mainWindow->updateMenus(); diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 104d7a95f625..4fa8d9a6d22e 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -21,7 +21,6 @@ MainWindow::MainWindow(QWidget *parent, bool fullscreen) : currentLanguage("en"), nextState(CORE_POWERDOWN), lastUIState(UISTATE_MENU), - memoryWindow(0), memoryTexWindow(0) { QDesktopWidget *desktop = QApplication::desktop(); @@ -47,12 +46,6 @@ MainWindow::MainWindow(QWidget *parent, bool fullscreen) : QObject::connect(emugl, SIGNAL(newFrame()), this, SLOT(newFrame())); } -void MainWindow::ShowMemory(u32 addr) -{ - if(memoryWindow) - memoryWindow->Goto(addr); -} - inline float clamp1(float x) { if (x > 1.0f) return 1.0f; if (x < -1.0f) return -1.0f; @@ -146,11 +139,8 @@ void MainWindow::bootDone() if(g_Config.bFullScreen != isFullScreen()) fullscrAct(); - memoryWindow = new Debugger_Memory(currentDebugMIPS, this, this); memoryTexWindow = new Debugger_MemoryTex(this); - notifyMapsLoaded(); - if (nextState == CORE_RUNNING) runAct(); updateMenus(); @@ -172,8 +162,6 @@ void MainWindow::closeAct() { updateMenus(); - if(memoryWindow && memoryWindow->isVisible()) - memoryWindow->close(); if(memoryTexWindow && memoryTexWindow->isVisible()) memoryTexWindow->close(); @@ -256,8 +244,6 @@ void MainWindow::resetAct() { updateMenus(); - if(memoryWindow) - memoryWindow->close(); if(memoryTexWindow) memoryTexWindow->close(); @@ -285,7 +271,6 @@ void MainWindow::lmapAct() { QString fileName = QFileInfo(fileNames[0]).absoluteFilePath(); g_symbolMap->LoadSymbolMap(fileName.toStdString().c_str()); - notifyMapsLoaded(); } } @@ -308,7 +293,6 @@ void MainWindow::smapAct() void MainWindow::resetTableAct() { g_symbolMap->Clear(); - notifyMapsLoaded(); } void MainWindow::dumpNextAct() @@ -321,12 +305,6 @@ void MainWindow::consoleAct() LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden()); } -void MainWindow::memviewAct() -{ - if (memoryWindow) - memoryWindow->show(); -} - void MainWindow::memviewTexAct() { if(memoryTexWindow) @@ -510,8 +488,6 @@ void MainWindow::createMenus() debugMenu->addSeparator(); debugMenu->add(new MenuAction(this, SLOT(consoleAct()), QT_TR_NOOP("Log Console"))) ->addDisableState(UISTATE_MENU); - debugMenu->add(new MenuAction(this, SLOT(memviewAct()), QT_TR_NOOP("Memory View"))) - ->addDisableState(UISTATE_MENU); debugMenu->add(new MenuAction(this, SLOT(memviewTexAct()),QT_TR_NOOP("Memory View Texture"))) ->addDisableState(UISTATE_MENU); @@ -634,9 +610,3 @@ void MainWindow::createMenus() retranslate(); } - -void MainWindow::notifyMapsLoaded() -{ - if (memoryWindow) - memoryWindow->NotifyMapLoaded(); -} diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 699bb4f8d8b8..4b99975d52cf 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -12,7 +12,6 @@ #include "Core/Core.h" #include "Core/Config.h" #include "Core/System.h" -#include "Debugger/debugger_memory.h" #include "Debugger/debugger_memorytex.h" #include "Qt/QtMain.h" @@ -35,11 +34,9 @@ class MainWindow : public QMainWindow explicit MainWindow(QWidget *parent = 0, bool fullscreen=false); ~MainWindow() { }; - Debugger_Memory* GetDialogMemory() { return memoryWindow; } Debugger_MemoryTex* GetDialogMemoryTex() { return memoryTexWindow; } CoreState GetNextState() { return nextState; } - void ShowMemory(u32 addr); void updateMenus(); void Notify(MainWindowMsg msg) { @@ -94,7 +91,6 @@ private slots: void dumpNextAct(); void takeScreen() { g_TakeScreenshot = true; } void consoleAct(); - void memviewAct(); void memviewTexAct(); // Options @@ -153,7 +149,6 @@ private slots: void SetGameTitle(QString text); void loadLanguage(const QString &language, bool retranslate); void createMenus(); - void notifyMapsLoaded(); QTranslator translator; QString currentLanguage; @@ -161,7 +156,6 @@ private slots: CoreState nextState; GlobalUIState lastUIState; - Debugger_Memory *memoryWindow; Debugger_MemoryTex *memoryTexWindow; QActionGroup *anisotropicGroup, *screenGroup, *displayLayoutGroup, diff --git a/Windows/PPSSPP.vcxproj b/Windows/PPSSPP.vcxproj index da523a6f7192..85113285de9d 100644 --- a/Windows/PPSSPP.vcxproj +++ b/Windows/PPSSPP.vcxproj @@ -341,18 +341,6 @@ - - true - true - true - true - - - true - true - true - true - true true @@ -458,8 +446,6 @@ - - @@ -520,7 +506,6 @@ - diff --git a/Windows/PPSSPP.vcxproj.filters b/Windows/PPSSPP.vcxproj.filters index 553198c60a8d..bf27441486a5 100644 --- a/Windows/PPSSPP.vcxproj.filters +++ b/Windows/PPSSPP.vcxproj.filters @@ -161,15 +161,9 @@ Other Platforms\Qt - - Other Platforms\Qt\Debugger - Other Platforms\Qt\Debugger - - Other Platforms\Qt\Debugger - Windows\System @@ -323,15 +317,9 @@ Other Platforms\Qt\Debugger - - Other Platforms\Qt\Debugger - Other Platforms\Qt\Debugger - - Other Platforms\Qt\Debugger - Windows\System @@ -435,9 +423,6 @@ Other Platforms\Qt - - Other Platforms\Qt\Debugger - Other Platforms\Qt\Debugger