mirror of https://github.com/mgba-emu/mgba.git
Core: Add some debug checks
This commit is contained in:
parent
405eafb969
commit
dbeff59c06
|
@ -194,6 +194,14 @@ static void _regenerateTile256(struct mTileCache* cache, color_t* tile, unsigned
|
||||||
static inline color_t* _tileLookup(struct mTileCache* cache, unsigned tileId, unsigned paletteId) {
|
static inline color_t* _tileLookup(struct mTileCache* cache, unsigned tileId, unsigned paletteId) {
|
||||||
if (mTileCacheConfigurationIsShouldStore(cache->config)) {
|
if (mTileCacheConfigurationIsShouldStore(cache->config)) {
|
||||||
unsigned tiles = mTileCacheSystemInfoGetMaxTiles(cache->sysConfig);
|
unsigned tiles = mTileCacheSystemInfoGetMaxTiles(cache->sysConfig);
|
||||||
|
#ifndef NDEBUG
|
||||||
|
if (tileId >= tiles) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
if (paletteId >= 1 << mTileCacheSystemInfoGetPaletteCount(cache->sysConfig)) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return &cache->cache[(tileId + paletteId * tiles) << 6];
|
return &cache->cache[(tileId + paletteId * tiles) << 6];
|
||||||
} else {
|
} else {
|
||||||
return cache->temporaryTile;
|
return cache->temporaryTile;
|
||||||
|
|
Loading…
Reference in New Issue