Moved WiimoteNew into Dolphin and eliminated the old wiimote plugin. Removed wiimote plugin support. Moved input dialog related InputUICommon stuff into DolphinWX. Removed now unused InputCommon files. UDPWiimote stuff is temporarily disabled until it is reorganized so Core won't depend on wx. Real wiimotes are now initialized on first need(wiimote diag open or game start) and left initialized until Dolphin exit.(maybe this will work better for Linux/OS X) (scons probably needs some fixes)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6270 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak
2010-10-12 19:42:29 +00:00
parent de3ad37299
commit 7e08fc19fc
116 changed files with 661 additions and 14529 deletions
+38 -14
View File
@@ -90,11 +90,11 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib xinput.lib Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib wxmsw28u_adv.lib wxmsw28u_aui.lib"
OutputFile="../../../Binary/Win32/Dolphin.exe"
AdditionalDependencies="Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib wxmsw28u_adv.lib wxmsw28u_aui.lib"
OutputFile="../../../Binary/$(PlatformName)/Dolphin.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32;..\..\..\Externals\wxWidgets\lib\vc_lib\Win32;../../../Externals/OpenAL/Win32/"
AdditionalLibraryDirectories="&quot;..\..\..\Externals\wxWidgets\lib\vc_lib\$(PlatformName)&quot;;&quot;../../../Externals/OpenAL/$(PlatformName)/&quot;;&quot;..\..\..\Externals\SDL\$(PlatformName)&quot;"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
@@ -208,11 +208,11 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib xinput.lib Iphlpapi.lib comctl32.lib rpcrt4.lib wxbase28u.lib wxmsw28u_core.lib wxmsw28u_adv.lib wxmsw28u_aui.lib"
OutputFile="../../../Binary/x64/Dolphin.exe"
AdditionalDependencies="Iphlpapi.lib comctl32.lib rpcrt4.lib wxbase28u.lib wxmsw28u_core.lib wxmsw28u_adv.lib wxmsw28u_aui.lib"
OutputFile="../../../Binary/$(PlatformName)/Dolphin.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\Externals\SDL\x64;..\..\..\Externals\wxWidgets\lib\vc_lib\x64;../../../Externals/OpenAL/Win64/"
AdditionalLibraryDirectories="&quot;..\..\..\Externals\wxWidgets\lib\vc_lib\$(PlatformName)&quot;;&quot;../../../Externals/OpenAL/$(PlatformName)/&quot;;&quot;..\..\..\Externals\SDL\$(PlatformName)&quot;"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
@@ -321,11 +321,11 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/TLBID:1"
AdditionalDependencies="SDL.lib xinput.lib Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28ud.lib wxmsw28ud_core.lib wxmsw28ud_adv.lib wxmsw28ud_aui.lib"
AdditionalDependencies="Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28ud.lib wxmsw28ud_core.lib wxmsw28ud_adv.lib wxmsw28ud_aui.lib"
OutputFile="../../../Binary/Win32/DolphinD.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32;..\..\..\Externals\wxWidgets\lib\vc_lib\Win32;../../../Externals/OpenAL/Win32/"
AdditionalLibraryDirectories="&quot;..\..\..\Externals\wxWidgets\lib\vc_lib\$(PlatformName)&quot;;&quot;../../../Externals/OpenAL/$(PlatformName)/&quot;;&quot;..\..\..\Externals\SDL\$(PlatformName)&quot;"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
@@ -432,11 +432,11 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/TLBID:1"
AdditionalDependencies="SDL.lib xinput.lib Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28ud.lib wxmsw28ud_core.lib wxmsw28ud_adv.lib wxmsw28ud_aui.lib"
AdditionalDependencies="Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28ud.lib wxmsw28ud_core.lib wxmsw28ud_adv.lib wxmsw28ud_aui.lib"
OutputFile="../../../Binary/x64/DolphinD.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\Externals\SDL\x64;..\..\..\Externals\wxWidgets\lib\vc_lib\x64;../../../Externals/OpenAL/Win64/"
AdditionalLibraryDirectories="&quot;..\..\..\Externals\wxWidgets\lib\vc_lib\$(PlatformName)&quot;;&quot;../../../Externals/OpenAL/$(PlatformName)/&quot;;&quot;..\..\..\Externals\SDL\$(PlatformName)&quot;"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
@@ -546,11 +546,11 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/NODEFAULTLIB:msvcrt.lib&#x0D;&#x0A;/NODEFAULTLIB:libcmtd.lib"
AdditionalDependencies="SDL.lib xinput.lib Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib wxmsw28u_adv.lib wxmsw28u_aui.lib"
AdditionalDependencies="Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib wxmsw28u_adv.lib wxmsw28u_aui.lib"
OutputFile="../../../Binary/Win32/DolphinDF.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32;..\..\..\Externals\wxWidgets\lib\vc_lib\Win32;../../../Externals/OpenAL/Win32/"
AdditionalLibraryDirectories="&quot;..\..\..\Externals\wxWidgets\lib\vc_lib\$(PlatformName)&quot;;&quot;../../../Externals/OpenAL/$(PlatformName)/&quot;;&quot;..\..\..\Externals\SDL\$(PlatformName)&quot;"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
@@ -659,11 +659,11 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib xinput.lib Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib wxmsw28u_adv.lib wxmsw28u_aui.lib"
AdditionalDependencies="Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib wxmsw28u_adv.lib wxmsw28u_aui.lib"
OutputFile="../../../Binary/x64/DolphinDF.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\Externals\SDL\x64;..\..\..\Externals\wxWidgets\lib\vc_lib\x64;../../../Externals/OpenAL/Win64/"
AdditionalLibraryDirectories="&quot;..\..\..\Externals\wxWidgets\lib\vc_lib\$(PlatformName)&quot;;&quot;../../../Externals/OpenAL/$(PlatformName)/&quot;;&quot;..\..\..\Externals\SDL\$(PlatformName)&quot;"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
@@ -924,6 +924,14 @@
RelativePath=".\Src\PatchAddEdit.h"
>
</File>
<File
RelativePath=".\Src\WiimoteConfigDiag.cpp"
>
</File>
<File
RelativePath=".\Src\WiimoteConfigDiag.h"
>
</File>
<Filter
Name="NetPlay"
>
@@ -1054,6 +1062,22 @@
>
</File>
</Filter>
<Filter
Name="InputConfig"
>
<File
RelativePath=".\Src\InputConfigDiag.cpp"
>
</File>
<File
RelativePath=".\Src\InputConfigDiag.h"
>
</File>
<File
RelativePath=".\Src\InputConfigDiagBitmaps.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="Misc"
-18
View File
@@ -130,9 +130,6 @@ EVT_BUTTON(ID_GRAPHIC_CONFIG, CConfigMain::OnConfig)
EVT_CHOICE(ID_DSP_CB, CConfigMain::OnSelectionChanged)
EVT_BUTTON(ID_DSP_CONFIG, CConfigMain::OnConfig)
EVT_CHOICE(ID_WIIMOTE_CB, CConfigMain::OnSelectionChanged)
EVT_BUTTON(ID_WIIMOTE_CONFIG, CConfigMain::OnConfig)
END_EVENT_TABLE()
CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
@@ -199,7 +196,6 @@ void CConfigMain::UpdateGUI()
// Disable stuff on PluginsPage
GraphicSelection->Disable();
DSPSelection->Disable();
WiimoteSelection->Disable();
}
}
@@ -329,7 +325,6 @@ void CConfigMain::InitializeGUIValues()
// Plugins
FillChoiceBox(GraphicSelection, PLUGIN_TYPE_VIDEO, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
FillChoiceBox(DSPSelection, PLUGIN_TYPE_DSP, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
FillChoiceBox(WiimoteSelection, PLUGIN_TYPE_WIIMOTE, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin);
}
void CConfigMain::InitializeGUITooltips()
@@ -743,10 +738,6 @@ void CConfigMain::CreateGUIControls()
DSPSelection = new wxChoice(PluginsPage, ID_DSP_CB, wxDefaultPosition, wxDefaultSize, 0, NULL, 0, wxDefaultValidator);
DSPConfig = new wxButton(PluginsPage, ID_DSP_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
sbWiimotePlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginsPage, wxT("Wiimote"));
WiimoteSelection = new wxChoice(PluginsPage, ID_WIIMOTE_CB, wxDefaultPosition, wxDefaultSize, 0, NULL, 0, wxDefaultValidator);
WiimoteConfig = new wxButton(PluginsPage, ID_WIIMOTE_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
// Populate the settings
sbGraphicsPlugin->Add(GraphicSelection, 1, wxEXPAND|wxALL, 5);
sbGraphicsPlugin->Add(GraphicConfig, 0, wxALL, 5);
@@ -754,14 +745,10 @@ void CConfigMain::CreateGUIControls()
sbDSPPlugin->Add(DSPSelection, 1, wxEXPAND|wxALL, 5);
sbDSPPlugin->Add(DSPConfig, 0, wxALL, 5);
sbWiimotePlugin->Add(WiimoteSelection, 1, wxEXPAND|wxALL, 5);
sbWiimotePlugin->Add(WiimoteConfig, 0, wxALL, 5);
// Populate the Plugins page
sPluginsPage = new wxBoxSizer(wxVERTICAL);
sPluginsPage->Add(sbGraphicsPlugin, 0, wxEXPAND|wxALL, 5);
sPluginsPage->Add(sbDSPPlugin, 0, wxEXPAND|wxALL, 5);
sPluginsPage->Add(sbWiimotePlugin, 0, wxEXPAND|wxALL, 5);
PluginsPage->SetSizer(sPluginsPage);
sPluginsPage->Layout();
@@ -1155,8 +1142,6 @@ void CConfigMain::OnSelectionChanged(wxCommandEvent& WXUNUSED (event))
CPluginManager::GetInstance().FreeVideo();
if (GetFilename(DSPSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin))
CPluginManager::GetInstance().FreeDSP();
if (GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin))
CPluginManager::GetInstance().FreeWiimote();
}
void CConfigMain::OnConfig(wxCommandEvent& event)
@@ -1169,9 +1154,6 @@ void CConfigMain::OnConfig(wxCommandEvent& event)
case ID_DSP_CONFIG:
CallConfig(DSPSelection);
break;
case ID_WIIMOTE_CONFIG:
CallConfig(WiimoteSelection);
break;
}
}
+1 -10
View File
@@ -140,7 +140,7 @@ private:
wxBoxSizer* sPluginsPage; // Plugins settings
wxStaticBoxSizer* sbGraphicsPlugin, *sbDSPPlugin, *sbWiimotePlugin; // Graphics, DSP, Wiimote sections
wxStaticBoxSizer* sbGraphicsPlugin, *sbDSPPlugin; // Graphics, DSP sections
// Graphics
wxChoice* GraphicSelection;
@@ -150,10 +150,6 @@ private:
wxChoice* DSPSelection;
wxButton* DSPConfig;
// Wiimote
wxChoice* WiimoteSelection;
wxButton* WiimoteConfig;
wxButton* m_Ok;
FILE* pStream;
@@ -262,11 +258,6 @@ private:
ID_DSP_CB,
ID_DSP_CONFIG,
ID_DSP_ABOUT,
ID_WIIMOTE_TEXT,
ID_WIIMOTE_CB,
ID_WIIMOTE_CONFIG,
ID_WIIMOTE_ABOUT
};
void InitializeGUILists();
-7
View File
@@ -817,9 +817,6 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
&& event.GetModifiers() == wxMOD_SHIFT)
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, WM_USER_KEYDOWN, event.GetKeyCode());
#endif
// Send the keyboard status to the Input plugins
CPluginManager::GetInstance().GetWiimote()->Wiimote_Input(event.GetKeyCode(), 1); // 1 = Down
}
else
event.Skip();
@@ -828,10 +825,6 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
void CFrame::OnKeyUp(wxKeyEvent& event)
{
event.Skip();
if(Core::GetState() != Core::CORE_UNINITIALIZED) {
CPluginManager::GetInstance().GetWiimote()->Wiimote_Input(event.GetKeyCode(), 0); // 0 = Up
}
}
void CFrame::DoFullscreen(bool bF)
+29 -19
View File
@@ -57,12 +57,14 @@ Core::GetWindowHandle().
#include "HW/DVDInterface.h"
#include "HW/ProcessorInterface.h"
#include "HW/GCPad.h"
#include "HW/Wiimote.h"
#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
#include "State.h"
#include "VolumeHandler.h"
#include "NANDContentLoader.h"
#include "WXInputBase.h"
#include "../../InputUICommon/Src/ConfigDiag.h"
#include "WiimoteConfigDiag.h"
#include "InputConfigDiag.h"
#include <wx/datetime.h> // wxWidgets
@@ -1024,42 +1026,50 @@ void CFrame::OnPluginDSP(wxCommandEvent& WXUNUSED (event))
void CFrame::OnPluginPAD(wxCommandEvent& WXUNUSED (event))
{
InputPlugin *pad_plugin = PAD_GetPlugin();
InputPlugin *const pad_plugin = Pad::GetPlugin();
bool was_init = false;
if ( pad_plugin->controller_interface.IsInit() ) // check if game is running
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());
GCPad_Init((void *)win);
Pad::Initialize((void *)win);
#else
GCPad_Init(GetHandle());
Pad::Initialize(GetHandle());
#endif
}
InputConfigDialog* m_ConfigFrame = new InputConfigDialog(this, *pad_plugin, "Dolphin GCPad Configuration");
InputConfigDialog *const m_ConfigFrame = new InputConfigDialog(this, *pad_plugin, "Dolphin GCPad Configuration");
m_ConfigFrame->ShowModal();
m_ConfigFrame->Destroy();
if (!was_init) // if game isn't running
{
GCPad_Deinit();
Pad::Shutdown();
}
}
void CFrame::OnPluginWiimote(wxCommandEvent& WXUNUSED (event))
{
#ifdef _WIN32
Disable(); // Fake a modal dialog
#endif
CPluginManager::GetInstance().OpenConfig(
this,
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin.c_str(),
PLUGIN_TYPE_WIIMOTE
);
#ifdef _WIN32
Enable();
Raise();
#endif
InputPlugin *const wiimote_plugin = Wiimote::GetPlugin();
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((void *)win);
#else
Wiimote::Initialize(GetHandle());
#endif
}
WiimoteConfigDiag *const m_ConfigFrame = new WiimoteConfigDiag(this, *wiimote_plugin);
m_ConfigFrame->ShowModal();
m_ConfigFrame->Destroy();
if (!was_init) // if game isn't running
{
Wiimote::Shutdown();
}
}
void CFrame::OnHelp(wxCommandEvent& event)
File diff suppressed because it is too large Load Diff
+260
View File
@@ -0,0 +1,260 @@
// Copyright (C) 2010 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _CONFIGBOX_H_
#define _CONFIGBOX_H_
#define SLIDER_TICK_COUNT 100
#define DETECT_WAIT_TIME 1500
#define PREVIEW_UPDATE_TIME 25
// might have to change this setup for wiimote
#define PROFILES_PATH "Profiles/"
#include <wx/wx.h>
#include <wx/listbox.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/combobox.h>
#include <wx/checkbox.h>
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/spinctrl.h>
#include <sstream>
#include <vector>
#include "ControllerInterface/ControllerInterface.h"
#include "ControllerEmu.h"
#include "InputConfig.h"
#include "FileSearch.h"
#include "UDPWrapper.h"
class PadSetting
{
protected:
PadSetting(wxControl* const _control) : wxcontrol(_control) { wxcontrol->SetClientData(this); }
public:
virtual void UpdateGUI() = 0;
virtual void UpdateValue() = 0;
virtual ~PadSetting() {}
wxControl* const wxcontrol;
};
class PadSettingExtension : public PadSetting
{
public:
PadSettingExtension(wxWindow* const parent, ControllerEmu::Extension* const ext);
void UpdateGUI();
void UpdateValue();
ControllerEmu::Extension* const extension;
};
class PadSettingSpin : public PadSetting
{
public:
PadSettingSpin(wxWindow* const parent, ControllerEmu::ControlGroup::Setting* const setting)
: PadSetting(new wxSpinCtrl(parent, -1, wxEmptyString, wxDefaultPosition
, wxSize( 54, -1 ), 0, setting->low, setting->high, setting->value * 100))
, value(setting->value) {}
void UpdateGUI();
void UpdateValue();
ControlState& value;
};
class PadSettingCheckBox : public PadSetting
{
public:
PadSettingCheckBox(wxWindow* const parent, ControlState& _value, const char* const label);
void UpdateGUI();
void UpdateValue();
ControlState& value;
};
class GamepadPage;
class ControlDialog : public wxDialog
{
public:
ControlDialog(GamepadPage* const parent, InputPlugin& plugin, ControllerInterface::ControlReference* const ref);
wxStaticBoxSizer* CreateControlChooser(wxWindow* const parent, wxWindow* const eventsink );
void DetectControl(wxCommandEvent& event);
void ClearControl(wxCommandEvent& event);
void SetControl(wxCommandEvent& event);
void SetDevice(wxCommandEvent& event);
void UpdateGUI();
void UpdateListContents();
void SelectControl(const std::string& name);
void SetSelectedControl(wxCommandEvent& event);
void AppendControl(wxCommandEvent& event);
ControllerInterface::ControlReference* const control_reference;
InputPlugin& m_plugin;
wxComboBox* device_cbox;
wxTextCtrl* textctrl;
wxListBox* control_lbox;
wxSlider* range_slider;
private:
GamepadPage* const m_parent;
wxStaticText* m_bound_label;
ControllerInterface::DeviceQualifier m_devq;
};
class ExtensionButton : public wxButton
{
public:
ExtensionButton( wxWindow* const parent, ControllerEmu::Extension* const ext )
: wxButton( parent, -1, wxT("Configure"), wxDefaultPosition )
, extension(ext) {}
ControllerEmu::Extension* const extension;
};
class ControlButton : public wxButton
{
public:
ControlButton( wxWindow* const parent, ControllerInterface::ControlReference* const _ref, const unsigned int width, const std::string& label = "" );
ControllerInterface::ControlReference* const control_reference;
};
#ifdef USE_UDP_WIIMOTE
class UDPConfigButton : public wxButton
{
public:
UDPWrapper* const wrapper;
UDPConfigButton( wxWindow* const parent, UDPWrapper * udp)
: wxButton( parent, -1, wxT("Configure"), wxDefaultPosition )
, wrapper(udp)
{}
};
#endif
class ControlGroupBox : public wxStaticBoxSizer
{
public:
ControlGroupBox( ControllerEmu::ControlGroup* const group, wxWindow* const parent, wxWindow* const eventsink );
~ControlGroupBox();
std::vector<PadSetting*> options;
ControllerEmu::ControlGroup* const control_group;
wxStaticBitmap* static_bitmap;
std::vector<ControlButton*> control_buttons;
};
class ControlGroupsSizer : public wxBoxSizer
{
public:
ControlGroupsSizer( ControllerEmu* const controller, wxWindow* const parent, wxWindow* const eventsink, std::vector<ControlGroupBox*>* const groups = NULL );
};
class InputConfigDialog;
class GamepadPage : public wxNotebookPage
{
friend class InputConfigDialog;
friend class ControlDialog;
public:
GamepadPage( wxWindow* parent, InputPlugin& plugin, const unsigned int pad_num, InputConfigDialog* const config_dialog );
void UpdateGUI();
void RefreshDevices( wxCommandEvent& event );
void LoadProfile( wxCommandEvent& event );
void SaveProfile( wxCommandEvent& event );
void DeleteProfile( wxCommandEvent& event );
void ConfigControl( wxCommandEvent& event );
void ClearControl( wxCommandEvent& event );
void DetectControl( wxCommandEvent& event );
void ConfigExtension( wxCommandEvent& event );
void ConfigUDPWii( wxCommandEvent& event );
void SetDevice( wxCommandEvent& event );
void ClearAll( wxCommandEvent& event );
void LoadDefaults( wxCommandEvent& event );
void AdjustControlOption( wxCommandEvent& event );
void AdjustSetting( wxCommandEvent& event );
void GetProfilePath(std::string& path);
wxComboBox* profile_cbox;
wxComboBox* device_cbox;
std::vector<ControlGroupBox*> control_groups;
protected:
ControllerEmu* const controller;
private:
ControlDialog* m_control_dialog;
InputConfigDialog* const m_config_dialog;
InputPlugin &m_plugin;
};
class InputConfigDialog : public wxDialog
{
public:
InputConfigDialog( wxWindow* const parent, InputPlugin& plugin, const std::string& name, const int tab_num = 0);
//~InputConfigDialog();
bool Destroy();
void ClickSave( wxCommandEvent& event );
void UpdateDeviceComboBox();
void UpdateProfileComboBox();
void UpdateControlReferences();
void UpdateBitmaps(wxTimerEvent&);
private:
wxNotebook* m_pad_notebook;
std::vector<GamepadPage*> m_padpages;
InputPlugin& m_plugin;
wxTimer* m_update_timer;
};
#endif
@@ -0,0 +1,349 @@
// Copyright (C) 2010 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "InputConfigDiag.h"
void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
{
wxFont small_font(6, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
g_controller_interface.UpdateInput();
// don't want game thread updating input when we are using it here
if (false == g_controller_interface.update_lock.TryEnter())
return;
GamepadPage* const current_page = (GamepadPage*)m_pad_notebook->GetPage(m_pad_notebook->GetSelection());
std::vector< ControlGroupBox* >::iterator
g = current_page->control_groups.begin(),
ge = current_page->control_groups.end();
for ( ; g != ge; ++g )
{
// if this control group has a bitmap
if ( (*g)->static_bitmap )
{
wxMemoryDC dc;
wxBitmap bitmap((*g)->static_bitmap->GetBitmap());
dc.SelectObject(bitmap);
dc.Clear();
dc.SetFont(small_font);
dc.SetTextForeground(0xC0C0C0);
// label for sticks and stuff
if (64 == bitmap.GetHeight())
dc.DrawText(wxString::FromAscii((*g)->control_group->name).Upper(), 4, 2);
switch ( (*g)->control_group->type )
{
case GROUP_TYPE_TILT :
case GROUP_TYPE_STICK :
case GROUP_TYPE_CURSOR :
{
// this is starting to be a mess combining all these in one case
float x = 0, y = 0, z = 0;
float xx, yy;
switch ((*g)->control_group->type)
{
case GROUP_TYPE_STICK :
((ControllerEmu::AnalogStick*)(*g)->control_group)->GetState( &x, &y, 32.0, 32-1.5 );
break;
case GROUP_TYPE_TILT :
((ControllerEmu::Tilt*)(*g)->control_group)->GetState( &x, &y, 32.0, 32-1.5 );
break;
case GROUP_TYPE_CURSOR :
((ControllerEmu::Cursor*)(*g)->control_group)->GetState( &x, &y, &z );
x *= (32-1.5); x+= 32;
y *= (32-1.5); y+= 32;
break;
}
xx = (*g)->control_group->controls[3]->control_ref->State();
xx -= (*g)->control_group->controls[2]->control_ref->State();
yy = (*g)->control_group->controls[1]->control_ref->State();
yy -= (*g)->control_group->controls[0]->control_ref->State();
xx *= 32 - 1; xx += 32;
yy *= 32 - 1; yy += 32;
// draw the shit
// ir cursor forward movement
if (GROUP_TYPE_CURSOR == (*g)->control_group->type)
{
if (z)
{
dc.SetPen(*wxRED_PEN);
dc.SetBrush(*wxRED_BRUSH);
}
else
{
dc.SetPen(*wxGREY_PEN);
dc.SetBrush(*wxGREY_BRUSH);
}
dc.DrawRectangle( 0, 31 - z*31, 64, 2);
}
// circle for visual aid for diagonal adjustment
dc.SetPen(*wxLIGHT_GREY_PEN);
dc.SetBrush(*wxWHITE_BRUSH);
if ( GROUP_TYPE_STICK == (*g)->control_group->type )
{
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawCircle( 32, 32, 32);
}
else
dc.DrawRectangle( 16, 16, 32, 32 );
if ( GROUP_TYPE_CURSOR != (*g)->control_group->type )
{
// deadzone circle
dc.SetBrush(*wxLIGHT_GREY_BRUSH);
dc.DrawCircle( 32, 32, ((*g)->control_group)->settings[0]->value * 32 );
}
// raw dot
dc.SetPen(*wxGREY_PEN);
dc.SetBrush(*wxGREY_BRUSH);
// i like the dot better than the cross i think
dc.DrawRectangle( xx - 2, yy - 2, 4, 4 );
//dc.DrawRectangle( xx-1, 64-yy-4, 2, 8 );
//dc.DrawRectangle( xx-4, 64-yy-1, 8, 2 );
// adjusted dot
if (x!=32 || y!=32)
{
dc.SetPen(*wxRED_PEN);
dc.SetBrush(*wxRED_BRUSH);
dc.DrawRectangle( x-2, 64-y-2, 4, 4 );
// i like the dot better than the cross i think
//dc.DrawRectangle( x-1, 64-y-4, 2, 8 );
//dc.DrawRectangle( x-4, 64-y-1, 8, 2 );
}
}
break;
case GROUP_TYPE_FORCE :
{
float raw_dot[3];
float adj_dot[3];
const float deadzone = 32 * ((*g)->control_group)->settings[0]->value;
// adjusted
((ControllerEmu::Force*)(*g)->control_group)->GetState( adj_dot, 32.0, 32-1.5 );
// raw
for ( unsigned int i=0; i<3; ++i )
{
raw_dot[i] = (*g)->control_group->controls[i*2 + 1]->control_ref->State()
- (*g)->control_group->controls[i*2]->control_ref->State();
raw_dot[i] *= 32 - 1; raw_dot[i] += 32;
}
// deadzone rect for forward/backward visual
dc.SetBrush(*wxLIGHT_GREY_BRUSH);
dc.SetPen(*wxLIGHT_GREY_PEN);
dc.DrawRectangle( 0, 32 - deadzone, 64, deadzone * 2 );
// raw forward/background line
dc.SetPen(*wxGREY_PEN);
dc.SetBrush(*wxGREY_BRUSH);
dc.DrawRectangle( 0, raw_dot[2] - 1, 64, 2 );
// adjusted forward/background line
if ( adj_dot[2]!=32 )
{
dc.SetPen(*wxRED_PEN);
dc.SetBrush(*wxRED_BRUSH);
dc.DrawRectangle( 0, adj_dot[2] - 1, 64, 2 );
}
// a rectangle, for looks i guess
dc.SetBrush(*wxWHITE_BRUSH);
dc.SetPen(*wxLIGHT_GREY_PEN);
dc.DrawRectangle( 16, 16, 32, 32 );
// deadzone square
dc.SetBrush(*wxLIGHT_GREY_BRUSH);
dc.DrawRectangle( 32 - deadzone, 32 - deadzone, deadzone * 2, deadzone * 2 );
// raw dot
dc.SetPen(*wxGREY_PEN);
dc.SetBrush(*wxGREY_BRUSH);
dc.DrawRectangle( raw_dot[1] - 2, raw_dot[0] - 2, 4, 4 );
// adjusted dot
if ( adj_dot[1]!=32 || adj_dot[0]!=32 )
{
dc.SetPen(*wxRED_PEN);
dc.SetBrush(*wxRED_BRUSH);
dc.DrawRectangle( adj_dot[1]-2, adj_dot[0]-2, 4, 4 );
}
}
break;
case GROUP_TYPE_BUTTONS :
{
const unsigned int button_count = ((unsigned int)(*g)->control_group->controls.size());
// draw the shit
dc.SetPen(*wxGREY_PEN);
unsigned int * const bitmasks = new unsigned int[ button_count ];
for (unsigned int n = 0; n<button_count; ++n)
bitmasks[n] = (1 << n);
unsigned int buttons = 0;
((ControllerEmu::Buttons*)(*g)->control_group)->GetState( &buttons, bitmasks );
for (unsigned int n = 0; n<button_count; ++n)
{
if ( buttons & bitmasks[n] )
dc.SetBrush( *wxRED_BRUSH );
else
{
unsigned char amt = 255 - (*g)->control_group->controls[n]->control_ref->State() * 128;
dc.SetBrush(wxBrush(wxColor(amt, amt, amt)));
}
dc.DrawRectangle(n * 12, 0, 14, 12);
// text
const char* const name = (*g)->control_group->controls[n]->name;
// bit of hax so ZL, ZR show up as L, R
dc.DrawText(wxString::FromAscii((name[1] && name[1] < 'a') ? name[1] : name[0]), n*12 + 2, 1);
}
delete[] bitmasks;
}
break;
case GROUP_TYPE_TRIGGERS :
{
const unsigned int trigger_count = ((unsigned int)((*g)->control_group->controls.size()));
// draw the shit
dc.SetPen(*wxGREY_PEN);
ControlState deadzone = (*g)->control_group->settings[0]->value;
unsigned int* const trigs = new unsigned int[trigger_count];
((ControllerEmu::Triggers*)(*g)->control_group)->GetState( trigs, 64 );
for ( unsigned int n = 0; n < trigger_count; ++n )
{
ControlState trig_r = (*g)->control_group->controls[n]->control_ref->State();
// outline
dc.SetPen(*wxGREY_PEN);
dc.SetBrush(*wxWHITE_BRUSH);
dc.DrawRectangle(0, n*12, 64, 14);
// raw
dc.SetBrush(*wxGREY_BRUSH);
dc.DrawRectangle(0, n*12, trig_r*64, 14);
// deadzone affected
dc.SetBrush(*wxRED_BRUSH);
dc.DrawRectangle(0, n*12, trigs[n], 14);
// text
dc.DrawText(wxString::FromAscii((*g)->control_group->controls[n]->name), 3, n*12 + 1);
}
delete[] trigs;
// deadzone box
dc.SetPen(*wxLIGHT_GREY_PEN);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(0, 0, deadzone*64, trigger_count*14);
}
break;
case GROUP_TYPE_MIXED_TRIGGERS :
{
const unsigned int trigger_count = ((unsigned int)((*g)->control_group->controls.size() / 2));
// draw the shit
dc.SetPen(*wxGREY_PEN);
ControlState thresh = (*g)->control_group->settings[0]->value;
for ( unsigned int n = 0; n < trigger_count; ++n )
{
dc.SetBrush(*wxRED_BRUSH);
ControlState trig_d = (*g)->control_group->controls[n]->control_ref->State();
ControlState trig_a = trig_d > thresh ? 1
: (*g)->control_group->controls[n+trigger_count]->control_ref->State();
dc.DrawRectangle(0, n*12, 64+20, 14);
if ( trig_d <= thresh )
dc.SetBrush(*wxWHITE_BRUSH);
dc.DrawRectangle(trig_a*64, n*12, 64+20, 14);
dc.DrawRectangle(64, n*12, 32, 14);
// text
dc.DrawText(wxString::FromAscii((*g)->control_group->controls[n+trigger_count]->name), 3, n*12 + 1);
dc.DrawText(wxString::FromAscii((*g)->control_group->controls[n]->name[0]), 64 + 3, n*12 + 1);
}
// threshold box
dc.SetPen(*wxLIGHT_GREY_PEN);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(thresh*64, 0, 128, trigger_count*14);
}
break;
case GROUP_TYPE_SLIDER:
{
const ControlState deadzone = (*g)->control_group->settings[0]->value;
ControlState state = (*g)->control_group->controls[1]->control_ref->State() - (*g)->control_group->controls[0]->control_ref->State();
dc.SetPen(*wxGREY_PEN);
dc.SetBrush(*wxGREY_BRUSH);
dc.DrawRectangle(31 + state * 30, 0, 2, 14);
((ControllerEmu::Slider*)(*g)->control_group)->GetState(&state, 1);
if (state)
{
dc.SetPen(*wxRED_PEN);
dc.SetBrush(*wxRED_BRUSH);
dc.DrawRectangle(31 + state * 30, 0, 2, 14);
}
// deadzone box
dc.SetPen(*wxLIGHT_GREY_PEN);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(32 - deadzone * 32, 0, deadzone * 64, 14);
}
break;
default :
break;
}
// box outline
// Windows XP color
dc.SetPen(wxPen(_T("#7f9db9")));
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(0, 0, bitmap.GetWidth(), bitmap.GetHeight());
dc.SelectObject(wxNullBitmap);
(*g)->static_bitmap->SetBitmap(bitmap);
}
}
g_controller_interface.update_lock.Leave();
}
+4 -8
View File
@@ -32,6 +32,7 @@
#include "Host.h" // Core
#include "PluginManager.h"
#include "HW/Wiimote.h"
#include "Globals.h" // Local
#include "Main.h"
@@ -336,6 +337,7 @@ bool DolphinApp::OnInit()
LogManager::Init();
SConfig::Init();
CPluginManager::Init();
WiimoteReal::LoadSettings();
if (selectVideoPlugin && videoPluginFilename != wxEmptyString)
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin =
@@ -345,10 +347,6 @@ bool DolphinApp::OnInit()
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin =
std::string(audioPluginFilename.mb_str());
if (selectWiimotePlugin && wiimotePluginFilename != wxEmptyString)
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin =
std::string(wiimotePluginFilename.mb_str());
// Enable the PNG image handler for screenshots
wxImage::AddHandler(new wxPNGHandler);
@@ -432,12 +430,10 @@ void DolphinApp::OnEndSession()
int DolphinApp::OnExit()
{
WiimoteReal::Shutdown();
#ifdef _WIN32
if (SConfig::GetInstance().m_WiiAutoUnpair)
{
if (CPluginManager::GetInstance().GetWiimote())
CPluginManager::GetInstance().GetWiimote()->Wiimote_UnPairWiimotes();
}
WiimoteReal::UnPair();
#endif
CPluginManager::Shutdown();
SConfig::Shutdown();
+1
View File
@@ -392,6 +392,7 @@ int main(int argc, char* argv[])
}
updateMainFrameEvent.Shutdown();
WiimoteReal::Shutdown();
CPluginManager::Shutdown();
SConfig::Shutdown();
LogManager::Shutdown();
+3 -2
View File
@@ -33,6 +33,8 @@ if env['HAVE_WX']:
'LogWindow.cpp',
'GameListCtrl.cpp',
'HotkeyDlg.cpp',
'InputConfigDiag.cpp',
'InputConfigDiagBitmaps.cpp',
'ISOFile.cpp',
'ISOProperties.cpp',
'PatchAddEdit.cpp',
@@ -43,6 +45,7 @@ if env['HAVE_WX']:
'NetPlayClient.cpp',
'NetPlayServer.cpp',
'NetWindow.cpp',
'WiimoteConfigDiag.cpp',
]
wxlibs = [ 'debwx', 'debugger_ui_util', 'inputuicommon', 'memcard' ]
@@ -96,8 +99,6 @@ elif sys.platform == 'darwin' and env['HAVE_WX']:
env.Depends(exeGUIdist, env['plugin_dir'])
env.Fixup(exeGUIdist, exeGUI)
else:
files += [ 'X11Utils.cpp' ]
libs += [ 'SDL' ]
exeGUI = env['binary_dir'] + '/dolphin-emu'
exeNoGUI = env['binary_dir'] + '/dolphin-emu-nogui'
env.InstallAs(env['data_dir'] + '/sys', '#Data/Sys')
@@ -0,0 +1,153 @@
#include "WiimoteConfigDiag.h"
#include "HW/Wiimote.h"
#define _connect_macro_(b, f, c, s) (b)->Connect(wxID_ANY, (c), wxCommandEventHandler( f ), (wxObject*)0, (wxEvtHandler*)s)
const wxString& ConnectedWiimotesString()
{
static wxString str = wxT("Connected to . Wiimotes");
str[13] = wxChar(wxT('0') + WiimoteReal::Initialize());
return str;
}
WiimoteConfigPage::WiimoteConfigPage(wxWindow* const parent, const int index)
: wxNotebookPage(parent, -1, wxDefaultPosition, wxDefaultSize)
, m_index(index)
{
// input source
const wxString src_choices[] = { wxT("None"),
wxT("Emulated Wiimote"), wxT("Real Wiimote"), wxT("Hybrid Wiimote") };
wxChoice* const input_src_choice = new wxChoice(this, -1, wxDefaultPosition, wxDefaultSize,
sizeof(src_choices)/sizeof(*src_choices), src_choices);
input_src_choice->Select(g_wiimote_sources[m_index]);
_connect_macro_(input_src_choice, WiimoteConfigPage::SelectSource, wxEVT_COMMAND_CHOICE_SELECTED, this);
wxStaticBoxSizer* const input_src_sizer = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("Input Source"));
input_src_sizer->Add(input_src_choice, 1, wxEXPAND | wxALL, 5);
// emulated wiimote
wxButton* const configure_wiimote_emu_btn = new wxButton(this, -1, wxT("Configure"));
wxStaticBoxSizer* const wiimote_emu_sizer = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("Emulated Wiimote"));
wiimote_emu_sizer->Add(configure_wiimote_emu_btn, 1, wxEXPAND | wxALL, 5);
_connect_macro_(configure_wiimote_emu_btn, WiimoteConfigDiag::ConfigEmulatedWiimote, wxEVT_COMMAND_BUTTON_CLICKED, parent->GetParent());
// real wiimote
connected_wiimotes_txt = new wxStaticText(this, -1, ConnectedWiimotesString());
wxButton* const refresh_btn = new wxButton(this, -1, wxT("Refresh"), wxDefaultPosition);
_connect_macro_(refresh_btn, WiimoteConfigDiag::RefreshRealWiimotes, wxEVT_COMMAND_BUTTON_CLICKED, parent->GetParent());
wxStaticBoxSizer* const wiimote_real_sizer = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Real Wiimote"));
wiimote_real_sizer->AddStretchSpacer(1);
wiimote_real_sizer->Add(connected_wiimotes_txt, 0, wxALIGN_CENTER | wxBOTTOM | wxLEFT | wxRIGHT, 5);
#ifdef _WIN32
wxButton* const pairup_btn = new wxButton(this, -1, wxT("Pair Up"), wxDefaultPosition);
_connect_macro_(pairup_btn, WiimoteConfigDiag::PairUpRealWiimotes, wxEVT_COMMAND_BUTTON_CLICKED, parent->GetParent());
wiimote_real_sizer->Add(pairup_btn, 0, wxALIGN_CENTER | wxBOTTOM, 5);
#endif
wiimote_real_sizer->Add(refresh_btn, 0, wxALIGN_CENTER, 5);
wiimote_real_sizer->AddStretchSpacer(1);
// sizers
wxBoxSizer* const left_sizer = new wxBoxSizer(wxVERTICAL);
left_sizer->Add(input_src_sizer, 0, wxEXPAND | wxBOTTOM, 5);
left_sizer->Add(wiimote_emu_sizer, 0, wxEXPAND, 0);
wxBoxSizer* const main_sizer = new wxBoxSizer(wxHORIZONTAL);
main_sizer->Add(left_sizer, 1, wxLEFT | wxTOP | wxBOTTOM | wxEXPAND, 5);
main_sizer->Add(wiimote_real_sizer, 1, wxALL | wxEXPAND, 5);
SetSizerAndFit(main_sizer);
Layout();
}
WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin)
: wxDialog(parent, -1, wxT("Dolphin Wiimote Configuration"), wxDefaultPosition, wxDefaultSize)
, m_plugin(plugin)
{
m_pad_notebook = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT);
for (unsigned int i = 0; i < 4; ++i)
{
WiimoteConfigPage* const wpage = new WiimoteConfigPage(m_pad_notebook, i);
//m_padpages.push_back(wpage);
m_pad_notebook->AddPage(wpage, wxString(wxT("Wiimote ")) + wxChar('1'+i));
}
wxButton* const ok_button = new wxButton(this, -1, wxT("OK"), wxDefaultPosition);
_connect_macro_(ok_button, WiimoteConfigDiag::Save, wxEVT_COMMAND_BUTTON_CLICKED, this);
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(m_pad_notebook, 1, wxEXPAND | wxALL, 5);
main_sizer->Add(ok_button, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 5);
SetSizerAndFit(main_sizer);
Center();
}
void WiimoteConfigDiag::ConfigEmulatedWiimote(wxCommandEvent&)
{
InputConfigDialog* const m_emu_config_diag = new InputConfigDialog(this, m_plugin, "Dolphin Emulated Wiimote Configuration", m_pad_notebook->GetSelection());
m_emu_config_diag->ShowModal();
m_emu_config_diag->Destroy();
}
void WiimoteConfigDiag::UpdateGUI()
{
for (size_t p = 0; p < m_pad_notebook->GetPageCount(); ++p)
((WiimoteConfigPage*)m_pad_notebook->GetPage(p))->
connected_wiimotes_txt->SetLabel(ConnectedWiimotesString());
}
#ifdef _WIN32
void WiimoteConfigDiag::PairUpRealWiimotes(wxCommandEvent&)
{
const int paired = WiimoteReal::PairUp();
if (paired > 0)
{
// Will this message be anoying?
//PanicAlert("Paired %d wiimotes.", paired);
WiimoteReal::Refresh();
UpdateGUI();
}
else if (paired < 0)
PanicAlert("A supported bluetooth device was not found!\n"
"(Only the Microsoft bluetooth stack is supported.)");
}
#endif
void WiimoteConfigDiag::RefreshRealWiimotes(wxCommandEvent&)
{
WiimoteReal::Refresh();
UpdateGUI();
}
void WiimoteConfigPage::SelectSource(wxCommandEvent& event)
{
// should be kinda fine, maybe should just set when user clicks OK, w/e change it later
g_wiimote_sources[m_index] = event.GetInt();
}
void WiimoteConfigDiag::Save(wxCommandEvent&)
{
std::string ini_filename = (std::string(File::GetUserPath(D_CONFIG_IDX)) + WIIMOTE_INI_NAME ".ini" );
IniFile inifile;
inifile.Load(ini_filename);
for (unsigned int i=0; i<MAX_WIIMOTES; ++i)
{
std::string secname("Wiimote");
secname += (char)('1' + i);
IniFile::Section& sec = *inifile.GetOrCreateSection(secname.c_str());
sec.Set("Source", (int)g_wiimote_sources[i]);
}
inifile.Save(ini_filename);
Close();
}
@@ -0,0 +1,53 @@
#ifndef WIIMOTE_CONFIG_DIAG_H
#define WIIMOTE_CONFIG_DIAG_H
#include <wx/wx.h>
#include <wx/listbox.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/combobox.h>
#include <wx/checkbox.h>
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/spinctrl.h>
#include "InputConfigDiag.h"
class WiimoteConfigPage : public wxNotebookPage
{
public:
WiimoteConfigPage(wxWindow* const parent, const int index);
void SelectSource(wxCommandEvent& event);
wxStaticText* connected_wiimotes_txt;
private:
const int m_index;
};
class WiimoteConfigDiag : public wxDialog
{
public:
WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin);
#ifdef _WIN32
void PairUpRealWiimotes(wxCommandEvent& event);
#endif
void RefreshRealWiimotes(wxCommandEvent& event);
void ConfigEmulatedWiimote(wxCommandEvent& event);
void Save(wxCommandEvent& event);
void UpdateGUI();
private:
InputPlugin& m_plugin;
wxNotebook* m_pad_notebook;
};
#endif