The rest
This commit is contained in:
parent
305f1b0f3c
commit
43b82b5fd8
|
@ -604,7 +604,7 @@ ExtensionNumber Wiimote::GetActiveExtensionNumber() const
|
|||
|
||||
bool Wiimote::IsMotionPlusAttached() const
|
||||
{
|
||||
return m_is_motion_plus_attached;
|
||||
return m_motion_plus_setting.GetValue();
|
||||
}
|
||||
|
||||
} // namespace WiimoteEmu
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "DolphinQt/Config/Mapping/MappingWindow.h"
|
||||
#include "DolphinQt/Config/Mapping/WiimoteEmuExtension.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/Attachments.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
@ -88,6 +89,8 @@ void WiimoteEmuGeneral::OnAttachmentChanged(int extension)
|
|||
GetParent()->ShowExtensionMotionTabs(extension == WiimoteEmu::ExtensionNumber::NUNCHUK);
|
||||
|
||||
m_extension_widget->ChangeExtensionType(extension);
|
||||
|
||||
Settings::Instance().UpdateWiimoteExtension(GetPort(), extension);
|
||||
}
|
||||
|
||||
void WiimoteEmuGeneral::OnAttachmentSelected(int extension)
|
||||
|
@ -110,6 +113,7 @@ void WiimoteEmuGeneral::ConfigChanged()
|
|||
|
||||
m_extension_combo_dynamic_indicator->setVisible(
|
||||
!ce_extension->GetSelectionSetting().IsSimpleValue());
|
||||
OnMotionPlusUpdate();
|
||||
}
|
||||
|
||||
void WiimoteEmuGeneral::Update()
|
||||
|
@ -128,9 +132,18 @@ void WiimoteEmuGeneral::LoadSettings()
|
|||
void WiimoteEmuGeneral::SaveSettings()
|
||||
{
|
||||
Wiimote::GetConfig()->SaveConfig();
|
||||
OnMotionPlusUpdate();
|
||||
}
|
||||
|
||||
InputConfig* WiimoteEmuGeneral::GetConfig()
|
||||
{
|
||||
return Wiimote::GetConfig();
|
||||
}
|
||||
|
||||
void WiimoteEmuGeneral::OnMotionPlusUpdate()
|
||||
{
|
||||
const int port = GetPort();
|
||||
const WiimoteEmu::Wiimote* const wiimote =
|
||||
static_cast<WiimoteEmu::Wiimote*>(Wiimote::GetConfig()->GetController(port));
|
||||
Settings::Instance().UpdateWiimoteMotionPlus(port, wiimote->IsMotionPlusAttached());
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ private:
|
|||
void OnAttachmentChanged(int index);
|
||||
// Selection chosen by user.
|
||||
void OnAttachmentSelected(int index);
|
||||
void OnMotionPlusUpdate();
|
||||
|
||||
void ConfigChanged();
|
||||
void Update();
|
||||
|
|
|
@ -519,6 +519,15 @@ void MainWindow::CreateComponents()
|
|||
&MemoryWidget::SetAddress);
|
||||
connect(m_cheats_manager, &CheatsManager::ShowMemory, m_memory_widget, &MemoryWidget::SetAddress);
|
||||
connect(m_cheats_manager, &CheatsManager::RequestWatch, request_watch);
|
||||
|
||||
connect(&Settings::Instance(), &Settings::UpdateWiimoteExtension,
|
||||
[this](const int controller_number, const int extension_index) {
|
||||
m_wii_tas_input_windows[controller_number]->UpdateExtension(extension_index);
|
||||
});
|
||||
connect(&Settings::Instance(), &Settings::UpdateWiimoteMotionPlus,
|
||||
[this](const int controller_number, const bool attached) {
|
||||
m_wii_tas_input_windows[controller_number]->UpdateMotionPlus(attached);
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::ConnectMenuBar()
|
||||
|
|
|
@ -224,6 +224,8 @@ signals:
|
|||
void USBKeyboardConnectionChanged(bool connected);
|
||||
void EnableGfxModsChanged(bool enabled);
|
||||
void HardcoreStateChanged();
|
||||
void UpdateWiimoteExtension(int controller_number, int extension_index);
|
||||
void UpdateWiimoteMotionPlus(int controller_number, bool attached);
|
||||
|
||||
private:
|
||||
Settings();
|
||||
|
|
|
@ -347,7 +347,6 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : TASInputWindow(
|
|||
layout->addWidget(m_settings_box);
|
||||
|
||||
setLayout(layout);
|
||||
UpdateExt();
|
||||
}
|
||||
|
||||
WiimoteEmu::Wiimote* WiiTASInputWindow::GetWiimote()
|
||||
|
@ -367,6 +366,28 @@ WiimoteEmu::Extension* WiiTASInputWindow::GetExtension()
|
|||
GetAttachments()->GetAttachmentList()[m_active_extension].get());
|
||||
}
|
||||
|
||||
void WiiTASInputWindow::UpdateExtension(const int extension)
|
||||
{
|
||||
const auto new_extension = static_cast<WiimoteEmu::ExtensionNumber>(extension);
|
||||
if (new_extension == m_active_extension)
|
||||
return;
|
||||
|
||||
m_active_extension = new_extension;
|
||||
|
||||
UpdateControlVisibility();
|
||||
UpdateInputOverrideFunction();
|
||||
}
|
||||
|
||||
void WiiTASInputWindow::UpdateMotionPlus(const bool attached)
|
||||
{
|
||||
if (attached == m_is_motion_plus_attached)
|
||||
return;
|
||||
|
||||
m_is_motion_plus_attached = attached;
|
||||
|
||||
UpdateControlVisibility();
|
||||
}
|
||||
|
||||
void WiiTASInputWindow::LoadExtensionAndMotionPlus()
|
||||
{
|
||||
if (Core::IsRunning(Core::System::GetInstance()))
|
||||
|
@ -393,9 +414,12 @@ void WiiTASInputWindow::LoadExtensionAndMotionPlus()
|
|||
m_is_motion_plus_attached = true;
|
||||
ini.GetIfExists(section_name, "Extension/Attach MotionPlus", &m_is_motion_plus_attached);
|
||||
}
|
||||
|
||||
UpdateControlVisibility();
|
||||
UpdateInputOverrideFunction();
|
||||
}
|
||||
|
||||
void WiiTASInputWindow::UpdateExt()
|
||||
void WiiTASInputWindow::UpdateControlVisibility()
|
||||
{
|
||||
if (m_active_extension == WiimoteEmu::ExtensionNumber::NUNCHUK)
|
||||
{
|
||||
|
@ -454,17 +478,30 @@ void WiiTASInputWindow::UpdateExt()
|
|||
m_nunchuk_buttons_box->hide();
|
||||
m_classic_buttons_box->hide();
|
||||
}
|
||||
|
||||
// Without this, switching between attachments can leave the Stick/IR widgets excessively large
|
||||
adjustSize();
|
||||
resize(sizeHint());
|
||||
}
|
||||
|
||||
void WiiTASInputWindow::hideEvent(QHideEvent* event)
|
||||
void WiiTASInputWindow::hideEvent(QHideEvent* const event)
|
||||
{
|
||||
GetWiimote()->ClearInputOverrideFunction();
|
||||
GetExtension()->ClearInputOverrideFunction();
|
||||
|
||||
TASInputWindow::hideEvent(event);
|
||||
}
|
||||
|
||||
void WiiTASInputWindow::showEvent(QShowEvent* event)
|
||||
void WiiTASInputWindow::showEvent(QShowEvent* const event)
|
||||
{
|
||||
WiimoteEmu::Wiimote* wiimote = GetWiimote();
|
||||
LoadExtensionAndMotionPlus();
|
||||
|
||||
TASInputWindow::showEvent(event);
|
||||
}
|
||||
|
||||
void WiiTASInputWindow::UpdateInputOverrideFunction()
|
||||
{
|
||||
WiimoteEmu::Wiimote* const wiimote = GetWiimote();
|
||||
|
||||
if (m_active_extension != WiimoteEmu::ExtensionNumber::CLASSIC)
|
||||
wiimote->SetInputOverrideFunction(m_wiimote_overrider.GetInputOverrideFunction());
|
||||
|
|
|
@ -34,13 +34,17 @@ public:
|
|||
void hideEvent(QHideEvent* event) override;
|
||||
void showEvent(QShowEvent* event) override;
|
||||
|
||||
void UpdateExtension(int extension);
|
||||
void UpdateMotionPlus(bool attached);
|
||||
|
||||
private:
|
||||
WiimoteEmu::Wiimote* GetWiimote();
|
||||
ControllerEmu::Attachments* GetAttachments();
|
||||
WiimoteEmu::Extension* GetExtension();
|
||||
|
||||
void UpdateExt();
|
||||
void LoadExtensionAndMotionPlus();
|
||||
void UpdateControlVisibility();
|
||||
void UpdateInputOverrideFunction();
|
||||
|
||||
WiimoteEmu::ExtensionNumber m_active_extension;
|
||||
bool m_is_motion_plus_attached;
|
||||
|
|
Loading…
Reference in New Issue