SDL: GB saving working

This commit is contained in:
Jeffrey Pfau 2016-01-22 20:25:28 -08:00
parent 77886d4cf4
commit 487c54f0ac
1 changed files with 12 additions and 1 deletions

View File

@ -277,7 +277,18 @@ int mSDLRunGB(struct mSDLRenderer* renderer, struct GBAArguments* args) {
GBVideoAssociateRenderer(&gb.video, &renderer->gb.d);
struct VFile* vf = VFileOpen(args->fname, O_RDONLY);
GBLoadROM(&gb, vf, 0, args->fname);
struct VFile* savVf = 0;
{
char savepath[PATH_MAX];
char dirname[PATH_MAX];
char basename[PATH_MAX];
separatePath(args->fname, dirname, basename, 0);
snprintf(savepath, sizeof(savepath), "%s" PATH_SEP "%s.sav", dirname, basename);
savVf = VFileOpen(savepath, O_RDWR | O_CREAT);
}
GBLoadROM(&gb, vf, savVf, args->fname);
LR35902Reset(&cpu);
renderer->runloop(renderer, &gb);