diff --git a/src/tools/generate_boot_screen.cpp b/src/tools/generate_boot_screen.cpp index 6b6cbb52de..618392c837 100644 --- a/src/tools/generate_boot_screen.cpp +++ b/src/tools/generate_boot_screen.cpp @@ -133,7 +133,7 @@ writeHeader(const char* baseName, int width, int height, png_bytep* rowPtrs) if (x == width * 3 - 1 && y == height - 1) { fprintf(sOutput, "0x%02x\n};\n\n", row[x]); break; - } else if ((offset % 8) == 0) + } else if ((offset % 12) == 0) fprintf(sOutput, "0x%02x,\n\t", row[x]); else fprintf(sOutput, "0x%02x, ", row[x]); @@ -164,24 +164,54 @@ parseImage(const char* filename, const char* baseName) int main(int argc, char* argv[]) { - if (argc < 4) { + if (argc < 8) { printf("Usage:\n"); - printf("\t%s \n", + printf("\t%s " + " \n", argv[0]); return 0; } - const char* headerFileName = argv[3]; + int logoPlacementX = atoi(argv[2]); + int logoPlacementY = atoi(argv[3]); + int iconPlacementX = atoi(argv[5]); + int iconPlacementY = atoi(argv[6]); + if (logoPlacementX < 0 || logoPlacementX > 100) { + printf("Bad X placement for logo: %d%%\n", logoPlacementX); + return 1; + } + if (logoPlacementY < 0 || logoPlacementY > 100) { + printf("Bad Y placement for logo: %d%%\n\n", logoPlacementY); + return 1; + } + if (iconPlacementX < 0 || iconPlacementX > 100) { + printf("Bad X placement for icons: %d%%\n", iconPlacementX); + return 1; + } + if (iconPlacementY < 0 || iconPlacementY > 100) { + printf("Bad Y placement for icons: %d%%\n", iconPlacementY); + return 1; + } + const char* headerFileName = argv[7]; sOutput = fopen(headerFileName, "wb"); if (!sOutput) error("Could not open file \"%s\" for writing", headerFileName); - fputs("// This file was generated by the generate_boot_screen build tool." - "\n\n", sOutput); + fputs("// This file was generated by the generate_boot_screen Haiku build " + "tool.\n\n", sOutput); + + fprintf(sOutput, "static const int32 kLogoPlacementX = %d;\n", + logoPlacementX); + fprintf(sOutput, "static const int32 kLogoPlacementY = %d;\n", + logoPlacementY); + fprintf(sOutput, "static const int32 kIconPlacementX = %d;\n", + iconPlacementX); + fprintf(sOutput, "static const int32 kIconPlacementY = %d;\n\n", + iconPlacementY); parseImage(argv[1], "kSplashLogo"); - parseImage(argv[2], "kSplashIcons"); + parseImage(argv[4], "kSplashIcons"); fclose(sOutput); return 0;