X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=common%2Fmenu.c;h=359517a8d7dcf66f98ac1b1be491a8907b4a65c8;hb=6e507f764b95d5f6088ea7f174586cfb0360a236;hp=53ef33d0885b6d07023d874dcbd7fcb9e92beed7;hpb=c7a4ff64287b12487c7e9cc13ce3b7d2aa6e1f06;p=libpicofe.git diff --git a/common/menu.c b/common/menu.c index 53ef33d..359517a 100644 --- a/common/menu.c +++ b/common/menu.c @@ -14,15 +14,40 @@ #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 giz_screen + //#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, }; + +// PicoPad[] format: MXYZ SACB RLDU +me_bind_action me_ctrl_actions[12] = +{ + { "UP ", 0x001 }, + { "DOWN ", 0x002 }, + { "LEFT ", 0x004 }, + { "RIGHT ", 0x008 }, + { "A ", 0x040 }, + { "B ", 0x010 }, + { "C ", 0x020 }, + { "START ", 0x080 }, + { "MODE ", 0x800 }, + { "X ", 0x400 }, + { "Y ", 0x200 }, + { "Z ", 0x100 } +}; + + static unsigned char menu_font_data[10240]; static int menu_text_color = 0xffff; // default to white static int menu_sel_color = -1; // disabled @@ -157,7 +182,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; } @@ -310,5 +340,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; + } +}