all repos — mgba @ 8a5183df0b927429ac42cc2a4a141c2f7d56202a

mGBA Game Boy Advance Emulator

Qt: Allow overrides to be saved before a game is loaded
Vicki Pfau vi@endrift.com
Wed, 20 Sep 2017 22:39:45 -0700
commit

8a5183df0b927429ac42cc2a4a141c2f7d56202a

parent

92f18fbf3e940e9f9fa02cbe911310d6dfeef704

3 files changed, 15 insertions(+), 5 deletions(-)

jump to
M CHANGESCHANGES

@@ -54,6 +54,7 @@ - Python: Integrate tests from cinema test suite

- Util: Don't build crc32 if the function already exists - GBA: Detect hardware for Pokémon FireRed ROM hacks - CMake: Fix CPack dependencies for libpng 1.6 + - Qt: Allow overrides to be saved before a game is loaded 0.6.0: (2017-07-16) Features:
M src/platform/qt/OverrideView.cppsrc/platform/qt/OverrideView.cpp

@@ -85,7 +85,6 @@ #endif

connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &OverrideView::saveOverride); connect(m_ui.buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close); - m_ui.buttonBox->button(QDialogButtonBox::Save)->setEnabled(false); } void OverrideView::setController(std::shared_ptr<CoreController> controller) {

@@ -96,10 +95,16 @@ updateOverrides();

} void OverrideView::saveOverride() { - if (!m_config || !m_controller) { + if (!m_controller) { + m_savePending = true; return; } - m_config->saveOverride(*m_controller->override()); + + Override* override = m_controller->override(); + if (!override) { + return; + } + m_config->saveOverride(*override); } void OverrideView::updateOverrides() {

@@ -176,7 +181,6 @@ CoreController::Interrupter interrupter(m_controller);

mCoreThread* thread = m_controller->thread(); m_ui.tabWidget->setEnabled(false); - m_ui.buttonBox->button(QDialogButtonBox::Save)->setEnabled(true); switch (thread->core->platform(thread->core)) { #ifdef M_CORE_GBA

@@ -221,6 +225,11 @@ #endif

case PLATFORM_NONE: break; } + + if (m_savePending) { + m_savePending = false; + saveOverride(); + } } void OverrideView::gameStopped() {

@@ -228,7 +237,6 @@ m_controller.reset();

m_ui.tabWidget->setEnabled(true); m_ui.savetype->setCurrentIndex(0); m_ui.idleLoop->clear(); - m_ui.buttonBox->button(QDialogButtonBox::Save)->setEnabled(false); m_ui.mbc->setCurrentIndex(0); m_ui.gbModel->setCurrentIndex(0);
M src/platform/qt/OverrideView.hsrc/platform/qt/OverrideView.h

@@ -47,6 +47,7 @@ Ui::OverrideView m_ui;

std::shared_ptr<CoreController> m_controller; ConfigController* m_config; + bool m_savePending = false; #ifdef M_CORE_GB uint32_t m_gbColors[4]{};