Add displayList debug dialog

This commit is contained in:
Xele02 2013-02-17 01:06:06 +01:00
parent 976b440781
commit 2a6af9b8a3
31 changed files with 2950 additions and 250 deletions

View File

@ -100,6 +100,8 @@ reswitch:
case CORE_STEPPING:
//1: wait for step command..
#if defined(USING_QT_UI) || defined(_DEBUG)
host->UpdateDisassembly();
host->UpdateMemView();
host->SendCoreWait(true);
#endif

View File

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

View File

@ -1056,6 +1056,11 @@ void GLES_GPU::Resized() {
framebufferManager_.Resized();
}
std::vector<FramebufferInfo> GLES_GPU::GetFramebufferList()
{
return framebufferManager_.GetFramebufferList();
}
void GLES_GPU::DoState(PointerWrap &p) {
GPUCommon::DoState(p);

View File

@ -59,6 +59,13 @@ public:
// Called by the window system if the window size changed. This will be reflected in PSPCoreParam.pixel*.
virtual void Resized();
virtual bool DecodeTexture(u8* dest, GPUgstate state)
{
return textureCache_.DecodeTexture(dest, state);
}
std::vector<FramebufferInfo> GetFramebufferList();
private:
void DoBlockTransfer();

View File

@ -449,6 +449,26 @@ void FramebufferManager::SetDisplayFramebuffer(u32 framebuf, u32 stride, int for
}
}
std::vector<FramebufferInfo> FramebufferManager::GetFramebufferList()
{
std::vector<FramebufferInfo> list;
for (auto iter = vfbs_.begin(); iter != vfbs_.end(); ++iter) {
VirtualFramebuffer *vfb = *iter;
FramebufferInfo info;
info.fb_address = vfb->fb_address;
info.z_address = vfb->z_address;
info.format = vfb->format;
info.width = vfb->width;
info.height = vfb->height;
info.fbo = vfb->fbo;
list.push_back(info);
}
return list;
}
void FramebufferManager::DecimateFBOs() {
for (auto iter = vfbs_.begin(); iter != vfbs_.end();) {
VirtualFramebuffer *vfb = *iter;

View File

@ -26,6 +26,7 @@
#include "../Globals.h"
#include "GPU/GPUCommon.h"
struct GLSLProgram;
class TextureCache;
@ -80,6 +81,8 @@ public:
void SetDisplayFramebuffer(u32 framebuf, u32 stride, int format);
size_t NumVFBs() const { return vfbs_.size(); }
std::vector<FramebufferInfo> GetFramebufferList();
int GetRenderWidth() const { return currentRenderVfb_ ? currentRenderVfb_->renderWidth : 480; }
int GetRenderHeight() const { return currentRenderVfb_ ? currentRenderVfb_->renderHeight : 272; }
int GetTargetWidth() const { return currentRenderVfb_ ? currentRenderVfb_->width : 480; }

View File

@ -1131,3 +1131,291 @@ void TextureCache::LoadTextureLevel(TexCacheEntry &entry, int level)
GLuint components = dstFmt == GL_UNSIGNED_SHORT_5_6_5 ? GL_RGB : GL_RGBA;
glTexImage2D(GL_TEXTURE_2D, level, components, w, h, 0, components, dstFmt, finalBuf);
}
bool TextureCache::DecodeTexture(u8* output, GPUgstate state)
{
GPUgstate oldState = gstate;
gstate = state;
u32 texaddr = (gstate.texaddr[0] & 0xFFFFF0) | ((gstate.texbufwidth[0]<<8) & 0x0F000000);
if (!Memory::IsValidAddress(texaddr)) {
return false;
}
u8 level = 0;
u32 format = gstate.texformat & 0xF;
if (format >= 11) {
ERROR_LOG(G3D, "Unknown texture format %i", format);
format = 0;
}
u32 clutformat = gstate.clutformat & 3;
u32 clutaddr = GetClutAddr(clutformat == GE_CMODE_32BIT_ABGR8888 ? 4 : 2);
const u8 *texptr = Memory::GetPointer(texaddr);
u32 texhash = texptr ? MiniHash((const u32*)texptr) : 0;
u64 cachekey = texaddr ^ texhash;
if (formatUsesClut[format])
cachekey |= (u64) clutaddr << 32;
int bufw = gstate.texbufwidth[0] & 0x3ff;
int w = 1 << (gstate.texsize[0] & 0xf);
int h = 1 << ((gstate.texsize[0]>>8) & 0xf);
GLenum dstFmt = 0;
u32 texByteAlign = 1;
void *finalBuf = NULL;
// TODO: Look into using BGRA for 32-bit textures when the GL_EXT_texture_format_BGRA8888 extension is available, as it's faster than RGBA on some chips.
// TODO: Actually decode the mipmaps.
switch (format)
{
case GE_TFMT_CLUT4:
dstFmt = getClutDestFormat((GEPaletteFormat)(gstate.clutformat & 3));
switch (clutformat) {
case GE_CMODE_16BIT_BGR5650:
case GE_CMODE_16BIT_ABGR5551:
case GE_CMODE_16BIT_ABGR4444:
{
ReadClut16(clutBuf16);
const u16 *clut = clutBuf16;
u32 clutSharingOff = 0;//gstate.mipmapShareClut ? 0 : level * 16;
texByteAlign = 2;
if (!(gstate.texmode & 1)) {
const u8 *addr = Memory::GetPointer(texaddr);
for (int i = 0; i < bufw * h; i += 2)
{
u8 index = *addr++;
tmpTexBuf16[i + 0] = clut[GetClutIndex((index >> 0) & 0xf) + clutSharingOff];
tmpTexBuf16[i + 1] = clut[GetClutIndex((index >> 4) & 0xf) + clutSharingOff];
}
} else {
UnswizzleFromMem(texaddr, 0, level);
for (int i = 0, j = 0; i < bufw * h; i += 8, j++)
{
u32 n = tmpTexBuf32[j];
u32 k, index;
for (k = 0; k < 8; k++) {
index = (n >> (k * 4)) & 0xf;
tmpTexBuf16[i + k] = clut[GetClutIndex(index) + clutSharingOff];
}
}
}
finalBuf = tmpTexBuf16;
}
break;
case GE_CMODE_32BIT_ABGR8888:
{
ReadClut32(clutBuf32);
const u32 *clut = clutBuf32;
u32 clutSharingOff = 0;//gstate.mipmapShareClut ? 0 : level * 16;
if (!(gstate.texmode & 1)) {
const u8 *addr = Memory::GetPointer(texaddr);
for (int i = 0; i < bufw * h; i += 2)
{
u8 index = *addr++;
tmpTexBuf32[i + 0] = clut[GetClutIndex((index >> 0) & 0xf) + clutSharingOff];
tmpTexBuf32[i + 1] = clut[GetClutIndex((index >> 4) & 0xf) + clutSharingOff];
}
} else {
u32 pixels = bufw * h;
UnswizzleFromMem(texaddr, 0, level);
for (int i = pixels - 8, j = (pixels / 8) - 1; i >= 0; i -= 8, j--) {
u32 n = tmpTexBuf32[j];
for (int k = 0; k < 8; k++) {
u32 index = (n >> (k * 4)) & 0xf;
tmpTexBuf32[i + k] = clut[GetClutIndex(index) + clutSharingOff];
}
}
}
finalBuf = tmpTexBuf32;
}
break;
default:
ERROR_LOG(G3D, "Unknown CLUT4 texture mode %d", (gstate.clutformat & 3));
return false;
}
break;
case GE_TFMT_CLUT8:
finalBuf = readIndexedTex(level, texaddr, 1);
dstFmt = getClutDestFormat((GEPaletteFormat)(gstate.clutformat & 3));
texByteAlign = texByteAlignMap[(gstate.clutformat & 3)];
break;
case GE_TFMT_CLUT16:
finalBuf = readIndexedTex(level, texaddr, 2);
dstFmt = getClutDestFormat((GEPaletteFormat)(gstate.clutformat & 3));
texByteAlign = texByteAlignMap[(gstate.clutformat & 3)];
break;
case GE_TFMT_CLUT32:
finalBuf = readIndexedTex(level, texaddr, 4);
dstFmt = getClutDestFormat((GEPaletteFormat)(gstate.clutformat & 3));
texByteAlign = texByteAlignMap[(gstate.clutformat & 3)];
break;
case GE_TFMT_4444:
case GE_TFMT_5551:
case GE_TFMT_5650:
if (format == GE_TFMT_4444)
dstFmt = GL_UNSIGNED_SHORT_4_4_4_4;
else if (format == GE_TFMT_5551)
dstFmt = GL_UNSIGNED_SHORT_5_5_5_1;
else if (format == GE_TFMT_5650)
dstFmt = GL_UNSIGNED_SHORT_5_6_5;
texByteAlign = 2;
if (!(gstate.texmode & 1)) {
int len = std::max(bufw, w) * h;
for (int i = 0; i < len; i++)
tmpTexBuf16[i] = Memory::ReadUnchecked_U16(texaddr + i * 2);
finalBuf = tmpTexBuf16;
}
else
finalBuf = UnswizzleFromMem(texaddr, 2, level);
break;
case GE_TFMT_8888:
dstFmt = GL_UNSIGNED_BYTE;
if (!(gstate.texmode & 1)) {
int len = bufw * h;
for (int i = 0; i < len; i++)
tmpTexBuf32[i] = Memory::ReadUnchecked_U32(texaddr + i * 4);
finalBuf = tmpTexBuf32;
}
else
finalBuf = UnswizzleFromMem(texaddr, 4, level);
break;
case GE_TFMT_DXT1:
dstFmt = GL_UNSIGNED_BYTE;
{
u32 *dst = tmpTexBuf32;
DXT1Block *src = (DXT1Block*)texptr;
for (int y = 0; y < h; y += 4) {
u32 blockIndex = (y / 4) * (bufw / 4);
for (int x = 0; x < std::min(bufw, w); x += 4) {
decodeDXT1Block(dst + bufw * y + x, src + blockIndex, bufw);
blockIndex++;
}
}
finalBuf = tmpTexBuf32;
w = (w + 3) & ~3;
}
break;
case GE_TFMT_DXT3:
dstFmt = GL_UNSIGNED_BYTE;
{
u32 *dst = tmpTexBuf32;
DXT3Block *src = (DXT3Block*)texptr;
// Alpha is off
for (int y = 0; y < h; y += 4) {
u32 blockIndex = (y / 4) * (bufw / 4);
for (int x = 0; x < std::min(bufw, w); x += 4) {
decodeDXT3Block(dst + bufw * y + x, src + blockIndex, bufw);
blockIndex++;
}
}
w = (w + 3) & ~3;
finalBuf = tmpTexBuf32;
}
break;
case GE_TFMT_DXT5:
ERROR_LOG(G3D, "Unhandled compressed texture, format %i! swizzle=%i", format, gstate.texmode & 1);
dstFmt = GL_UNSIGNED_BYTE;
{
u32 *dst = tmpTexBuf32;
DXT5Block *src = (DXT5Block*)texptr;
// Alpha is almost right
for (int y = 0; y < h; y += 4) {
u32 blockIndex = (y / 4) * (bufw / 4);
for (int x = 0; x < std::min(bufw, w); x += 4) {
decodeDXT5Block(dst + bufw * y + x, src + blockIndex, bufw);
blockIndex++;
}
}
w = (w + 3) & ~3;
finalBuf = tmpTexBuf32;
}
break;
default:
ERROR_LOG(G3D, "Unknown Texture Format %d!!!", format);
finalBuf = tmpTexBuf32;
return false;
}
if (!finalBuf) {
ERROR_LOG(G3D, "NO finalbuf! Will crash!");
}
convertColors((u8*)finalBuf, dstFmt, bufw * h);
if(dstFmt == GL_UNSIGNED_SHORT_4_4_4_4)
{
for(int x = 0; x < h; x++)
for(int y = 0; y < bufw; y++)
{
u32 val = ((u16*)finalBuf)[x*bufw + y];
u32 a = (val & 0xF) * 255 / 15;
u32 r = ((val & 0xF) >> 24) * 255 / 15;
u32 g = ((val & 0xF) >> 16) * 255 / 15;
u32 b = ((val & 0xF) >> 8) * 255 / 15;
((u32*)output)[x*w + y] = (a << 24) | (r << 16) | (g << 8) | b;
}
}
else if(dstFmt == GL_UNSIGNED_SHORT_5_5_5_1)
{
for(int x = 0; x < h; x++)
for(int y = 0; y < bufw; y++)
{
u32 val = ((u16*)finalBuf)[x*bufw + y];
u32 a = (val & 0x1) * 255;
u32 r = ((val & 0x1F) >> 11) * 255 / 31;
u32 g = ((val & 0x1F) >> 6) * 255 / 31;
u32 b = ((val & 0x1F) >> 1) * 255 / 31;
((u32*)output)[x*w + y] = (a << 24) | (r << 16) | (g << 8) | b;
}
}
else if(dstFmt == GL_UNSIGNED_SHORT_5_6_5)
{
for(int x = 0; x < h; x++)
for(int y = 0; y < bufw; y++)
{
u32 val = ((u16*)finalBuf)[x*bufw + y];
u32 a = 0xFF;
u32 r = ((val & 0x1F) >> 11) * 255 / 31;
u32 g = ((val & 0x3F) >> 6) * 255 / 63;
u32 b = ((val & 0x1F)) * 255 / 31;
((u32*)output)[x*w + y] = (a << 24) | (r << 16) | (g << 8) | b;
}
}
else
{
for(int x = 0; x < h; x++)
for(int y = 0; y < bufw; y++)
{
u32 val = ((u32*)finalBuf)[x*bufw + y];
((u32*)output)[x*w + y] = ((val & 0xFF000000)) | ((val & 0x00FF0000)>>16) | ((val & 0x0000FF00)) | ((val & 0x000000FF)<<16);
}
}
gstate = oldState;
return true;
}

View File

@ -19,6 +19,7 @@
#include "../Globals.h"
#include "gfx_es2/fbo.h"
#include "GPU/GPUState.h"
class TextureCache
{
@ -42,6 +43,7 @@ public:
return cache.size();
}
bool DecodeTexture(u8 *output, GPUgstate state);
private:
struct TexCacheEntry {

View File

@ -76,6 +76,12 @@ bool GPUCommon::InterpretList(DisplayList &list)
ERROR_LOG(G3D, "DL PC = %08x WTF!!!!", list.pc);
return true;
}
#if defined(USING_QT_UI)
if(host->GpuStep())
{
host->SendGPUStart();
}
#endif
while (!finished)
{
@ -85,14 +91,16 @@ bool GPUCommon::InterpretList(DisplayList &list)
list.status = PSP_GE_LIST_STALL_REACHED;
return false;
}
op = Memory::ReadUnchecked_U32(list.pc); //read from memory
u32 cmd = op >> 24;
#if defined(USING_QT_UI)
if(host->GpuStep())
{
host->SendGPUWait();
host->SendGPUWait(cmd);
}
#endif
op = Memory::ReadUnchecked_U32(list.pc); //read from memory
u32 cmd = op >> 24;
u32 diff = op ^ gstate.cmdmem[cmd];
PreExecuteOp(op, diff);
// TODO: Add a compiler flag to remove stuff like this at very-final build time.

View File

@ -62,4 +62,13 @@ public:
{
return currentList;
}
virtual bool DecodeTexture(u8* dest, GPUgstate state)
{
return false;
}
std::vector<FramebufferInfo> GetFramebufferList()
{
return std::vector<FramebufferInfo>();
}
};

