all repos — mgba @ b8e9f50c92a55c3d81b2f5f12bbc6d49a84f1a9c

mGBA Game Boy Advance Emulator

Core: Add mVideoLogIsCompatible function
Vicki Pfau vi@endrift.com
Tue, 23 Jun 2020 22:59:00 -0700
commit

b8e9f50c92a55c3d81b2f5f12bbc6d49a84f1a9c

parent

386b788956da824036574fd445e2efd59d9afba6

2 files changed, 23 insertions(+), 2 deletions(-)

jump to
M include/mgba/feature/video-logger.hinclude/mgba/feature/video-logger.h

@@ -10,6 +10,8 @@ #include <mgba-util/common.h>

CXX_GUARD_START +#include <mgba/core/core.h> + #include <mgba-util/circle-buffer.h> #define mVL_MAX_CHANNELS 32

@@ -128,6 +130,7 @@ void mVideoLoggerInjectVideoRegister(struct mVideoLogger* logger, uint32_t address, uint16_t value);

void mVideoLoggerInjectPalette(struct mVideoLogger* logger, uint32_t address, uint16_t value); void mVideoLoggerInjectOAM(struct mVideoLogger* logger, uint32_t address, uint16_t value); +enum mPlatform mVideoLogIsCompatible(struct VFile*); struct mCore* mVideoLogCoreFind(struct VFile*); CXX_GUARD_END
M src/feature/video-logger.csrc/feature/video-logger.c

@@ -5,7 +5,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this

* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include <mgba/feature/video-logger.h> -#include <mgba/core/core.h> #include <mgba-util/memory.h> #include <mgba-util/vfs.h> #include <mgba-util/math.h>

@@ -1033,7 +1032,7 @@ }

return read; } -struct mCore* mVideoLogCoreFind(struct VFile* vf) { +static const struct mVLDescriptor* _mVideoLogDescriptor(struct VFile* vf) { if (!vf) { return NULL; }

@@ -1054,6 +1053,25 @@ for (descriptor = &_descriptors[0]; descriptor->platform != PLATFORM_NONE; ++descriptor) {

if (platform == descriptor->platform) { break; } + } + if (descriptor->platform == PLATFORM_NONE) { + return NULL; + } + return descriptor; +} + +enum mPlatform mVideoLogIsCompatible(struct VFile* vf) { + const struct mVLDescriptor* descriptor = _mVideoLogDescriptor(vf); + if (descriptor) { + return descriptor->platform; + } + return PLATFORM_NONE; +} + +struct mCore* mVideoLogCoreFind(struct VFile* vf) { + const struct mVLDescriptor* descriptor = _mVideoLogDescriptor(vf); + if (!descriptor) { + return NULL; } struct mCore* core = NULL; if (descriptor->open) {