mirror of https://github.com/mgba-emu/mgba.git
GBA: Add option to disable loading BIOS even if BIOS path is stored (fixes #203)
This commit is contained in:
parent
a8dae9b9d5
commit
fe0af2c563
|
@ -190,6 +190,9 @@ void GBAConfigMap(const struct GBAConfig* config, struct GBAOptions* opts) {
|
|||
}
|
||||
|
||||
int fakeBool;
|
||||
if (_lookupIntValue(config, "useSync", &fakeBool)) {
|
||||
opts->useBios = fakeBool;
|
||||
}
|
||||
if (_lookupIntValue(config, "audioSync", &fakeBool)) {
|
||||
opts->audioSync = fakeBool;
|
||||
}
|
||||
|
@ -229,6 +232,7 @@ void GBAConfigMap(const struct GBAConfig* config, struct GBAOptions* opts) {
|
|||
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);
|
||||
|
|
|
@ -21,6 +21,7 @@ struct GBAConfig {
|
|||
struct GBAOptions {
|
||||
char* bios;
|
||||
bool skipBios;
|
||||
bool useBios;
|
||||
int logLevel;
|
||||
int frameskip;
|
||||
bool rewindEnable;
|
||||
|
|
|
@ -310,7 +310,11 @@ static THREAD_ENTRY _GBAThreadRun(void* context) {
|
|||
}
|
||||
|
||||
void GBAMapOptionsToContext(const struct GBAOptions* opts, struct GBAThread* threadContext) {
|
||||
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) {
|
||||
|
|
|
@ -100,6 +100,7 @@ ConfigController::ConfigController(QObject* parent)
|
|||
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);
|
||||
|
|
|
@ -156,6 +156,7 @@ void GameController::setOptions(const GBAOptions* opts) {
|
|||
setAudioSync(opts->audioSync);
|
||||
setVideoSync(opts->videoSync);
|
||||
setSkipBIOS(opts->skipBios);
|
||||
setUseBIOS(opts->useBios);
|
||||
setRewind(opts->rewindEnable, opts->rewindBufferCapacity, opts->rewindBufferInterval);
|
||||
|
||||
threadInterrupt();
|
||||
|
@ -228,8 +229,10 @@ void GameController::openGame() {
|
|||
#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()) {
|
||||
|
@ -402,6 +405,12 @@ void GameController::setSkipBIOS(bool set) {
|
|||
threadContinue();
|
||||
}
|
||||
|
||||
void GameController::setUseBIOS(bool use) {
|
||||
threadInterrupt();
|
||||
m_useBios = use;
|
||||
threadContinue();
|
||||
}
|
||||
|
||||
void GameController::loadState(int slot) {
|
||||
threadInterrupt();
|
||||
GBALoadState(&m_threadContext, m_threadContext.stateDir, slot);
|
||||
|
|
|
@ -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 @@ private:
|
|||
|
||||
QString m_fname;
|
||||
QString m_bios;
|
||||
bool m_useBios;
|
||||
QString m_patch;
|
||||
|
||||
QThread* m_audioThread;
|
||||
|
|
|
@ -19,6 +19,7 @@ SettingsView::SettingsView(ConfigController* controller, QWidget* parent)
|
|||
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::selectBios() {
|
|||
|
||||
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);
|
||||
|
|
|
@ -62,9 +62,6 @@
|
|||
</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>
|
||||
|
|
|
@ -196,6 +196,8 @@ void Window::selectBIOS() {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
@ -733,6 +735,9 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
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()); });
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ int main(int argc, char** argv) {
|
|||
struct GBAOptions opts = {
|
||||
.width = VIDEO_HORIZONTAL_PIXELS,
|
||||
.height = VIDEO_VERTICAL_PIXELS,
|
||||
.useBios = true,
|
||||
.rewindEnable = true,
|
||||
.audioBuffers = 512,
|
||||
.videoSync = false,
|
||||
|
|
Loading…
Reference in New Issue