From 01bfb88f1545df77a0d63400d3cd56ceebeaeb38 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 20 Aug 2022 15:51:46 -0700 Subject: [PATCH] GE Debugger: Correct 16-bit CLUT display. --- Windows/GEDebugger/GEDebugger.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Windows/GEDebugger/GEDebugger.cpp b/Windows/GEDebugger/GEDebugger.cpp index 60ae3a0b3b..49ecc6af4e 100644 --- a/Windows/GEDebugger/GEDebugger.cpp +++ b/Windows/GEDebugger/GEDebugger.cpp @@ -649,11 +649,13 @@ void CGEDebugger::SecondPreviewHover(int x, int y) { } DescribeSecondPreview(state, desc); } else { - u32 pix = secondBuffer_->GetRawPixel(x, y); if (showClut_) { - // Show the clut index, rather than coords. - DescribePixel(pix, secondBuffer_->GetFormat(), y * 16 + x, 0, desc); + // Use the clut index, rather than coords. + uint32_t clutWidth = secondBuffer_->GetStride() / 16; + u32 pix = secondBuffer_->GetRawPixel(y * clutWidth + x, 0); + DescribePixel(pix, secondBuffer_->GetFormat(), y * clutWidth + x, 0, desc); } else { + u32 pix = secondBuffer_->GetRawPixel(x, y); DescribePixel(pix, secondBuffer_->GetFormat(), x, y, desc); } }