From 6ac1dd896640c009e3b5a235bda18e6ede9d1a6f Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Tue, 7 Nov 2023 02:25:30 -0500 Subject: [PATCH] Fix RGBGFX `-r` with `-d 1` (#1224) --- src/gfx/reverse.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gfx/reverse.cpp b/src/gfx/reverse.cpp index bede1b60..b7bbf19e 100644 --- a/src/gfx/reverse.cpp +++ b/src/gfx/reverse.cpp @@ -293,8 +293,9 @@ void reverse() { auto const &palette = palettes[palID]; for (uint8_t y = 0; y < 8; ++y) { // If vertically mirrored, fetch the bytes from the other end - uint8_t realY = attribute & 0x40 ? 7 - y : y; - uint8_t bitplane0 = tileData[realY * 2], bitplane1 = tileData[realY * 2 + 1]; + uint8_t realY = (attribute & 0x40 ? 7 - y : y) * options.bitDepth; + uint8_t bitplane0 = tileData[realY]; + uint8_t bitplane1 = tileData[realY + 1 % options.bitDepth]; if (attribute & 0x20) { // Handle horizontal flip bitplane0 = flipTable[bitplane0]; bitplane1 = flipTable[bitplane1];