From 7b97d7ce1573d6445a0f3a56bbe46dfadcfb8d82 Mon Sep 17 00:00:00 2001 From: Rangi Date: Thu, 9 Jul 2026 21:24:59 -0400 Subject: [PATCH] Fix RGBGFX crash on deduplicating transparent tiles --- src/gfx/process.cpp | 2 +- test/gfx/dedup_transparent.flags | 1 + test/gfx/dedup_transparent.out.2bpp | Bin 0 -> 48 bytes test/gfx/dedup_transparent.out.attrmap | Bin 0 -> 9 bytes test/gfx/dedup_transparent.out.pal | Bin 0 -> 8 bytes test/gfx/dedup_transparent.out.tilemap | Bin 0 -> 9 bytes test/gfx/dedup_transparent.png | Bin 0 -> 488 bytes 7 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 test/gfx/dedup_transparent.flags create mode 100644 test/gfx/dedup_transparent.out.2bpp create mode 100644 test/gfx/dedup_transparent.out.attrmap create mode 100644 test/gfx/dedup_transparent.out.pal create mode 100644 test/gfx/dedup_transparent.out.tilemap create mode 100644 test/gfx/dedup_transparent.png diff --git a/src/gfx/process.cpp b/src/gfx/process.cpp index c679fc17..0230f9ec 100644 --- a/src/gfx/process.cpp +++ b/src/gfx/process.cpp @@ -822,7 +822,7 @@ static UniqueTiles dedupTiles( attr.bank = 0; attr.tileID = 0; } else { - auto [tileID, matchType] = tiles.addTile({tile, palettes[mappings[attr.colorSetID]]}); + auto [tileID, matchType] = tiles.addTile({tile, palettes[attr.getPalID(mappings)]}); if (inputWithoutOutput && matchType == TileData::NOPE) { error( diff --git a/test/gfx/dedup_transparent.flags b/test/gfx/dedup_transparent.flags new file mode 100644 index 00000000..4bca84d6 --- /dev/null +++ b/test/gfx/dedup_transparent.flags @@ -0,0 +1 @@ +-m diff --git a/test/gfx/dedup_transparent.out.2bpp b/test/gfx/dedup_transparent.out.2bpp new file mode 100644 index 0000000000000000000000000000000000000000..d498b6885613bae5d3cc41740a2c165b9e078a12 GIT binary patch literal 48 ocmey*aM)&P)XcQTIuQKNaKQe7d_lj(ahb<_AK8B}|6xD_00vAC@c;k- literal 0 HcmV?d00001 diff --git a/test/gfx/dedup_transparent.out.attrmap b/test/gfx/dedup_transparent.out.attrmap new file mode 100644 index 0000000000000000000000000000000000000000..3ed7cece591bc882ecf2734d7c829ff15f24217f GIT binary patch literal 9 QcmZQzU|?`iP+(vH00JohfdBvi literal 0 HcmV?d00001 diff --git a/test/gfx/dedup_transparent.out.pal b/test/gfx/dedup_transparent.out.pal new file mode 100644 index 0000000000000000000000000000000000000000..6cd5231c36b7df00afbd0df9cfc7a615663725c5 GIT binary patch literal 8 PcmZQ*U|{%P|NlP#3;qNB literal 0 HcmV?d00001 diff --git a/test/gfx/dedup_transparent.out.tilemap b/test/gfx/dedup_transparent.out.tilemap new file mode 100644 index 0000000000000000000000000000000000000000..a9ababdd59dcb620854ce4e7392035437025ac82 GIT binary patch literal 9 QcmZQzWMX1qWMpCh001@s3IG5A literal 0 HcmV?d00001 diff --git a/test/gfx/dedup_transparent.png b/test/gfx/dedup_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..fb4e0776204d11c7175474112824fd1e531955b0 GIT binary patch literal 488 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM3?#3wJbMaAF%}28J29*~C-V}>VM%xNb!1@J z*w6hZkrl}24DbnY1=9cj{|A!A$C?X)6mvM1 zMG8<*vcxr_Bsf2%FBlnrvS1|u_AoC(M_WMpCx1kzDJoY~F-7S92)K_CH$LHc1dx~)K$ zGcZhGXJ7%UF)%VVU|aw(7o>-E0mQ6nKsE?40Zn28s|>QV0J5OE3=IrGvNxB{ntF0O zcRY|;;OXKRq7j^Xk&~~%fP>}0qyO@`4Y7GbYhMO9)apCw*s+)e2|ek2!5if8W>YZp znrYW}AAG_xwZ$x_apu96mcUOewiS({Yc9lXarkeNs#WItzs1mC+T4b}v6H+R+B$X$ o*Sz`Ld}GQ}u?_zj|A{pGU_7vuDN?ve%>(2PPgg&ebxsLQ0HJ4hPyhe` literal 0 HcmV?d00001