View File

@ -18,6 +18,7 @@
#pragma once
#include "../Globals.h"
#include "GPUState.h"
#include <deque>
class PointerWrap;
@ -32,6 +33,18 @@ enum DisplayListStatus
PSP_GE_LIST_CANCEL_DONE = 5, // canceled?
};
// Used for debug
struct FramebufferInfo
{
u32 fb_address;
u32 z_address;
int format;
u32 width;
u32 height;
void* fbo;
};
struct DisplayList
{
int id;
@ -94,4 +107,6 @@ public:
virtual void DumpNextFrame() = 0;
virtual const std::deque<DisplayList>& GetDisplayLists() = 0;
virtual DisplayList* GetCurrentDisplayList() = 0;
virtual bool DecodeTexture(u8* dest, GPUgstate state) = 0;
virtual std::vector<FramebufferInfo> GetFramebufferList() = 0;
};

View File

@ -152,7 +152,7 @@ void EmuThread::run()
host->UpdateUI();
host->InitGL();
glWindow->makeCurrent();
EmuThread_LockDraw(true);
#ifndef USING_GLES2
glewInit();
@ -163,6 +163,8 @@ void EmuThread::run()
QElapsedTimer timer;
EmuThread_LockDraw(false);
while(running) {
//UpdateGamepad(*input_state);
timer.start();
@ -173,10 +175,7 @@ void EmuThread::run()
if(gRun)
{
gameMutex->lock();
glWindow->makeCurrent();
EmuThread_LockDraw(true);
if(needInitGame)
{
g_State.bEmuThreadStarted = true;
@ -239,14 +238,12 @@ void EmuThread::run()
qint64 time = timer.elapsed();
const int frameTime = (1.0f/60.0f) * 1000;
gameMutex->unlock();
if(time < frameTime)
{
glWindow->doneCurrent();
EmuThread_LockDraw(false);
msleep(frameTime-time);
glWindow->makeCurrent();
EmuThread_LockDraw(true);
}
gameMutex->lock();
timer.start();
}
@ -276,13 +273,11 @@ void EmuThread::run()
}
#endif
glWindow->swapBuffers();
glWindow->doneCurrent();
gameMutex->unlock();
EmuThread_LockDraw(false);
}
else
{
gameMutex->lock();
glWindow->makeCurrent();
EmuThread_LockDraw(true);
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
@ -323,8 +318,7 @@ void EmuThread::run()
ui_draw2d.Flush(UIShader_Get());
glWindow->swapBuffers();
glWindow->doneCurrent();
gameMutex->unlock();
EmuThread_LockDraw(false);
qint64 time = timer.elapsed();
const int frameTime = (1.0f/60.0f) * 1000;
if(time < frameTime)

View File

@ -12,6 +12,7 @@
#include "android/jni/EmuScreen.h"
#include "android/jni/UIShader.h"
#include "android/jni/ui_atlas.h"
#include "GPU/ge_constants.h"
#include "EmuThread.h"
std::string boot_filename = "";
@ -65,6 +66,10 @@ void QtHost::UpdateDisassembly()
mainWindow->GetDialogDisasm()->GotoPC();
mainWindow->GetDialogDisasm()->Update();
}
if(mainWindow->GetDialogDisplaylist())
{
mainWindow->GetDialogDisplaylist()->Update();
}
}
void QtHost::SetDebugMode(bool mode)
@ -145,19 +150,42 @@ bool QtHost::GpuStep()
return m_GPUStep;
}
void QtHost::SendGPUWait()
void QtHost::SendGPUStart()
{
EmuThread_LockDraw(false);
mainWindow->GetDialogDisasm()->UpdateDisplayList();
m_hGPUStepEvent.wait(m_hGPUStepMutex);
if(m_GPUFlag == -1)
{
m_GPUFlag = 0;
}
EmuThread_LockDraw(true);
}
void QtHost::SetGPUStep(bool value)
void QtHost::SendGPUWait(u32 cmd)
{
EmuThread_LockDraw(false);
if((m_GPUFlag == 1 && (cmd == GE_CMD_PRIM || cmd == GE_CMD_BEZIER || cmd == GE_CMD_SPLINE)))
{
// Break after the draw
m_GPUFlag = 0;
}
else if(m_GPUFlag == 0)
{
mainWindow->GetDialogDisasm()->UpdateDisplayList();
mainWindow->GetDialogDisplaylist()->Update();
m_hGPUStepEvent.wait(m_hGPUStepMutex);
}
EmuThread_LockDraw(true);
}
void QtHost::SetGPUStep(bool value, int flag)
{
m_GPUStep = value;
m_GPUFlag = flag;
}
void QtHost::NextGPUStep()

View File

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

View File

@ -5,7 +5,6 @@
#include <QMenu>
#include <QAction>
#include <QApplication>
#include <QDebug>
#include <QInputDialog>
#include <QMessageBox>
@ -164,9 +163,7 @@ void CtrlDisAsmView::GoToMemoryView()
void CtrlDisAsmView::CopyAddress()
{
char temp[16];
sprintf(temp,"%08x",selection);
QApplication::clipboard()->setText(QString(temp));
QApplication::clipboard()->setText(QString("%1").arg(selection,8,16,QChar('0')));
}
void CtrlDisAsmView::CopyInstrDisAsm()
@ -178,11 +175,9 @@ void CtrlDisAsmView::CopyInstrDisAsm()
void CtrlDisAsmView::CopyInstrHex()
{
char temp[24];
EmuThread_LockDraw(true);
sprintf(temp,"%08x",debugger->readMemory(selection));
QApplication::clipboard()->setText(QString("%1").arg(debugger->readMemory(selection),8,16,QChar('0')));
EmuThread_LockDraw(false);
QApplication::clipboard()->setText(temp);
}
void CtrlDisAsmView::SetNextStatement()
@ -234,8 +229,7 @@ void CtrlDisAsmView::RenameFunction()
int sym = symbolMap.GetSymbolNum(selection);
if (sym != -1)
{
char name[256];
strncpy(name, symbolMap.GetSymbolName(sym),256);
QString name = symbolMap.GetSymbolName(sym);
bool ok;
QString newname = QInputDialog::getText(this, tr("New function name"),
tr("New function name:"), QLineEdit::Normal,
@ -300,8 +294,6 @@ void CtrlDisAsmView::paintEvent(QPaintEvent *)
int rowY1 = rect().bottom()/2 + rowHeight*i - rowHeight/2;
int rowY2 = rect().bottom()/2 + rowHeight*i + rowHeight/2 - 1;
char temp[256];
sprintf(temp,"%08x",address);
lbr.setColor(marker==address?QColor(0xFFFFEEE0):QColor(debugger->getColor(address)));
QColor bg = lbr.color();
@ -319,7 +311,6 @@ void CtrlDisAsmView::paintEvent(QPaintEvent *)
if (address == debugger->getPC())
{
painter.setBrush(pcBrush);
qDebug() << address;
}
painter.drawRect(16,rowY1,width-16-1,rowY2-rowY1);
@ -327,7 +318,7 @@ void CtrlDisAsmView::paintEvent(QPaintEvent *)
QPen textPen = QPen(QColor(halfAndHalf(bg.rgba(),0)));
painter.setPen(textPen);
painter.setFont(alignedFont);
painter.drawText(17,rowY1-3+rowHeight,QString(temp));
painter.drawText(17,rowY1-3+rowHeight,QString("%1").arg(address,8,16,QChar('0')));
painter.setFont(normalFont);
textPen.setColor(QColor(0xFF000000));
painter.setPen(textPen);

View File

@ -108,7 +108,6 @@ void CtrlMemView::paintEvent(QPaintEvent *)
int rowY2 = rect().bottom()/2 + rowHeight*i + rowHeight/2;
char temp[256];
sprintf(temp,"%08x",address);
painter.setBrush(currentBrush);
@ -123,7 +122,7 @@ void CtrlMemView::paintEvent(QPaintEvent *)
textPen.setColor(0x600000);
painter.setPen(textPen);
painter.setFont(alignedFont);
painter.drawText(17,rowY1-2+rowHeight, temp);
painter.drawText(17,rowY1-2+rowHeight, QString("%1").arg(address,8,16,QChar('0')));
textPen.setColor(0xFF000000);
painter.setPen(textPen);
if (debugger->isAlive())
@ -231,9 +230,7 @@ void CtrlMemView::contextMenu(const QPoint &pos)
void CtrlMemView::CopyValue()
{
char temp[24];
sprintf(temp,"%08x",Memory::ReadUnchecked_U32(selection));
QApplication::clipboard()->setText(temp);
QApplication::clipboard()->setText(QString("%1").arg(Memory::ReadUnchecked_U32(selection),8,16,QChar('0')));
}
void CtrlMemView::Dump()

View File

@ -236,14 +236,14 @@ void CtrlRegisterList::paintEvent(QPaintEvent *)
painter.setBrush(currentBrush);
if (i<cpu->GetNumRegsInCategory(category))
{
char temp[256];
sprintf(temp,"%s",cpu->GetRegName(category,i));
QString regName = cpu->GetRegName(category,i);
textPen.setColor(0x600000);
painter.setPen(textPen);
painter.drawText(17,rowY1-3+rowHeight,temp);
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])
{
@ -331,10 +331,7 @@ void CtrlRegisterList::CopyValue()
u32 val = cpu->GetRegValue(cat,reg);
EmuThread_LockDraw(false);
char temp[24];
sprintf(temp,"%08x",val);
QApplication::clipboard()->setText(temp);
QApplication::clipboard()->setText(QString("%1").arg(val,8,16,QChar('0')));
}
void CtrlRegisterList::Change()

View File

@ -45,9 +45,7 @@ void CtrlVfpuView::paintEvent(QPaintEvent *)
{
int my = (int)(yStart + matrix * rowHeight * 5.5f);
painter.drawRect(0, my, xStart-1, rowHeight-1);
char temp[256];
sprintf(temp, "M%i00", matrix);
painter.drawText(3, my+rowHeight-3, temp);
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++)
@ -56,13 +54,10 @@ void CtrlVfpuView::paintEvent(QPaintEvent *)
int x = column * columnWidth + xStart;
painter.drawRect(x, y, columnWidth-1, rowHeight - 1);
char temp[256];
sprintf(temp, "R%i0%i", matrix, column);
painter.drawText(x+3, y-3+rowHeight, temp);
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);
sprintf(temp, "C%i%i0", matrix, column);
painter.drawText(3, y+rowHeight*(column+2)-3, temp);
painter.drawText(3, y+rowHeight*(column+2)-3, QString("C%1").arg(matrix)+QString("%1").arg(column)+"0");
y+=rowHeight;

