mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
WiimoteConfigDiag: Unify controller menu with the GameCube controllers.
This commit is contained in:
parent
00dcaba37d
commit
e801fcead9
@ -107,13 +107,6 @@ static const wxLanguage langIds[] =
|
||||
#define DEV_NONE_STR _trans("<Nothing>")
|
||||
#define DEV_DUMMY_STR _trans("Dummy")
|
||||
|
||||
#define SIDEV_STDCONT_STR _trans("Standard Controller")
|
||||
#define SIDEV_STEERING_STR _trans("Steering Wheel")
|
||||
#define SIDEV_DANCEMAT_STR _trans("Dance Mat")
|
||||
#define SIDEV_BONGO_STR _trans("TaruKonga (Bongos)")
|
||||
#define SIDEV_GBA_STR "GBA"
|
||||
#define SIDEV_AM_BB_STR _trans("AM-Baseboard")
|
||||
|
||||
#define EXIDEV_MEMCARD_STR _trans("Memory Card")
|
||||
#define EXIDEV_MEMDIR_STR _trans("GCI Folder")
|
||||
#define EXIDEV_MIC_STR _trans("Mic")
|
||||
@ -165,11 +158,6 @@ EVT_BUTTON(ID_GC_EXIDEVICE_SLOTA_PATH, CConfigMain::GCSettingsChanged)
|
||||
EVT_CHOICE(ID_GC_EXIDEVICE_SLOTB, CConfigMain::GCSettingsChanged)
|
||||
EVT_BUTTON(ID_GC_EXIDEVICE_SLOTB_PATH, CConfigMain::GCSettingsChanged)
|
||||
EVT_CHOICE(ID_GC_EXIDEVICE_SP1, CConfigMain::GCSettingsChanged)
|
||||
EVT_CHOICE(ID_GC_SIDEVICE0, CConfigMain::GCSettingsChanged)
|
||||
EVT_CHOICE(ID_GC_SIDEVICE1, CConfigMain::GCSettingsChanged)
|
||||
EVT_CHOICE(ID_GC_SIDEVICE2, CConfigMain::GCSettingsChanged)
|
||||
EVT_CHOICE(ID_GC_SIDEVICE3, CConfigMain::GCSettingsChanged)
|
||||
|
||||
|
||||
EVT_CHECKBOX(ID_WII_IPL_SSV, CConfigMain::WiiSettingsChanged)
|
||||
EVT_CHECKBOX(ID_WII_IPL_E60, CConfigMain::WiiSettingsChanged)
|
||||
@ -404,14 +392,6 @@ void CConfigMain::InitializeGUIValues()
|
||||
SP1Devices.Add(_(EXIDEV_BBA_STR));
|
||||
SP1Devices.Add(_(EXIDEV_AM_BB_STR));
|
||||
|
||||
wxArrayString SIDevices;
|
||||
SIDevices.Add(_(DEV_NONE_STR));
|
||||
SIDevices.Add(_(SIDEV_STDCONT_STR));
|
||||
SIDevices.Add(_(SIDEV_STEERING_STR));
|
||||
SIDevices.Add(_(SIDEV_DANCEMAT_STR));
|
||||
SIDevices.Add(_(SIDEV_BONGO_STR));
|
||||
SIDevices.Add(_(SIDEV_GBA_STR));
|
||||
SIDevices.Add(_(SIDEV_AM_BB_STR));
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
@ -454,39 +434,6 @@ void CConfigMain::InitializeGUIValues()
|
||||
if (!isMemcard && i < 2)
|
||||
GCMemcardPath[i]->Disable();
|
||||
}
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
// Add string to the wxChoice list
|
||||
GCSIDevice[i]->Append(SIDevices);
|
||||
|
||||
switch (SConfig::GetInstance().m_SIDevice[i])
|
||||
{
|
||||
case SIDEVICE_GC_CONTROLLER:
|
||||
GCSIDevice[i]->SetStringSelection(SIDevices[1]);
|
||||
break;
|
||||
case SIDEVICE_GC_STEERING:
|
||||
GCSIDevice[i]->SetStringSelection(SIDevices[2]);
|
||||
break;
|
||||
case SIDEVICE_DANCEMAT:
|
||||
GCSIDevice[i]->SetStringSelection(SIDevices[3]);
|
||||
break;
|
||||
case SIDEVICE_GC_TARUKONGA:
|
||||
GCSIDevice[i]->SetStringSelection(SIDevices[4]);
|
||||
break;
|
||||
case SIDEVICE_GC_GBA:
|
||||
GCSIDevice[i]->SetStringSelection(SIDevices[5]);
|
||||
break;
|
||||
case SIDEVICE_AM_BASEBOARD:
|
||||
GCSIDevice[i]->SetStringSelection(SIDevices[6]);
|
||||
break;
|
||||
default:
|
||||
GCSIDevice[i]->SetStringSelection(SIDevices[0]);
|
||||
break;
|
||||
}
|
||||
// Remove the AM baseboard from the list, only the first list can select it
|
||||
if (i == 0)
|
||||
SIDevices.RemoveAt(SIDevices.GetCount() - 1);
|
||||
}
|
||||
|
||||
// Wii - Misc
|
||||
WiiScreenSaver->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.SSV"));
|
||||
@ -729,17 +676,6 @@ void CConfigMain::CreateGUIControls()
|
||||
GCMemcardPath[1] = new wxButton(GamecubePage, ID_GC_EXIDEVICE_SLOTB_PATH, "...",
|
||||
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
|
||||
|
||||
//SI Devices
|
||||
wxStaticText* GCSIDeviceText[4];
|
||||
GCSIDeviceText[0] = TEXT_BOX(GamecubePage, _("Port 1"));
|
||||
GCSIDeviceText[1] = TEXT_BOX(GamecubePage, _("Port 2"));
|
||||
GCSIDeviceText[2] = TEXT_BOX(GamecubePage, _("Port 3"));
|
||||
GCSIDeviceText[3] = TEXT_BOX(GamecubePage, _("Port 4"));
|
||||
GCSIDevice[0] = new wxChoice(GamecubePage, ID_GC_SIDEVICE0);
|
||||
GCSIDevice[1] = new wxChoice(GamecubePage, ID_GC_SIDEVICE1);
|
||||
GCSIDevice[2] = new wxChoice(GamecubePage, ID_GC_SIDEVICE2);
|
||||
GCSIDevice[3] = new wxChoice(GamecubePage, ID_GC_SIDEVICE3);
|
||||
|
||||
// Populate the GameCube page
|
||||
sGamecubeIPLSettings = new wxGridBagSizer();
|
||||
sGamecubeIPLSettings->Add(GCAlwaysHLE_BS2, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
@ -761,24 +697,11 @@ void CConfigMain::CreateGUIControls()
|
||||
}
|
||||
sbGamecubeDeviceSettings->Add(sbGamecubeEXIDevSettings, 0, wxALL, 5);
|
||||
|
||||
wxFlexGridSizer* sbGamecubeDevSettings = new wxFlexGridSizer(2, 10, 10);
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
sbGamecubeDevSettings->Add(GCSIDeviceText[i], 1, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 0);
|
||||
sbGamecubeDevSettings->Add(GCSIDevice[i], 1, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 0);
|
||||
if (NetPlay::IsNetPlayRunning() || Movie::IsMovieActive())
|
||||
{
|
||||
GCSIDevice[i]->Disable();
|
||||
}
|
||||
}
|
||||
sbGamecubeDeviceSettings->Add(sbGamecubeDevSettings, 0, wxALL, 5);
|
||||
|
||||
sGamecubePage = new wxBoxSizer(wxVERTICAL);
|
||||
sGamecubePage->Add(sbGamecubeIPLSettings, 0, wxEXPAND|wxALL, 5);
|
||||
sGamecubePage->Add(sbGamecubeDeviceSettings, 0, wxEXPAND|wxALL, 5);
|
||||
GamecubePage->SetSizer(sGamecubePage);
|
||||
|
||||
|
||||
// Wii page
|
||||
// Misc Settings
|
||||
WiiScreenSaver = new wxCheckBox(WiiPage, ID_WII_IPL_SSV, _("Enable Screen Saver"));
|
||||
@ -1026,7 +949,6 @@ bool CConfigMain::SupportsVolumeChanges(std::string backend)
|
||||
// -----------------------
|
||||
void CConfigMain::GCSettingsChanged(wxCommandEvent& event)
|
||||
{
|
||||
int sidevice = 0;
|
||||
int exidevice = 0;
|
||||
switch (event.GetId())
|
||||
{
|
||||
@ -1053,15 +975,6 @@ void CConfigMain::GCSettingsChanged(wxCommandEvent& event)
|
||||
case ID_GC_EXIDEVICE_SLOTB_PATH:
|
||||
ChooseMemcardPath(SConfig::GetInstance().m_strMemoryCardB, false);
|
||||
break;
|
||||
case ID_GC_SIDEVICE3:
|
||||
sidevice++;
|
||||
case ID_GC_SIDEVICE2:
|
||||
sidevice++;
|
||||
case ID_GC_SIDEVICE1:
|
||||
sidevice++;
|
||||
case ID_GC_SIDEVICE0:
|
||||
ChooseSIDevice(event.GetString(), sidevice);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1123,33 +1036,6 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
|
||||
}
|
||||
}
|
||||
|
||||
void CConfigMain::ChooseSIDevice(wxString deviceName, int deviceNum)
|
||||
{
|
||||
SIDevices tempType;
|
||||
if (!deviceName.compare(_(SIDEV_STDCONT_STR)))
|
||||
tempType = SIDEVICE_GC_CONTROLLER;
|
||||
else if (!deviceName.compare(_(SIDEV_STEERING_STR)))
|
||||
tempType = SIDEVICE_GC_STEERING;
|
||||
else if (!deviceName.compare(_(SIDEV_DANCEMAT_STR)))
|
||||
tempType = SIDEVICE_DANCEMAT;
|
||||
else if (!deviceName.compare(_(SIDEV_BONGO_STR)))
|
||||
tempType = SIDEVICE_GC_TARUKONGA;
|
||||
else if (!deviceName.compare(SIDEV_GBA_STR))
|
||||
tempType = SIDEVICE_GC_GBA;
|
||||
else if (!deviceName.compare(_(SIDEV_AM_BB_STR)))
|
||||
tempType = SIDEVICE_AM_BASEBOARD;
|
||||
else
|
||||
tempType = SIDEVICE_NONE;
|
||||
|
||||
SConfig::GetInstance().m_SIDevice[deviceNum] = tempType;
|
||||
|
||||
if (Core::IsRunning())
|
||||
{
|
||||
// Change plugged device! :D
|
||||
SerialInterface::ChangeDevice(tempType, deviceNum);
|
||||
}
|
||||
}
|
||||
|
||||
void CConfigMain::ChooseEXIDevice(wxString deviceName, int deviceNum)
|
||||
{
|
||||
TEXIDevices tempType;
|
||||
|
@ -108,11 +108,6 @@ private:
|
||||
ID_GC_EXIDEVICE_SLOTB,
|
||||
ID_GC_EXIDEVICE_SLOTB_PATH,
|
||||
ID_GC_EXIDEVICE_SP1,
|
||||
ID_GC_SIDEVICE0,
|
||||
ID_GC_SIDEVICE1,
|
||||
ID_GC_SIDEVICE2,
|
||||
ID_GC_SIDEVICE3,
|
||||
|
||||
|
||||
ID_WII_IPL_SSV,
|
||||
ID_WII_IPL_E60,
|
||||
@ -186,8 +181,6 @@ private:
|
||||
// Device
|
||||
wxChoice* GCEXIDevice[3];
|
||||
wxButton* GCMemcardPath[2];
|
||||
wxChoice* GCSIDevice[4];
|
||||
|
||||
|
||||
wxBoxSizer* sWiiPage; // Wii settings
|
||||
wxStaticBoxSizer* /*sbWiimoteSettings, **/sbWiiIPLSettings, *sbWiiDeviceSettings; // Wiimote, Misc and Device sections
|
||||
@ -257,7 +250,6 @@ private:
|
||||
|
||||
void GCSettingsChanged(wxCommandEvent& event);
|
||||
void ChooseMemcardPath(std::string& strMemcard, bool isSlotA);
|
||||
void ChooseSIDevice(wxString deviceName, int deviceNum);
|
||||
void ChooseEXIDevice(wxString deviceName, int deviceNum);
|
||||
|
||||
void WiiSettingsChanged(wxCommandEvent& event);
|
||||
|
@ -260,8 +260,7 @@ EVT_MENU(IDM_TOGGLE_DUMPAUDIO, CFrame::OnToggleDumpAudio)
|
||||
EVT_MENU(wxID_PREFERENCES, CFrame::OnConfigMain)
|
||||
EVT_MENU(IDM_CONFIG_GFX_BACKEND, CFrame::OnConfigGFX)
|
||||
EVT_MENU(IDM_CONFIG_DSP_EMULATOR, CFrame::OnConfigDSP)
|
||||
EVT_MENU(IDM_CONFIG_PAD_PLUGIN, CFrame::OnConfigPAD)
|
||||
EVT_MENU(IDM_CONFIG_WIIMOTE_PLUGIN, CFrame::OnConfigWiimote)
|
||||
EVT_MENU(IDM_CONFIG_CONTROLLERS, CFrame::OnConfigControllers)
|
||||
EVT_MENU(IDM_CONFIG_HOTKEYS, CFrame::OnConfigHotkey)
|
||||
|
||||
EVT_MENU(IDM_SAVE_PERSPECTIVE, CFrame::OnPerspectiveMenu)
|
||||
|
@ -190,8 +190,7 @@ private:
|
||||
Toolbar_ConfigMain,
|
||||
Toolbar_ConfigGFX,
|
||||
Toolbar_ConfigDSP,
|
||||
Toolbar_ConfigPAD,
|
||||
Toolbar_Wiimote,
|
||||
Toolbar_Controller,
|
||||
EToolbar_Max
|
||||
};
|
||||
|
||||
@ -293,8 +292,7 @@ private:
|
||||
void OnConfigMain(wxCommandEvent& event); // Options
|
||||
void OnConfigGFX(wxCommandEvent& event);
|
||||
void OnConfigDSP(wxCommandEvent& event);
|
||||
void OnConfigPAD(wxCommandEvent& event);
|
||||
void OnConfigWiimote(wxCommandEvent& event);
|
||||
void OnConfigControllers(wxCommandEvent& event);
|
||||
void OnConfigHotkey(wxCommandEvent& event);
|
||||
|
||||
void OnToggleFullscreen(wxCommandEvent& event);
|
||||
|
@ -236,8 +236,7 @@ wxMenuBar* CFrame::CreateMenu()
|
||||
pOptionsMenu->AppendSeparator();
|
||||
pOptionsMenu->Append(IDM_CONFIG_GFX_BACKEND, _("&Graphics Settings"));
|
||||
pOptionsMenu->Append(IDM_CONFIG_DSP_EMULATOR, _("&DSP Settings"));
|
||||
pOptionsMenu->Append(IDM_CONFIG_PAD_PLUGIN, _("GameCube &Pad Settings"));
|
||||
pOptionsMenu->Append(IDM_CONFIG_WIIMOTE_PLUGIN, _("&Wiimote Settings"));
|
||||
pOptionsMenu->Append(IDM_CONFIG_CONTROLLERS, _("&Controller Settings"));
|
||||
pOptionsMenu->Append(IDM_CONFIG_HOTKEYS, _("&Hotkey Settings"));
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
@ -560,20 +559,19 @@ void CFrame::PopulateToolbar(wxToolBar* ToolBar)
|
||||
ToolBar->SetToolBitmapSize(wxSize(w, h));
|
||||
|
||||
|
||||
WxUtils::AddToolbarButton(ToolBar, wxID_OPEN, _("Open"), m_Bitmaps[Toolbar_FileOpen], _("Open file..."));
|
||||
WxUtils::AddToolbarButton(ToolBar, wxID_REFRESH, _("Refresh"), m_Bitmaps[Toolbar_Refresh], _("Refresh game list"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_BROWSE, _("Browse"), m_Bitmaps[Toolbar_Browse], _("Browse for an ISO directory..."));
|
||||
WxUtils::AddToolbarButton(ToolBar, wxID_OPEN, _("Open"), m_Bitmaps[Toolbar_FileOpen], _("Open file..."));
|
||||
WxUtils::AddToolbarButton(ToolBar, wxID_REFRESH, _("Refresh"), m_Bitmaps[Toolbar_Refresh], _("Refresh game list"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_BROWSE, _("Browse"), m_Bitmaps[Toolbar_Browse], _("Browse for an ISO directory..."));
|
||||
ToolBar->AddSeparator();
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_PLAY, _("Play"), m_Bitmaps[Toolbar_Play], _("Play"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_STOP, _("Stop"), m_Bitmaps[Toolbar_Stop], _("Stop"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_TOGGLE_FULLSCREEN, _("FullScr"), m_Bitmaps[Toolbar_FullScreen], _("Toggle Fullscreen"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_SCREENSHOT, _("ScrShot"), m_Bitmaps[Toolbar_Screenshot], _("Take Screenshot"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_PLAY, _("Play"), m_Bitmaps[Toolbar_Play], _("Play"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_STOP, _("Stop"), m_Bitmaps[Toolbar_Stop], _("Stop"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_TOGGLE_FULLSCREEN, _("FullScr"), m_Bitmaps[Toolbar_FullScreen], _("Toggle Fullscreen"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_SCREENSHOT, _("ScrShot"), m_Bitmaps[Toolbar_Screenshot], _("Take Screenshot"));
|
||||
ToolBar->AddSeparator();
|
||||
WxUtils::AddToolbarButton(ToolBar, wxID_PREFERENCES, _("Config"), m_Bitmaps[Toolbar_ConfigMain], _("Configure..."));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_GFX_BACKEND, _("Graphics"), m_Bitmaps[Toolbar_ConfigGFX], _("Graphics settings"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_DSP_EMULATOR, _("DSP"), m_Bitmaps[Toolbar_ConfigDSP], _("DSP settings"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_PAD_PLUGIN, _("GCPad"), m_Bitmaps[Toolbar_ConfigPAD], _("GameCube Pad settings"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_WIIMOTE_PLUGIN, _("Wiimote"), m_Bitmaps[Toolbar_Wiimote], _("Wiimote settings"));
|
||||
WxUtils::AddToolbarButton(ToolBar, wxID_PREFERENCES, _("Config"), m_Bitmaps[Toolbar_ConfigMain], _("Configure..."));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_GFX_BACKEND, _("Graphics"), m_Bitmaps[Toolbar_ConfigGFX], _("Graphics settings"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_DSP_EMULATOR, _("DSP"), m_Bitmaps[Toolbar_ConfigDSP], _("DSP settings"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_CONTROLLERS, _("Controllers"), m_Bitmaps[Toolbar_Controller], _("Controller settings"));
|
||||
}
|
||||
|
||||
|
||||
@ -617,8 +615,7 @@ void CFrame::InitBitmaps()
|
||||
m_Bitmaps[Toolbar_ConfigMain].LoadFile(dir + "config.png", wxBITMAP_TYPE_PNG);
|
||||
m_Bitmaps[Toolbar_ConfigGFX ].LoadFile(dir + "graphics.png", wxBITMAP_TYPE_PNG);
|
||||
m_Bitmaps[Toolbar_ConfigDSP ].LoadFile(dir + "dsp.png", wxBITMAP_TYPE_PNG);
|
||||
m_Bitmaps[Toolbar_ConfigPAD ].LoadFile(dir + "gcpad.png", wxBITMAP_TYPE_PNG);
|
||||
m_Bitmaps[Toolbar_Wiimote ].LoadFile(dir + "wiimote.png", wxBITMAP_TYPE_PNG);
|
||||
m_Bitmaps[Toolbar_Controller].LoadFile(dir + "wiimote.png", wxBITMAP_TYPE_PNG);
|
||||
m_Bitmaps[Toolbar_Screenshot].LoadFile(dir + "screenshot.png", wxBITMAP_TYPE_PNG);
|
||||
m_Bitmaps[Toolbar_FullScreen].LoadFile(dir + "fullscreen.png", wxBITMAP_TYPE_PNG);
|
||||
|
||||
@ -1346,56 +1343,11 @@ void CFrame::OnConfigDSP(wxCommandEvent& WXUNUSED (event))
|
||||
m_GameListCtrl->Update();
|
||||
}
|
||||
|
||||
void CFrame::OnConfigPAD(wxCommandEvent& WXUNUSED (event))
|
||||
void CFrame::OnConfigControllers(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
InputConfig* const pad_plugin = Pad::GetConfig();
|
||||
bool was_init = false;
|
||||
if (g_controller_interface.IsInit()) // check if game is running
|
||||
{
|
||||
was_init = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
Window win = X11Utils::XWindowFromHandle(GetHandle());
|
||||
Pad::Initialize(reinterpret_cast<void*>(win));
|
||||
#else
|
||||
Pad::Initialize(reinterpret_cast<void*>(GetHandle()));
|
||||
#endif
|
||||
}
|
||||
InputConfigDialog m_ConfigFrame(this, *pad_plugin, _trans("Dolphin GCPad Configuration"));
|
||||
WiimoteConfigDiag m_ConfigFrame(this);
|
||||
m_ConfigFrame.ShowModal();
|
||||
m_ConfigFrame.Destroy();
|
||||
if (!was_init) // if game isn't running
|
||||
{
|
||||
Pad::Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
void CFrame::OnConfigWiimote(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
InputConfig* const wiimote_plugin = Wiimote::GetConfig();
|
||||
bool was_init = false;
|
||||
if (g_controller_interface.IsInit()) // check if game is running
|
||||
{
|
||||
was_init = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
Window win = X11Utils::XWindowFromHandle(GetHandle());
|
||||
Wiimote::Initialize(reinterpret_cast<void*>(win));
|
||||
#else
|
||||
Wiimote::Initialize(reinterpret_cast<void*>(GetHandle()));
|
||||
#endif
|
||||
}
|
||||
WiimoteConfigDiag m_ConfigFrame(this, *wiimote_plugin);
|
||||
m_ConfigFrame.ShowModal();
|
||||
m_ConfigFrame.Destroy();
|
||||
if (!was_init) // if game isn't running
|
||||
{
|
||||
Wiimote::Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
void CFrame::OnConfigHotkey(wxCommandEvent& WXUNUSED (event))
|
||||
@ -1759,8 +1711,6 @@ void CFrame::UpdateGUI()
|
||||
m_ToolBar->EnableTool(IDM_STOP, Running || Paused);
|
||||
m_ToolBar->EnableTool(IDM_TOGGLE_FULLSCREEN, Running || Paused);
|
||||
m_ToolBar->EnableTool(IDM_SCREENSHOT, Running || Paused);
|
||||
// Don't allow wiimote config while in GameCube mode
|
||||
m_ToolBar->EnableTool(IDM_CONFIG_WIIMOTE_PLUGIN, !RunningGamecube);
|
||||
}
|
||||
|
||||
// File
|
||||
@ -1803,7 +1753,7 @@ void CFrame::UpdateGUI()
|
||||
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Enable(RunningWii);
|
||||
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Enable(RunningWii);
|
||||
GetMenuBar()->FindItem(IDM_CONNECT_BALANCEBOARD)->Enable(RunningWii);
|
||||
GetMenuBar()->FindItem(IDM_CONFIG_WIIMOTE_PLUGIN)->Enable(!RunningGamecube);
|
||||
GetMenuBar()->FindItem(IDM_CONFIG_CONTROLLERS)->Enable(!RunningGamecube);
|
||||
if (RunningWii)
|
||||
{
|
||||
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Check(GetUsbPointer()->
|
||||
|
@ -147,8 +147,7 @@ enum
|
||||
|
||||
IDM_CONFIG_GFX_BACKEND,
|
||||
IDM_CONFIG_DSP_EMULATOR,
|
||||
IDM_CONFIG_PAD_PLUGIN,
|
||||
IDM_CONFIG_WIIMOTE_PLUGIN,
|
||||
IDM_CONFIG_CONTROLLERS,
|
||||
IDM_CONFIG_HOTKEYS,
|
||||
IDM_CONFIG_LOGGER,
|
||||
|
||||
|
@ -24,14 +24,29 @@
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/NetPlayProto.h"
|
||||
#include "Core/HW/GCPad.h"
|
||||
#include "Core/HW/SI.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/HW/WiimoteReal/WiimoteReal.h"
|
||||
#include "DolphinWX/InputConfigDiag.h"
|
||||
#include "DolphinWX/WiimoteConfigDiag.h"
|
||||
|
||||
WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputConfig& config)
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
#include "VideoBackends/OGL/GLInterface/X11Utils.h"
|
||||
#endif
|
||||
|
||||
const std::array<wxString, 7> WiimoteConfigDiag::m_gc_pad_type_strs = {{
|
||||
_("None"),
|
||||
_("Standard Controller"),
|
||||
_("Steering Wheel"),
|
||||
_("Dance Mat"),
|
||||
_("TaruKonga (Bongos)"),
|
||||
_("GBA"),
|
||||
_("AM-Baseboard")
|
||||
}};
|
||||
|
||||
WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent)
|
||||
: wxDialog(parent, -1, _("Dolphin Wiimote Configuration"))
|
||||
, m_config(config)
|
||||
{
|
||||
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
@ -55,16 +70,6 @@ wxStaticBoxSizer* WiimoteConfigDiag::CreateGamecubeSizer()
|
||||
wxStaticBoxSizer* const gamecube_static_sizer = new wxStaticBoxSizer(wxHORIZONTAL, this, _("GameCube Controllers"));
|
||||
wxFlexGridSizer* const gamecube_flex_sizer = new wxFlexGridSizer(3, 5, 5);
|
||||
|
||||
static const std::array<wxString, 7> pad_type_strs = {{
|
||||
_("None"),
|
||||
_("Standard Controller"),
|
||||
_("Steering Wheel"),
|
||||
_("Dance Mat"),
|
||||
_("TaruKonga (Bongos)"),
|
||||
_("GBA"),
|
||||
_("AM-Baseboard")
|
||||
}};
|
||||
|
||||
wxStaticText* pad_labels[4];
|
||||
wxChoice* pad_type_choices[4];
|
||||
wxButton* config_buttons[4];
|
||||
@ -72,15 +77,53 @@ wxStaticBoxSizer* WiimoteConfigDiag::CreateGamecubeSizer()
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
config_buttons[i] = new wxButton(this, wxID_ANY, _("Configure"), wxDefaultPosition, wxSize(100, 25));
|
||||
pad_labels[i] = new wxStaticText(this, wxID_ANY, wxString::Format(_("Port %i"), i + 1));
|
||||
|
||||
// Create an ID for the config button.
|
||||
const wxWindowID button_id = wxWindow::NewControlId();
|
||||
m_gc_port_config_ids.insert(std::make_pair(button_id, i));
|
||||
config_buttons[i] = new wxButton(this, button_id, _("Configure"), wxDefaultPosition, wxSize(100, 25));
|
||||
config_buttons[i]->Bind(wxEVT_BUTTON, &WiimoteConfigDiag::OnGameCubeConfigButton, this);
|
||||
|
||||
// Create a control ID for the choice boxes on the fly.
|
||||
const wxWindowID choice_id = wxWindow::NewControlId();
|
||||
m_gc_port_choice_ids.insert(std::make_pair(choice_id, i));
|
||||
|
||||
// Only add AM-Baseboard to the first pad.
|
||||
if (i == 0)
|
||||
pad_type_choices[i] = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, pad_type_strs.size(), pad_type_strs.data());
|
||||
pad_type_choices[i] = new wxChoice(this, choice_id, wxDefaultPosition, wxDefaultSize, m_gc_pad_type_strs.size(), m_gc_pad_type_strs.data());
|
||||
else
|
||||
pad_type_choices[i] = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, pad_type_strs.size() - 1, pad_type_strs.data());
|
||||
pad_type_choices[i] = new wxChoice(this, choice_id, wxDefaultPosition, wxDefaultSize, m_gc_pad_type_strs.size() - 1, m_gc_pad_type_strs.data());
|
||||
|
||||
pad_type_choices[i]->Bind(wxEVT_CHOICE, &WiimoteConfigDiag::OnGameCubePortChanged, this);
|
||||
|
||||
// Set the saved pad type as the default choice.
|
||||
switch (SConfig::GetInstance().m_SIDevice[i])
|
||||
{
|
||||
case SIDEVICE_GC_CONTROLLER:
|
||||
pad_type_choices[i]->SetStringSelection(m_gc_pad_type_strs[1]);
|
||||
break;
|
||||
case SIDEVICE_GC_STEERING:
|
||||
pad_type_choices[i]->SetStringSelection(m_gc_pad_type_strs[2]);
|
||||
break;
|
||||
case SIDEVICE_DANCEMAT:
|
||||
pad_type_choices[i]->SetStringSelection(m_gc_pad_type_strs[3]);
|
||||
break;
|
||||
case SIDEVICE_GC_TARUKONGA:
|
||||
pad_type_choices[i]->SetStringSelection(m_gc_pad_type_strs[4]);
|
||||
break;
|
||||
case SIDEVICE_GC_GBA:
|
||||
pad_type_choices[i]->SetStringSelection(m_gc_pad_type_strs[5]);
|
||||
break;
|
||||
case SIDEVICE_AM_BASEBOARD:
|
||||
pad_type_choices[i]->SetStringSelection(m_gc_pad_type_strs[6]);
|
||||
break;
|
||||
default:
|
||||
pad_type_choices[i]->SetStringSelection(m_gc_pad_type_strs[0]);
|
||||
break;
|
||||
}
|
||||
|
||||
// Add to the sizer
|
||||
gamecube_flex_sizer->Add(pad_labels[i], 0, wxALIGN_CENTER_VERTICAL);
|
||||
gamecube_flex_sizer->Add(pad_type_choices[i], 0, wxALIGN_CENTER_VERTICAL);
|
||||
gamecube_flex_sizer->Add(config_buttons[i], 1, wxEXPAND);
|
||||
@ -298,9 +341,32 @@ wxStaticBoxSizer* WiimoteConfigDiag::CreateGeneralWiimoteSettingsSizer()
|
||||
|
||||
void WiimoteConfigDiag::ConfigEmulatedWiimote(wxCommandEvent& ev)
|
||||
{
|
||||
InputConfigDialog* const m_emu_config_diag = new InputConfigDialog(this, m_config, _trans("Dolphin Emulated Wiimote Configuration"), m_wiimote_index_from_conf_bt_id[ev.GetId()]);
|
||||
m_emu_config_diag->ShowModal();
|
||||
m_emu_config_diag->Destroy();
|
||||
InputConfig* const wiimote_plugin = Wiimote::GetConfig();
|
||||
bool was_init = false;
|
||||
if (g_controller_interface.IsInit()) // check if game is running
|
||||
{
|
||||
was_init = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
Window win = X11Utils::XWindowFromHandle(GetHandle());
|
||||
Wiimote::Initialize(reinterpret_cast<void*>(win));
|
||||
#else
|
||||
Wiimote::Initialize(reinterpret_cast<void*>(GetHandle()));
|
||||
#endif
|
||||
}
|
||||
InputConfigDialog m_ConfigFrame(this, *wiimote_plugin, _trans("Dolphin Emulated Wiimote Configuration"), m_wiimote_index_from_conf_bt_id[ev.GetId()]);
|
||||
m_ConfigFrame.ShowModal();
|
||||
m_ConfigFrame.Destroy();
|
||||
if (!was_init) // if game isn't running
|
||||
{
|
||||
Wiimote::Shutdown();
|
||||
}
|
||||
|
||||
//InputConfigDialog* const m_emu_config_diag = new InputConfigDialog(this, *Wiimote::GetConfig(), _trans("Dolphin Emulated Wiimote Configuration"), m_wiimote_index_from_conf_bt_id[ev.GetId()]);
|
||||
//m_emu_config_diag->ShowModal();
|
||||
//m_emu_config_diag->Destroy();
|
||||
}
|
||||
|
||||
void WiimoteConfigDiag::RefreshRealWiimotes(wxCommandEvent&)
|
||||
@ -364,3 +430,61 @@ void WiimoteConfigDiag::Cancel(wxCommandEvent& event)
|
||||
RevertSource();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void WiimoteConfigDiag::OnGameCubePortChanged(wxCommandEvent& event)
|
||||
{
|
||||
const unsigned int device_num = m_gc_port_choice_ids[event.GetId()];
|
||||
const wxString device_name = event.GetString();
|
||||
|
||||
SIDevices tempType;
|
||||
if (device_name == m_gc_pad_type_strs[1])
|
||||
tempType = SIDEVICE_GC_CONTROLLER;
|
||||
else if (device_name == m_gc_pad_type_strs[2])
|
||||
tempType = SIDEVICE_GC_STEERING;
|
||||
else if (device_name == m_gc_pad_type_strs[3])
|
||||
tempType = SIDEVICE_DANCEMAT;
|
||||
else if (device_name == m_gc_pad_type_strs[4])
|
||||
tempType = SIDEVICE_GC_TARUKONGA;
|
||||
else if (device_name == m_gc_pad_type_strs[5])
|
||||
tempType = SIDEVICE_GC_GBA;
|
||||
else if (device_name == m_gc_pad_type_strs[6])
|
||||
tempType = SIDEVICE_AM_BASEBOARD;
|
||||
else
|
||||
tempType = SIDEVICE_NONE;
|
||||
|
||||
SConfig::GetInstance().m_SIDevice[device_num] = tempType;
|
||||
|
||||
if (Core::IsRunning())
|
||||
SerialInterface::ChangeDevice(tempType, device_num);
|
||||
}
|
||||
|
||||
void WiimoteConfigDiag::OnGameCubeConfigButton(wxCommandEvent& event)
|
||||
{
|
||||
InputConfig* const pad_plugin = Pad::GetConfig();
|
||||
const int port_num = m_gc_port_config_ids[event.GetId()];
|
||||
|
||||
bool was_init = false;
|
||||
|
||||
// check if game is running
|
||||
if (g_controller_interface.IsInit())
|
||||
{
|
||||
was_init = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
Window win = X11Utils::XWindowFromHandle(GetHandle());
|
||||
Pad::Initialize(reinterpret_cast<void*>(win));
|
||||
#else
|
||||
Pad::Initialize(reinterpret_cast<void*>(GetHandle()));
|
||||
#endif
|
||||
}
|
||||
|
||||
InputConfigDialog m_ConfigFrame(this, *pad_plugin, _trans("Dolphin GCPad Configuration"), port_num);
|
||||
m_ConfigFrame.ShowModal();
|
||||
m_ConfigFrame.Destroy();
|
||||
|
||||
// if game isn't running
|
||||
if (!was_init)
|
||||
Pad::Shutdown();
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <map>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/event.h>
|
||||
@ -17,7 +18,7 @@ class wxWindow;
|
||||
class WiimoteConfigDiag : public wxDialog
|
||||
{
|
||||
public:
|
||||
WiimoteConfigDiag(wxWindow* const parent, InputConfig& config);
|
||||
WiimoteConfigDiag(wxWindow* const parent);
|
||||
|
||||
void RefreshRealWiimotes(wxCommandEvent& event);
|
||||
|
||||
@ -65,9 +66,14 @@ private:
|
||||
wxStaticBoxSizer* CreateBalanceBoardSizer();
|
||||
wxStaticBoxSizer* CreateRealWiimoteSizer();
|
||||
wxStaticBoxSizer* CreateGeneralWiimoteSettingsSizer();
|
||||
void Cancel(wxCommandEvent& event);
|
||||
|
||||
InputConfig& m_config;
|
||||
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;
|
||||
static const std::array<wxString, 7> m_gc_pad_type_strs;
|
||||
|
||||
std::map<wxWindowID, unsigned int> m_wiimote_index_from_ctrl_id;
|
||||
unsigned int m_orig_wiimote_sources[MAX_BBMOTES];
|
||||
|
Loading…
Reference in New Issue
Block a user