summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorred031000 <rubenru09@aol.com>2021-05-19 22:58:03 +0100
committerred031000 <rubenru09@aol.com>2021-05-19 22:58:03 +0100
commit73d208810e888514be6cb13bd34db9c8bc47032c (patch)
treec349b2aaa00b6913e3481aa5fdc52e71ce16a1b9
parent929c5c94cf404904ea4601e7c083c716f84ceca9 (diff)
implement nitrogfx ncer mapping type
-rw-r--r--files/poketool/icongra/poke_icon/.gitignore3
-rw-r--r--files/poketool/icongra/poke_icon/narc_0002.json1
-rw-r--r--files/poketool/icongra/poke_icon/narc_0004.json1
-rw-r--r--files/poketool/icongra/poke_icon/narc_0006.NCERbin202 -> 0 bytes
-rw-r--r--files/poketool/icongra/poke_icon/narc_0006.json68
-rw-r--r--filesystem.mk1
-rw-r--r--graphics_rules.mk3
-rw-r--r--tools/nitrogfx/gfx.c3
-rw-r--r--tools/nitrogfx/json.c3
-rw-r--r--tools/nitrogfx/options.h1
10 files changed, 79 insertions, 5 deletions
diff --git a/files/poketool/icongra/poke_icon/.gitignore b/files/poketool/icongra/poke_icon/.gitignore
index c80b7843..fccab7c8 100644
--- a/files/poketool/icongra/poke_icon/.gitignore
+++ b/files/poketool/icongra/poke_icon/.gitignore
@@ -1,6 +1,5 @@
narc_0000.NCLR
-narc_0002.NCER
-narc_0004.NCER
+*.NCER
narc_0007.NCGR
narc_0008.NCGR
narc_0009.NCGR
diff --git a/files/poketool/icongra/poke_icon/narc_0002.json b/files/poketool/icongra/poke_icon/narc_0002.json
index defb5b41..1750fa55 100644
--- a/files/poketool/icongra/poke_icon/narc_0002.json
+++ b/files/poketool/icongra/poke_icon/narc_0002.json
@@ -4,6 +4,7 @@
"imageHeight": 32,
"imageWidth": 32,
"cellCount": 2,
+ "mappingType": 0,
"cells": [
{
"readOnly": 2054,
diff --git a/files/poketool/icongra/poke_icon/narc_0004.json b/files/poketool/icongra/poke_icon/narc_0004.json
index 3d8b8b80..b8cae63a 100644
--- a/files/poketool/icongra/poke_icon/narc_0004.json
+++ b/files/poketool/icongra/poke_icon/narc_0004.json
@@ -4,6 +4,7 @@
"imageHeight": 32,
"imageWidth": 32,
"cellCount": 2,
+ "mappingType": 0,
"cells": [
{
"readOnly": 2054,
diff --git a/files/poketool/icongra/poke_icon/narc_0006.NCER b/files/poketool/icongra/poke_icon/narc_0006.NCER
deleted file mode 100644
index 19e6e054..00000000
--- a/files/poketool/icongra/poke_icon/narc_0006.NCER
+++ /dev/null
Binary files differ
diff --git a/files/poketool/icongra/poke_icon/narc_0006.json b/files/poketool/icongra/poke_icon/narc_0006.json
new file mode 100644
index 00000000..ce7f1d83
--- /dev/null
+++ b/files/poketool/icongra/poke_icon/narc_0006.json
@@ -0,0 +1,68 @@
+{
+ "labelEnabled": true,
+ "extended": true,
+ "imageHeight": 32,
+ "imageWidth": 32,
+ "cellCount": 2,
+ "mappingType": 1,
+ "cells": [
+ {
+ "readOnly": 2054,
+ "maxX": 15,
+ "maxY": 15,
+ "minX": 65520,
+ "minY": 65520,
+ "OAM": {
+ "Attr0": {
+ "YCoordinate": 240,
+ "Rotation": false,
+ "SizeDisable": false,
+ "Mode": 0,
+ "Mosaic": false,
+ "Colours": 16,
+ "Shape": 0
+ },
+ "Attr1": {
+ "XCoordinate": 496,
+ "RotationScaling": 0,
+ "Size": 2
+ },
+ "Attr2": {
+ "CharName": 0,
+ "Priority": 0,
+ "Palette": 0
+ }
+ }
+ },
+ {
+ "readOnly": 2054,
+ "maxX": 15,
+ "maxY": 15,
+ "minX": 65520,
+ "minY": 65520,
+ "OAM": {
+ "Attr0": {
+ "YCoordinate": 240,
+ "Rotation": false,
+ "SizeDisable": false,
+ "Mode": 0,
+ "Mosaic": false,
+ "Colours": 16,
+ "Shape": 0
+ },
+ "Attr1": {
+ "XCoordinate": 496,
+ "RotationScaling": 0,
+ "Size": 2
+ },
+ "Attr2": {
+ "CharName": 8,
+ "Priority": 0,
+ "Palette": 0
+ }
+ }
+ }
+ ],
+ "labels": ["CellAnime0", "CellAnime1", "CellAnime2", "CellAnime3", "CellAnime4", "CellAnime5"],
+ "labelCount": 6
+}
diff --git a/filesystem.mk b/filesystem.mk
index 2f8034cb..f06a5429 100644
--- a/filesystem.mk
+++ b/filesystem.mk
@@ -2589,6 +2589,7 @@ files/poketool/icongra/poke_icon.narc: \
files/poketool/icongra/poke_icon/narc_0000.NCLR \
files/poketool/icongra/poke_icon/narc_0002.NCER \
files/poketool/icongra/poke_icon/narc_0004.NCER \
+ files/poketool/icongra/poke_icon/narc_0006.NCER \
files/poketool/icongra/poke_icon/narc_0007.NCGR \
files/poketool/icongra/poke_icon/narc_0008.NCGR \
files/poketool/icongra/poke_icon/narc_0009.NCGR \
diff --git a/graphics_rules.mk b/graphics_rules.mk
index 5587bb68..d20020cd 100644
--- a/graphics_rules.mk
+++ b/graphics_rules.mk
@@ -921,7 +921,8 @@ NCLR_CLEAN_LIST := files/application/wifi_earth/wifi_earth/narc_0006.NCLR \
files/poketool/trgra/trfgra/narc_0194.NCLR \
NCER_CLEAN_LIST := files/poketool/icongra/poke_icon/narc_0002.NCER \
- files/poketool/icongra/poke_icon/narc_0004.NCER
+ files/poketool/icongra/poke_icon/narc_0004.NCER \
+ files/poketool/icongra/poke_icon/narc_0006.NCER
NSCR_CLEAN_LIST := files/demo/title/titledemo/narc_0000.NSCR \
files/demo/title/titledemo/narc_0008.NSCR \
diff --git a/tools/nitrogfx/gfx.c b/tools/nitrogfx/gfx.c
index 305fbeb2..f5ff30e7 100644
--- a/tools/nitrogfx/gfx.c
+++ b/tools/nitrogfx/gfx.c
@@ -774,8 +774,9 @@ void WriteNtrCell(char *path, struct JsonToCellOptions *options)
KBECHeader[4] = (size + 0x20) & 0xFF; //size
KBECHeader[5] = (size + 0x20) >> 8; //unlikely to be more than 16 bits, but there are 32 allocated, change if necessary
- fwrite(KBECHeader, 1, 0x20, fp);
+ KBECHeader[16] = (options->mappingType & 0xFF); //not possible to be more than 8 bits, though 32 are allocated
+ fwrite(KBECHeader, 1, 0x20, fp);
unsigned char *KBECContents = malloc(size);
diff --git a/tools/nitrogfx/json.c b/tools/nitrogfx/json.c
index aad325be..b825c363 100644
--- a/tools/nitrogfx/json.c
+++ b/tools/nitrogfx/json.c
@@ -51,16 +51,17 @@ struct JsonToCellOptions *ParseNCERJson(char *path)
cJSON *imageHeight = cJSON_GetObjectItemCaseSensitive(json, "imageHeight");
cJSON *imageWidth = cJSON_GetObjectItemCaseSensitive(json, "imageWidth");
cJSON *cellCount = cJSON_GetObjectItemCaseSensitive(json, "cellCount");
+ cJSON *mappingType = cJSON_GetObjectItemCaseSensitive(json, "mappingType");
options->labelEnabled = GetBool(labelBool);
options->extended = GetBool(extended);
options->imageHeight = GetInt(imageHeight);
options->imageWidth = GetInt(imageWidth);
options->cellCount = GetInt(cellCount);
+ options->mappingType = GetInt(mappingType);
options->cells = malloc(sizeof(struct Cell *) * options->cellCount);
-
if (options->labelEnabled)
{
cJSON *labelCount = cJSON_GetObjectItemCaseSensitive(json, "labelCount");
diff --git a/tools/nitrogfx/options.h b/tools/nitrogfx/options.h
index 780c83e6..66e9895d 100644
--- a/tools/nitrogfx/options.h
+++ b/tools/nitrogfx/options.h
@@ -74,6 +74,7 @@ struct Cell {
struct JsonToCellOptions {
bool labelEnabled;
bool extended;
+ int mappingType;
int imageHeight;
int imageWidth;
int cellCount;