From 9063a0179de399353c76c6406338d8e495fbd726 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 8 Apr 2017 14:14:59 -0500 Subject: [PATCH] Fix findMedia to make sure it gets both media header segments --- src/core/gba/media.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/gba/media.cpp b/src/core/gba/media.cpp index 6e5beeac..cd5af72f 100644 --- a/src/core/gba/media.cpp +++ b/src/core/gba/media.cpp @@ -23,8 +23,8 @@ uint8_t *findMedia() { const static auto headerP2Len = 16; const static auto headerLen = headerP1Len + headerP2Len + 1; - for (uint8_t *current = &MEM_ROM; current < ((uint8_t*) 0x0a000000); current += headerLen) { - if (ox_memcmp(current, headerP1, headerP1Len) == 0 || + for (auto current = &MEM_ROM; current < ((uint8_t*) 0x0a000000); current += headerLen) { + if (ox_memcmp(current, headerP1, headerP1Len) == 0 && ox_memcmp(current + headerP1Len, headerP2, headerP2Len) == 0) { return current + headerLen; }