Add 2 step mode for display list : Go to selected line and go to next draw using selected texture

This commit is contained in:
Xele02 2013-02-17 18:25:43 +01:00
parent 6339c2fc9a
commit 0fefca672d
7 changed files with 88 additions and 8 deletions

View File

@ -65,8 +65,8 @@ public:
virtual bool GpuStep() { return false; }
virtual void SendGPUStart() {}
virtual void SendGPUWait(u32 cmd) {}
virtual void SetGPUStep(bool value, int flag = 0) {}
virtual void SendGPUWait(u32 cmd, u32 addr, void* data) {}
virtual void SetGPUStep(bool value, int flag = 0, int data = 0) {}
virtual void NextGPUStep() {}
// Used for headless.

View File

@ -98,7 +98,7 @@ bool GPUCommon::InterpretList(DisplayList &list)
#if defined(USING_QT_UI)
if(host->GpuStep())
{
host->SendGPUWait(cmd);
host->SendGPUWait(cmd, list.pc, &gstate);
}
#endif
u32 diff = op ^ gstate.cmdmem[cmd];

View File

@ -28,6 +28,7 @@ recursive_mutex m_hGPUStepMutex;
QtHost::QtHost(MainWindow *mainWindow_)
: mainWindow(mainWindow_)
, m_GPUStep(false)
, m_GPUFlag(0)
{
QObject::connect(this,SIGNAL(BootDoneSignal()),mainWindow,SLOT(Boot()));
}
@ -162,7 +163,7 @@ void QtHost::SendGPUStart()
EmuThread_LockDraw(true);
}
void QtHost::SendGPUWait(u32 cmd)
void QtHost::SendGPUWait(u32 cmd, u32 addr, void *data)
{
EmuThread_LockDraw(false);
@ -173,19 +174,36 @@ void QtHost::SendGPUWait(u32 cmd)
}
else if(m_GPUFlag == 0)
{
mainWindow->GetDialogDisasm()->UpdateDisplayList();
mainWindow->GetDialogDisplaylist()->Update();
m_hGPUStepEvent.wait(m_hGPUStepMutex);
}
else if(m_GPUFlag == 2 && addr == m_GPUData)
{
mainWindow->GetDialogDisasm()->UpdateDisplayList();
mainWindow->GetDialogDisplaylist()->Update();
m_hGPUStepEvent.wait(m_hGPUStepMutex);
}
else if(m_GPUFlag == 3 && (cmd == GE_CMD_PRIM || cmd == GE_CMD_BEZIER || cmd == GE_CMD_SPLINE))
{
GPUgstate *state = (GPUgstate*)data;
u32 texAddr = (state->texaddr[0] & 0xFFFFF0) | ((state->texbufwidth[0]<<8) & 0x0F000000);
if(texAddr == m_GPUData)
{
mainWindow->GetDialogDisasm()->UpdateDisplayList();
mainWindow->GetDialogDisplaylist()->Update();
m_hGPUStepEvent.wait(m_hGPUStepMutex);
}
}
EmuThread_LockDraw(true);
}
void QtHost::SetGPUStep(bool value, int flag)
void QtHost::SetGPUStep(bool value, int flag, int data)
{
m_GPUStep = value;
m_GPUFlag = flag;
m_GPUData = data;
}
void QtHost::NextGPUStep()

View File

@ -51,9 +51,9 @@ public:
void SendCoreWait(bool);
bool GpuStep();
void SendGPUWait(u32 cmd);
void SendGPUWait(u32 cmd, u32 addr, void* data);
void SendGPUStart();
void SetGPUStep(bool value, int flag = 0);
void SetGPUStep(bool value, int flag = 0, int data = 0);
void NextGPUStep();
signals:
@ -62,6 +62,7 @@ private:
MainWindow* mainWindow;
bool m_GPUStep;
int m_GPUFlag;
int m_GPUData;
};
#endif // QTAPP_H

View File

@ -2,6 +2,7 @@
#include <QTimer>
#include <set>
#include <QMenu>
#include "Core/CPU.h"
#include "ui_debugger_displaylist.h"
@ -1518,3 +1519,49 @@ void Debugger_DisplayList::on_indexList_itemClicked(QTreeWidgetItem *item, int c
{
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).toInt(0,16);
host->SetGPUStep(true, 2, addr);
host->NextGPUStep();
}
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).toInt(0,16);
host->SetGPUStep(true, 3, addr);
host->NextGPUStep();
}

View File

@ -93,6 +93,12 @@ private slots:
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);
@ -100,6 +106,8 @@ private:
DebugInterface* cpu;
MainWindow* mainWindow;
QTreeWidgetItem* displayListRowSelected;
QTreeWidgetItem* displayListDataSelected;
QTreeWidgetItem* textureDataSelected;
int currentRenderFrameDisplay;
FBO* currentTextureDisplay;
float fboZoomFactor;

View File

@ -118,6 +118,9 @@
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTreeWidget" name="displayListData">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
@ -192,6 +195,9 @@
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTreeWidget" name="texturesList">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<column>
<property name="text">
<string>Address</string>