X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fgp2x%2Fmenu.c;h=b771ee5ab5a87eed7746728a491fa9b68a32f0bc;hb=cb0316e4c526ad4c8d50e40e53c9d39044dcaaf9;hp=6336126ed81d8f24f6c30cf2ee995ad6ea4d64fd;hpb=cc68a136aa179a5f32fe40208371eb9c2b0aadae;p=picodrive.git diff --git a/platform/gp2x/menu.c b/platform/gp2x/menu.c index 6336126..b771ee5 100644 --- a/platform/gp2x/menu.c +++ b/platform/gp2x/menu.c @@ -352,11 +352,11 @@ static char *romsel_loop(char *curr_path) for (;;) { draw_dirlist(curr_path, namelist, n, sel); - inp = wait_for_input(GP2X_UP|GP2X_DOWN|GP2X_LEFT|GP2X_RIGHT|GP2X_B|GP2X_X); + inp = wait_for_input(GP2X_UP|GP2X_DOWN|GP2X_LEFT|GP2X_RIGHT|GP2X_L|GP2X_R|GP2X_B|GP2X_X); if(inp & GP2X_UP ) { sel--; if (sel < 0) sel = n-2; } if(inp & GP2X_DOWN) { sel++; if (sel > n-2) sel = 0; } - if(inp & GP2X_LEFT) { sel-=10; if (sel < 0) sel = 0; } - if(inp & GP2X_RIGHT) { sel+=10; if (sel > n-2) sel = n-2; } + if(inp &(GP2X_LEFT|GP2X_L)) { sel-=10; if (sel < 0) sel = 0; } + if(inp &(GP2X_RIGHT|GP2X_R)) { sel+=10; if (sel > n-2) sel = n-2; } if(inp & GP2X_B) { // enter dir/select again: if (namelist[sel+1]->d_type == DT_REG) { @@ -562,10 +562,8 @@ static void kc_sel_loop(void) - -// --------- advanced options ---------- - // order must match that of currentConfig_t + struct { int EmuOpt; int PicoOpt; @@ -576,6 +574,95 @@ struct { } tmp_opts; int tmp_gamma; +// --------- sega/mega cd options ---------- + +static void draw_cd_menu_options(int menu_sel, char *b_us, char *b_eu, char *b_jp) +{ + int tl_x = 25, tl_y = 60, y; + + y = tl_y; + memset(gp2x_screen, 0, 320*240); + gp2x_text_out8(tl_x, y, "USA BIOS: %s", b_us); // 0 + gp2x_text_out8(tl_x, (y+=10), "EUR BIOS: %s", b_eu); // 1 + gp2x_text_out8(tl_x, (y+=10), "JAP BIOS: %s", b_jp); // 2 + gp2x_text_out8(tl_x, (y+=10), "CD LEDs %s", (tmp_opts.EmuOpt &0x400)?"ON":"OFF"); // 3 + gp2x_text_out8(tl_x, (y+=10), "CDDA audio (using mp3s) %s", (tmp_opts.EmuOpt &0x800)?"ON":"OFF"); // 4 + gp2x_text_out8(tl_x, (y+=10), "Done"); + + // draw cursor + gp2x_text_out8(tl_x - 16, tl_y + menu_sel*10, ">"); + + if ((menu_sel == 0 && strcmp(b_us, "NOT FOUND")) || + (menu_sel == 1 && strcmp(b_eu, "NOT FOUND")) || + (menu_sel == 2 && strcmp(b_jp, "NOT FOUND"))) + gp2x_text_out8(tl_x, 220, "Press start to test selected BIOS"); + + gp2x_video_flip(); +} + +static void cd_menu_loop_options(void) +{ + int menu_sel = 0, menu_sel_max = 5; + unsigned long inp = 0; + char bios_us[32], bios_eu[32], bios_jp[32], *bios, *p; + + if (find_bios(4, &bios)) { // US + for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--); p++; + strncpy(bios_us, p, 31); bios_us[31] = 0; + } else strcpy(bios_us, "NOT FOUND"); + + if (find_bios(8, &bios)) { // EU + for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--); p++; + strncpy(bios_eu, p, 31); bios_eu[31] = 0; + } else strcpy(bios_eu, "NOT FOUND"); + + if (find_bios(1, &bios)) { // JP + for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--); p++; + strncpy(bios_jp, p, 31); bios_jp[31] = 0; + } else strcpy(bios_jp, "NOT FOUND"); + + for(;;) + { + draw_cd_menu_options(menu_sel, bios_us, bios_eu, bios_jp); + inp = wait_for_input(GP2X_UP|GP2X_DOWN|GP2X_LEFT|GP2X_RIGHT|GP2X_B|GP2X_X|GP2X_A|GP2X_START); + if(inp & GP2X_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; } + if(inp & GP2X_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; } + if((inp& GP2X_B)||(inp&GP2X_LEFT)||(inp&GP2X_RIGHT)) { // toggleable options + switch (menu_sel) { + case 3: tmp_opts.EmuOpt ^=0x400; break; + case 4: tmp_opts.EmuOpt ^=0x800; break; + case 5: return; + } + } + if(inp & (GP2X_X|GP2X_A)) return; + if(inp & GP2X_START) { // BIOS testers + switch (menu_sel) { + case 0: if (find_bios(4, &bios)) { // test US + strcpy(romFileName, bios); + engineState = PGS_ReloadRom; + return; + } + break; + case 1: if (find_bios(8, &bios)) { // test EU + strcpy(romFileName, bios); + engineState = PGS_ReloadRom; + return; + } + break; + case 2: if (find_bios(1, &bios)) { // test JP + strcpy(romFileName, bios); + engineState = PGS_ReloadRom; + return; + } + break; + } + } + } +} + + +// --------- advanced options ---------- + static void draw_amenu_options(int menu_sel) { int tl_x = 25, tl_y = 60, y; @@ -603,7 +690,7 @@ static void draw_amenu_options(int menu_sel) static void amenu_loop_options(void) { - int menu_sel = 0, menu_sel_max = 11; + int menu_sel = 0, menu_sel_max = 10; unsigned long inp = 0; for(;;) @@ -683,11 +770,12 @@ static void draw_menu_options(int menu_sel) gp2x_text_out8(tl_x, (y+=10), "Use ARM940 core for sound %s", (tmp_opts.PicoOpt&0x200)?"ON":"OFF"); // 7 gp2x_text_out8(tl_x, (y+=10), "6 button pad %s", (tmp_opts.PicoOpt&0x020)?"ON":"OFF"); // 8 gp2x_text_out8(tl_x, (y+=10), "Genesis Region: %s", region_name(tmp_opts.PicoRegion)); - gp2x_text_out8(tl_x, (y+=10), "Use SRAM savestates %s", (tmp_opts.EmuOpt &0x001)?"ON":"OFF"); // 10 + gp2x_text_out8(tl_x, (y+=10), "Use SRAM/BRAM savestates %s", (tmp_opts.EmuOpt &0x001)?"ON":"OFF"); // 10 gp2x_text_out8(tl_x, (y+=10), "Confirm save overwrites %s", (tmp_opts.EmuOpt &0x200)?"ON":"OFF"); // 11 gp2x_text_out8(tl_x, (y+=10), "Save slot %i", state_slot); // 12 gp2x_text_out8(tl_x, (y+=10), "GP2X CPU clocks %iMhz", tmp_opts.CPUclock); - gp2x_text_out8(tl_x, (y+=10), "[advanced options]"); + gp2x_text_out8(tl_x, (y+=10), "[Sega/Mega CD options]"); + gp2x_text_out8(tl_x, (y+=10), "[advanced options]"); // 15 gp2x_text_out8(tl_x, (y+=10), "Save cfg as default"); if (rom_data) gp2x_text_out8(tl_x, (y+=10), "Save cfg for current game only"); @@ -726,9 +814,9 @@ static void menu_options_save(void) } } -static void menu_loop_options(void) +static int menu_loop_options(void) { - int menu_sel = 0, menu_sel_max = 15; + int menu_sel = 0, menu_sel_max = 16; unsigned long inp = 0; if (rom_data) menu_sel_max++; @@ -754,21 +842,27 @@ static void menu_loop_options(void) case 8: tmp_opts.PicoOpt^=0x020; break; case 10: tmp_opts.EmuOpt ^=0x001; break; case 11: tmp_opts.EmuOpt ^=0x200; break; - case 14: amenu_loop_options(); break; - case 15: // done (save) + case 14: cd_menu_loop_options(); + if (engineState == PGS_ReloadRom) + return 0; // test BIOS + break; + case 15: amenu_loop_options(); break; + case 16: // done (update and write) menu_options_save(); - emu_WriteConfig(0); - return; - case 16: // done (save for current game) + if (emu_WriteConfig(0)) strcpy(menuErrorMsg, "config saved"); + else strcpy(menuErrorMsg, "failed to write config"); + return 1; + case 17: // done (update and write for current game) menu_options_save(); - emu_WriteConfig(1); - return; + if (emu_WriteConfig(1)) strcpy(menuErrorMsg, "config saved"); + else strcpy(menuErrorMsg, "failed to write config"); + return 1; } } - if(inp & GP2X_X) return; // done (no save) + if(inp & GP2X_X) return 0; // done (no update or write) if(inp & GP2X_A) { menu_options_save(); - return; // done (save) + return 0; // done (update, no write) } if(inp & (GP2X_LEFT|GP2X_RIGHT)) { // multi choise switch (menu_sel) { @@ -827,7 +921,7 @@ static void draw_menu_credits(void) int tl_x = 15, tl_y = 70, y; memset(gp2x_screen, 0, 320*240); - gp2x_text_out8(tl_x, 20, "PicoDrive v" VERSION " (c) notaz, 2006"); + gp2x_text_out8(tl_x, 20, "PicoDrive v" VERSION " (c) notaz, 2006,2007"); y = tl_y; gp2x_text_out8(tl_x, y, "Credits:"); gp2x_text_out8(tl_x, (y+=10), "Dave: Cyclone 68000 core,"); @@ -866,7 +960,7 @@ static void draw_menu_root(int menu_sel) } else { y += 30; } - gp2x_text_out8(tl_x, (y+=10), "Load new ROM"); + gp2x_text_out8(tl_x, (y+=10), "Load new ROM/ISO"); gp2x_text_out8(tl_x, (y+=10), "Change options"); gp2x_text_out8(tl_x, (y+=10), "Configure controls"); gp2x_text_out8(tl_x, (y+=10), "Credits"); @@ -882,7 +976,7 @@ static void draw_menu_root(int menu_sel) static void menu_loop_root(void) { - int menu_sel = 4, menu_sel_max = 8, menu_sel_min = 4; + int ret, menu_sel = 4, menu_sel_max = 8, menu_sel_min = 4; unsigned long inp = 0; char curr_path[PATH_MAX], *selfname; FILE *tstf; @@ -948,13 +1042,14 @@ static void menu_loop_root(void) selfname = romsel_loop(curr_path); if (selfname) { printf("selected file: %s\n", selfname); - strncpy(currentConfig.lastRomFile, selfname, sizeof(currentConfig.lastRomFile)-1); - currentConfig.lastRomFile[sizeof(currentConfig.lastRomFile)-1] = 0; engineState = PGS_ReloadRom; } return; case 5: // options - menu_loop_options(); + ret = menu_loop_options(); + if (ret == 1) continue; // status update + if (engineState == PGS_ReloadRom) + return; // BIOS test break; case 6: // controls kc_sel_loop();