mirror of https://github.com/mgba-emu/mgba.git
Expose GBAGetState
This commit is contained in:
parent
0d1b323e22
commit
65ce79c611
|
@ -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' };
|
char suffix[5] = { '\0' };
|
||||||
snprintf(suffix, sizeof(suffix), ".ss%d", slot);
|
snprintf(suffix, sizeof(suffix), ".ss%d", slot);
|
||||||
return VDirOptionalOpenFile(dir, gba->activeFile, "savestate", suffix, write ? (O_CREAT | O_TRUNC | O_RDWR) : O_RDONLY);
|
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
|
#endif
|
||||||
|
|
||||||
bool GBASaveState(struct GBA* gba, struct VDir* dir, int slot, bool screenshot) {
|
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) {
|
if (!vf) {
|
||||||
return false;
|
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) {
|
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) {
|
if (!vf) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 GBASaveState(struct GBA* gba, struct VDir* dir, int slot, bool screenshot);
|
||||||
bool GBALoadState(struct GBA* gba, struct VDir* dir, int slot);
|
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 GBASaveStateNamed(struct GBA* gba, struct VFile* vf, bool screenshot);
|
||||||
bool GBALoadStateNamed(struct GBA* gba, struct VFile* vf);
|
bool GBALoadStateNamed(struct GBA* gba, struct VFile* vf);
|
||||||
|
|
Loading…
Reference in New Issue