all repos — mgba @ 6c71d7433b409eb74967a3ae631c0a4b87bb6c34

mGBA Game Boy Advance Emulator

Qt: Use safer isLoaded check in GameController
Jeffrey Pfau jeffrey@endrift.com
Sat, 24 Oct 2015 23:45:47 -0700
commit

6c71d7433b409eb74967a3ae631c0a4b87bb6c34

parent

2079d476738802b53ff1a9c4be68f60173744c8e

2 files changed, 11 insertions(+), 10 deletions(-)

jump to
M CHANGESCHANGES

@@ -5,6 +5,7 @@ - I/O viewer

- Booting of multiboot images Bugfixes: - Util: Fix PowerPC PNG read/write pixel order + - Qt: Use safer isLoaded check in GameController Misc: - Qt: Window size command line options are now supported - Qt: Increase usability of key mapper
M src/platform/qt/GameController.cppsrc/platform/qt/GameController.cpp

@@ -390,7 +390,7 @@ }

} void GameController::importSharkport(const QString& path) { - if (!m_gameOpen) { + if (!isLoaded()) { return; } VFile* vf = VFileDevice::open(path, O_RDONLY);

@@ -405,7 +405,7 @@ vf->close(vf);

} void GameController::exportSharkport(const QString& path) { - if (!m_gameOpen) { + if (!isLoaded()) { return; } VFile* vf = VFileDevice::open(path, O_WRONLY | O_CREAT | O_TRUNC);

@@ -462,7 +462,7 @@ return GBAThreadIsPaused(&m_threadContext);

} void GameController::setPaused(bool paused) { - if (!m_gameOpen || m_rewindTimer.isActive() || paused == GBAThreadIsPaused(&m_threadContext)) { + if (!isLoaded() || m_rewindTimer.isActive() || paused == GBAThreadIsPaused(&m_threadContext)) { return; } if (paused) {

@@ -614,7 +614,7 @@ if (channel > 5 || channel < 0) {

return; } m_audioChannels[channel] = enable; - if (m_gameOpen) { + if (isLoaded()) { switch (channel) { case 0: case 1:

@@ -637,7 +637,7 @@ if (layer > 4 || layer < 0) {

return; } m_videoLayers[layer] = enable; - if (m_gameOpen) { + if (isLoaded()) { switch (layer) { case 0: case 1:

@@ -771,7 +771,7 @@

void GameController::setFrameskip(int skip) { threadInterrupt(); m_threadContext.frameskip = skip; - if (m_gameOpen) { + if (isLoaded()) { m_threadContext.gba->video.frameskip = skip; } threadContinue();

@@ -780,7 +780,7 @@

void GameController::setVolume(int volume) { threadInterrupt(); m_threadContext.volume = volume; - if (m_gameOpen) { + if (isLoaded()) { m_threadContext.gba->audio.masterVolume = volume; } threadContinue();

@@ -789,7 +789,7 @@

void GameController::setMute(bool mute) { threadInterrupt(); m_threadContext.mute = mute; - if (m_gameOpen) { + if (isLoaded()) { m_threadContext.gba->audio.masterVolume = mute ? 0 : m_threadContext.volume; } threadContinue();

@@ -837,7 +837,7 @@

void GameController::setAVStream(GBAAVStream* stream) { threadInterrupt(); m_threadContext.stream = stream; - if (m_gameOpen) { + if (isLoaded()) { m_threadContext.gba->stream = stream; } threadContinue();

@@ -846,7 +846,7 @@

void GameController::clearAVStream() { threadInterrupt(); m_threadContext.stream = nullptr; - if (m_gameOpen) { + if (isLoaded()) { m_threadContext.gba->stream = nullptr; } threadContinue();