Qt: Improve handling of disabling VBA bug compat mode (fixes #2129)

This commit is contained in:
Vicki Pfau 2021-04-15 23:19:06 -07:00
parent 8094345153
commit 2dc47e63dd
8 changed files with 52 additions and 17 deletions

View File

@ -26,6 +26,7 @@ Misc:
- GBA Memory: Log GPIO writes on non-GPIO carts as Pak Hardware instead of Memory
- Qt: Add ROM filename and size to bug reporter
- Qt: Rearrange menus some
- Qt: Improve handling of disabling VBA bug compat mode (fixes mgba.io/i/2129)
0.9.0: (2021-03-28)
Features:

View File

@ -300,6 +300,7 @@ static void _GBACoreLoadConfig(struct mCore* core, const struct mCoreConfig* con
mCoreConfigCopyValue(&core->config, config, "gba.bios");
mCoreConfigCopyValue(&core->config, config, "gba.forceGbp");
mCoreConfigCopyValue(&core->config, config, "gba.audioHle");
mCoreConfigCopyValue(&core->config, config, "vbaBugCompat");
#ifndef DISABLE_THREADING
mCoreConfigCopyValue(&core->config, config, "threadedVideo");
@ -610,6 +611,10 @@ static void _GBACoreReset(struct mCore* core) {
if (mCoreConfigGetIntValue(&core->config, "gba.forceGbp", &fakeBool)) {
forceGbp = fakeBool;
}
bool vbaBugCompat = true;
if (mCoreConfigGetIntValue(&core->config, "vbaBugCompat", &fakeBool)) {
vbaBugCompat = fakeBool;
}
if (!forceGbp) {
gba->memory.hw.devices &= ~HW_GB_PLAYER_DETECTION;
}
@ -617,6 +622,9 @@ static void _GBACoreReset(struct mCore* core) {
if (forceGbp) {
gba->memory.hw.devices |= HW_GB_PLAYER_DETECTION;
}
if (!vbaBugCompat) {
gba->vbaBugCompat = false;
}
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
if (!gba->biosVf && core->opts.useBios) {

View File

@ -6,6 +6,7 @@
#include "GBAOverride.h"
#include <mgba/core/core.h>
#include <mgba/internal/gba/gba.h>
using namespace QGBA;
@ -13,7 +14,11 @@ void GBAOverride::apply(struct mCore* core) {
if (core->platform(core) != mPLATFORM_GBA) {
return;
}
GBAOverrideApply(static_cast<GBA*>(core->board), &override);
GBA* gba = static_cast<GBA*>(core->board);
if (!vbaBugCompatSet) {
override.vbaBugCompat = gba->vbaBugCompat;
}
GBAOverrideApply(gba, &override);
}
void GBAOverride::identify(const struct mCore* core) {

View File

@ -18,6 +18,7 @@ public:
void save(struct Configuration*) const override;
struct GBACartridgeOverride override;
bool vbaBugCompatSet;
};
}

View File

@ -144,6 +144,7 @@ void OverrideView::updateOverrides() {
gba->override.idleLoop = IDLE_LOOP_NONE;
gba->override.mirroring = false;
gba->override.vbaBugCompat = false;
gba->vbaBugCompatSet = false;
if (!m_ui.hwAutodetect->isChecked()) {
hasOverride = true;
@ -168,9 +169,10 @@ void OverrideView::updateOverrides() {
hasOverride = true;
gba->override.hardware |= HW_GB_PLAYER_DETECTION;
}
if (m_ui.vbaBugCompat->isChecked()) {
if (m_ui.vbaBugCompat->checkState() != Qt::PartiallyChecked) {
hasOverride = true;
gba->override.vbaBugCompat = true;
gba->vbaBugCompatSet = true;
gba->override.vbaBugCompat = m_ui.vbaBugCompat->isChecked();
}
bool ok;
@ -270,7 +272,7 @@ void OverrideView::gameStopped() {
m_ui.tabWidget->setEnabled(true);
m_ui.savetype->setCurrentIndex(0);
m_ui.idleLoop->clear();
m_ui.vbaBugCompat->setChecked(false);
m_ui.vbaBugCompat->setCheckState(Qt::PartiallyChecked);
m_ui.mbc->setCurrentIndex(0);
m_ui.gbModel->setCurrentIndex(0);

View File

@ -186,6 +186,12 @@
<property name="text">
<string>VBA bug compatibility mode</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
<property name="checkState">
<enum>Qt::PartiallyChecked</enum>
</property>
</widget>
</item>
</layout>

View File

@ -429,6 +429,7 @@ void SettingsView::updateConfig() {
saveSetting("dynamicTitle", m_ui.dynamicTitle);
saveSetting("videoScale", m_ui.videoScale);
saveSetting("gba.forceGbp", m_ui.forceGbp);
saveSetting("vbaBugCompat", m_ui.vbaBugCompat);
if (m_ui.audioBufferSize->currentText().toInt() > 8192) {
m_ui.audioBufferSize->setCurrentText("8192");
@ -622,6 +623,7 @@ void SettingsView::reloadConfig() {
loadSetting("gba.audioHle", m_ui.audioHle);
loadSetting("dynamicTitle", m_ui.dynamicTitle, true);
loadSetting("gba.forceGbp", m_ui.forceGbp);
loadSetting("vbaBugCompat", m_ui.vbaBugCompat, true);
m_ui.libraryStyle->setCurrentIndex(loadSetting("libraryStyle").toInt());

View File

@ -873,21 +873,28 @@
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<item row="9" column="1">
<widget class="QCheckBox" name="forceGbp">
<property name="text">
<string>Enable Game Boy Player features by default</string>
</property>
</widget>
</item>
<item row="11" column="0" colspan="2">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="11" column="0">
<item row="12" column="0">
<widget class="QLabel" name="label_24">
<property name="text">
<string>Save state extra data:</string>
</property>
</widget>
</item>
<item row="11" column="1">
<item row="12" column="1">
<widget class="QCheckBox" name="saveStateScreenshot">
<property name="text">
<string>Screenshot</string>
@ -897,7 +904,7 @@
</property>
</widget>
</item>
<item row="12" column="1">
<item row="13" column="1">
<widget class="QCheckBox" name="saveStateSave">
<property name="text">
<string>Save game</string>
@ -907,7 +914,7 @@
</property>
</widget>
</item>
<item row="13" column="1">
<item row="14" column="1">
<widget class="QCheckBox" name="saveStateCheats">
<property name="text">
<string>Cheat codes</string>
@ -917,21 +924,21 @@
</property>
</widget>
</item>
<item row="14" column="0" colspan="2">
<item row="15" column="0" colspan="2">
<widget class="Line" name="line_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="15" column="0">
<item row="16" column="0">
<widget class="QLabel" name="label_25">
<property name="text">
<string>Load state extra data:</string>
</property>
</widget>
</item>
<item row="15" column="1">
<item row="16" column="1">
<widget class="QCheckBox" name="loadStateScreenshot">
<property name="text">
<string>Screenshot</string>
@ -941,24 +948,27 @@
</property>
</widget>
</item>
<item row="16" column="1">
<item row="17" column="1">
<widget class="QCheckBox" name="loadStateSave">
<property name="text">
<string>Save game</string>
</property>
</widget>
</item>
<item row="17" column="1">
<item row="18" column="1">
<widget class="QCheckBox" name="loadStateCheats">
<property name="text">
<string>Cheat codes</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QCheckBox" name="forceGbp">
<item row="10" column="1">
<widget class="QCheckBox" name="vbaBugCompat">
<property name="text">
<string>Enable Game Boy Player features by default</string>
<string>Enable VBA bug compatibility in ROM hacks</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>