Files
ppsspp/Windows/Debugger/CtrlRegisterList.h
T
Artem Lytkin dcf442349f Win32 debugger: show VFPU values, make the register list scrollable
PrintRegValue returned "N/A" for the VFPU category, and CtrlRegisterList
had its WM_VSCROLL case commented out, so only the rows that fit in the
window were reachable - about a quarter of the 128 VFPU registers. Print
the float the same way the FPU tab does, give the list a real scrollbar
with mouse wheel support, keep the keyboard selection in view, and reset
the position when switching tabs.

The category header hit test now uses the client rect so the tab
boundaries match what's drawn once the scrollbar takes its share of the
width. KernelThreadDebugInterface gets the same one-line fix for parity.
2026-09-05 10:09:46 +03:00

82 lines
2.4 KiB
C++

#pragma once
//////////////////////////////////////////////////////////////////////////
//CtrlRegisterList
// CtrlRegisterList.cpp
//////////////////////////////////////////////////////////////////////////
//This Win32 control is made to be flexible and usable with
//every kind of CPU architechture that has fixed width instruction words.
//Just supply it an instance of a class derived from Debugger, with all methods
//overridden for full functionality. Look at the ppc one for an example.
//
//To add to a dialog box, just draw a User Control in the dialog editor,
//and set classname to "CtrlRegisterList". you also need to call CtrlRegisterList::init()
//before opening this dialog, to register the window class.
//
//To get a class instance to be able to access it, just use
// CtrlRegisterList::getFrom(GetDlgItem(yourdialog, IDC_yourid)).
#include "Core/MIPS/MIPSDebugInterface.h"
class CtrlRegisterList {
HWND wnd;
HFONT font;
RECT rect;
int rowHeight;
int selection = 0;
int category = 0;
int scrollRow_ = 0;
int oldSelection = 0;
bool selecting = false;
bool hasFocus = false;
MIPSDebugInterface *cpu = nullptr;
u32 lastPC = 0;
u32 *lastCat0Values = nullptr;
bool *changedCat0Regs = nullptr;
bool ctrlDown = false;
u32 getSelectedRegValue(char *out, size_t size);
void copyRegisterValue();
void editRegisterValue();
int totalRows();
int visibleRows();
void scrollTo(int row);
public:
CtrlRegisterList(HWND _wnd);
~CtrlRegisterList();
static void init();
static void deinit();
static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static CtrlRegisterList * getFrom(HWND wnd);
void onPaint(WPARAM wParam, LPARAM lParam);
void onVScroll(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);
void onMouseMove(WPARAM wParam, LPARAM lParam, int button);
void redraw();
int yToIndex(int y);
void setCPU(MIPSDebugInterface *deb) {
cpu = deb;
constexpr int regs = MIPSDebugInterface::GetNumRegsInCategory(0);
lastCat0Values = new u32[regs+3];
changedCat0Regs = new bool[regs+3];
memset(lastCat0Values, 0, (regs+3) * sizeof(u32));
memset(changedCat0Regs, 0, (regs+3) * sizeof(bool));
}
MIPSDebugInterface *getCPU()
{
return cpu;
}
private:
bool redrawScheduled_ = false;
};