mirror of https://github.com/mgba-emu/mgba.git
Start working on ability to bundle save data with movies
This commit is contained in:
parent
220d836f13
commit
f8fff828e3
|
@ -41,6 +41,18 @@ void GBARRContextDestroy(struct GBA* gba) {
|
||||||
gba->rr = 0;
|
gba->rr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GBARRAlterSavedata(struct GBA* gba) {
|
||||||
|
if (!gba || !gba->rr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gba->rr->initFrom & INIT_FROM_SAVEGAME) {
|
||||||
|
// TOOD
|
||||||
|
} else {
|
||||||
|
GBASavedataMask(&gba->memory.savedata, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool GBARRInitStream(struct GBARRContext* rr, struct VDir* stream) {
|
bool GBARRInitStream(struct GBARRContext* rr, struct VDir* stream) {
|
||||||
if (rr->movieStream && !rr->movieStream->close(rr->movieStream)) {
|
if (rr->movieStream && !rr->movieStream->close(rr->movieStream)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -77,6 +77,7 @@ struct GBARRContext {
|
||||||
|
|
||||||
void GBARRContextCreate(struct GBA*);
|
void GBARRContextCreate(struct GBA*);
|
||||||
void GBARRContextDestroy(struct GBA*);
|
void GBARRContextDestroy(struct GBA*);
|
||||||
|
void GBARRAlterSavedata(struct GBA*);
|
||||||
|
|
||||||
bool GBARRInitStream(struct GBARRContext*, struct VDir*);
|
bool GBARRInitStream(struct GBARRContext*, struct VDir*);
|
||||||
bool GBARRReinitStream(struct GBARRContext*, enum GBARRInitFrom);
|
bool GBARRReinitStream(struct GBARRContext*, enum GBARRInitFrom);
|
||||||
|
|
|
@ -60,6 +60,11 @@ void GBASavedataDeinit(struct GBASavedata* savedata) {
|
||||||
savedata->type = SAVEDATA_NONE;
|
savedata->type = SAVEDATA_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GBASavedataMask(struct GBASavedata* savedata, struct VFile* vf) {
|
||||||
|
GBASavedataDeinit(savedata);
|
||||||
|
GBASavedataInit(savedata, vf);
|
||||||
|
}
|
||||||
|
|
||||||
void GBASavedataInitFlash(struct GBASavedata* savedata) {
|
void GBASavedataInitFlash(struct GBASavedata* savedata) {
|
||||||
if (savedata->type == SAVEDATA_NONE) {
|
if (savedata->type == SAVEDATA_NONE) {
|
||||||
savedata->type = SAVEDATA_FLASH512;
|
savedata->type = SAVEDATA_FLASH512;
|
||||||
|
|
|
@ -71,6 +71,7 @@ struct GBASavedata {
|
||||||
|
|
||||||
void GBASavedataInit(struct GBASavedata* savedata, struct VFile* vf);
|
void GBASavedataInit(struct GBASavedata* savedata, struct VFile* vf);
|
||||||
void GBASavedataDeinit(struct GBASavedata* savedata);
|
void GBASavedataDeinit(struct GBASavedata* savedata);
|
||||||
|
void GBASavedataMask(struct GBASavedata* savedata, struct VFile* vf);
|
||||||
|
|
||||||
void GBASavedataInitFlash(struct GBASavedata* savedata);
|
void GBASavedataInitFlash(struct GBASavedata* savedata);
|
||||||
void GBASavedataInitEEPROM(struct GBASavedata* savedata);
|
void GBASavedataInitEEPROM(struct GBASavedata* savedata);
|
||||||
|
|
|
@ -128,9 +128,10 @@ static void _GBASDLHandleKeypress(struct GBAThread* context, struct GBASDLEvents
|
||||||
GBARRContextCreate(context->gba);
|
GBARRContextCreate(context->gba);
|
||||||
if (!GBARRIsRecording(context->gba->rr)) {
|
if (!GBARRIsRecording(context->gba->rr)) {
|
||||||
GBARRInitStream(context->gba->rr, context->stateDir);
|
GBARRInitStream(context->gba->rr, context->stateDir);
|
||||||
GBARRReinitStream(context->gba->rr, INIT_FROM_SAVEGAME);
|
GBARRReinitStream(context->gba->rr, INIT_EX_NIHILO);
|
||||||
GBARRStopPlaying(context->gba->rr);
|
GBARRStopPlaying(context->gba->rr);
|
||||||
GBARRStartRecording(context->gba->rr);
|
GBARRStartRecording(context->gba->rr);
|
||||||
|
GBARRAlterSavedata(context->gba);
|
||||||
}
|
}
|
||||||
GBAThreadContinue(context);
|
GBAThreadContinue(context);
|
||||||
}
|
}
|
||||||
|
@ -142,7 +143,11 @@ static void _GBASDLHandleKeypress(struct GBAThread* context, struct GBASDLEvents
|
||||||
GBARRContextCreate(context->gba);
|
GBARRContextCreate(context->gba);
|
||||||
GBARRInitStream(context->gba->rr, context->stateDir);
|
GBARRInitStream(context->gba->rr, context->stateDir);
|
||||||
GBARRStopRecording(context->gba->rr);
|
GBARRStopRecording(context->gba->rr);
|
||||||
GBARRStartPlaying(context->gba->rr, event->keysym.mod & KMOD_SHIFT);
|
GBARRStartPlaying(context->gba->rr, false);
|
||||||
|
if (context->gba->rr->initFrom & INIT_FROM_SAVESTATE) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
GBARRAlterSavedata(context->gba);
|
||||||
GBAThreadContinue(context);
|
GBAThreadContinue(context);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue