NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
types_nw4r.h
1#ifndef NW4R_TYPES_H
2#define NW4R_TYPES_H
3#include <types.h>
4
5#define NW4R_BYTEORDER_BIG 0xFEFF
6#define NW4R_BYTEORDER_LITTLE 0xFFFE
7
8#ifdef NW4R_LITTLE_ENDIAN
9#define NW4R_BYTEORDER_NATIVE NW4R_BYTEORDER_LITTLE
10#else
11#define NW4R_BYTEORDER_NATIVE NW4R_BYTEORDER_BIG
12#endif
13
14#define NW4R_VERSION(major, minor) ((major & 0xFF) << 8 | minor & 0xFF)
15
16#define NW4R_LIB_VERSION(NAME, ORIGINAL_DATE, ORIGINAL_TIME, ORIGINAL_CWCC) \
17 const char* NW4R_##NAME##_Version_ = \
18 "<< NW4R - " #NAME " \tfinal build: " ORIGINAL_DATE \
19 " " ORIGINAL_TIME " (" ORIGINAL_CWCC ") >>"
20
21#if defined(CHAR_BIT)
22#define CHAR_BIT_ CHAR_BIT
23#else
24#define CHAR_BIT_ 8 // most common; default
25#endif
26
27#define NW4R_BYTE_(byte_, offset_) \
28 (static_cast<unsigned char>(byte_) << CHAR_BIT_ * (offset_))
29
30#define NW4R_FOUR_BYTE(A, B, C, D) \
31 (NW4R_BYTE_(A, 3) | NW4R_BYTE_(B, 2) | NW4R_BYTE_(C, 1) | NW4R_BYTE_(D, 0))
32
33#define NW4R_FILE_VERSION(MAJOR, MINOR) \
34 (NW4R_BYTE_(MAJOR, 1) | NW4R_BYTE_(MINOR, 0))
35
36#endif