View File

@ -344,7 +344,7 @@ void Debugger_Disasm::FillFunctions()
if(symbolMap.GetSymbolType(i) & ST_FUNCTION)
{
QListWidgetItem* item = new QListWidgetItem();
item->setText(QString(symbolMap.GetSymbolName(i)) + " ("+ QVariant(symbolMap.GetSymbolSize(i)).toString() +")");
item->setText(QString(symbolMap.GetSymbolName(i)) + " ("+ QString::number(symbolMap.GetSymbolSize(i)) +")");
item->setData(Qt::UserRole, symbolMap.GetAddress(i));
ui->FuncList->addItem(item);
}
@ -372,9 +372,7 @@ void Debugger_Disasm::UpdateBreakpointsGUI()
if(!CBreakPoints::IsTempBreakPoint(addr_))
{
QTreeWidgetItem* item = new QTreeWidgetItem();
char temp[24];
sprintf(temp,"%08x",addr_);
item->setText(0,temp);
item->setText(0,QString("%1").arg(addr_,8,16,QChar('0')));
item->setData(0,Qt::UserRole,addr_);
ui->breakpointsList->addTopLevelItem(item);
if(curBpAddr == addr_)
@ -434,7 +432,7 @@ void Debugger_Disasm::UpdateThreadGUI()
for(int i = 0; i < threads.size(); i++)
{
QTreeWidgetItem* item = new QTreeWidgetItem();
item->setText(0,QVariant(threads[i].id).toString());
item->setText(0,QString::number(threads[i].id));
item->setData(0,Qt::UserRole,threads[i].id);
item->setText(1,threads[i].name);
QString status = "";
@ -445,12 +443,9 @@ void Debugger_Disasm::UpdateThreadGUI()
if(threads[i].status & THREADSTATUS_DORMANT) status += "Dormant ";
if(threads[i].status & THREADSTATUS_DEAD) status += "Dead ";
item->setText(2,status);
char temp[24];
sprintf(temp,"%08x",threads[i].curPC);
item->setText(3,temp);
item->setText(3,QString("%1").arg(threads[i].curPC,8,16,QChar('0')));
item->setData(3,Qt::UserRole,threads[i].curPC);
sprintf(temp,"%08x",threads[i].entrypoint);
item->setText(4,temp);
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)
@ -461,6 +456,8 @@ void Debugger_Disasm::UpdateThreadGUI()
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)
@ -542,7 +539,6 @@ void Debugger_Disasm::UpdateDisplayListGUI()
curDlId = ui->displayList->currentItem()->data(0,Qt::UserRole).toInt();
ui->displayList->clear();
ui->displayListData->clear();
EmuThread_LockDraw(true);
const std::deque<DisplayList>& dlQueue = gpu->GetDisplayLists();
@ -551,7 +547,7 @@ void Debugger_Disasm::UpdateDisplayListGUI()
if(dl)
{
QTreeWidgetItem* item = new QTreeWidgetItem();
item->setText(0,QVariant(dl->id).toString());
item->setText(0,QString::number(dl->id));
item->setData(0, Qt::UserRole, dl->id);
switch(dl->status)
{
@ -563,19 +559,15 @@ void Debugger_Disasm::UpdateDisplayListGUI()
case PSP_GE_LIST_CANCEL_DONE: item->setText(1,"Cancel Done"); break;
default: break;
}
char temp[24];
sprintf(temp,"%08x",dl->startpc);
item->setText(2,temp);
item->setText(2,QString("%1").arg(dl->startpc,8,16,QChar('0')));
item->setData(2, Qt::UserRole, dl->startpc);
sprintf(temp,"%08x",dl->pc);
item->setText(3,temp);
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 == dl->id)
{
ui->displayList->setCurrentItem(item);
displayListRowSelected = item;
ShowDLCode();
}
}
@ -584,7 +576,7 @@ void Debugger_Disasm::UpdateDisplayListGUI()
if(dl && it->id == dl->id)
continue;
QTreeWidgetItem* item = new QTreeWidgetItem();
item->setText(0,QVariant(it->id).toString());
item->setText(0,QString::number(it->id));
item->setData(0, Qt::UserRole, it->id);
switch(it->status)
{
@ -596,21 +588,19 @@ void Debugger_Disasm::UpdateDisplayListGUI()
case PSP_GE_LIST_CANCEL_DONE: item->setText(1,"Cancel Done"); break;
default: break;
}
char temp[24];
sprintf(temp,"%08x",it->startpc);
item->setText(2,temp);
item->setText(2,QString("%1").arg(it->startpc,8,16,QChar('0')));
item->setData(2, Qt::UserRole, it->startpc);
sprintf(temp,"%08x",it->pc);
item->setText(3,temp);
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 == it->id)
{
ui->displayList->setCurrentItem(item);
displayListRowSelected = item;
ShowDLCode();
}
}
for(int i = 0; i < ui->displayList->columnCount(); i++)
ui->displayList->resizeColumnToContents(i);
EmuThread_LockDraw(false);
}
@ -621,96 +611,12 @@ void Debugger_Disasm::on_displayList_customContextMenuRequested(const QPoint &po
{
displayListRowSelected = item;
QMenu menu(this);
/*QMenu menu(this);
QAction *showCode = new QAction(tr("Show code"), this);
connect(showCode, SIGNAL(triggered()), this, SLOT(ShowDLCode()));
menu.addAction(showCode);
menu.addAction(showCode);*/
menu.exec( ui->displayList->mapToGlobal(pos));
//menu.exec( ui->displayList->mapToGlobal(pos));
}
}
void Debugger_Disasm::ShowDLCode()
{
ui->displayListData->clear();
ui->displayListData->setColumnWidth(0,70);
u32 startPc = displayListRowSelected->data(2,Qt::UserRole).toInt();
u32 curPc = displayListRowSelected->data(3,Qt::UserRole).toInt();
std::map<int,std::string> data;
FillDisplayListCmd(data, startPc,0);
for(std::map<int,std::string>::iterator it = data.begin(); it != data.end(); it++)
{
QTreeWidgetItem* item = new QTreeWidgetItem();
char temp[24];
sprintf(temp,"%08x",it->first);
item->setText(0,temp);
item->setText(1,it->second.c_str());
if(curPc == it->first)
{
for(int j = 0; j < 2; j++)
item->setTextColor(j, Qt::green);
}
ui->displayListData->addTopLevelItem(item);
}
}
void Debugger_Disasm::FillDisplayListCmd(std::map<int,std::string>& data, u32 pc, u32 prev)
{
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 diff = op ^ gstate.cmdmem[cmd];
char temp[256];
GeDisassembleOp(curPc, op, prev, temp);
data[curPc] = temp;
prev = op;
if(cmd == GE_CMD_JUMP)
{
u32 target = (((gstate.base & 0x00FF0000) << 8) | (op & 0xFFFFFC)) & 0x0FFFFFFF;
FillDisplayListCmd(data, target, prev);
return;
}
else if(cmd == GE_CMD_CALL)
{
u32 target = gstate_c.getRelativeAddress(op & 0xFFFFFF);
FillDisplayListCmd(data, target, prev);
}
else if(cmd == GE_CMD_RET)
{
return;
}
else if(cmd == GE_CMD_FINISH)
{
return;
}
else if(cmd == GE_CMD_END)
{
if(prev >> 24 == GE_CMD_FINISH)
return;
}
curPc += 4;
debugLimit--;
}
}
void Debugger_Disasm::on_nextGPU_clicked()
{
host->SetGPUStep(true);
host->NextGPUStep();
}
void Debugger_Disasm::on_runBtn_clicked()
{
host->SetGPUStep(false);
host->NextGPUStep();
}

