all repos — mgba @ ffe99c08b745bdef74d9385a16c2159c6f5744e6

mGBA Game Boy Advance Emulator

Qt: Fix compiling with M_CORE_GB disabled

GB specific code was added without guards, causing configurations with
it disabled to fail compiling:

    cmake -B build -DM_CORE_GB:BOOL=OFF

Resolves: #1578
Fixes: a44a8f668f6a5 ("GB: Add yanking")
Fixes: fbe375fab992c ("Core: Add support for caching bitmapped modes")
Fixes: 06657d9fde5a2 ("Qt: Add additional info to map view")
Fixes: f15aacd0b6aaf ("Qt: Set default Game Boy colors")
Tim Crawford crawfxrd@gmail.com
Wed, 20 Nov 2019 07:30:14 -0700
commit

ffe99c08b745bdef74d9385a16c2159c6f5744e6

parent

a2b3129bc0748e7373443a61259c52231216b704

3 files changed, 11 insertions(+), 1 deletions(-)

jump to
M src/platform/qt/CoreController.cppsrc/platform/qt/CoreController.cpp

@@ -632,12 +632,16 @@ void CoreController::yankPak() {

Interrupter interrupter(this); switch (platform()) { +#ifdef M_CORE_GBA case PLATFORM_GBA: GBAYankROM(static_cast<GBA*>(m_threadContext.core->board)); break; +#endif +#ifdef M_CORE_GB case PLATFORM_GB: GBYankROM(static_cast<GB*>(m_threadContext.core->board)); break; +#endif } }
M src/platform/qt/MapView.cppsrc/platform/qt/MapView.cpp

@@ -167,6 +167,7 @@ int priority = -1;

int frame = 0; QString offset(tr("N/A")); QString transform(tr("N/A")); +#ifdef M_CORE_GBA if (m_controller->platform() == PLATFORM_GBA) { uint16_t* io = static_cast<GBA*>(m_controller->thread()->core->board)->memory.io; int mode = GBARegisterDISPCNTGetMode(io[REG_DISPCNT >> 1]);

@@ -199,12 +200,15 @@ .arg(io[(REG_BG2PD >> 1) + ((m_map - 2) << 2)] / 256., 3, 'f', 2);

} } +#endif +#ifdef M_CORE_GB if (m_controller->platform() == PLATFORM_GB) { uint8_t* io = static_cast<GB*>(m_controller->thread()->core->board)->memory.io; int x = io[m_map == 0 ? 0x42 : 0x4A]; int y = io[m_map == 0 ? 0x43 : 0x4B]; offset = QString("%1, %2").arg(x).arg(y); } +#endif if (bitmap >= 0) { mBitmapCache* bitmapCache = mBitmapCacheSetGetPointer(&m_cacheSet->bitmaps, bitmap); int width = mBitmapCacheSystemInfoGetWidth(bitmapCache->sysConfig);

@@ -266,4 +270,4 @@

void MapView::copyMap() { CoreController::Interrupter interrupter(m_controller); GBAApp::app()->clipboard()->setImage(m_rawMap); -}+}
M src/platform/qt/OverrideView.cppsrc/platform/qt/OverrideView.cpp

@@ -69,6 +69,7 @@ m_ui.hwTilt->setEnabled(!enabled);

m_ui.hwRumble->setEnabled(!enabled); }); +#ifdef M_CORE_GB m_colorPickers[0] = ColorPicker(m_ui.color0, QColor(0xF8, 0xF8, 0xF8)); m_colorPickers[1] = ColorPicker(m_ui.color1, QColor(0xA8, 0xA8, 0xA8)); m_colorPickers[2] = ColorPicker(m_ui.color2, QColor(0x50, 0x50, 0x50));

@@ -86,6 +87,7 @@ connect(&m_colorPickers[colorId], &ColorPicker::colorChanged, this, [this, colorId](const QColor& color) {

m_gbColors[colorId] = color.rgb() | 0xFF000000; }); } +#endif #ifndef M_CORE_GBA m_ui.tabWidget->removeTab(m_ui.tabWidget->indexOf(m_ui.tabGBA));