summaryrefslogtreecommitdiff
path: root/apps/plugins/rockboy/rockboy.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/rockboy/rockboy.c')
-rw-r--r--apps/plugins/rockboy/rockboy.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c
index 0364f47faa..5464a2a416 100644
--- a/apps/plugins/rockboy/rockboy.c
+++ b/apps/plugins/rockboy/rockboy.c
@@ -71,8 +71,17 @@ static void setoptions (void)
71 snprintf(optionsave, sizeof(optionsave), "%s/%s", savedir, optionname); 71 snprintf(optionsave, sizeof(optionsave), "%s/%s", savedir, optionname);
72 72
73 fd = open(optionsave, O_RDONLY); 73 fd = open(optionsave, O_RDONLY);
74 if(fd < 0) /* no options to read, set defaults */ 74
75 int optionssize = sizeof(options);
76 int filesize = 0;
77 if(fd >= 0)
78 filesize = rb->filesize(fd);
79
80 /* don't read the option file if the size
81 * is not as expected to avoid crash */
82 if(fd < 0 || filesize!=optionssize)
75 { 83 {
84 // no options to read, set defaults
76#ifdef HAVE_TOUCHSCREEN 85#ifdef HAVE_TOUCHSCREEN
77 options.LEFT = BUTTON_MIDLEFT; 86 options.LEFT = BUTTON_MIDLEFT;
78 options.RIGHT = BUTTON_MIDRIGHT; 87 options.RIGHT = BUTTON_MIDRIGHT;
@@ -378,6 +387,7 @@ static int gnuboy_main(const char *rom)
378 rb->lcd_puts(0,4,"Emu run"); 387 rb->lcd_puts(0,4,"Emu run");
379 rb->lcd_clear_display(); 388 rb->lcd_clear_display();
380 rb->lcd_update(); 389 rb->lcd_update();
390 if(options.autosave) sn_load();
381 emu_run(); 391 emu_run();
382 392
383 /* never reached */ 393 /* never reached */