X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=common%2Fmenu.c;h=16d4342d4fc4a25b5d74bac064d96c4b0533ba62;hb=c51bd2feb382b1d1f4bd8aaeaf128e04bd0e147b;hp=d2957c2b7509304fd86b6a4ac4b93f8ab4fc29b4;hpb=f013066e974c7d35b818a6fca43a9deba1ce5c3e;p=libpicofe.git diff --git a/common/menu.c b/common/menu.c index d2957c2..16d4342 100644 --- a/common/menu.c +++ b/common/menu.c @@ -22,6 +22,10 @@ #define SCREEN_WIDTH 321 #define SCREEN_BUFFER menu_screen extern unsigned char *menu_screen; +#elif defined(PSP) + #include "../psp/psp.h" + #define SCREEN_WIDTH 512 + #define SCREEN_BUFFER psp_screen #endif char menuErrorMsg[64] = { 0, }; @@ -160,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; } @@ -313,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; + } +}