Reorganized Wiimote Config Dialog a bit to make it more compact

Fixed many wrongly named variables
Deleted many unreferenced variables

wxWidgets cleanup

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4663 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx
2009-12-09 14:52:30 +00:00
parent 0bc7fa7bf5
commit c9f98d8f2b
11 changed files with 689 additions and 806 deletions

View File

@ -264,7 +264,8 @@ void Config::Load(bool ChangePad)
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini"); iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini");
// General // General
iniFile.Get("Settings", "SidewaysDPad", &bSidewaysDPad, false); iniFile.Get("Settings", "Sideways", &bSideways, false);
iniFile.Get("Settings", "Upright", &bUpright, false);
iniFile.Get("Settings", "ExtensionConnected", &iExtensionConnected, EXT_NONE); iniFile.Get("Settings", "ExtensionConnected", &iExtensionConnected, EXT_NONE);
iniFile.Get("Settings", "MotionPlusConnected", &bMotionPlusConnected, false); iniFile.Get("Settings", "MotionPlusConnected", &bMotionPlusConnected, false);
@ -285,10 +286,10 @@ void Config::Load(bool ChangePad)
char SectionName[32]; char SectionName[32];
sprintf(SectionName, "Wiimote%i", i + 1); sprintf(SectionName, "Wiimote%i", i + 1);
iniFile.Get(SectionName, "NoTriggerFilter", &bNoTriggerFilter, false); iniFile.Get(SectionName, "NoTriggerFilter", &bNoTriggerFilter, false);
iniFile.Get(SectionName, "TriggerType", &Trigger.Type, Trigger.TRIGGER_OFF);
iniFile.Get(SectionName, "TriggerUpright", &Trigger.Upright, false); iniFile.Get(SectionName, "TiltType", &Tilt.Type, Tilt.OFF);
iniFile.Get(SectionName, "TriggerRollRange", &Trigger.Range.Roll, 0); iniFile.Get(SectionName, "TiltRollRange", &Tilt.Range.Roll, 0);
iniFile.Get(SectionName, "TriggerPitchRange", &Trigger.Range.Pitch, 0); iniFile.Get(SectionName, "TiltPitchRange", &Tilt.Range.Pitch, 0);
// Wiimote // Wiimote
for (int x = 0; x < WM_CONTROLS; x++) for (int x = 0; x < WM_CONTROLS; x++)
@ -304,6 +305,7 @@ void Config::Load(bool ChangePad)
iniFile.Get(SectionName, "CcTriggers", &ClassicController.TType, ClassicController.KEYBOARD); iniFile.Get(SectionName, "CcTriggers", &ClassicController.TType, ClassicController.KEYBOARD);
for (int x = 0; x < CC_CONTROLS; x++) for (int x = 0; x < CC_CONTROLS; x++)
iniFile.Get(SectionName, ccControlNames[x], &WiiMoteEmu::PadMapping[i].Cc.keyForControls[x], ccDefaultControls[x]); iniFile.Get(SectionName, ccControlNames[x], &WiiMoteEmu::PadMapping[i].Cc.keyForControls[x], ccDefaultControls[x]);
iniFile.Get(SectionName, "GH3Analog", &GH3Controller.AType, GH3Controller.ANALOG1); iniFile.Get(SectionName, "GH3Analog", &GH3Controller.AType, GH3Controller.ANALOG1);
for (int x = 0; x < GH3_CONTROLS; x++) for (int x = 0; x < GH3_CONTROLS; x++)
iniFile.Get(SectionName, gh3ControlNames[x], &WiiMoteEmu::PadMapping[i].GH3c.keyForControls[x], GH3DefaultControls[x]); iniFile.Get(SectionName, gh3ControlNames[x], &WiiMoteEmu::PadMapping[i].GH3c.keyForControls[x], GH3DefaultControls[x]);
@ -328,8 +330,6 @@ void Config::Load(bool ChangePad)
// Create a section name // Create a section name
std::string joySectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name; std::string joySectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name;
iniFile.Get(joySectionName.c_str(), "Rumble", &WiiMoteEmu::PadMapping[i].Rumble, true);
iniFile.Get(joySectionName.c_str(), "RumbleStrength", &WiiMoteEmu::PadMapping[i].RumbleStrength, 10);
iniFile.Get(joySectionName.c_str(), "left_x", &WiiMoteEmu::PadMapping[i].Axis.Lx, 0); iniFile.Get(joySectionName.c_str(), "left_x", &WiiMoteEmu::PadMapping[i].Axis.Lx, 0);
iniFile.Get(joySectionName.c_str(), "left_y", &WiiMoteEmu::PadMapping[i].Axis.Ly, 1); iniFile.Get(joySectionName.c_str(), "left_y", &WiiMoteEmu::PadMapping[i].Axis.Ly, 1);
iniFile.Get(joySectionName.c_str(), "right_x", &WiiMoteEmu::PadMapping[i].Axis.Rx, 2); iniFile.Get(joySectionName.c_str(), "right_x", &WiiMoteEmu::PadMapping[i].Axis.Rx, 2);
@ -338,11 +338,13 @@ void Config::Load(bool ChangePad)
iniFile.Get(joySectionName.c_str(), "r_trigger", &WiiMoteEmu::PadMapping[i].Axis.Tr, 1005); iniFile.Get(joySectionName.c_str(), "r_trigger", &WiiMoteEmu::PadMapping[i].Axis.Tr, 1005);
iniFile.Get(joySectionName.c_str(), "DeadZoneL", &WiiMoteEmu::PadMapping[i].DeadZoneL, 0); iniFile.Get(joySectionName.c_str(), "DeadZoneL", &WiiMoteEmu::PadMapping[i].DeadZoneL, 0);
iniFile.Get(joySectionName.c_str(), "DeadZoneR", &WiiMoteEmu::PadMapping[i].DeadZoneR, 0); iniFile.Get(joySectionName.c_str(), "DeadZoneR", &WiiMoteEmu::PadMapping[i].DeadZoneR, 0);
iniFile.Get(joySectionName.c_str(), "TriggerType", &WiiMoteEmu::PadMapping[i].triggertype, 0);
iniFile.Get(joySectionName.c_str(), "Diagonal", &WiiMoteEmu::PadMapping[i].SDiagonal, "100%"); iniFile.Get(joySectionName.c_str(), "Diagonal", &WiiMoteEmu::PadMapping[i].SDiagonal, "100%");
iniFile.Get(joySectionName.c_str(), "Circle2Square", &WiiMoteEmu::PadMapping[i].bCircle2Square, false); iniFile.Get(joySectionName.c_str(), "Circle2Square", &WiiMoteEmu::PadMapping[i].bCircle2Square, false);
iniFile.Get(joySectionName.c_str(), "Rumble", &WiiMoteEmu::PadMapping[i].Rumble, true);
iniFile.Get(joySectionName.c_str(), "RumbleStrength", &WiiMoteEmu::PadMapping[i].RumbleStrength, 10);
iniFile.Get(joySectionName.c_str(), "RollInvert", &WiiMoteEmu::PadMapping[i].bRollInvert, false); iniFile.Get(joySectionName.c_str(), "RollInvert", &WiiMoteEmu::PadMapping[i].bRollInvert, false);
iniFile.Get(joySectionName.c_str(), "PitchInvert", &WiiMoteEmu::PadMapping[i].bPitchInvert, false); iniFile.Get(joySectionName.c_str(), "PitchInvert", &WiiMoteEmu::PadMapping[i].bPitchInvert, false);
iniFile.Get(joySectionName.c_str(), "TriggerType", &WiiMoteEmu::PadMapping[i].triggertype, 0);
} }
// Load the IR cursor settings if it's avaliable for the GameId, if not load the default settings // Load the IR cursor settings if it's avaliable for the GameId, if not load the default settings
iniFile.Load(FULL_CONFIG_DIR "IR Pointer.ini"); iniFile.Load(FULL_CONFIG_DIR "IR Pointer.ini");
@ -368,9 +370,10 @@ void Config::Save(int Slot)
{ {
IniFile iniFile; IniFile iniFile;
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini"); iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini");
iniFile.Set("Settings", "SidewaysDPad", bSidewaysDPad); iniFile.Set("Settings", "Sideways", bSideways);
iniFile.Set("Settings", "ExtensionConnected", iExtensionConnected); iniFile.Set("Settings", "Upright", bUpright);
iniFile.Set("Settings", "MotionPlusConnected", bMotionPlusConnected); iniFile.Set("Settings", "MotionPlusConnected", bMotionPlusConnected);
iniFile.Set("Settings", "ExtensionConnected", iExtensionConnected);
iniFile.Set("Real", "Connect", bConnectRealWiimote); iniFile.Set("Real", "Connect", bConnectRealWiimote);
iniFile.Set("Real", "Use", bUseRealWiimote); iniFile.Set("Real", "Use", bUseRealWiimote);
@ -390,10 +393,9 @@ void Config::Save(int Slot)
iniFile.Set(SectionName, "Enabled", WiiMoteEmu::PadMapping[i].enabled); iniFile.Set(SectionName, "Enabled", WiiMoteEmu::PadMapping[i].enabled);
iniFile.Set(SectionName, "NoTriggerFilter", bNoTriggerFilter); iniFile.Set(SectionName, "NoTriggerFilter", bNoTriggerFilter);
iniFile.Set(SectionName, "TriggerType", Trigger.Type); iniFile.Set(SectionName, "TiltType", Tilt.Type);;
iniFile.Set(SectionName, "TriggerUpright", Trigger.Upright); iniFile.Set(SectionName, "TiltRollRange", Tilt.Range.Roll);
iniFile.Set(SectionName, "TriggerRollRange", Trigger.Range.Roll); iniFile.Set(SectionName, "TiltPitchRange", Tilt.Range.Pitch);
iniFile.Set(SectionName, "TriggerPitchRange", Trigger.Range.Pitch);
// Wiimote // Wiimote
for (int x = 0; x < WM_CONTROLS; x++) for (int x = 0; x < WM_CONTROLS; x++)
@ -410,6 +412,7 @@ void Config::Save(int Slot)
iniFile.Set(SectionName, "CcTriggers", ClassicController.TType); iniFile.Set(SectionName, "CcTriggers", ClassicController.TType);
for (int x = 0; x < CC_CONTROLS; x++) for (int x = 0; x < CC_CONTROLS; x++)
iniFile.Set(SectionName, ccControlNames[x], WiiMoteEmu::PadMapping[i].Cc.keyForControls[x]); iniFile.Set(SectionName, ccControlNames[x], WiiMoteEmu::PadMapping[i].Cc.keyForControls[x]);
// GH3 // GH3
iniFile.Set(SectionName, "GH3Analog", GH3Controller.AType); iniFile.Set(SectionName, "GH3Analog", GH3Controller.AType);
for (int x = 0; x < GH3_CONTROLS; x++) for (int x = 0; x < GH3_CONTROLS; x++)
@ -429,23 +432,21 @@ void Config::Save(int Slot)
// Create a new section name after the joypad name // Create a new section name after the joypad name
std::string joySectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name; std::string joySectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name;
iniFile.Set(joySectionName.c_str(), "Rumble", WiiMoteEmu::PadMapping[i].Rumble);
iniFile.Set(joySectionName.c_str(), "RumbleStrength", WiiMoteEmu::PadMapping[i].RumbleStrength);
iniFile.Set(joySectionName.c_str(), "left_x", WiiMoteEmu::PadMapping[i].Axis.Lx); iniFile.Set(joySectionName.c_str(), "left_x", WiiMoteEmu::PadMapping[i].Axis.Lx);
iniFile.Set(joySectionName.c_str(), "left_y", WiiMoteEmu::PadMapping[i].Axis.Ly); iniFile.Set(joySectionName.c_str(), "left_y", WiiMoteEmu::PadMapping[i].Axis.Ly);
iniFile.Set(joySectionName.c_str(), "right_x", WiiMoteEmu::PadMapping[i].Axis.Rx); iniFile.Set(joySectionName.c_str(), "right_x", WiiMoteEmu::PadMapping[i].Axis.Rx);
iniFile.Set(joySectionName.c_str(), "right_y", WiiMoteEmu::PadMapping[i].Axis.Ry); iniFile.Set(joySectionName.c_str(), "right_y", WiiMoteEmu::PadMapping[i].Axis.Ry);
iniFile.Set(joySectionName.c_str(), "l_trigger", WiiMoteEmu::PadMapping[i].Axis.Tl); iniFile.Set(joySectionName.c_str(), "l_trigger", WiiMoteEmu::PadMapping[i].Axis.Tl);
iniFile.Set(joySectionName.c_str(), "r_trigger", WiiMoteEmu::PadMapping[i].Axis.Tr); iniFile.Set(joySectionName.c_str(), "r_trigger", WiiMoteEmu::PadMapping[i].Axis.Tr);
iniFile.Set(joySectionName.c_str(), "DeadZoneL", WiiMoteEmu::PadMapping[i].DeadZoneL); iniFile.Set(joySectionName.c_str(), "DeadZoneL", WiiMoteEmu::PadMapping[i].DeadZoneL);
iniFile.Set(joySectionName.c_str(), "DeadZoneR", WiiMoteEmu::PadMapping[i].DeadZoneR); iniFile.Set(joySectionName.c_str(), "DeadZoneR", WiiMoteEmu::PadMapping[i].DeadZoneR);
//iniFile.Set(joySectionName.c_str(), "controllertype", WiiMoteEmu::PadMapping[i].controllertype);
iniFile.Set(joySectionName.c_str(), "TriggerType", WiiMoteEmu::PadMapping[i].triggertype);
iniFile.Set(joySectionName.c_str(), "Diagonal", WiiMoteEmu::PadMapping[i].SDiagonal); iniFile.Set(joySectionName.c_str(), "Diagonal", WiiMoteEmu::PadMapping[i].SDiagonal);
iniFile.Set(joySectionName.c_str(), "Circle2Square", WiiMoteEmu::PadMapping[i].bCircle2Square); iniFile.Set(joySectionName.c_str(), "Circle2Square", WiiMoteEmu::PadMapping[i].bCircle2Square);
iniFile.Set(joySectionName.c_str(), "Rumble", WiiMoteEmu::PadMapping[i].Rumble);
iniFile.Set(joySectionName.c_str(), "RumbleStrength", WiiMoteEmu::PadMapping[i].RumbleStrength);
iniFile.Set(joySectionName.c_str(), "RollInvert", WiiMoteEmu::PadMapping[i].bRollInvert); iniFile.Set(joySectionName.c_str(), "RollInvert", WiiMoteEmu::PadMapping[i].bRollInvert);
iniFile.Set(joySectionName.c_str(), "PitchInvert", WiiMoteEmu::PadMapping[i].bPitchInvert); iniFile.Set(joySectionName.c_str(), "PitchInvert", WiiMoteEmu::PadMapping[i].bPitchInvert);
iniFile.Set(joySectionName.c_str(), "TriggerType", WiiMoteEmu::PadMapping[i].triggertype);
} }
iniFile.Save(FULL_CONFIG_DIR "Wiimote.ini"); iniFile.Save(FULL_CONFIG_DIR "Wiimote.ini");

