all repos — mgba @ 02ef49dea81bb60e75d67cc2788066b364af1aa2

mGBA Game Boy Advance Emulator

Expose GBAGetState
Jeffrey Pfau jeffrey@endrift.com
Tue, 14 Oct 2014 01:05:53 -0700
commit

02ef49dea81bb60e75d67cc2788066b364af1aa2

parent

49d668f2854fd8f8e4cc27374db83dd587b5148f

2 files changed, 4 insertions(+), 3 deletions(-)

jump to
M src/gba/gba-serialize.csrc/gba/gba-serialize.c

@@ -102,7 +102,7 @@ GBARRSkipSegment(gba->rr);

} } -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 @@ }

#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 @@ return success;

} 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; }
M src/gba/gba-serialize.hsrc/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);