mirror of https://github.com/mgba-emu/mgba.git
Qt: Allow overrides to be saved before a game is loaded
This commit is contained in:
parent
92f18fbf3e
commit
8a5183df0b
1
CHANGES
1
CHANGES
|
@ -54,6 +54,7 @@ Misc:
|
|||
- 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:
|
||||
|
|
|
@ -85,7 +85,6 @@ OverrideView::OverrideView(ConfigController* config, QWidget* parent)
|
|||
|
||||
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 @@ void OverrideView::setController(std::shared_ptr<CoreController> controller) {
|
|||
}
|
||||
|
||||
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 @@ void OverrideView::gameStarted() {
|
|||
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 @@ void OverrideView::gameStarted() {
|
|||
case PLATFORM_NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_savePending) {
|
||||
m_savePending = false;
|
||||
saveOverride();
|
||||
}
|
||||
}
|
||||
|
||||
void OverrideView::gameStopped() {
|
||||
|
@ -228,7 +237,6 @@ void OverrideView::gameStopped() {
|
|||
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);
|
||||
|
|
|
@ -47,6 +47,7 @@ private:
|
|||
|
||||
std::shared_ptr<CoreController> m_controller;
|
||||
ConfigController* m_config;
|
||||
bool m_savePending = false;
|
||||
|
||||
#ifdef M_CORE_GB
|
||||
uint32_t m_gbColors[4]{};
|
||||
|
|
Loading…
Reference in New Issue