X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=common%2Fmenu.c;h=16d4342d4fc4a25b5d74bac064d96c4b0533ba62;hb=0ae25549b5066ea8b42216ec875f5c3c5d5bd8d6;hp=b6bd019c3520becad5279154e58f0510689198c6;hpb=2951214ea65ce2e2ac40671511b8d5a9ea2d2842;p=libpicofe.git diff --git a/common/menu.c b/common/menu.c index b6bd019..16d4342 100644 --- a/common/menu.c +++ b/common/menu.c @@ -164,7 +164,12 @@ static int parse_hex_color(char *buff) { char *endp = buff; int t = (int) strtoul(buff, &endp, 16); - if (endp != buff) return ((t>>8)&0xf800) | ((t>>5)&0x07e0) | ((t>>3)&0x1f); + if (endp != buff) +#ifdef PSP + return ((t<<8)&0xf800) | ((t>>5)&0x07e0) | ((t>>19)&0x1f); +#else + return ((t>>8)&0xf800) | ((t>>5)&0x07e0) | ((t>>3)&0x1f); +#endif return -1; } @@ -220,7 +225,6 @@ void menu_init(void) int tmp = parse_hex_color(buff+16); if (tmp >= 0) menu_sel_color = tmp; else lprintf("skin.txt: parse error for selection_color\n"); - lprintf("sel color: %04x\n", menu_sel_color); } else lprintf("skin.txt: parse error: %s\n", buff); @@ -318,5 +322,25 @@ int me_process(menu_entry *entries, int count, menu_id id, int is_next) } } - +const char *me_region_name(unsigned int code, int auto_order) +{ + static const char *names[] = { "Auto", " Japan NTSC", " Japan PAL", " USA", " Europe" }; + static const char *names_short[] = { "", " JP", " JP", " US", " EU" }; + int u, i = 0; + if (code) { + code <<= 1; + while((code >>= 1)) i++; + if (i > 4) return "unknown"; + return names[i]; + } else { + static char name[24]; + strcpy(name, "Auto:"); + for (u = 0; u < 3; u++) { + i = 0; code = ((auto_order >> u*4) & 0xf) << 1; + while((code >>= 1)) i++; + strcat(name, names_short[i]); + } + return name; + } +}