diff --git a/CMakeLists.txt b/CMakeLists.txt index e26ebe2227c5..f56b075c2b31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -273,8 +273,13 @@ if(NOT MSVC) if(IOS) elseif(APPLE AND NOT CMAKE_CROSSCOMPILING) # We want C++11, so target 10.7+ - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.7") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7 -stdlib=libc++ -U__STRICT_ANSI__") + if(USING_QT_UI) + set(MACOSX_VERSION_MIN "10.8") + else() + set(MACOSX_VERSION_MIN "10.7") + endif() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${MACOSX_VERSION_MIN}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${MACOSX_VERSION_MIN} -stdlib=libc++ -U__STRICT_ANSI__") set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") elseif(NOT ANDROID) # TODO: See if we can get rid of no-psabi @@ -751,40 +756,13 @@ elseif(USING_QT_UI) if(NOT SDL2_FOUND) find_package(Qt5 COMPONENTS Multimedia) endif(NOT SDL2_FOUND) - set(Qt_UI - Qt/Debugger/debugger_disasm.ui - Qt/Debugger/debugger_displaylist.ui - Qt/Debugger/debugger_memory.ui - Qt/Debugger/debugger_memorytex.ui - Qt/Debugger/debugger_vfpu.ui - ) - qt5_wrap_ui(QT_UI_GEN ${Qt_UI}) list(APPEND NativeAppSource - ${QT_UI_GEN} Qt/QtMain.cpp Qt/QtMain.h Qt/QtHost.cpp Qt/QtHost.h Qt/mainwindow.cpp Qt/mainwindow.h - Qt/Debugger/ctrldisasmview.cpp - Qt/Debugger/ctrldisasmview.h - Qt/Debugger/ctrlmemview.cpp - Qt/Debugger/ctrlmemview.h - Qt/Debugger/ctrlregisterlist.cpp - Qt/Debugger/ctrlregisterlist.h - Qt/Debugger/ctrlvfpuview.cpp - Qt/Debugger/ctrlvfpuview.h - Qt/Debugger/debugger_disasm.cpp - Qt/Debugger/debugger_disasm.h - Qt/Debugger/debugger_displaylist.cpp - Qt/Debugger/debugger_displaylist.h - Qt/Debugger/debugger_memory.cpp - Qt/Debugger/debugger_memory.h - Qt/Debugger/debugger_memorytex.cpp - Qt/Debugger/debugger_memorytex.h - Qt/Debugger/debugger_vfpu.cpp - Qt/Debugger/debugger_vfpu.h ) add_definitions(-DUSING_QT_UI) include_directories(${CMAKE_CURRENT_BINARY_DIR} Qt Qt/Debugger) @@ -1701,7 +1679,6 @@ add_library(${CoreLibName} ${CoreLinkType} Core/Util/ppge_atlas.h ${CORE_NEON} ${GPU_SOURCES} - git-version.cpp ext/disarm.cpp git-version.cpp) @@ -1751,7 +1728,8 @@ add_custom_command(OUTPUT something_that_never_exists -P ${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake) set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/git-version.cpp - PROPERTIES GENERATED TRUE) + PROPERTIES GENERATED TRUE + SKIP_AUTOMOC ON) add_dependencies(${CoreLibName} GitVersion) set(WindowsFiles diff --git a/GPU/GPUInterface.h b/GPU/GPUInterface.h index 101f73e14b1c..543f757a9967 100644 --- a/GPU/GPUInterface.h +++ b/GPU/GPUInterface.h @@ -241,6 +241,7 @@ class GPUInterface { virtual void DumpNextFrame() = 0; virtual void GetReportingInfo(std::string &primaryInfo, std::string &fullInfo) = 0; virtual const std::list& GetDisplayLists() = 0; + // TODO: Currently Qt only, needs to be cleaned up. virtual std::vector GetFramebufferList() = 0; virtual s64 GetListTicks(int listid) = 0; diff --git a/Qt/Debugger/ctrldisasmview.cpp b/Qt/Debugger/ctrldisasmview.cpp deleted file mode 100644 index af496e30a89b..000000000000 --- a/Qt/Debugger/ctrldisasmview.cpp +++ /dev/null @@ -1,422 +0,0 @@ -#include "ctrldisasmview.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#include "math.h" - -#include "debugger_disasm.h" -#include "Core/Debugger/SymbolMap.h" - -namespace -{ - u32 halfAndHalf(u32 a, u32 b) - { - return ((a>>1)&0x7f7f7f7f) + ((b>>1)&0x7f7f7f7f); - } -} - -CtrlDisAsmView::CtrlDisAsmView(QWidget *parent) : - QWidget(parent) -{ - curAddress=0; - rowHeight=14; - align=2; - selecting=false; - showHex=false; -} - -void CtrlDisAsmView::keyPressEvent(QKeyEvent *e) -{ - int page=(rect().bottom()/rowHeight)/2-1; - - switch (e->key()) - { - case Qt::Key_Down: curAddress += align; break; - case Qt::Key_Up: curAddress -= align; break; - case Qt::Key_PageDown: curAddress += page*align; break; - case Qt::Key_PageUp: curAddress -= page*align; break; - default: QWidget::keyPressEvent(e); break; - } - - update(); -} - -void CtrlDisAsmView::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(); - } - else - { - debugger->toggleBreakpoint(yToAddress(y)); - parentWindow->Update(); - redraw(); - } -} - -void CtrlDisAsmView::wheelEvent(QWheelEvent* e) -{ - int numDegrees = e->delta() / 8; - int numSteps = numDegrees / 15; - if (e->orientation() == Qt::Vertical) - { - curAddress -= numSteps*align; - update(); - } -} - -void CtrlDisAsmView::redraw() -{ - update(); -} - -void CtrlDisAsmView::contextMenu(const QPoint &pos) -{ - QMenu menu(this); - - QAction *copyAddress = new QAction(tr("Copy &address"), this); - connect(copyAddress, SIGNAL(triggered()), this, SLOT(CopyAddress())); - menu.addAction(copyAddress); - - QAction *copyInstrHex = new QAction(tr("Copy instruction (&hex)"), this); - connect(copyInstrHex, SIGNAL(triggered()), this, SLOT(CopyInstrHex())); - menu.addAction(copyInstrHex); - - QAction *copyInstrDisAsm = new QAction(tr("Copy instruction (&disasm)"), this); - connect(copyInstrDisAsm, SIGNAL(triggered()), this, SLOT(CopyInstrDisAsm())); - menu.addAction(copyInstrDisAsm); - - menu.addSeparator(); - - QAction *runToHere = new QAction(tr("&Run to here"), this); - connect(runToHere, SIGNAL(triggered()), this, SLOT(RunToHere())); - menu.addAction(runToHere); - - QAction *setNextStatement = new QAction(tr("&Set Next Statement"), this); - connect(setNextStatement, SIGNAL(triggered()), this, SLOT(SetNextStatement())); - menu.addAction(setNextStatement); - - QAction *toggleBreakpoint = new QAction(tr("&Toggle breakpoint"), this); - connect(toggleBreakpoint, SIGNAL(triggered()), this, SLOT(ToggleBreakpoint())); - menu.addAction(toggleBreakpoint); - - QAction *followBranch = new QAction(tr("&Follow branch"), this); - connect(followBranch, SIGNAL(triggered()), this, SLOT(FollowBranch())); - menu.addAction(followBranch); - - menu.addSeparator(); - - //QAction *showDynarecResults = new QAction(tr("&Show Dynarec Results"), this); - //connect(showDynarecResults, SIGNAL(triggered()), this, SLOT(ShowDynarecResults())); - //menu.addAction(showDynarecResults); - - QAction *goToMemoryView = new QAction(tr("Go to in &Memory View"), this); - connect(goToMemoryView, SIGNAL(triggered()), this, SLOT(GoToMemoryView())); - menu.addAction(goToMemoryView); - - menu.addSeparator(); - - //QAction *killFunction = new QAction(tr("&Kill function"), this); - //connect(killFunction, SIGNAL(triggered()), this, SLOT(KillFunction())); - //menu.addAction(killFunction); - - QAction *renameFunction = new QAction(tr("&Rename function..."), this); - connect(renameFunction, SIGNAL(triggered()), this, SLOT(RenameFunction())); - menu.addAction(renameFunction); - - - menu.exec( mapToGlobal(pos)); -} - -void CtrlDisAsmView::GoToMemoryView() -{ - parentWindow->ShowMemory(selection); -} - -void CtrlDisAsmView::CopyAddress() -{ - QApplication::clipboard()->setText(QString("%1").arg(selection,8,16,QChar('0'))); -} - -void CtrlDisAsmView::CopyInstrDisAsm() -{ - QApplication::clipboard()->setText(debugger->disasm(selection,align)); -} - -void CtrlDisAsmView::CopyInstrHex() -{ - QApplication::clipboard()->setText(QString("%1").arg(debugger->readMemory(selection),8,16,QChar('0'))); -} - -void CtrlDisAsmView::SetNextStatement() -{ - debugger->setPC(selection); - redraw(); -} - -void CtrlDisAsmView::ToggleBreakpoint() -{ - debugger->toggleBreakpoint(selection); - parentWindow->Update(); - redraw(); -} - -void CtrlDisAsmView::FollowBranch() -{ - const char *temp = debugger->disasm(selection,align);; - const char *mojs=strstr(temp,"->$"); - if (mojs) - { - u32 dest; - sscanf(mojs+3,"%08x",&dest); - if (dest) - { - marker = selection; - gotoAddr(dest); - } - } -} - -void CtrlDisAsmView::RunToHere() -{ - debugger->setBreakpoint(selection); - debugger->runToBreakpoint(); - redraw(); -} - -void CtrlDisAsmView::RenameFunction() -{ - u32 funcBegin = g_symbolMap->GetFunctionStart(curAddress); - if (funcBegin != (u32)-1) - { - QString name = QString::fromStdString(g_symbolMap->GetLabelString(funcBegin)); - bool ok; - QString newname = QInputDialog::getText(this, tr("New function name"), - tr("New function name:"), QLineEdit::Normal, - name, &ok); - if (ok && !newname.isEmpty()) - { - g_symbolMap->SetLabelName(newname.toStdString().c_str(),funcBegin); - redraw(); - parentWindow->NotifyMapLoaded(); - } - } - else - { - QMessageBox::information(this,tr("Warning"),tr("No symbol selected"),QMessageBox::Ok); - } -} - -void CtrlDisAsmView::paintEvent(QPaintEvent *) -{ - QPainter painter(this); - painter.setBrush(Qt::white); - painter.setPen(Qt::white); - painter.drawRect(rect()); - - struct branch - { - int src,dst,srcAddr; - bool conditional; - }; - branch branches[256]; - int numBranches=0; - - int width = rect().width(); - int numRows=(rect().height()/rowHeight); - - QColor bgColor(0xFFFFFFFF); - QPen nullPen(bgColor); - QPen currentPen(QColor(0,0,0)); - QPen selPen(QColor(0xFF808080)); - QPen condPen(QColor(0xFFFF3020)); - - QBrush lbr; - lbr.setColor(bgColor); - QBrush currentBrush(QColor(0xFFFFEfE8)); - QBrush pcBrush(QColor(0xFF70FF70)); - - QFont normalFont("Arial", 10); - QFont boldFont("Arial", 10); - QFont alignedFont("Monospace", 10); - alignedFont.setStyleHint(QFont::Monospace); - boldFont.setBold(true); - painter.setFont(normalFont); - - - QImage breakPoint(":/resources/breakpoint.ico"); - int i; - curAddress&=~(align-1); - - align=(debugger->getInstructionSize(0)); - for (i=0; i<=numRows; i++) - { - unsigned int address=curAddress + (i-(numRows/2))*align; - - int rowY1 = rect().top() + rowHeight*i; - int rowY2 = rect().top() + rowHeight*i + rowHeight - 1; - - lbr.setColor((unsigned int)marker == address ? QColor(0xFFFFEEE0) : QColor(debugger->getColor(address))); - QColor bg = lbr.color(); - painter.setBrush(currentBrush); - painter.setPen(nullPen); - painter.drawRect(0,rowY1,16-1,rowY2-rowY1); - - if (selecting && address == (unsigned int)selection) - painter.setPen(selPen); - else - { - if(i==numRows/2) - painter.setPen(currentPen); - else - painter.setPen(bg); - } - painter.setBrush(QBrush(bg)); - - if (address == debugger->getPC()) - { - painter.setBrush(pcBrush); - } - - painter.drawRect(16,rowY1,width-16-1,rowY2-rowY1); - painter.setBrush(currentBrush); - QPen textPen(QColor(halfAndHalf(bg.rgba(),0))); - painter.setPen(textPen); - painter.setFont(alignedFont); - painter.drawText(17,rowY1-3+rowHeight,QString("%1").arg(address,8,16,QChar('0'))); - painter.setFont(normalFont); - textPen.setColor(QColor(0xFF000000)); - painter.setPen(textPen); - if (debugger->isAlive()) - { - const char *dizz = debugger->disasm(address, align); - char dis[512]; - strcpy(dis, dizz); - char *dis2 = strchr(dis,'\t'); - char desc[256]=""; - if (dis2) - { - *dis2=0; - dis2++; - const char *mojs=strstr(dis2,"->$"); - if (mojs) - { - for (int i=0; i<8; i++) - { - bool found=false; - for (int j=0; j<22; j++) - { - if (mojs[i+3]=="0123456789ABCDEFabcdef"[j]) - found=true; - } - if (!found) - { - mojs=0; - break; - } - } - } - if (mojs) - { - unsigned int offs; - sscanf(mojs+3,"%08x",&offs); - branches[numBranches].src=rowY1 + rowHeight/2; - branches[numBranches].srcAddr=address/align; - branches[numBranches].dst=(int)(rowY1+((s64)offs-(s64)address)*rowHeight/align + rowHeight/2); - branches[numBranches].conditional = (dis[1]!=0); //unconditional 'b' branch - numBranches++; - const char *t = debugger->getDescription(offs).c_str(); - if (memcmp(t,"z_",2)==0) - t+=2; - if (memcmp(t,"zz_",3)==0) - t+=3; - sprintf(desc,"-->%s", t); - textPen.setColor(QColor(0xFF600060)); - painter.setPen(textPen); - } - else - { - textPen.setColor(QColor(0xFF000000)); - painter.setPen(textPen); - } - painter.drawText(149,rowY1-3+rowHeight,QString(dis2)); - } - textPen.setColor(QColor(0xFF007000)); - painter.setPen(textPen); - painter.setFont(boldFont); - painter.drawText(84,rowY1-3+rowHeight,QString(dis)); - painter.setFont(normalFont); - if (desc[0]==0) - { - const char *t = debugger->getDescription(address).c_str(); - if (memcmp(t,"z_",2)==0) - t+=2; - if (memcmp(t,"zz_",3)==0) - t+=3; - strcpy(desc,t); - } - if (memcmp(desc,"-->",3) == 0) - { - textPen.setColor(QColor(0xFF0000FF)); - painter.setPen(textPen); - } - else - { - textPen.setColor(halfAndHalf(halfAndHalf(bg.rgba(),0),bg.rgba())); - painter.setPen(textPen); - } - if (strlen(desc)) - painter.drawText(std::max(280,width/3+190),rowY1-3+rowHeight,QString(desc)); - if (debugger->isBreakpoint(address)) - { - painter.drawImage(2,rowY1+2,breakPoint); - } - } - } - for (i=0; i-200) - { - painter.drawLine(curPos, QPoint(x+2,branches[i].src)); - curPos = QPoint(x+2,branches[i].src); - painter.drawLine(curPos, QPoint(x+2,branches[i].dst)); - curPos = QPoint(x+2,branches[i].dst); - painter.drawLine(curPos, QPoint(x-4,branches[i].dst)); - - curPos = QPoint(x,branches[i].dst-4); - painter.drawLine(curPos, QPoint(x-4,branches[i].dst)); - curPos = QPoint(x-4,branches[i].dst); - painter.drawLine(curPos, QPoint(x+1,branches[i].dst+5)); - } - else - { - painter.drawLine(curPos, QPoint(x+4,branches[i].src)); - } - } -} - -int CtrlDisAsmView::yToAddress(int y) -{ - //int ydiff=y - rect().bottom()/2;//-rowHeight/2; - int ydiff=(int)(floor((float)y / (float)rowHeight)); - ydiff -= (rect().height()/rowHeight)/2; - return curAddress + ydiff *align; -} diff --git a/Qt/Debugger/ctrldisasmview.h b/Qt/Debugger/ctrldisasmview.h deleted file mode 100644 index 8846ad40dbd5..000000000000 --- a/Qt/Debugger/ctrldisasmview.h +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef CTRLDISASMVIEW_H -#define CTRLDISASMVIEW_H - -#include -#include "Core/Debugger/DebugInterface.h" - -class Debugger_Disasm; - -class CtrlDisAsmView : public QWidget -{ - Q_OBJECT -public: - explicit CtrlDisAsmView(QWidget *parent = 0); - - void redraw(); - void setAlign(int l) - { - align=l; - } - - void setParentWindow(Debugger_Disasm* win) - { - parentWindow = win; - } - - void setDebugger(DebugInterface *deb) - { - debugger=deb; - curAddress=debugger->getPC(); - align=debugger->getInstructionSize(0); - } - DebugInterface *getDebugger() - { - return debugger; - } - void gotoAddr(unsigned int addr) - { - curAddress=addr&(~(align-1)); - redraw(); - } - void gotoPC() - { - curAddress=debugger->getPC()&(~(align-1)); - redraw(); - } - unsigned int getSelection() - { - return curAddress; - } - - void setShowMode(bool s) - { - showHex=s; - } - - void toggleBreakpoint() - { - debugger->toggleBreakpoint(curAddress); - redraw(); - } - - void contextMenu(const QPoint& pos); -protected: - void paintEvent(QPaintEvent *); - void mousePressEvent(QMouseEvent *e); - void keyPressEvent(QKeyEvent *); - void wheelEvent(QWheelEvent *e); - -public slots: - void CopyAddress(); - void CopyInstrDisAsm(); - void SetNextStatement(); - void FollowBranch(); - void CopyInstrHex(); - void RunToHere(); - void ToggleBreakpoint(); - void GoToMemoryView(); - void RenameFunction(); - -private: - int yToAddress(int y); - - int curAddress; - int align; - - int rowHeight; - int selection; - int marker; - int oldSelection; - bool selectionChanged; - bool selecting; - bool hasFocus; - bool showHex; - - DebugInterface *debugger; - Debugger_Disasm* parentWindow; - -}; - -#endif // CTRLDISASMVIEW_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/ctrlregisterlist.cpp b/Qt/Debugger/ctrlregisterlist.cpp deleted file mode 100644 index 29184ee1aba7..000000000000 --- a/Qt/Debugger/ctrlregisterlist.cpp +++ /dev/null @@ -1,335 +0,0 @@ -#include "ctrlregisterlist.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "debugger_disasm.h" - -CtrlRegisterList::CtrlRegisterList(QWidget *parent) : - QWidget(parent) -{ - rowHeight = 14; - selecting=false; - selection=0; - category=0; - showHex=false; - cpu=0; - lastPC = 0; - lastCat0Values = NULL; - changedCat0Regs = NULL; - curVertOffset = 0; - -} - -CtrlRegisterList::~CtrlRegisterList() -{ - if (lastCat0Values != NULL) - delete [] lastCat0Values; - if (changedCat0Regs != NULL) - delete [] changedCat0Regs; -} - -void CtrlRegisterList::redraw() -{ - update(); -} - -void CtrlRegisterList::scrollChanged(int action) -{ - QScrollBar *bar = findChild("RegListScroll"); - switch(action) - { - case QScrollBar::SliderSingleStepAdd: - curVertOffset++; - break; - case QScrollBar::SliderSingleStepSub: - curVertOffset--; - break; - case QScrollBar::SliderPageStepAdd: - curVertOffset+= 4; - break; - case QScrollBar::SliderPageStepSub: - curVertOffset-= 4; - break; - case QScrollBar::SliderMove: - curVertOffset = bar->sliderPosition(); - break; - default: - break; - } - redraw(); -} - - -void CtrlRegisterList::keyPressEvent(QKeyEvent *e) -{ - switch (e->key()) - { - case Qt::Key_Down: selection += 1; break; - case Qt::Key_Up: selection -= 1; break; - case Qt::Key_PageDown: selection += 4; break; - case Qt::Key_PageUp: selection -= 4; break; - default: QWidget::keyPressEvent(e); break; - } - - int maxRowsDisplay =rect().bottom()/rowHeight - 1; - curVertOffset = std::min(std::max(curVertOffset, selection-maxRowsDisplay),selection); - update(); -} - -void CtrlRegisterList::mousePressEvent(QMouseEvent *e) -{ - int x = e->pos().x(); - int y = e->pos().y(); - if (x>16) - { - oldSelection=selection; - - if (y>rowHeight) - { - selection=yToIndex(y); - bool oldselecting=selecting; - selecting=true; - if (!oldselecting || (selection!=oldSelection)) - redraw(); - } - else - { - int lastCat = category; - category = (x*cpu->GetNumCategories())/(rect().width()); - if (category<0) category=0; - if (category>=cpu->GetNumCategories()) - category=cpu->GetNumCategories()-1; - if (category!=lastCat) - { - curVertOffset = 0; - redraw(); - } - } - } - else - { - redraw(); - } -} - -void CtrlRegisterList::wheelEvent(QWheelEvent* e) -{ - int numDegrees = e->delta() / 8; - int numSteps = numDegrees / 15; - if (e->orientation() == Qt::Vertical) - { - curVertOffset -= numSteps; - update(); - } -} - - -void CtrlRegisterList::paintEvent(QPaintEvent *) -{ - - int numRowsTotal = cpu->GetNumRegsInCategory(category); - int maxRowsDisplay =rect().bottom()/rowHeight - 1; - - selection = std::min(std::max(selection,0),numRowsTotal); - curVertOffset = std::max(std::min(curVertOffset,numRowsTotal - maxRowsDisplay),0); - - QScrollBar *bar = findChild("RegListScroll"); - if(bar) - { - bar->setMinimum(0); - bar->setMaximum(numRowsTotal - maxRowsDisplay); - bar->setPageStep(1); - bar->setValue(curVertOffset); - } - - - QPainter painter(this); - painter.setBrush(Qt::white); - painter.setPen(Qt::white); - painter.drawRect(rect()); - - if (!cpu) - return; - - QFont normalFont = QFont("Arial", 10); - painter.setFont(normalFont); - - int width = rect().width(); - - QColor bgColor(0xffffff); - QPen nullPen(bgColor); - QPen currentPen(QColor(0xFF000000)); - QPen selPen(0x808080); - QPen textPen; - - QBrush lbr; - lbr.setColor(bgColor); - QBrush nullBrush(bgColor); - QBrush currentBrush(0xFFEfE8); - QBrush pcBrush(0x70FF70); - - int nc = cpu->GetNumCategories(); - for (int i=0; iGetCategoryName(i); - painter.setPen(currentPen); - painter.drawText(width*i/nc+1,-3+rowHeight,name); - } - - int numRows=rect().bottom()/rowHeight; - - for (int i=curVertOffset; iGetPC()) - { - for (int i = 0, n = cpu->GetNumRegsInCategory(0); i < n; ++i) - { - u32 v = cpu->GetRegValue(0, i); - changedCat0Regs[i] = v != lastCat0Values[i]; - lastCat0Values[i] = v; - } - lastPC = cpu->GetPC(); - } - - painter.setBrush(currentBrush); - if (iGetNumRegsInCategory(category)) - { - QString regName = cpu->GetRegName(category,i); - textPen.setColor(0x600000); - painter.setPen(textPen); - painter.drawText(17,rowY1-3+rowHeight,regName); - textPen.setColor(0xFF000000); - painter.setPen(textPen); - - char temp[256]; - cpu->PrintRegValue(category,i,temp); - if (category == 0 && changedCat0Regs[i]) - { - textPen.setColor(0x0000FF); - painter.setPen(textPen); - } - else - { - textPen.setColor(0x004000); - painter.setPen(textPen); - } - painter.drawText(77,rowY1-3+rowHeight,temp); - } - } -} - -int CtrlRegisterList::yToIndex(int y) -{ - int n = (y/rowHeight) - 1 + curVertOffset; - if (n<0) n=0; - return n; -} - -void CtrlRegisterList::contextMenu(const QPoint &pos) -{ - QMenu menu(this); - - QAction *gotoMemory = new QAction(tr("Go to in &memory view"), this); - connect(gotoMemory, SIGNAL(triggered()), this, SLOT(GotoMemory())); - menu.addAction(gotoMemory); - - 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 *change = new QAction(tr("C&hange..."), this); - connect(change, SIGNAL(triggered()), this, SLOT(Change())); - menu.addAction(change); - - menu.exec( mapToGlobal(pos)); -} - -void CtrlRegisterList::GotoMemory() -{ - int cat = category; - int reg = selection; - if (selection >= cpu->GetNumRegsInCategory(cat)) - return; - - u32 val = cpu->GetRegValue(cat,reg); - - parentWindow->ShowMemory(val); -} - -void CtrlRegisterList::GotoDisAsm() -{ - int cat = category; - int reg = selection; - if (selection >= cpu->GetNumRegsInCategory(cat)) - return; - - u32 val = cpu->GetRegValue(cat,reg); - - emit GotoDisasm(val); -} - -void CtrlRegisterList::CopyValue() -{ - int cat = category; - int reg = selection; - if (selection >= cpu->GetNumRegsInCategory(cat)) - return; - - u32 val = cpu->GetRegValue(cat,reg); - - QApplication::clipboard()->setText(QString("%1").arg(val,8,16,QChar('0'))); -} - -void CtrlRegisterList::Change() -{ - int cat = category; - int reg = selection; - if (selection >= cpu->GetNumRegsInCategory(cat)) - return; - - u32 val = cpu->GetRegValue(cat,reg); - - bool ok; - QString text = QInputDialog::getText(this, tr("Set new value"), - tr("Set new value:"), QLineEdit::Normal, - QString::number(val), &ok); - if (ok && !text.isEmpty()) - { - cpu->SetRegValue(cat,reg,text.toInt()); - redraw(); - } -} diff --git a/Qt/Debugger/ctrlregisterlist.h b/Qt/Debugger/ctrlregisterlist.h deleted file mode 100644 index ca3c498d9aaa..000000000000 --- a/Qt/Debugger/ctrlregisterlist.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef CTRLREGISTERLIST_H -#define CTRLREGISTERLIST_H - -#include -#include "Core/Debugger/DebugInterface.h" - -class Debugger_Disasm; -class CtrlRegisterList : public QWidget -{ - Q_OBJECT -public: - explicit CtrlRegisterList(QWidget *parent = 0); - - - void setParentWindow(Debugger_Disasm* win) - { - parentWindow = win; - } - - void setCPU(DebugInterface *deb) - { - cpu = deb; - - int regs = cpu->GetNumRegsInCategory(0); - lastCat0Values = new u32[regs]; - changedCat0Regs = new bool[regs]; - memset(lastCat0Values, 0, regs * sizeof(u32)); - memset(changedCat0Regs, 0, regs * sizeof(bool)); - } - DebugInterface *getCPU() - { - return cpu; - } - ~CtrlRegisterList(); - void contextMenu(const QPoint &pos); -protected: - void paintEvent(QPaintEvent *); - void keyPressEvent(QKeyEvent *e); - void mousePressEvent(QMouseEvent *e); - void wheelEvent(QWheelEvent *e); -signals: - void GotoDisasm(u32); - -public slots: - void redraw(); - void scrollChanged(int); - - void GotoDisAsm(); - void CopyValue(); - void Change(); - void GotoMemory(); - -private: - int yToIndex(int y); - - int rowHeight; - int selection; - int marker; - int category; - - int oldSelection; - - bool selectionChanged; - bool selecting; - bool hasFocus; - bool showHex; - DebugInterface *cpu; - int curVertOffset; - - u32 lastPC; - u32 *lastCat0Values; - bool *changedCat0Regs; - - Debugger_Disasm* parentWindow; -}; - -#endif // CTRLREGISTERLIST_H diff --git a/Qt/Debugger/ctrlvfpuview.cpp b/Qt/Debugger/ctrlvfpuview.cpp deleted file mode 100644 index f7622d03ef16..000000000000 --- a/Qt/Debugger/ctrlvfpuview.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include "ctrlvfpuview.h" -#include - -#include "Core/MIPS/MIPS.h" // BAD - -CtrlVfpuView::CtrlVfpuView(QWidget *parent) : - QWidget(parent) -{ - mode = 0; -} - -void CtrlVfpuView::setMode(int newMode) -{ - mode = newMode; - redraw(); -} - -void CtrlVfpuView::paintEvent(QPaintEvent *) -{ - QPainter painter(this); - painter.setBrush(Qt::white); - painter.setPen(Qt::white); - painter.drawRect(rect()); - - if (!cpu) - return; - - QFont normalFont("Arial", 10); - painter.setFont(normalFont); - - QPen currentPen(0xFF000000); - QBrush nullBrush(0xFFEfE8); - painter.setPen(currentPen); - painter.setBrush(nullBrush); - - enum - { - rowHeight = 15, - columnWidth = 80, - xStart = columnWidth/2, - yStart = 0 - }; - - for (int matrix = 0; matrix<8; matrix++) - { - int my = (int)(yStart + matrix * rowHeight * 5.5f); - painter.drawRect(0, my, xStart-1, rowHeight-1); - painter.drawText(3, my+rowHeight-3, QString("M%1").arg(matrix)+"00"); - painter.drawRect(xStart, my+rowHeight, columnWidth*4-1, 4*rowHeight-1); - - for (int column = 0; column<4; column++) - { - int y = my; - int x = column * columnWidth + xStart; - - painter.drawRect(x, y, columnWidth-1, rowHeight - 1); - painter.drawText(x+3, y-3+rowHeight, QString("R%1").arg(matrix)+QString("0%1").arg(column)); - - painter.drawRect(0, y+rowHeight*(column+1), xStart - 1, rowHeight - 1); - painter.drawText(3, y+rowHeight*(column+2)-3, QString("C%1").arg(matrix)+QString("%1").arg(column)+"0"); - - y+=rowHeight; - - for (int row = 0; row<4; row++) - { - float val = mipsr4k.v[column*32+row+matrix*4]; - u32 hex = *((u32*)&val); - char temp[256]; - switch (mode) - { - case 0: sprintf(temp,"%f",val); break; -// case 1: sprintf(temp,"??"); break; - case 2: sprintf(temp,"0x%08x",hex); break; - default:sprintf(temp,"%f",val); break; - } - - painter.drawText(x+3, y-3 + rowHeight, temp); - y+=rowHeight; - } - } - } - - setMinimumHeight((int)(yStart + 8 * rowHeight * 5.5f)); - setMinimumWidth(4*columnWidth+xStart); - -} - - -void CtrlVfpuView::redraw() -{ - update(); -} - diff --git a/Qt/Debugger/ctrlvfpuview.h b/Qt/Debugger/ctrlvfpuview.h deleted file mode 100644 index 5fabb3dd6663..000000000000 --- a/Qt/Debugger/ctrlvfpuview.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef CTRLVFPUVIEW_H -#define CTRLVFPUVIEW_H - -#include -#include "Core/Debugger/DebugInterface.h" - -class Debugger_Vfpu; -class CtrlVfpuView : public QWidget -{ - Q_OBJECT -public: - explicit CtrlVfpuView(QWidget *parent = 0); - - void setParentWindow(Debugger_Vfpu* win) - { - parentWindow = win; - } - - void setCPU(DebugInterface *deb) - { - cpu = deb; - } - DebugInterface *getCPU() - { - return cpu; - } - void setMode(int newMode); - void redraw(); -protected: - void paintEvent(QPaintEvent *); - -private: - DebugInterface *cpu; - Debugger_Vfpu* parentWindow; - int mode; -}; - -#endif // CTRLVFPUVIEW_H diff --git a/Qt/Debugger/debugger_disasm.cpp b/Qt/Debugger/debugger_disasm.cpp deleted file mode 100644 index f8e585e23d3e..000000000000 --- a/Qt/Debugger/debugger_disasm.cpp +++ /dev/null @@ -1,607 +0,0 @@ -#include -#include - -#include - -#include "debugger_disasm.h" -#include "ui_debugger_disasm.h" -#include "Core/Debugger/DebugInterface.h" -#include "Core/Debugger/SymbolMap.h" -#include "ctrldisasmview.h" -#include "Core/Debugger/Breakpoints.h" -#include "Core/HLE/HLE.h" -#include "Core/CoreTiming.h" -#include "mainwindow.h" -#include "ctrlregisterlist.h" -#include "base/stringutil.h" -#include "Core/Debugger/SymbolMap.h" -#include "GPU/GPUState.h" -#include "GPU/GPUInterface.h" -#include "GPU/GeDisasm.h" -#include "GPU/Common/GPUDebugInterface.h" -#include "Core/Host.h" - -Debugger_Disasm::Debugger_Disasm(DebugInterface *_cpu, MainWindow* mainWindow_, QWidget *parent) : - QDialog(parent), - ui(new Ui::Debugger_Disasm), - cpu(_cpu), - mainWindow(mainWindow_) -{ - ui->setupUi(this); - - vfpudlg = new Debugger_VFPU(_cpu, mainWindow, this); - - ui->DisasmView->setWindowTitle(_cpu->GetName()); - - QObject::connect(ui->RegListScroll,SIGNAL(actionTriggered(int)), ui->RegList, SLOT(scrollChanged(int))); - QObject::connect(ui->RegList,SIGNAL(GotoDisasm(u32)),this,SLOT(Goto(u32))); - QObject::connect(this, SIGNAL(UpdateCallstack_()), this, SLOT(UpdateCallstackGUI())); - QObject::connect(this, SIGNAL(UpdateDisplayList_()), this, SLOT(UpdateDisplayListGUI())); - QObject::connect(this, SIGNAL(UpdateBreakpoints_()), this, SLOT(UpdateBreakpointsGUI())); - QObject::connect(this, SIGNAL(UpdateThread_()), this, SLOT(UpdateThreadGUI())); - - CtrlDisAsmView *ptr = ui->DisasmView; - ptr->setDebugger(cpu); - ptr->setParentWindow(this); - ptr->gotoAddr(0x00000000); - - CtrlRegisterList *rl = ui->RegList; - rl->setParentWindow(this); - rl->setCPU(cpu); - - FillFunctions(); - -} - -Debugger_Disasm::~Debugger_Disasm() -{ - delete ui; -} - -void Debugger_Disasm::ShowVFPU() -{ - vfpudlg->show(); -} - -void Debugger_Disasm::Update() -{ - ui->RegList->redraw(); - mainWindow->updateMenus(); - UpdateDialog(); -} - -void Debugger_Disasm::Go() -{ - SetDebugMode(false); - Core_EnableStepping(false); - mainWindow->updateMenus(); -} - -void Debugger_Disasm::Step() -{ - Core_DoSingleStep(); - _dbg_update_(); -} - -void Debugger_Disasm::StepOver() -{ - SetDebugMode(false); - CBreakPoints::AddBreakPoint(cpu->GetPC()+cpu->getInstructionSize(0),true); - _dbg_update_(); - Core_EnableStepping(false); - mainWindow->updateMenus(); -} - -void Debugger_Disasm::StepHLE() -{ - hleDebugBreak(); - SetDebugMode(false); - _dbg_update_(); - Core_EnableStepping(false); - mainWindow->updateMenus(); -} - -void Debugger_Disasm::UpdateDialog() -{ - if(!isVisible()) - return; - ui->DisasmView->setAlign(cpu->getInstructionSize(0)); - ui->DisasmView->redraw(); - ui->RegList->redraw(); - vfpudlg->Update(); - UpdateBreakpoints(); - UpdateThread(); - UpdateDisplayList(); - UpdateCallstack(); - - char tempTicks[24]; - sprintf(tempTicks, "%lld", CoreTiming::GetTicks()); - ui->debugCount->setText(QString("Ctr : ") + tempTicks); - - if(mainWindow->GetDialogMemory()) - mainWindow->GetDialogMemory()->Update(); - -} - -void Debugger_Disasm::Stop() -{ - SetDebugMode(true); - Core_EnableStepping(true); - _dbg_update_(); - mainWindow->updateMenus(); - UpdateDialog(); -} - -void Debugger_Disasm::Skip() -{ - CtrlDisAsmView *ptr = ui->DisasmView; - - cpu->SetPC(cpu->GetPC() + cpu->getInstructionSize(0)); - ptr->gotoPC(); - UpdateDialog(); -} - -void Debugger_Disasm::GotoPC() -{ - CtrlDisAsmView *ptr = ui->DisasmView; - - ptr->gotoPC(); - UpdateDialog(); -} - -void Debugger_Disasm::GotoLR() -{ - CtrlDisAsmView *ptr = ui->DisasmView; - - ptr->gotoAddr(cpu->GetLR()); -} - -void Debugger_Disasm::SetDebugMode(bool _bDebug) -{ - if (_bDebug) - { - ui->Go->setEnabled(true); - ui->StepInto->setEnabled(true); - ui->StepOver->setEnabled(false); // Crash, so disable for now - ui->NextHLE->setEnabled(true); - ui->Stop->setEnabled(false); - ui->Skip->setEnabled(true); - CtrlDisAsmView *ptr = ui->DisasmView; - ptr->gotoPC(); - UpdateDialog(); - } - else - { - ui->Go->setEnabled(false); - ui->StepInto->setEnabled(false); - ui->StepOver->setEnabled(false); - ui->NextHLE->setEnabled(false); - ui->Stop->setEnabled(true); - ui->Skip->setEnabled(false); - CtrlRegisterList *reglist = ui->RegList; - reglist->redraw(); - } -} - -void Debugger_Disasm::Goto(u32 addr) -{ - CtrlDisAsmView *ptr = ui->DisasmView; - ptr->gotoAddr(addr); - ptr->redraw(); -} - -void Debugger_Disasm::on_GotoPc_clicked() -{ - GotoPC(); -} - -void Debugger_Disasm::on_Go_clicked() -{ - Go(); -} - -void Debugger_Disasm::on_Stop_clicked() -{ - Stop(); -} - -void Debugger_Disasm::on_StepInto_clicked() -{ - Step(); -} - -void Debugger_Disasm::on_StepOver_clicked() -{ - StepOver(); -} - -void Debugger_Disasm::on_Skip_clicked() -{ - Skip(); -} - -void Debugger_Disasm::on_NextHLE_clicked() -{ - StepHLE(); -} - -void Debugger_Disasm::on_GotoLr_clicked() -{ - GotoLR(); -} - -void Debugger_Disasm::on_GotoInt_currentIndexChanged(int index) -{ - CtrlDisAsmView *ptr = ui->DisasmView; - u32 addr = ui->GotoInt->itemData(index,Qt::UserRole).toInt(); - if (addr != 0xFFFFFFFF) - ptr->gotoAddr(addr); -} - -void Debugger_Disasm::on_Address_textChanged(const QString &arg1) -{ - CtrlDisAsmView *ptr = ui->DisasmView; - ptr->gotoAddr(parseHex(ui->Address->text().toStdString().c_str())); - UpdateDialog(); -} - -void Debugger_Disasm::on_DisasmView_customContextMenuRequested(const QPoint &pos) -{ - ui->DisasmView->contextMenu(pos); -} - -void Debugger_Disasm::NotifyMapLoaded() -{ - FillFunctions(); - CtrlDisAsmView *ptr = ui->DisasmView; - ptr->redraw(); -} - -void Debugger_Disasm::on_RegList_customContextMenuRequested(const QPoint &pos) -{ - ui->RegList->contextMenu(pos); -} - -void Debugger_Disasm::ShowMemory(u32 addr) -{ - mainWindow->ShowMemory(addr); -} - -void Debugger_Disasm::on_vfpu_clicked() -{ - ShowVFPU(); -} - -void Debugger_Disasm::on_FuncList_itemClicked(QListWidgetItem *item) -{ - u32 addr = item->data(Qt::UserRole).toInt(); - - ui->DisasmView->gotoAddr(addr); -} - -void Debugger_Disasm::FillFunctions() -{ - QListWidgetItem* item = new QListWidgetItem(); - item->setText("(0x02000000)"); - item->setData(Qt::UserRole, 0x02000000); - ui->FuncList->addItem(item); - - std::vector symbols = g_symbolMap->GetAllSymbols(ST_FUNCTION); - 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->FuncList->addItem(item); - } -} - -void Debugger_Disasm::UpdateCallstack() -{ - emit UpdateCallstack_(); -} - -void Debugger_Disasm::UpdateCallstackGUI() -{ - - auto threads = GetThreadsInfo(); - - u32 entry = 0, stackTop = 0; - for (size_t i = 0; i < threads.size(); i++) - { - if (threads[i].isCurrent) - { - entry = threads[i].entrypoint; - stackTop = threads[i].initialStack; - break; - } - } - if (entry != 0) { - stackTraceModel = MIPSStackWalk::Walk( - cpu->GetPC(), - cpu->GetRegValue(0,MIPS_REG_RA), - cpu->GetRegValue(0,MIPS_REG_SP), - entry, - stackTop); - } else { - stackTraceModel.clear(); - } - - ui->callStack->clear(); - - QTreeWidgetItem* item; - for(auto it=stackTraceModel.begin();it!=stackTraceModel.end();it++) - { - item = new QTreeWidgetItem(); - item->setText(0,QString("%1").arg(it->pc,8,16,QChar('0')).prepend("0x")); - item->setData(0,Qt::UserRole,it->pc); - item->setText(1,QString("%1").arg(it->entry,8,16,QChar('0')).prepend("0x")); - item->setData(1,Qt::UserRole,it->entry); - item->setText(2,QString("%1").arg(it->sp,8,16,QChar('0')).prepend("0x")); - item->setText(3,QString("%1").arg(it->stackSize,8,16,QChar('0')).prepend("0x")); - ui->callStack->addTopLevelItem(item); - } -} - -void Debugger_Disasm::UpdateBreakpoints() -{ - emit UpdateBreakpoints_(); -} - -void Debugger_Disasm::UpdateBreakpointsGUI() -{ - u32 curBpAddr = 0; - QTreeWidgetItem* curItem = ui->breakpointsList->currentItem(); - if(curItem) - curBpAddr = ui->breakpointsList->currentItem()->data(0,Qt::UserRole).toInt(); - - ui->breakpointsList->clear(); - - auto breakpoints = CBreakPoints::GetBreakpoints(); - for(size_t i = 0; i < breakpoints.size(); i++) - { - u32 addr_ = breakpoints[i].addr; - if(!CBreakPoints::IsTempBreakPoint(addr_)) - { - QTreeWidgetItem* item = new QTreeWidgetItem(); - item->setText(0,QString("%1").arg(addr_,8,16,QChar('0'))); - item->setData(0,Qt::UserRole,addr_); - ui->breakpointsList->addTopLevelItem(item); - if(curBpAddr == addr_) - ui->breakpointsList->setCurrentItem(item); - } - } -} - -void Debugger_Disasm::on_breakpointsList_itemClicked(QTreeWidgetItem *item, int column) -{ - ui->DisasmView->gotoAddr(item->data(column,Qt::UserRole).toInt()); -} - -void Debugger_Disasm::on_breakpointsList_customContextMenuRequested(const QPoint &pos) -{ - QTreeWidgetItem* item = ui->breakpointsList->itemAt(pos); - if(item) - { - breakpointAddr = item->data(0,Qt::UserRole).toInt(); - - QMenu menu(this); - - QAction *removeBP = new QAction(tr("Remove breakpoint"), this); - connect(removeBP, SIGNAL(triggered()), this, SLOT(RemoveBreakpoint())); - menu.addAction(removeBP); - - menu.exec( ui->breakpointsList->mapToGlobal(pos)); - } -} - -void Debugger_Disasm::RemoveBreakpoint() -{ - CBreakPoints::RemoveBreakPoint(breakpointAddr); - Update(); -} - -void Debugger_Disasm::on_clearAllBP_clicked() -{ - CBreakPoints::ClearAllBreakPoints(); - Update(); -} - -void Debugger_Disasm::UpdateThread() -{ - emit UpdateThread_(); -} - -void Debugger_Disasm::UpdateThreadGUI() -{ - ui->threadList->clear(); - - std::vector threads = GetThreadsInfo(); - - for(size_t i = 0; i < threads.size(); i++) - { - QTreeWidgetItem* item = new QTreeWidgetItem(); - item->setText(0,QString::number(threads[i].id)); - item->setData(0,Qt::UserRole,threads[i].id); - item->setText(1,threads[i].name); - QString status = ""; - if(threads[i].status & THREADSTATUS_RUNNING) status += "Running "; - if(threads[i].status & THREADSTATUS_WAIT) status += "Wait "; - if(threads[i].status & THREADSTATUS_READY) status += "Ready "; - if(threads[i].status & THREADSTATUS_SUSPEND) status += "Suspend "; - if(threads[i].status & THREADSTATUS_DORMANT) status += "Dormant "; - if(threads[i].status & THREADSTATUS_DEAD) status += "Dead "; - item->setText(2,status); - item->setText(3,QString("%1").arg(threads[i].curPC,8,16,QChar('0'))); - item->setData(3,Qt::UserRole,threads[i].curPC); - item->setText(4,QString("%1").arg(threads[i].entrypoint,8,16,QChar('0'))); - item->setData(4,Qt::UserRole,threads[i].entrypoint); - - if(threads[i].isCurrent) - { - for(int j = 0; j < 5; j++) - item->setTextColor(j,Qt::green); - } - - ui->threadList->addTopLevelItem(item); - } - for(int i = 0; i < ui->threadList->columnCount(); i++) - ui->threadList->resizeColumnToContents(i); -} - -void Debugger_Disasm::on_threadList_itemClicked(QTreeWidgetItem *item, int column) -{ - ui->DisasmView->gotoAddr(item->data(3,Qt::UserRole).toInt()); -} - -void Debugger_Disasm::on_threadList_customContextMenuRequested(const QPoint &pos) -{ - QTreeWidgetItem* item = ui->threadList->itemAt(pos); - if(item) - { - threadRowSelected = item; - - QMenu menu(this); - - QAction *gotoEntryPoint = new QAction(tr("Go to entry point"), this); - connect(gotoEntryPoint, SIGNAL(triggered()), this, SLOT(GotoThreadEntryPoint())); - menu.addAction(gotoEntryPoint); - - QMenu* changeStatus = menu.addMenu(tr("Change status")); - - QAction *statusRunning = new QAction(tr("Running"), this); - connect(statusRunning, SIGNAL(triggered()), this, SLOT(SetThreadStatusRun())); - changeStatus->addAction(statusRunning); - - QAction *statusWait = new QAction(tr("Wait"), this); - connect(statusWait, SIGNAL(triggered()), this, SLOT(SetThreadStatusWait())); - changeStatus->addAction(statusWait); - - QAction *statusSuspend = new QAction(tr("Suspend"), this); - connect(statusSuspend, SIGNAL(triggered()), this, SLOT(SetThreadStatusSuspend())); - changeStatus->addAction(statusSuspend); - - menu.exec( ui->threadList->mapToGlobal(pos)); - } -} - -void Debugger_Disasm::GotoThreadEntryPoint() -{ - ui->DisasmView->gotoAddr(threadRowSelected->data(4,Qt::UserRole).toInt()); - Update(); -} - -void Debugger_Disasm::SetThreadStatus(ThreadStatus status) -{ - __KernelChangeThreadState(threadRowSelected->data(0,Qt::UserRole).toInt(), status); - - UpdateThread(); -} - -void Debugger_Disasm::SetThreadStatusRun() -{ - SetThreadStatus(THREADSTATUS_RUNNING); -} - -void Debugger_Disasm::SetThreadStatusWait() -{ - SetThreadStatus(THREADSTATUS_WAIT); -} - -void Debugger_Disasm::SetThreadStatusSuspend() -{ - SetThreadStatus(THREADSTATUS_SUSPEND); -} - -void Debugger_Disasm::UpdateDisplayList() -{ - emit UpdateDisplayList_(); -} - -void Debugger_Disasm::UpdateDisplayListGUI() -{ - u32 curDlId = 0; - QTreeWidgetItem* curItem = ui->displayList->currentItem(); - if(curItem) - curDlId = ui->displayList->currentItem()->data(0,Qt::UserRole).toInt(); - - ui->displayList->clear(); - - const std::list& dlQueue = gpu->GetDisplayLists(); - - DisplayList dlist; - DisplayList* dl = &dlist; - if(gpuDebug->GetCurrentDisplayList(dlist)) - { - QTreeWidgetItem* item = new QTreeWidgetItem(); - item->setText(0,QString::number(dl->id)); - item->setData(0, Qt::UserRole, dl->id); - switch(dl->state) - { - case PSP_GE_DL_STATE_NONE: item->setText(1,"None"); break; - case PSP_GE_DL_STATE_QUEUED: item->setText(1,"Queued"); break; - case PSP_GE_DL_STATE_RUNNING: item->setText(1,"Running"); break; - case PSP_GE_DL_STATE_COMPLETED: item->setText(1,"Completed"); break; - case PSP_GE_DL_STATE_PAUSED: item->setText(1,"Paused"); break; - default: break; - } - item->setText(2,QString("%1").arg(dl->startpc,8,16,QChar('0'))); - item->setData(2, Qt::UserRole, dl->startpc); - item->setText(3,QString("%1").arg(dl->pc,8,16,QChar('0'))); - item->setData(3, Qt::UserRole, dl->pc); - ui->displayList->addTopLevelItem(item); - if(curDlId == (u32)dl->id) - { - ui->displayList->setCurrentItem(item); - displayListRowSelected = item; - } - } - - for(auto listIdIt = dlQueue.begin(); listIdIt != dlQueue.end(); ++listIdIt) - { - DisplayList *it = gpu->getList(*listIdIt); - if(dl && it->id == dl->id) - continue; - QTreeWidgetItem* item = new QTreeWidgetItem(); - item->setText(0,QString::number(it->id)); - item->setData(0, Qt::UserRole, it->id); - switch(it->state) - { - case PSP_GE_DL_STATE_NONE: item->setText(1,"None"); break; - case PSP_GE_DL_STATE_QUEUED: item->setText(1,"Queued"); break; - case PSP_GE_DL_STATE_RUNNING: item->setText(1,"Running"); break; - case PSP_GE_DL_STATE_COMPLETED: item->setText(1,"Completed"); break; - case PSP_GE_DL_STATE_PAUSED: item->setText(1,"Paused"); break; - default: break; - } - item->setText(2,QString("%1").arg(it->startpc,8,16,QChar('0'))); - item->setData(2, Qt::UserRole, it->startpc); - item->setText(3,QString("%1").arg(it->pc,8,16,QChar('0'))); - item->setData(3, Qt::UserRole, it->pc); - ui->displayList->addTopLevelItem(item); - if(curDlId == (u32)it->id) - { - ui->displayList->setCurrentItem(item); - displayListRowSelected = item; - } - } - for(int i = 0; i < ui->displayList->columnCount(); i++) - ui->displayList->resizeColumnToContents(i); -} - -void Debugger_Disasm::on_displayList_customContextMenuRequested(const QPoint &pos) -{ - QTreeWidgetItem* item = ui->displayList->itemAt(pos); - if(item) - { - displayListRowSelected = item; - - /*QMenu menu(this); - - QAction *showCode = new QAction(tr("Show code"), this); - connect(showCode, SIGNAL(triggered()), this, SLOT(ShowDLCode())); - menu.addAction(showCode);*/ - - //menu.exec( ui->displayList->mapToGlobal(pos)); - } -} diff --git a/Qt/Debugger/debugger_disasm.h b/Qt/Debugger/debugger_disasm.h deleted file mode 100644 index aa06dc5bc8ca..000000000000 --- a/Qt/Debugger/debugger_disasm.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef DEBUGGER_DISASM_H -#define DEBUGGER_DISASM_H - -#include "Core/MIPS/MIPSStackWalk.h" -#include "Core/HLE/sceKernelThread.h" -#include "Core/Debugger/DebugInterface.h" -#include "debugger_vfpu.h" -#include -#include -#include -#include - -class MainWindow; -namespace Ui { -class Debugger_Disasm; -} - -class Debugger_Disasm : public QDialog -{ - Q_OBJECT - -public: - explicit Debugger_Disasm(DebugInterface *_cpu, MainWindow* mainWindow_, QWidget *parent = 0); - ~Debugger_Disasm(); - void SetDebugMode(bool _bDebug); - - void ShowVFPU(); - void Go(); - void Step(); - void StepOver(); - void StepHLE(); - void Stop(); - void Skip(); - void GotoPC(); - void GotoLR(); - void UpdateDialog(); - void NotifyMapLoaded(); - void Update(); - void ShowMemory(u32 addr); - void FillFunctions(); - void UpdateCallstack(); - void UpdateBreakpoints(); - void UpdateThread(); - void UpdateDisplayList(); - -signals: - void UpdateCallstack_(); - void UpdateDisplayList_(); - void UpdateBreakpoints_(); - void UpdateThread_(); - -public slots: - void Goto(u32 addr); - void RemoveBreakpoint(); - void GotoThreadEntryPoint(); - -private slots: - void UpdateCallstackGUI(); - void UpdateDisplayListGUI(); - void UpdateBreakpointsGUI(); - void UpdateThreadGUI(); - - void on_GotoPc_clicked(); - void on_Go_clicked(); - void on_Stop_clicked(); - void on_StepInto_clicked(); - void on_StepOver_clicked(); - void on_Skip_clicked(); - void on_NextHLE_clicked(); - void on_GotoLr_clicked(); - void on_GotoInt_currentIndexChanged(int index); - void on_Address_textChanged(const QString &arg1); - void on_DisasmView_customContextMenuRequested(const QPoint &pos); - - void on_RegList_customContextMenuRequested(const QPoint &pos); - void on_vfpu_clicked(); - void on_FuncList_itemClicked(QListWidgetItem *item); - void on_breakpointsList_itemClicked(QTreeWidgetItem *item, int column); - void on_breakpointsList_customContextMenuRequested(const QPoint &pos); - void on_clearAllBP_clicked(); - void on_threadList_itemClicked(QTreeWidgetItem *item, int column); - void on_threadList_customContextMenuRequested(const QPoint &pos); - - void SetThreadStatusRun(); - void SetThreadStatusWait(); - void SetThreadStatusSuspend(); - void on_displayList_customContextMenuRequested(const QPoint &pos); - -private: - void SetThreadStatus(ThreadStatus status); - - Ui::Debugger_Disasm *ui; - DebugInterface* cpu; - MainWindow* mainWindow; - Debugger_VFPU* vfpudlg; - u32 breakpointAddr; - QTreeWidgetItem* threadRowSelected; - QTreeWidgetItem* displayListRowSelected; - std::vector stackTraceModel; -}; - -#endif // DEBUGGER_DISASM_H diff --git a/Qt/Debugger/debugger_disasm.ui b/Qt/Debugger/debugger_disasm.ui deleted file mode 100644 index fb3b7e6e17b8..000000000000 --- a/Qt/Debugger/debugger_disasm.ui +++ /dev/null @@ -1,530 +0,0 @@ - - - Debugger_Disasm - - - - 0 - 0 - 837 - 492 - - - - Qt::ClickFocus - - - Disassembler - - - - - - Qt::Horizontal - - - - - - - Ctr: - - - - - - - - 0 - 0 - - - - &Go to - - - - 0 - - - 4 - - - 4 - - - 0 - - - 0 - - - - - - - - QLayout::SetDefaultConstraint - - - - - - 0 - 0 - - - - &PC - - - - - - - - 0 - 0 - - - - &LR - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Show VFPU - - - - - - - - - 0 - - - - - 0 - 0 - - - - Regs - - - - - - - 0 - 0 - - - - Qt::ClickFocus - - - Qt::CustomContextMenu - - - - 0 - - - 0 - - - - - Qt::Horizontal - - - - 120 - 20 - - - - - - - - Qt::Vertical - - - - - - - - - - - Funcs - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - &Go - - - - - - - - 0 - 0 - - - - Stop - - - - - - - - 0 - 0 - - - - Step &Into - - - - - - - false - - - - 0 - 0 - - - - Step &Over - - - - - - - - 0 - 0 - - - - S&kip - - - - - - - - 0 - 0 - - - - Next &HLE - - - - - - - - - - 0 - 0 - - - - Qt::ClickFocus - - - Qt::CustomContextMenu - - - - - - - 0 - - - - Breakpoints - - - - - - Qt::CustomContextMenu - - - false - - - false - - - 30 - - - - Address - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Clear All - - - - - - - - - - Callstack - - - - - - 4 - - - - Address - - - - - Entry Point - - - - - SP - - - - - length - - - - - - - - - Display Lists - - - - - - Qt::Horizontal - - - - Qt::CustomContextMenu - - - false - - - false - - - false - - - 30 - - - - Id - - - - - Status - - - - - Start Address - - - - - Current Address - - - - - - - - - - Threads - - - - - - Qt::CustomContextMenu - - - false - - - false - - - false - - - 50 - - - - Id - - - - - Name - - - - - Status - - - - - Current PC - - - - - Entry point - - - - - - - - - - - - - - - - - CtrlDisAsmView - QWidget -
ctrldisasmview.h
- 1 -
- - CtrlRegisterList - QWidget -
ctrlregisterlist.h
- 1 -
-
- - -
diff --git a/Qt/Debugger/debugger_displaylist.cpp b/Qt/Debugger/debugger_displaylist.cpp deleted file mode 100644 index 6089c6400329..000000000000 --- a/Qt/Debugger/debugger_displaylist.cpp +++ /dev/null @@ -1,1666 +0,0 @@ -#include "debugger_displaylist.h" - -#include -#include -#include - -#include "ui_debugger_displaylist.h" -#include "GPU/GPUInterface.h" -#include "GPU/GeDisasm.h" -#include "Core/Host.h" -#include "base/display.h" -#include "mainwindow.h" -#include "Qt/QtHost.h" - -//commented out until someone bothers to maintain it (see below) -//#include "GPU/GLES/VertexDecoder.h" - -Debugger_DisplayList::Debugger_DisplayList(DebugInterface *_cpu, Draw::DrawContext *draw, MainWindow* mainWindow_, QWidget *parent) : - QDialog(parent), - ui(new Ui::Debugger_DisplayList), - cpu(_cpu), - draw_(draw), - mainWindow(mainWindow_), - currentRenderFrameDisplay(0), - currentTextureDisplay(0), - fboZoomFactor(1), - maxVtxDisplay(20), - maxIdxDisplay(20) -{ - ui->setupUi(this); - - QObject::connect(this, SIGNAL(updateDisplayList_()), this, SLOT(UpdateDisplayListGUI())); - QObject::connect(this, SIGNAL(updateRenderBufferList_()), this, SLOT(UpdateRenderBufferListGUI())); - QObject::connect(this, SIGNAL(updateRenderBuffer_()), this, SLOT(UpdateRenderBufferGUI())); - -} - -Debugger_DisplayList::~Debugger_DisplayList() -{ - delete ui; -} - -void Debugger_DisplayList::UpdateDisplayList() -{ - emit updateDisplayList_(); -} - - -void Debugger_DisplayList::UpdateDisplayListGUI() -{ - u32 curDlId = 0; - QTreeWidgetItem* curItem = ui->displayList->currentItem(); - if(curItem) - curDlId = ui->displayList->currentItem()->data(0,Qt::UserRole).toInt(); - - displayListRowSelected = 0; - ui->displayList->clear(); - ui->displayListData->clear(); - - const std::list& dlQueue = gpu->GetDisplayLists(); - - for(auto listIdIt = dlQueue.begin(); listIdIt != dlQueue.end(); ++listIdIt) - { - DisplayList *it = gpu->getList(*listIdIt); - QTreeWidgetItem* item = new QTreeWidgetItem(); - item->setText(0,QString::number(it->id)); - item->setData(0, Qt::UserRole, it->id); - switch(it->state) - { - case PSP_GE_DL_STATE_NONE: item->setText(1,"None"); break; - case PSP_GE_DL_STATE_QUEUED: item->setText(1,"Queued"); break; - case PSP_GE_DL_STATE_RUNNING: item->setText(1,"Running"); break; - case PSP_GE_DL_STATE_COMPLETED: item->setText(1,"Completed"); break; - case PSP_GE_DL_STATE_PAUSED: item->setText(1,"Paused"); break; - default: break; - } - item->setText(2,QString("%1").arg(it->startpc,8,16,QChar('0'))); - item->setData(2, Qt::UserRole, it->startpc); - item->setText(3,QString("%1").arg(it->pc,8,16,QChar('0'))); - item->setData(3, Qt::UserRole, it->pc); - ui->displayList->addTopLevelItem(item); - if(curDlId == (u32)it->id) - { - ui->displayList->setCurrentItem(item); - displayListRowSelected = item; - ShowDLCode(); - } - } - for(int i = 0; i < ui->displayList->columnCount(); i++) - ui->displayList->resizeColumnToContents(i); - - if (ui->displayList->selectedItems().size() == 0 && ui->displayList->topLevelItemCount() != 0) - { - ui->displayList->setCurrentItem(ui->displayList->topLevelItem(0)); - displayListRowSelected = ui->displayList->topLevelItem(0); - ShowDLCode(); - } -} - - -void Debugger_DisplayList::ShowDLCode() -{ - ui->displayListData->clear(); - ui->displayListData->setColumnCount(4); - - u32 startPc = displayListRowSelected->data(2,Qt::UserRole).toInt(); - u32 curPc = displayListRowSelected->data(3,Qt::UserRole).toInt(); - - std::map data; - GPUgstate listState; - memset(&listState,0,sizeof(GPUgstate)); - drawGPUState.clear(); - vtxBufferSize.clear(); - idxBufferSize.clear(); - - FillDisplayListCmd(data, startPc,0, listState); - - u32 curTexAddr = 0; - u32 curVtxAddr = 0; - u32 curIdxAddr = 0; - - for(std::map::iterator it = data.begin(); it != data.end(); it++) - { - QTreeWidgetItem* item = new QTreeWidgetItem(); - item->setText(0,QString("%1").arg(it->first,8,16,QChar('0'))); - item->setData(0, Qt::UserRole, it->first); - item->setText(1,QString("%1").arg(it->second.cmd,2,16,QChar('0'))); - item->setText(2,QString("%1").arg(it->second.data,6,16,QChar('0'))); - item->setText(3,it->second.comment); - if(curPc == (u32)it->first) - { - curTexAddr = it->second.texAddr; - curVtxAddr = it->second.vtxAddr; - curIdxAddr = it->second.idxAddr; - setCurrentFBO(it->second.fboAddr); - for(int j = 0; j < ui->displayListData->columnCount(); j++) - item->setTextColor(j, Qt::green); - } - if(it->second.implementationNotFinished) - { - for(int j = 0; j < ui->displayListData->columnCount(); j++) - item->setBackgroundColor(j, Qt::red); - } - ui->displayListData->addTopLevelItem(item); - - if(curPc == (u32)it->first) - { - ui->displayListData->setCurrentItem(item); - } - } - for(int j = 0; j < ui->displayListData->columnCount(); j++) - ui->displayListData->resizeColumnToContents(j); - - ui->texturesList->clear(); - ui->vertexData->clear(); - ui->vertexList->clear(); - ui->indexData->clear(); - ui->indexList->clear(); - - std::set usedTexAddr; - std::set usedVtxAddr; - std::set usedIdxAddr; - for(int i = 0; i < (int)drawGPUState.size(); i++) - { - // Textures - QTreeWidgetItem* item = new QTreeWidgetItem(); - u32 texaddr = (drawGPUState[i].texaddr[0] & 0xFFFFF0) | ((drawGPUState[i].texbufwidth[0]<<8) & 0x0F000000); - if(usedTexAddr.find(texaddr) == usedTexAddr.end() && Memory::IsValidAddress(texaddr)) - { - u32 format = drawGPUState[i].texformat & 0xF; - int w = 1 << (drawGPUState[i].texsize[0] & 0xf); - int h = 1 << ((drawGPUState[i].texsize[0]>>8) & 0xf); - - item->setText(0,QString("%1").arg(texaddr,8,16,QChar('0'))); - item->setData(0, Qt::UserRole, i); - item->setText(1,QString::number(w)); - item->setText(2,QString::number(h)); - item->setText(3,QString::number(format,16)); - ui->texturesList->addTopLevelItem(item); - if(curTexAddr == texaddr) - { - ui->texturesList->setCurrentItem(item); - for(int j = 0; j < ui->texturesList->columnCount(); j++) - item->setTextColor(j,Qt::green); - } - usedTexAddr.insert(texaddr); - } - - // Vertex - QTreeWidgetItem* vertexItem = new QTreeWidgetItem(); - u32 baseExtended = ((drawGPUState[i].base & 0x0F0000) << 8) | (drawGPUState[i].vaddr & 0xFFFFFF); - u32 vaddr = ((drawGPUState[i].offsetAddr & 0xFFFFFF) + baseExtended) & 0x0FFFFFFF; - if(drawGPUState[i].vaddr != 0 && Memory::IsValidAddress(vaddr) && usedVtxAddr.find(vaddr) == usedVtxAddr.end()) - { - vertexItem->setText(0, QString("%1").arg(vaddr,8,16,QChar('0'))); - vertexItem->setData(0,Qt::UserRole, i); - if((drawGPUState[i].vertType & GE_VTYPE_THROUGH_MASK) == GE_VTYPE_TRANSFORM) - vertexItem->setText(1, "Transform"); - else - vertexItem->setText(1, "Raw"); - vertexItem->setText(2, QString::number((drawGPUState[i].vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT)); - vertexItem->setText(3, QString::number((drawGPUState[i].vertType & GE_VTYPE_WEIGHTCOUNT_MASK) >> GE_VTYPE_WEIGHTCOUNT_SHIFT)); - switch(drawGPUState[i].vertType & GE_VTYPE_WEIGHT_MASK) - { - case GE_VTYPE_WEIGHT_8BIT: vertexItem->setText(4, "8bit"); break; - case GE_VTYPE_WEIGHT_16BIT: vertexItem->setText(4, "16bit"); break; - case GE_VTYPE_WEIGHT_FLOAT: vertexItem->setText(4, "float"); break; - default: vertexItem->setText(4, "No"); break; - } - switch(drawGPUState[i].vertType & GE_VTYPE_POS_MASK) - { - case GE_VTYPE_POS_8BIT: vertexItem->setText(5, "8bit"); break; - case GE_VTYPE_POS_16BIT: vertexItem->setText(5, "16bit"); break; - case GE_VTYPE_POS_FLOAT: vertexItem->setText(5, "float"); break; - default: vertexItem->setText(5, "No"); break; - } - switch(drawGPUState[i].vertType & GE_VTYPE_NRM_MASK) - { - case GE_VTYPE_NRM_8BIT: vertexItem->setText(6, "8bit"); break; - case GE_VTYPE_NRM_16BIT: vertexItem->setText(6, "16bit"); break; - case GE_VTYPE_NRM_FLOAT: vertexItem->setText(6, "float"); break; - default: vertexItem->setText(6, "No"); break; - } - switch(drawGPUState[i].vertType & GE_VTYPE_COL_MASK) - { - case GE_VTYPE_COL_4444: vertexItem->setText(7, "4444"); break; - case GE_VTYPE_COL_5551: vertexItem->setText(7, "5551"); break; - case GE_VTYPE_COL_565: vertexItem->setText(7, "565"); break; - case GE_VTYPE_COL_8888: vertexItem->setText(7, "8888"); break; - default: vertexItem->setText(7, "No"); break; - } - switch(drawGPUState[i].vertType & GE_VTYPE_TC_MASK) - { - case GE_VTYPE_TC_8BIT: vertexItem->setText(8, "8bit"); break; - case GE_VTYPE_TC_16BIT: vertexItem->setText(8, "16bit"); break; - case GE_VTYPE_TC_FLOAT: vertexItem->setText(8, "float"); break; - default: vertexItem->setText(8, "No"); break; - } - - ui->vertexList->addTopLevelItem(vertexItem); - if(curVtxAddr == vaddr) - { - ui->vertexList->setCurrentItem(vertexItem); - for(int j = 0; j < ui->vertexList->columnCount(); j++) - vertexItem->setTextColor(j,Qt::green); - } - usedVtxAddr.insert(vaddr); - } - - - // Index - QTreeWidgetItem* indexItem = new QTreeWidgetItem(); - baseExtended = ((drawGPUState[i].base & 0x0F0000) << 8) | (drawGPUState[i].iaddr & 0xFFFFFF); - u32 iaddr = ((drawGPUState[i].offsetAddr & 0xFFFFFF) + baseExtended) & 0x0FFFFFFF; - if((drawGPUState[i].iaddr & 0xFFFFFF) != 0 && Memory::IsValidAddress(iaddr) && usedIdxAddr.find(iaddr) == usedIdxAddr.end()) - { - indexItem->setText(0, QString("%1").arg(iaddr,8,16,QChar('0'))); - indexItem->setData(0,Qt::UserRole, i); - - ui->indexList->addTopLevelItem(indexItem); - if(curIdxAddr == iaddr) - { - ui->indexList->setCurrentItem(indexItem); - for(int j = 0; j < ui->indexList->columnCount(); j++) - indexItem->setTextColor(j,Qt::green); - } - usedIdxAddr.insert(iaddr); - } - } - - - for(int i = 0; i < ui->texturesList->columnCount(); i++) - ui->texturesList->resizeColumnToContents(i); - for(int i = 0; i < ui->vertexList->columnCount(); i++) - ui->vertexList->resizeColumnToContents(i); - for(int i = 0; i < ui->indexList->columnCount(); i++) - ui->indexList->resizeColumnToContents(i); - - UpdateVertexInfo(); - UpdateIndexInfo(); -} - - -QString Debugger_DisplayList::DisassembleOp(u32 pc, u32 op, u32 prev, const GPUgstate& state) { - u32 cmd = op >> 24; - u32 data = op & 0xFFFFFF; - - // Handle control and drawing commands here directly. The others we delegate. - switch (cmd) - { - case GE_CMD_BASE: - return QString("BASE: %1").arg(data & 0xFFFFFF,6,16,QChar('0')); - - case GE_CMD_VADDR: /// <<8???? - { - u32 baseExtended = ((state.base & 0x0F0000) << 8) | (data & 0xFFFFFF); - baseExtended = (state.offsetAddr + baseExtended) & 0x0FFFFFFF; - return QString("VADDR: %1").arg(baseExtended,6,16,QChar('0')); - } - - case GE_CMD_IADDR: - { - u32 baseExtended = ((state.base & 0x0F0000) << 8) | (data & 0xFFFFFF); - baseExtended = (state.offsetAddr + baseExtended) & 0x0FFFFFFF; - return QString("IADDR: %1").arg(baseExtended,6,16,QChar('0')); - } - - case GE_CMD_PRIM: - { - u32 count = data & 0xFFFF; - u32 type = data >> 16; - static const char* types[7] = { - "POINTS", - "LINES", - "LINE_STRIP", - "TRIANGLES", - "TRIANGLE_STRIP", - "TRIANGLE_FAN", - "RECTANGLES", - }; - return QString("DrawPrim type: %1 count: %2").arg(type < 7 ? types[type] : "INVALID").arg(count); - } - - // The arrow and other rotary items in Puzbob are bezier patches, strangely enough. - case GE_CMD_BEZIER: - { - int bz_ucount = data & 0xFF; - int bz_vcount = (data >> 8) & 0xFF; - return QString("DRAW BEZIER: U=%1 x V=%2").arg(bz_ucount).arg(bz_vcount); - } - - case GE_CMD_SPLINE: - { - int sp_ucount = data & 0xFF; - int sp_vcount = (data >> 8) & 0xFF; - static const char* type[4] = { - "Close/Close", - "Open/Close", - "Close/Open", - "Open/Open" - }; - int sp_utype = (data >> 16) & 0x3; - int sp_vtype = (data >> 18) & 0x3; - return QString("DRAW SPLINE: U=%1 x V=%2, U Type = %3 , V Type = %4").arg(sp_ucount).arg(sp_vcount).arg(type[sp_utype]).arg(type[sp_vtype]); - } - - case GE_CMD_JUMP: - { - u32 target = (((state.base & 0x00FF0000) << 8) | (op & 0xFFFFFC)) & 0x0FFFFFFF; - return QString("CMD JUMP - %1 to %2").arg(pc,8,16,QChar('0')).arg(target,8,16,QChar('0')); - } - - case GE_CMD_CALL: - { - u32 retval = pc + 4; - u32 baseExtended = ((state.base & 0x0F0000) << 8) | (op & 0xFFFFFF); - u32 target = (state.offsetAddr + baseExtended) & 0x0FFFFFFF; - return QString("CMD CALL - %1 to %2, ret=%3").arg(pc,8,16,QChar('0')).arg(target,8,16,QChar('0')).arg(retval,8,16,QChar('0')); - } - - case GE_CMD_RET: - return QString("CMD RET"); - - case GE_CMD_SIGNAL: - return QString("GE_CMD_SIGNAL %1").arg(data,6,16,QChar('0')); - - case GE_CMD_FINISH: - return QString("CMD FINISH %1").arg(data,6,16,QChar('0')); - - case GE_CMD_END: - switch (prev >> 24) - { - case GE_CMD_SIGNAL: - { - // TODO: see http://code.google.com/p/jpcsp/source/detail?r=2935# - int behaviour = (prev >> 16) & 0xFF; - int signal = prev & 0xFFFF; - int enddata = data & 0xFFFF; - // We should probably defer to sceGe here, no sense in implementing this stuff in every GPU - switch (behaviour) { - case 1: // Signal with Wait - return QString("Signal with Wait UNIMPLEMENTED! signal/end: %1 %2").arg(signal,4,16,QChar('0')).arg(enddata,4,16,QChar('0')); - case 2: - return QString("Signal without wait. signal/end: %1 %2").arg(signal,4,16,QChar('0')).arg(enddata,4,16,QChar('0')); - case 3: - return QString("Signal with Pause UNIMPLEMENTED! signal/end: %1 %2").arg(signal,4,16,QChar('0')).arg(enddata,4,16,QChar('0')); - case 0x10: - return QString("Signal with Jump UNIMPLEMENTED! signal/end: %1 %2").arg(signal,4,16,QChar('0')).arg(enddata,4,16,QChar('0')); - case 0x11: - return QString("Signal with Call UNIMPLEMENTED! signal/end: %1 %2").arg(signal,4,16,QChar('0')).arg(enddata,4,16,QChar('0')); - case 0x12: - return QString("Signal with Return UNIMPLEMENTED! signal/end: %1 %2").arg(signal,4,16,QChar('0')).arg(enddata,4,16,QChar('0')); - default: - return QString("UNKNOWN Signal UNIMPLEMENTED %1 ! signal/end: %1 %2").arg(behaviour).arg(signal,4,16,QChar('0')).arg(enddata,4,16,QChar('0')); - } - } - break; - case GE_CMD_FINISH: - break; - default: - return QString("Ah, not finished: %1").arg(prev & 0xFFFFFF,6,16,QChar('0')); - } - return "CMD END"; - - case GE_CMD_BJUMP: - { - // bounding box jump. Let's just not jump, for now. - u32 target = (((state.base & 0x00FF0000) << 8) | (op & 0xFFFFFC)) & 0x0FFFFFFF; - return QString("BBOX JUMP - %1 to %2").arg(pc,8,16,QChar('0')).arg(target,8,16,QChar('0')); - } - case GE_CMD_BOUNDINGBOX: - // bounding box test. Let's do nothing. - return QString("BBOX TEST - number : %1").arg(data & 0xFFFF,4,16,QChar('0')); - - case GE_CMD_ORIGIN: - return QString("Origin: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_VERTEXTYPE: - { - const char* format[4] = - { - "No", - "8 Bits fixed", - "16 Bits fixed", - "Float" - }; - const char* colFormat[8] = - { - "No", - "", - "", - "", - "16-bit BGR-5650", - "16-bit ABGR-5551", - "16-bit ABGR-4444", - "32-bit ABGR-8888" - }; - QString retString = "SetVertexType:"; - - u32 transform = data & GE_VTYPE_THROUGH_MASK; - retString += QString(" Transform : %1").arg(transform==0?"Transformed":"Raw"); - - u32 numVertMorph = (data & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT; - retString += QString(", Num Vtx Morph : %1").arg(numVertMorph); - - u32 numWeight = (data & GE_VTYPE_WEIGHTCOUNT_MASK) >> GE_VTYPE_WEIGHTCOUNT_SHIFT; - retString += QString(", Num Weights : %1").arg(numWeight); - - u32 indexFmt = (data & GE_VTYPE_IDX_MASK) >> GE_VTYPE_IDX_SHIFT; - retString += QString(", Index Format : %1").arg(format[indexFmt]); - - u32 weightFmt = (data & GE_VTYPE_WEIGHT_MASK) >> GE_VTYPE_WEIGHT_SHIFT; - retString += QString(", Weight Format : %1").arg(format[weightFmt]); - - u32 posFmt = (data & GE_VTYPE_POS_MASK) >> GE_VTYPE_POS_SHIFT; - retString += QString(", Position Format : %1").arg(format[posFmt]); - - u32 nrmFmt = (data & GE_VTYPE_NRM_MASK) >> GE_VTYPE_NRM_SHIFT; - retString += QString(", Normal Format : %1").arg(format[nrmFmt]); - - u32 colFmt = (data & GE_VTYPE_COL_MASK) >> GE_VTYPE_COL_SHIFT; - retString += QString(", Color Format : %1").arg(colFormat[colFmt]); - - u32 tcFmt = (data & GE_VTYPE_TC_MASK) >> GE_VTYPE_TC_SHIFT; - retString += QString(", Texture UV Format : %1").arg(format[tcFmt]); - - return retString; - } - case GE_CMD_OFFSETADDR: - return QString("OffsetAddr: %1").arg(data,6,16,QChar('0')); - break; - - case GE_CMD_REGION1: - { - int x1 = data & 0x3ff; - int y1 = data >> 10; - //topleft - return QString("Region TL: %1 %2").arg(x1).arg(y1); - } - - case GE_CMD_REGION2: - { - int x2 = data & 0x3ff; - int y2 = data >> 10; - return QString("Region BR: %1 %2").arg(x2).arg(y2); - } - - case GE_CMD_CLIPENABLE: - return QString("Clip Enable: %1").arg(data); - - case GE_CMD_CULLFACEENABLE: - return QString("CullFace Enable: %1").arg(data); - - case GE_CMD_TEXTUREMAPENABLE: - return QString("Texture map enable: %1").arg(data); - - case GE_CMD_LIGHTINGENABLE: - return QString("Lighting enable: %1").arg(data); - - case GE_CMD_FOGENABLE: - return QString("Fog Enable: %1").arg(data); - - case GE_CMD_DITHERENABLE: - return QString("Dither Enable: %1").arg(data); - - case GE_CMD_OFFSETX: - return QString("Offset X: %1").arg(data); - - case GE_CMD_OFFSETY: - return QString("Offset Y: %1").arg(data); - - case GE_CMD_TEXSCALEU: - return QString("Texture U Scale: %1").arg(getFloat24(data)); - - case GE_CMD_TEXSCALEV: - return QString("Texture V Scale: %1").arg(getFloat24(data)); - - case GE_CMD_TEXOFFSETU: - return QString("Texture U Offset: %1").arg(getFloat24(data)); - - case GE_CMD_TEXOFFSETV: - return QString("Texture V Offset: %1").arg(getFloat24(data)); - - case GE_CMD_SCISSOR1: - { - int x1 = data & 0x3ff; - int y1 = data >> 10; - return QString("Scissor TL: %1, %2").arg(x1).arg(y1); - } - case GE_CMD_SCISSOR2: - { - int x2 = data & 0x3ff; - int y2 = data >> 10; - return QString("Scissor BR: %1, %2").arg(x2).arg(y2); - } - - case GE_CMD_MINZ: - { - float zMin = getFloat24(data) / 65535.f; - return QString("MinZ: %1").arg(zMin); - } - - case GE_CMD_MAXZ: - { - float zMax = getFloat24(data) / 65535.f; - return QString("MaxZ: %1").arg(zMax); - } - - case GE_CMD_FRAMEBUFPTR: - { - return QString("FramebufPtr: %1").arg(data,8,16,QChar('0')); - } - - case GE_CMD_FRAMEBUFWIDTH: - { - return QString("FramebufWidth: %1").arg(data); - } - - case GE_CMD_FRAMEBUFPIXFORMAT: - { - const char* fmt[4] = - { - "16-bit BGR 5650", - "16-bit ABGR 5551", - "16-bit ABGR 4444", - "32-bit ABGR 8888" - }; - return QString("FramebufPixeFormat: %1").arg(fmt[data]); - } - case GE_CMD_TEXADDR0: - case GE_CMD_TEXADDR1: - case GE_CMD_TEXADDR2: - case GE_CMD_TEXADDR3: - case GE_CMD_TEXADDR4: - case GE_CMD_TEXADDR5: - case GE_CMD_TEXADDR6: - case GE_CMD_TEXADDR7: - return QString("Texture address %1: %2").arg(cmd-GE_CMD_TEXADDR0).arg(data,6,16,QChar('0')); - - case GE_CMD_TEXBUFWIDTH0: - case GE_CMD_TEXBUFWIDTH1: - case GE_CMD_TEXBUFWIDTH2: - case GE_CMD_TEXBUFWIDTH3: - case GE_CMD_TEXBUFWIDTH4: - case GE_CMD_TEXBUFWIDTH5: - case GE_CMD_TEXBUFWIDTH6: - case GE_CMD_TEXBUFWIDTH7: - return QString("Texture BUFWIDTHess %1: %2 width : %3").arg(cmd-GE_CMD_TEXBUFWIDTH0).arg(data,6,16,QChar('0')).arg(data & 0xFFFF); - - case GE_CMD_CLUTADDR: - return QString("CLUT base addr: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_CLUTADDRUPPER: - return QString("CLUT addr upper %1").arg(data,8,16,QChar('0')); - - case GE_CMD_LOADCLUT: - // This could be used to "dirty" textures with clut. - return QString("Clut load, numColor : %1").arg(data*8); - - case GE_CMD_TEXMAPMODE: - { - const char* texMapMode[3] = - { - "Texture Coordinates (UV)", - "Texture Matrix", - "Environment Map" - }; - const char* texProjMode[4] = - { - "Position", - "Texture Coordinates", - "Normalized Normal", - "Normal" - }; - return QString("Tex map mode: Map mode : %1, Proj Mode : %2").arg(texMapMode[data & 0x3]).arg(texProjMode[(data >> 8) & 0x3]); - } - case GE_CMD_TEXSHADELS: - return QString("Tex shade light sources: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_CLUTFORMAT: - { - const char* fmt[4] = - { - "16-bit BGR 5650", - "16-bit ABGR 5551", - "16-bit ABGR 4444", - "32-bit ABGR 8888" - }; - return QString("Clut format: %1 , Fmt : %2").arg(data,6,16,QChar('0')).arg(fmt[data & 0x3]); - } - - case GE_CMD_TRANSFERSRC: - { - return QString("Block Transfer Src: %1").arg(data,6,16,QChar('0')); - // Nothing to do, the next one prints - } - - case GE_CMD_TRANSFERSRCW: - { - u32 xferSrc = state.transfersrc | ((data&0xFF0000)<<8); - u32 xferSrcW = state.transfersrcw & 1023; - return QString("Block Transfer Src: %1 W: %2").arg(xferSrc,8,16,QChar('0')).arg(xferSrcW); - } - - case GE_CMD_TRANSFERDST: - { - // Nothing to do, the next one prints - return QString("Block Transfer Dst: %1").arg(data,6,16,QChar('0')); - } - - case GE_CMD_TRANSFERDSTW: - { - u32 xferDst= state.transferdst | ((data&0xFF0000)<<8); - u32 xferDstW = state.transferdstw & 1023; - return QString("Block Transfer Dest: %1 W: %2").arg(xferDst,8,16,QChar('0')).arg(xferDstW); - } - - case GE_CMD_TRANSFERSRCPOS: - { - u32 x = (data & 1023)+1; - u32 y = ((data>>10) & 1023)+1; - return QString("Block Transfer Src Rect TL: %1, %2").arg(x).arg(y); - } - - case GE_CMD_TRANSFERDSTPOS: - { - u32 x = (data & 1023)+1; - u32 y = ((data>>10) & 1023)+1; - return QString("Block Transfer Dest Rect TL: %1, %2").arg(x).arg(y); - } - - case GE_CMD_TRANSFERSIZE: - { - u32 w = (data & 1023)+1; - u32 h = ((data>>10) & 1023)+1; - return QString("Block Transfer Rect Size: %1 x %2").arg(w).arg(h); - } - - case GE_CMD_TRANSFERSTART: - { - return QString("Block Transfer Start : %1").arg(data ? "32-bit texel size" : "16-bit texel size"); - } - - case GE_CMD_TEXSIZE0: - case GE_CMD_TEXSIZE1: - case GE_CMD_TEXSIZE2: - case GE_CMD_TEXSIZE3: - case GE_CMD_TEXSIZE4: - case GE_CMD_TEXSIZE5: - case GE_CMD_TEXSIZE6: - case GE_CMD_TEXSIZE7: - { - int w = 1 << (data & 0xf); - int h = 1 << ((data>>8) & 0xf); - return QString("Texture Size %1: %2, width : %3, height : %4").arg(cmd - GE_CMD_TEXSIZE0).arg(data,6,16,QChar('0')).arg(w).arg(h); - } - - case GE_CMD_ZBUFPTR: - { - return QString("Zbuf Ptr: %1").arg(data,6,16,QChar('0')); - } - - case GE_CMD_ZBUFWIDTH: - { - return QString("Zbuf Width: %1").arg(data,6,16,QChar('0')); - } - - case GE_CMD_AMBIENTCOLOR: - return QString("Ambient Color: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_AMBIENTALPHA: - return QString("Ambient Alpha: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_MATERIALAMBIENT: - return QString("Material Ambient Color: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_MATERIALDIFFUSE: - return QString("Material Diffuse Color: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_MATERIALEMISSIVE: - return QString("Material Emissive Color: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_MATERIALSPECULAR: - return QString("Material Specular Color: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_MATERIALALPHA: - return QString("Material Alpha Color: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_MATERIALSPECULARCOEF: - return QString("Material specular coef: %1").arg(getFloat24(data)); - - case GE_CMD_SHADEMODE: - return QString("Shade: %1 (%2)").arg(data,6,16,QChar('0')).arg(data ? "gouraud" : "flat"); - - case GE_CMD_LIGHTMODE: - return QString("Lightmode: %1 (%2)").arg(data,6,16,QChar('0')).arg(data ? "separate spec" : "single color"); - - case GE_CMD_LIGHTTYPE0: - case GE_CMD_LIGHTTYPE1: - case GE_CMD_LIGHTTYPE2: - case GE_CMD_LIGHTTYPE3: - { - const char* lightType[3] = - { - "Directional Light", - "Point Light", - "Spot Light" - }; - const char* lightComp[3] = - { - "Ambient & Diffuse", - "Diffuse & Specular", - "Unknown (diffuse color, affected by specular power)" - }; - return QString("Light %1 type: %2 %3").arg(cmd-GE_CMD_LIGHTTYPE0).arg(lightType[(data) >> 8 & 0x3]).arg(lightComp[data & 0x3]); - } - case GE_CMD_LX0:case GE_CMD_LY0:case GE_CMD_LZ0: - case GE_CMD_LX1:case GE_CMD_LY1:case GE_CMD_LZ1: - case GE_CMD_LX2:case GE_CMD_LY2:case GE_CMD_LZ2: - case GE_CMD_LX3:case GE_CMD_LY3:case GE_CMD_LZ3: - { - int n = cmd - GE_CMD_LX0; - int l = n / 3; - int c = n % 3; - float val = getFloat24(data); - return QString("Light %1 %2 pos: %3").arg(l).arg(QChar('X')+c).arg(val); - } - - case GE_CMD_LDX0:case GE_CMD_LDY0:case GE_CMD_LDZ0: - case GE_CMD_LDX1:case GE_CMD_LDY1:case GE_CMD_LDZ1: - case GE_CMD_LDX2:case GE_CMD_LDY2:case GE_CMD_LDZ2: - case GE_CMD_LDX3:case GE_CMD_LDY3:case GE_CMD_LDZ3: - { - int n = cmd - GE_CMD_LDX0; - int l = n / 3; - int c = n % 3; - float val = getFloat24(data); - return QString("Light %1 %2 dir: %3").arg(l).arg(QChar('X')+c).arg(val); - } - - case GE_CMD_LKA0:case GE_CMD_LKB0:case GE_CMD_LKC0: - case GE_CMD_LKA1:case GE_CMD_LKB1:case GE_CMD_LKC1: - case GE_CMD_LKA2:case GE_CMD_LKB2:case GE_CMD_LKC2: - case GE_CMD_LKA3:case GE_CMD_LKB3:case GE_CMD_LKC3: - { - int n = cmd - GE_CMD_LKA0; - int l = n / 3; - int c = n % 3; - float val = getFloat24(data); - return QString("Light %1 %2 att: %3").arg(l).arg(QChar('X')+c).arg(val); - } - - case GE_CMD_LAC0:case GE_CMD_LAC1:case GE_CMD_LAC2:case GE_CMD_LAC3: - case GE_CMD_LDC0:case GE_CMD_LDC1:case GE_CMD_LDC2:case GE_CMD_LDC3: - case GE_CMD_LSC0:case GE_CMD_LSC1:case GE_CMD_LSC2:case GE_CMD_LSC3: - { - float r = (float)(data & 0xff)/255.0f; - float g = (float)((data>>8) & 0xff)/255.0f; - float b = (float)(data>>16)/255.0f; - - int l = (cmd - GE_CMD_LAC0) / 3; - int t = (cmd - GE_CMD_LAC0) % 3; - return QString("Light %1 color %2: %3 %4 %5").arg(l).arg(t).arg(r).arg(g).arg(b); - } - - case GE_CMD_VIEWPORTXSCALE: - case GE_CMD_VIEWPORTYSCALE: - case GE_CMD_VIEWPORTXCENTER: - case GE_CMD_VIEWPORTYCENTER: - return QString("Viewport param %1: %2").arg(cmd-GE_CMD_VIEWPORTXSCALE).arg(getFloat24(data)); - case GE_CMD_VIEWPORTZSCALE: - { - float zScale = getFloat24(data) / 65535.f; - return QString("Viewport Z scale: %1").arg(zScale); - } - case GE_CMD_VIEWPORTZCENTER: - { - float zOff = getFloat24(data) / 65535.f; - return QString("Viewport Z pos: %1").arg(zOff); - } - - case GE_CMD_LIGHTENABLE0: - case GE_CMD_LIGHTENABLE1: - case GE_CMD_LIGHTENABLE2: - case GE_CMD_LIGHTENABLE3: - return QString("Light %1 enable: %2").arg(cmd-GE_CMD_LIGHTENABLE0).arg(data); - - case GE_CMD_CULL: - { - const char* cull[2] = - { - "Clockwise visible", - "Counter-clockwise visible" - }; - return QString("cull: %1").arg(cull[data & 0x1]); - } - case GE_CMD_PATCHDIVISION: - { - int patch_div_s = data & 0xFF; - int patch_div_t = (data >> 8) & 0xFF; - return QString("Patch subdivision: S=%1 x T=%2").arg(patch_div_s).arg(patch_div_t); - } - - case GE_CMD_PATCHPRIMITIVE: - { - const char* type[3] = - { - "Triangles", - "Lines", - "Points" - }; - return QString("Patch Primitive: %1").arg(type[data]); - } - case GE_CMD_PATCHFACING: - { - const char* val[2] = - { - "Clockwise", - "Counter-Clockwise" - }; - return QString( "Patch Facing: %1").arg(val[data]); - } - case GE_CMD_REVERSENORMAL: - return QString("Reverse normal: %1").arg(data); - break; - - case GE_CMD_MATERIALUPDATE: - { - QString txt = ""; - if(data & 1) txt += " Ambient"; - if(data & 2) txt += " Diffuse"; - if(data & 4) txt += " Specular"; - return QString("Material Update: %1").arg(txt); - } - - ////////////////////////////////////////////////////////////////// - // CLEARING - ////////////////////////////////////////////////////////////////// - case GE_CMD_CLEARMODE: - { - // If it becomes a performance problem, check diff&1 - const char* clearMode[8] = - { - "", - "Clear Color Buffer", - "Clear Stencil/Alpha Buffer", - "", - "Clear Depth Buffer", - "", - "", - "" - }; - return QString("Clear mode: %1, enabled : %2").arg(clearMode[(data >> 8) & 0xF]).arg(data & 0x1); - } - - ////////////////////////////////////////////////////////////////// - // ALPHA BLENDING - ////////////////////////////////////////////////////////////////// - case GE_CMD_ALPHABLENDENABLE: - return QString("Alpha blend enable: %1").arg(data); - - case GE_CMD_BLENDMODE: - { - const char* func[9] = - { - "Source Color", - "One Minus Source Color", - "Source Alpha", - "One Minus Source Alpha", - "Destination Color", - "One Minus Destination Color", - "Destination Alpha", - "One Minus Destination Alpha", - "Fix" - }; - const char* op[6] = - { - "Add", - "Subtract", - "Reverse Subtract", - "Minimum Value", - "Maximum Value", - "Absolute Value" - }; - return QString("Blend mode: Src : %1, Dest : %2, Op : %3").arg(func[(data >> 4) & 0xF]).arg(func[(data >> 8) & 0xF]).arg(op[(data) & 0x7]); - } - case GE_CMD_BLENDFIXEDA: - return QString("Blend fix A: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_BLENDFIXEDB: - return QString("Blend fix B: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_ALPHATESTENABLE: - return QString("Alpha test enable: %1").arg(data); - - case GE_CMD_ALPHATEST: - { - const char* testFunc[8] = - { - "Never pass pixel", - "Always pass pixel", - "Pass pixel if match", - "Pass pixel if difference", - "Pass pixel if less", - "Pass pixel if less or equal", - "Pass pixel if greater", - "Pass pixel if greater or equal" - }; - return QString("Alpha test settings, Mask : %1, Ref : %2, Test : %3").arg((data >> 8) & 0xFF).arg((data >> 16) & 0xFF).arg(testFunc[data & 0x7]); - } - case GE_CMD_ANTIALIASENABLE: - return QString("Antialias enable: %1").arg(data); - - case GE_CMD_PATCHCULLENABLE: - return QString("Antialias enable: %1").arg(data); - - case GE_CMD_COLORTESTENABLE: - { - const char* colorTest[4] = - { - "Never pass pixel", - "Always pass pixel", - "Pass pixel if color matches", - "Pass pixel if color differs" - }; - return QString("Color Test enable: %1").arg(colorTest[data]); - } - case GE_CMD_LOGICOPENABLE: - { - const char* logicOp[16] = - { - "Clear", - "And", - "Reverse And", - "Copy", - "Inverted And", - "No Operation", - "Exclusive Or", - "Or", - "Negated Or", - "Equivalence", - "Inverted", - "Reverse Or", - "Inverted Copy", - "Inverted Or", - "Negated And", - "Set" - }; - return QString("Logic op enable: %1").arg(logicOp[data]); - } - case GE_CMD_TEXFUNC: - { - const char* effect[8] = - { - "Modulate", - "Decal", - "Blend", - "Replace", - "Add", - "","","" - }; - return QString("TexFunc %1 / %2 / %3").arg((data&0x100)?"Texture alpha is read":"Texture alpha is ignored").arg((data & 0x10000)?"Fragment color is doubled":"Fragment color is untouched").arg(effect[data & 0x7]); - } - case GE_CMD_TEXFILTER: - { - const char* filter[8]= - { - "Nearest", - "Linear", - "", - "", - "Nearest; Mipmap Nearest", - "Linear; Mipmap Nearest", - "Nearest; Mipmap Linear", - "Linear; Mipmap Linear" - }; - int min = data & 0x7; - int mag = (data >> 8) & 0x7; - return QString("TexFilter min: %1 mag: %2").arg(filter[min]).arg(filter[mag]); - } - - case GE_CMD_TEXENVCOLOR: - return QString("TexEnvColor %1").arg(data,6,16,QChar('0')); - - case GE_CMD_TEXMODE: - { - u32 maxMipMap = (data >> 16) & 0xF; - return QString("TexMode MaxmipMap : %1, Swizzle : %2").arg(maxMipMap).arg(data & 0x1); - } - case GE_CMD_TEXFORMAT: - { - const char* texFmt[11] = - { - "16-bit BGR 5650", - "16-bit ABGR 5551", - "16-bit ABGR 4444", - "32-bit ABGR 8888", - "4-bit indexed", - "8-bit indexed", - "16-bit indexed", - "32-bit indexed", - "DXT1", - "DXT3", - "DXT5" - }; - return QString("TexFormat %1").arg(texFmt[data]); - } - case GE_CMD_TEXFLUSH: - return QString("TexFlush"); - - case GE_CMD_TEXSYNC: - return QString("TexSync"); - - case GE_CMD_TEXWRAP: - { - const char* wrapMode[2] = - { - "Repeat", - "Clamp" - }; - return QString("TexWrap U : %1, V : %2").arg(wrapMode[data & 0x1]).arg(wrapMode[(data >> 8) & 0x1]); - } - case GE_CMD_TEXLEVEL: - return QString("TexWrap Mode: %1 Offset: %2").arg(data&3).arg(data >> 16); - - case GE_CMD_FOG1: - return QString("Fog1 %1").arg(getFloat24(data)); - - case GE_CMD_FOG2: - return QString( "Fog2 %1").arg(getFloat24(data)); - - case GE_CMD_FOGCOLOR: - return QString("FogColor %1").arg(data,6,16,QChar('0')); - - case GE_CMD_TEXLODSLOPE: - return QString( "TexLodSlope %1").arg(data,6,16,QChar('0')); - - ////////////////////////////////////////////////////////////////// - // Z/STENCIL TESTING - ////////////////////////////////////////////////////////////////// - - case GE_CMD_ZTESTENABLE: - return QString( "Z test enable: %1").arg(data&1); - - case GE_CMD_STENCILOP: - { - const char* stencilOp[8] = - { - "Keep stencil value", - "Zero stencil value", - "Replace stencil value", - "Invert stencil value", - "Increment stencil value", - "Decrement stencil value", - "","" - }; - return QString("Stencil op: ZFail : %1, Fail : %2, Pass : %3").arg(stencilOp[(data >> 16) & 0x7]).arg(stencilOp[(data >> 8) & 0x7]).arg(stencilOp[(data) & 0x7]); - } - case GE_CMD_STENCILTEST: - { - const char* testFunc[8] = - { - "Never pass stencil pixel", - "Always pass stencil pixel", - "Pass test if match", - "Pass test if difference", - "Pass test if less", - "Pass test if less or equal", - "Pass test if greater", - "Pass test if greater or equal" - }; - return QString("Stencil test, Mask : %1, Ref : %2, Test : %3").arg((data >> 8) & 0xFF).arg((data >> 16) & 0xFF).arg(testFunc[data & 0x7]); - } - - case GE_CMD_STENCILTESTENABLE: - return QString("Stencil test enable: %1").arg(data); - - case GE_CMD_ZTEST: - { - const char* testFunc[8] = - { - "Never pass stencil pixel", - "Always pass stencil pixel", - "Pass pixel if match", - "Pass pixel if difference", - "Pass pixel if less", - "Pass pixel if less or equal", - "Pass pixel if greater", - "Pass pixel if greater or equal" - }; - return QString("Z test mode: %1").arg(testFunc[data & 0x7]); - } - case GE_CMD_MORPHWEIGHT0: - case GE_CMD_MORPHWEIGHT1: - case GE_CMD_MORPHWEIGHT2: - case GE_CMD_MORPHWEIGHT3: - case GE_CMD_MORPHWEIGHT4: - case GE_CMD_MORPHWEIGHT5: - case GE_CMD_MORPHWEIGHT6: - case GE_CMD_MORPHWEIGHT7: - { - int index = cmd - GE_CMD_MORPHWEIGHT0; - float weight = getFloat24(data); - return QString("MorphWeight %1 = %2").arg(index).arg(weight); - } - - case GE_CMD_DITH0: - case GE_CMD_DITH1: - case GE_CMD_DITH2: - case GE_CMD_DITH3: - return QString("DitherMatrix %1 = %2").arg(cmd-GE_CMD_DITH0).arg(data,6,16,QChar('0')); - - case GE_CMD_LOGICOP: - return QString("LogicOp: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_ZWRITEDISABLE: - return QString("ZMask: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_COLORTEST: - return QString("ColorTest: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_COLORREF: - return QString("ColorRef: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_COLORTESTMASK: - return QString( "ColorTestMask: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_MASKRGB: - return QString("MaskRGB: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_MASKALPHA: - return QString("MaskAlpha: %1").arg(data,6,16,QChar('0')); - - case GE_CMD_WORLDMATRIXNUMBER: - return QString("World # %1").arg(data & 0xF); - - case GE_CMD_WORLDMATRIXDATA: - return QString("World data # %1").arg(getFloat24(data)); - - case GE_CMD_VIEWMATRIXNUMBER: - return QString("VIEW # %1").arg(data & 0xF); - - case GE_CMD_VIEWMATRIXDATA: - return QString("VIEW data # %1").arg(getFloat24(data)); - - case GE_CMD_PROJMATRIXNUMBER: - return QString("PROJECTION # %1").arg(data & 0xF); - - case GE_CMD_PROJMATRIXDATA: - return QString("PROJECTION matrix data # %1").arg(getFloat24(data)); - - case GE_CMD_TGENMATRIXNUMBER: - return QString("TGEN # %1").arg(data & 0xF); - - case GE_CMD_TGENMATRIXDATA: - return QString("TGEN data # %1").arg(getFloat24(data)); - - case GE_CMD_BONEMATRIXNUMBER: - return QString("BONE #%1").arg(data); - - case GE_CMD_BONEMATRIXDATA: - return QString("BONE data #%1 %2").arg(state.boneMatrixNumber & 0x7f).arg(getFloat24(data)); - - default: - return QString("Unknown: %1").arg(op,8,16,QChar('0')); - } -} - - -void Debugger_DisplayList::FillDisplayListCmd(std::map& data, u32 pc, u32 prevAddr, GPUgstate& state) -{ - u32 curPc = pc; - int debugLimit = 10000; // Anti crash if this code is bugged - while(Memory::IsValidAddress(curPc) && debugLimit > 0) - { - if(data.find(curPc) != data.end()) - return; - - u32 op = Memory::ReadUnchecked_U32(curPc); //read from memory - u32 cmd = op >> 24; - u32 data_ = op & 0xFFFFFF; - u32 diff = op ^ gstate.cmdmem[cmd]; - state.cmdmem[cmd] = op; - u32 prevOp = 0; - if(Memory::IsValidAddress(prevAddr)) - Memory::ReadUnchecked_U32(prevAddr); - data[curPc].comment = DisassembleOp(curPc, op, prevOp, state); - data[curPc].addr = curPc; - data[curPc].cmd = cmd; - data[curPc].data = data_; - data[curPc].implementationNotFinished = false; - data[curPc].texAddr = (gstate.texaddr[0] & 0xFFFFF0) | ((gstate.texbufwidth[0]<<8) & 0x0F000000); - data[curPc].fboAddr = state.fbptr & 0xFFFFFF; - u32 baseExtended = ((state.base & 0x0F0000) << 8) | (state.vaddr & 0xFFFFFF); - data[curPc].vtxAddr = ((state.offsetAddr & 0xFFFFFF) + baseExtended) & 0x0FFFFFFF; - baseExtended = ((state.base & 0x0F0000) << 8) | (state.iaddr & 0xFFFFFF); - data[curPc].idxAddr = ((state.offsetAddr & 0xFFFFFF) + baseExtended) & 0x0FFFFFFF; - // Add or remove bugged functions for highlight - if(cmd == GE_CMD_BEZIER || - cmd == GE_CMD_SPLINE || - cmd == GE_CMD_BJUMP || - cmd == GE_CMD_BOUNDINGBOX) - { - data[curPc].implementationNotFinished = true; - } - - // We are drawing, save the GPU state for texture, vertex and index list - if(cmd == GE_CMD_PRIM || cmd == GE_CMD_BEZIER || cmd == GE_CMD_SPLINE) - { - drawGPUState.push_back(state); - } - - if(cmd == GE_CMD_JUMP) - { - u32 baseExtended = ((state.base & 0x0F0000) << 8) | (data_ & 0xFFFFFF); - u32 target = (((state.offsetAddr & 0xFFFFFF) << 8) + baseExtended) & 0x0FFFFFFF; - FillDisplayListCmd(data, target, prevAddr, state); - return; - } - else if(cmd == GE_CMD_CALL) - { - u32 baseExtended = ((state.base & 0x0F0000) << 8) | (data_ & 0xFFFFFF); - u32 target = (((state.offsetAddr & 0xFFFFFF) << 8) + baseExtended) & 0x0FFFFFFF; - FillDisplayListCmd(data, target, prevAddr, state); - } - else if(cmd == GE_CMD_RET) - { - return; - } - else if(cmd == GE_CMD_FINISH) - { - return; - } - else if(cmd == GE_CMD_END) - { - if(prevOp >> 24 == GE_CMD_FINISH) - return; - } - prevAddr = curPc; - curPc += 4; - debugLimit--; - } -} - -void Debugger_DisplayList::Update() -{ - if(!isVisible()) - return; - UpdateRenderBuffer(); - UpdateRenderBufferList(); - UpdateDisplayList(); -} - - -void Debugger_DisplayList::on_displayList_itemClicked(QTreeWidgetItem *item, int column) -{ - displayListRowSelected = item; - ShowDLCode(); -} - -void Debugger_DisplayList::on_stepBtn_clicked() -{ - ((QtHost*)host)->SetGPUStep(true); -} - -void Debugger_DisplayList::on_runBtn_clicked() -{ - ui->displayList->clear(); - ui->displayListData->clear(); - ((QtHost*)host)->SetGPUStep(false); -} - -void Debugger_DisplayList::on_stopBtn_clicked() -{ - ((QtHost*)host)->SetGPUStep(true); -} - -void Debugger_DisplayList::UpdateRenderBuffer() -{ - emit updateRenderBuffer_(); -} - -void Debugger_DisplayList::UpdateRenderBufferGUI() -{ - //gpu->Flush(); - - int FRAME_WIDTH; - int FRAME_HEIGHT; - u8 *data = 0; - int curTex; - glGetIntegerv(GL_TEXTURE_BINDING_2D, &curTex); - // TODO: GLES2 compatible -#ifndef USING_GLES2 - if(currentTextureDisplay == 0) - { - FRAME_WIDTH = pixel_xres; - FRAME_HEIGHT = pixel_yres; - data = new u8[FRAME_WIDTH * FRAME_HEIGHT * 4]; - memset(data,0,FRAME_WIDTH * FRAME_HEIGHT * 4); - if(currentRenderFrameDisplay == 0) - { - glReadBuffer(GL_COLOR_ATTACHMENT0); - glReadPixels(0, 0, FRAME_WIDTH, FRAME_HEIGHT, GL_BGRA, GL_UNSIGNED_BYTE, data); - } - else - { - glReadBuffer(GL_DEPTH_ATTACHMENT); - glReadPixels(0, 0, FRAME_WIDTH, FRAME_HEIGHT, GL_DEPTH_COMPONENT, GL_FLOAT, data); - } - } - else - { - draw_->GetFramebufferDimensions(currentTextureDisplay, &FRAME_WIDTH, &FRAME_HEIGHT); - data = new u8[FRAME_WIDTH * FRAME_HEIGHT * 4]; - memset(data,0,FRAME_WIDTH * FRAME_HEIGHT * 4); - if(currentRenderFrameDisplay == 0) - { - draw_->BindFramebufferAsTexture(currentTextureDisplay, 0, Draw::FB_COLOR_BIT, 0); - glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_BYTE, data); - } - } -#endif - glBindTexture(GL_TEXTURE_2D, curTex); - - QImage img = QImage(data, FRAME_WIDTH, FRAME_HEIGHT, FRAME_WIDTH*4, QImage::Format_ARGB32).mirrored(false,true); - QPixmap pixmap = QPixmap::fromImage(img); - ui->fboImg->setPixmap(pixmap); - ui->fboImg->setMinimumWidth(pixmap.width() * fboZoomFactor); - ui->fboImg->setMinimumHeight(pixmap.height() * fboZoomFactor); - ui->fboImg->setMaximumWidth(pixmap.width() * fboZoomFactor); - ui->fboImg->setMaximumHeight(pixmap.height() * fboZoomFactor); - - delete[] data; -} - -void Debugger_DisplayList::on_nextDrawBtn_clicked() -{ - ((QtHost*)host)->SetGPUStep(true, 1); -} - -void Debugger_DisplayList::on_gotoPCBtn_clicked() -{ - if(!displayListRowSelected) - return; - u32 currentPC = displayListRowSelected->data(3, Qt::UserRole).toInt(); - - for(int i = 0; i < ui->displayListData->topLevelItemCount(); i++) - { - if((u32)ui->displayListData->topLevelItem(i)->data(0, Qt::UserRole).toInt() == currentPC) - { - ui->displayListData->setCurrentItem(ui->displayListData->topLevelItem(i)); - } - } -} - -void Debugger_DisplayList::on_texturesList_itemDoubleClicked(QTreeWidgetItem *item, int column) -{ - mainWindow->GetDialogMemoryTex()->ShowTex(drawGPUState[item->data(0,Qt::UserRole).toInt()]); -} - -void Debugger_DisplayList::on_comboBox_currentIndexChanged(int index) -{ - currentRenderFrameDisplay = index; - UpdateRenderBufferGUI(); -} - -void Debugger_DisplayList::UpdateRenderBufferList() -{ - emit updateRenderBufferList_(); -} - -void Debugger_DisplayList::UpdateRenderBufferListGUI() -{ - ui->fboList->clear(); - - QTreeWidgetItem* item = new QTreeWidgetItem(); - item->setText(0,"Framebuffer"); - item->setData(0,Qt::UserRole, 0); - item->setText(1,QString::number(pixel_xres)); - item->setText(2,QString::number(pixel_yres)); - item->setText(3,QString::number(4)); - ui->fboList->addTopLevelItem(item); - - std::vector fboList = gpu->GetFramebufferList(); - - for(size_t i = 0; i < fboList.size(); i++) - { - QTreeWidgetItem* item = new QTreeWidgetItem(); - item->setText(0,QString("%1").arg(fboList[i].fb_address,8,16,QChar('0'))); - u64 addr = (u64)fboList[i].fbo; - item->setData(0,Qt::UserRole, addr); - item->setData(0,Qt::UserRole+1, fboList[i].fb_address); - item->setText(1,QString::number(fboList[i].width)); - item->setText(2,QString::number(fboList[i].height)); - item->setText(3,QString::number(fboList[i].format)); - - ui->fboList->addTopLevelItem(item); - } -} - -void Debugger_DisplayList::on_fboList_itemClicked(QTreeWidgetItem *item, int column) -{ - u64 addr = item->data(0,Qt::UserRole).toULongLong(); - Draw::Framebuffer * fbo = (Draw::Framebuffer *)addr; - currentTextureDisplay = fbo; - UpdateRenderBufferGUI(); -} - -void Debugger_DisplayList::on_nextDLBtn_clicked() -{ - ((QtHost*)host)->SetGPUStep(true,-1); -} - -void Debugger_DisplayList::setCurrentFBO(u32 addr) -{ - for(int i = 0; i < ui->fboList->topLevelItemCount(); i++) - { - if((u32)ui->fboList->topLevelItem(i)->data(0,Qt::UserRole+1).toInt() == addr) - { - for(int j = 0; j < ui->fboList->colorCount(); j++) - ui->fboList->topLevelItem(i)->setTextColor(j,Qt::green); - } - else - { - for(int j = 0; j < ui->fboList->colorCount(); j++) - ui->fboList->topLevelItem(i)->setTextColor(j,Qt::black); - } - } -} - -void Debugger_DisplayList::on_zoommBtn_clicked() -{ - fboZoomFactor *= 0.5; - ui->fboImg->setMinimumWidth(ui->fboImg->minimumWidth()*0.5); - ui->fboImg->setMinimumHeight(ui->fboImg->minimumHeight()*0.5); - ui->fboImg->setMaximumWidth(ui->fboImg->minimumWidth()*0.5); - ui->fboImg->setMaximumHeight(ui->fboImg->minimumHeight()*0.5); -} - -void Debugger_DisplayList::on_zoompBtn_clicked() -{ - fboZoomFactor *= 2; - ui->fboImg->setMinimumWidth(ui->fboImg->minimumWidth()*2); - ui->fboImg->setMinimumHeight(ui->fboImg->minimumHeight()*2); - ui->fboImg->setMaximumWidth(ui->fboImg->minimumWidth()*2); - ui->fboImg->setMaximumHeight(ui->fboImg->minimumHeight()*2); -} - -void Debugger_DisplayList::UpdateVertexInfo() -{ - //commented out until someone bothers to maintain it -#if 0 - ui->vertexData->clear(); - - QTreeWidgetItem* item = ui->vertexList->currentItem(); - if(item == 0) - return; - - GPUgstate state = drawGPUState[item->data(0,Qt::UserRole).toInt()]; - u32 baseExtended = ((state.base & 0x0F0000) << 8) | (state.vaddr & 0xFFFFFF); - u32 vaddr = ((state.offsetAddr & 0xFFFFFF) + baseExtended) & 0x0FFFFFFF; - - VertexDecoder vtcDec; - vtcDec.SetVertexType(state.vertType); - u8* tmp = new u8[20*vtcDec.GetDecVtxFmt().stride]; - vtcDec.DecodeVerts(tmp,Memory::GetPointer(vaddr),0,19); - VertexReader vtxRead(tmp,vtcDec.GetDecVtxFmt(),state.vertType); - - for(int i = 0; i < maxVtxDisplay; i++) - { - vtxRead.Goto(i); - QTreeWidgetItem* itemTop = new QTreeWidgetItem(); - itemTop->setText(0,QString::number(i)); - itemTop->setText(1,QString("%1").arg(vaddr+i*vtcDec.GetDecVtxFmt().stride,8,16,QChar('0'))); - ui->vertexData->addTopLevelItem(itemTop); - - if (vtxRead.hasNormal()) - { - float nrm[3]; - vtxRead.ReadNrm(nrm); - QTreeWidgetItem* item = new QTreeWidgetItem(); - item->setText(1,"Normal"); - item->setText(2,QString("X: %1, Y: %2, Z: %3").arg(nrm[0]).arg(nrm[1]).arg(nrm[2])); - itemTop->addChild(item); - } - if (vtxRead.hasUV()) { - float uv[2]; - vtxRead.ReadUV(uv); - QTreeWidgetItem* item = new QTreeWidgetItem(); - item->setText(1,"Uv"); - item->setText(2,QString("X: %1, Y: %2").arg(uv[0]).arg(uv[1])); - itemTop->addChild(item); - } - if (vtxRead.hasColor0()) { - float col0[4]; - vtxRead.ReadColor0(col0); - QTreeWidgetItem* item = new QTreeWidgetItem(); - item->setText(1,"Color0"); - item->setText(2,QString("X: %1, Y: %2, Z: %3").arg(col0[0]).arg(col0[1]).arg(col0[2])); - itemTop->addChild(item); - } - if (vtxRead.hasColor0()) { - float col1[3]; - vtxRead.ReadColor1(col1); - QTreeWidgetItem* item = new QTreeWidgetItem(); - item->setText(1,"Color1"); - item->setText(2,QString("X: %1, Y: %2, Z: %3").arg(col1[0]).arg(col1[1]).arg(col1[2])); - itemTop->addChild(item); - } - float pos[3]; - vtxRead.ReadPos(pos); - QTreeWidgetItem* item = new QTreeWidgetItem(); - item->setText(1,"Position"); - item->setText(2,QString("X: %1, Y: %2, Z: %3").arg(pos[0]).arg(pos[1]).arg(pos[2])); - itemTop->addChild(item); - } - delete [] tmp; - for(int i = 0; i < ui->vertexData->columnCount(); i++) - { - ui->vertexData->resizeColumnToContents(i); - } -#endif -} - -void Debugger_DisplayList::on_vertexList_itemClicked(QTreeWidgetItem *item, int column) -{ - UpdateVertexInfo(); -} - -void Debugger_DisplayList::on_pushButton_clicked() -{ - maxVtxDisplay += 20; - UpdateVertexInfo(); -} - - -void Debugger_DisplayList::UpdateIndexInfo() -{ - ui->indexData->clear(); - - QTreeWidgetItem* item = ui->indexList->currentItem(); - if(item == 0) - return; - - GPUgstate state = drawGPUState[item->data(0,Qt::UserRole).toInt()]; - u32 baseExtended = ((state.base & 0x0F0000) << 8) | (state.iaddr & 0xFFFFFF); - u32 iaddr = ((state.offsetAddr & 0xFFFFFF) + baseExtended) & 0x0FFFFFFF; - - int sizeIdx = 1; - if((state.vertType & GE_VTYPE_IDX_MASK) == GE_VTYPE_IDX_16BIT) - sizeIdx = 2; - - for(int i = 0; i < maxIdxDisplay; i++) - { - QTreeWidgetItem* itemTop = new QTreeWidgetItem(); - itemTop->setText(0,QString::number(i)); - itemTop->setText(1,QString("%1").arg(iaddr+i*sizeIdx,8,16,QChar('0'))); - int idx = 0; - if(sizeIdx == 1) - idx = Memory::Read_U8(iaddr+i*sizeIdx); - else - idx = Memory::Read_U16(iaddr+i*sizeIdx); - itemTop->setText(2,QString::number(idx)); - ui->indexData->addTopLevelItem(itemTop); - } - for(int i = 0; i < ui->indexData->columnCount(); i++) - { - ui->indexData->resizeColumnToContents(i); - } -} - - -void Debugger_DisplayList::on_nextIdx_clicked() -{ - maxIdxDisplay += 20; - UpdateIndexInfo(); -} - -void Debugger_DisplayList::on_indexList_itemClicked(QTreeWidgetItem *item, int column) -{ - UpdateIndexInfo(); -} - -void Debugger_DisplayList::on_displayListData_customContextMenuRequested(const QPoint &pos) -{ - QTreeWidgetItem* item = ui->displayListData->itemAt(pos); - if(!item) - return; - displayListDataSelected = item; - - QMenu menu(this); - - QAction *runToHere = new QAction(tr("Run to here"), this); - connect(runToHere, SIGNAL(triggered()), this, SLOT(RunToDLPC())); - menu.addAction(runToHere); - - menu.exec( ui->displayListData->mapToGlobal(pos)); -} - -void Debugger_DisplayList::RunToDLPC() -{ - u32 addr = displayListDataSelected->text(0).toUInt(0,16); - ((QtHost*)host)->SetGPUStep(true, 2, addr); -} - -void Debugger_DisplayList::on_texturesList_customContextMenuRequested(const QPoint &pos) -{ - QTreeWidgetItem* item = ui->texturesList->itemAt(pos); - if(!item) - return; - textureDataSelected = item; - - QMenu menu(this); - - QAction *runToDraw = new QAction(tr("Run to draw using this texture"), this); - connect(runToDraw, SIGNAL(triggered()), this, SLOT(RunToDrawTex())); - menu.addAction(runToDraw); - - menu.exec( ui->texturesList->mapToGlobal(pos)); -} - -void Debugger_DisplayList::RunToDrawTex() -{ - u32 addr = textureDataSelected->text(0).toUInt(0,16); - ((QtHost*)host)->SetGPUStep(true, 3, addr); -} diff --git a/Qt/Debugger/debugger_displaylist.h b/Qt/Debugger/debugger_displaylist.h deleted file mode 100644 index 2c88384269d9..000000000000 --- a/Qt/Debugger/debugger_displaylist.h +++ /dev/null @@ -1,104 +0,0 @@ -#pragma once - -#include "Core/Debugger/DebugInterface.h" - -#include -#include - -#include "GPU/GPUState.h" -#include "thin3d/thin3d.h" - -class MainWindow; -namespace Ui { -class Debugger_DisplayList; -} - - -class DListLine -{ -public: - u32 addr; - u32 cmd; - u32 data; - QString comment; - bool implementationNotFinished; - u32 texAddr; - u32 fboAddr; - u32 vtxAddr; - int vtxStart; - int vtxCount; - u32 idxAddr; - int idxStart; - int idxCount; -}; - -class Debugger_DisplayList : public QDialog -{ - Q_OBJECT - -public: - Debugger_DisplayList(DebugInterface *_cpu, Draw::DrawContext *draw, MainWindow *mainWindow_, QWidget *parent = 0); - ~Debugger_DisplayList(); - - void UpdateDisplayList(); - - void ShowDLCode(); - void FillDisplayListCmd(std::map &data, u32 pc, u32 prev, GPUgstate &state); - void Update(); - void UpdateRenderBuffer(); - void UpdateRenderBufferList(); - void UpdateVertexInfo(); - void UpdateIndexInfo(); - -signals: - void updateDisplayList_(); - void updateRenderBufferList_(); - void updateRenderBuffer_(); - -private slots: - void UpdateDisplayListGUI(); - void UpdateRenderBufferListGUI(); - void UpdateRenderBufferGUI(); - - void on_displayList_itemClicked(QTreeWidgetItem *item, int column); - void on_stepBtn_clicked(); - void on_runBtn_clicked(); - void on_stopBtn_clicked(); - void on_nextDrawBtn_clicked(); - void on_gotoPCBtn_clicked(); - void on_texturesList_itemDoubleClicked(QTreeWidgetItem *item, int column); - void on_comboBox_currentIndexChanged(int index); - void on_fboList_itemClicked(QTreeWidgetItem *item, int column); - void on_nextDLBtn_clicked(); - void setCurrentFBO(u32 addr); - void on_zoommBtn_clicked(); - void on_zoompBtn_clicked(); - void on_vertexList_itemClicked(QTreeWidgetItem *item, int column); - void on_pushButton_clicked(); - void on_nextIdx_clicked(); - void on_indexList_itemClicked(QTreeWidgetItem *item, int column); - void on_displayListData_customContextMenuRequested(const QPoint &pos); - void on_texturesList_customContextMenuRequested(const QPoint &pos); - void RunToDLPC(); - void RunToDrawTex(); - -private: - QString DisassembleOp(u32 pc, u32 op, u32 prev, const GPUgstate &state); - - Ui::Debugger_DisplayList *ui; - DebugInterface* cpu; - Draw::DrawContext* draw_; - MainWindow* mainWindow; - QTreeWidgetItem* displayListRowSelected; - QTreeWidgetItem* displayListDataSelected; - QTreeWidgetItem* textureDataSelected; - int currentRenderFrameDisplay; - Draw::Framebuffer *currentTextureDisplay; - float fboZoomFactor; - int maxVtxDisplay; - int maxIdxDisplay; - - std::vector drawGPUState; - std::map vtxBufferSize; - std::map idxBufferSize; -}; diff --git a/Qt/Debugger/debugger_displaylist.ui b/Qt/Debugger/debugger_displaylist.ui deleted file mode 100644 index 894a479ad2dd..000000000000 --- a/Qt/Debugger/debugger_displaylist.ui +++ /dev/null @@ -1,533 +0,0 @@ - - - Debugger_DisplayList - - - - 0 - 0 - 795 - 506 - - - - Dialog - - - - - - Qt::Horizontal - - - - Qt::Vertical - - - - DisplayList - - - - - - Qt::CustomContextMenu - - - false - - - false - - - false - - - 30 - - - - Id - - - - - Status - - - - - Start Address - - - - - Current Address - - - - - - - - - - Run - - - - - - - Stop - - - - - - - Next DL - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 0 - - - - Commands - - - - - - Qt::CustomContextMenu - - - false - - - false - - - false - - - 2 - - - false - - - - 1 - - - - - 2 - - - - - - - - - - Step - - - - - - - Next Draw - - - - - - - Goto PC - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Textures - - - - - - Qt::CustomContextMenu - - - - Address - - - - - Width - - - - - Height - - - - - Format - - - - - - - - - Vertex Buffer - - - - - - 30 - - - - Address - - - - - Coord Type - - - - - Number Morph - - - - - Number Weights - - - - - Has Weight - - - - - Has Position - - - - - Has Normal - - - - - Has Color - - - - - Has UV - - - - - - - - 30 - - - - Idx - - - - - Address - - - - - Values - - - - - - - - - - Next 20 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Index Buffer - - - - - - Qt::Vertical - - - - - Address - - - - - - 30 - - - - Idx - - - - - Adress - - - - - Value - - - - - - - - - - - Next 20 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - Framebuffer - - - - - - Qt::Vertical - - - - - 0 - 0 - - - - - VAddress - - - - - Width - - - - - Height - - - - - Format - - - - - - - 0 - 0 - - - - true - - - - - 0 - 0 - 375 - 76 - - - - - - - QFrame::Box - - - - - - true - - - - - - - - - - - - - - Display : - - - - - - - - Color - - - - - Depth - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Zoom- - - - - - - - Zoom+ - - - - - - - - - - - - - - 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/Debugger/debugger_memorytex.cpp b/Qt/Debugger/debugger_memorytex.cpp deleted file mode 100644 index 238c1371af0f..000000000000 --- a/Qt/Debugger/debugger_memorytex.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "debugger_memorytex.h" -#include "gfx/gl_common.h" -#include "ui_debugger_memorytex.h" -#include "Core/MemMap.h" -#include -#include -#include "Core/HLE/sceDisplay.h" -#include "GPU/GPUInterface.h" -#include "base/display.h" - -Debugger_MemoryTex::Debugger_MemoryTex(QWidget *parent) : - QDialog(parent), - ui(new Ui::Debugger_MemoryTex) -{ - ui->setupUi(this); -} - -Debugger_MemoryTex::~Debugger_MemoryTex() -{ - delete ui; -} - -void Debugger_MemoryTex::ShowTex(const GPUgstate &state) -{ - ui->texaddr->setText(QString("%1").arg(state.texaddr[0] & 0xFFFFFF,8,16,QChar('0'))); - ui->texbufwidth0->setText(QString("%1").arg(state.texbufwidth[0] & 0xFFFFFF,8,16,QChar('0'))); - ui->texformat->setText(QString("%1").arg(state.texformat & 0xFFFFFF,8,16,QChar('0'))); - ui->texsize->setText(QString("%1").arg(state.texsize[0] & 0xFFFFFF,8,16,QChar('0'))); - ui->texmode->setText(QString("%1").arg(state.texmode & 0xFFFFFF,8,16,QChar('0'))); - ui->clutformat->setText(QString("%1").arg(state.clutformat & 0xFFFFFF,8,16,QChar('0'))); - ui->clutaddr->setText(QString("%1").arg(state.clutaddr & 0xFFFFFF,8,16,QChar('0'))); - ui->clutaddrupper->setText(QString("%1").arg(state.clutaddrupper & 0xFFFFFF,8,16,QChar('0'))); - ui->loadclut->setText(QString("%1").arg(state.loadclut & 0xFFFFFF,8,16,QChar('0'))); - on_readBtn_clicked(); - - show(); -} - -void Debugger_MemoryTex::on_readBtn_clicked() -{ - GPUgstate state; - state.texaddr[0] = ui->texaddr->text().toUInt(0,16); - state.texbufwidth[0] = ui->texbufwidth0->text().toUInt(0,16); - state.texformat = ui->texformat->text().toUInt(0,16); - state.texsize[0] = ui->texsize->text().toUInt(0,16); - state.texmode = ui->texmode->text().toUInt(0,16); - state.clutformat = ui->clutformat->text().toUInt(0,16); - state.clutaddr = ui->clutaddr->text().toUInt(0,16); - state.clutaddrupper = ui->clutaddrupper->text().toUInt(0,16); - state.loadclut = ui->loadclut->text().toUInt(0,16); - int bufW = state.texbufwidth[0] & 0x3ff; - int w = 1 << (state.texsize[0] & 0xf); - int h = 1 << ((state.texsize[0]>>8) & 0xf); - w = std::max(bufW,w); - uchar* newData = new uchar[w*h*4]; - - // TODO: Use GPU_GetCurrentTexture(). Warning: blocks. - - delete[] newData; -} diff --git a/Qt/Debugger/debugger_memorytex.h b/Qt/Debugger/debugger_memorytex.h deleted file mode 100644 index a39d3ed53b1d..000000000000 --- a/Qt/Debugger/debugger_memorytex.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef DEBUGGER_MEMORYTEX_H -#define DEBUGGER_MEMORYTEX_H - -#include -#include "GPU/GPUState.h" - -namespace Ui { -class Debugger_MemoryTex; -} - -class Debugger_MemoryTex : public QDialog -{ - Q_OBJECT - -public: - explicit Debugger_MemoryTex(QWidget *parent = 0); - ~Debugger_MemoryTex(); - - void ShowTex(const GPUgstate& state); -private slots: - void on_readBtn_clicked(); - -private: - Ui::Debugger_MemoryTex *ui; -}; - -#endif // DEBUGGER_MEMORYTEX_H diff --git a/Qt/Debugger/debugger_memorytex.ui b/Qt/Debugger/debugger_memorytex.ui deleted file mode 100644 index b16301022215..000000000000 --- a/Qt/Debugger/debugger_memorytex.ui +++ /dev/null @@ -1,177 +0,0 @@ - - - Debugger_MemoryTex - - - - 0 - 0 - 768 - 546 - - - - Dialog - - - - - - Qt::Horizontal - - - - - - - - - TexAddr - - - - - - - TexBufWidth0 - - - - - - - TexFormat - - - - - - - TexSize - - - - - - - ClutFormat - - - - - - - ClutAddr - - - - - - - ClutAddrUpper - - - - - - - LoadClut - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TexMode - - - - - - - - - - - - - - Read - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - true - - - - - 0 - 0 - 76 - 526 - - - - - - - QFrame::Box - - - - - - - - - - - - - - - - diff --git a/Qt/Debugger/debugger_vfpu.cpp b/Qt/Debugger/debugger_vfpu.cpp deleted file mode 100644 index af10c2e0583e..000000000000 --- a/Qt/Debugger/debugger_vfpu.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "debugger_vfpu.h" -#include "ui_debugger_vfpu.h" -#include "mainwindow.h" -#include - -Debugger_VFPU::Debugger_VFPU(DebugInterface *_cpu, MainWindow* mainWindow_, QWidget *parent) : - QDialog(parent), - ui(new Ui::Debugger_VFPU), - cpu(_cpu), - mainWindow(mainWindow_) -{ - ui->setupUi(this); - - setWindowTitle(QString("VFPU - %1").arg(cpu->GetName())); - - ui->vfpu->setCPU(_cpu); -} - -Debugger_VFPU::~Debugger_VFPU() -{ - delete ui; -} - -void Debugger_VFPU::Update() -{ - ui->vfpu->redraw(); -} - -void Debugger_VFPU::Goto(u32 addr) -{ - show(); - mainWindow->GetDialogMemory()->Goto(addr & ~3); -} - -void Debugger_VFPU::on_comboBox_currentIndexChanged(int index) -{ - ui->vfpu->setMode(index); -} diff --git a/Qt/Debugger/debugger_vfpu.h b/Qt/Debugger/debugger_vfpu.h deleted file mode 100644 index e14fc737130d..000000000000 --- a/Qt/Debugger/debugger_vfpu.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef DEBUGGER_VFPU_H -#define DEBUGGER_VFPU_H - -#include "Core/Debugger/DebugInterface.h" -#include - -class MainWindow; -namespace Ui { -class Debugger_VFPU; -} - -class Debugger_VFPU : public QDialog -{ - Q_OBJECT - -public: - explicit Debugger_VFPU(DebugInterface *_cpu, MainWindow *mainWindow_, QWidget *parent = 0); - ~Debugger_VFPU(); - - void Update(); - void Goto(u32 addr); -private slots: - void on_comboBox_currentIndexChanged(int index); - -private: - Ui::Debugger_VFPU *ui; - DebugInterface* cpu; - MainWindow* mainWindow; -}; - -#endif // DEBUGGER_VFPU_H diff --git a/Qt/Debugger/debugger_vfpu.ui b/Qt/Debugger/debugger_vfpu.ui deleted file mode 100644 index acf1f04dba11..000000000000 --- a/Qt/Debugger/debugger_vfpu.ui +++ /dev/null @@ -1,87 +0,0 @@ - - - Debugger_VFPU - - - - 0 - 0 - 400 - 300 - - - - VFPU - - - - - - - - - Float - - - - - HalfFloat - - - - - Hex - - - - - Bytes - - - - - Shorts - - - - - Ints - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::StrongFocus - - - - - - - - CtrlVfpuView - QWidget -
ctrlvfpuview.h
- 1 -
-
- - -
diff --git a/Qt/QtHost.h b/Qt/QtHost.h index 2df6155bb0bd..fbad0aa7eaac 100644 --- a/Qt/QtHost.h +++ b/Qt/QtHost.h @@ -28,8 +28,6 @@ class QtHost : public Host { QtHost(MainWindow *mainWindow_) { mainWindow = mainWindow_; - m_GPUStep = false; - m_GPUFlag = 0; } virtual void UpdateUI() override { @@ -37,19 +35,12 @@ class QtHost : public Host { } virtual void UpdateMemView() override { - if(mainWindow->GetDialogMemory()) - mainWindow->GetDialogMemory()->Update(); } virtual void UpdateDisassembly() override { - if(mainWindow->GetDialogDisasm()) - mainWindow->GetDialogDisasm()->Update(); - if(mainWindow->GetDialogDisplaylist()) - mainWindow->GetDialogDisplaylist()->Update(); + mainWindow->updateMenus(); } virtual void SetDebugMode(bool mode) override { - if(mainWindow->GetDialogDisasm()) - mainWindow->GetDialogDisasm()->SetDebugMode(mode); } virtual bool InitGraphics(std::string *error_message, GraphicsContext **ctx) override { return true; } @@ -100,24 +91,9 @@ class QtHost : public Host { } bool GPUDebuggingActive() override { - auto dialogDisplayList = mainWindow->GetDialogDisplaylist(); - if (dialogDisplayList && dialogDisplayList->isVisible()) { - if (m_GPUStep && m_GPUFlag == -1) - m_GPUFlag = 0; - - return true; - } return false; } - void SetGPUStep(bool value, int flag = 0, u32 data = 0) { - m_GPUStep = value; - m_GPUFlag = flag; - m_GPUData = data; - } private: const char* SymbolMapFilename(std::string currentFilename); MainWindow* mainWindow; - bool m_GPUStep; - int m_GPUFlag; - u32 m_GPUData; }; diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 116b7f084ad8..904edc60952d 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -20,11 +20,7 @@ MainWindow::MainWindow(QWidget *parent, bool fullscreen) : QMainWindow(parent), currentLanguage("en"), nextState(CORE_POWERDOWN), - lastUIState(UISTATE_MENU), - dialogDisasm(0), - memoryWindow(0), - memoryTexWindow(0), - displaylistWindow(0) + lastUIState(UISTATE_MENU) { QDesktopWidget *desktop = QApplication::desktop(); int screenNum = QProcessEnvironment::systemEnvironment().value("SDL_VIDEO_FULLSCREEN_HEAD", "0").toInt(); @@ -49,12 +45,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; @@ -145,19 +135,9 @@ void MainWindow::updateMenus() void MainWindow::bootDone() { - dialogDisasm = new Debugger_Disasm(currentDebugMIPS, this, this); - if(g_Config.bShowDebuggerOnLoad) - dialogDisasm->show(); - if(g_Config.bFullScreen != isFullScreen()) fullscrAct(); - memoryWindow = new Debugger_Memory(currentDebugMIPS, this, this); - memoryTexWindow = new Debugger_MemoryTex(this); - displaylistWindow = new Debugger_DisplayList(currentDebugMIPS, gpu->GetDrawContext(), this, this); - - notifyMapsLoaded(); - if (nextState == CORE_RUNNING) runAct(); updateMenus(); @@ -177,17 +157,7 @@ void MainWindow::openAct() void MainWindow::closeAct() { - if(dialogDisasm) - dialogDisasm->Stop(); - - if(dialogDisasm && dialogDisasm->isVisible()) - dialogDisasm->close(); - if(memoryWindow && memoryWindow->isVisible()) - memoryWindow->close(); - if(memoryTexWindow && memoryTexWindow->isVisible()) - memoryTexWindow->close(); - if(displaylistWindow && displaylistWindow->isVisible()) - displaylistWindow->close(); + updateMenus(); NativeMessageReceived("stop", ""); SetGameTitle(""); @@ -266,17 +236,7 @@ void MainWindow::pauseAct() void MainWindow::resetAct() { - if(dialogDisasm) - dialogDisasm->Stop(); - - if(dialogDisasm) - dialogDisasm->close(); - if(memoryWindow) - memoryWindow->close(); - if(memoryTexWindow) - memoryTexWindow->close(); - if(displaylistWindow) - displaylistWindow->close(); + updateMenus(); NativeMessageReceived("reset", ""); } @@ -302,7 +262,6 @@ void MainWindow::lmapAct() { QString fileName = QFileInfo(fileNames[0]).absoluteFilePath(); g_symbolMap->LoadSymbolMap(fileName.toStdString().c_str()); - notifyMapsLoaded(); } } @@ -325,7 +284,6 @@ void MainWindow::smapAct() void MainWindow::resetTableAct() { g_symbolMap->Clear(); - notifyMapsLoaded(); } void MainWindow::dumpNextAct() @@ -333,38 +291,13 @@ void MainWindow::dumpNextAct() gpu->DumpNextFrame(); } -void MainWindow::disasmAct() -{ - if(dialogDisasm) - dialogDisasm->show(); -} - -void MainWindow::dpyListAct() -{ - if(displaylistWindow) - displaylistWindow->show(); -} - void MainWindow::consoleAct() { LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden()); } -void MainWindow::memviewAct() -{ - if (memoryWindow) - memoryWindow->show(); -} - -void MainWindow::memviewTexAct() -{ - if(memoryTexWindow) - memoryTexWindow->show(); -} - void MainWindow::raiseTopMost() { - setWindowState( (windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); raise(); activateWindow(); @@ -537,17 +470,8 @@ void MainWindow::createMenus() debugMenu->add(new MenuAction(this, SLOT(takeScreen()), QT_TR_NOOP("Take Screenshot"), Qt::Key_F12)) ->addDisableState(UISTATE_MENU); debugMenu->addSeparator(); - debugMenu->add(new MenuAction(this, SLOT(disasmAct()), QT_TR_NOOP("Disassembly"), Qt::CTRL + Qt::Key_D)) - ->addDisableState(UISTATE_MENU); - //commented out until someone bothers to maintain it - //debugMenu->add(new MenuAction(this, SLOT(dpyListAct()), QT_TR_NOOP("Display List..."))) - // ->addDisableState(UISTATE_MENU); 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); // Options MenuTree* optionsMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Options")); @@ -668,11 +592,3 @@ void MainWindow::createMenus() retranslate(); } - -void MainWindow::notifyMapsLoaded() -{ - if (dialogDisasm) - dialogDisasm->NotifyMapLoaded(); - if (memoryWindow) - memoryWindow->NotifyMapLoaded(); -} diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index ba2d3ff7dc1d..57d24acce139 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -12,10 +12,6 @@ #include "Core/Core.h" #include "Core/Config.h" #include "Core/System.h" -#include "Debugger/debugger_disasm.h" -#include "Debugger/debugger_memory.h" -#include "Debugger/debugger_memorytex.h" -#include "Debugger/debugger_displaylist.h" #include "Qt/QtMain.h" extern bool g_TakeScreenshot; @@ -37,13 +33,8 @@ class MainWindow : public QMainWindow explicit MainWindow(QWidget *parent = 0, bool fullscreen=false); ~MainWindow() { }; - Debugger_Disasm* GetDialogDisasm() { return dialogDisasm; } - Debugger_Memory* GetDialogMemory() { return memoryWindow; } - Debugger_MemoryTex* GetDialogMemoryTex() { return memoryTexWindow; } - Debugger_DisplayList* GetDialogDisplaylist() { return displaylistWindow; } CoreState GetNextState() { return nextState; } - void ShowMemory(u32 addr); void updateMenus(); void Notify(MainWindowMsg msg) { @@ -97,11 +88,7 @@ private slots: void resetTableAct(); void dumpNextAct(); void takeScreen() { g_TakeScreenshot = true; } - void disasmAct(); - void dpyListAct(); void consoleAct(); - void memviewAct(); - void memviewTexAct(); // Options // Core @@ -159,7 +146,6 @@ private slots: void SetGameTitle(QString text); void loadLanguage(const QString &language, bool retranslate); void createMenus(); - void notifyMapsLoaded(); QTranslator translator; QString currentLanguage; @@ -167,11 +153,6 @@ private slots: CoreState nextState; GlobalUIState lastUIState; - Debugger_Disasm *dialogDisasm; - Debugger_Memory *memoryWindow; - Debugger_MemoryTex *memoryTexWindow; - Debugger_DisplayList *displaylistWindow; - QActionGroup *anisotropicGroup, *screenGroup, *displayLayoutGroup, *defaultLogGroup, *g3dLogGroup, *hleLogGroup; diff --git a/Windows/PPSSPP.vcxproj b/Windows/PPSSPP.vcxproj index 9e95c6a1b87d..7fa9fc452568 100644 --- a/Windows/PPSSPP.vcxproj +++ b/Windows/PPSSPP.vcxproj @@ -1,4 +1,4 @@ - + @@ -341,60 +341,6 @@ - - true - true - true - true - - - true - true - true - true - - - true - true - true - true - - - true - true - true - true - - - true - true - true - true - - - true - true - true - true - - - true - true - true - true - - - true - true - true - true - - - true - true - true - true - true true @@ -494,15 +440,6 @@ - - - - - - - - - @@ -562,11 +499,6 @@ - - - - - @@ -627,4 +559,4 @@ - \ No newline at end of file + diff --git a/Windows/PPSSPP.vcxproj.filters b/Windows/PPSSPP.vcxproj.filters index 8cce6b63ecb1..8cfb5cdbb31a 100644 --- a/Windows/PPSSPP.vcxproj.filters +++ b/Windows/PPSSPP.vcxproj.filters @@ -1,4 +1,4 @@ - + @@ -161,33 +161,6 @@ Other Platforms\Qt - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - Windows\System @@ -341,30 +314,6 @@ Other Platforms\Qt\Debugger - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - Windows\System @@ -468,21 +417,6 @@ Other Platforms\Qt - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - - - Other Platforms\Qt\Debugger - @@ -494,4 +428,4 @@ Resource Files - \ No newline at end of file +