From e60b6b8f2357d65190bc351c192594e04ed20074 Mon Sep 17 00:00:00 2001 From: Steven Smith Date: Sun, 25 Jan 2015 18:24:32 -0800 Subject: [PATCH] Use array for regional ratings. --- source/3ds/smdh.h | 33 +++++++++++++-------------------- source/3ds/util.cpp | 20 ++++++++++---------- source/3ds/util.h | 2 +- 3 files changed, 24 insertions(+), 31 deletions(-) diff --git a/source/3ds/smdh.h b/source/3ds/smdh.h index 37646f6..564caec 100644 --- a/source/3ds/smdh.h +++ b/source/3ds/smdh.h @@ -24,25 +24,18 @@ typedef struct { u16 publisher[0x40] = {0}; } SMDHTitle; -typedef struct { - // TODO: values... - u8 cero = 0; - u8 esrb = 0; - u8 reserved0 = 0; - u8 usk = 0; - u8 pegiGen = 0; - u8 reserved1 = 0; - u8 pegiPrt = 0; - u8 pegiBbfc = 0; - u8 cob = 0; - u8 grb = 0; - u8 cgsrr = 0; - u8 reserved2 = 0; - u8 reserved3 = 0; - u8 reserved4 = 0; - u8 reserved5 = 0; - u8 reserved6 = 0; -} SMDHGameRatings; +// TODO: Provide values to set ratings to. +typedef enum { + CERO = 0, + ESRB = 1, + USK = 3, + PEGI_GEN = 4, + PEGI_PTR = 6, + PEGI_BBFC = 7, + COB = 8, + GRB = 9, + CGSRR = 10 +} SMDHGameRating; typedef enum { JAPAN = 0x01, @@ -71,7 +64,7 @@ typedef enum { } SMDHFlag; typedef struct { - SMDHGameRatings gameRatings; + u8 gameRatings[0x10] = {0}; u32 regionLock = REGION_FREE; u8 matchMakerId[0xC] = {0}; u32 flags = VISIBLE | ALLOW_3D | RECORD_USAGE; diff --git a/source/3ds/util.cpp b/source/3ds/util.cpp index 722493e..ded3509 100644 --- a/source/3ds/util.cpp +++ b/source/3ds/util.cpp @@ -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, 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) { if(format == RGB565) { float alpha = a / 255.0f; @@ -63,14 +73,4 @@ u16* image_to_tiles(const char* image, u32 width, u32 height, PixelFormat format } 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; - } - } } \ No newline at end of file diff --git a/source/3ds/util.h b/source/3ds/util.h index 63b0556..4556201 100644 --- a/source/3ds/util.h +++ b/source/3ds/util.h @@ -8,8 +8,8 @@ typedef enum { RGBA4444 } 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* 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 \ No newline at end of file