gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit ca4c321370f4c3947f7509e429b63db861d035e6 parent 2aeda94c55d5cbbcc2c37e0317ebccce64d98b36 Author: Toxa <untoxa@mail.ru> Date: Mon, 23 Aug 2021 18:47:31 +0300 png2asset: use of BANKREF/BANKREF_EXTERN Diffstat:
| M | gbdk-support/png2asset/png2asset.cpp | 12 | +++++++++--- |
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/gbdk-support/png2asset/png2asset.cpp b/gbdk-support/png2asset/png2asset.cpp @@ -580,18 +580,22 @@ int main(int argc, char *argv[]) fprintf(file, "#define METASPRITE_%s_H\n", data_name.c_str()); fprintf(file, "\n"); fprintf(file, "#include <stdint.h>\n"); + fprintf(file, "#include <gbdk/platform.h>\n"); + fprintf(file, "\n"); if(use_structs) { if(export_as_map) { fprintf(file, "#include \"TilesInfo.h\"\n"); fprintf(file, "#include \"MapInfo.h\"\n"); + fprintf(file, "\n"); fprintf(file, "extern const struct TilesInfo %s_tiles_info;\n", data_name.c_str()); fprintf(file, "extern const struct MapInfo %s;\n", data_name.c_str()); } else { fprintf(file, "#include \"MetaSpriteInfo.h\"\n"); + fprintf(file, "\n"); fprintf(file, "extern const struct MetaSpriteInfo %s;\n", data_name.c_str()); } } @@ -622,6 +626,8 @@ int main(int argc, char *argv[]) fprintf(file, "#define %s_PIVOT_H %d\n", data_name.c_str(), pivot_h); } fprintf(file, "\n"); + fprintf(file, "BANKREF_EXTERN(%s)\n", data_name.c_str()); + fprintf(file, "\n"); fprintf(file, "extern const uint16_t %s_palettes[%d];\n", data_name.c_str(), image.palettesize); fprintf(file, "extern const uint8_t %s_tiles[%d];\n", data_name.c_str(), (int)(tiles.size() * tile_h * 2)); @@ -652,8 +658,8 @@ int main(int argc, char *argv[]) printf("Error writing file"); return 1; } - - fprintf(file, "#pragma bank %d\n\n", bank); + + if (bank) fprintf(file, "#pragma bank %d\n\n", bank); fprintf(file, "//AUTOGENERATED FILE FROM png2asset\n\n"); @@ -662,7 +668,7 @@ int main(int argc, char *argv[]) fprintf(file, "#include <gbdk/metasprites.h>\n"); fprintf(file, "\n"); - fprintf(file, "const void __at(%d) __bank_%s;\n\n", bank, data_name.c_str()); + fprintf(file, "BANKREF(%s)\n\n", data_name.c_str()); fprintf(file, "const uint16_t %s_palettes[%d] = {\n", data_name.c_str(), image.palettesize); for(size_t i = 0; i < image.palettesize / 4; ++i)
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.