1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Michael Stummvoll 2010-11-25 12:45:13 +00:00
parent 8971b230dc
commit 7704a3ccd7
5 changed files with 49 additions and 9 deletions

View file

@ -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();