View File

@ -41,7 +41,6 @@ public:
void UpdateDisplayList();
protected:
void showEvent(QShowEvent *);
void FillDisplayListCmd(std::map<int,std::string>& data, u32 pc, u32 prev);
signals:
void updateDisplayList_();
@ -52,7 +51,6 @@ public slots:
void Goto(u32 addr);
void RemoveBreakpoint();
void GotoThreadEntryPoint();
void ShowDLCode();
private slots:
void UpdateDisplayListGUI();
@ -103,9 +101,6 @@ private slots:
void SetThreadStatusSuspend();
void on_displayList_customContextMenuRequested(const QPoint &pos);
void on_nextGPU_clicked();
void on_runBtn_clicked();
private:
void SetThreadStatus(ThreadStatus status);

View File

@ -313,7 +313,7 @@
<item>
<widget class="QTabWidget" name="tabWidget_2">
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab_3">
<attribute name="title">
@ -424,70 +424,6 @@
</property>
</column>
</widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QTreeWidget" name="displayListData">
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="runBtn">
<property name="text">
<string>Run</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="nextGPU">
<property name="text">
<string>Step</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

1520
Qt/debugger_displaylist.cpp Normal file

File diff suppressed because it is too large Load Diff

114
Qt/debugger_displaylist.h Normal file
View File

