From: notaz Date: Sun, 15 Mar 2009 21:02:40 +0000 (+0000) Subject: fix gp2x build and some obvious menu glitches X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a31ef07776f196cbf25748eee78da65b2b89928;p=libpicofe.git fix gp2x build and some obvious menu glitches git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@665 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/common/menu.c b/common/menu.c index 2f29e87..c2e18fa 100644 --- a/common/menu.c +++ b/common/menu.c @@ -176,7 +176,7 @@ static void menu_draw_selection(int x, int y, int w) for (h = me_mfont_h + 1; h > 0; h--) { dst = dest; - for (i = w; i > 0; i--) + for (i = w - 14; i > 0; i--) *dst++ = menu_sel_color; dest += g_screen_width; } @@ -472,7 +472,7 @@ static void me_loop(menu_entry *menu, int *menu_sel) return; } - while (!menu[sel].enabled && sel < menu_sel_max) + while ((!menu[sel].enabled || !menu[sel].selectable) && sel < menu_sel_max) sel++; /* make sure action buttons are not pressed on entering menu */ @@ -604,16 +604,16 @@ void menu_romload_prepare(const char *rom_name) { const char *p = rom_name + strlen(rom_name); - plat_video_menu_begin(); - while (p > rom_name && *p != '/') p--; /* fill both buffers, callbacks won't update in full */ + plat_video_menu_begin(); smalltext_out16(1, 1, "Loading", 0xffff); smalltext_out16(1, 10, p, 0xffff); plat_video_menu_end(); + plat_video_menu_begin(); smalltext_out16(1, 1, "Loading", 0xffff); smalltext_out16(1, 10, p, 0xffff); plat_video_menu_end(); @@ -977,7 +977,7 @@ static void draw_savestate_menu(int menu_sel, int is_loading) text_out16(x, y, is_loading ? "Load state" : "Save state"); y += 3 * me_mfont_h; - menu_draw_selection(x - me_mfont_w * 2, y + menu_sel * me_mfont_h, 13 * me_mfont_w + 4); + menu_draw_selection(x - me_mfont_w * 2, y + menu_sel * me_mfont_h, (13 + 2) * me_mfont_w + 4); /* draw all 10 slots */ for (i = 0; i < 10; i++, y += me_mfont_h) @@ -1091,10 +1091,11 @@ static int count_bound_keys(int dev_id, int action_mask, int player_idx) static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_idx, int sel, int dev_id, int dev_count, int is_bind) { - int x, y, w, i; const char *dev_name; + int x, y, w, i; - x = g_screen_width / 2 - 20 * me_mfont_w / 2; + w = ((player_idx >= 0) ? 20 : 30) * me_mfont_w; + x = g_screen_width / 2 - w / 2; y = (g_screen_height - 4 * me_mfont_h) / 2 - (2 + opt_cnt) * me_mfont_h / 2; if (x < me_mfont_w * 2) x = me_mfont_w * 2; @@ -1106,7 +1107,7 @@ static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_ text_out16(x, y, "Emulator controls"); y += 2 * me_mfont_h; - menu_draw_selection(x - me_mfont_w * 2, y + sel * me_mfont_h, me_mfont_w); // FIXME last arg + menu_draw_selection(x - me_mfont_w * 2, y + sel * me_mfont_h, w + 2 * me_mfont_w); for (i = 0; i < opt_cnt; i++, y += me_mfont_h) text_out16(x, y, "%s : %s", opts[i].name, @@ -1885,6 +1886,10 @@ static int main_menu_handler(menu_id id, int keys) static menu_entry e_menu_main[] = { + mee_label ("PicoDrive " VERSION), + mee_label (""), + mee_label (""), + mee_label (""), mee_handler_id("Resume game", MA_MAIN_RESUME_GAME, main_menu_handler), mee_handler_id("Save State", MA_MAIN_SAVE_STATE, main_menu_handler), mee_handler_id("Load State", MA_MAIN_LOAD_STATE, main_menu_handler), @@ -1911,13 +1916,15 @@ void menu_loop(void) plat_video_menu_enter(rom_loaded); in_set_blocking(1); me_loop(e_menu_main, &sel); - in_set_blocking(0); - if (rom_loaded && engineState == PGS_Menu) { + if (rom_loaded) { + if (engineState == PGS_Menu) + engineState = PGS_Running; /* wait until menu, ok, back is released */ while (in_menu_wait_any(50) & (PBTN_MENU|PBTN_MOK|PBTN_MBACK)); - engineState = PGS_Running; } + + in_set_blocking(0); } // --------- CD tray close menu ---------- @@ -1967,7 +1974,6 @@ int menu_loop_tray(void) in_set_blocking(1); me_loop(e_menu_tray, &sel); - in_set_blocking(0); if (engineState != PGS_RestartRun) { engineState = PGS_RestartRun; @@ -1975,6 +1981,7 @@ int menu_loop_tray(void) } while (in_menu_wait_any(50) & (PBTN_MENU|PBTN_MOK|PBTN_MBACK)); + in_set_blocking(0); return ret; } diff --git a/gp2x/Makefile b/gp2x/Makefile index 625e679..ea86f6b 100644 --- a/gp2x/Makefile +++ b/gp2x/Makefile @@ -54,14 +54,15 @@ LD = $(CROSS)ld OBJCOPY = $(CROSS)objcopy # frontend -OBJS += main.o gp2x.o emu.o in_gp2x.o squidgehack.o cpuctrl.o +# TODO: clean cpuctrl +OBJS += main.o gp2x.o emu.o in_gp2x.o plat.o squidgehack.o cpuctrl.o # 940 core control OBJS += 940ctl.o # common OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \ platform/common/arm_utils.o platform/common/arm_linux.o platform/common/readpng.o \ - platform/common/mp3_helix.o platform/common/input.o platform/linux/usbjoy.o \ + platform/common/mp3_helix.o platform/common/input.o \ platform/linux/sndout_oss.o platform/linux/plat.o # Pico diff --git a/gp2x/gp2x.c b/gp2x/gp2x.c index e0aa296..e433524 100644 --- a/gp2x/gp2x.c +++ b/gp2x/gp2x.c @@ -35,6 +35,7 @@ #include "../linux/sndout_oss.h" #include "../common/arm_utils.h" #include "../common/arm_linux.h" +#include "../common/emu.h" volatile unsigned short *gp2x_memregs; //static @@ -196,7 +197,6 @@ void gp2x_pd_clone_buffer2(void) unsigned long gp2x_joystick_read(int unused) { - int i; unsigned long value=(gp2x_memregs[0x1198>>1] & 0x00FF); // GPIO M if(value==0xFD) value=0xFA; if(value==0xF7) value=0xEB; diff --git a/gp2x/port_config.h b/gp2x/port_config.h index 94b7bfe..932b7e5 100644 --- a/gp2x/port_config.h +++ b/gp2x/port_config.h @@ -3,6 +3,8 @@ #ifndef PORT_CONFIG_H #define PORT_CONFIG_H +#include "version.h" + #define CASE_SENSITIVE_FS 1 // CS filesystem #define DONT_OPEN_MANY_FILES 0 #define REDUCE_IO_CALLS 0 diff --git a/pandora/port_config.h b/pandora/port_config.h index 02bc39c..3d047dc 100644 --- a/pandora/port_config.h +++ b/pandora/port_config.h @@ -3,6 +3,8 @@ #ifndef PORT_CONFIG_H #define PORT_CONFIG_H +#include "../gp2x/version.h" /* FIXME */ + #define CASE_SENSITIVE_FS 1 // CS filesystem #define DONT_OPEN_MANY_FILES 0 #define REDUCE_IO_CALLS 0