all repos — mgba @ fe0af2c563421d9a1750686683cc760bce572ef8

mGBA Game Boy Advance Emulator

GBA: Add option to disable loading BIOS even if BIOS path is stored (fixes #203)
Jeffrey Pfau jeffrey@endrift.com
Mon, 16 Mar 2015 23:14:52 -0700
commit

fe0af2c563421d9a1750686683cc760bce572ef8

parent

a8dae9b9d5546a2fdfdea3674e813a7883d913df

M src/gba/supervisor/config.csrc/gba/supervisor/config.c

@@ -190,6 +190,9 @@ opts->audioBuffers = audioBuffers;

} int fakeBool; + if (_lookupIntValue(config, "useSync", &fakeBool)) { + opts->useBios = fakeBool; + } if (_lookupIntValue(config, "audioSync", &fakeBool)) { opts->audioSync = fakeBool; }

@@ -229,6 +232,7 @@

void GBAConfigLoadDefaults(struct GBAConfig* config, const struct GBAOptions* opts) { ConfigurationSetValue(&config->defaultsTable, 0, "bios", opts->bios); ConfigurationSetIntValue(&config->defaultsTable, 0, "skipBios", opts->skipBios); + ConfigurationSetIntValue(&config->defaultsTable, 0, "useBios", opts->useBios); ConfigurationSetIntValue(&config->defaultsTable, 0, "logLevel", opts->logLevel); ConfigurationSetIntValue(&config->defaultsTable, 0, "frameskip", opts->frameskip); ConfigurationSetIntValue(&config->defaultsTable, 0, "rewindEnable", opts->rewindEnable);
M src/gba/supervisor/config.hsrc/gba/supervisor/config.h

@@ -21,6 +21,7 @@

struct GBAOptions { char* bios; bool skipBios; + bool useBios; int logLevel; int frameskip; bool rewindEnable;
M src/gba/supervisor/thread.csrc/gba/supervisor/thread.c

@@ -310,7 +310,11 @@ return 0;

} void GBAMapOptionsToContext(const struct GBAOptions* opts, struct GBAThread* threadContext) { - threadContext->bios = VFileOpen(opts->bios, O_RDONLY); + if (opts->useBios) { + threadContext->bios = VFileOpen(opts->bios, O_RDONLY); + } else { + threadContext->bios = 0; + } threadContext->frameskip = opts->frameskip; threadContext->logLevel = opts->logLevel; if (opts->rewindEnable) {
M src/platform/qt/ConfigController.cppsrc/platform/qt/ConfigController.cpp

@@ -100,6 +100,7 @@ m_opts.logLevel = GBA_LOG_WARN | GBA_LOG_ERROR | GBA_LOG_FATAL;

m_opts.rewindEnable = false; m_opts.rewindBufferInterval = 0; m_opts.rewindBufferCapacity = 0; + m_opts.useBios = true; GBAConfigLoadDefaults(&m_config, &m_opts); GBAConfigLoad(&m_config); GBAConfigMap(&m_config, &m_opts);
M src/platform/qt/GameController.cppsrc/platform/qt/GameController.cpp

@@ -156,6 +156,7 @@ setFrameskip(opts->frameskip);

setAudioSync(opts->audioSync); setVideoSync(opts->videoSync); setSkipBIOS(opts->skipBios); + setUseBIOS(opts->useBios); setRewind(opts->rewindEnable, opts->rewindBufferCapacity, opts->rewindBufferInterval); threadInterrupt();

@@ -228,8 +229,10 @@ }

#endif } - if (!m_bios.isNull()) { + if (!m_bios.isNull() &&m_useBios) { m_threadContext.bios = VFileOpen(m_bios.toLocal8Bit().constData(), O_RDONLY); + } else { + m_threadContext.bios = nullptr; } if (!m_patch.isNull()) {

@@ -399,6 +402,12 @@

void GameController::setSkipBIOS(bool set) { threadInterrupt(); m_threadContext.skipBios = set; + threadContinue(); +} + +void GameController::setUseBIOS(bool use) { + threadInterrupt(); + m_useBios = use; threadContinue(); }
M src/platform/qt/GameController.hsrc/platform/qt/GameController.h

@@ -87,6 +87,7 @@ public slots:

void loadGame(const QString& path, bool dirmode = false); void loadBIOS(const QString& path); void setSkipBIOS(bool); + void setUseBIOS(bool); void loadPatch(const QString& path); void openGame(); void closeGame();

@@ -151,6 +152,7 @@ bool m_dirmode;

QString m_fname; QString m_bios; + bool m_useBios; QString m_patch; QThread* m_audioThread;
M src/platform/qt/SettingsView.cppsrc/platform/qt/SettingsView.cpp

@@ -19,6 +19,7 @@ {

m_ui.setupUi(this); loadSetting("bios", m_ui.bios); + loadSetting("useBios", m_ui.useBios); loadSetting("skipBios", m_ui.skipBios); loadSetting("audioBuffers", m_ui.audioBufferSize); loadSetting("videoSync", m_ui.videoSync);

@@ -68,6 +69,7 @@ }

void SettingsView::updateConfig() { saveSetting("bios", m_ui.bios); + saveSetting("useBios", m_ui.useBios); saveSetting("skipBios", m_ui.skipBios); saveSetting("audioBuffers", m_ui.audioBufferSize); saveSetting("videoSync", m_ui.videoSync);
M src/platform/qt/SettingsView.uisrc/platform/qt/SettingsView.ui

@@ -62,9 +62,6 @@ </widget>

</item> <item row="2" column="1"> <widget class="QCheckBox" name="useBios"> - <property name="enabled"> - <bool>false</bool> - </property> <property name="text"> <string>Use BIOS file</string> </property>
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -196,6 +196,8 @@ if (!filename.isEmpty()) {

m_config->setQtOption("lastDirectory", QFileInfo(filename).dir().path()); m_config->setOption("bios", filename); m_config->updateOption("bios"); + m_config->setOption("useBios", true); + m_config->updateOption("useBios"); m_controller->loadBIOS(filename); } }

@@ -732,6 +734,9 @@ #endif

ConfigOption* skipBios = m_config->addOption("skipBios"); skipBios->connect([this](const QVariant& value) { m_controller->setSkipBIOS(value.toBool()); }); + + ConfigOption* useBios = m_config->addOption("useBios"); + useBios->connect([this](const QVariant& value) { m_controller->setUseBIOS(value.toBool()); }); ConfigOption* rewindEnable = m_config->addOption("rewindEnable"); rewindEnable->connect([this](const QVariant& value) { m_controller->setRewind(value.toBool(), m_config->getOption("rewindBufferCapacity").toInt(), m_config->getOption("rewindBufferInterval").toInt()); });
M src/platform/sdl/main.csrc/platform/sdl/main.c

@@ -45,6 +45,7 @@

struct GBAOptions opts = { .width = VIDEO_HORIZONTAL_PIXELS, .height = VIDEO_VERTICAL_PIXELS, + .useBios = true, .rewindEnable = true, .audioBuffers = 512, .videoSync = false,