@ -0,0 +1,114 @@
#ifndef DEBUGGER_DISPLAYLIST_H
#define DEBUGGER_DISPLAYLIST_H
#include "Core/Debugger/DebugInterface.h"
#include <QDialog>
#include <QTreeWidgetItem>
#include "GPU/GPUState.h"
#include "native/gfx_es2/fbo.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:
explicit Debugger_DisplayList(DebugInterface *_cpu, MainWindow *mainWindow_, QWidget *parent = 0);
~Debugger_DisplayList();
void UpdateDisplayList();
void ShowDLCode();
void FillDisplayListCmd(std::map<int,DListLine> &data, u32 pc, u32 prev, GPUgstate &state);
void Update();
void UpdateRenderBuffer();
void UpdateRenderBufferList();
void UpdateVertexInfo();
void UpdateIndexInfo();
protected:
void showEvent(QShowEvent *);
signals:
void updateDisplayList_();
void updateRenderBufferList_();
private slots:
void UpdateDisplayListGUI();
void UpdateRenderBufferListGUI();
void releaseLock();
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);
private:
QString DisassembleOp(u32 pc, u32 op, u32 prev, const GPUgstate &state);
Ui::Debugger_DisplayList *ui;
DebugInterface* cpu;
MainWindow* mainWindow;
QTreeWidgetItem* displayListRowSelected;
int currentRenderFrameDisplay;
FBO* currentTextureDisplay;
float fboZoomFactor;
int maxVtxDisplay;
int maxIdxDisplay;
std::vector<GPUgstate> drawGPUState;
std::map<u32, int> vtxBufferSize;
std::map<u32, int> idxBufferSize;
};
#endif // DEBUGGER_DISPLAYLIST_H

527
Qt/debugger_displaylist.ui Normal file
View File

