all repos — mgba @ 2da8c63ec2be3b5816a5f5741c9737789afeb653

mGBA Game Boy Advance Emulator

DS Core: Add video recording
Vicki Pfau vi@endrift.com
Sat, 04 Mar 2017 12:54:39 -0800
commit

2da8c63ec2be3b5816a5f5741c9737789afeb653

parent

928896f978c35578de13bed991ecfb028bbaf5b2

3 files changed, 13 insertions(+), 0 deletions(-)

jump to
M include/mgba/internal/ds/ds.hinclude/mgba/internal/ds/ds.h

@@ -111,6 +111,7 @@ struct VFile* bios7Vf;

struct VFile* bios9Vf; struct VFile* firmwareVf; + struct mAVStream* stream; struct mKeyCallback* keyCallback; struct mCoreCallbacks* coreCallbacks;
M src/ds/core.csrc/ds/core.c

@@ -162,6 +162,11 @@ ds->coreCallbacks = coreCallbacks;

} static void _DSCoreSetAVStream(struct mCore* core, struct mAVStream* stream) { + struct DS* ds = core->board; + ds->stream = stream; + if (stream && stream->videoDimensionsChanged) { + stream->videoDimensionsChanged(stream, DS_VIDEO_HORIZONTAL_PIXELS, DS_VIDEO_VERTICAL_PIXELS * 2); + } } static bool _DSCoreLoadROM(struct mCore* core, struct VFile* vf) {
M src/ds/ds.csrc/ds/ds.c

@@ -835,4 +835,11 @@ struct mCoreCallbacks* callbacks = ds->coreCallbacks;

if (callbacks && callbacks->videoFrameEnded) { callbacks->videoFrameEnded(callbacks->context); } + + if (ds->stream && ds->stream->postVideoFrame) { + const color_t* pixels; + size_t stride; + ds->video.renderer->getPixels(ds->video.renderer, &stride, (const void**) &pixels); + ds->stream->postVideoFrame(ds->stream, pixels, stride); + } }