Common section parsing and binary parsing helpers matching Nintendo Nitro specifications.
More...
Go to the source code of this file.
Common section parsing and binary parsing helpers matching Nintendo Nitro specifications.
◆ Nitro_AbsInt()
| int Nitro_AbsInt |
( |
int |
value | ) |
|
Math helper returning absolute value of an integer.
- Parameters
-
- Returns
- Absolute integer value.
◆ Nitro_FindSection()
| int Nitro_FindSection |
( |
const u8 * |
data, |
|
|
size_t |
size, |
|
|
const char * |
magic, |
|
|
size_t * |
out_offset, |
|
|
u32 * |
out_size |
|
) |
| |
Searches for a section starting with a specific 4-character magic string.
- Parameters
-
| data | Raw file data buffer. |
| size | Buffer size in bytes. |
| magic | Section magic identifier to search for (e.g. "PLTT", "CHAR"). |
| out_offset | Destination pointer to store the section start offset. |
| out_size | Destination pointer to store the section size in bytes. |
- Returns
- 0 on success; negative value if the section is not found.
◆ Nitro_GetPrintableMagic()
| void Nitro_GetPrintableMagic |
( |
const u8 * |
data, |
|
|
size_t |
size, |
|
|
char |
out[5] |
|
) |
| |
Safely reads the first 4 bytes of a buffer and formats them as a null-terminated string.
- Parameters
-
| data | Data buffer. |
| size | Data size. |
| out | Destination char array buffer (must be at least 5 bytes). |
◆ Nitro_HasMagic()
| int Nitro_HasMagic |
( |
const u8 * |
data, |
|
|
size_t |
size, |
|
|
const char * |
magic |
|
) |
| |
Verifies if the buffer starts with the target 4-character magic signature.
- Parameters
-
| data | Data buffer pointer. |
| size | Buffer size in bytes. |
| magic | 4-character format magic string (e.g. "NCLR"). |
- Returns
- 1 if magic matches; 0 otherwise.
◆ Nitro_ReadS16LE()
| s16 Nitro_ReadS16LE |
( |
const u8 * |
p | ) |
|
Safely reads a little-endian signed 16-bit value.
- Parameters
-
- Returns
- Signed 16-bit integer.
◆ Nitro_ReadS32LE()
| s32 Nitro_ReadS32LE |
( |
const u8 * |
p | ) |
|
Safely reads a little-endian signed 32-bit value.
- Parameters
-
- Returns
- Signed 32-bit integer.