mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Add reverse_1bit RGBGFX test (#1555)
Fixes a bug to always use 2bpp `_data` in `TileData`
This commit is contained in:
@@ -712,6 +712,9 @@ static void hashBitplanes(uint16_t bitplanes, uint16_t &hash) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class TileData {
|
class TileData {
|
||||||
|
// Importantly, `TileData` is **always** 2bpp.
|
||||||
|
// If the active bit depth is 1bpp, all tiles are processed as 2bpp nonetheless, but emitted as 1bpp.
|
||||||
|
// This massively simplifies internal processing, since bit depth is always identical outside of I/O / serialization boundaries.
|
||||||
std::array<uint8_t, 16> _data;
|
std::array<uint8_t, 16> _data;
|
||||||
// The hash is a bit lax: it's the XOR of all lines, and every other nibble is identical
|
// The hash is a bit lax: it's the XOR of all lines, and every other nibble is identical
|
||||||
// if horizontal mirroring is in effect. It should still be a reasonable tie-breaker in
|
// if horizontal mirroring is in effect. It should still be a reasonable tie-breaker in
|
||||||
@@ -755,11 +758,9 @@ public:
|
|||||||
hashBitplanes(bitplanes, _hash);
|
hashBitplanes(bitplanes, _hash);
|
||||||
|
|
||||||
_data[writeIndex++] = bitplanes & 0xFF;
|
_data[writeIndex++] = bitplanes & 0xFF;
|
||||||
if (options.bitDepth == 2) {
|
|
||||||
_data[writeIndex++] = bitplanes >> 8;
|
_data[writeIndex++] = bitplanes >> 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
auto const &data() const { return _data; }
|
auto const &data() const { return _data; }
|
||||||
uint16_t hash() const { return _hash; }
|
uint16_t hash() const { return _hash; }
|
||||||
@@ -1032,7 +1033,14 @@ static void outputTileData(UniqueTiles const &tiles) {
|
|||||||
TileData const *tile = *iter;
|
TileData const *tile = *iter;
|
||||||
assume(tile->tileID == tileID);
|
assume(tile->tileID == tileID);
|
||||||
++tileID;
|
++tileID;
|
||||||
output->sputn(reinterpret_cast<char const *>(tile->data().data()), options.bitDepth * 8);
|
if (options.bitDepth == 2) {
|
||||||
|
output->sputn(reinterpret_cast<char const *>(tile->data().data()), 16);
|
||||||
|
} else {
|
||||||
|
assume(options.bitDepth == 1);
|
||||||
|
for (size_t y = 0; y < 8; ++y) {
|
||||||
|
output->sputc(tile->data()[y * 2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1
test/gfx/reverse_1bit.1bpp
Normal file
1
test/gfx/reverse_1bit.1bpp
Normal file
@@ -0,0 +1 @@
|
|||||||
|
@L血宇@
|
||||||
BIN
test/gfx/reverse_1bit.attrmap
Normal file
BIN
test/gfx/reverse_1bit.attrmap
Normal file
Binary file not shown.
3
test/gfx/reverse_1bit.flags
Normal file
3
test/gfx/reverse_1bit.flags
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
-m
|
||||||
|
-t reverse_1bit.tilemap
|
||||||
|
-a reverse_1bit.attrmap
|
||||||
BIN
test/gfx/reverse_1bit.tilemap
Normal file
BIN
test/gfx/reverse_1bit.tilemap
Normal file
Binary file not shown.
Reference in New Issue
Block a user