diff --git a/src/app/gfx/snes_tile.cc b/src/app/gfx/snes_tile.cc index 3b0a0895..b38ed6f2 100644 --- a/src/app/gfx/snes_tile.cc +++ b/src/app/gfx/snes_tile.cc @@ -149,14 +149,15 @@ std::vector Convert4bppTo3bpp(const std::vector& tiles) { return ConvertBpp(tiles, 4, 3); } -std::vector SnesTo8bppSheet(const std::vector& sheet, - int bpp) { +std::vector SnesTo8bppSheet(const std::vector& sheet, int bpp, + int num_sheets) { int xx = 0; // positions where we are at on the sheet int yy = 0; int pos = 0; int ypos = 0; int num_tiles = 64; int buffer_size = 0x1000; + if (bpp == 2) { bpp = 16; num_tiles = 128; @@ -169,6 +170,12 @@ std::vector SnesTo8bppSheet(const std::vector& sheet, } else if (bpp == 8) { bpp = 64; } + + if (num_sheets != 1) { + num_tiles *= num_sheets; + buffer_size *= num_sheets; + } + std::vector sheet_buffer_out(buffer_size); for (int i = 0; i < num_tiles; i++) { // for each tiles, 16 per line diff --git a/src/app/gfx/snes_tile.h b/src/app/gfx/snes_tile.h index 8f5263da..cf62af5c 100644 --- a/src/app/gfx/snes_tile.h +++ b/src/app/gfx/snes_tile.h @@ -19,7 +19,7 @@ constexpr uint8_t kGraphicsBitmap[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}; std::vector SnesTo8bppSheet(const std::vector& sheet, - int bpp); + int bpp, int num_sheets = 1); std::vector Bpp8SnesToIndexed(std::vector data, uint64_t bpp = 0);