Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GE Debugger: Add fields to register expressions #16007

Merged
merged 4 commits into from
Sep 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
GE Debugger: Provide addrs in breakpoint conds.
Easier to just refer to the full address.
  • Loading branch information
unknownbrackets committed Sep 11, 2022
commit aa377662dd0ccf7fc9bca7f05d8b87af6fddb998
46 changes: 44 additions & 2 deletions GPU/Common/GPUDebugInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ enum class GEReferenceIndex : uint32_t {
BFLAG,
OP,
DATA,
CLUTADDR,
TRANSFERSRC,
TRANSFERDST,

TEXADDR0,
TEXADDR1,
TEXADDR2,
TEXADDR3,
TEXADDR4,
TEXADDR5,
TEXADDR6,
TEXADDR7,

BONE_MATRIX = 0x200,
WORLD_MATRIX = 0x260,
Expand All @@ -56,6 +68,17 @@ static constexpr ReferenceName referenceNames[] = {
{ GEReferenceIndex::BFLAG, "boundflag" },
{ GEReferenceIndex::OP, "op" },
{ GEReferenceIndex::DATA, "data" },
{ GEReferenceIndex::CLUTADDR, "clutaddr" },
{ GEReferenceIndex::TRANSFERSRC, "transfersrc" },
{ GEReferenceIndex::TRANSFERDST, "transferdst" },
{ GEReferenceIndex::TEXADDR0, "texaddr0" },
{ GEReferenceIndex::TEXADDR1, "texaddr1" },
{ GEReferenceIndex::TEXADDR2, "texaddr2" },
{ GEReferenceIndex::TEXADDR3, "texaddr3" },
{ GEReferenceIndex::TEXADDR4, "texaddr4" },
{ GEReferenceIndex::TEXADDR5, "texaddr5" },
{ GEReferenceIndex::TEXADDR6, "texaddr6" },
{ GEReferenceIndex::TEXADDR7, "texaddr7" },
};

class GEExpressionFunctions : public IExpressionFunctions {
Expand Down Expand Up @@ -133,15 +156,15 @@ bool GEExpressionFunctions::parseSymbol(char *str, uint32_t &symbolValue) {
}

uint32_t GEExpressionFunctions::getReferenceValue(uint32_t referenceIndex) {
GPUgstate state = gpu_->GetGState();
if (referenceIndex < 0x100) {
uint32_t value = gpu_->GetGState().cmdmem[referenceIndex];
uint32_t value = state.cmdmem[referenceIndex];
// TODO: Later, support float values and similar.
return value & 0x00FFFFFF;
}

// We return the matrix value as float bits, which gets interpreted correctly in the parser.
if (referenceIndex >= (uint32_t)GEReferenceIndex::BONE_MATRIX && referenceIndex < (uint32_t)GEReferenceIndex::MATRIX_END) {
GPUgstate state = gpu_->GetGState();
float value;
if (referenceIndex >= (uint32_t)GEReferenceIndex::TGEN_MATRIX) {
value = state.tgenMatrix[referenceIndex - (uint32_t)GEReferenceIndex::TGEN_MATRIX];
Expand Down Expand Up @@ -197,6 +220,25 @@ uint32_t GEExpressionFunctions::getReferenceValue(uint32_t referenceIndex) {
}
return 0;

case GEReferenceIndex::CLUTADDR:
return state.getClutAddress();

case GEReferenceIndex::TRANSFERSRC:
return state.getTransferSrcAddress();

case GEReferenceIndex::TRANSFERDST:
return state.getTransferDstAddress();

case GEReferenceIndex::TEXADDR0:
case GEReferenceIndex::TEXADDR1:
case GEReferenceIndex::TEXADDR2:
case GEReferenceIndex::TEXADDR3:
case GEReferenceIndex::TEXADDR4:
case GEReferenceIndex::TEXADDR5:
case GEReferenceIndex::TEXADDR6:
case GEReferenceIndex::TEXADDR7:
return state.getTextureAddress((int)ref - (int)GEReferenceIndex::TEXADDR0);

case GEReferenceIndex::BONE_MATRIX:
case GEReferenceIndex::WORLD_MATRIX:
case GEReferenceIndex::VIEW_MATRIX:
Expand Down
22 changes: 11 additions & 11 deletions GPU/Debugger/GECommandTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,14 @@ static constexpr GECmdInfo geCmdInfo[] = {
{ GE_CMD_FRAMEBUFWIDTH, "fbstride", GECmdFormat::STRIDE },
{ GE_CMD_ZBUFPTR, "zbptr", GECmdFormat::LOW_ADDR_ONLY },
{ GE_CMD_ZBUFWIDTH, "zbstride", GECmdFormat::STRIDE },
{ GE_CMD_TEXADDR0, "texaddr0", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR1, "texaddr1", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR2, "texaddr2", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR3, "texaddr3", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR4, "texaddr4", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR5, "texaddr5", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR6, "texaddr6", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR7, "texaddr7", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR0, "texaddr0low", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR1, "texaddr1low", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR2, "texaddr2low", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR3, "texaddr3low", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR4, "texaddr4low", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR5, "texaddr5low", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR6, "texaddr6low", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR7, "texaddr7low", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXBUFWIDTH0, "texbufw0", GECmdFormat::STRIDE_HIGH_ADDR },
{ GE_CMD_TEXBUFWIDTH1, "texbufw1", GECmdFormat::STRIDE_HIGH_ADDR },
{ GE_CMD_TEXBUFWIDTH2, "texbufw2", GECmdFormat::STRIDE_HIGH_ADDR },
Expand All @@ -204,11 +204,11 @@ static constexpr GECmdInfo geCmdInfo[] = {
{ GE_CMD_TEXBUFWIDTH5, "texbufw5", GECmdFormat::STRIDE_HIGH_ADDR },
{ GE_CMD_TEXBUFWIDTH6, "texbufw6", GECmdFormat::STRIDE_HIGH_ADDR },
{ GE_CMD_TEXBUFWIDTH7, "texbufw7", GECmdFormat::STRIDE_HIGH_ADDR },
{ GE_CMD_CLUTADDR, "clutaddr", GECmdFormat::LOW_ADDR },
{ GE_CMD_CLUTADDR, "clutaddrlow", GECmdFormat::LOW_ADDR },
{ GE_CMD_CLUTADDRUPPER, "clutaddrhigh", GECmdFormat::HIGH_ADDR },
{ GE_CMD_TRANSFERSRC, "transfersrc", GECmdFormat::LOW_ADDR },
{ GE_CMD_TRANSFERSRC, "transfersrclow", GECmdFormat::LOW_ADDR },
{ GE_CMD_TRANSFERSRCW, "transfersrcstride", GECmdFormat::STRIDE_HIGH_ADDR },
{ GE_CMD_TRANSFERDST, "transferdst", GECmdFormat::LOW_ADDR },
{ GE_CMD_TRANSFERDST, "transferdstlow", GECmdFormat::LOW_ADDR },
{ GE_CMD_TRANSFERDSTW, "transferdststride", GECmdFormat::STRIDE_HIGH_ADDR },
{ GE_CMD_UNKNOWN_B6, "unknownb6", GECmdFormat::NONE },
{ GE_CMD_UNKNOWN_B7, "unknownb7", GECmdFormat::NONE },
Expand Down