mirror of https://github.com/mgba-emu/mgba.git
Core: Extend tile cache to return raw bits
This commit is contained in:
parent
cea83a5444
commit
f3b66397a2
|
@ -58,6 +58,8 @@ void mTileCacheSetPalette(struct mTileCache* cache, int palette);
|
|||
|
||||
const uint16_t* mTileCacheGetTile(struct mTileCache* cache, unsigned tileId, unsigned paletteId);
|
||||
const uint16_t* mTileCacheGetTileIfDirty(struct mTileCache* cache, struct mTileCacheEntry* entry, unsigned tileId, unsigned paletteId);
|
||||
const uint8_t* mTileCacheGetRawTile(struct mTileCache* cache, unsigned tileId);
|
||||
const uint16_t* mTileCacheGetPalette(struct mTileCache* cache, unsigned paletteId);
|
||||
|
||||
CXX_GUARD_END
|
||||
|
||||
|
|
|
@ -283,3 +283,27 @@ const uint16_t* mTileCacheGetTileIfDirty(struct mTileCache* cache, struct mTileC
|
|||
}
|
||||
return tile;
|
||||
}
|
||||
|
||||
const uint8_t* mTileCacheGetRawTile(struct mTileCache* cache, unsigned tileId) {
|
||||
unsigned bpp = cache->bpp;
|
||||
switch (bpp) {
|
||||
case 0:
|
||||
return NULL;
|
||||
default:
|
||||
return (uint8_t*) &cache->vram[tileId << (2 + bpp)];
|
||||
}
|
||||
}
|
||||
|
||||
const uint16_t* mTileCacheGetPalette(struct mTileCache* cache, unsigned paletteId) {
|
||||
unsigned bpp = cache->bpp;
|
||||
switch (bpp) {
|
||||
default:
|
||||
return NULL;
|
||||
case 1:
|
||||
return &cache->palette[paletteId << 2];
|
||||
case 2:
|
||||
return &cache->palette[paletteId << 4];
|
||||
case 3:
|
||||
return &cache->palette[paletteId << 8];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue