Files
ppsspp/Windows/GEDebugger/CtrlDisplayListView.h

86 lines
1.9 KiB
C
Raw Normal View History

2013-09-25 15:24:53 +02:00
#pragma once
#include "Common/CommonWindows.h"
#include "Globals.h"
#include "GPU/Common/GPUDebugInterface.h"
2013-10-02 08:51:21 +02:00
#include <algorithm>
2013-09-25 15:24:53 +02:00
class CtrlDisplayListView
{
HWND wnd;
RECT rect;
static const PTCHAR windowClass;
DisplayList list;
HFONT font;
2013-09-26 10:24:41 +02:00
HFONT boldfont;
2013-09-25 15:24:53 +02:00
u32 windowStart;
u32 curAddress;
2013-10-02 08:51:21 +02:00
u32 selectRangeStart;
u32 selectRangeEnd;
2013-09-25 15:24:53 +02:00
int visibleRows;
int charWidth;
int rowHeight;
int instructionSize;
bool hasFocus;
bool validDisplayList;
struct {
int addressStart;
int opcodeStart;
} pixelPositions;
2013-10-01 12:05:19 +02:00
void toggleBreakpoint();
2013-09-25 15:24:53 +02:00
public:
CtrlDisplayListView(HWND _wnd);
~CtrlDisplayListView();
static void registerClass();
static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static CtrlDisplayListView * getFrom(HWND wnd);
void onPaint(WPARAM wParam, LPARAM lParam);
void onKeyDown(WPARAM wParam, LPARAM lParam);
void onMouseDown(WPARAM wParam, LPARAM lParam, int button);
void onMouseUp(WPARAM wParam, LPARAM lParam, int button);
2013-09-25 15:24:53 +02:00
void onVScroll(WPARAM wParam, LPARAM lParam);
void redraw();
void setDisplayList(DisplayList& displayList)
{
validDisplayList = true;
list = displayList;
gotoAddr(list.pc);
}
void scrollWindow(int lines)
{
windowStart += lines*instructionSize;
redraw();
}
void gotoAddr(unsigned int addr)
{
u32 windowEnd = windowStart+visibleRows*instructionSize;
u32 newAddress = addr&(~(instructionSize-1));
if (newAddress < windowStart || newAddress >= windowEnd)
{
windowStart = newAddress-visibleRows/2*instructionSize;
}
setCurAddress(newAddress);
redraw();
}
void setCurAddress(u32 newAddress, bool extend = false)
{
2013-10-02 08:51:21 +02:00
u32 after = newAddress + instructionSize;
2013-09-25 15:24:53 +02:00
curAddress = newAddress;
2013-10-02 08:51:21 +02:00
selectRangeStart = extend ? std::min(selectRangeStart, newAddress) : newAddress;
selectRangeEnd = extend ? std::max(selectRangeEnd, after) : after;
2013-09-25 15:24:53 +02:00
}
void scrollAddressIntoView();
bool curAddressIsVisible();
};