@ -0,0 +1,527 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Debugger_DisplayList</class>
<widget class="QDialog" name="Debugger_DisplayList">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>795</width>
<height>506</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QSplitter" name="splitter_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QSplitter" name="splitter_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>DisplayList</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTreeWidget" name="displayList">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
<attribute name="headerDefaultSectionSize">
<number>30</number>
</attribute>
<column>
<property name="text">
<string>Id</string>
</property>
</column>
<column>
<property name="text">
<string>Status</string>
</property>
</column>
<column>
<property name="text">
<string>Start Address</string>
</property>
</column>
<column>
<property name="text">
<string>Current Address</string>
</property>
</column>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="runBtn">
<property name="text">
<string>Run</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="stopBtn">
<property name="text">
<string>Stop</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="nextDLBtn">
<property name="text">
<string>Next DL</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QTabWidget" name="displayListInfo">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Commands</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTreeWidget" name="displayListData">
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="stepBtn">
<property name="text">
<string>Step</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="nextDrawBtn">
<property name="text">
<string>Next Draw</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="gotoPCBtn">
<property name="text">
<string>Goto PC</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Textures</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTreeWidget" name="texturesList">
<column>
<property name="text">
<string>Address</string>
</property>
</column>
<column>
<property name="text">
<string>Width</string>
</property>
</column>
<column>
<property name="text">
<string>Height</string>
</property>
</column>
<column>
<property name="text">
<string>Format</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Vertex Buffer</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QTreeWidget" name="vertexList">
<attribute name="headerDefaultSectionSize">
<number>30</number>
</attribute>
<column>
<property name="text">
<string notr="true">Address</string>
</property>
</column>
<column>
<property name="text">
<string>Coord Type</string>
</property>
</column>
<column>
<property name="text">
<string>Number Morph</string>
</property>
</column>
<column>
<property name="text">
<string>Number Weights</string>
</property>
</column>
<column>
<property name="text">
<string>Has Weight</string>
</property>
</column>
<column>
<property name="text">
<string>Has Position</string>
</property>
</column>
<column>
<property name="text">
<string>Has Normal</string>
</property>
</column>
<column>
<property name="text">
<string>Has Color</string>
</property>
</column>
<column>
<property name="text">
<string>Has UV</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="vertexData">
<attribute name="headerDefaultSectionSize">
<number>30</number>
</attribute>
<column>
<property name="text">
<string notr="true">Idx</string>
</property>
</column>
<column>
<property name="text">
<string>Address</string>
</property>
</column>
<column>
<property name="text">
<string>Values</string>
</property>
</column>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Next 20</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string>Index Buffer</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QSplitter" name="splitter_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QTreeWidget" name="indexList">
<column>
<property name="text">
<string notr="true">Address</string>
</property>
</column>
</widget>
<widget class="QTreeWidget" name="indexData">
<attribute name="headerDefaultSectionSize">
<number>30</number>
</attribute>
<column>
<property name="text">
<string>Idx</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">Adress</string>
</property>
</column>
<column>
<property name="text">
<string>Value</string>
</property>
</column>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QPushButton" name="nextIdx">
<property name="text">
<string>Next 20</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Framebuffer</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QSplitter" name="splitter_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QTreeWidget" name="fboList">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<column>
<property name="text">
<string>VAddress</string>
</property>
</column>
<column>
<property name="text">
<string>Width</string>
</property>
</column>
<column>
<property name="text">
<string>Height</string>
</property>
</column>
<column>
<property name="text">
<string>Format</string>
</property>
</column>
</widget>
<widget class="QScrollArea" name="fboScroll">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>375</width>
<height>76</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="fboImg">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Display : </string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<item>
<property name="text">
<string>Color</string>
</property>
</item>
<item>
<property name="text">
<string>Depth</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="zoommBtn">
<property name="text">
<string>Zoom-</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="zoompBtn">
<property name="text">
<string>Zoom+</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -51,9 +51,7 @@ void Debugger_Memory::Goto(u32 addr)
void Debugger_Memory::on_editAddress_textChanged(const QString &arg1)
{
u32 addr;
sscanf(arg1.toStdString().c_str(),"%08x",&addr);
ui->memView->gotoAddr(addr & ~3);
ui->memView->gotoAddr(arg1.toInt(0,16) & ~3);
}
void Debugger_Memory::on_normalBtn_clicked()
@ -83,7 +81,7 @@ void Debugger_Memory::NotifyMapLoaded()
if(symbolMap.GetSymbolType(i) & ST_DATA)
{
QListWidgetItem* item = new QListWidgetItem();
item->setText(QString(symbolMap.GetSymbolName(i)) + " ("+ QVariant(symbolMap.GetSymbolSize(i)).toString() +")");
item->setText(QString(symbolMap.GetSymbolName(i)) + " ("+ QString::number(symbolMap.GetSymbolSize(i)) +")");
item->setData(Qt::UserRole, symbolMap.GetAddress(i));
ui->symbols->addItem(item);
}

93
Qt/debugger_memorytex.cpp Normal file
View File

@ -0,0 +1,93 @@
#include "debugger_memorytex.h"
#include "gfx_es2/gl_state.h"
#include "gfx/gl_common.h"
#include "gfx/gl_lost_manager.h"
#include "ui_debugger_memorytex.h"
#include "Core/MemMap.h"
#include <QImage>
#include <QTimer>
#include "Core/HLE/sceDisplay.h"
#include "GPU/GPUInterface.h"
#include "EmuThread.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::showEvent(QShowEvent *)
{
#ifdef Q_WS_X11
// Hack to remove the X11 crash with threaded opengl when opening the first dialog
EmuThread_LockDraw(true);
QTimer::singleShot(100, this, SLOT(releaseLock()));
#endif
}
void Debugger_MemoryTex::releaseLock()
{
EmuThread_LockDraw(false);
}
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()
{
EmuThread_LockDraw(true);
GPUgstate state;
state.texaddr[0] = ui->texaddr->text().toInt(0,16);
state.texbufwidth[0] = ui->texbufwidth0->text().toInt(0,16);
state.texformat = ui->texformat->text().toInt(0,16);
state.texsize[0] = ui->texsize->text().toInt(0,16);
state.texmode = ui->texmode->text().toInt(0,16);
state.clutformat = ui->clutformat->text().toInt(0,16);
state.clutaddr = ui->clutaddr->text().toInt(0,16);
state.clutaddrupper = ui->clutaddrupper->text().toInt(0,16);
state.loadclut = ui->loadclut->text().toInt(0,16);
int w = 1 << (state.texsize[0] & 0xf);
int h = 1 << ((state.texsize[0]>>8) & 0xf);
uchar* newData = new uchar[w*h*4];
if(gpu->DecodeTexture(newData, state))
{
QImage img = QImage(newData, w, h, w*4, QImage::Format_ARGB32); // EmuThread_GrabBackBuffer();
QPixmap pixmap = QPixmap::fromImage(img);
ui->textureImg->setPixmap(pixmap);
ui->textureImg->setMinimumWidth(pixmap.width());
ui->textureImg->setMinimumHeight(pixmap.height());
ui->textureImg->setMaximumWidth(pixmap.width());
ui->textureImg->setMaximumHeight(pixmap.height());
}
delete[] newData;
EmuThread_LockDraw(false);
}

