From 65ce79c6110df10e26c50083b728944349eed464 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Tue, 14 Oct 2014 01:05:53 -0700 Subject: [PATCH] Expose GBAGetState --- src/gba/gba-serialize.c | 6 +++--- src/gba/gba-serialize.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gba/gba-serialize.c b/src/gba/gba-serialize.c index b26fd169e..8cfdf1df6 100644 --- a/src/gba/gba-serialize.c +++ b/src/gba/gba-serialize.c @@ -102,7 +102,7 @@ void GBADeserialize(struct GBA* gba, struct GBASerializedState* state) { } } -static struct VFile* _getStateVf(struct GBA* gba, struct VDir* dir, int slot, bool write) { +struct VFile* GBAGetState(struct GBA* gba, struct VDir* dir, int slot, bool write) { char suffix[5] = { '\0' }; snprintf(suffix, sizeof(suffix), ".ss%d", slot); return VDirOptionalOpenFile(dir, gba->activeFile, "savestate", suffix, write ? (O_CREAT | O_TRUNC | O_RDWR) : O_RDONLY); @@ -167,7 +167,7 @@ static bool _loadPNGState(struct GBA* gba, struct VFile* vf) { #endif bool GBASaveState(struct GBA* gba, struct VDir* dir, int slot, bool screenshot) { - struct VFile* vf = _getStateVf(gba, dir, slot, true); + struct VFile* vf = GBAGetState(gba, dir, slot, true); if (!vf) { return false; } @@ -177,7 +177,7 @@ bool GBASaveState(struct GBA* gba, struct VDir* dir, int slot, bool screenshot) } bool GBALoadState(struct GBA* gba, struct VDir* dir, int slot) { - struct VFile* vf = _getStateVf(gba, dir, slot, false); + struct VFile* vf = GBAGetState(gba, dir, slot, false); if (!vf) { return false; } diff --git a/src/gba/gba-serialize.h b/src/gba/gba-serialize.h index 86edf9de5..bf1461beb 100644 --- a/src/gba/gba-serialize.h +++ b/src/gba/gba-serialize.h @@ -271,6 +271,7 @@ void GBADeserialize(struct GBA* gba, struct GBASerializedState* state); bool GBASaveState(struct GBA* gba, struct VDir* dir, int slot, bool screenshot); bool GBALoadState(struct GBA* gba, struct VDir* dir, int slot); +struct VFile* GBAGetState(struct GBA* gba, struct VDir* dir, int slot, bool write); bool GBASaveStateNamed(struct GBA* gba, struct VFile* vf, bool screenshot); bool GBALoadStateNamed(struct GBA* gba, struct VFile* vf);