mirror of
https://github.com/libretro/mgba.git
synced 2024-12-18 05:57:12 +00:00
Core: Fix flushing a read video log
This commit is contained in:
parent
deffdc79a0
commit
c4aa669cf1
@ -80,6 +80,7 @@ struct mVideoLogContext {
|
||||
uint32_t nChannels;
|
||||
struct mVideoLogChannel channels[mVL_MAX_CHANNELS];
|
||||
|
||||
bool write;
|
||||
uint32_t activeChannel;
|
||||
struct VFile* backing;
|
||||
};
|
||||
@ -320,6 +321,8 @@ struct mVideoLogContext* mVideoLogContextCreate(struct mCore* core) {
|
||||
struct mVideoLogContext* context = malloc(sizeof(*context));
|
||||
memset(context, 0, sizeof(*context));
|
||||
|
||||
context->write = !!core;
|
||||
|
||||
if (core) {
|
||||
context->initialStateSize = core->stateSize(core);
|
||||
context->initialState = anonymousMemoryMap(context->initialStateSize);
|
||||
@ -449,11 +452,13 @@ static void _flushBuffer(struct mVideoLogContext* context) {
|
||||
}
|
||||
|
||||
void mVideoLogContextDestroy(struct mCore* core, struct mVideoLogContext* context) {
|
||||
_flushBuffer(context);
|
||||
if (context->write) {
|
||||
_flushBuffer(context);
|
||||
|
||||
struct mVLBlockHeader header = { 0 };
|
||||
STORE_32LE(mVL_BLOCK_FOOTER, 0, &header.blockType);
|
||||
context->backing->write(context->backing, &header, sizeof(header));
|
||||
struct mVLBlockHeader header = { 0 };
|
||||
STORE_32LE(mVL_BLOCK_FOOTER, 0, &header.blockType);
|
||||
context->backing->write(context->backing, &header, sizeof(header));
|
||||
}
|
||||
|
||||
if (core) {
|
||||
core->endVideoLog(core);
|
||||
|
Loading…
Reference in New Issue
Block a user