X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=platform%2Fgizmondo%2Fmenu.c;h=b062ffdc85ff78a54ad0df13feba09a399263d5d;hb=f3d1de29dacce5e79cc644ce05064da9bc44af62;hp=74bb6e191c427e8ad99a61617211464e03d95f6a;hpb=c9077ab4b91e5c28954cb05e0db20e45e3dd19e4;p=picodrive.git diff --git a/platform/gizmondo/menu.c b/platform/gizmondo/menu.c index 74bb6e1..b062ffd 100644 --- a/platform/gizmondo/menu.c +++ b/platform/gizmondo/menu.c @@ -19,6 +19,7 @@ #include "menu.h" #include "../common/arm_utils.h" #include "../common/menu.h" +#include "../common/emu.h" #include "../common/readpng.h" #include "version.h" #include "kgsdk/Framework.h" @@ -28,22 +29,17 @@ #include #include -extern char romFileName[MAX_PATH]; -extern char *rom_data; -extern int state_slot; -extern int config_slot, config_slot_current; #define gizKeyUnkn "???" static const char * const gizKeyNames[] = { "LEFT", "RIGHT", "UP", "DOWN", "STOP", "PLAY", "FORWARD", "REWIND", - "LEFT_SHOULDER", "RIGHT_SHOULDER", "HOME", "VOLUME", "BRIGHTNESS", "ALARM", "POWER", gizKeyUnkn, - gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, + "L", "R", "HOME", "VOLUME", "BRIGHTNESS", "ALARM", "POWER", gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, + gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn }; -static unsigned char bg_buffer[321*240*2]; -unsigned char menu_screen[321*240*2]; /* draw here and blit later, to avoid flicker */ -char menuErrorMsg[40] = {0, }; +static unsigned char *bg_buffer = gfx_buffer + 321*240*2; +unsigned char *menu_screen = gfx_buffer; /* draw here and blit later, to avoid flicker */ static void menu_darken_bg(void *dst, const void *src, int pixels, int darker); static void menu_prepare_bg(int use_game_bg); @@ -120,7 +116,7 @@ static void load_progress_cb(int percent) dst = (unsigned short *)menu_screen + 321*20; if (len > 320) len = 320; - for (ln = 10; ln > 0; ln--, dst += 320) + for (ln = 10; ln > 0; ln--, dst += 321) memset(dst, 0xff, len*2); menu_draw_end(); } @@ -441,6 +437,36 @@ static char *romsel_loop(char *curr_path) } #endif +// ------------ debug menu ------------ + +char *debugString(void); + +static void draw_debug(void) +{ + char *p, *str = debugString(); + int len, line; + + menu_draw_begin(1); + + p = str; + for (line = 0; line < 24; line++) + { + while (*p && *p != '\n') p++; + len = p - str; + if (len > 55) len = 55; + smalltext_out16_lim(1, line*10, str, 0xffff, len); + if (*p == 0) break; + p++; str = p; + } + menu_draw_end(); +} + +static void debug_menu_loop(void) +{ + draw_debug(); + wait_for_input(BTN_PLAY|BTN_STOP); +} + // ------------ patch/gg menu ------------ static void draw_patchlist(int sel) @@ -502,7 +528,7 @@ static void state_check_slots(void) for (slot = 0; slot < 10; slot++) { - if (emu_check_save_file(slot)) + if (emu_checkSaveFile(slot)) { state_slot_flags |= 1 << slot; } @@ -530,10 +556,10 @@ static void draw_savestate_bg(int slot) if (strcmp(fname + strlen(fname) - 3, ".gz") == 0) { file = gzopen(fname, "rb"); - emu_set_save_cbs(1); + emu_setSaveStateCbs(1); } else { file = fopen(fname, "rb"); - emu_set_save_cbs(0); + emu_setSaveStateCbs(0); } if (file) { @@ -551,7 +577,7 @@ static void draw_savestate_bg(int slot) areaClose(file); } - emu_forced_frame(); + emu_forcedFrame(); menu_prepare_bg(1); memcpy(Pico.vram, tmp_vram, sizeof(Pico.vram)); @@ -687,13 +713,13 @@ static void draw_key_config(const bind_action_t *opts, int opt_cnt, int player_i if (sel < opt_cnt) { text_out16(30, 180, "Press a button to bind/unbind"); - text_out16(30, 190, "Use SELECT to clear"); - text_out16(30, 200, "To bind UP/DOWN, hold SELECT"); + text_out16(30, 190, "Use HOME to clear"); + text_out16(30, 200, "To bind UP/DOWN, hold HOME"); text_out16(30, 210, "Select \"Done\" to exit"); } else { text_out16(30, 190, "Use Options -> Save cfg"); text_out16(30, 200, "to save controls"); - text_out16(30, 210, "Press B or X to exit"); + text_out16(30, 210, "Press PLAY or STOP to exit"); } menu_draw_end(); } @@ -706,7 +732,7 @@ static void key_config_loop(const bind_action_t *opts, int opt_cnt, int player_i for (;;) { draw_key_config(opts, opt_cnt, player_idx, sel); - inp = wait_for_input(CONFIGURABLE_KEYS); + inp = wait_for_input(CONFIGURABLE_KEYS|BTN_HOME); if (!(inp & BTN_HOME)) { prev_select = 0; if(inp & BTN_UP ) { sel--; if (sel < 0) sel = menu_sel_max; continue; } @@ -781,7 +807,6 @@ static bind_action_t emuctrl_actions[] = { "Switch Renderer", 1<<26 }, { "Volume Down ", 1<<30 }, { "Volume Up ", 1<<29 }, - { "Enter Menu ", 1<<23 }, }; static void kc_sel_loop(void) @@ -888,17 +913,17 @@ static void cd_menu_loop_options(void) menu_id selected_id; char *bios, *p; - if (find_bios(4, &bios)) { // US + if (emu_findBios(4, &bios)) { // US for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--); p++; strncpy(bios_names.us, p, sizeof(bios_names.us)); bios_names.us[sizeof(bios_names.us)-1] = 0; } else strcpy(bios_names.us, "NOT FOUND"); - if (find_bios(8, &bios)) { // EU + if (emu_findBios(8, &bios)) { // EU for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--); p++; strncpy(bios_names.eu, p, sizeof(bios_names.eu)); bios_names.eu[sizeof(bios_names.eu)-1] = 0; } else strcpy(bios_names.eu, "NOT FOUND"); - if (find_bios(1, &bios)) { // JP + if (emu_findBios(1, &bios)) { // JP for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--); p++; strncpy(bios_names.jp, p, sizeof(bios_names.jp)); bios_names.jp[sizeof(bios_names.jp)-1] = 0; } else strcpy(bios_names.jp, "NOT FOUND"); @@ -930,21 +955,21 @@ static void cd_menu_loop_options(void) } switch (selected_id) { // BIOS testers case MA_CDOPT_TESTBIOS_USA: - if (find_bios(4, &bios)) { // test US + if (emu_findBios(4, &bios)) { // test US strcpy(romFileName, bios); engineState = PGS_ReloadRom; return; } break; case MA_CDOPT_TESTBIOS_EUR: - if (find_bios(8, &bios)) { // test EU + if (emu_findBios(8, &bios)) { // test EU strcpy(romFileName, bios); engineState = PGS_ReloadRom; return; } break; case MA_CDOPT_TESTBIOS_JAP: - if (find_bios(1, &bios)) { // test JP + if (emu_findBios(1, &bios)) { // test JP strcpy(romFileName, bios); engineState = PGS_ReloadRom; return; @@ -1006,7 +1031,7 @@ static void amenu_loop_options(void) if (inp & (BTN_LEFT|BTN_RIGHT)) { // multi choise if (!me_process(opt2_entries, OPT2_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0) && selected_id == MA_OPT2_GAMMA) { - while ((inp = Framework_PollGetButtons(1)) & (BTN_LEFT|BTN_RIGHT)) { + while ((inp = Framework_PollGetButtons()) & (BTN_LEFT|BTN_RIGHT)) { currentConfig.gamma += (inp & BTN_LEFT) ? -1 : 1; if (currentConfig.gamma < 1) currentConfig.gamma = 1; if (currentConfig.gamma > 300) currentConfig.gamma = 300; @@ -1144,14 +1169,14 @@ static void draw_menu_options(int menu_sel) static int sndrate_prevnext(int rate, int dir) { - int i, rates[] = { 8000, 11025, 16000, 22050, 44100 }; + int i, rates[] = { 11025, 22050, 44100 }; for (i = 0; i < 5; i++) if (rates[i] == rate) break; i += dir ? 1 : -1; - if (i > 4) return dir ? 44100 : 22050; - if (i < 0) return dir ? 11025 : 8000; + if (i > 2) return dir ? 44100 : 22050; + if (i < 0) return dir ? 22050 : 11025; return rates[i]; } @@ -1188,7 +1213,6 @@ static void menu_options_save(void) // unbind XYZ MODE, just in case unbind_action(0xf00); } - scaling_update(); } static int menu_loop_options(void) @@ -1230,8 +1254,8 @@ static int menu_loop_options(void) break; case MA_OPT_SOUND_QUALITY: if ((inp & BTN_RIGHT) && currentConfig.PsndRate == 44100 && !(currentConfig.PicoOpt&0x08)) { - currentConfig.PsndRate = 8000; currentConfig.PicoOpt|= 0x08; - } else if ((inp & BTN_LEFT) && currentConfig.PsndRate == 8000 && (currentConfig.PicoOpt&0x08)) { + currentConfig.PsndRate = 11025; currentConfig.PicoOpt|= 0x08; + } else if ((inp & BTN_LEFT) && currentConfig.PsndRate == 11025 && (currentConfig.PicoOpt&0x08)) { currentConfig.PsndRate = 44100; currentConfig.PicoOpt&=~0x08; } else currentConfig.PsndRate = sndrate_prevnext(currentConfig.PsndRate, inp & BTN_RIGHT); break; @@ -1319,6 +1343,7 @@ static void draw_menu_credits(void) menu_draw_begin(1); text_out16(tl_x, 20, "PicoDrive v" VERSION " (c) notaz, 2006,2007"); +text_out16(tl_x, 30, "beta1"); y = tl_y; text_out16(tl_x, y, "Credits:"); text_out16(tl_x, (y+=10), "Dave: Cyclone 68000 core,"); @@ -1329,8 +1354,8 @@ static void draw_menu_credits(void) text_out16(tl_x, (y+=10), "Stephane Dallongeville:"); text_out16(tl_x, (y+=10), " opensource Gens"); text_out16(tl_x, (y+=10), "Haze: Genesis hw info"); - text_out16(tl_x, (y+=10), "Reesy: TODO"); - text_out16(tl_x, (y+=10), "TODO: gizmondo hardware"); + text_out16(tl_x, (y+=10), "Reesy: kgsdk wrapper, sound code"); + text_out16(tl_x, (y+=10), "jens.l: gizmondo hardware"); text_out16(tl_x, (y+=10), "ketchupgun: skin design"); menu_draw_end(); @@ -1394,7 +1419,7 @@ static void menu_loop_root(void) /* make sure action buttons are not pressed on entering menu */ draw_menu_root(menu_sel); - while (Framework_PollGetButtons(1) & (BTN_PLAY|BTN_STOP|BTN_HOME)) Sleep(50); + while (Framework_PollGetButtons() & (BTN_PLAY|BTN_STOP|BTN_HOME)) Sleep(50); for (;;) { @@ -1402,9 +1427,10 @@ static void menu_loop_root(void) inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_PLAY|BTN_STOP|BTN_HOME|BTN_L|BTN_R); if(inp & BTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; } if(inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; } - if(inp &(BTN_HOME|BTN_STOP)){ + if((inp & (BTN_L|BTN_R)) == (BTN_L|BTN_R)) debug_menu_loop(); + if( inp & (BTN_HOME|BTN_STOP)) { if (rom_data) { - while (Framework_PollGetButtons(1) & (BTN_HOME|BTN_STOP)) Sleep(50); // wait until select is released + while (Framework_PollGetButtons() & (BTN_HOME|BTN_STOP)) Sleep(50); // wait until released engineState = PGS_Running; break; } @@ -1414,7 +1440,7 @@ static void menu_loop_root(void) { case MA_MAIN_RESUME_GAME: if (rom_data) { - while (Framework_PollGetButtons(1) & BTN_PLAY) Sleep(50); + while (Framework_PollGetButtons() & BTN_PLAY) Sleep(50); engineState = PGS_Running; return; } @@ -1524,10 +1550,13 @@ static void menu_prepare_bg(int use_game_bg) if (use_game_bg) { // darken the active framebuffer - // TODO: take from somewhere else, not giz_screen + if (giz_screen == NULL) + giz_screen = Framework2D_LockBuffer(); memset(bg_buffer, 0, 321*8*2); menu_darken_bg(bg_buffer + 321*8*2, (char *)giz_screen + 321*8*2, 321*224, 1); memset(bg_buffer + 321*232*2, 0, 321*8*2); + Framework2D_UnlockBuffer(); + giz_screen = NULL; } else { @@ -1603,7 +1632,7 @@ int menu_loop_tray(void) /* make sure action buttons are not pressed on entering menu */ draw_menu_tray(menu_sel); - while (Framework_PollGetButtons(1) & BTN_PLAY) Sleep(50); + while (Framework_PollGetButtons() & BTN_PLAY) Sleep(50); for (;;) { @@ -1617,7 +1646,7 @@ int menu_loop_tray(void) selfname = romsel_loop(curr_path); if (selfname) { int ret = -1, cd_type; - cd_type = emu_cd_check(NULL); + cd_type = emu_cdCheck(NULL); if (cd_type > 0) ret = Insert_CD(romFileName, cd_type == 2); if (ret != 0) {