mirror of
https://github.com/libretro/mgba.git
synced 2024-11-24 08:30:30 +00:00
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 _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* _openSavestate(struct GBARRContext* rr, int flags);
|
||||
@ -303,13 +304,7 @@ void GBARRNextFrame(struct GBARRContext* rr) {
|
||||
rr->inputThisFrame = false;
|
||||
} else {
|
||||
if (!_seekTag(rr, rr->movieStream, TAG_FRAME)) {
|
||||
uint32_t endStreamId = rr->streamId;
|
||||
GBARRStopPlaying(rr);
|
||||
if (rr->autorecord) {
|
||||
rr->isRecording = true;
|
||||
GBARRLoadStream(rr, endStreamId);
|
||||
GBARRIncrementStream(rr, false);
|
||||
}
|
||||
_streamEndReached(rr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -357,6 +352,7 @@ bool GBARRSkipSegment(struct GBARRContext* rr) {
|
||||
rr->nextTime = 0;
|
||||
while (_readTag(rr, rr->movieStream) != TAG_EOF);
|
||||
if (!rr->nextTime || !GBARRLoadStream(rr, rr->nextTime)) {
|
||||
_streamEndReached(rr);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -492,7 +488,6 @@ bool _parseMetadata(struct GBARRContext* rr, struct VFile* vf) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
rr->maxStreamIdOffset = vf->seek(vf, 0, SEEK_SET);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -548,6 +543,20 @@ bool _markStreamNext(struct GBARRContext* rr, uint32_t newStreamId, bool recursi
|
||||
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) {
|
||||
return rr->streamDir->openFile(rr->streamDir, "movie.sav", flags);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user