gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 113367301f0fb6f0ada37af21a61fe7e00bc2b2e parent c4069d2db01314afafc65db71e330ca1af00e58b Author: bbbbbr <reg+github@roughhousing.com> Date: Thu, 16 Dec 2021 22:10:16 -0800 Merge pull request #292 from bbbbbr/png2asset_check_image_size png2asset: require image size to be an even multiple of tile size Diffstat:
| M | gbdk-support/png2asset/png2asset.cpp | 8 | ++++++++ |
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/gbdk-support/png2asset/png2asset.cpp b/gbdk-support/png2asset/png2asset.cpp @@ -16,6 +16,7 @@ void loadFile(vector<unsigned char>& buffer, const std::string& filename); bool export_as_map = false; bool use_map_attributes = false; size_t pal_size; +#define TILE_W 8 int tile_h; int bpp = 2; @@ -546,6 +547,13 @@ int main(int argc, char *argv[]) return 1; } + // Validate image dimensions + if( ((image32.w % TILE_W) != 0) || ((image32.h % tile_h) != 0) ) + { + printf("Error: Image size %d x %d isn't an even multiple of tile size %d x %d\n", image32.w, image32.h, TILE_W, tile_h); + return 1; + } + int* palettes_per_tile = new int[(image32.w / 8) * (image32.h /tile_h)]; vector< SetPal > palettes; for(unsigned int y = 0; y < image32.h; y += tile_h)
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.