View File

@ -22,6 +22,7 @@
#include <X11/keysym.h> #include <X11/keysym.h>
#endif #endif
#define AN_CONTROLS 6
#define WM_CONTROLS 16 #define WM_CONTROLS 16
#define NC_CONTROLS 7 #define NC_CONTROLS 7
#define CC_CONTROLS 23 #define CC_CONTROLS 23
@ -33,7 +34,6 @@ enum
EXT_NUNCHUCK, EXT_NUNCHUCK,
EXT_CLASSIC_CONTROLLER, EXT_CLASSIC_CONTROLLER,
EXT_GUITARHERO3_CONTROLLER, EXT_GUITARHERO3_CONTROLLER,
EXT_GUITARHEROWT_DRUMS,
}; };
struct Config struct Config
@ -42,25 +42,24 @@ struct Config
void Load(bool ChangePad = false); void Load(bool ChangePad = false);
void Save(int Slot = -1); void Save(int Slot = -1);
struct PadRange struct TiltRange
{ {
int Roll; int Roll;
int Pitch; int Pitch;
}; };
struct PadTrigger struct PadTilt
{ {
enum ETriggerType enum ETiltType
{ {
TRIGGER_OFF = 0, OFF = 0,
KEYBOARD, KEYBOARD,
ANALOG1, ANALOG1,
ANALOG2, ANALOG2,
TRIGGER TRIGGER
}; };
int Type; int Type;
bool Upright; TiltRange Range;
PadRange Range;
}; };
struct PadNunchuck struct PadNunchuck
{ {
@ -90,7 +89,7 @@ struct Config
{ {
enum EGH3Stick enum EGH3Stick
{ {
// KEYBOARD, // KEYBOARD,
ANALOG1, ANALOG1,
ANALOG2 ANALOG2
}; };
@ -99,10 +98,11 @@ struct Config
}; };
// Emulated Wiimote // Emulated Wiimote
bool bSidewaysDPad; bool bSideways;
bool bUpright;
bool bWideScreen; bool bWideScreen;
int iExtensionConnected;
bool bMotionPlusConnected; bool bMotionPlusConnected;
int iExtensionConnected;
// Real Wiimote // Real Wiimote
bool bConnectRealWiimote, bUseRealWiimote, bUpdateRealWiimote; bool bConnectRealWiimote, bUseRealWiimote, bUpdateRealWiimote;
@ -112,7 +112,7 @@ struct Config
// Gamepad // Gamepad
bool bNoTriggerFilter; bool bNoTriggerFilter;
PadTrigger Trigger; PadTilt Tilt;
PadNunchuck Nunchuck; PadNunchuck Nunchuck;
PadClassicController ClassicController; PadClassicController ClassicController;
PadGH3 GH3Controller; PadGH3 GH3Controller;

View File

@ -33,7 +33,7 @@ BEGIN_EVENT_TABLE(WiimoteBasicConfigDialog,wxDialog)
EVT_BUTTON(ID_BUTTONRECORDING, WiimoteBasicConfigDialog::ButtonClick) EVT_BUTTON(ID_BUTTONRECORDING, WiimoteBasicConfigDialog::ButtonClick)
EVT_CHECKBOX(ID_CONNECT_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_CONNECT_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_USE_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_USE_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_SIDEWAYSDPAD, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_SIDEWAYSWIIMOTE, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_UPRIGHTWIIMOTE, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_UPRIGHTWIIMOTE, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_MOTIONPLUSCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_MOTIONPLUSCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(ID_EXTCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHOICE(ID_EXTCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged)
@ -176,11 +176,11 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
m_WiimoteOnline[i]->SetToolTip(wxString::Format(wxT("Decide if Wiimote %i shall be detected by the game"), i)); m_WiimoteOnline[i]->SetToolTip(wxString::Format(wxT("Decide if Wiimote %i shall be detected by the game"), i));
// Emulated Wiimote // Emulated Wiimote
m_SidewaysDPad[i] = new wxCheckBox(m_Controller[i], ID_SIDEWAYSDPAD, wxT("Sideways Wiimote")); m_SidewaysWiimote[i] = new wxCheckBox(m_Controller[i], ID_SIDEWAYSWIIMOTE, wxT("Sideways Wiimote"));
m_SidewaysDPad[i]->SetValue(g_Config.bSidewaysDPad); m_SidewaysWiimote[i]->SetValue(g_Config.bSideways);
m_SidewaysDPad[i]->SetToolTip(wxT("Treat the sideways position as neutral")); m_SidewaysWiimote[i]->SetToolTip(wxT("Treat the sideways position as neutral"));
m_UprightWiimote[i] = new wxCheckBox(m_Controller[i], ID_UPRIGHTWIIMOTE, wxT("Upright Wiimote")); m_UprightWiimote[i] = new wxCheckBox(m_Controller[i], ID_UPRIGHTWIIMOTE, wxT("Upright Wiimote"));
m_UprightWiimote[i]->SetValue(g_Config.Trigger.Upright); m_UprightWiimote[i]->SetValue(g_Config.bUpright);
m_UprightWiimote[i]->SetToolTip(wxT("Treat the upright position as neutral")); m_UprightWiimote[i]->SetToolTip(wxT("Treat the upright position as neutral"));
//IR Pointer //IR Pointer
@ -216,7 +216,7 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
m_SizeBasic[i]->Add(m_WiimoteOnline[i], 0, wxEXPAND | wxALL, 5); m_SizeBasic[i]->Add(m_WiimoteOnline[i], 0, wxEXPAND | wxALL, 5);
m_SizeEmu[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Position")); m_SizeEmu[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Position"));
m_SizeEmu[i]->Add(m_SidewaysDPad[i], 0, wxEXPAND | wxALL, 5); m_SizeEmu[i]->Add(m_SidewaysWiimote[i], 0, wxEXPAND | wxALL, 5);
m_SizeEmu[i]->Add(m_UprightWiimote[i], 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5); m_SizeEmu[i]->Add(m_UprightWiimote[i], 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5);
m_SizeExtensions[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Extension")); m_SizeExtensions[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Extension"));
@ -379,11 +379,11 @@ void WiimoteBasicConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
if (g_Config.bUseRealWiimote) DoUseReal(); if (g_Config.bUseRealWiimote) DoUseReal();
break; break;
case ID_SIDEWAYSDPAD: case ID_SIDEWAYSWIIMOTE:
g_Config.bSidewaysDPad = m_SidewaysDPad[Page]->IsChecked(); g_Config.bSideways = m_SidewaysWiimote[Page]->IsChecked();
break; break;
case ID_UPRIGHTWIIMOTE: case ID_UPRIGHTWIIMOTE:
g_Config.Trigger.Upright = m_UprightWiimote[Page]->IsChecked(); g_Config.bUpright = m_UprightWiimote[Page]->IsChecked();
break; break;
case ID_MOTIONPLUSCONNECTED: case ID_MOTIONPLUSCONNECTED:

View File

@ -78,7 +78,7 @@ class WiimoteBasicConfigDialog : public wxDialog
*m_SliderTop[4]; *m_SliderTop[4];
// Emulated Wiimote settings // Emulated Wiimote settings
wxCheckBox *m_SidewaysDPad[4], wxCheckBox *m_SidewaysWiimote[4],
*m_UprightWiimote[4], *m_UprightWiimote[4],
*m_WiimoteOnline[4], *m_WiimoteOnline[4],
*m_WiiMotionPlusConnected[4], *m_WiiMotionPlusConnected[4],
@ -126,7 +126,7 @@ class WiimoteBasicConfigDialog : public wxDialog
ID_CONTROLLERPAGE4, ID_CONTROLLERPAGE4,
// Emulated Wiimote // Emulated Wiimote
ID_SIDEWAYSDPAD, ID_SIDEWAYSWIIMOTE,
ID_UPRIGHTWIIMOTE, ID_UPRIGHTWIIMOTE,
ID_MOTIONPLUSCONNECTED, ID_MOTIONPLUSCONNECTED,
ID_EXTCONNECTED, ID_EXTCONNECTED,

View File

@ -38,6 +38,7 @@ void WiimotePadConfigDialog::DoChangeJoystick()
// Load the settings for the new Id // Load the settings for the new Id
g_Config.Load(true); g_Config.Load(true);
UpdateGUI(Page); // Update the GUI UpdateGUI(Page); // Update the GUI
// Open the new pad // Open the new pad
@ -99,7 +100,6 @@ void WiimotePadConfigDialog::SetButtonTextAll(int id, char text[128])
}; };
} }
void WiimotePadConfigDialog::SaveButtonMappingAll(int Slot) void WiimotePadConfigDialog::SaveButtonMappingAll(int Slot)
{ {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
@ -123,16 +123,7 @@ void WiimotePadConfigDialog::UpdateGUIButtonMapping(int controller)
// Update the enabled checkbox // Update the enabled checkbox
//m_Joyattach[controller]->SetValue(PadMapping[controller].enabled == 1 ? true : false); //m_Joyattach[controller]->SetValue(PadMapping[controller].enabled == 1 ? true : false);
tmp << WiiMoteEmu::PadMapping[controller].Axis.Lx; m_AnalogLeftX[controller]->SetValue(tmp); tmp.clear();
tmp << WiiMoteEmu::PadMapping[controller].Axis.Ly; m_AnalogLeftY[controller]->SetValue(tmp); tmp.clear();
tmp << WiiMoteEmu::PadMapping[controller].Axis.Rx; m_AnalogRightX[controller]->SetValue(tmp); tmp.clear();
tmp << WiiMoteEmu::PadMapping[controller].Axis.Ry; m_AnalogRightY[controller]->SetValue(tmp); tmp.clear();
tmp << WiiMoteEmu::PadMapping[controller].Axis.Tl; m_AnalogTriggerL[controller]->SetValue(tmp); tmp.clear();
tmp << WiiMoteEmu::PadMapping[controller].Axis.Tr; m_AnalogTriggerR[controller]->SetValue(tmp); tmp.clear();
// Update the deadzone and controller type controls // Update the deadzone and controller type controls
m_TriggerType[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].triggertype);
m_ComboDeadZoneLeft[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].DeadZoneL); m_ComboDeadZoneLeft[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].DeadZoneL);
m_ComboDeadZoneRight[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].DeadZoneR); m_ComboDeadZoneRight[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].DeadZoneR);
m_ComboDiagonal[controller]->SetValue(wxString::FromAscii(WiiMoteEmu::PadMapping[controller].SDiagonal.c_str())); m_ComboDiagonal[controller]->SetValue(wxString::FromAscii(WiiMoteEmu::PadMapping[controller].SDiagonal.c_str()));
@ -141,12 +132,22 @@ void WiimotePadConfigDialog::UpdateGUIButtonMapping(int controller)
m_RumbleStrength[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].RumbleStrength); m_RumbleStrength[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].RumbleStrength);
m_TiltInvertRoll[controller]->SetValue(WiiMoteEmu::PadMapping[controller].bRollInvert); m_TiltInvertRoll[controller]->SetValue(WiiMoteEmu::PadMapping[controller].bRollInvert);
m_TiltInvertPitch[controller]->SetValue(WiiMoteEmu::PadMapping[controller].bPitchInvert); m_TiltInvertPitch[controller]->SetValue(WiiMoteEmu::PadMapping[controller].bPitchInvert);
m_TriggerType[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].triggertype);
for (int i = 0; i < AN_CONTROLS; i++)
{
tmp << WiiMoteEmu::PadMapping[controller].Axis.keyForControls[i];
m_Button_Analog[i][controller]->SetLabel(tmp);
tmp.clear();
}
// Wiimote // Wiimote
#ifdef _WIN32 #ifdef _WIN32
for (int x = 0; x < WM_CONTROLS; x++) for (int x = 0; x < WM_CONTROLS; x++)
{
m_Button_Wiimote[x][controller]->SetLabel(wxString::FromAscii( m_Button_Wiimote[x][controller]->SetLabel(wxString::FromAscii(
InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[x]).c_str())); InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[x]).c_str()));
}
if(g_Config.iExtensionConnected == EXT_NUNCHUCK) if(g_Config.iExtensionConnected == EXT_NUNCHUCK)
{ {
for (int x = 0; x < NC_CONTROLS; x++) for (int x = 0; x < NC_CONTROLS; x++)
@ -203,11 +204,9 @@ void WiimotePadConfigDialog::UpdateGUIButtonMapping(int controller)
/* Populate the PadMapping array with the dialog items settings (for example /* Populate the PadMapping array with the dialog items settings (for example
selected joystick, enabled or disabled status and so on) */ selected joystick, enabled or disabled status and so on) */
void WiimotePadConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot) void WiimotePadConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot)
{ {
// Temporary storage // Temporary storage
wxString tmp;
long value; long value;
// Save from or to the same or different slots // Save from or to the same or different slots
@ -223,28 +222,24 @@ void WiimotePadConfigDialog::SaveButtonMapping(int controller, bool DontChangeId
WiiMoteEmu::PadMapping[controller].ID = m_Joyname[FromSlot]->GetSelection(); WiiMoteEmu::PadMapping[controller].ID = m_Joyname[FromSlot]->GetSelection();
// Set enabled or disable status // Set enabled or disable status
if (FromSlot == controller) if (FromSlot == controller)
WiiMoteEmu::PadMapping[controller].enabled = true; //m_Joyattach[FromSlot]->GetValue(); // Only enable one WiiMoteEmu::PadMapping[controller].enabled = true; // Only enable one
// Set other settings // Set other settings
//WiiMoteEmu::PadMapping[controller].controllertype = m_ControlType[FromSlot]->GetSelection();
WiiMoteEmu::PadMapping[controller].Rumble = m_CheckRumble[FromSlot]->IsChecked();
WiiMoteEmu::PadMapping[controller].RumbleStrength = m_RumbleStrength[FromSlot]->GetSelection();
WiiMoteEmu::PadMapping[controller].triggertype = m_TriggerType[FromSlot]->GetSelection();
WiiMoteEmu::PadMapping[controller].DeadZoneL = m_ComboDeadZoneLeft[FromSlot]->GetSelection(); WiiMoteEmu::PadMapping[controller].DeadZoneL = m_ComboDeadZoneLeft[FromSlot]->GetSelection();
WiiMoteEmu::PadMapping[controller].DeadZoneR = m_ComboDeadZoneRight[FromSlot]->GetSelection(); WiiMoteEmu::PadMapping[controller].DeadZoneR = m_ComboDeadZoneRight[FromSlot]->GetSelection();
WiiMoteEmu::PadMapping[controller].SDiagonal = m_ComboDiagonal[FromSlot]->GetLabel().mb_str(); WiiMoteEmu::PadMapping[controller].SDiagonal = m_ComboDiagonal[FromSlot]->GetLabel().mb_str();
WiiMoteEmu::PadMapping[controller].bCircle2Square = m_CheckC2S[FromSlot]->IsChecked(); WiiMoteEmu::PadMapping[controller].bCircle2Square = m_CheckC2S[FromSlot]->IsChecked();
WiiMoteEmu::PadMapping[controller].Rumble = m_CheckRumble[FromSlot]->IsChecked();
WiiMoteEmu::PadMapping[controller].RumbleStrength = m_RumbleStrength[FromSlot]->GetSelection();
WiiMoteEmu::PadMapping[controller].bRollInvert = m_TiltInvertRoll[FromSlot]->IsChecked(); WiiMoteEmu::PadMapping[controller].bRollInvert = m_TiltInvertRoll[FromSlot]->IsChecked();
WiiMoteEmu::PadMapping[controller].bPitchInvert = m_TiltInvertPitch[FromSlot]->IsChecked(); WiiMoteEmu::PadMapping[controller].bPitchInvert = m_TiltInvertPitch[FromSlot]->IsChecked();
WiiMoteEmu::PadMapping[controller].triggertype = m_TriggerType[FromSlot]->GetSelection();
// The analog buttons for (int i = 0; i < AN_CONTROLS; i++)
m_AnalogLeftX[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Lx = value; tmp.clear(); {
m_AnalogLeftY[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Ly = value; tmp.clear(); m_Button_Analog[i][FromSlot]->GetLabel().ToLong(&value);
m_AnalogRightX[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Rx = value; tmp.clear(); WiiMoteEmu::PadMapping[controller].Axis.keyForControls[i] = value;
m_AnalogRightY[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Ry = value; tmp.clear(); }
// The shoulder buttons
m_AnalogTriggerL[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Tl = value;
m_AnalogTriggerR[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Tr = value;
//DEBUG_LOG(WIIMOTE, "WiiMoteEmu::PadMapping[%i].ID = %i, m_Joyname[%i]->GetSelection() = %i", //DEBUG_LOG(WIIMOTE, "WiiMoteEmu::PadMapping[%i].ID = %i, m_Joyname[%i]->GetSelection() = %i",
// controller, WiiMoteEmu::PadMapping[controller].ID, FromSlot, m_Joyname[FromSlot]->GetSelection()); // controller, WiiMoteEmu::PadMapping[controller].ID, FromSlot, m_Joyname[FromSlot]->GetSelection());
@ -285,7 +280,7 @@ void WiimotePadConfigDialog::ToBlank(bool _ToBlank)
if(_ToBlank) if(_ToBlank)
{ {
for(int i = IDB_ANALOG_LEFT_X; i <= IDB_TRIGGER_R; i++) for(int i = IDB_ANALOG_LEFT_X; i <= IDB_TRIGGER_R; i++)
#if ! defined _WIN32 && ! wxCHECK_VERSION(2, 9, 0) #if !defined _WIN32 && !wxCHECK_VERSION(2, 9, 0)
if(GetButtonText(i, j).ToAscii() == "-1") if(GetButtonText(i, j).ToAscii() == "-1")
SetButtonText(i, (char *)"", j); SetButtonText(i, (char *)"", j);
#else #else
@ -307,9 +302,12 @@ void WiimotePadConfigDialog::SetButtonText(int id, const char text[128], int _Pa
{ {
// Set controller value // Set controller value
int controller; int controller;
if (_Page == -1) controller = Page; else controller = _Page; if (_Page == -1) controller = Page;
else controller = _Page;
if (IDB_WM_A <= id && id <= IDB_WM_SHAKE) if (IDB_ANALOG_LEFT_X <= id && id <= IDB_TRIGGER_R)
m_Button_Analog[id - IDB_ANALOG_LEFT_X][controller]->SetLabel(wxString::FromAscii(text));
else if (IDB_WM_A <= id && id <= IDB_WM_SHAKE)
m_Button_Wiimote[id - IDB_WM_A][controller]->SetLabel(wxString::FromAscii(text)); m_Button_Wiimote[id - IDB_WM_A][controller]->SetLabel(wxString::FromAscii(text));
else if (IDB_NC_Z <= id && id <= IDB_NC_SHAKE) else if (IDB_NC_Z <= id && id <= IDB_NC_SHAKE)
m_Button_NunChuck[id - IDB_NC_Z][controller]->SetLabel(wxString::FromAscii(text)); m_Button_NunChuck[id - IDB_NC_Z][controller]->SetLabel(wxString::FromAscii(text));
@ -317,17 +315,7 @@ void WiimotePadConfigDialog::SetButtonText(int id, const char text[128], int _Pa
m_Button_Classic[id - IDB_CC_A][controller]->SetLabel(wxString::FromAscii(text)); m_Button_Classic[id - IDB_CC_A][controller]->SetLabel(wxString::FromAscii(text));
else if (IDB_GH3_GREEN <= id && id <= IDB_GH3_STRUM_DOWN) else if (IDB_GH3_GREEN <= id && id <= IDB_GH3_STRUM_DOWN)
m_Button_GH3[id - IDB_GH3_GREEN][controller]->SetLabel(wxString::FromAscii(text)); m_Button_GH3[id - IDB_GH3_GREEN][controller]->SetLabel(wxString::FromAscii(text));
else switch(id)
{
case IDB_ANALOG_LEFT_X: m_AnalogLeftX[controller]->SetValue(wxString::FromAscii(text)); break;
case IDB_ANALOG_LEFT_Y: m_AnalogLeftY[controller]->SetValue(wxString::FromAscii(text)); break;
case IDB_ANALOG_RIGHT_X: m_AnalogRightX[controller]->SetValue(wxString::FromAscii(text)); break;
case IDB_ANALOG_RIGHT_Y: m_AnalogRightY[controller]->SetValue(wxString::FromAscii(text)); break;
case IDB_TRIGGER_L: m_AnalogTriggerL[controller]->SetValue(wxString::FromAscii(text)); break;
case IDB_TRIGGER_R: m_AnalogTriggerR[controller]->SetValue(wxString::FromAscii(text)); break;
default: break;
}
//DEBUG_LOG(WIIMOTE, "SetButtonText: %s", text); //DEBUG_LOG(WIIMOTE, "SetButtonText: %s", text);
} }
@ -338,22 +326,21 @@ wxString WiimotePadConfigDialog::GetButtonText(int id, int _Page)
// Set controller value // Set controller value
int controller; int controller;
if (_Page == -1) controller = Page; else controller = _Page; if (_Page == -1) controller = Page;
else controller = _Page;
switch(id) if (IDB_ANALOG_LEFT_X <= id && id <= IDB_TRIGGER_R)
{ return m_Button_Analog[id - IDB_ANALOG_LEFT_X][controller]->GetLabel();
// Analog Stick else if (IDB_WM_A <= id && id <= IDB_WM_SHAKE)
case IDB_ANALOG_LEFT_X: return m_AnalogLeftX[controller]->GetValue(); return m_Button_Wiimote[id - IDB_WM_A][controller]->GetLabel();
case IDB_ANALOG_LEFT_Y: return m_AnalogLeftY[controller]->GetValue(); else if (IDB_NC_Z <= id && id <= IDB_NC_SHAKE)
case IDB_ANALOG_RIGHT_X: return m_AnalogRightX[controller]->GetValue(); return m_Button_NunChuck[id - IDB_NC_Z][controller]->GetLabel();
case IDB_ANALOG_RIGHT_Y: return m_AnalogRightY[controller]->GetValue(); else if (IDB_CC_A <= id && id <= IDB_CC_RD)
return m_Button_Classic[id - IDB_CC_A][controller]->GetLabel();
else if (IDB_GH3_GREEN <= id && id <= IDB_GH3_STRUM_DOWN)
return m_Button_GH3[id - IDB_GH3_GREEN][controller]->GetLabel();
// Shoulder Buttons return wxString();
case IDB_TRIGGER_L: return m_AnalogTriggerL[controller]->GetValue();
case IDB_TRIGGER_R: return m_AnalogTriggerR[controller]->GetValue();
default: return wxString();
}
} }
@ -377,8 +364,8 @@ void WiimotePadConfigDialog::GetButtons(wxCommandEvent& event)
if (m_ButtonMappingTimer->IsRunning()) if (m_ButtonMappingTimer->IsRunning())
return; return;
OldLabel.clear(); OldLabel = ((wxButton *)event.GetEventObject())->GetLabel();
SetButtonText(event.GetId(), "<Axis>"); SetButtonText(event.GetId(), "<Move Axis>");
DoGetButtons(event.GetId()); DoGetButtons(event.GetId());
} }
@ -553,7 +540,6 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId)
} }
// Show current input status // Show current input status
// Convert the 0x8000 range values to BoxW and BoxH for the plot // Convert the 0x8000 range values to BoxW and BoxH for the plot
void WiimotePadConfigDialog::Convert2Box(int &x) void WiimotePadConfigDialog::Convert2Box(int &x)
@ -570,29 +556,19 @@ void WiimotePadConfigDialog::PadGetStatus()
{ {
//DEBUG_LOG(WIIMOTE, "SDL_WasInit: %i", SDL_WasInit(0)); //DEBUG_LOG(WIIMOTE, "SDL_WasInit: %i", SDL_WasInit(0));
/* Return if it's not detected. The ID should never be less than zero here, /* Return if it's not enabled or not detected. The ID should never be less than zero here,
it can only be that because of a manual ini file change, but we make it can only be that because of a manual ini file change, but we make that check anway. */
that check anway. */ if(!WiiMoteEmu::PadMapping[Page].enabled
if(WiiMoteEmu::PadMapping[Page].ID < 0 || WiiMoteEmu::PadMapping[Page].ID >= SDL_NumJoysticks()) || WiiMoteEmu::PadMapping[Page].ID < 0
|| WiiMoteEmu::PadMapping[Page].ID >= SDL_NumJoysticks()
)
{ {
m_TStatusLeftIn[Page]->SetLabel(wxT("Not connected")); m_tStatusLeftIn[Page]->SetLabel(wxT("Not connected"));
m_TStatusLeftOut[Page]->SetLabel(wxT("Not connected")); m_tStatusLeftOut[Page]->SetLabel(wxT("Not connected"));
m_TStatusRightIn[Page]->SetLabel(wxT("Not connected")); m_tStatusRightIn[Page]->SetLabel(wxT("Not connected"));
m_TStatusRightOut[Page]->SetLabel(wxT("Not connected")); m_tStatusRightOut[Page]->SetLabel(wxT("Not connected"));
m_TriggerStatusLx[Page]->SetLabel(wxT("0")); m_TriggerStatusL[Page]->SetLabel(wxT("000"));
m_TriggerStatusRx[Page]->SetLabel(wxT("0")); m_TriggerStatusR[Page]->SetLabel(wxT("000"));
return;
}
// Return if it's not enabled
if (!WiiMoteEmu::PadMapping[Page].enabled)
{
m_TStatusLeftIn[Page]->SetLabel(wxT("Not enabled"));
m_TStatusLeftOut[Page]->SetLabel(wxT("Not enabled"));
m_TStatusRightIn[Page]->SetLabel(wxT("Not enabled"));
m_TStatusRightOut[Page]->SetLabel(wxT("Not enabled"));
m_TriggerStatusLx[Page]->SetLabel(wxT("0"));
m_TriggerStatusRx[Page]->SetLabel(wxT("0"));
return; return;
} }
@ -604,12 +580,7 @@ void WiimotePadConfigDialog::PadGetStatus()
//if (IsFocus()) //if (IsFocus())
WiiMoteEmu::GetJoyState(WiiMoteEmu::PadState[Page], WiiMoteEmu::PadMapping[Page], Page, WiiMoteEmu::joyinfo.at(WiiMoteEmu::PadMapping[Page].ID).NumButtons); WiiMoteEmu::GetJoyState(WiiMoteEmu::PadState[Page], WiiMoteEmu::PadMapping[Page], Page, WiiMoteEmu::joyinfo.at(WiiMoteEmu::PadMapping[Page].ID).NumButtons);
// Analog stick // Analog stick
// Set Deadzones perhaps out of function
//int deadzone = (int)(((float)(128.00/100.00)) * (float)(PadMapping[_numPAD].deadzone+1));
//int deadzone2 = (int)(((float)(-128.00/100.00)) * (float)(PadMapping[_numPAD].deadzone+1));
// Get original values // Get original values
int main_x = WiiMoteEmu::PadState[Page].Axis.Lx; int main_x = WiiMoteEmu::PadState[Page].Axis.Lx;
@ -620,11 +591,13 @@ void WiimotePadConfigDialog::PadGetStatus()
// Get adjusted values // Get adjusted values
int main_x_after = main_x, main_y_after = main_y; int main_x_after = main_x, main_y_after = main_y;
int right_x_after = right_x, right_y_after = right_y; int right_x_after = right_x, right_y_after = right_y;
// Produce square // Produce square
if(WiiMoteEmu::PadMapping[Page].bCircle2Square) if(WiiMoteEmu::PadMapping[Page].bCircle2Square)
{ {
InputCommon::Square2Circle(main_x_after, main_y_after, Page, WiiMoteEmu::PadMapping[Page].SDiagonal, true); InputCommon::Square2Circle(main_x_after, main_y_after, Page, WiiMoteEmu::PadMapping[Page].SDiagonal, true);
} }
// Check dead zone // Check dead zone
float DeadZoneLeft = (float)WiiMoteEmu::PadMapping[Page].DeadZoneL / 100.0; float DeadZoneLeft = (float)WiiMoteEmu::PadMapping[Page].DeadZoneL / 100.0;
float DeadZoneRight = (float)WiiMoteEmu::PadMapping[Page].DeadZoneR / 100.0; float DeadZoneRight = (float)WiiMoteEmu::PadMapping[Page].DeadZoneR / 100.0;
@ -667,16 +640,16 @@ void WiimotePadConfigDialog::PadGetStatus()
float f_Rx_aft = right_x_after / 32767.0; float f_Rx_aft = right_x_after / 32767.0;
float f_Ry_aft = right_y_after / 32767.0; float f_Ry_aft = right_y_after / 32767.0;
m_TStatusLeftIn[Page]->SetLabel(wxString::Format( m_tStatusLeftIn[Page]->SetLabel(wxString::Format(
wxT("x:%1.2f y:%1.2f"), f_x, f_y wxT("x:%1.2f y:%1.2f"), f_x, f_y
)); ));
m_TStatusLeftOut[Page]->SetLabel(wxString::Format( m_tStatusLeftOut[Page]->SetLabel(wxString::Format(
wxT("x:%1.2f y:%1.2f"), f_x_aft, f_y_aft wxT("x:%1.2f y:%1.2f"), f_x_aft, f_y_aft
)); ));
m_TStatusRightIn[Page]->SetLabel(wxString::Format( m_tStatusRightIn[Page]->SetLabel(wxString::Format(
wxT("x:%1.2f y:%1.2f"), f_Rx, f_Ry wxT("x:%1.2f y:%1.2f"), f_Rx, f_Ry
)); ));
m_TStatusRightOut[Page]->SetLabel(wxString::Format( m_tStatusRightOut[Page]->SetLabel(wxString::Format(
wxT("x:%1.2f y:%1.2f"), f_Rx_aft, f_Ry_aft wxT("x:%1.2f y:%1.2f"), f_Rx_aft, f_Ry_aft
)); ));
@ -694,13 +667,6 @@ void WiimotePadConfigDialog::PadGetStatus()
m_bmpDotRightOut[Page]->SetPosition(wxPoint(right_x_after, right_y_after)); m_bmpDotRightOut[Page]->SetPosition(wxPoint(right_x_after, right_y_after));
// Triggers
// Get the selected keys
long Left, Right;
m_AnalogTriggerL[Page]->GetValue().ToLong(&Left);
m_AnalogTriggerR[Page]->GetValue().ToLong(&Right);
// Get the trigger values // Get the trigger values
int TriggerLeft = WiiMoteEmu::PadState[Page].Axis.Tl; int TriggerLeft = WiiMoteEmu::PadState[Page].Axis.Tl;
int TriggerRight = WiiMoteEmu::PadState[Page].Axis.Tr; int TriggerRight = WiiMoteEmu::PadState[Page].Axis.Tr;
@ -712,9 +678,9 @@ void WiimotePadConfigDialog::PadGetStatus()
TriggerRight = InputCommon::Pad_Convert(TriggerRight); TriggerRight = InputCommon::Pad_Convert(TriggerRight);
} }
m_TriggerStatusLx[Page]->SetLabel(wxString::Format( m_TriggerStatusL[Page]->SetLabel(wxString::Format(
wxT("%03i"), TriggerLeft)); wxT("%03i"), TriggerLeft));
m_TriggerStatusRx[Page]->SetLabel(wxString::Format( m_TriggerStatusR[Page]->SetLabel(wxString::Format(
wxT("%03i"), TriggerRight)); wxT("%03i"), TriggerRight));
} }

File diff suppressed because it is too large Load Diff

View File

@ -61,7 +61,7 @@ class WiimotePadConfigDialog : public wxDialog
void OnButtonTimer(wxTimerEvent& WXUNUSED(event)) { DoGetButtons(GetButtonWaitingID); } void OnButtonTimer(wxTimerEvent& WXUNUSED(event)) { DoGetButtons(GetButtonWaitingID); }
void UpdatePad(wxTimerEvent& WXUNUSED(event)); void UpdatePad(wxTimerEvent& WXUNUSED(event));
wxTimer *m_UpdatePad, wxTimer *m_UpdatePadTimer,
*m_ButtonMappingTimer; *m_ButtonMappingTimer;
wxStaticBitmap *m_bmpDotLeftIn[4], wxStaticBitmap *m_bmpDotLeftIn[4],
@ -75,83 +75,110 @@ class WiimotePadConfigDialog : public wxDialog
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
bool ControlsCreated; bool ControlsCreated;
int Page, BoxW, BoxH, g_Pressed; int Page, g_Pressed, BoxW, BoxH;
wxString OldLabel;
wxNotebook *m_Notebook; wxNotebook *m_Notebook;
wxPanel *m_Controller[4];
wxButton *m_Close, wxPanel *m_Controller[4],
*m_Apply; *m_pLeftInStatus[4],
wxBoxSizer *m_MainSizer, *m_pLeftOutStatus[4],
*m_sMain[4], *m_pRightInStatus[4],
*m_SizeParent[4]; *m_pRightOutStatus[4];
wxStaticBitmap *m_bmpSquareLeftIn[4],
*m_bmpSquareLeftOut[4],
*m_bmpSquareRightIn[4],
*m_bmpSquareRightOut[4];
wxCheckBox *m_CheckC2S[4], wxCheckBox *m_CheckC2S[4],
*m_CheckRumble[4], *m_CheckRumble[4],
*m_TiltInvertRoll[4], *m_TiltInvertRoll[4],
*m_TiltInvertPitch[4]; *m_TiltInvertPitch[4];
// Emulated Wiimote key settings wxButton *m_Close, *m_Apply, *ClickedButton,
wxBoxSizer *m_HorizControllers[4], *m_Button_Analog[AN_CONTROLS][4],
*m_gC2SDeadZone[4],
*m_gCircle2Square[4],
*m_gCircle2SquareVert[4],
*m_gRumble[4],
*m_gDeadZone[4],
*m_gDeadZoneHoriz[4],
*m_gJoyname[4],
*m_HorizControllerTiltParent[4],
*m_HorizControllerTilt[4],
*m_TiltHoriz[4],
*m_SizeAnalogLeft[4],
*m_SizeAnalogLeftHorizX[4],
*m_SizeAnalogLeftHorizY[4],
*m_SizeAnalogRight[4],
*m_SizeAnalogRightHorizX[4],
*m_SizeAnalogRightHorizY[4],
*m_SizeAnalogTriggerVertLeft[4],
*m_SizeAnalogTriggerVertRight[4],
*m_SizeAnalogTriggerHorizInput[4],
*m_HorizControllerMapping[4],
*m_Sizer_Wiimote[WM_CONTROLS][4],
*m_SWmVertLeft[4],
*m_SWmVertRight[4],
*m_Sizer_NunChuck[NC_CONTROLS][4],
*m_NunchuckStick[4],
*m_Sizer_Classic[CC_CONTROLS][4],
*m_SCcVertLeft[4],
*m_SCcVertMiddle[4],
*m_SCcVertRight[4],
*m_SCcLeftStick[4],
*m_SCcRightStick[4],
*m_SCcTriggers[4],
*m_sizer_GH3[GH3_CONTROLS][4],
*m_sGH3_Analog[4],
*m_SGH3VertLeft[4],
*m_SGH3VertMiddle[4],
*m_SGH3VertRight[4];
wxGridBagSizer *m_SizeAnalogTriggerHorizConfig[4], *m_SizeAnalogTriggerStatusBox[4], *m_TiltGrid[4],
*m_GridLeftStick[4], *m_GridRightStick[4];
wxStaticBoxSizer *m_SizeBasic[4], *m_SizeEmu[4], *m_SizeReal[4], *m_SizeExtensions[4], *m_SizerIRPointer[4], *m_gTilt[4], *m_gJoyPad[4];
wxTextCtrl *m_AnalogLeftX[4], *m_AnalogLeftY[4], *m_AnalogRightX[4], *m_AnalogRightY[4],
*m_AnalogTriggerL[4], *m_AnalogTriggerR[4];
wxButton *m_bAnalogLeftX[4], *m_bAnalogLeftY[4], *m_bAnalogRightX[4], *m_bAnalogRightY[4],
*m_bAnalogTriggerL[4], *m_bAnalogTriggerR[4],
// Nunchuck
*m_Button_Wiimote[WM_CONTROLS][4], *m_Button_Wiimote[WM_CONTROLS][4],
*m_Button_NunChuck[NC_CONTROLS][4], *m_Button_NunChuck[NC_CONTROLS][4],
*m_Button_Classic[CC_CONTROLS][4], *m_Button_Classic[CC_CONTROLS][4],
*m_Button_GH3[GH3_CONTROLS][4], *m_Button_GH3[GH3_CONTROLS][4];
*m_bGH3_Analog[4];
wxStaticText *m_TextScreenWidth[4], *m_TextScreenHeight[4], *m_TextScreenLeft[4], *m_TextScreenTop[4], *m_TextAR[4], wxComboBox *m_Joyname[4],
*m_tAnalogX[8], *m_tAnalogY[8], *m_TiltTextRoll[4], *m_TiltTextPitch[4], *m_RumbleStrengthLabel[4], *m_ComboDeadZoneLeft[4],
*m_CheckC2SLabel[4], *m_ComboDeadZoneLabel[4], *m_TStatusLeftIn[4], *m_TStatusLeftOut[4], *m_TStatusRightIn[4], *m_TStatusRightOut[4], *m_ComboDeadZoneRight[4],
*m_TriggerStatusL[4], *m_TriggerStatusR[4], *m_TriggerStatusLx[4], *m_TriggerStatusRx[4], *m_ComboDiagonal[4],
*m_tAnalogTriggerInput[4], *m_tAnalogTriggerL[4], *m_tAnalogTriggerR[4], *m_RumbleStrength[4],
*m_TiltComboInput[4],
*m_TiltComboRangeRoll[4],
*m_TiltComboRangePitch[4],
*m_TriggerType[4],
*m_NunchuckComboStick[4],
*m_CcComboLeftStick[4],
*m_CcComboRightStick[4],
*m_CcComboTriggers[4],
*m_GH3ComboAnalog[4];
wxGridBagSizer *m_sGridTilt[4],
*m_sGridStickLeft[4],
*m_sGridStickRight[4],
*m_sGridTrigger[4];
wxBoxSizer *m_MainSizer,
*m_sMain[4],
*m_sDeadZoneHoriz[4],
*m_sDeadZone[4],
*m_sDiagonal[4],
*m_sCircle2Square[4],
*m_sC2SDeadZone[4],
*m_sJoyname[4],
*m_sRumble[4],
*m_sHorizController[4],
*m_sHorizStatus[4],
*m_Sizer_Analog[AN_CONTROLS][4],
*m_sAnalogLeft[4],
*m_sAnalogMiddle[4],
*m_sAnalogRight[4],
*m_sHorizAnalogMapping[4],
*m_Sizer_Wiimote[WM_CONTROLS][4],
*m_sWmVertLeft[4],
*m_sWmVertRight[4],
*m_Sizer_NunChuck[NC_CONTROLS][4],
*m_sNunchuckStick[4],
*m_Sizer_Classic[CC_CONTROLS][4],
*m_sCcLeftStick[4],
*m_sCcRightStick[4],
*m_sCcTriggers[4],
*m_sCcVertLeft[4],
*m_sCcVertMiddle[4],
*m_sCcVertRight[4],
*m_Sizer_GH3[GH3_CONTROLS][4],
*m_sGH3Analog[4],
*m_sGH3VertLeft[4],
*m_sGH3VertRight[4],
*m_sHorizControllerMapping[4];
wxStaticBoxSizer *m_gJoyPad[4],
*m_gTilt[4],
*m_gStickLeft[4],
*m_gStickRight[4],
*m_gTriggers[4],
*m_gAnalog[4],
*m_gWiimote[4],
*m_gNunchuck[4],
*m_gClassicController[4],
*m_gGuitarHero3Controller[4];
wxStaticText *m_ComboDeadZoneLabel[4],
*m_DiagonalLabel[4],
*m_RumbleStrengthLabel[4],
*m_TiltTextRoll[4], *m_TiltTextPitch[4],
*m_tStatusLeftIn[4], *m_tStatusLeftOut[4], *m_tStatusRightIn[4], *m_tStatusRightOut[4],
*m_TriggerL[4], *m_TriggerR[4],
*m_TriggerStatusL[4], *m_TriggerStatusR[4],
*m_tTriggerSource[4],
*m_statictext_Analog[AN_CONTROLS][4],
*m_statictext_Wiimote[WM_CONTROLS][4], *m_statictext_Wiimote[WM_CONTROLS][4],
*m_statictext_NunChuck[NC_CONTROLS][4], *m_statictext_NunChuck[NC_CONTROLS][4],
*m_statictext_Classic[CC_CONTROLS][4], *m_statictext_Classic[CC_CONTROLS][4],
@ -160,30 +187,13 @@ class WiimotePadConfigDialog : public wxDialog
*m_CcTextLeftStick[4], *m_CcTextLeftStick[4],
*m_CcTextRightStick[4], *m_CcTextRightStick[4],
*m_CcTextTriggers[4], *m_CcTextTriggers[4],
*m_tGH3_Analog[4]; *m_tGH3Analog[4];
wxButton *ClickedButton;
wxString OldLabel;
wxComboBox *m_TiltComboInput[4], *m_TiltComboRangeRoll[4], *m_TiltComboRangePitch[4], *m_Joyname[4], *m_ComboDiagonal[4], *m_ComboDeadZoneLeft[4], *m_ComboDeadZoneRight[4], *m_TriggerType[4],
*m_RumbleStrength[4], *m_NunchuckComboStick[4], *m_CcComboLeftStick[4], *m_CcComboRightStick[4], *m_CcComboTriggers[4], *m_GH3ComboAnalog[4];
wxPanel *m_pLeftInStatus[4], *m_pLeftOutStatus[4], *m_pRightInStatus[4], *m_pRightOutStatus[4];
wxStaticBitmap *m_bmpSquareLeftIn[4], *m_bmpSquareLeftOut[4], *m_bmpSquareRightIn[4], *m_bmpSquareRightOut[4];
wxStaticBoxSizer *m_gAnalogLeft[4], *m_gAnalogRight[4], *m_gTrigger[4],
*m_gWiimote[4], *m_gNunchuck[4], *m_gClassicController[4], *m_gGuitarHero3Controller[4];
wxBitmap CreateBitmapDot();
wxBitmap CreateBitmap();
wxBitmap CreateBitmapDeadZone(int Radius);
wxBitmap CreateBitmapClear();
enum enum
{ {
ID_CLOSE = 1000, ID_CLOSE = 1000,
ID_APPLY, ID_APPLY,
IDTM_EXIT, IDTM_BUTTON, // Timer
IDTM_BUTTON,
IDTM_UPDATE_PAD, // Timer IDTM_UPDATE_PAD, // Timer
ID_NOTEBOOK, ID_NOTEBOOK,
@ -192,17 +202,16 @@ class WiimotePadConfigDialog : public wxDialog
ID_CONTROLLERPAGE3, ID_CONTROLLERPAGE3,
ID_CONTROLLERPAGE4, ID_CONTROLLERPAGE4,
ID_ANALOG_LEFT_X, ID_ANALOG_LEFT_Y,
ID_ANALOG_RIGHT_X, ID_ANALOG_RIGHT_Y,
ID_TRIGGER_L, ID_TRIGGER_R,
// Gamepad <It's important that the internal ordering of these are unchanged> // Gamepad <It's important that the internal ordering of these are unchanged>
IDB_ANALOG_LEFT_X, IDB_ANALOG_LEFT_Y, IDB_ANALOG_LEFT_X, IDB_ANALOG_LEFT_Y,
IDB_ANALOG_RIGHT_X, IDB_ANALOG_RIGHT_Y, IDB_ANALOG_RIGHT_X, IDB_ANALOG_RIGHT_Y,
IDB_TRIGGER_L, IDB_TRIGGER_R, IDB_TRIGGER_L, IDB_TRIGGER_R,
ID_ANALOG_LEFT_X, ID_ANALOG_LEFT_Y,
ID_ANALOG_RIGHT_X, ID_ANALOG_RIGHT_Y,
ID_TRIGGER_L, ID_TRIGGER_R,
// Wiimote // Wiimote
IDS_WIDTH, IDS_HEIGHT, IDS_LEFT, IDS_TOP,
IDB_WM_A, IDB_WM_B, IDB_WM_A, IDB_WM_B,
IDB_WM_1, IDB_WM_2, IDB_WM_1, IDB_WM_2,
IDB_WM_P, IDB_WM_M, IDB_WM_H, IDB_WM_P, IDB_WM_M, IDB_WM_H,
@ -246,11 +255,24 @@ class WiimotePadConfigDialog : public wxDialog
IDB_GH3_STRUM_DOWN, IDB_GH3_STRUM_DOWN,
// Gamepad settings // Gamepad settings
IDC_JOYNAME, IDC_RUMBLE, IDC_RUMBLE_STRENGTH, IDC_LEFT_C2S, IDCB_LEFT_DIAGONAL, IDCB_DEAD_ZONE_LEFT, IDCB_DEAD_ZONE_RIGHT, IDC_JOYNAME,
ID_TRIGGER_TYPE, ID_TILT_INPUT, ID_TILT_RANGE_ROLL, ID_TILT_RANGE_PITCH, ID_TILT_INVERT_ROLL, ID_TILT_INVERT_PITCH, IDC_RUMBLE, IDC_RUMBLE_STRENGTH,
IDCB_NUNCHUCK_STICK, IDCB_CC_LEFT_STICK, IDCB_CC_RIGHT_STICK, IDCB_CC_TRIGGERS, IDCB_GH3_ANALOG, IDC_DEAD_ZONE_LEFT, IDC_DEAD_ZONE_RIGHT,
IDC_STICK_DIAGONAL, IDC_STICK_C2S,
IDC_TILT_INPUT,
IDC_TILT_RANGE_ROLL, IDC_TILT_RANGE_PITCH,
IDC_TILT_INVERT_ROLL, IDC_TILT_INVERT_PITCH,
IDC_TRIGGER_TYPE,
IDC_NUNCHUCK_STICK,
IDC_CC_LEFT_STICK, IDC_CC_RIGHT_STICK, IDC_CC_TRIGGERS,
IDC_GH3_ANALOG,
}; };
wxBitmap CreateBitmap();
wxBitmap CreateBitmapDot();
wxBitmap CreateBitmapDeadZone(int Radius);
wxBitmap CreateBitmapClear();
void OnClose(wxCloseEvent& event); void OnClose(wxCloseEvent& event);
void CreatePadGUIControls(); void CreatePadGUIControls();
void GeneralSettingsChanged(wxCommandEvent& event); void GeneralSettingsChanged(wxCommandEvent& event);
@ -258,8 +280,8 @@ class WiimotePadConfigDialog : public wxDialog
// Gamepad configuration // Gamepad configuration
void SetButtonText(int id, const char text[128], int _Page = -1); void SetButtonText(int id, const char text[128], int _Page = -1);
void SetButtonTextAll(int id, char text[128]); void SetButtonTextAll(int id, char text[128]);
wxString GetButtonText(int id, int Page = -1); void GetButtons(wxCommandEvent& event);
void GetButtons(wxCommandEvent& event); void DoGetButtons(int); void DoGetButtons(int);
void SaveButtonMapping(int controller, bool DontChangeId = false, int FromSlot = -1); void SaveButtonMapping(int controller, bool DontChangeId = false, int FromSlot = -1);
void SaveButtonMappingAll(int Slot); void SaveButtonMappingAll(int Slot);
void SaveKeyboardMapping(int Controller, int Id, int Key); void SaveKeyboardMapping(int Controller, int Id, int Key);
@ -273,6 +295,7 @@ class WiimotePadConfigDialog : public wxDialog
// Configure buttons // Configure buttons
int GetButtonWaitingID, GetButtonWaitingTimer; int GetButtonWaitingID, GetButtonWaitingTimer;
wxString GetButtonText(int id, int Page = -1);
}; };
extern WiimotePadConfigDialog *m_PadConfigFrame; extern WiimotePadConfigDialog *m_PadConfigFrame;
#endif #endif

View File

@ -240,9 +240,8 @@ struct KeyboardGH3GLP
#else #else
Green = 48, Green = 48,
#endif #endif
Red, Yellow, Blue, Red, Yellow, Blue, Orange,
Orange,Plus, Minus, Plus, Minus, Whammy,
Whammy,
Al, Ar, Au, Ad, Al, Ar, Au, Ad,
StrumUp, StrumDown, StrumUp, StrumDown,
LAST_CONSTANT LAST_CONSTANT

View File

@ -92,9 +92,9 @@ void AdjustAngles(int &Roll, int &Pitch)
void PitchDegreeToAccelerometer(int Roll, int Pitch, int &_x, int &_y, int &_z) void PitchDegreeToAccelerometer(int Roll, int Pitch, int &_x, int &_y, int &_z)
{ {
// Direct mapping for swing, from analog stick to accelerometer // Direct mapping for swing, from analog stick to accelerometer
if (g_Config.Trigger.Range.Roll == 0 && g_Config.Trigger.Range.Pitch == 0) if (g_Config.Tilt.Range.Roll == 0 && g_Config.Tilt.Range.Pitch == 0)
{ {
if (!g_Config.Trigger.Upright) if (!g_Config.bUpright)
{ {
_x -= Roll; _x -= Roll;
_z -= Pitch; _z -= Pitch;
@ -114,13 +114,13 @@ void PitchDegreeToAccelerometer(int Roll, int Pitch, int &_x, int &_y, int &_z)
float x, y, z; float x, y, z;
// In these cases we can use the simple and accurate formula // In these cases we can use the simple and accurate formula
if(g_Config.Trigger.Range.Pitch == 0) if(g_Config.Tilt.Range.Pitch == 0)
{ {
x = sin(_Roll); x = sin(_Roll);
y = 0.0f; y = 0.0f;
z = cos(_Roll); z = cos(_Roll);
} }
else if (g_Config.Trigger.Range.Roll == 0) else if (g_Config.Tilt.Range.Roll == 0)
{ {
x = 0.0f; x = 0.0f;
y = sin(_Pitch); y = sin(_Pitch);
@ -157,16 +157,16 @@ void PitchDegreeToAccelerometer(int Roll, int Pitch, int &_x, int &_y, int &_z)
int iy = g_wm.cal_zero.y + (int)(yg * y); int iy = g_wm.cal_zero.y + (int)(yg * y);
int iz = g_wm.cal_zero.z + (int)(zg * z); int iz = g_wm.cal_zero.z + (int)(zg * z);
if (!g_Config.Trigger.Upright) if (!g_Config.bUpright)
{ {
if(g_Config.Trigger.Range.Roll != 0) _x = ix; if(g_Config.Tilt.Range.Roll != 0) _x = ix;
if(g_Config.Trigger.Range.Pitch != 0) _y = iy; if(g_Config.Tilt.Range.Pitch != 0) _y = iy;
_z = iz; _z = iz;
} }
else // Upright wiimote else // Upright wiimote
{ {
if(g_Config.Trigger.Range.Roll != 0) _x = ix; if(g_Config.Tilt.Range.Roll != 0) _x = ix;
if(g_Config.Trigger.Range.Pitch != 0) _z = iy; if(g_Config.Tilt.Range.Pitch != 0) _z = iy;
_y = 0xFF - iz; _y = 0xFF - iz;
} }
} }
@ -188,7 +188,7 @@ void PitchAccelerometerToDegree(u8 _x, u8 _y, u8 _z, int &_Roll, int &_Pitch, in
float y = AccelerometerToG((float)_y, (float)g_wm.cal_zero.y, (float)g_wm.cal_g.y); float y = AccelerometerToG((float)_y, (float)g_wm.cal_zero.y, (float)g_wm.cal_g.y);
float z = AccelerometerToG((float)_z, (float)g_wm.cal_zero.z, (float)g_wm.cal_g.z); float z = AccelerometerToG((float)_z, (float)g_wm.cal_zero.z, (float)g_wm.cal_g.z);
if (!g_Config.Trigger.Upright) if (!g_Config.bUpright)
{ {
// If it is over 1g then it is probably accelerating and may not reliable // If it is over 1g then it is probably accelerating and may not reliable
//if (abs(accel->x - ac->cal_zero.x) <= ac->cal_g.x) //if (abs(accel->x - ac->cal_zero.x) <= ac->cal_g.x)
@ -225,7 +225,7 @@ void PitchAccelerometerToDegree(u8 _x, u8 _y, u8 _z, int &_Roll, int &_Pitch, in
if (x < -1.0) x = -1.0; else if (x > 1.0) x = 1.0; if (x < -1.0) x = -1.0; else if (x > 1.0) x = 1.0;
if (y < -1.0) y = -1.0; else if (y > 1.0) y = 1.0; if (y < -1.0) y = -1.0; else if (y > 1.0) y = 1.0;
if (z < -1.0) z = -1.0; else if (z > 1.0) z = 1.0; if (z < -1.0) z = -1.0; else if (z > 1.0) z = 1.0;
if (!g_Config.Trigger.Upright) if (!g_Config.bUpright)
{ {
Roll = InputCommon::Rad2Deg(atan2(x, z)); Roll = InputCommon::Rad2Deg(atan2(x, z));
Pitch = InputCommon::Rad2Deg(atan2(y, z)); Pitch = InputCommon::Rad2Deg(atan2(y, z));

View File

@ -636,7 +636,7 @@ void Update()
readKeyboard(); readKeyboard();
// Check if the pad state should be updated // Check if the pad state should be updated
if ((g_Config.Trigger.Type == g_Config.Trigger.TRIGGER || g_Config.Trigger.Type == g_Config.Trigger.ANALOG1 || g_Config.Trigger.Type == g_Config.Trigger.ANALOG2 if ((g_Config.Tilt.Type == g_Config.Tilt.TRIGGER || g_Config.Tilt.Type == g_Config.Tilt.ANALOG1 || g_Config.Tilt.Type == g_Config.Tilt.ANALOG2
|| g_Config.Nunchuck.Type == g_Config.Nunchuck.ANALOG1 || g_Config.Nunchuck.Type == g_Config.Nunchuck.ANALOG2 || g_Config.Nunchuck.Type == g_Config.Nunchuck.ANALOG1 || g_Config.Nunchuck.Type == g_Config.Nunchuck.ANALOG2
|| g_Config.ClassicController.LType == g_Config.ClassicController.ANALOG1 || g_Config.ClassicController.LType == g_Config.ClassicController.ANALOG2 || g_Config.ClassicController.LType == g_Config.ClassicController.ANALOG1 || g_Config.ClassicController.LType == g_Config.ClassicController.ANALOG2
|| g_Config.ClassicController.RType == g_Config.ClassicController.ANALOG1 || g_Config.ClassicController.RType == g_Config.ClassicController.ANALOG2) || g_Config.ClassicController.RType == g_Config.ClassicController.ANALOG1 || g_Config.ClassicController.RType == g_Config.ClassicController.ANALOG2)

View File

@ -390,7 +390,7 @@ void FillReportInfo(wm_core& _core)
_core.home = IsKey(g_Wiimote_kbd.H) ? 1 : 0; _core.home = IsKey(g_Wiimote_kbd.H) ? 1 : 0;
/* Sideways controls (for example for Wario Land) if the Wiimote is intended to be held sideways */ /* Sideways controls (for example for Wario Land) if the Wiimote is intended to be held sideways */
if(g_Config.bSidewaysDPad) if(g_Config.bSideways)
{ {
_core.left = IsKey(g_Wiimote_kbd.D) ? 1 : 0; _core.left = IsKey(g_Wiimote_kbd.D) ? 1 : 0;
_core.up = IsKey(g_Wiimote_kbd.L) ? 1 : 0; _core.up = IsKey(g_Wiimote_kbd.L) ? 1 : 0;
@ -504,11 +504,11 @@ void TiltWiimoteGamepad(int &Roll, int &Pitch)
PadStateAdjustments(Lx, Ly, Rx, Ry, Tl, Tr); PadStateAdjustments(Lx, Ly, Rx, Ry, Tl, Tr);
// Save the Range in degrees, 45 and 90 are good values in some games // Save the Range in degrees, 45 and 90 are good values in some games
int &RollRange = g_Config.Trigger.Range.Roll; int &RollRange = g_Config.Tilt.Range.Roll;
int &PitchRange = g_Config.Trigger.Range.Pitch; int &PitchRange = g_Config.Tilt.Range.Pitch;
// The trigger currently only controls pitch // The trigger currently only controls pitch
if (g_Config.Trigger.Type == g_Config.Trigger.TRIGGER) if (g_Config.Tilt.Type == g_Config.Tilt.TRIGGER)
{ {
// Make the range the same dimension as the analog stick // Make the range the same dimension as the analog stick
Tl = Tl / 2; Tl = Tl / 2;
@ -522,7 +522,7 @@ void TiltWiimoteGamepad(int &Roll, int &Pitch)
/* For the analog stick roll is by default set to the X-axis, pitch is by /* For the analog stick roll is by default set to the X-axis, pitch is by
default set to the Y-axis. By changing the axis mapping and the invert default set to the Y-axis. By changing the axis mapping and the invert
options this can be altered in any way */ options this can be altered in any way */
else if (g_Config.Trigger.Type == g_Config.Trigger.ANALOG1) else if (g_Config.Tilt.Type == g_Config.Tilt.ANALOG1)
{ {
// Adjust the trigger to go between negative and positive values // Adjust the trigger to go between negative and positive values
Lx = Lx - 0x80; Lx = Lx - 0x80;
@ -554,7 +554,7 @@ void TiltWiimoteGamepad(int &Roll, int &Pitch)
void TiltWiimoteKeyboard(int &Roll, int &Pitch) void TiltWiimoteKeyboard(int &Roll, int &Pitch)
{ {
// Direct map roll/pitch to swing // Direct map roll/pitch to swing
if (g_Config.Trigger.Range.Roll == 0 && g_Config.Trigger.Range.Pitch == 0) if (g_Config.Tilt.Range.Roll == 0 && g_Config.Tilt.Range.Pitch == 0)
{ {
if (IsKey(g_Wiimote_kbd.ROLL_L)) if (IsKey(g_Wiimote_kbd.ROLL_L))
Roll = -0x80 / 2; Roll = -0x80 / 2;
@ -575,13 +575,13 @@ void TiltWiimoteKeyboard(int &Roll, int &Pitch)
if (IsKey(g_Wiimote_kbd.ROLL_L)) if (IsKey(g_Wiimote_kbd.ROLL_L))
{ {
// Stop at the upper end of the range // Stop at the upper end of the range
if (Roll < g_Config.Trigger.Range.Roll) if (Roll < g_Config.Tilt.Range.Roll)
Roll += 3; // aim left Roll += 3; // aim left
} }
else if (IsKey(g_Wiimote_kbd.ROLL_R)) else if (IsKey(g_Wiimote_kbd.ROLL_R))
{ {
// Stop at the lower end of the range // Stop at the lower end of the range
if (Roll > -g_Config.Trigger.Range.Roll) if (Roll > -g_Config.Tilt.Range.Roll)
Roll -= 3; // aim right Roll -= 3; // aim right
} }
else else
@ -591,13 +591,13 @@ void TiltWiimoteKeyboard(int &Roll, int &Pitch)
if (IsKey(g_Wiimote_kbd.PITCH_U)) if (IsKey(g_Wiimote_kbd.PITCH_U))
{ {
// Stop at the upper end of the range // Stop at the upper end of the range
if (Pitch < g_Config.Trigger.Range.Pitch) if (Pitch < g_Config.Tilt.Range.Pitch)
Pitch += 3; // aim up Pitch += 3; // aim up
} }
else if (IsKey(g_Wiimote_kbd.PITCH_D)) else if (IsKey(g_Wiimote_kbd.PITCH_D))
{ {
// Stop at the lower end of the range // Stop at the lower end of the range
if (Pitch > -g_Config.Trigger.Range.Pitch) if (Pitch > -g_Config.Tilt.Range.Pitch)
Pitch -= 3; // aim down Pitch -= 3; // aim down
} }
else else
@ -610,16 +610,16 @@ void TiltWiimoteKeyboard(int &Roll, int &Pitch)
void Tilt(int &_x, int &_y, int &_z) void Tilt(int &_x, int &_y, int &_z)
{ {
// Check if it's on // Check if it's on
if (g_Config.Trigger.Type == g_Config.Trigger.TRIGGER_OFF) return; if (g_Config.Tilt.Type == g_Config.Tilt.OFF) return;
// Select input method and return the x, y, x values // Select input method and return the x, y, x values
if (g_Config.Trigger.Type == g_Config.Trigger.KEYBOARD) if (g_Config.Tilt.Type == g_Config.Tilt.KEYBOARD)
TiltWiimoteKeyboard(Roll, Pitch); TiltWiimoteKeyboard(Roll, Pitch);
else if (g_Config.Trigger.Type == g_Config.Trigger.TRIGGER || g_Config.Trigger.Type == g_Config.Trigger.ANALOG1 || g_Config.Trigger.Type == g_Config.Trigger.ANALOG2) else if (g_Config.Tilt.Type == g_Config.Tilt.TRIGGER || g_Config.Tilt.Type == g_Config.Tilt.ANALOG1 || g_Config.Tilt.Type == g_Config.Tilt.ANALOG2)
TiltWiimoteGamepad(Roll, Pitch); TiltWiimoteGamepad(Roll, Pitch);
// Adjust angles, it's only needed if both roll and pitch is used together // Adjust angles, it's only needed if both roll and pitch is used together
if (g_Config.Trigger.Range.Roll != 0 && g_Config.Trigger.Range.Pitch != 0) if (g_Config.Tilt.Range.Roll != 0 && g_Config.Tilt.Range.Pitch != 0)
AdjustAngles(Roll, Pitch); AdjustAngles(Roll, Pitch);
// Calculate the accelerometer value from this tilt angle // Calculate the accelerometer value from this tilt angle
@ -649,7 +649,7 @@ void FillReportAcc(wm_accel& _acc)
int acc_y = g_wm.cal_zero.y; int acc_y = g_wm.cal_zero.y;
int acc_z = g_wm.cal_zero.z; int acc_z = g_wm.cal_zero.z;
if (!g_Config.Trigger.Upright) if (!g_Config.bUpright)
acc_z += g_wm.cal_g.z; acc_z += g_wm.cal_g.z;
else // Upright wiimote else // Upright wiimote
acc_y -= g_wm.cal_g.y; acc_y -= g_wm.cal_g.y;
@ -754,7 +754,7 @@ void FillReportAcc(wm_accel& _acc)
// Rotate IR dot when rolling Wiimote // Rotate IR dot when rolling Wiimote
void RotateIRDot(int _Roll, int& _x, int& _y) void RotateIRDot(int _Roll, int& _x, int& _y)
{ {
if (g_Config.Trigger.Range.Roll == 0 || _Roll == 0) if (g_Config.Tilt.Range.Roll == 0 || _Roll == 0)
return; return;
// The IR camera resolution is 1023x767 // The IR camera resolution is 1023x767