mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix sprite compositing when sprite tiles go out of bounds (fixes #2348)
This commit is contained in:
parent
71b616a9c2
commit
1b71a64c51
1
CHANGES
1
CHANGES
|
@ -31,6 +31,7 @@ Other fixes:
|
||||||
- GBA: Fix maximum tile ID in caching for 256-color modes
|
- GBA: Fix maximum tile ID in caching for 256-color modes
|
||||||
- Libretro: Fix crash when using Game Boy codes (fixes mgba.io/i/2281)
|
- Libretro: Fix crash when using Game Boy codes (fixes mgba.io/i/2281)
|
||||||
- Qt: Fix corrupted savestate and fatal error text
|
- Qt: Fix corrupted savestate and fatal error text
|
||||||
|
- Qt: Fix sprite compositing when sprite tiles go out of bounds (fixes mgba.io/i/2348)
|
||||||
Misc:
|
Misc:
|
||||||
- Core: Suspend runloop when a core crashes
|
- Core: Suspend runloop when a core crashes
|
||||||
- GBA I/O: Update KEYINPUT in internal I/O memory (fixes mgba.io/i/2235)
|
- GBA I/O: Update KEYINPUT in internal I/O memory (fixes mgba.io/i/2235)
|
||||||
|
|
|
@ -131,6 +131,7 @@ QImage AssetView::compositeMap(int map, mMapCacheEntry* mapStatus) {
|
||||||
|
|
||||||
QImage AssetView::compositeObj(const ObjInfo& objInfo) {
|
QImage AssetView::compositeObj(const ObjInfo& objInfo) {
|
||||||
mTileCache* tileCache = mTileCacheSetGetPointer(&m_cacheSet->tiles, objInfo.paletteSet);
|
mTileCache* tileCache = mTileCacheSetGetPointer(&m_cacheSet->tiles, objInfo.paletteSet);
|
||||||
|
unsigned maxTiles = mTileCacheSystemInfoGetMaxTiles(tileCache->sysConfig);
|
||||||
const color_t* rawPalette = mTileCacheGetPalette(tileCache, objInfo.paletteId);
|
const color_t* rawPalette = mTileCacheGetPalette(tileCache, objInfo.paletteId);
|
||||||
unsigned colors = 1 << objInfo.bits;
|
unsigned colors = 1 << objInfo.bits;
|
||||||
QVector<QRgb> palette;
|
QVector<QRgb> palette;
|
||||||
|
@ -142,10 +143,11 @@ QImage AssetView::compositeObj(const ObjInfo& objInfo) {
|
||||||
|
|
||||||
QImage image = QImage(QSize(objInfo.width * 8, objInfo.height * 8), QImage::Format_Indexed8);
|
QImage image = QImage(QSize(objInfo.width * 8, objInfo.height * 8), QImage::Format_Indexed8);
|
||||||
image.setColorTable(palette);
|
image.setColorTable(palette);
|
||||||
|
image.fill(0);
|
||||||
uchar* bits = image.bits();
|
uchar* bits = image.bits();
|
||||||
unsigned t = objInfo.tile;
|
unsigned t = objInfo.tile;
|
||||||
for (unsigned y = 0; y < objInfo.height; ++y) {
|
for (unsigned y = 0; y < objInfo.height && t < maxTiles; ++y) {
|
||||||
for (unsigned x = 0; x < objInfo.width; ++x, ++t) {
|
for (unsigned x = 0; x < objInfo.width && t < maxTiles; ++x, ++t) {
|
||||||
compositeTile(static_cast<const void*>(mTileCacheGetVRAM(tileCache, t)), bits, objInfo.width * 8, x * 8, y * 8, objInfo.bits);
|
compositeTile(static_cast<const void*>(mTileCacheGetVRAM(tileCache, t)), bits, objInfo.width * 8, x * 8, y * 8, objInfo.bits);
|
||||||
}
|
}
|
||||||
t += objInfo.stride - objInfo.width;
|
t += objInfo.stride - objInfo.width;
|
||||||
|
|
Loading…
Reference in New Issue