summaryrefslogtreecommitdiff
path: root/tools/gbagfx/main.c
diff options
context:
space:
mode:
authorYamaArashi <shadow962@live.com>2015-11-24 01:41:14 -0800
committerYamaArashi <shadow962@live.com>2015-11-24 01:41:14 -0800
commit69d1b312f654abd550d350b5b1db29a5f6aba348 (patch)
treec339a3c1cb4a91e20f8a6abd1f5d9321d55312cf /tools/gbagfx/main.c
parent066d199fe32040a0110746dba145ece66bd50c20 (diff)
title screen background tiles and palettes
Diffstat (limited to 'tools/gbagfx/main.c')
-rw-r--r--tools/gbagfx/main.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/tools/gbagfx/main.c b/tools/gbagfx/main.c
index 56a1c2c7b..cc1e8f807 100644
--- a/tools/gbagfx/main.c
+++ b/tools/gbagfx/main.c
@@ -129,11 +129,36 @@ void HandleGbaToJascPaletteCommand(char *inputPath, char *outputPath, int argc U
WriteJascPalette(outputPath, &palette);
}
-void HandleJascToGbaPaletteCommand(char *inputPath, char *outputPath, int argc UNUSED, char **argv UNUSED)
+void HandleJascToGbaPaletteCommand(char *inputPath, char *outputPath, int argc, char **argv)
{
+ int numColors = 0;
+
+ for (int i = 3; i < argc; i++) {
+ char *option = argv[i];
+
+ if (strcmp(option, "-num_colors") == 0) {
+ if (i + 1 >= argc)
+ FATAL_ERROR("No number of colors following \"-num_colors\".\n");
+
+ i++;
+
+ if (!ParseNumber(argv[i], NULL, 10, &numColors))
+ FATAL_ERROR("Failed to parse number of colors.\n");
+
+ if (numColors < 1)
+ FATAL_ERROR("Number of colors must be positive.\n");
+ } else {
+ FATAL_ERROR("Unrecognized option \"%s\".\n", option);
+ }
+ }
+
struct Palette palette;
ReadJascPalette(inputPath, &palette);
+
+ if (numColors != 0)
+ palette.numColors = numColors;
+
WriteGbaPalette(outputPath, &palette);
}