diff options
Diffstat (limited to 'source/nds')
-rw-r--r-- | source/nds/bdf_font.c | 300 | ||||
-rw-r--r-- | source/nds/draw.h | 118 | ||||
-rw-r--r-- | source/nds/gui.c | 38 | ||||
-rw-r--r-- | source/nds/message.h | 2 |
4 files changed, 240 insertions, 218 deletions
diff --git a/source/nds/bdf_font.c b/source/nds/bdf_font.c index 5da57e3..b1e7ccd 100644 --- a/source/nds/bdf_font.c +++ b/source/nds/bdf_font.c @@ -27,13 +27,13 @@ #include "gui.h" -#define BDF_VERDANA "SYSTEM/verdana.bdf" +#define BDF_PICTOCHAT "SYSTEM/Pictochat-16.bdf" #define BDF_SONG "SYSTEM/song.bdf" -#define ODF_VERDANA "SYSTEM/verdana.odf" +#define ODF_PICTOCHAT "SYSTEM/Pictochat-16.odf" #define ODF_SONG "SYSTEM/song.odf" -#define HAVE_ODF -//#define DUMP_ODF +#define HAVE_ODF // Define this if you have generated Pictochat-16.odf [Neb] +// #define DUMP_ODF // Define this if you want to regenerate Pictochat-16.odf [Neb] #define BDF_LIB_NUM 2 #define ODF_VERSION "1.0" @@ -49,21 +49,24 @@ static u32 fonts_max_height; static u32 bitmap_code(unsigned char *code, unsigned char *bitmap) { unsigned char *map; - u32 a, b, len; + u8 a, b; + u32 len; len= 0; map= (unsigned char*)bitmap; while(*map) { - //character to number, we assume the character can convert to number! + // One hex character represents the state of 4 successive pixels if(*map != 0x0A) { - if(*map <= 0x39) a= *map - 0x30; - else a= *map - 0x37; + if (*map <= '9') a= *map - '0'; + else if (*map <= 'F') a= *map - 'A' + 10; + else if (*map <= 'f') a= *map - 'a' + 10; map++; - if(*map <= 0x39) b= *map - 0x30; - else b= *map - 0x37; + if (*map <= '9') b= *map - '0'; + else if (*map <= 'F') b= *map - 'A' + 10; + else if (*map <= 'f') b= *map - 'a' + 10; *code++ = (a << 4) | b; len++; @@ -108,7 +111,7 @@ static u32 hatoi(char *string) /* * example * -* STARTCHAR 2264 +* STARTCHAR <arbitrary number or name> * ENCODING 8804 * SWIDTH 840 0 * DWIDTH 14 0 @@ -202,8 +205,17 @@ static int parse_bdf(char *filename, u32 start, u32 span, struct bdflibinfo *bdf pt += 6; ret= atoi(pt); - bdflibinfop -> start= start; - bdflibinfop -> span= span; + if (method == 1) + bdflibinfop -> start= start; + switch (method) { + case 0: + default: + bdflibinfop -> span= span + start; + break; + case 1: + bdflibinfop -> span= span; + break; + } //construct bdf font information bdffontp= (struct bdffont*)malloc(span * sizeof(struct bdffont)); @@ -241,14 +253,7 @@ static int parse_bdf(char *filename, u32 start, u32 span, struct bdflibinfo *bdf } if(!(strncasecmp(string, "STARTCHAR ", 10))) { - i= hatoi(pt +10); - if(i < start) continue; - else if(i < end) break; - else //Not found the start - { - ret= -7; - goto parse_bdf_error; - } + break; } } @@ -266,7 +271,7 @@ static int parse_bdf(char *filename, u32 start, u32 span, struct bdflibinfo *bdf pt= string + 9; index= atoi(pt); - if(index >= end) break; + if(index < start || index >= end) break; if(method == 0) i= index; else if(method == 1) i= index-start; @@ -534,15 +539,15 @@ int BDF_font_init(void) fonts_max_height= 0; #ifndef HAVE_ODF - sprintf(tmp_path, "%s/%s", main_path, BDF_VERDANA); - err= parse_bdf(tmp_path, 0, 128, &bdflib_info[0], 0); + sprintf(tmp_path, "%s/%s", main_path, BDF_PICTOCHAT); + err= parse_bdf(tmp_path, 32 /* from SPACE */, 8564 /* to one past the last character, "DOWNWARDS ARROW" */, &bdflib_info[0], 1); if(err < 0) { printf("BDF 0 initial error: %d\n", err); return -1; } #else - sprintf(tmp_path, "%s/%s", main_path, ODF_VERDANA); + sprintf(tmp_path, "%s/%s", main_path, ODF_PICTOCHAT); err= init_from_odf(tmp_path, &bdflib_info[0]); if(err < 0) { @@ -556,7 +561,7 @@ int BDF_font_init(void) fonts_max_height = bdflib_info[0].height; #ifdef DUMP_ODF - sprintf(tmp_path, "%s/%s", main_path, BDF_VERDANA); + sprintf(tmp_path, "%s/%s", main_path, BDF_PICTOCHAT); err= dump2odf(tmp_path, &bdflib_info[0]); if(err < 0) { @@ -613,7 +618,7 @@ void BDF_font_release(void) } } -/*----------------------------------------------------------------------------- +/*---------------------------------------------------------------------------- //16-bit color // Unicode Character // back is background, 0x8000 is transparence, other are visable colors @@ -626,26 +631,25 @@ u32 BDF_render16_ucs(void* screen_address, u32 screen_w, u32 v_align, u32 back, unsigned char cc; struct bdffont *bdffontp; - if(ch < 128) - { - bdffontp= bdflib_info[0].fonts; - fonts_height= bdflib_info[0].height; - } - else if(bdflib_info[1].fonts != NULL) - { - k= bdflib_info[1].start; - m= k + bdflib_info[1].span; - if(ch >= k && ch < m) - { + int font_num; + bool found = 0; + for (font_num = 0; font_num < BDF_LIB_NUM && !found; font_num++) { + if(bdflib_info[font_num].fonts != NULL) + { + k = bdflib_info[font_num].start; + if (ch < k) + continue; + m = k + bdflib_info[font_num].span; + if (ch >= m) + continue; ch -= k; - bdffontp= bdflib_info[1].fonts; - fonts_height= bdflib_info[0].height; - } - else - return 8; - } - else - return 8; + bdffontp= bdflib_info[font_num].fonts; + fonts_height= bdflib_info[font_num].height; + found = 1; + } + } + if (!found) + return 8; // the width of an undefined character, not an error code width= bdffontp[ch].dwidth >> 16; ret= width; @@ -715,6 +719,27 @@ u32 BDF_render16_ucs(void* screen_address, u32 screen_w, u32 v_align, u32 back, return ret; } +/* Returns the width, in pixels, of a character given its UCS-16 codepoint. */ +u32 BDF_width16_ucs(u16 ch) +{ + u32 k, ret; + + int font_num; + for (font_num = 0; font_num < BDF_LIB_NUM; font_num++) { + if(bdflib_info[font_num].fonts != NULL) + { + k = bdflib_info[font_num].start; + if (ch < k) + continue; + if (ch > k + bdflib_info[font_num].span) + continue; + ch -= k; + return bdflib_info[font_num].fonts[ch].dwidth >> 16; + } + } + return 8; // the width of an undefined character, not an error code +} + /*----------------------------------------------------------------------------- //16-bit color // ASCII Character @@ -837,101 +862,101 @@ void BDF_render_string(void* screen_address, u32 x, u32 y, u32 back, u32 front, /*----------------------------------------------------------------------------- ------------------------------------------------------------------------------*/ -char* utf8decode(char *utf8, u16 *ucs)
-{
- unsigned char c = *utf8++;
- unsigned long code;
- int tail = 0;
-
- if ((c <= 0x7f) || (c >= 0xc2)) {
- /* Start of new character. */
- if (c < 0x80) { /* U-00000000 - U-0000007F, 1 byte */
- code = c;
- } else if (c < 0xe0) { /* U-00000080 - U-000007FF, 2 bytes */
- tail = 1;
- code = c & 0x1f;
- } else if (c < 0xf0) { /* U-00000800 - U-0000FFFF, 3 bytes */
- tail = 2;
- code = c & 0x0f;
- } else if (c < 0xf5) { /* U-00010000 - U-001FFFFF, 4 bytes */
- tail = 3;
- code = c & 0x07;
- } else {
- /* Invalid size. */
- code = 0;
- }
-
- while (tail-- && ((c = *utf8++) != 0)) {
- if ((c & 0xc0) == 0x80) {
- /* Valid continuation character. */
- code = (code << 6) | (c & 0x3f);
-
- } else {
- /* Invalid continuation char */
- code = 0xfffd;
- utf8--;
- break;
- }
- }
- } else {
- /* Invalid UTF-8 char */
- code = 0;
- }
- /* currently we don't support chars above U-FFFF */
- *ucs = (code < 0x10000) ? code : 0;
- return utf8;
-}
-
-static u8 utf8_ucs2(const char *utf8, u16 *ucs)
+char* utf8decode(char *utf8, u16 *ucs) +{ + unsigned char c = *utf8++; + unsigned long code; + int tail = 0; + + if ((c <= 0x7f) || (c >= 0xc2)) { + /* Start of new character. */ + if (c < 0x80) { /* U-00000000 - U-0000007F, 1 byte */ + code = c; + } else if (c < 0xe0) { /* U-00000080 - U-000007FF, 2 bytes */ + tail = 1; + code = c & 0x1f; + } else if (c < 0xf0) { /* U-00000800 - U-0000FFFF, 3 bytes */ + tail = 2; + code = c & 0x0f; + } else if (c < 0xf5) { /* U-00010000 - U-001FFFFF, 4 bytes */ + tail = 3; + code = c & 0x07; + } else { + /* Invalid size. */ + code = 0; + } + + while (tail-- && ((c = *utf8++) != 0)) { + if ((c & 0xc0) == 0x80) { + /* Valid continuation character. */ + code = (code << 6) | (c & 0x3f); + + } else { + /* Invalid continuation char */ + code = 0xfffd; + utf8--; + break; + } + } + } else { + /* Invalid UTF-8 char */ + code = 0; + } + /* currently we don't support chars above U-FFFF */ + *ucs = (code < 0x10000) ? code : 0; + return utf8; +} + +static u8 utf8_ucs2(const char *utf8, u16 *ucs) { char *pt = (char*)utf8; -
- while(*pt !='\0')
- {
- pt = utf8decode(pt, ucs++);
- }
- *ucs = '\0';
- return 0;
-}
-
-static u32 ucslen(const u16 *ucs)
-{
+ + while(*pt !='\0') + { + pt = utf8decode(pt, ucs++); + } + *ucs = '\0'; + return 0; +} + +static u32 ucslen(const u16 *ucs) +{ u32 len = 0; -
- while(ucs[len] != '\0')
- len++;
- return len;
+ + while(ucs[len] != '\0') + len++; + return len; } unsigned char* skip_utf8_unit(unsigned char* utf8, unsigned int num) { while(num--) { - unsigned char c = *utf8++;
- int tail = 0;
- if ((c <= 0x7f) || (c >= 0xc2)) {
- /* Start of new character. */
- if (c < 0x80) { /* U-00000000 - U-0000007F, 1 byte */
- } else if (c < 0xe0) { /* U-00000080 - U-000007FF, 2 bytes */
- tail = 1;
- } else if (c < 0xf0) { /* U-00000800 - U-0000FFFF, 3 bytes */
- tail = 2;
- } else if (c < 0xf5) { /* U-00010000 - U-001FFFFF, 4 bytes */
- tail = 3;
- } else { /* Invalid size. */
- }
-
- while (tail-- && ((c = *utf8++) != 0)) {
- if ((c & 0xc0) != 0x80) {
- /* Invalid continuation char */
- utf8--;
- break;
- }
- }
+ unsigned char c = *utf8++; + int tail = 0; + if ((c <= 0x7f) || (c >= 0xc2)) { + /* Start of new character. */ + if (c < 0x80) { /* U-00000000 - U-0000007F, 1 byte */ + } else if (c < 0xe0) { /* U-00000080 - U-000007FF, 2 bytes */ + tail = 1; + } else if (c < 0xf0) { /* U-00000800 - U-0000FFFF, 3 bytes */ + tail = 2; + } else if (c < 0xf5) { /* U-00010000 - U-001FFFFF, 4 bytes */ + tail = 3; + } else { /* Invalid size. */ + } + + while (tail-- && ((c = *utf8++) != 0)) { + if ((c & 0xc0) != 0x80) { + /* Invalid continuation char */ + utf8--; + break; + } + } } } - /* currently we don't support chars above U-FFFF */
+ /* currently we don't support chars above U-FFFF */ return utf8; } @@ -971,10 +996,9 @@ void BDF_render_mix(void* screen_address, u32 screen_w, u32 x, u32 y, u32 v_alig continue; } - if(unicode < 128) - cmp = bdf_fontp[0][unicode].dwidth>>16; - else if(unicode >= start && unicode < end) - cmp = bdf_fontp[1][unicode -start].dwidth>>16; + /* If the text would go beyond the end of the line, go back to the + * start instead. */ + cmp = BDF_width16_ucs(unicode); if((screenp+cmp) >= line_start) { @@ -1074,10 +1098,7 @@ u32 BDF_cut_unicode(u16 *unicodes, u32 len, u32 width, u32 direction) while(len > 0) { unicode= unicodes[i]; - if(unicode < 128) - xw += bdf_fontp[0][unicode].dwidth>>16; - else if(unicode >= start && unicode < end) - xw += bdf_fontp[1][unicode -start].dwidth>>16; + xw += BDF_width16_ucs(unicode); if(xw >= width) break; i += direction; @@ -1096,10 +1117,7 @@ u32 BDF_cut_unicode(u16 *unicodes, u32 len, u32 width, u32 direction) while(len-- > 0) { unicode= unicodes[i]; - if(unicode < 128) - xw += bdf_fontp[0][unicode].dwidth>>16; - else if(unicode >= start && unicode < end) - xw += bdf_fontp[1][unicode -start].dwidth>>16; + xw += BDF_width16_ucs(unicode); i += direction; } diff --git a/source/nds/draw.h b/source/nds/draw.h index 3bdf5be..f40aa23 100644 --- a/source/nds/draw.h +++ b/source/nds/draw.h @@ -17,8 +17,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef __DRAW_H__
-#define __DRAW_H__
+#ifndef __DRAW_H__ +#define __DRAW_H__ #include "ds2_types.h" #include "ds2io.h" @@ -27,12 +27,12 @@ #define NDS_SCREEN_WIDTH 256 #define NDS_SCREEN_HEIGHT 192 #define NDS_SCREEN_SIZE (NDS_SCREEN_WIDTH*NDS_SCREEN_HEIGHT) -
-#define COLOR16(red, green, blue) ((blue << 10) | (green << 5) | red)
-#define GET_R16(color) (color & 0x1f)
-#define GET_G16(color) ((color >> 5) & 0x1f)
-#define GET_B16(color) ((color >> 10)& 0x1f)
-#define COLOR32(red, green, blue) (0xff000000 | ((blue & 0xff) << 16) | ((green & 0xff) << 8) | (red & 0xff))
+ +#define COLOR16(red, green, blue) ((blue << 10) | (green << 5) | red) +#define GET_R16(color) (color & 0x1f) +#define GET_G16(color) ((color >> 5) & 0x1f) +#define GET_B16(color) ((color >> 10)& 0x1f) +#define COLOR32(red, green, blue) (0xff000000 | ((blue & 0xff) << 16) | ((green & 0xff) << 8) | (red & 0xff)) #define RGB24_15(pixel) ((((*pixel) & 0xF8) << 7) |\ (((*(pixel+1)) & 0xF8) << 2) |\ @@ -44,36 +44,36 @@ #define PRINT_STRING(screen, str, fg_color, x, y) \ - BDF_render_string(screen, x, y, COLOR_TRANS, fg_color, str) \ + BDF_render_mix(screen, SCREEN_WIDTH, x, y, 0, COLOR_TRANS, fg_color, str) \ #define PRINT_STRING_SHADOW(screen, str, fg_color, x, y) \ - BDF_render_string(screen, x+1, y+1, 0, 0, str); \ - BDF_render_string(screen, x, y, 0, 0, str) \ + BDF_render_mix(screen, SCREEN_WIDTH, x+1, y+1, 0, 0, 0, str); \ + BDF_render_mix(screen, SCREEN_WIDTH, x, y, 0, 0, 0, str) \ #define PRINT_STRING_BG(screen, str, fg_color, bg_color, x, y) \ - BDF_render_string(screen, x, y, bg_color, fg_color, str) \ + BDF_render_mix(screen, SCREEN_WIDTH, x, y, 0, bg_color, fg_color, str) \ + +// #define PRINT_STRING_BG_UTF8(screen, utf8, fg_color, bg_color, x, y) \ +// BDF_render_mix(screen, SCREEN_WIDTH, x, y, 0, bg_color, fg_color, utf8) \ -#define PRINT_STRING_BG_UTF8(screen, utf8, fg_color, bg_color, x, y) \ - BDF_render_mix(screen, SCREEN_WIDTH, x, y, 0, bg_color, fg_color, utf8) \ -
//colors -#define COLOR_TRANS COLOR16(31, 31, 63)
-#define COLOR_WHITE COLOR16(31, 31, 31)
-#define COLOR_BLACK COLOR16( 0, 0, 0)
-#define COLOR_TEXT COLOR16(31, 31, 31)
-#define COLOR_PROGRESS_TEXT COLOR16( 0, 0, 0)
-#define COLOR_PROGRESS_BAR COLOR16(15, 15, 15)
-#define COLOR_ERROR COLOR16(31, 0, 0)
-#define COLOR_BG COLOR16(2, 4, 10)
-#define COLOR_BG32 COLOR32(2*8, 4*8, 10*8)
-#define COLOR_ROM_INFO COLOR16(22, 18, 26)
-#define COLOR_ACTIVE_ITEM COLOR16(31, 31, 31)
-#define COLOR_INACTIVE_ITEM COLOR16(13, 20, 18)
-#define COLOR_HELP_TEXT COLOR16(16, 20, 24)
-#define COLOR_DIALOG COLOR16(31, 31, 31)
-#define COLOR_DIALOG_SHADOW COLOR16( 0, 2, 8)
-#define COLOR_FRAME COLOR16( 0, 0, 0)
+#define COLOR_TRANS COLOR16(31, 31, 63) +#define COLOR_WHITE COLOR16(31, 31, 31) +#define COLOR_BLACK COLOR16( 0, 0, 0) +#define COLOR_TEXT COLOR16(31, 31, 31) +#define COLOR_PROGRESS_TEXT COLOR16( 0, 0, 0) +#define COLOR_PROGRESS_BAR COLOR16(15, 15, 15) +#define COLOR_ERROR COLOR16(31, 0, 0) +#define COLOR_BG COLOR16(2, 4, 10) +#define COLOR_BG32 COLOR32(2*8, 4*8, 10*8) +#define COLOR_ROM_INFO COLOR16(22, 18, 26) +#define COLOR_ACTIVE_ITEM COLOR16(31, 31, 31) +#define COLOR_INACTIVE_ITEM COLOR16(13, 20, 18) +#define COLOR_HELP_TEXT COLOR16(16, 20, 24) +#define COLOR_DIALOG COLOR16(31, 31, 31) +#define COLOR_DIALOG_SHADOW COLOR16( 0, 2, 8) +#define COLOR_FRAME COLOR16( 0, 0, 0) #define COLOR_YESNO_TEXT COLOR16( 0, 0, 0) #define COLOR_GREEN COLOR16( 0, 31, 0 ) #define COLOR_GREEN1 COLOR16( 0, 24, 0 ) @@ -81,14 +81,14 @@ #define COLOR_GREEN3 COLOR16( 0, 12, 0 ) #define COLOR_GREEN4 COLOR16( 0, 6, 0 ) #define COLOR_RED COLOR16( 31, 0, 0 ) -#define COLOR_MSSG COLOR16( 16, 8, 29)
-/******************************************************************************
- *
+#define COLOR_MSSG COLOR16( 16, 8, 29) +/****************************************************************************** + * ******************************************************************************/ #ifdef __cplusplus extern "C" { #endif -
+ struct background{ char bgname[128]; char bgbuffer[256*192*2]; @@ -151,17 +151,17 @@ extern struct gui_iconlist gui_icon_list[]; #define ICON_CHTFILE gui_icon_list[38] #define ICON_MSG gui_icon_list[39] #define ICON_BUTTON gui_icon_list[40] -
-/******************************************************************************
- *
- ******************************************************************************/
+ +/****************************************************************************** + * + ******************************************************************************/ extern void print_string_center(void* screen_addr, u32 sy, u32 color, u32 bg_color, char *str); -extern void print_string_shadow_center(void* screen_addr, u32 sy, u32 color, char *str);
-extern void hline(u32 sx, u32 ex, u32 y, u32 color);
-extern void hline_alpha(u32 sx, u32 ex, u32 y, u32 color, u32 alpha);
-extern void vline(u32 x, u32 sy, u32 ey, u32 color);
-extern void vline_alpha(u32 x, u32 sy, u32 ey, u32 color, u32 alpha);
-extern void drawbox(void* screen_address, u32 sx, u32 sy, u32 ex, u32 ey, u32 color);
+extern void print_string_shadow_center(void* screen_addr, u32 sy, u32 color, char *str); +extern void hline(u32 sx, u32 ex, u32 y, u32 color); +extern void hline_alpha(u32 sx, u32 ex, u32 y, u32 color, u32 alpha); +extern void vline(u32 x, u32 sy, u32 ey, u32 color); +extern void vline_alpha(u32 x, u32 sy, u32 ey, u32 color, u32 alpha); +extern void drawbox(void* screen_address, u32 sx, u32 sy, u32 ex, u32 ey, u32 color); extern void drawboxfill(void* screen_address, u32 sx, u32 sy, u32 ex, u32 ey, u32 color); extern void draw_selitem(void* screen_address, u32 x, u32 y, u32 color, u32 active); extern void draw_message(void* screen_address, u16 *screen_bg, u32 sx, u32 sy, u32 ex, u32 ey, @@ -173,19 +173,19 @@ extern void draw_string_vcenter(void* screen_address, u32 sx, u32 sy, u32 width, extern u32 draw_hscroll_init(void* screen_address, u32 sx, u32 sy, u32 width, u32 color_bg, u32 color_fg, char *string); extern u32 draw_hscroll(u32 index, s32 scroll_val); -extern void draw_hscroll_over(u32 index);
-extern void boxfill_alpha(u32 sx, u32 sy, u32 ex, u32 ey, u32 color, u32 alpha);
-extern void init_progress(enum SCREEN_ID screen, u32 total, char *text);
-extern void update_progress(void);
-extern void show_progress(char *text);
-extern void scrollbar(void* screen_addr, u32 sx, u32 sy, u32 ex, u32 ey, u32 all, u32 view, u32 now);
+extern void draw_hscroll_over(u32 index); +extern void boxfill_alpha(u32 sx, u32 sy, u32 ex, u32 ey, u32 color, u32 alpha); +extern void init_progress(enum SCREEN_ID screen, u32 total, char *text); +extern void update_progress(void); +extern void show_progress(char *text); +extern void scrollbar(void* screen_addr, u32 sx, u32 sy, u32 ex, u32 ey, u32 all, u32 view, u32 now); extern u32 yesno_dialog(char *text); -extern u32 draw_yesno_dialog(enum SCREEN_ID screen, u32 sy, char *yes, char *no);
-extern void msg_screen_init(const char *title);
-extern void msg_screen_draw();
-extern void msg_printf(const char *text, ...);
-extern void msg_screen_clear(void);
-extern void msg_set_text_color(u32 color);
+extern u32 draw_yesno_dialog(enum SCREEN_ID screen, u32 sy, char *yes, char *no); +extern void msg_screen_init(const char *title); +extern void msg_screen_draw(); +extern void msg_printf(const char *text, ...); +extern void msg_screen_clear(void); +extern void msg_set_text_color(u32 color); extern int icon_init(u32 language_id); extern int gui_change_icon(u32 language_id); @@ -203,5 +203,5 @@ extern void blit_to_screen(void* screen_addr, u16 *src, u32 w, u32 h, u32 dest_x } #endif -#endif //__DRAW_H__
-
+#endif //__DRAW_H__ + diff --git a/source/nds/gui.c b/source/nds/gui.c index af04c74..b1b9ce5 100644 --- a/source/nds/gui.c +++ b/source/nds/gui.c @@ -40,10 +40,11 @@ char rom_path[MAX_PATH]; char gamepak_name[MAX_PATH]; char gcheat_filename[MAX_PATH]; -char *lang[2] = +char *lang[3] = { "English", // 0 "简体中文", // 1 + "Français", // 2 }; /****************************************************************************** @@ -1937,7 +1938,7 @@ u32 menu(u16 *screen) else color= COLOR_INACTIVE_ITEM; - PRINT_STRING_BG_UTF8(down_screen_addr, line_buffer, color, COLOR_TRANS, 23, 40 + line[i]*27); + PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, 23, 40 + line[i]*27); } int slot_index; @@ -1948,7 +1949,7 @@ u32 menu(u16 *screen) slot_index= get_savestate_slot(); sprintf(line_buffer, "%d", (slot_index+2) > SAVE_STATE_SLOT_NUM ? SAVE_STATE_SLOT_NUM : (slot_index+2)); - PRINT_STRING_BG_UTF8(down_screen_addr, line_buffer, COLOR_INACTIVE_ITEM, COLOR_TRANS, 146, 40 + 0*27); + PRINT_STRING_BG(down_screen_addr, line_buffer, COLOR_INACTIVE_ITEM, COLOR_TRANS, 146, 40 + 0*27); if(current_option_num == 1) selected = slot_index+1; @@ -2006,7 +2007,7 @@ u32 menu(u16 *screen) else color= COLOR_INACTIVE_ITEM; - PRINT_STRING_BG_UTF8(down_screen_addr, line_buffer, color, COLOR_TRANS, 23, 40 + line[i]*27); + PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, 23, 40 + line[i]*27); } if(current_option_num == 2) @@ -2578,7 +2579,7 @@ u32 menu(u16 *screen) pt = strrchr(tmp_buf, ')'); strcat(line_buffer, pt); - PRINT_STRING_BG_UTF8(down_screen_addr, line_buffer, color, COLOR_TRANS, 26, 40 + display_option-> line_number*27); + PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, 26, 40 + display_option-> line_number*27); } void dynamic_cheat_menu_end() @@ -2801,7 +2802,7 @@ u32 menu(u16 *screen) mm = *(display_option->current_option); sprintf(line_buffer, *(display_option->display_string), str[mm]); - PRINT_STRING_BG_UTF8(down_screen_addr, line_buffer, color, COLOR_TRANS, 27, + PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, 27, 38 + (display_option-> line_number)*32); } @@ -2913,7 +2914,7 @@ u32 menu(u16 *screen) strcpy(line_buffer, *(display_option->display_string)); line_num= display_option-> line_number; - PRINT_STRING_BG_UTF8(down_screen_addr, line_buffer, COLOR_INACTIVE_ITEM, COLOR_TRANS, 27, + PRINT_STRING_BG(down_screen_addr, line_buffer, COLOR_INACTIVE_ITEM, COLOR_TRANS, 27, 40 + (display_option->line_number)*27); num_byte = freespace; @@ -2945,7 +2946,7 @@ u32 menu(u16 *screen) strcat(line_buffer, ".0 GB"); } - PRINT_STRING_BG_UTF8(down_screen_addr, line_buffer, COLOR_INACTIVE_ITEM, COLOR_TRANS, 147, + PRINT_STRING_BG(down_screen_addr, line_buffer, COLOR_INACTIVE_ITEM, COLOR_TRANS, 147, 40 + (display_option->line_number)*27); } @@ -2965,7 +2966,7 @@ u32 menu(u16 *screen) char *enable_disable_options[] = { (char*)&msg[MSG_EN_DIS_ABLE_0], (char*)&msg[MSG_EN_DIS_ABLE_1] }; - char *language_options[] = { (char*)&lang[0], (char*)&lang[1] }; + char *language_options[] = { (char*) &lang[0], (char*) &lang[1], (char*) &lang[2] }; char *keyremap_options[] = {(char*)&msg[MSG_KEY_MAP_NONE], (char*)&msg[MSG_KEY_MAP_A], (char*)&msg[MSG_KEY_MAP_B], (char*)&msg[MSG_KEY_MAP_SL], (char*)&msg[MSG_KEY_MAP_ST], (char*)&msg[MSG_KEY_MAP_RT], @@ -3124,7 +3125,7 @@ u32 menu(u16 *screen) /* 01 */ NUMERIC_SELECTION_OPTION(NULL, &msg[MSG_SUB_MENU_42], &clock_speed_number, 6, NULL, 1), /* 02 */ STRING_SELECTION_OPTION(language_set, NULL, &msg[MSG_SUB_MENU_41], language_options, - &emu_config.language, 2, NULL, ACTION_TYPE, 2), + &emu_config.language, 3 /* number of possibilities */, NULL, ACTION_TYPE, 2), /* 03 */ STRING_SELECTION_OPTION(NULL, show_card_space, &msg[MSG_SUB_MENU_43], NULL, &desert, 2, NULL, PASSIVE_TYPE | HIDEN_TYPE, 3), @@ -3582,7 +3583,7 @@ u32 menu(u16 *screen) else color= COLOR_INACTIVE_ITEM; - PRINT_STRING_BG_UTF8(down_screen_addr, line_buffer, color, COLOR_TRANS, 26, 37 + line_num*32); + PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, 26, 37 + line_num*32); } void game_fastforward() @@ -3758,7 +3759,7 @@ u32 menu(u16 *screen) else color= COLOR_INACTIVE_ITEM; - PRINT_STRING_BG_UTF8(down_screen_addr, line_buffer, color, COLOR_TRANS, 23, 40 + i*27); + PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, 23, 40 + i*27); } } } @@ -4204,6 +4205,7 @@ int load_language_msg(char *filename, u32 language) switch(language) { case ENGLISH: + default: strcpy(start, "STARTENGLISH"); strcpy(end, "ENDENGLISH"); cmplen= 12; @@ -4213,10 +4215,10 @@ int load_language_msg(char *filename, u32 language) strcpy(end, "ENDCHINESESIM"); cmplen= 15; break; - default: - strcpy(start, "STARTENGLISH"); - strcpy(end, "ENDENGLISH"); - cmplen= 12; + case FRENCH: + strcpy(start, "STARTFRENCH"); + strcpy(end, "ENDFRENCH"); + cmplen= 11; break; } //find the start flag @@ -4898,7 +4900,9 @@ void gui_init(u32 lang_id) flag = load_font(); if(0 != flag) { - err_msg(DOWN_SCREEN, "initial font library error, press any key to exit\n"); + char message[128]; + sprintf(message, "Font library initialisation error %d, press any key to exit\n", flag); + err_msg(DOWN_SCREEN, message); goto gui_init_err; } diff --git a/source/nds/message.h b/source/nds/message.h index fc6bd33..9292d3f 100644 --- a/source/nds/message.h +++ b/source/nds/message.h @@ -165,7 +165,7 @@ enum MSG enum LANGUAGE{ ENGLISH, CHINESE_SIMPLIFIED, - CHINESE_TRADITIONAL + FRENCH }; char *msg[MSG_END+1]; |