From 1b13dae0c45a068382ce2422b1d407ff47374039 Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 28 Mar 2008 20:59:30 +0000 Subject: [PATCH] del ability, adjustments, 1.40 release? git-svn-id: file:///home/notaz/opt/svn/PicoDrive@400 be3aeb3a-fb24-0410-a615-afba39da0efa --- Pico/carthw/svp/svp.c | 4 ++- platform/base_readme.txt | 1 + platform/gp2x/Makefile | 2 +- platform/gp2x/emu.c | 5 ++-- platform/gp2x/menu.c | 63 +++++++++++++++++++++++++++++++++------- 5 files changed, 61 insertions(+), 14 deletions(-) diff --git a/Pico/carthw/svp/svp.c b/Pico/carthw/svp/svp.c index c7b6551c..68217376 100644 --- a/Pico/carthw/svp/svp.c +++ b/Pico/carthw/svp/svp.c @@ -47,8 +47,10 @@ static void PicoSVPLine(int count) { if ((PicoOpt&0x20000) && svp_dyn_ready) ssp1601_dyn_run(PicoSVPCycles * count); - else + else { ssp1601_run(PicoSVPCycles * count); + svp_dyn_ready = 0; // just in case + } // test mode //if (Pico.m.frame_count == 13) PicoPad[0] |= 0xff; diff --git a/platform/base_readme.txt b/platform/base_readme.txt index 3d595884..34341f8e 100644 --- a/platform/base_readme.txt +++ b/platform/base_readme.txt @@ -650,6 +650,7 @@ Changelog + PicoDrive now comes with a game config file for some games which need special settings, so they should now work out-of-the-box. More games will be added with later updates. + + Files now can be deleted by pressing A+SELECT in the file browser. 1.35b * PSP: mp3 code should no longer fail on 1.5 firmware. diff --git a/platform/gp2x/Makefile b/platform/gp2x/Makefile index e96126d3..210e1390 100644 --- a/platform/gp2x/Makefile +++ b/platform/gp2x/Makefile @@ -232,7 +232,7 @@ $(error need VER) endif endif -rel: PicoDrive.gpe code940/pico940_v2.bin readme.txt PicoDrive.man.txt PicoDrive.png +rel: PicoDrive.gpe code940/pico940_v2.bin readme.txt PicoDrive.man.txt PicoDrive.png game.cfg zip -9 -j ../../PicoDrive_$(VER).zip $^ mmuhack.o zip -9 -r ../../PicoDrive_$(VER).zip skin -i \*.png -i \*.txt diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index e329b5aa..f2867fc9 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -865,9 +865,10 @@ void emu_Loop(void) bench_fps += frames_shown; sprintf(fpsbuff, "%02i/%02i/%02i", frames_shown, bench_fps_s, (bf[0]+bf[1]+bf[2]+bf[3])>>2); #else - if (currentConfig.EmuOpt & 2) + if (currentConfig.EmuOpt & 2) { sprintf(fpsbuff, "%02i/%02i", frames_shown, frames_done); - if (fpsbuff[5] == 0) { fpsbuff[5] = fpsbuff[6] = ' '; fpsbuff[7] = 0; } + if (fpsbuff[5] == 0) { fpsbuff[5] = fpsbuff[6] = ' '; fpsbuff[7] = 0; } + } #endif frames_shown = frames_done = 0; thissec = tval.tv_sec; diff --git a/platform/gp2x/menu.c b/platform/gp2x/menu.c index 5039cab7..506b7c44 100644 --- a/platform/gp2x/menu.c +++ b/platform/gp2x/menu.c @@ -275,6 +275,31 @@ static int scandir_filter(const struct dirent *ent) return 1; } +static void do_delete(const char *fpath, const char *fname) +{ + int len, inp; + + gp2x_pd_clone_buffer2(); + + if (!rom_loaded) + menu_darken_bg(gp2x_screen, 320*240, 0); + + len = strlen(fname); + if (len > 320/6) len = 320/6; + + text_out16(320/2 - 15*8/2, 80, "About to delete"); + smalltext_out16_lim(320/2 - len*6/2, 95, fname, 0xbdff, len); + text_out16(320/2 - 13*8/2, 110, "Are you sure?"); + text_out16(320/2 - 25*8/2, 120, "(Y - confirm, X - cancel)"); + menu_flip(); + + + while (gp2x_joystick_read(1) & (GP2X_A|GP2X_SELECT)) usleep(50*1000); + inp = wait_for_input(GP2X_Y|GP2X_X); + if (inp & GP2X_Y) + remove(fpath); +} + static char *romsel_loop(char *curr_path) { struct dirent **namelist; @@ -283,6 +308,7 @@ static char *romsel_loop(char *curr_path) unsigned long inp = 0; char *ret = NULL, *fname = NULL; +rescan: // is this a dir or a full path? if ((dir = opendir(curr_path))) { closedir(dir); @@ -319,24 +345,39 @@ 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_L|GP2X_R|GP2X_B|GP2X_X); + inp = wait_for_input(GP2X_UP|GP2X_DOWN|GP2X_LEFT|GP2X_RIGHT|GP2X_L|GP2X_R|GP2X_A|GP2X_B|GP2X_X|GP2X_SELECT); 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_L) { sel-=24; if (sel < 0) sel = 0; } if(inp & GP2X_RIGHT) { sel+=10; if (sel > n-2) sel = n-2; } if(inp & GP2X_R) { sel+=24; if (sel > n-2) sel = n-2; } - if(inp & GP2X_B) { // enter dir/select + if ((inp & GP2X_B) || (inp & (GP2X_SELECT|GP2X_A)) == (GP2X_SELECT|GP2X_A)) // enter dir/select || delete + { again: - if (namelist[sel+1]->d_type == DT_REG) { + if (namelist[sel+1]->d_type == DT_REG) + { strcpy(romFileName, curr_path); strcat(romFileName, "/"); strcat(romFileName, namelist[sel+1]->d_name); - ret = romFileName; - break; - } else if (namelist[sel+1]->d_type == DT_DIR) { - int newlen = strlen(curr_path) + strlen(namelist[sel+1]->d_name) + 2; - char *p, *newdir = malloc(newlen); + if (inp & GP2X_B) { // return sel + ret = romFileName; + break; + } + do_delete(romFileName, namelist[sel+1]->d_name); + if (n > 0) { + while (n--) free(namelist[n]); + free(namelist); + } + goto rescan; + } + else if (namelist[sel+1]->d_type == DT_DIR) + { + int newlen; + char *p, *newdir; + if (!(inp & GP2X_B)) continue; + newlen = strlen(curr_path) + strlen(namelist[sel+1]->d_name) + 2; + newdir = malloc(newlen); if (strcmp(namelist[sel+1]->d_name, "..") == 0) { char *start = curr_path; p = start + strlen(start) - 1; @@ -354,7 +395,9 @@ static char *romsel_loop(char *curr_path) ret = romsel_loop(newdir); free(newdir); break; - } else { + } + else + { // unknown file type, happens on NTFS mounts. Try to guess. FILE *tstf; int tmp; strcpy(romFileName, curr_path); @@ -375,7 +418,7 @@ static char *romsel_loop(char *curr_path) } if (n > 0) { - while(n--) free(namelist[n]); + while (n--) free(namelist[n]); free(namelist); } -- 2.39.5