From 7704a3ccd7b1a3d1092bde0a1ec13ba6196b550b Mon Sep 17 00:00:00 2001 From: Michael Stummvoll Date: Thu, 25 Nov 2010 12:45:13 +0000 Subject: Added the snapshot patch for rockboy (FS#11757) Added a simple filesize-check for the options file before loading to avoid crashes due the changed config git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28664 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/rockboy/loader.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'apps/plugins/rockboy/loader.c') diff --git a/apps/plugins/rockboy/loader.c b/apps/plugins/rockboy/loader.c index 8741dabd12..d843ba8a60 100644 --- a/apps/plugins/rockboy/loader.c +++ b/apps/plugins/rockboy/loader.c @@ -102,6 +102,7 @@ static const unsigned char ramsize_table[5] = static const char *romfile; static char sramfile[500]; static char rtcfile[500]; +static char snfile[500]; static char saveprefix[500]; static int forcebatt, nobatt; @@ -269,6 +270,24 @@ static void rtc_load(void) close(fd); } +void sn_save(void) +{ + int fd; + if ((fd = open(snfile, O_WRONLY | O_CREAT, 0666)) < 0) + return; + savestate(fd); + close(fd); +} + +void sn_load(void) +{ + int fd; + if ((fd = open(snfile, O_RDONLY, 0666)) < 0) + return; + loadstate(fd); + close(fd); +} + void cleanup(void) { sram_save(); @@ -289,6 +308,8 @@ void loader_init(const char *s) strcpy(rtcfile, saveprefix); strcat(rtcfile, ".rtc"); + strcpy(snfile, saveprefix); + strcat(snfile, ".sn"); sram_load(); rtc_load(); -- cgit v1.2.3