Index: apps/plugins/rockboy/loader.c =================================================================== --- apps/plugins/rockboy/loader.c (Revision 28580) +++ apps/plugins/rockboy/loader.c (Arbeitskopie) @@ -102,6 +102,7 @@ static const char *romfile; static char sramfile[500]; static char rtcfile[500]; +static char snfile[500]; static char saveprefix[500]; static int forcebatt, nobatt; @@ -229,11 +230,11 @@ ram.loaded = 1; fd = open(sramfile, O_RDONLY); - snprintf(meow,499,"Opening %s %d",sramfile,fd); - rb->splash(HZ*2, meow); + snprintf(meow,499,"Opening %s",sramfile); + rb->splash(0, meow); if (fd<0) return -1; snprintf(meow,499,"Loading savedata from %s",sramfile); - rb->splash(HZ*2, meow); + rb->splash(0, meow); read(fd,ram.sbank, 8192*mbc.ramsize); close(fd); @@ -252,7 +253,7 @@ fd = open(sramfile, O_WRONLY|O_CREAT|O_TRUNC, 0666); if (fd<0) return -1; snprintf(meow,499,"Saving savedata to %s",sramfile); - rb->splash(HZ*2, meow); + rb->splash(0, meow); write(fd,ram.sbank, 8192*mbc.ramsize); close(fd); @@ -277,6 +278,22 @@ close(fd); } +void sn_save(void) +{ + int fd; + if ((fd = open(snfile, O_WRONLY | O_CREAT, 0666)) < 0) + return; + savestate(fd); +} + +void sn_load(void) +{ + int fd; + if ((fd = open(snfile, O_RDONLY, 0666)) < 0) + return; + loadstate(fd); +} + void cleanup(void) { sram_save(); @@ -289,7 +306,7 @@ romfile = s; if(rom_load()) return; - rb->splash(HZ/2, rom.name); + rb->splash(0, rom.name); snprintf(saveprefix, 499, "%s/%s", savedir, rom.name); @@ -298,6 +315,9 @@ strcpy(rtcfile, saveprefix); strcat(rtcfile, ".rtc"); + + strcpy(snfile, saveprefix); + strcat(snfile, ".sn"); sram_load(); rtc_load(); Index: apps/plugins/rockboy/rockmacros.h =================================================================== --- apps/plugins/rockboy/rockmacros.h (Revision 28580) +++ apps/plugins/rockboy/rockmacros.h (Arbeitskopie) @@ -91,6 +91,7 @@ int UP, DOWN, LEFT, RIGHT; int frameskip, fps, maxskip; int sound, scaling, showstats; + int autosave; int rotate; int pal; int dirty; Index: apps/plugins/rockboy/loader.h =================================================================== --- apps/plugins/rockboy/loader.h (Revision 28580) +++ apps/plugins/rockboy/loader.h (Arbeitskopie) @@ -5,6 +5,8 @@ void loader_init(const char *s); void cleanup(void); +void sn_load(void); +void sn_save(void); #endif Index: apps/plugins/rockboy/lcd.c =================================================================== --- apps/plugins/rockboy/lcd.c (Revision 28580) +++ apps/plugins/rockboy/lcd.c (Arbeitskopie) @@ -1108,8 +1108,13 @@ { if(options.showstats) { - rb->lcd_putsxyf(0,LCD_HEIGHT-10,"FPS: %d Frameskip: %d ", - options.fps, options.frameskip); + if(options.showstats==1) { + rb->lcd_putsxyf(0,LCD_HEIGHT-10," %d %d ", + options.fps, options.frameskip); + } else { + rb->lcd_putsxyf(0,LCD_HEIGHT-10," FPS: %d Frameskip: %d ", + options.fps, options.frameskip); + } rb->lcd_update_rect(0,LCD_HEIGHT-10, LCD_WIDTH, 10); } Index: apps/plugins/rockboy/menu.c =================================================================== --- apps/plugins/rockboy/menu.c (Revision 28580) +++ apps/plugins/rockboy/menu.c (Arbeitskopie) @@ -11,6 +11,8 @@ #include "save.h" #include "rtc-gb.h" #include "pcm.h" +#include "emu.h" +#include "loader.h" #define SLOT_COUNT 50 #define DESC_SIZE 20 @@ -89,7 +91,7 @@ MENUITEM_STRINGLIST(menu, "Rockboy Menu", NULL, "Load Game", "Save Game", - "Options", "Quit"); + "Options", "Reset", "Quit"); rockboy_pcm_init(); @@ -108,8 +110,13 @@ case 2: /* Options */ do_opt_menu(); break; - case 3: /* Quit */ + case 3: /* Reset */ + emu_reset(); + done=true; + break; + case 4: /* Quit */ ret = USER_MENU_QUIT; + if(options.autosave) sn_save(); done=true; break; default: @@ -344,6 +351,12 @@ { "On" , -1 }, }; + static const struct opt_items stats[3] = { + { "Off", -1 }, + { "Short" , -1 }, + { "Full" , -1 }, + }; + static const struct opt_items frameskip[]= { { "0 Max", -1 }, { "1 Max", -1 }, @@ -352,6 +365,15 @@ { "4 Max", -1 }, { "5 Max", -1 }, { "6 Max", -1 }, + { "7 Max", -1 }, + { "8 Max", -1 }, + { "9 Max", -1 }, + { "10 Max", -1 }, + { "11 Max", -1 }, + { "12 Max", -1 }, + { "13 Max", -1 }, + { "14 Max", -1 }, + { "15 Max", -1 }, }; #ifdef HAVE_LCD_COLOR @@ -391,7 +413,7 @@ #endif MENUITEM_STRINGLIST(menu, "Options", NULL, - "Max Frameskip", "Sound", "Volume", "Stats", "Set Keys (Buggy)", + "Max Frameskip", "Autosave", "Sound", "Volume", "Stats", "Set Keys (Buggy)", #ifdef HAVE_LCD_COLOR "Screen Size", "Screen Rotate", "Set Palette", #endif @@ -412,32 +434,35 @@ rb->set_option("Max Frameskip", &options.maxskip, INT, frameskip, sizeof(frameskip)/sizeof(*frameskip), NULL ); break; - case 1: /* Sound */ + case 1: /* Autosave */ + rb->set_option("Autosave", &options.autosave, INT, onoff, 2, NULL ); + break; + case 2: /* Sound */ if(options.sound>1) options.sound=1; rb->set_option("Sound", &options.sound, INT, onoff, 2, NULL ); if(options.sound) sound_dirty(); break; - case 2: /* Volume */ + case 3: /* Volume */ rb->option_screen((struct settings_list*)vol, parentvp, false, "Volume"); break; - case 3: /* Stats */ - rb->set_option("Stats", &options.showstats, INT, onoff, 2, NULL ); + case 4: /* Stats */ + rb->set_option("Stats", &options.showstats, INT, stats, 3, NULL ); break; - case 4: /* Keys */ + case 5: /* Keys */ setupkeys(); break; #ifdef HAVE_LCD_COLOR - case 5: /* Screen Size */ + case 6: /* Screen Size */ rb->set_option("Screen Size", &options.scaling, INT, scaling, sizeof(scaling)/sizeof(*scaling), NULL ); setvidmode(); break; - case 6: /* Screen rotate */ + case 7: /* Screen rotate */ rb->set_option("Screen Rotate", &options.rotate, INT, rotate, sizeof(rotate)/sizeof(*rotate), NULL ); setvidmode(); break; - case 7: /* Palette */ + case 8: /* Palette */ rb->set_option("Set Palette", &options.pal, INT, palette, 17, NULL ); set_pal(); break; Index: apps/plugins/rockboy/rockboy.c =================================================================== --- apps/plugins/rockboy/rockboy.c (Revision 28580) +++ apps/plugins/rockboy/rockboy.c (Arbeitskopie) @@ -378,6 +378,7 @@ rb->lcd_puts(0,4,"Emu run"); rb->lcd_clear_display(); rb->lcd_update(); + if(options.autosave) sn_load(); emu_run(); /* never reached */