GBA: Add option to skip BIOS start screen
Jeffrey Pfau jeffrey@endrift.com
Sun, 21 Dec 2014 17:48:36 -0800
12 files changed,
39 insertions(+),
3 deletions(-)
M
CHANGES
→
CHANGES
@@ -6,6 +6,7 @@ - Debugger: Add CLI "frame", frame advance command
- Better audio resampling via FFmpeg - Settings window - Bilinear resampling option + - Add option to skip BIOS start screen Bugfixes: - Qt: Fix issue with set frame sizes being the wrong height - Qt: Fix emulator crashing when full screen if a game is not running
M
src/gba/gba-config.c
→
src/gba/gba-config.c
@@ -202,6 +202,9 @@ }
if (_lookupIntValue(config, "resampleVideo", &fakeBool)) { opts->resampleVideo = fakeBool; } + if (_lookupIntValue(config, "skipBios", &fakeBool)) { + opts->skipBios = fakeBool; + } _lookupIntValue(config, "fullscreen", &opts->fullscreen); _lookupIntValue(config, "width", &opts->width);@@ -210,6 +213,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, "logLevel", opts->logLevel); ConfigurationSetIntValue(&config->defaultsTable, 0, "frameskip", opts->frameskip); ConfigurationSetIntValue(&config->defaultsTable, 0, "rewindBufferCapacity", opts->rewindBufferCapacity);
M
src/gba/gba-config.h
→
src/gba/gba-config.h
@@ -18,6 +18,7 @@ };
struct GBAOptions { char* bios; + bool skipBios; int logLevel; int frameskip; int rewindBufferCapacity;
M
src/gba/gba-thread.c
→
src/gba/gba-thread.c
@@ -156,6 +156,9 @@ }
} ARMReset(&cpu); + if (threadContext->skipBios) { + GBASkipBIOS(&cpu); + } if (threadContext->debugger) { threadContext->debugger->log = GBADebuggerLogShim;@@ -208,6 +211,9 @@ }
MutexUnlock(&threadContext->stateMutex); if (resetScheduled) { ARMReset(&cpu); + if (threadContext->skipBios) { + GBASkipBIOS(&cpu); + } } }@@ -236,6 +242,7 @@ threadContext->frameskip = opts->frameskip;
threadContext->logLevel = opts->logLevel; threadContext->rewindBufferCapacity = opts->rewindBufferCapacity; threadContext->rewindBufferInterval = opts->rewindBufferInterval; + threadContext->skipBios = opts->skipBios; threadContext->sync.audioWait = opts->audioSync; threadContext->sync.videoFrameWait = opts->videoSync;
M
src/gba/gba-thread.h
→
src/gba/gba-thread.h
@@ -98,6 +98,8 @@ int rewindBufferInterval;
int rewindBufferNext; struct GBASerializedState** rewindBuffer; int rewindBufferWriteOffset; + + bool skipBios; }; void GBAMapOptionsToContext(const struct GBAOptions*, struct GBAThread*);
M
src/gba/gba.c
→
src/gba/gba.c
@@ -11,6 +11,8 @@ #include "gba-rr.h"
#include "gba-sio.h" #include "gba-thread.h" +#include "isa-inlines.h" + #include "util/crc32.h" #include "util/memory.h" #include "util/patch.h"@@ -218,6 +220,14 @@ GBASIOInit(&gba->sio);
gba->timersEnabled = 0; memset(gba->timers, 0, sizeof(gba->timers)); +} + +void GBASkipBIOS(struct ARMCore* cpu) { + if (cpu->gprs[ARM_PC] == BASE_RESET + WORD_SIZE_ARM) { + cpu->gprs[ARM_PC] = BASE_CART0; + int currentCycles = 0; + ARM_WRITE_PC; + } } static void GBAProcessEvents(struct ARMCore* cpu) {
M
src/gba/gba.h
→
src/gba/gba.h
@@ -147,6 +147,7 @@ void GBACreate(struct GBA* gba);
void GBADestroy(struct GBA* gba); void GBAReset(struct ARMCore* cpu); +void GBASkipBIOS(struct ARMCore* cpu); void GBATimerUpdateRegister(struct GBA* gba, int timer); void GBATimerWriteTMCNT_LO(struct GBA* gba, int timer, uint16_t value);
M
src/platform/qt/GameController.cpp
→
src/platform/qt/GameController.cpp
@@ -295,6 +295,12 @@ threadContinue();
QMetaObject::invokeMethod(m_audioProcessor, "inputParametersChanged"); } +void GameController::setSkipBIOS(bool set) { + threadInterrupt(); + m_threadContext.skipBios = set; + threadContinue(); +} + void GameController::loadState(int slot) { threadInterrupt(); GBALoadState(m_threadContext.gba, m_threadContext.stateDir, slot);
M
src/platform/qt/GameController.h
→
src/platform/qt/GameController.h
@@ -72,6 +72,7 @@
public slots: void loadGame(const QString& path, bool dirmode = false); void loadBIOS(const QString& path); + void setSkipBIOS(bool); void loadPatch(const QString& path); void openGame(); void closeGame();
M
src/platform/qt/SettingsView.cpp
→
src/platform/qt/SettingsView.cpp
@@ -18,6 +18,7 @@ {
m_ui.setupUi(this); loadSetting("bios", m_ui.bios); + loadSetting("skipBios", m_ui.skipBios); loadSetting("audioBuffers", m_ui.audioBufferSize); loadSetting("videoSync", m_ui.videoSync); loadSetting("audioSync", m_ui.audioSync);@@ -40,6 +41,7 @@ }
void SettingsView::updateConfig() { saveSetting("bios", m_ui.bios); + saveSetting("skipBios", m_ui.skipBios); saveSetting("audioBuffers", m_ui.audioBufferSize); saveSetting("videoSync", m_ui.videoSync); saveSetting("audioSync", m_ui.audioSync);
M
src/platform/qt/SettingsView.ui
→
src/platform/qt/SettingsView.ui
@@ -49,9 +49,6 @@ </layout>
</item> <item row="1" column="1"> <widget class="QCheckBox" name="skipBios"> - <property name="enabled"> - <bool>false</bool> - </property> <property name="text"> <string>Skip BIOS intro</string> </property>
M
src/platform/qt/Window.cpp
→
src/platform/qt/Window.cpp
@@ -137,6 +137,7 @@
m_controller->setFrameskip(opts->frameskip); m_controller->setAudioSync(opts->audioSync); m_controller->setVideoSync(opts->videoSync); + m_controller->setSkipBIOS(opts->skipBios); m_display->lockAspectRatio(opts->lockAspectRatio); m_display->filter(opts->resampleVideo);@@ -610,6 +611,9 @@ QAction* gdbWindow = new QAction(tr("Start &GDB server..."), debuggingMenu);
connect(gdbWindow, SIGNAL(triggered()), this, SLOT(gdbOpen())); debuggingMenu->addAction(gdbWindow); #endif + + ConfigOption* skipBios = m_config->addOption("skipBios"); + skipBios->connect([this](const QVariant& value) { m_controller->setSkipBIOS(value.toBool()); }); foreach (QAction* action, m_gameActions) { action->setDisabled(true);