30
Qt/debugger_memorytex.h Normal file
View File

@ -0,0 +1,30 @@
#ifndef DEBUGGER_MEMORYTEX_H
#define DEBUGGER_MEMORYTEX_H
#include <QDialog>
#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);
protected:
void showEvent(QShowEvent *);
private slots:
void releaseLock();
void on_readBtn_clicked();
private:
Ui::Debugger_MemoryTex *ui;
};
#endif // DEBUGGER_MEMORYTEX_H

177
Qt/debugger_memorytex.ui Normal file
View File

@ -0,0 +1,177 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Debugger_MemoryTex</class>
<widget class="QDialog" name="Debugger_MemoryTex">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>768</width>
<height>546</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>TexAddr</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>TexBufWidth0</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>TexFormat</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>TexSize</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>ClutFormat</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>ClutAddr</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>ClutAddrUpper</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>LoadClut</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="texaddr"/>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="texbufwidth0"/>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="texformat"/>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="texsize"/>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="clutformat"/>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="clutaddr"/>
</item>
<item row="7" column="1">
<widget class="QLineEdit" name="clutaddrupper"/>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="loadclut"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>TexMode</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="texmode"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="readBtn">
<property name="text">
<string>Read</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QScrollArea" name="texture">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>76</width>
<height>526</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="textureImg">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -28,7 +28,9 @@ MainWindow::MainWindow(QWidget *parent) :
ui(new Ui::MainWindow),
nextState(CORE_POWERDOWN),
dialogDisasm(0),
memoryWindow(0)
memoryWindow(0),
memoryTexWindow(0),
displaylistWindow(0)
{
ui->setupUi(this);
qApp->installEventFilter(this);
@ -206,6 +208,8 @@ void MainWindow::Boot()
on_action_OptionsFullScreen_triggered();
memoryWindow = new Debugger_Memory(currentDebugMIPS, this, this);
memoryTexWindow = new Debugger_MemoryTex(this);
displaylistWindow = new Debugger_DisplayList(currentDebugMIPS, this, this);
if (dialogDisasm)
dialogDisasm->NotifyMapLoaded();
@ -259,13 +263,12 @@ void MainWindow::UpdateMenus()
ui->action_FileLoadStateFile->setEnabled(!enable);
ui->action_FileQuickloadState->setEnabled(!enable);
ui->action_FileQuickSaveState->setEnabled(!enable);
ui->action_CPUDynarec->setEnabled(enable);
ui->action_CPUInterpreter->setEnabled(enable);
ui->action_CPUFastInterpreter->setEnabled(enable);
ui->action_EmulationStop->setEnabled(!enable);
ui->action_DebugDumpFrame->setEnabled(!enable);
ui->action_DebugDisassembly->setEnabled(!enable);
ui->action_DebugMemoryView->setEnabled(!enable);
ui->action_DebugMemoryViewTexture->setEnabled(!enable);
ui->action_DebugDisplayList->setEnabled(!enable);
ui->action_OptionsScreen1x->setChecked(0 == (g_Config.iWindowZoom - 1));
ui->action_OptionsScreen2x->setChecked(1 == (g_Config.iWindowZoom - 1));
@ -354,6 +357,10 @@ void MainWindow::on_action_EmulationStop_triggered()
dialogDisasm->close();
if(memoryWindow && memoryWindow->isVisible())
memoryWindow->close();
if(memoryTexWindow && memoryTexWindow->isVisible())
memoryTexWindow->close();
if(displaylistWindow && displaylistWindow->isVisible())
displaylistWindow->close();
EmuThread_StopGame();
SetGameTitle("");
@ -932,6 +939,10 @@ void MainWindow::on_action_EmulationReset_triggered()
dialogDisasm->close();
if(memoryWindow)
memoryWindow->close();
if(memoryTexWindow)
memoryTexWindow->close();
if(displaylistWindow)
displaylistWindow->close();
EmuThread_StopGame();
@ -1016,3 +1027,15 @@ void MainWindow::on_action_Sound_triggered()
g_Config.bEnableSound = !g_Config.bEnableSound;
UpdateMenus();
}
void MainWindow::on_action_DebugMemoryViewTexture_triggered()
{
if(memoryTexWindow)
memoryTexWindow->show();
}
void MainWindow::on_action_DebugDisplayList_triggered()
{
if(displaylistWindow)
displaylistWindow->show();
}

View File

@ -8,6 +8,8 @@
#include "input/input_state.h"
#include "debugger_disasm.h"
#include "debugger_memory.h"
#include "debugger_memorytex.h"
#include "debugger_displaylist.h"
#include "controls.h"
#include "gamepaddialog.h"
@ -33,6 +35,8 @@ public:
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 closeEvent(QCloseEvent *event);
void keyPressEvent(QKeyEvent *);
@ -169,6 +173,10 @@ private slots:
void on_action_Sound_triggered();
void on_action_DebugMemoryViewTexture_triggered();
void on_action_DebugDisplayList_triggered();
private:
void loadLanguage(const QString &language);
void createLanguageMenu();
@ -188,6 +196,8 @@ private:
Debugger_Disasm *dialogDisasm;
Debugger_Memory *memoryWindow;
Debugger_MemoryTex *memoryTexWindow;
Debugger_DisplayList *displaylistWindow;
Controls* controls;
GamePadDialog* gamePadDlg;

View File

@ -44,7 +44,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
@ -83,8 +83,10 @@
<addaction name="action_DebugDumpFrame"/>
<addaction name="separator"/>
<addaction name="action_DebugDisassembly"/>
<addaction name="action_DebugDisplayList"/>
<addaction name="action_DebugLog"/>
<addaction name="action_DebugMemoryView"/>
<addaction name="action_DebugMemoryViewTexture"/>
</widget>
<widget class="QMenu" name="menu_Options">
<property name="title">
@ -616,6 +618,11 @@
<string>Memory View Texture...</string>
</property>
</action>
<action name="action_DebugDisplayList">
<property name="text">
<string>DisplayList...</string>
</property>
</action>
<action name="action_Simple_2xAA">
<property name="checkable">
<bool>true</bool>