X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=common%2Fmenu.c;h=16d4342d4fc4a25b5d74bac064d96c4b0533ba62;hb=c51bd2feb382b1d1f4bd8aaeaf128e04bd0e147b;hp=ed02ff8d9287d59ecfdd63d4584ea25803a87e49;hpb=7695af0a5bf50329be07289f8eb8b9a59636963e;p=libpicofe.git diff --git a/common/menu.c b/common/menu.c index ed02ff8..16d4342 100644 --- a/common/menu.c +++ b/common/menu.c @@ -14,16 +14,22 @@ #include "lprintf.h" #if defined(__GP2X__) -#include "../gp2x/gp2x.h" -#define SCREEN_WIDTH 320 -#define SCREEN_BUFFER gp2x_screen + #include "../gp2x/gp2x.h" + #define SCREEN_WIDTH 320 + #define SCREEN_BUFFER gp2x_screen #elif defined(__GIZ__) -#include "../gizmondo/giz.h" -#define SCREEN_WIDTH 321 -#define SCREEN_BUFFER menu_screen -extern unsigned char menu_screen[321*240*2]; + //#include "../gizmondo/giz.h" + #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, }; + static unsigned char menu_font_data[10240]; static int menu_text_color = 0xffff; // default to white static int menu_sel_color = -1; // disabled @@ -158,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; } @@ -311,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; + } +}