From 2bcece4af4d179daabffc55b86c10d738d84aad7 Mon Sep 17 00:00:00 2001 From: David Lindecrantz Date: Tue, 1 Oct 2019 12:59:16 +0200 Subject: [PATCH] Fix GBC banked map output --- src/Common.h | 2 +- src/Map.cpp | 5 ++--- src/superfamiconv.cpp | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Common.h b/src/Common.h index c54b7ab..66f6764 100755 --- a/src/Common.h +++ b/src/Common.h @@ -36,7 +36,7 @@ typedef std::vector rgba_set_vec_t; namespace sfc { -constexpr const char* VERSION = "0.8.6"; +constexpr const char* VERSION = "0.8.7"; constexpr const char* COPYRIGHT = "Copyright (c) 2017-2019 David Lindecrantz"; diff --git a/src/Map.cpp b/src/Map.cpp index 6501824..3592b22 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -89,9 +89,8 @@ byte_vec_t Map::gbc_banked_data() const { const auto linear_data = native_data(); auto banked_data = byte_vec_t(linear_data.size()); - for (unsigned i = 0; i < linear_data.size(); ++i) { - banked_data[!(i % 2) ? i >> 2 : (i >> 2) + (32 * 32)] = linear_data[i]; - } + for (unsigned i = 0; i < linear_data.size() >> 1; ++i) banked_data[i] = linear_data[i << 1]; + for (unsigned i = 0; i < linear_data.size() >> 1; ++i) banked_data[i + (linear_data.size() >> 1)] = linear_data[(i << 1) + 1]; return banked_data; } diff --git a/src/superfamiconv.cpp b/src/superfamiconv.cpp index 75ab3a9..310faf6 100644 --- a/src/superfamiconv.cpp +++ b/src/superfamiconv.cpp @@ -7,7 +7,6 @@ // TODO: Check map output with tiles using duplicate colors (#8) // TODO: Don't always pad native palette output? (Pad every palette but the last? Option?) // TODO: Add more palette packing algorithms -// MAYBE: In sprite-mode, output matched palette metadata #include