mirror of
https://github.com/red031000/nitrogfx.git
synced 2025-06-18 13:15:35 -04:00
NCER cellAttrs
This commit is contained in:
parent
9b05753c29
commit
649aa24a6f
7
gfx.c
7
gfx.c
@ -828,8 +828,11 @@ void WriteNtrCell(char *path, struct JsonToCellOptions *options)
|
||||
for (i = 0; i < options->cellCount * 0x10; i += 0x10)
|
||||
{
|
||||
KBECContents[i] = 0x01; //number of images
|
||||
KBECContents[i + 2] = options->cells[i / 0x10]->readOnly & 0xff; //unknown
|
||||
KBECContents[i + 3] = options->cells[i / 0x10]->readOnly >> 8;
|
||||
short cellAttrs = (options->cells[i / 0x10]->attributes.hFlip << 8) | (options->cells[i / 0x10]->attributes.vFlip << 9)
|
||||
| (options->cells[i / 0x10]->attributes.hvFlip << 10) | (options->cells[i / 0x10]->attributes.boundingRect << 11)
|
||||
| (options->cells[i / 0x10]->attributes.boundingSphereRadius & 0x3F);
|
||||
KBECContents[i + 2] = cellAttrs & 0xff; //cell attributes
|
||||
KBECContents[i + 3] = cellAttrs >> 8;
|
||||
KBECContents[i + 4] = (i / 0x10 * 6) & 0xff; //pointer to OAM data
|
||||
KBECContents[i + 5] = (i / 0x10 * 6) >> 8; //unlikely to be more than 16 bits, but there are 32 allocated, change if necessary
|
||||
KBECContents[i + 8] = options->cells[i / 0x10]->maxX & 0xff; //maxX
|
||||
|
19
json.c
19
json.c
@ -95,9 +95,24 @@ struct JsonToCellOptions *ParseNCERJson(char *path)
|
||||
if (i > options->cellCount - 1)
|
||||
FATAL_ERROR("Cell count is incorrect.\n");
|
||||
|
||||
cJSON *readOnly = cJSON_GetObjectItemCaseSensitive(cell, "readOnly");
|
||||
cJSON *cellAttrs = cJSON_GetObjectItemCaseSensitive(cell, "cellAttrs");
|
||||
|
||||
cJSON *hFlip = cJSON_GetObjectItemCaseSensitive(cellAttrs, "hFlip");
|
||||
cJSON *vFlip = cJSON_GetObjectItemCaseSensitive(cellAttrs, "vFlip");
|
||||
cJSON *hvFlip = cJSON_GetObjectItemCaseSensitive(cellAttrs, "hvFlip");
|
||||
|
||||
options->cells[i]->attributes.hFlip = GetBool(hFlip);
|
||||
options->cells[i]->attributes.vFlip = GetBool(vFlip);
|
||||
options->cells[i]->attributes.hvFlip = GetBool(hvFlip);
|
||||
|
||||
cJSON *boundingRect = cJSON_GetObjectItemCaseSensitive(cellAttrs, "boundingRect");
|
||||
|
||||
options->cells[i]->attributes.boundingRect = GetBool(boundingRect);
|
||||
|
||||
cJSON *boundingSphereRadius = cJSON_GetObjectItemCaseSensitive(cellAttrs, "boundingSphereRadius");
|
||||
|
||||
options->cells[i]->attributes.boundingSphereRadius = GetInt(boundingSphereRadius);
|
||||
|
||||
options->cells[i]->readOnly = (short)GetInt(readOnly);
|
||||
if (options->extended)
|
||||
{
|
||||
cJSON *maxX = cJSON_GetObjectItemCaseSensitive(cell, "maxX");
|
||||
|
10
options.h
10
options.h
@ -77,8 +77,16 @@ struct OAM {
|
||||
struct Attr2 attr2;
|
||||
};
|
||||
|
||||
struct CellAttributes {
|
||||
bool hFlip; // 1 << 8
|
||||
bool vFlip; // 1 << 9
|
||||
bool hvFlip; // 1 << 10
|
||||
bool boundingRect; // 1 << 11
|
||||
int boundingSphereRadius; // 1 << 0 (6 bits);
|
||||
};
|
||||
|
||||
struct Cell {
|
||||
short readOnly;
|
||||
struct CellAttributes attributes;
|
||||
short maxX;
|
||||
short maxY;
|
||||
short minX;
|
||||
|
Loading…
Reference in New Issue
Block a user