2015-05-24 07:32:32 +03:00
|
|
|
// Copyright 2010 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2014-02-10 20:54:46 +02:00
|
|
|
#pragma once
|
2010-07-03 11:04:10 +03:00
|
|
|
|
2014-11-22 22:29:13 +02:00
|
|
|
#include <array>
|
2014-02-17 12:18:15 +02:00
|
|
|
#include <map>
|
2016-08-23 17:19:30 +03:00
|
|
|
#include <wx/button.h>
|
|
|
|
#include <wx/checkbox.h>
|
|
|
|
#include <wx/choice.h>
|
2014-02-23 00:36:30 +02:00
|
|
|
#include <wx/dialog.h>
|
2016-08-23 17:19:30 +03:00
|
|
|
#include <wx/sizer.h>
|
|
|
|
#include <wx/statbox.h>
|
|
|
|
#include <wx/stattext.h>
|
2010-07-03 11:04:10 +03:00
|
|
|
|
2014-02-23 00:36:30 +02:00
|
|
|
#include "Common/SysConf.h"
|
2014-02-17 12:18:15 +02:00
|
|
|
#include "Core/ConfigManager.h"
|
|
|
|
#include "Core/HW/Wiimote.h"
|
2016-08-23 17:19:30 +03:00
|
|
|
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
|
|
|
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_real.h"
|
2015-12-31 18:27:51 +02:00
|
|
|
#include "InputCommon/GCAdapter.h"
|
2014-02-23 00:36:30 +02:00
|
|
|
|
2014-08-31 07:04:15 +03:00
|
|
|
class InputConfig;
|
2011-08-06 17:38:23 +03:00
|
|
|
|
2014-11-22 23:39:48 +02:00
|
|
|
class ControllerConfigDiag : public wxDialog
|
2010-07-03 11:04:10 +03:00
|
|
|
{
|
|
|
|
public:
|
2016-06-24 11:43:46 +03:00
|
|
|
ControllerConfigDiag(wxWindow* const parent);
|
2011-08-06 17:38:23 +03:00
|
|
|
|
2015-04-28 03:48:04 +03:00
|
|
|
private:
|
2016-06-24 11:43:46 +03:00
|
|
|
void OnSensorBarPos(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_SYSCONF->SetData("BT.BAR", event.GetInt());
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnSensorBarSensitivity(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_SYSCONF->SetData("BT.SENS", event.GetInt());
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnSpeakerVolume(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_SYSCONF->SetData("BT.SPKV", event.GetInt());
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnMotor(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_SYSCONF->SetData("BT.MOT", event.GetInt());
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnContinuousScanning(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_WiimoteContinuousScanning = event.IsChecked();
|
2016-07-07 16:40:14 +03:00
|
|
|
WiimoteReal::Initialize(Wiimote::InitializeMode::DO_NOT_WAIT_FOR_WIIMOTES);
|
2016-06-24 11:43:46 +03:00
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
2016-08-23 17:19:30 +03:00
|
|
|
void OnPassthroughMode(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_bt_passthrough_enabled = event.IsChecked();
|
|
|
|
UpdateUI();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnPassthroughScanButton(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
auto device = WII_IPC_HLE_Interface::GetDeviceByName("/dev/usb/oh1/57e/305");
|
|
|
|
if (device != nullptr)
|
|
|
|
std::static_pointer_cast<CWII_IPC_HLE_Device_usb_oh1_57e_305_base>(device)
|
|
|
|
->TriggerSyncButtonPressedEvent();
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnPassthroughResetButton(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
auto device = WII_IPC_HLE_Interface::GetDeviceByName("/dev/usb/oh1/57e/305");
|
|
|
|
if (device != nullptr)
|
|
|
|
std::static_pointer_cast<CWII_IPC_HLE_Device_usb_oh1_57e_305_base>(device)
|
|
|
|
->TriggerSyncButtonHeldEvent();
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
2016-06-24 11:43:46 +03:00
|
|
|
void OnEnableSpeaker(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_WiimoteEnableSpeaker = event.IsChecked();
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
2016-08-23 17:19:30 +03:00
|
|
|
void UpdateUI()
|
|
|
|
{
|
|
|
|
const bool enable_bt_passthrough_mode = SConfig::GetInstance().m_bt_passthrough_enabled;
|
|
|
|
m_real_wiimotes_sizer->ShowItems(!enable_bt_passthrough_mode);
|
|
|
|
m_bt_passthrough_sizer->ShowItems(enable_bt_passthrough_mode);
|
|
|
|
m_unsupported_bt_text->Show(!enable_bt_passthrough_mode);
|
|
|
|
m_bt_passthrough_text->Show(enable_bt_passthrough_mode);
|
|
|
|
m_balance_board_group->ShowItems(!enable_bt_passthrough_mode);
|
|
|
|
m_enable_speaker_data->Enable(!enable_bt_passthrough_mode);
|
|
|
|
for (int i = 0; i < MAX_WIIMOTES; ++i)
|
|
|
|
{
|
|
|
|
m_wiimote_labels[i]->Enable(!enable_bt_passthrough_mode);
|
|
|
|
m_wiimote_sources[i]->Enable(!enable_bt_passthrough_mode);
|
|
|
|
m_wiimote_configure_button[i]->Enable(!enable_bt_passthrough_mode);
|
|
|
|
}
|
|
|
|
Layout();
|
|
|
|
Fit();
|
|
|
|
}
|
|
|
|
|
2016-06-24 11:43:46 +03:00
|
|
|
wxStaticBoxSizer* CreateGamecubeSizer();
|
|
|
|
wxStaticBoxSizer* CreateWiimoteConfigSizer();
|
|
|
|
wxStaticBoxSizer* CreateBalanceBoardSizer();
|
|
|
|
wxStaticBoxSizer* CreateRealWiimoteSizer();
|
|
|
|
wxStaticBoxSizer* CreateGeneralWiimoteSettingsSizer();
|
|
|
|
|
2016-08-16 03:53:38 +03:00
|
|
|
void OnClose(wxCloseEvent& event);
|
|
|
|
void OnCloseButton(wxCommandEvent& event);
|
|
|
|
|
2016-06-24 11:43:46 +03:00
|
|
|
void OnGameCubePortChanged(wxCommandEvent& event);
|
|
|
|
void OnGameCubeConfigButton(wxCommandEvent& event);
|
|
|
|
|
2016-08-16 03:53:38 +03:00
|
|
|
void OnWiimoteSourceChanged(wxCommandEvent& event);
|
|
|
|
void OnWiimoteConfigButton(wxCommandEvent& event);
|
|
|
|
void OnWiimoteRefreshButton(wxCommandEvent& event);
|
|
|
|
void SaveWiimoteSource();
|
2016-06-24 11:43:46 +03:00
|
|
|
|
2016-08-16 03:53:38 +03:00
|
|
|
std::map<wxWindowID, unsigned int> m_gc_port_from_choice_id;
|
|
|
|
std::map<wxWindowID, unsigned int> m_gc_port_from_config_id;
|
|
|
|
std::array<wxButton*, 4> m_gc_port_configure_button;
|
|
|
|
std::array<wxString, 8> m_gc_pad_type_strs;
|
2016-06-24 11:43:46 +03:00
|
|
|
|
2016-08-16 03:53:38 +03:00
|
|
|
std::map<wxWindowID, unsigned int> m_wiimote_index_from_choice_id;
|
|
|
|
std::map<wxWindowID, unsigned int> m_wiimote_index_from_config_id;
|
|
|
|
std::array<wxButton*, MAX_WIIMOTES> m_wiimote_configure_button;
|
2016-08-23 17:19:30 +03:00
|
|
|
|
|
|
|
std::array<wxStaticText*, 4> m_wiimote_labels;
|
|
|
|
std::array<wxChoice*, 4> m_wiimote_sources;
|
|
|
|
wxBoxSizer* m_real_wiimotes_sizer;
|
|
|
|
wxBoxSizer* m_bt_passthrough_sizer;
|
|
|
|
wxStaticText* m_unsupported_bt_text;
|
|
|
|
wxStaticText* m_bt_passthrough_text;
|
|
|
|
wxStaticBoxSizer* m_general_wm_settings;
|
|
|
|
wxStaticBoxSizer* m_balance_board_group;
|
|
|
|
wxCheckBox* m_enable_speaker_data;
|
2010-07-03 11:04:10 +03:00
|
|
|
};
|