Qt: Fix some config regressions
Jeffrey Pfau jeffrey@endrift.com
Mon, 08 Feb 2016 20:48:39 -0800
5 files changed,
21 insertions(+),
17 deletions(-)
M
src/platform/qt/GameController.cpp
→
src/platform/qt/GameController.cpp
@@ -106,7 +106,7 @@
if (mCoreLoadState(context->core, 0, controller->m_loadStateFlags)) { mCoreDeleteState(context->core, 0); } - QMetaObject::invokeMethod(controller, "gameStarted", Q_ARG(mCoreThread*, context)); + QMetaObject::invokeMethod(controller, "gameStarted", Q_ARG(mCoreThread*, context), Q_ARG(const QString&, controller->m_fname)); }; m_threadContext.cleanCallback = [](mCoreThread* context) {@@ -235,12 +235,12 @@ // TODO: Put back overrides
} void GameController::setConfig(const mCoreConfig* config) { - if (!m_gameOpen) { - return; + m_config = config; + if (isLoaded()) { + threadInterrupt(); + mCoreLoadForeignConfig(m_threadContext.core, config); + threadContinue(); } - threadInterrupt(); - mCoreLoadForeignConfig(m_threadContext.core, config); - threadContinue(); } #ifdef USE_GDB_STUB@@ -332,6 +332,10 @@ m_inputController->recalibrateAxes();
memset(m_drawContext, 0xF8, width * height * 4); m_threadContext.core->setAVStream(m_threadContext.core, m_stream); + + if (m_config) { + mCoreLoadForeignConfig(m_threadContext.core, m_config); + } if (!mCoreThreadStart(&m_threadContext)) { m_gameOpen = false;
M
src/platform/qt/GameController.h
→
src/platform/qt/GameController.h
@@ -82,7 +82,7 @@ #endif
signals: void frameAvailable(const uint32_t*); - void gameStarted(mCoreThread*); + void gameStarted(mCoreThread*, const QString& fname); void gameStopped(mCoreThread*); void gamePaused(mCoreThread*); void gameUnpaused(mCoreThread*);@@ -171,6 +171,7 @@
uint32_t* m_drawContext; uint32_t* m_frontBuffer; mCoreThread m_threadContext; + const mCoreConfig* m_config; GBACheatDevice m_cheatDevice; int m_activeKeys; int m_activeButtons;
M
src/platform/qt/OverrideView.cpp
→
src/platform/qt/OverrideView.cpp
@@ -21,7 +21,7 @@ , m_config(config)
{ m_ui.setupUi(this); - connect(controller, SIGNAL(gameStarted(mCoreThread*)), this, SLOT(gameStarted(mCoreThread*))); + connect(controller, SIGNAL(gameStarted(mCoreThread*, const QString&)), this, SLOT(gameStarted(mCoreThread*))); connect(controller, SIGNAL(gameStopped(mCoreThread*)), this, SLOT(gameStopped())); connect(m_ui.hwAutodetect, &QAbstractButton::toggled, [this] (bool enabled) {
M
src/platform/qt/Window.cpp
→
src/platform/qt/Window.cpp
@@ -94,8 +94,8 @@ m_screenWidget->setPixmap(m_logo);
m_screenWidget->setLockAspectRatio(m_logo.width(), m_logo.height()); setCentralWidget(m_screenWidget); - connect(m_controller, SIGNAL(gameStarted(mCoreThread*)), this, SLOT(gameStarted(mCoreThread*))); - connect(m_controller, SIGNAL(gameStarted(mCoreThread*)), &m_inputController, SLOT(suspendScreensaver())); + connect(m_controller, SIGNAL(gameStarted(mCoreThread*, const QString&)), this, SLOT(gameStarted(mCoreThread*, const QString&))); + connect(m_controller, SIGNAL(gameStarted(mCoreThread*, const QString&)), &m_inputController, SLOT(suspendScreensaver())); connect(m_controller, SIGNAL(gameStopped(mCoreThread*)), m_display, SLOT(stopDrawing())); connect(m_controller, SIGNAL(gameStopped(mCoreThread*)), this, SLOT(gameStopped())); connect(m_controller, SIGNAL(gameStopped(mCoreThread*)), &m_inputController, SLOT(resumeScreensaver()));@@ -597,8 +597,7 @@ enterFullScreen();
} } -void Window::gameStarted(mCoreThread* context) { - char title[13] = { '\0' }; +void Window::gameStarted(mCoreThread* context, const QString& fname) { MutexLock(&context->stateMutex); if (context->state < THREAD_EXITING) { emit startDrawing(context);@@ -611,10 +610,10 @@ foreach (QAction* action, m_gameActions) {
action->setDisabled(false); } multiplayerChanged(); - /*if (context->fname) { - setWindowFilePath(context->fname); - appendMRU(context->fname); - }*/ + if (!fname.isEmpty()) { + setWindowFilePath(fname); + appendMRU(fname); + } updateTitle(); attachWidget(m_display);
M
src/platform/qt/Window.h
→
src/platform/qt/Window.h
@@ -111,7 +111,7 @@ virtual void dropEvent(QDropEvent*) override;
virtual void mouseDoubleClickEvent(QMouseEvent*) override; private slots: - void gameStarted(mCoreThread*); + void gameStarted(mCoreThread*, const QString&); void gameStopped(); void gameCrashed(const QString&); void gameFailed();