mirror of https://github.com/mgba-emu/mgba.git
Fix stream recording resumption
This commit is contained in:
parent
484a7f299a
commit
6291a62860
|
@ -22,6 +22,7 @@ static bool _emitEnd(struct GBARRContext* rr, struct VFile* vf);
|
||||||
static bool _parseMetadata(struct GBARRContext* rr, struct VFile* vf);
|
static bool _parseMetadata(struct GBARRContext* rr, struct VFile* vf);
|
||||||
|
|
||||||
static bool _markStreamNext(struct GBARRContext* rr, uint32_t newStreamId, bool recursive);
|
static bool _markStreamNext(struct GBARRContext* rr, uint32_t newStreamId, bool recursive);
|
||||||
|
static void _streamEndReached(struct GBARRContext* rr);
|
||||||
|
|
||||||
static struct VFile* _openSavedata(struct GBARRContext* rr, int flags);
|
static struct VFile* _openSavedata(struct GBARRContext* rr, int flags);
|
||||||
static struct VFile* _openSavestate(struct GBARRContext* rr, int flags);
|
static struct VFile* _openSavestate(struct GBARRContext* rr, int flags);
|
||||||
|
@ -303,13 +304,7 @@ void GBARRNextFrame(struct GBARRContext* rr) {
|
||||||
rr->inputThisFrame = false;
|
rr->inputThisFrame = false;
|
||||||
} else {
|
} else {
|
||||||
if (!_seekTag(rr, rr->movieStream, TAG_FRAME)) {
|
if (!_seekTag(rr, rr->movieStream, TAG_FRAME)) {
|
||||||
uint32_t endStreamId = rr->streamId;
|
_streamEndReached(rr);
|
||||||
GBARRStopPlaying(rr);
|
|
||||||
if (rr->autorecord) {
|
|
||||||
rr->isRecording = true;
|
|
||||||
GBARRLoadStream(rr, endStreamId);
|
|
||||||
GBARRIncrementStream(rr, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -357,6 +352,7 @@ bool GBARRSkipSegment(struct GBARRContext* rr) {
|
||||||
rr->nextTime = 0;
|
rr->nextTime = 0;
|
||||||
while (_readTag(rr, rr->movieStream) != TAG_EOF);
|
while (_readTag(rr, rr->movieStream) != TAG_EOF);
|
||||||
if (!rr->nextTime || !GBARRLoadStream(rr, rr->nextTime)) {
|
if (!rr->nextTime || !GBARRLoadStream(rr, rr->nextTime)) {
|
||||||
|
_streamEndReached(rr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -492,7 +488,6 @@ bool _parseMetadata(struct GBARRContext* rr, struct VFile* vf) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rr->maxStreamIdOffset = vf->seek(vf, 0, SEEK_SET);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,6 +543,20 @@ bool _markStreamNext(struct GBARRContext* rr, uint32_t newStreamId, bool recursi
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _streamEndReached(struct GBARRContext* rr) {
|
||||||
|
if (!GBARRIsPlaying(rr)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t endStreamId = rr->streamId;
|
||||||
|
GBARRStopPlaying(rr);
|
||||||
|
if (rr->autorecord) {
|
||||||
|
rr->isRecording = true;
|
||||||
|
GBARRLoadStream(rr, endStreamId);
|
||||||
|
GBARRIncrementStream(rr, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct VFile* _openSavedata(struct GBARRContext* rr, int flags) {
|
struct VFile* _openSavedata(struct GBARRContext* rr, int flags) {
|
||||||
return rr->streamDir->openFile(rr->streamDir, "movie.sav", flags);
|
return rr->streamDir->openFile(rr->streamDir, "movie.sav", flags);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue