Qt: Fix some config regressions

This commit is contained in:
Jeffrey Pfau 2016-02-08 20:48:39 -08:00
parent fae8ef7f42
commit 9ec62368bc
5 changed files with 21 additions and 17 deletions

View File

@ -106,7 +106,7 @@ GameController::GameController(QObject* parent)
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 @@ void GameController::setOverride(const GBACartridgeOverride& override) {
}
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
@ -333,6 +333,10 @@ void GameController::openGame(bool biosOnly) {
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;
emit gameFailed();

View File

@ -82,7 +82,7 @@ public:
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 @@ private:
uint32_t* m_drawContext;
uint32_t* m_frontBuffer;
mCoreThread m_threadContext;
const mCoreConfig* m_config;
GBACheatDevice m_cheatDevice;
int m_activeKeys;
int m_activeButtons;

View File

@ -21,7 +21,7 @@ OverrideView::OverrideView(GameController* controller, ConfigController* 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) {

View File

@ -94,8 +94,8 @@ Window::Window(ConfigController* config, int playerId, QWidget* parent)
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 @@ void Window::toggleFullScreen() {
}
}
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 @@ void Window::gameStarted(mCoreThread* context) {
action->setDisabled(false);
}
multiplayerChanged();
/*if (context->fname) {
setWindowFilePath(context->fname);
appendMRU(context->fname);
}*/
if (!fname.isEmpty()) {
setWindowFilePath(fname);
appendMRU(fname);
}
updateTitle();
attachWidget(m_display);

View File

@ -111,7 +111,7 @@ protected:
virtual void mouseDoubleClickEvent(QMouseEvent*) override;
private slots:
void gameStarted(mCoreThread*);
void gameStarted(mCoreThread*, const QString&);
void gameStopped();
void gameCrashed(const QString&);
void gameFailed();