Use array for regional ratings.

This commit is contained in:
Steven Smith 2015-01-25 18:24:32 -08:00
parent df96656ff5
commit e60b6b8f23
3 changed files with 24 additions and 31 deletions

View file

@ -24,25 +24,18 @@ typedef struct {
u16 publisher[0x40] = {0}; u16 publisher[0x40] = {0};
} SMDHTitle; } SMDHTitle;
typedef struct { // TODO: Provide values to set ratings to.
// TODO: values... typedef enum {
u8 cero = 0; CERO = 0,
u8 esrb = 0; ESRB = 1,
u8 reserved0 = 0; USK = 3,
u8 usk = 0; PEGI_GEN = 4,
u8 pegiGen = 0; PEGI_PTR = 6,
u8 reserved1 = 0; PEGI_BBFC = 7,
u8 pegiPrt = 0; COB = 8,
u8 pegiBbfc = 0; GRB = 9,
u8 cob = 0; CGSRR = 10
u8 grb = 0; } SMDHGameRating;
u8 cgsrr = 0;
u8 reserved2 = 0;
u8 reserved3 = 0;
u8 reserved4 = 0;
u8 reserved5 = 0;
u8 reserved6 = 0;
} SMDHGameRatings;
typedef enum { typedef enum {
JAPAN = 0x01, JAPAN = 0x01,
@ -71,7 +64,7 @@ typedef enum {
} SMDHFlag; } SMDHFlag;
typedef struct { typedef struct {
SMDHGameRatings gameRatings; u8 gameRatings[0x10] = {0};
u32 regionLock = REGION_FREE; u32 regionLock = REGION_FREE;
u8 matchMakerId[0xC] = {0}; u8 matchMakerId[0xC] = {0};
u32 flags = VISIBLE | ALLOW_3D | RECORD_USAGE; u32 flags = VISIBLE | ALLOW_3D | RECORD_USAGE;

View file

@ -7,6 +7,16 @@ u8 TILE_ORDER[64] = { 0, 1, 8, 9, 2, 3, 10, 11, 16, 17, 24, 25, 18, 19, 26
32, 33, 40, 41, 34, 35, 42, 43, 48, 49, 56, 57, 50, 51, 58, 59, 32, 33, 40, 41, 34, 35, 42, 43, 48, 49, 56, 57, 50, 51, 58, 59,
36, 37, 44, 45, 38, 39, 46, 47, 52, 53, 60, 61, 54, 55, 62, 63 }; 36, 37, 44, 45, 38, 39, 46, 47, 52, 53, 60, 61, 54, 55, 62, 63 };
void utf8_to_utf16(u16* dst, const char* src, size_t max_len) {
size_t n = 0;
while(src[n]) {
dst[n] = (u16) src[n];
if(n++ >= max_len) {
return;
}
}
}
u16 pack_color(u8 r, u8 g, u8 b, u8 a, PixelFormat format) { u16 pack_color(u8 r, u8 g, u8 b, u8 a, PixelFormat format) {
if(format == RGB565) { if(format == RGB565) {
float alpha = a / 255.0f; float alpha = a / 255.0f;
@ -63,14 +73,4 @@ u16* image_to_tiles(const char* image, u32 width, u32 height, PixelFormat format
} }
return converted; return converted;
}
void utf8_to_utf16(u16* dst, const char* src, size_t max_len) {
size_t n = 0;
while(src[n]) {
dst[n] = (u16) src[n];
if(n++ >= max_len) {
return;
}
}
} }

View file

@ -8,8 +8,8 @@ typedef enum {
RGBA4444 RGBA4444
} PixelFormat; } PixelFormat;
void utf8_to_utf16(u16* dst, const char* src, size_t max_len);
u16 pack_color(u8 r, u8 g, u8 b, u8 a, PixelFormat format); u16 pack_color(u8 r, u8 g, u8 b, u8 a, PixelFormat format);
u16* image_to_tiles(const char* image, u32 width, u32 height, PixelFormat format, u32* size); u16* image_to_tiles(const char* image, u32 width, u32 height, PixelFormat format, u32* size);
void utf8_to_utf16(u16* dst, const char* src, size_t max_len);
#endif #endif