dolphin/Source/Core/DolphinWX/ControllerConfigDiag.h
Ryan Houdek 49410576e9 Make the Wii U Gamecube adapter work with less magic.
The Wii U Gamecube controller adapter setup has always been a bit weird. It tries to be as automatic as possible to make the user experience as easy
as possible.
The problem with this approach is that it brings a large disconnect in the user experience because you have the Gamecube controller setup with regular
gamepads and then for some reason below that you have a "direct connect" option which will cause the Gamecube Adapter to overwrite the regular inputs
if something was connected.
While this works and allows the user to only click one checkbox to get the device working, it breaks the user's experience because they don't really
know what "direct connect" means and won't look it up to figure out what it is. Just expecting the device to work (At least one occurence of this in
the IRC channel in the last week).

This way around also had the terrible nature of making the code more filthy than it needed to be. The GCAdapter namespace was parasitic and hooked in
to the regular GC Controller SI class to overwrite the data that it was getting from the default configuration.
Now instead we have a specific SIDevice class for the Wii U Gamecube adapter. This class is fairly simple and is a child of the regular SI Gamecube
Pad device and only reimplements what it needs to.
This also gives the ability to configure controllers individually, which allows the user to configure rumble individually per pad input.

Overall the code is cleaner, and it fits more in line with how the rest of Dolphin works.
2016-01-05 13:44:37 -06:00

93 lines
2.3 KiB
C++

// Copyright 2010 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <array>
#include <map>
#include <wx/dialog.h>
#include "Common/SysConf.h"
#include "Core/ConfigManager.h"
#include "Core/HW/Wiimote.h"
#include "InputCommon/GCAdapter.h"
class InputConfig;
class wxButton;
class wxStaticBoxSizer;
class ControllerConfigDiag : public wxDialog
{
public:
ControllerConfigDiag(wxWindow* const parent);
private:
void RefreshRealWiimotes(wxCommandEvent& event);
void ConfigEmulatedWiimote(wxCommandEvent& event);
void SelectSource(wxCommandEvent& event);
void RevertSource();
void Save(wxCommandEvent& event);
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();
WiimoteReal::Initialize();
event.Skip();
}
void OnEnableSpeaker(wxCommandEvent& event)
{
SConfig::GetInstance().m_WiimoteEnableSpeaker = event.IsChecked();
event.Skip();
}
wxStaticBoxSizer* CreateGamecubeSizer();
wxStaticBoxSizer* CreateWiimoteConfigSizer();
wxStaticBoxSizer* CreateBalanceBoardSizer();
wxStaticBoxSizer* CreateRealWiimoteSizer();
wxStaticBoxSizer* CreateGeneralWiimoteSettingsSizer();
void Cancel(wxCommandEvent& event);
void OnGameCubePortChanged(wxCommandEvent& event);
void OnGameCubeConfigButton(wxCommandEvent& event);
std::map<wxWindowID, unsigned int> m_gc_port_choice_ids;
std::map<wxWindowID, unsigned int> m_gc_port_config_ids;
std::array<wxString, 9> m_gc_pad_type_strs;
std::map<wxWindowID, unsigned int> m_wiimote_index_from_ctrl_id;
unsigned int m_orig_wiimote_sources[MAX_BBMOTES];
wxButton* wiimote_configure_bt[MAX_WIIMOTES];
wxButton* gamecube_configure_bt[4];
std::map<wxWindowID, unsigned int> m_wiimote_index_from_conf_bt_id;
};