Merge pull request #7587 from Techjar/disable-controller-config-netplay

Qt: Disable controller configuration while NetPlay is running
This commit is contained in:
Pierre Bourdon 2018-11-29 14:28:18 +01:00 committed by GitHub
commit 4d14d5ee9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 1 deletions

View File

@ -275,6 +275,8 @@ void MainWindow::InitCoreCallbacks()
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [=](Core::State state) { connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [=](Core::State state) {
if (state == Core::State::Uninitialized) if (state == Core::State::Uninitialized)
OnStopComplete(); OnStopComplete();
if (state != Core::State::Uninitialized && NetPlay::IsNetPlayRunning() && m_controllers_window)
m_controllers_window->reject();
if (state == Core::State::Running && m_fullscreen_requested) if (state == Core::State::Running && m_fullscreen_requested)
{ {

View File

@ -32,6 +32,7 @@
#include "Core/IOS/IOS.h" #include "Core/IOS/IOS.h"
#include "Core/IOS/USB/Bluetooth/BTEmu.h" #include "Core/IOS/USB/Bluetooth/BTEmu.h"
#include "Core/Movie.h" #include "Core/Movie.h"
#include "Core/NetPlayProto.h"
#include "Core/PowerPC/JitInterface.h" #include "Core/PowerPC/JitInterface.h"
#include "Core/PowerPC/MMU.h" #include "Core/PowerPC/MMU.h"
#include "Core/PowerPC/PPCAnalyst.h" #include "Core/PowerPC/PPCAnalyst.h"
@ -106,6 +107,9 @@ void MenuBar::OnEmulationStateChanged(Core::State state)
m_recording_stop->setEnabled(false); m_recording_stop->setEnabled(false);
m_recording_play->setEnabled(!running); m_recording_play->setEnabled(!running);
// Options
m_controllers_action->setEnabled(NetPlay::IsNetPlayRunning() ? !running : true);
// Tools // Tools
m_show_cheat_manager->setEnabled(Settings::Instance().GetCheatsEnabled() && running); m_show_cheat_manager->setEnabled(Settings::Instance().GetCheatsEnabled() && running);
@ -471,7 +475,8 @@ void MenuBar::AddOptionsMenu()
options_menu->addSeparator(); options_menu->addSeparator();
options_menu->addAction(tr("&Graphics Settings"), this, &MenuBar::ConfigureGraphics); options_menu->addAction(tr("&Graphics Settings"), this, &MenuBar::ConfigureGraphics);
options_menu->addAction(tr("&Audio Settings"), this, &MenuBar::ConfigureAudio); options_menu->addAction(tr("&Audio Settings"), this, &MenuBar::ConfigureAudio);
options_menu->addAction(tr("&Controller Settings"), this, &MenuBar::ConfigureControllers); m_controllers_action =
options_menu->addAction(tr("&Controller Settings"), this, &MenuBar::ConfigureControllers);
options_menu->addAction(tr("&Hotkey Settings"), this, &MenuBar::ConfigureHotkeys); options_menu->addAction(tr("&Hotkey Settings"), this, &MenuBar::ConfigureHotkeys);
options_menu->addSeparator(); options_menu->addSeparator();

View File

@ -215,6 +215,7 @@ private:
QAction* m_boot_to_pause; QAction* m_boot_to_pause;
QAction* m_automatic_start; QAction* m_automatic_start;
QAction* m_change_font; QAction* m_change_font;
QAction* m_controllers_action;
// View // View
QAction* m_show_code; QAction* m_show_code;

View File

@ -8,6 +8,7 @@
#include <QIcon> #include <QIcon>
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/NetPlayProto.h"
#include "DolphinQt/Host.h" #include "DolphinQt/Host.h"
#include "DolphinQt/Resources.h" #include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
@ -54,6 +55,7 @@ void ToolBar::OnEmulationStateChanged(Core::State state)
m_stop_action->setEnabled(running); m_stop_action->setEnabled(running);
m_fullscreen_action->setEnabled(running); m_fullscreen_action->setEnabled(running);
m_screenshot_action->setEnabled(running); m_screenshot_action->setEnabled(running);
m_controllers_action->setEnabled(NetPlay::IsNetPlayRunning() ? !running : true);
bool playing = running && state != Core::State::Paused; bool playing = running && state != Core::State::Paused;
UpdatePausePlayButtonState(playing); UpdatePausePlayButtonState(playing);