summaryrefslogtreecommitdiff
path: root/apps/plugins/rockboy/loader.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/rockboy/loader.c')
-rw-r--r--apps/plugins/rockboy/loader.c21
1 files changed, 21 insertions, 0 deletions
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] =
102static const char *romfile; 102static const char *romfile;
103static char sramfile[500]; 103static char sramfile[500];
104static char rtcfile[500]; 104static char rtcfile[500];
105static char snfile[500];
105static char saveprefix[500]; 106static char saveprefix[500];
106 107
107static int forcebatt, nobatt; 108static int forcebatt, nobatt;
@@ -269,6 +270,24 @@ static void rtc_load(void)
269 close(fd); 270 close(fd);
270} 271}
271 272
273void sn_save(void)
274{
275 int fd;
276 if ((fd = open(snfile, O_WRONLY | O_CREAT, 0666)) < 0)
277 return;
278 savestate(fd);
279 close(fd);
280}
281
282void sn_load(void)
283{
284 int fd;
285 if ((fd = open(snfile, O_RDONLY, 0666)) < 0)
286 return;
287 loadstate(fd);
288 close(fd);
289}
290
272void cleanup(void) 291void cleanup(void)
273{ 292{
274 sram_save(); 293 sram_save();
@@ -289,6 +308,8 @@ void loader_init(const char *s)
289 308
290 strcpy(rtcfile, saveprefix); 309 strcpy(rtcfile, saveprefix);
291 strcat(rtcfile, ".rtc"); 310 strcat(rtcfile, ".rtc");
311 strcpy(snfile, saveprefix);
312 strcat(snfile, ".sn");
292 313
293 sram_load(); 314 sram_load();
294 rtc_load(); 315 rtc_load();