GBA: Add option to skip BIOS start screen

This commit is contained in:
Jeffrey Pfau 2014-12-21 17:48:36 -08:00
parent f53f9555a2
commit 9a0640f834
12 changed files with 39 additions and 3 deletions

View File

@ -6,6 +6,7 @@ Features:
- Better audio resampling via FFmpeg - Better audio resampling via FFmpeg
- Settings window - Settings window
- Bilinear resampling option - Bilinear resampling option
- Add option to skip BIOS start screen
Bugfixes: Bugfixes:
- Qt: Fix issue with set frame sizes being the wrong height - Qt: Fix issue with set frame sizes being the wrong height
- Qt: Fix emulator crashing when full screen if a game is not running - Qt: Fix emulator crashing when full screen if a game is not running

View File

@ -202,6 +202,9 @@ void GBAConfigMap(const struct GBAConfig* config, struct GBAOptions* opts) {
if (_lookupIntValue(config, "resampleVideo", &fakeBool)) { if (_lookupIntValue(config, "resampleVideo", &fakeBool)) {
opts->resampleVideo = fakeBool; opts->resampleVideo = fakeBool;
} }
if (_lookupIntValue(config, "skipBios", &fakeBool)) {
opts->skipBios = fakeBool;
}
_lookupIntValue(config, "fullscreen", &opts->fullscreen); _lookupIntValue(config, "fullscreen", &opts->fullscreen);
_lookupIntValue(config, "width", &opts->width); _lookupIntValue(config, "width", &opts->width);
@ -210,6 +213,7 @@ void GBAConfigMap(const struct GBAConfig* config, struct GBAOptions* opts) {
void GBAConfigLoadDefaults(struct GBAConfig* config, const struct GBAOptions* opts) { void GBAConfigLoadDefaults(struct GBAConfig* config, const struct GBAOptions* opts) {
ConfigurationSetValue(&config->defaultsTable, 0, "bios", opts->bios); 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, "logLevel", opts->logLevel);
ConfigurationSetIntValue(&config->defaultsTable, 0, "frameskip", opts->frameskip); ConfigurationSetIntValue(&config->defaultsTable, 0, "frameskip", opts->frameskip);
ConfigurationSetIntValue(&config->defaultsTable, 0, "rewindBufferCapacity", opts->rewindBufferCapacity); ConfigurationSetIntValue(&config->defaultsTable, 0, "rewindBufferCapacity", opts->rewindBufferCapacity);

View File

@ -18,6 +18,7 @@ struct GBAConfig {
struct GBAOptions { struct GBAOptions {
char* bios; char* bios;
bool skipBios;
int logLevel; int logLevel;
int frameskip; int frameskip;
int rewindBufferCapacity; int rewindBufferCapacity;

View File

@ -156,6 +156,9 @@ static THREAD_ENTRY _GBAThreadRun(void* context) {
} }
ARMReset(&cpu); ARMReset(&cpu);
if (threadContext->skipBios) {
GBASkipBIOS(&cpu);
}
if (threadContext->debugger) { if (threadContext->debugger) {
threadContext->debugger->log = GBADebuggerLogShim; threadContext->debugger->log = GBADebuggerLogShim;
@ -208,6 +211,9 @@ static THREAD_ENTRY _GBAThreadRun(void* context) {
MutexUnlock(&threadContext->stateMutex); MutexUnlock(&threadContext->stateMutex);
if (resetScheduled) { if (resetScheduled) {
ARMReset(&cpu); ARMReset(&cpu);
if (threadContext->skipBios) {
GBASkipBIOS(&cpu);
}
} }
} }
@ -236,6 +242,7 @@ void GBAMapOptionsToContext(const struct GBAOptions* opts, struct GBAThread* thr
threadContext->logLevel = opts->logLevel; threadContext->logLevel = opts->logLevel;
threadContext->rewindBufferCapacity = opts->rewindBufferCapacity; threadContext->rewindBufferCapacity = opts->rewindBufferCapacity;
threadContext->rewindBufferInterval = opts->rewindBufferInterval; threadContext->rewindBufferInterval = opts->rewindBufferInterval;
threadContext->skipBios = opts->skipBios;
threadContext->sync.audioWait = opts->audioSync; threadContext->sync.audioWait = opts->audioSync;
threadContext->sync.videoFrameWait = opts->videoSync; threadContext->sync.videoFrameWait = opts->videoSync;

View File

@ -98,6 +98,8 @@ struct GBAThread {
int rewindBufferNext; int rewindBufferNext;
struct GBASerializedState** rewindBuffer; struct GBASerializedState** rewindBuffer;
int rewindBufferWriteOffset; int rewindBufferWriteOffset;
bool skipBios;
}; };
void GBAMapOptionsToContext(const struct GBAOptions*, struct GBAThread*); void GBAMapOptionsToContext(const struct GBAOptions*, struct GBAThread*);

View File

@ -11,6 +11,8 @@
#include "gba-sio.h" #include "gba-sio.h"
#include "gba-thread.h" #include "gba-thread.h"
#include "isa-inlines.h"
#include "util/crc32.h" #include "util/crc32.h"
#include "util/memory.h" #include "util/memory.h"
#include "util/patch.h" #include "util/patch.h"
@ -220,6 +222,14 @@ void GBAReset(struct ARMCore* cpu) {
memset(gba->timers, 0, sizeof(gba->timers)); 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) { static void GBAProcessEvents(struct ARMCore* cpu) {
do { do {
struct GBA* gba = (struct GBA*) cpu->master; struct GBA* gba = (struct GBA*) cpu->master;

View File

@ -147,6 +147,7 @@ void GBACreate(struct GBA* gba);
void GBADestroy(struct GBA* gba); void GBADestroy(struct GBA* gba);
void GBAReset(struct ARMCore* cpu); void GBAReset(struct ARMCore* cpu);
void GBASkipBIOS(struct ARMCore* cpu);
void GBATimerUpdateRegister(struct GBA* gba, int timer); void GBATimerUpdateRegister(struct GBA* gba, int timer);
void GBATimerWriteTMCNT_LO(struct GBA* gba, int timer, uint16_t value); void GBATimerWriteTMCNT_LO(struct GBA* gba, int timer, uint16_t value);

View File

@ -295,6 +295,12 @@ void GameController::setFPSTarget(float fps) {
QMetaObject::invokeMethod(m_audioProcessor, "inputParametersChanged"); QMetaObject::invokeMethod(m_audioProcessor, "inputParametersChanged");
} }
void GameController::setSkipBIOS(bool set) {
threadInterrupt();
m_threadContext.skipBios = set;
threadContinue();
}
void GameController::loadState(int slot) { void GameController::loadState(int slot) {
threadInterrupt(); threadInterrupt();
GBALoadState(m_threadContext.gba, m_threadContext.stateDir, slot); GBALoadState(m_threadContext.gba, m_threadContext.stateDir, slot);

View File

@ -72,6 +72,7 @@ signals:
public slots: public slots:
void loadGame(const QString& path, bool dirmode = false); void loadGame(const QString& path, bool dirmode = false);
void loadBIOS(const QString& path); void loadBIOS(const QString& path);
void setSkipBIOS(bool);
void loadPatch(const QString& path); void loadPatch(const QString& path);
void openGame(); void openGame();
void closeGame(); void closeGame();

View File

@ -18,6 +18,7 @@ SettingsView::SettingsView(ConfigController* controller, QWidget* parent)
m_ui.setupUi(this); m_ui.setupUi(this);
loadSetting("bios", m_ui.bios); loadSetting("bios", m_ui.bios);
loadSetting("skipBios", m_ui.skipBios);
loadSetting("audioBuffers", m_ui.audioBufferSize); loadSetting("audioBuffers", m_ui.audioBufferSize);
loadSetting("videoSync", m_ui.videoSync); loadSetting("videoSync", m_ui.videoSync);
loadSetting("audioSync", m_ui.audioSync); loadSetting("audioSync", m_ui.audioSync);
@ -40,6 +41,7 @@ void SettingsView::selectBios() {
void SettingsView::updateConfig() { void SettingsView::updateConfig() {
saveSetting("bios", m_ui.bios); saveSetting("bios", m_ui.bios);
saveSetting("skipBios", m_ui.skipBios);
saveSetting("audioBuffers", m_ui.audioBufferSize); saveSetting("audioBuffers", m_ui.audioBufferSize);
saveSetting("videoSync", m_ui.videoSync); saveSetting("videoSync", m_ui.videoSync);
saveSetting("audioSync", m_ui.audioSync); saveSetting("audioSync", m_ui.audioSync);

View File

@ -49,9 +49,6 @@
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QCheckBox" name="skipBios"> <widget class="QCheckBox" name="skipBios">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text"> <property name="text">
<string>Skip BIOS intro</string> <string>Skip BIOS intro</string>
</property> </property>

View File

@ -137,6 +137,7 @@ void Window::loadConfig() {
m_controller->setFrameskip(opts->frameskip); m_controller->setFrameskip(opts->frameskip);
m_controller->setAudioSync(opts->audioSync); m_controller->setAudioSync(opts->audioSync);
m_controller->setVideoSync(opts->videoSync); m_controller->setVideoSync(opts->videoSync);
m_controller->setSkipBIOS(opts->skipBios);
m_display->lockAspectRatio(opts->lockAspectRatio); m_display->lockAspectRatio(opts->lockAspectRatio);
m_display->filter(opts->resampleVideo); m_display->filter(opts->resampleVideo);
@ -611,6 +612,9 @@ void Window::setupMenu(QMenuBar* menubar) {
debuggingMenu->addAction(gdbWindow); debuggingMenu->addAction(gdbWindow);
#endif #endif
ConfigOption* skipBios = m_config->addOption("skipBios");
skipBios->connect([this](const QVariant& value) { m_controller->setSkipBIOS(value.toBool()); });
foreach (QAction* action, m_gameActions) { foreach (QAction* action, m_gameActions) {
action->setDisabled(true); action->setDisabled(true);
} }