summaryrefslogtreecommitdiff
path: root/tools/nitrogfx/main.c
diff options
context:
space:
mode:
authorCleverking2003 <30466983+Cleverking2003@users.noreply.github.com>2020-07-19 20:57:35 +0300
committerGitHub <noreply@github.com>2020-07-19 20:57:35 +0300
commit7cd7b320d3336bdfe57b0a9d12174e32b242c088 (patch)
treea7e3ac1a7289b199ee975a3cb33ea43284d98d55 /tools/nitrogfx/main.c
parent453ccaf11724bb7e96f0e12e4520161f52056520 (diff)
parente312ef2117a7ffaffb05f84e2526b947a4591c69 (diff)
Merge pull request #241 from red031000/master
extract all trainer back sprites + palette indexes
Diffstat (limited to 'tools/nitrogfx/main.c')
-rw-r--r--tools/nitrogfx/main.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/nitrogfx/main.c b/tools/nitrogfx/main.c
index 942b0d90..35f59d0b 100644
--- a/tools/nitrogfx/main.c
+++ b/tools/nitrogfx/main.c
@@ -50,7 +50,7 @@ void ConvertNtrToPng(char *inputPath, char *outputPath, struct GbaToPngOptions *
if (options->paletteFilePath != NULL)
{
- ReadNtrPalette(options->paletteFilePath, &image.palette, options->bitDepth);
+ ReadNtrPalette(options->paletteFilePath, &image.palette, options->bitDepth, options->palIndex);
image.hasPalette = true;
}
else
@@ -205,6 +205,7 @@ void HandleNtrToPngCommand(char *inputPath, char *outputPath, int argc, char **a
options.width = 1;
options.metatileWidth = 1;
options.metatileHeight = 1;
+ options.palIndex = 1;
for (int i = 3; i < argc; i++)
{
@@ -223,6 +224,19 @@ void HandleNtrToPngCommand(char *inputPath, char *outputPath, int argc, char **a
{
options.hasTransparency = true;
}
+ else if (strcmp(option, "-palindex") == 0)
+ {
+ if (i + 1 >= argc)
+ FATAL_ERROR("No palette index following \"-palindex\".\n");
+
+ i++;
+
+ if (!ParseNumber(argv[i], NULL, 10, &options.palIndex))
+ FATAL_ERROR("Failed to parse palette index.\n");
+
+ if (options.width < 1)
+ FATAL_ERROR("Palette index must be positive.\n");
+ }
else if (strcmp(option, "-width") == 0)
{
if (i + 1 >= argc)
@@ -539,7 +553,7 @@ void HandleNtrToJascPaletteCommand(char *inputPath, char *outputPath, int argc,
}
}
- ReadNtrPalette(inputPath, &palette, bitdepth);
+ ReadNtrPalette(inputPath, &palette, bitdepth, 1);
WriteJascPalette(outputPath, &palette);
}