X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=gp2x%2Fmenu.c;h=ef54ed6322c3d1236f9f4a9ba802037589992bf2;hb=0480e6c9696e4d4cbd451a91a7ef63d96f60542d;hp=63ba6a0e965fdcfb614254456340d0917c95880c;hpb=7695af0a5bf50329be07289f8eb8b9a59636963e;p=libpicofe.git diff --git a/gp2x/menu.c b/gp2x/menu.c index 63ba6a0..ef54ed6 100644 --- a/gp2x/menu.c +++ b/gp2x/menu.c @@ -14,8 +14,9 @@ #include "emu.h" #include "menu.h" #include "usbjoy.h" -#include "../common/arm_utils.h" +#include "../common/emu.h" #include "../common/menu.h" +#include "../common/arm_utils.h" #include "../common/readpng.h" #include "version.h" @@ -27,11 +28,7 @@ #error "need d_type for file browser #endif -extern char romFileName[PATH_MAX]; -extern char *rom_data; extern int mmuhack_status; -extern int state_slot; -extern int config_slot, config_slot_current; static const char *gp2xKeyNames[] = { "UP", "???", "LEFT", "???", "DOWN", "???", "RIGHT", "???", @@ -40,8 +37,6 @@ static const char *gp2xKeyNames[] = { "???", "???", "???", "PUSH", "???", "???", "???", "???" }; -char menuErrorMsg[40] = {0, }; - static void menu_darken_bg(void *dst, int pixels, int darker); static void menu_prepare_bg(int use_game_bg); @@ -138,15 +133,35 @@ static void menu_flip(void) // --------- loading ROM screen ---------- +static int cdload_called = 0; + static void load_progress_cb(int percent) { int ln, len = percent * 320 / 100; unsigned short *dst = (unsigned short *)gp2x_screen + 320*20; if (len > 320) len = 320; - for (ln = 10; ln > 0; ln--, dst += 320) + for (ln = 8; ln > 0; ln--, dst += 320) + memset(dst, 0xff, len*2); + menu_flip(); +} + +static void cdload_progress_cb(int percent) +{ + int ln, len = percent * 320 / 100; + unsigned short *dst = (unsigned short *)gp2x_screen + 320*20; + + memset(dst, 0xff, 320*2*8); + + smalltext_out16(1, 3*10, "Processing CD image / MP3s", 0xffff); + smalltext_out16_lim(1, 4*10, romFileName, 0xffff, 80); + dst += 320*30; + + if (len > 320) len = 320; + for (ln = 8; ln > 0; ln--, dst += 320) memset(dst, 0xff, len*2); menu_flip(); + cdload_called = 1; } void menu_romload_prepare(const char *rom_name) @@ -162,12 +177,14 @@ void menu_romload_prepare(const char *rom_name) gp2x_memcpy_buffers(3, gp2x_screen, 0, 320*240*2); menu_flip(); PicoCartLoadProgressCB = load_progress_cb; + PicoCDLoadProgressCB = cdload_progress_cb; + cdload_called = 0; } void menu_romload_end(void) { - PicoCartLoadProgressCB = NULL; - smalltext_out16(1, 30, "Starting emulation...", 0xffff); + PicoCartLoadProgressCB = PicoCDLoadProgressCB = NULL; + smalltext_out16(1, cdload_called ? 60 : 30, "Starting emulation...", 0xffff); menu_flip(); } @@ -177,7 +194,7 @@ void menu_romload_end(void) static unsigned short file2color(const char *fname) { const char *ext = fname + strlen(fname) - 3; - static const char *rom_exts[] = { "zip", "bin", "smd", "gen", "iso" }; + static const char *rom_exts[] = { "zip", "bin", "smd", "gen", "iso", "cso" }; static const char *other_exts[] = { "gmv", "pat" }; int i; @@ -452,7 +469,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; } @@ -480,10 +497,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) { @@ -501,7 +518,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)); @@ -821,6 +838,7 @@ static bind_action_t emuctrl_actions[] = { "Switch Renderer", 1<<26 }, { "Volume Down ", 1<<30 }, { "Volume Up ", 1<<29 }, + { "Fast forward ", 1<<22 }, { "Enter Menu ", 1<<23 }, }; @@ -928,17 +946,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"); @@ -972,21 +990,21 @@ static void cd_menu_loop_options(void) if (inp & GP2X_START) { // BIOS testers switch (selected_id) { 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; @@ -1255,11 +1273,14 @@ static void menu_options_save(void) PicoOpt = currentConfig.PicoOpt; PsndRate = currentConfig.PsndRate; PicoRegionOverride = currentConfig.PicoRegion; + if (PicoRegionOverride) { + // force setting possibly changed.. + Pico.m.pal = (PicoRegionOverride == 2 || PicoRegionOverride == 8) ? 1 : 0; + } if (!(PicoOpt & 0x20)) { // unbind XYZ MODE, just in case unbind_action(0xf00, -1, -1); } - scaling_update(); } static int menu_loop_options(void) @@ -1400,7 +1421,7 @@ static void draw_menu_credits(void) text_out16(tl_x, 20, "PicoDrive v" VERSION " (c) notaz, 2006,2007"); y = tl_y; text_out16(tl_x, y, "Credits:"); - text_out16(tl_x, (y+=10), "Dave: Cyclone 68000 core,"); + text_out16(tl_x, (y+=10), "fDave: Cyclone 68000 core,"); text_out16(tl_x, (y+=10), " base code of PicoDrive"); text_out16(tl_x, (y+=10), "Reesy & FluBBa: DrZ80 core"); text_out16(tl_x, (y+=10), "MAME devs: YM2612 and SN76496 cores"); @@ -1697,7 +1718,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) {