gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 49745617ac0605e491a949de8714c3dcabaefc59 parent 80d70eb512f959e2eb6363441862723b6e7282bf Author: fingerflinger <64179526+fingerflinger@users.noreply.github.com> Date: Sat, 22 Jun 2024 08:59:48 +0200 Palette Generation broken when using -source_tileset option (#698) * If the source tileset includes some of the same palette information, the exporter will exclude the redundant palettes. However, the exporter was checking if i != 0 to determine the first time through the loop, and this is not true in the case of the source_tileset excluding redundant palettes. This was generating a leading comma in the output, which causes a syntax error. * Changes per bbbbbr suggestions --------- Co-authored-by: Eric Vaughan <ericlvaughan@gmail.com> Diffstat:
| M | gbdk-support/png2asset/export_c_file.cpp | 6 | ++++-- |
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gbdk-support/png2asset/export_c_file.cpp b/gbdk-support/png2asset/export_c_file.cpp @@ -113,9 +113,11 @@ static void export_c_palette_data(PNG2AssetData* assetData, FILE* file) { if (!(assetData->args->use_structs) || (assetData->args->includeTileData)) { fprintf(file, "const palette_color_t %s_palettes[%d] = {\n", assetData->args->data_name.c_str(), (unsigned int)exportOpt.color_count); - for(size_t i = exportOpt.color_start / assetData->image.colors_per_pal; i < assetData->image.total_color_count / assetData->image.colors_per_pal; ++i) + const size_t palette_start = exportOpt.color_start / assetData->image.colors_per_pal; + const size_t total_palette_count = assetData->image.total_color_count / assetData->image.colors_per_pal; + for(size_t i = palette_start; i < total_palette_count; ++i) { - if(i != 0) + if(i > palette_start) fprintf(file, ",\n"); fprintf(file, "\t");
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.