Rearranged EmuWiimote & nJoy. Wow they can share one pad at the same time, and they also can be enabled/disabled separately.
So as long as the game supports, you can toggle controller input between them on the fly. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4691 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
2d10a47c2b
commit
6f1efd4873
|
@ -100,6 +100,7 @@ struct CONTROLLER_MAPPING // GC PAD MAPPING
|
|||
std::string SRadius, SDiagonal, SRadiusC, SDiagonalC;
|
||||
bool bRadiusOnOff, bSquareToCircle, bRadiusOnOffC, bSquareToCircleC;
|
||||
bool rumble;
|
||||
bool enable;
|
||||
int eventnum; // Linux Event Number, Can't be found dynamically yet
|
||||
};
|
||||
|
||||
|
@ -231,8 +232,6 @@ struct CONTROLLER_MAPPING_NEW // GC PAD MAPPING
|
|||
std::string SDiagonal;
|
||||
bool bSquareToCircle;
|
||||
bool bCircle2Square;
|
||||
bool bRollInvert;
|
||||
bool bPitchInvert;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -288,9 +288,15 @@ void Config::Load(bool ChangePad)
|
|||
sprintf(SectionName, "Wiimote%i", i + 1);
|
||||
iniFile.Get(SectionName, "NoTriggerFilter", &bNoTriggerFilter, false);
|
||||
|
||||
iniFile.Get(SectionName, "TiltType", &Tilt.Type, Tilt.OFF);
|
||||
iniFile.Get(SectionName, "TiltRollRange", &Tilt.Range.Roll, 0);
|
||||
iniFile.Get(SectionName, "TiltPitchRange", &Tilt.Range.Pitch, 0);
|
||||
iniFile.Get(SectionName, "TiltType", &Tilt.Type, Tilt.KEYBOARD);
|
||||
iniFile.Get(SectionName, "TiltRollSwing", &Tilt.Range.RollSwing, false);
|
||||
iniFile.Get(SectionName, "TiltRollDegree", &Tilt.Range.RollDegree, 60);
|
||||
Tilt.Range.Roll = (Tilt.Range.RollSwing) ? 0 : Tilt.Range.RollDegree;
|
||||
iniFile.Get(SectionName, "TiltRollInvert", &Tilt.RollInvert, false);
|
||||
iniFile.Get(SectionName, "TiltPitchSwing", &Tilt.Range.PitchSwing, false);
|
||||
iniFile.Get(SectionName, "TiltPitchDegree", &Tilt.Range.PitchDegree, 60);
|
||||
Tilt.Range.Pitch = (Tilt.Range.PitchSwing) ? 0 : Tilt.Range.PitchDegree;
|
||||
iniFile.Get(SectionName, "TiltPitchInvert", &Tilt.PitchInvert, false);
|
||||
|
||||
// Wiimote
|
||||
for (int x = 0; x < WM_CONTROLS; x++)
|
||||
|
@ -342,9 +348,7 @@ void Config::Load(bool ChangePad)
|
|||
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(), "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(), "PitchInvert", &WiiMoteEmu::PadMapping[i].bPitchInvert, false);
|
||||
iniFile.Get(joySectionName.c_str(), "RumbleStrength", &WiiMoteEmu::PadMapping[i].RumbleStrength, 9);
|
||||
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
|
||||
|
@ -371,7 +375,7 @@ void Config::Save(int Slot)
|
|||
{
|
||||
IniFile iniFile;
|
||||
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini");
|
||||
iniFile.Set("Settings", "InputActive", bInputActive);
|
||||
// iniFile.Set("Settings", "InputActive", bInputActive);
|
||||
iniFile.Set("Settings", "Sideways", bSideways);
|
||||
iniFile.Set("Settings", "Upright", bUpright);
|
||||
iniFile.Set("Settings", "MotionPlusConnected", bMotionPlusConnected);
|
||||
|
@ -395,9 +399,12 @@ void Config::Save(int Slot)
|
|||
|
||||
iniFile.Set(SectionName, "NoTriggerFilter", bNoTriggerFilter);
|
||||
iniFile.Set(SectionName, "TiltType", Tilt.Type);;
|
||||
iniFile.Set(SectionName, "TiltRollRange", Tilt.Range.Roll);
|
||||
iniFile.Set(SectionName, "TiltPitchRange", Tilt.Range.Pitch);
|
||||
|
||||
iniFile.Set(SectionName, "TiltRollDegree", Tilt.Range.RollDegree);
|
||||
iniFile.Set(SectionName, "TiltRollSwing", Tilt.Range.RollSwing);
|
||||
iniFile.Set(SectionName, "TiltRollInvert", Tilt.RollInvert);
|
||||
iniFile.Set(SectionName, "TiltPitchDegree", Tilt.Range.PitchDegree);
|
||||
iniFile.Set(SectionName, "TiltPitchSwing", Tilt.Range.PitchSwing);
|
||||
iniFile.Set(SectionName, "TiltPitchInvert", Tilt.PitchInvert);
|
||||
// Wiimote
|
||||
for (int x = 0; x < WM_CONTROLS; x++)
|
||||
iniFile.Set(SectionName, wmControlNames[x], WiiMoteEmu::PadMapping[i].Wm.keyForControls[x]);
|
||||
|
@ -446,8 +453,6 @@ void Config::Save(int Slot)
|
|||
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(), "PitchInvert", WiiMoteEmu::PadMapping[i].bPitchInvert);
|
||||
iniFile.Set(joySectionName.c_str(), "TriggerType", WiiMoteEmu::PadMapping[i].triggertype);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,10 +44,13 @@ struct Config
|
|||
|
||||
struct TiltRange
|
||||
{
|
||||
int RollDegree;
|
||||
bool RollSwing;
|
||||
int Roll;
|
||||
int PitchDegree;
|
||||
bool PitchSwing;
|
||||
int Pitch;
|
||||
};
|
||||
|
||||
struct PadTilt
|
||||
{
|
||||
enum ETiltType
|
||||
|
@ -59,6 +62,8 @@ struct Config
|
|||
TRIGGER
|
||||
};
|
||||
int Type;
|
||||
bool RollInvert;
|
||||
bool PitchInvert;
|
||||
TiltRange Range;
|
||||
};
|
||||
struct PadNunchuck
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
|
||||
BEGIN_EVENT_TABLE(WiimoteBasicConfigDialog,wxDialog)
|
||||
EVT_CLOSE(WiimoteBasicConfigDialog::OnClose)
|
||||
EVT_BUTTON(ID_CLOSE, WiimoteBasicConfigDialog::ButtonClick)
|
||||
EVT_BUTTON(ID_APPLY, WiimoteBasicConfigDialog::ButtonClick)
|
||||
EVT_BUTTON(ID_OK, WiimoteBasicConfigDialog::ButtonClick)
|
||||
EVT_BUTTON(ID_CANCEL, WiimoteBasicConfigDialog::ButtonClick)
|
||||
EVT_BUTTON(ID_BUTTONMAPPING, WiimoteBasicConfigDialog::ButtonClick)
|
||||
EVT_BUTTON(ID_BUTTONRECORDING, WiimoteBasicConfigDialog::ButtonClick)
|
||||
EVT_CHECKBOX(IDC_INPUT_ACTIVE, WiimoteBasicConfigDialog::GeneralSettingsChanged)
|
||||
|
@ -61,7 +61,7 @@ WiimoteBasicConfigDialog::WiimoteBasicConfigDialog(wxWindow *parent, wxWindowID
|
|||
ControlsCreated = false;
|
||||
m_bEnableUseRealWiimote = true;
|
||||
Page = 0;
|
||||
g_Config.Load();
|
||||
//g_Config.Load();
|
||||
CreateGUIControls();
|
||||
UpdateGUI();
|
||||
}
|
||||
|
@ -69,7 +69,6 @@ WiimoteBasicConfigDialog::WiimoteBasicConfigDialog(wxWindow *parent, wxWindowID
|
|||
void WiimoteBasicConfigDialog::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
g_FrameOpen = false;
|
||||
g_Config.Save();
|
||||
EndModal(wxID_CLOSE);
|
||||
}
|
||||
|
||||
|
@ -89,7 +88,9 @@ void WiimoteBasicConfigDialog::ButtonClick(wxCommandEvent& event)
|
|||
{
|
||||
switch(event.GetId())
|
||||
{
|
||||
case ID_CLOSE:
|
||||
case ID_OK:
|
||||
g_Config.Save();
|
||||
/*
|
||||
// Wait for the Wiimote thread to stop, then close and shutdown
|
||||
if(!g_EmulatorRunning)
|
||||
{
|
||||
|
@ -101,9 +102,12 @@ void WiimoteBasicConfigDialog::ButtonClick(wxCommandEvent& event)
|
|||
{
|
||||
Close();
|
||||
}
|
||||
*/
|
||||
Close();
|
||||
break;
|
||||
case ID_APPLY:
|
||||
g_Config.Save();
|
||||
case ID_CANCEL:
|
||||
g_Config.Load();
|
||||
Close();
|
||||
break;
|
||||
case ID_BUTTONMAPPING:
|
||||
m_PadConfigFrame = new WiimotePadConfigDialog(this);
|
||||
|
@ -172,7 +176,7 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
|
|||
|
||||
// Basic Settings
|
||||
m_InputActive[i] = new wxCheckBox(m_Controller[i], IDC_INPUT_ACTIVE, wxT("Wiimote Input Active"));
|
||||
m_InputActive[i]->SetValue(true);
|
||||
m_InputActive[i]->SetValue(g_Config.bInputActive);
|
||||
m_InputActive[i]->SetToolTip(wxString::Format(wxT("Decide if Wiimote button events shall be sent to game"), i));
|
||||
|
||||
// Emulated Wiimote
|
||||
|
@ -274,52 +278,55 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
|
|||
|
||||
m_ButtonMapping = new wxButton(this, ID_BUTTONMAPPING, wxT("Button Mapping"));
|
||||
m_Recording = new wxButton(this, ID_BUTTONRECORDING, wxT("Recording"));
|
||||
m_Apply = new wxButton(this, ID_APPLY, wxT("Apply"));
|
||||
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"));
|
||||
m_OK = new wxButton(this, ID_OK, wxT("OK"));
|
||||
m_OK->SetToolTip(wxT("Save changes and close"));
|
||||
m_Cancel = new wxButton(this, ID_CANCEL, wxT("Cancel"));
|
||||
m_Cancel->SetToolTip(wxT("Discard changes and close"));
|
||||
|
||||
wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);
|
||||
sButtons->Add(m_ButtonMapping, 0, (wxALL), 0);
|
||||
sButtons->Add(m_Recording, 0, (wxALL), 0);
|
||||
sButtons->AddStretchSpacer();
|
||||
sButtons->Add(m_Apply, 0, (wxALL), 0);
|
||||
sButtons->Add(m_Close, 0, (wxLEFT), 5);
|
||||
sButtons->Add(m_OK, 0, (wxALL), 0);
|
||||
sButtons->Add(m_Cancel, 0, (wxLEFT), 5);
|
||||
|
||||
m_MainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
m_MainSizer->Add(m_Notebook, 1, wxEXPAND | wxALL, 5);
|
||||
m_MainSizer->Add(sButtons, 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5);
|
||||
|
||||
this->SetSizer(m_MainSizer);
|
||||
this->Layout();
|
||||
SetSizer(m_MainSizer);
|
||||
Layout();
|
||||
Fit();
|
||||
|
||||
// Center the window if there is room for it
|
||||
#ifdef _WIN32
|
||||
if (GetSystemMetrics(SM_CYFULLSCREEN) > 600)
|
||||
Center();
|
||||
#endif
|
||||
|
||||
ControlsCreated = true;
|
||||
}
|
||||
|
||||
void WiimoteBasicConfigDialog::DoConnectReal()
|
||||
{
|
||||
g_Config.bConnectRealWiimote = m_ConnectRealWiimote[Page]->IsChecked();
|
||||
|
||||
if(g_Config.bConnectRealWiimote)
|
||||
{
|
||||
if (!g_RealWiiMoteInitialized) WiiMoteReal::Initialize();
|
||||
if (!g_RealWiiMoteInitialized)
|
||||
WiiMoteReal::Initialize();
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(WIIMOTE, "Post Message: %i", g_RealWiiMoteInitialized);
|
||||
|
||||
if (g_RealWiiMoteInitialized)
|
||||
{
|
||||
WiiMoteReal::Shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WiimoteBasicConfigDialog::DoUseReal()
|
||||
{
|
||||
if (!g_Config.bUseRealWiimote)
|
||||
return;
|
||||
|
||||
// Clear any eventual events in the Wiimote queue
|
||||
WiiMoteReal::ClearEvents();
|
||||
|
||||
|
@ -370,14 +377,14 @@ void WiimoteBasicConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
|||
switch (event.GetId())
|
||||
{
|
||||
case IDC_CONNECT_REAL:
|
||||
g_Config.bConnectRealWiimote = m_ConnectRealWiimote[Page]->IsChecked();
|
||||
DoConnectReal();
|
||||
break;
|
||||
case IDC_USE_REAL:
|
||||
// Enable the Wiimote thread
|
||||
g_Config.bUseRealWiimote = m_UseRealWiimote[Page]->IsChecked();
|
||||
if (g_Config.bUseRealWiimote) DoUseReal();
|
||||
DoUseReal();
|
||||
break;
|
||||
|
||||
case IDC_INPUT_ACTIVE:
|
||||
g_Config.bInputActive = m_InputActive[Page]->IsChecked();
|
||||
break;
|
||||
|
@ -387,7 +394,6 @@ void WiimoteBasicConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
|||
case IDC_UPRIGHTWIIMOTE:
|
||||
g_Config.bUpright = m_UprightWiimote[Page]->IsChecked();
|
||||
break;
|
||||
|
||||
case IDC_MOTIONPLUSCONNECTED:
|
||||
g_Config.bMotionPlusConnected = m_WiiMotionPlusConnected[Page]->IsChecked();
|
||||
break;
|
||||
|
@ -409,7 +415,6 @@ void WiimoteBasicConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
|||
DoExtensionConnectedDisconnected();
|
||||
break;
|
||||
}
|
||||
g_Config.Save();
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
|
@ -430,7 +435,6 @@ void WiimoteBasicConfigDialog::IRCursorChanged(wxScrollEvent& event)
|
|||
g_Config.iIRTop = m_SliderTop[Page]->GetValue();
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
|
|
|
@ -63,8 +63,8 @@ class WiimoteBasicConfigDialog : public wxDialog
|
|||
|
||||
wxNotebook *m_Notebook;
|
||||
wxPanel *m_Controller[4];
|
||||
wxButton *m_Close,
|
||||
*m_Apply,
|
||||
wxButton *m_OK,
|
||||
*m_Cancel,
|
||||
*m_ButtonMapping,
|
||||
*m_Recording;
|
||||
|
||||
|
@ -108,8 +108,8 @@ class WiimoteBasicConfigDialog : public wxDialog
|
|||
|
||||
enum
|
||||
{
|
||||
ID_CLOSE = 1000,
|
||||
ID_APPLY,
|
||||
ID_OK = 1000,
|
||||
ID_CANCEL,
|
||||
ID_BUTTONMAPPING,
|
||||
ID_BUTTONRECORDING,
|
||||
IDTM_SHUTDOWN,
|
||||
|
|
|
@ -130,8 +130,6 @@ void WiimotePadConfigDialog::UpdateGUIButtonMapping(int controller)
|
|||
m_CheckC2S[controller]->SetValue(WiiMoteEmu::PadMapping[controller].bCircle2Square);
|
||||
m_CheckRumble[controller]->SetValue(WiiMoteEmu::PadMapping[controller].Rumble);
|
||||
m_RumbleStrength[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].RumbleStrength);
|
||||
m_TiltInvertRoll[controller]->SetValue(WiiMoteEmu::PadMapping[controller].bRollInvert);
|
||||
m_TiltInvertPitch[controller]->SetValue(WiiMoteEmu::PadMapping[controller].bPitchInvert);
|
||||
m_TriggerType[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].triggertype);
|
||||
|
||||
for (int i = 0; i < AN_CONTROLS; i++)
|
||||
|
@ -231,8 +229,6 @@ void WiimotePadConfigDialog::SaveButtonMapping(int controller, bool DontChangeId
|
|||
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].bPitchInvert = m_TiltInvertPitch[FromSlot]->IsChecked();
|
||||
WiiMoteEmu::PadMapping[controller].triggertype = m_TriggerType[FromSlot]->GetSelection();
|
||||
|
||||
for (int i = 0; i < AN_CONTROLS; i++)
|
||||
|
|
|
@ -46,10 +46,12 @@ BEGIN_EVENT_TABLE(WiimotePadConfigDialog,wxDialog)
|
|||
EVT_COMBOBOX(IDC_STICK_DIAGONAL, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(IDC_STICK_C2S, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
EVT_COMBOBOX(IDC_TILT_INPUT, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
EVT_COMBOBOX(IDC_TILT_RANGE_ROLL, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
EVT_COMBOBOX(IDC_TILT_RANGE_PITCH, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(IDC_TILT_INVERT_ROLL, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(IDC_TILT_INVERT_PITCH, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
EVT_COMBOBOX(IDC_TILT_ROLL, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(IDC_TILT_ROLL_SWING, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
EVT_COMBOBOX(IDC_TILT_PITCH, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(IDC_TILT_PITCH_SWING, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(IDC_TILT_ROLL_INVERT, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(IDC_TILT_PITCH_INVERT, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
EVT_COMBOBOX(IDC_TRIGGER_TYPE, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
EVT_COMBOBOX(IDC_NUNCHUCK_STICK, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
EVT_COMBOBOX(IDC_CC_LEFT_STICK, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
|
@ -127,7 +129,7 @@ WiimotePadConfigDialog::WiimotePadConfigDialog(wxWindow *parent, wxWindowID id,
|
|||
Page = 0;
|
||||
ClickedButton = NULL;
|
||||
|
||||
g_Config.Load();
|
||||
//g_Config.Load();
|
||||
CreatePadGUIControls();
|
||||
SetBackgroundColour(m_Notebook->GetBackgroundColour());
|
||||
|
||||
|
@ -229,6 +231,7 @@ void WiimotePadConfigDialog::OnClose(wxCloseEvent& event)
|
|||
m_UpdatePadTimer->Stop();
|
||||
if (m_ButtonMappingTimer)
|
||||
m_ButtonMappingTimer->Stop();
|
||||
|
||||
SaveButtonMappingAll(Page);
|
||||
EndModal(wxID_CLOSE);
|
||||
}
|
||||
|
@ -378,11 +381,9 @@ void WiimotePadConfigDialog::CreatePadGUIControls()
|
|||
|
||||
// The range is in degrees and are set at even 5 degrees values
|
||||
wxArrayString StrTiltRangeRoll, StrTiltRangePitch;
|
||||
StrTiltRangeRoll.Add(wxString::Format(wxT("Free Swing")));
|
||||
for (int i = 1; i < 37; i++)
|
||||
for (int i = 1; i <= 36; i++)
|
||||
StrTiltRangeRoll.Add(wxString::Format(wxT("%i"), i*5));
|
||||
StrTiltRangePitch.Add(wxString::Format(wxT("Free Swing")));
|
||||
for (int i = 1; i < 37; i++)
|
||||
for (int i = 1; i <= 36; i++)
|
||||
StrTiltRangePitch.Add(wxString::Format(wxT("%i"), i*5));
|
||||
|
||||
// The Trigger type list
|
||||
|
@ -566,36 +567,43 @@ void WiimotePadConfigDialog::CreatePadGUIControls()
|
|||
m_gJoyPad[i]->AddStretchSpacer();
|
||||
|
||||
// Tilt Wiimote
|
||||
m_TiltComboInput[i] = new wxComboBox(m_Controller[i], IDC_TILT_INPUT, StrTilt[0], wxDefaultPosition, wxSize(100, -1), StrTilt, wxCB_READONLY);
|
||||
m_TiltComboInput[i] = new wxComboBox(m_Controller[i], IDC_TILT_INPUT, StrTilt[0], wxDefaultPosition, wxSize(80, -1), StrTilt, wxCB_READONLY);
|
||||
m_TiltComboInput[i]->SetSelection(g_Config.Tilt.Type);
|
||||
m_TiltComboInput[i]->SetToolTip(wxT("Control tilting by an analog gamepad stick, an analog trigger or the keyboard."));
|
||||
m_TiltComboInput[i]->SetToolTip(wxT("Control tilting by keyboard or analog stick or trigger"));
|
||||
|
||||
m_TiltTextRoll[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Roll L/R"));
|
||||
m_TiltTextPitch[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Pitch U/D"));
|
||||
|
||||
m_TiltComboRangeRoll[i] = new wxComboBox(m_Controller[i], IDC_TILT_RANGE_ROLL, StrTiltRangeRoll[0], wxDefaultPosition, wxSize(75, -1), StrTiltRangeRoll, wxCB_READONLY);
|
||||
m_TiltComboRangeRoll[i] = new wxComboBox(m_Controller[i], IDC_TILT_ROLL, StrTiltRangeRoll[0], wxDefaultPosition, wxSize(40, -1), StrTiltRangeRoll, wxCB_READONLY);
|
||||
m_TiltComboRangeRoll[i]->SetValue(wxString::Format(wxT("%i"), g_Config.Tilt.Range.Roll));
|
||||
m_TiltComboRangeRoll[i]->SetToolTip(wxT("The maximum roll in degrees."));
|
||||
m_TiltComboRangePitch[i] = new wxComboBox(m_Controller[i], IDC_TILT_RANGE_PITCH, StrTiltRangePitch[0], wxDefaultPosition, wxSize(75, -1), StrTiltRangePitch, wxCB_READONLY);
|
||||
m_TiltComboRangeRoll[i]->SetToolTip(wxT("The maximum Left/Righ Roll in degrees"));
|
||||
m_TiltComboRangePitch[i] = new wxComboBox(m_Controller[i], IDC_TILT_PITCH, StrTiltRangePitch[0], wxDefaultPosition, wxSize(40, -1), StrTiltRangePitch, wxCB_READONLY);
|
||||
m_TiltComboRangePitch[i]->SetValue(wxString::Format(wxT("%i"), g_Config.Tilt.Range.Pitch));
|
||||
m_TiltComboRangePitch[i]->SetToolTip(wxT("The maximum pitch in degrees."));
|
||||
|
||||
m_TiltInvertRoll[i] = new wxCheckBox(m_Controller[i], IDC_TILT_INVERT_ROLL, wxT("Invert"));
|
||||
m_TiltInvertPitch[i] = new wxCheckBox(m_Controller[i], IDC_TILT_INVERT_PITCH, wxT("Invert"));
|
||||
m_TiltComboRangePitch[i]->SetToolTip(wxT("The maximum Up/Down Pitch in degrees"));
|
||||
m_TiltRollSwing[i] = new wxCheckBox(m_Controller[i], IDC_TILT_ROLL_SWING, wxT("Swing"));
|
||||
m_TiltRollSwing[i]->SetToolTip(wxT("Emulate Left/Right Swing instead of Left/Right Roll"));
|
||||
m_TiltPitchSwing[i] = new wxCheckBox(m_Controller[i], IDC_TILT_PITCH_SWING, wxT("Swing"));
|
||||
m_TiltPitchSwing[i]->SetToolTip(wxT("Emulate Up/Down Swing instead of Up/Down Pitch"));
|
||||
m_TiltRollInvert[i] = new wxCheckBox(m_Controller[i], IDC_TILT_ROLL_INVERT, wxT("Invert"));
|
||||
m_TiltRollInvert[i]->SetToolTip(wxT("Invert Left/Right direction"));
|
||||
m_TiltPitchInvert[i] = new wxCheckBox(m_Controller[i], IDC_TILT_PITCH_INVERT, wxT("Invert"));
|
||||
m_TiltPitchInvert[i]->SetToolTip(wxT("Invert Up/Down direction"));
|
||||
|
||||
// Sizers
|
||||
m_sGridTilt[i] = new wxGridBagSizer(0, 0);
|
||||
m_sGridTilt[i]->Add(m_TiltTextRoll[i], wxGBPosition(0, 0), wxGBSpan(1, 1), (wxTOP), 4);
|
||||
m_sGridTilt[i]->Add(m_TiltComboRangeRoll[i], wxGBPosition(0, 1), wxGBSpan(1, 1), (wxLEFT), 2);
|
||||
m_sGridTilt[i]->Add(m_TiltInvertRoll[i], wxGBPosition(0, 2), wxGBSpan(1, 1), (wxLEFT | wxTOP), 4);
|
||||
m_sGridTilt[i]->Add(m_TiltTextPitch[i], wxGBPosition(1, 0), wxGBSpan(1, 1), (wxTOP), 4);
|
||||
m_sGridTilt[i]->Add(m_TiltComboRangePitch[i], wxGBPosition(1, 1), wxGBSpan(1, 1), (wxLEFT | wxTOP), 2);
|
||||
m_sGridTilt[i]->Add(m_TiltInvertPitch[i], wxGBPosition(1, 2), wxGBSpan(1, 1), (wxLEFT | wxTOP), 4);
|
||||
m_sGridTilt[i]->Add(m_TiltRollInvert[i], wxGBPosition(1, 0), wxGBSpan(1, 1), (wxTOP), 4);
|
||||
m_sGridTilt[i]->Add(m_TiltComboRangeRoll[i], wxGBPosition(0, 1), wxGBSpan(1, 1), (wxLEFT | wxRIGHT), 4);
|
||||
m_sGridTilt[i]->Add(m_TiltRollSwing[i], wxGBPosition(1, 1), wxGBSpan(1, 1), (wxTOP | wxLEFT | wxRIGHT), 4);
|
||||
m_sGridTilt[i]->Add(m_TiltTextPitch[i], wxGBPosition(0, 2), wxGBSpan(1, 1), (wxLEFT | wxTOP), 4);
|
||||
m_sGridTilt[i]->Add(m_TiltPitchInvert[i], wxGBPosition(1, 2), wxGBSpan(1, 1), (wxLEFT | wxTOP), 4);
|
||||
m_sGridTilt[i]->Add(m_TiltComboRangePitch[i], wxGBPosition(0, 3), wxGBSpan(1, 1), (wxLEFT), 4);
|
||||
m_sGridTilt[i]->Add(m_TiltPitchSwing[i], wxGBPosition(1, 3), wxGBSpan(1, 1), (wxLEFT | wxTOP), 4);
|
||||
|
||||
m_gTilt[i] = new wxStaticBoxSizer (wxVERTICAL, m_Controller[i], wxT("Tilt and Swing"));
|
||||
m_gTilt[i]->AddStretchSpacer();
|
||||
m_gTilt[i]->Add(m_TiltComboInput[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5);
|
||||
m_gTilt[i]->Add(m_sGridTilt[i], 0, wxEXPAND | (wxLEFT | wxRIGHT), 5);
|
||||
m_gTilt[i]->Add(m_sGridTilt[i], 0, wxEXPAND | (wxLEFT), 5);
|
||||
m_gTilt[i]->AddStretchSpacer();
|
||||
|
||||
// Row 1 Sizers: Connected pads, tilt
|
||||
|
@ -933,23 +941,25 @@ void WiimotePadConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
|||
case IDC_TILT_INPUT:
|
||||
g_Config.Tilt.Type = m_TiltComboInput[Page]->GetSelection();
|
||||
break;
|
||||
case IDC_TILT_RANGE_ROLL:
|
||||
if (m_TiltComboRangeRoll[Page]->GetSelection() == 0)
|
||||
g_Config.Tilt.Range.Roll = 0;
|
||||
else
|
||||
{
|
||||
case IDC_TILT_ROLL:
|
||||
case IDC_TILT_ROLL_SWING:
|
||||
m_TiltComboRangeRoll[Page]->GetValue().ToLong(&TmpValue);
|
||||
g_Config.Tilt.Range.Roll = TmpValue;
|
||||
}
|
||||
g_Config.Tilt.Range.RollDegree = TmpValue;
|
||||
g_Config.Tilt.Range.RollSwing = m_TiltRollSwing[Page]->IsChecked();
|
||||
g_Config.Tilt.Range.Roll = (g_Config.Tilt.Range.RollSwing) ? 0 : g_Config.Tilt.Range.RollDegree;
|
||||
break;
|
||||
case IDC_TILT_RANGE_PITCH:
|
||||
if (m_TiltComboRangePitch[Page]->GetSelection() == 0)
|
||||
g_Config.Tilt.Range.Pitch = 0;
|
||||
else
|
||||
{
|
||||
case IDC_TILT_PITCH:
|
||||
case IDC_TILT_PITCH_SWING:
|
||||
m_TiltComboRangePitch[Page]->GetValue().ToLong(&TmpValue);
|
||||
g_Config.Tilt.Range.Pitch = TmpValue;
|
||||
}
|
||||
g_Config.Tilt.Range.PitchDegree = TmpValue;
|
||||
g_Config.Tilt.Range.PitchSwing = m_TiltPitchSwing[Page]->IsChecked();
|
||||
g_Config.Tilt.Range.Pitch = (g_Config.Tilt.Range.PitchSwing) ? 0 : g_Config.Tilt.Range.PitchDegree;
|
||||
break;
|
||||
case IDC_TILT_ROLL_INVERT:
|
||||
g_Config.Tilt.RollInvert = m_TiltRollInvert[Page]->IsChecked();
|
||||
break;
|
||||
case IDC_TILT_PITCH_INVERT:
|
||||
g_Config.Tilt.PitchInvert = m_TiltPitchInvert[Page]->IsChecked();
|
||||
break;
|
||||
case IDC_NUNCHUCK_STICK:
|
||||
g_Config.Nunchuck.Type = m_NunchuckComboStick[Page]->GetSelection();
|
||||
|
@ -973,8 +983,6 @@ void WiimotePadConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
|||
case IDC_STICK_C2S:
|
||||
case IDC_RUMBLE:
|
||||
case IDC_RUMBLE_STRENGTH:
|
||||
case IDC_TILT_INVERT_ROLL:
|
||||
case IDC_TILT_INVERT_PITCH:
|
||||
case IDC_TRIGGER_TYPE:
|
||||
SaveButtonMappingAll(Page);
|
||||
break;
|
||||
|
@ -1003,6 +1011,8 @@ void WiimotePadConfigDialog::UpdateGUI(int Slot)
|
|||
m_Notebook->FindItem(IDC_RUMBLE)->Enable(PadEnabled);
|
||||
m_Notebook->FindItem(IDC_RUMBLE_STRENGTH)->Enable(PadEnabled);
|
||||
m_Notebook->FindItem(IDC_TRIGGER_TYPE)->Enable(PadEnabled);
|
||||
m_Notebook->FindItem(IDC_TILT_ROLL)->Enable(!g_Config.Tilt.Range.RollSwing);
|
||||
m_Notebook->FindItem(IDC_TILT_PITCH)->Enable(!g_Config.Tilt.Range.PitchSwing);
|
||||
for(int i = IDB_ANALOG_LEFT_X; i <= IDB_TRIGGER_R; i++)
|
||||
m_Notebook->FindItem(i)->Enable(PadEnabled);
|
||||
#endif
|
||||
|
|
|
@ -95,8 +95,10 @@ class WiimotePadConfigDialog : public wxDialog
|
|||
|
||||
wxCheckBox *m_CheckC2S[4],
|
||||
*m_CheckRumble[4],
|
||||
*m_TiltInvertRoll[4],
|
||||
*m_TiltInvertPitch[4];
|
||||
*m_TiltRollSwing[4],
|
||||
*m_TiltPitchSwing[4],
|
||||
*m_TiltRollInvert[4],
|
||||
*m_TiltPitchInvert[4];
|
||||
|
||||
wxButton *m_Close, *m_Apply, *ClickedButton,
|
||||
*m_Button_Analog[AN_CONTROLS][4],
|
||||
|
@ -256,8 +258,9 @@ class WiimotePadConfigDialog : public wxDialog
|
|||
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_TILT_ROLL, IDC_TILT_ROLL_SWING,
|
||||
IDC_TILT_PITCH, IDC_TILT_PITCH_SWING,
|
||||
IDC_TILT_ROLL_INVERT, IDC_TILT_PITCH_INVERT,
|
||||
IDC_TRIGGER_TYPE,
|
||||
IDC_NUNCHUCK_STICK,
|
||||
IDC_CC_LEFT_STICK, IDC_CC_RIGHT_STICK, IDC_CC_TRIGGERS,
|
||||
|
|
|
@ -39,8 +39,6 @@ extern SWiimoteInitialize g_WiimoteInitialize;
|
|||
namespace WiiMoteEmu
|
||||
{
|
||||
|
||||
extern void PAD_RumbleClose();
|
||||
|
||||
/* Bit shift conversions */
|
||||
u32 convert24bit(const u8* src) {
|
||||
return (src[0] << 16) | (src[1] << 8) | src[2];
|
||||
|
@ -424,11 +422,12 @@ void UpdateExtRegisterBlocks()
|
|||
UpdateEeprom();
|
||||
}
|
||||
|
||||
|
||||
/* Write initial values to Eeprom and registers. */
|
||||
// Start emulation
|
||||
void Initialize()
|
||||
{
|
||||
if (g_EmulatedWiiMoteInitialized) return;
|
||||
INFO_LOG(WIIMOTE, "Initialize");
|
||||
|
||||
//if (g_EmulatedWiiMoteInitialized) return;
|
||||
|
||||
// Reset variables
|
||||
ResetVariables();
|
||||
|
@ -442,10 +441,10 @@ void Initialize()
|
|||
/* Populate joyinfo for all attached devices and do g_Config.Load() if the
|
||||
configuration window is not already open, if it's already open we
|
||||
continue with the settings we have */
|
||||
if(!g_FrameOpen)
|
||||
{
|
||||
//if(!g_FrameOpen)
|
||||
Search_Devices(joyinfo, NumPads, NumGoodPads);
|
||||
}
|
||||
|
||||
g_Config.Load();
|
||||
|
||||
// Copy extension id and calibration to its register, g_Config.Load() is needed before this
|
||||
UpdateExtRegisterBlocks();
|
||||
|
@ -502,32 +501,13 @@ void DoState(PointerWrap &p)
|
|||
|
||||
/* This is not needed if we call FreeLibrary() when we stop a game, but if it's
|
||||
not called we need to reset these variables. */
|
||||
void Shutdown(void)
|
||||
void Shutdown()
|
||||
{
|
||||
INFO_LOG(WIIMOTE, "ShutDown");
|
||||
|
||||
ResetVariables();
|
||||
|
||||
PAD_RumbleClose();
|
||||
/* Close all devices carefully. We must check that we are not accessing any
|
||||
undefined vector elements or any bad devices */
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
if (SDL_WasInit(0) && joyinfo.size() > (u32)PadMapping[i].ID)
|
||||
if (PadState[i].joy && joyinfo.at(PadMapping[i].ID).Good)
|
||||
{
|
||||
INFO_LOG(WIIMOTE, "ShutDown: %i", PadState[i].joy);
|
||||
if(SDL_JoystickOpened(PadMapping[i].ID))
|
||||
SDL_JoystickClose(PadState[i].joy);
|
||||
PadState[i].joy = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the physical device info
|
||||
joyinfo.clear();
|
||||
NumPads = 0;
|
||||
NumGoodPads = 0;
|
||||
|
||||
// Close joypads
|
||||
Close_Devices();
|
||||
// Finally close SDL
|
||||
if (SDL_WasInit(0))
|
||||
SDL_Quit();
|
||||
|
|
|
@ -37,7 +37,7 @@ void GetMousePos(float& x, float& y);
|
|||
// General functions
|
||||
void Initialize();
|
||||
void DoState(PointerWrap &p);
|
||||
void Shutdown(void);
|
||||
void Shutdown();
|
||||
void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size);
|
||||
void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) ;
|
||||
void Update();
|
||||
|
@ -52,6 +52,7 @@ void UpdateEeprom();
|
|||
void UpdateExtRegisterBlocks();
|
||||
|
||||
// Gamepad
|
||||
void Close_Devices();
|
||||
bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_NumGoodPads);
|
||||
void GetJoyState(InputCommon::CONTROLLER_STATE_NEW &_PadState, InputCommon::CONTROLLER_MAPPING_NEW _PadMapping, int controller, int NumButtons);
|
||||
void PadStateAdjustments(int &Lx, int &Ly, int &Rx, int &Ry, int &Tl, int &Tr);
|
||||
|
|
|
@ -40,25 +40,50 @@ extern SWiimoteInitialize g_WiimoteInitialize;
|
|||
namespace WiiMoteEmu
|
||||
{
|
||||
|
||||
extern void PAD_RumbleClose();
|
||||
|
||||
// Close joypads
|
||||
void Close_Devices()
|
||||
{
|
||||
PAD_RumbleClose();
|
||||
/* Close all devices carefully. We must check that we are not accessing any
|
||||
undefined vector elements or any bad devices */
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
if (SDL_WasInit(0) && joyinfo.size() > (u32)PadMapping[i].ID)
|
||||
if (PadState[i].joy && joyinfo.at(PadMapping[i].ID).Good)
|
||||
{
|
||||
INFO_LOG(WIIMOTE, "ShutDown: %i", PadState[i].joy);
|
||||
if(SDL_JoystickOpened(PadMapping[i].ID))
|
||||
{
|
||||
SDL_JoystickClose(PadState[i].joy);
|
||||
PadState[i].joy = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the physical device info
|
||||
joyinfo.clear();
|
||||
NumPads = 0;
|
||||
NumGoodPads = 0;
|
||||
}
|
||||
|
||||
// Fill joyinfo with the current connected devices
|
||||
bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_NumGoodPads)
|
||||
{
|
||||
// Close opened pad first
|
||||
Close_Devices();
|
||||
|
||||
bool WasGotten = InputCommon::SearchDevices(_joyinfo, _NumPads, _NumGoodPads);
|
||||
|
||||
// Warn the user if no gamepads are detected
|
||||
if (_NumGoodPads == 0 && g_EmulatorRunning)
|
||||
{
|
||||
//PanicAlert("nJoy: No Gamepad Detected");
|
||||
//return false;
|
||||
}
|
||||
|
||||
// Load PadMapping[] etc
|
||||
g_Config.Load();
|
||||
if (_NumGoodPads == 0)
|
||||
return false;
|
||||
|
||||
// Update the PadState[].joy handle
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
if (PadMapping[i].enabled && joyinfo.size() > (u32)PadMapping[i].ID)
|
||||
if (joyinfo.size() > (u32)PadMapping[i].ID)
|
||||
if(joyinfo.at(PadMapping[i].ID).Good)
|
||||
PadState[i].joy = SDL_JoystickOpen(PadMapping[i].ID);
|
||||
}
|
||||
|
|
|
@ -514,7 +514,7 @@ void TiltWiimoteGamepad(int &Roll, int &Pitch)
|
|||
Tl = Tl / 2;
|
||||
Tr = Tr / 2;
|
||||
// Invert
|
||||
if (PadMapping[Page].bPitchInvert) { Tl = -Tl; Tr = -Tr; }
|
||||
if (g_Config.Tilt.PitchInvert) { Tl = -Tl; Tr = -Tr; }
|
||||
// The final value
|
||||
Pitch = (float)PitchRange * ((float)(Tl - Tr) / 128.0f);
|
||||
}
|
||||
|
@ -528,8 +528,8 @@ void TiltWiimoteGamepad(int &Roll, int &Pitch)
|
|||
Lx = Lx - 0x80;
|
||||
Ly = Ly - 0x80;
|
||||
// Invert
|
||||
if (PadMapping[Page].bRollInvert) Lx = -Lx; // else Tr = -Tr;
|
||||
if (PadMapping[Page].bPitchInvert) Ly = -Ly; // else Tr = -Tr;
|
||||
if (g_Config.Tilt.RollInvert) Lx = -Lx; // else Tr = -Tr;
|
||||
if (g_Config.Tilt.PitchInvert) Ly = -Ly; // else Tr = -Tr;
|
||||
// Produce the final value
|
||||
Roll = (RollRange) ? (float)RollRange * ((float)Lx / 128.0f) : Lx;
|
||||
Pitch = (PitchRange) ? (float)PitchRange * ((float)Ly / 128.0f) : Ly;
|
||||
|
@ -541,8 +541,8 @@ void TiltWiimoteGamepad(int &Roll, int &Pitch)
|
|||
Rx = Rx - 0x80;
|
||||
Ry = Ry - 0x80;
|
||||
// Invert
|
||||
if (PadMapping[Page].bRollInvert) Rx = -Rx; // else Tr = -Tr;
|
||||
if (PadMapping[Page].bPitchInvert) Ry = -Ry; // else Tr = -Tr;
|
||||
if (g_Config.Tilt.RollInvert) Rx = -Rx; // else Tr = -Tr;
|
||||
if (g_Config.Tilt.PitchInvert) Ry = -Ry; // else Tr = -Tr;
|
||||
// Produce the final value
|
||||
Roll = (RollRange) ? (float)RollRange * ((float)Rx / 128.0f) : Rx;
|
||||
Pitch = (PitchRange) ? (float)PitchRange * ((float)Ry / 128.0f) : Ry;
|
||||
|
|
|
@ -185,9 +185,13 @@ void DllDebugger(HWND _hParent, bool Show) {}
|
|||
|
||||
void DllConfig(HWND _hParent)
|
||||
{
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
// We do a pad search before creating the dialog
|
||||
WiiMoteEmu::Search_Devices(WiiMoteEmu::joyinfo, WiiMoteEmu::NumPads, WiiMoteEmu::NumGoodPads);
|
||||
|
||||
DoInitialize();
|
||||
// Load settings
|
||||
g_Config.Load();
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
|
||||
if (!m_BasicConfigFrame)
|
||||
m_BasicConfigFrame = new WiimoteBasicConfigDialog(GetParentedWxWindow(_hParent));
|
||||
|
@ -202,6 +206,7 @@ void DllConfig(HWND _hParent)
|
|||
#endif
|
||||
}
|
||||
|
||||
// Start emulation
|
||||
void Initialize(void *init)
|
||||
{
|
||||
// Declarations
|
||||
|
|
|
@ -127,6 +127,7 @@ void Config::Save(int Slot)
|
|||
|
||||
// Save the physical device ID
|
||||
file.Set(SectionName.c_str(), "joy_id", PadMapping[i].ID);
|
||||
file.Set(SectionName.c_str(), "enable", PadMapping[i].enable);
|
||||
// ===================
|
||||
|
||||
// ==================================================================
|
||||
|
@ -190,7 +191,8 @@ void Config::Save(int Slot)
|
|||
void Config::Load(bool ChangePad, bool ChangeSaveByID)
|
||||
{
|
||||
// If there are no good pads don't load
|
||||
if (NumGoodPads == 0) return;
|
||||
if (NumGoodPads == 0)
|
||||
return;
|
||||
|
||||
// Load file
|
||||
IniFile file;
|
||||
|
@ -219,6 +221,7 @@ void Config::Load(bool ChangePad, bool ChangeSaveByID)
|
|||
if (!ChangePad)
|
||||
{
|
||||
file.Get(SectionName.c_str(), "joy_id", &PadMapping[i].ID, 0);
|
||||
file.Get(SectionName.c_str(), "enable", &PadMapping[i].enable, false);
|
||||
}
|
||||
|
||||
// ==================================================================
|
||||
|
|
|
@ -58,6 +58,7 @@ BEGIN_EVENT_TABLE(PADConfigDialognJoy,wxDialog)
|
|||
|
||||
// Change gamepad
|
||||
EVT_COMBOBOX(IDC_JOYNAME, PADConfigDialognJoy::ChangeSettings)
|
||||
EVT_CHECKBOX(IDC_ENABLE, PADConfigDialognJoy::ChangeSettings)
|
||||
|
||||
// Other settings
|
||||
EVT_CHECKBOX(IDC_SAVEBYID, PADConfigDialognJoy::ChangeSettings)
|
||||
|
@ -130,8 +131,8 @@ PADConfigDialognJoy::PADConfigDialognJoy(wxWindow *parent, wxWindowID id, const
|
|||
GetButtonWaitingID = 0; GetButtonWaitingTimer = 0;
|
||||
|
||||
// Start the constant timer
|
||||
int TimesPerSecond = 30;
|
||||
m_ConstantTimer->Start( floor((double)(1000 / TimesPerSecond)) );
|
||||
int TimesPerSecond = 10;
|
||||
m_ConstantTimer->Start(1000 / TimesPerSecond);
|
||||
#endif
|
||||
|
||||
// wxEVT_KEY_DOWN is blocked for enter, tab and the directional keys
|
||||
|
@ -157,13 +158,15 @@ void PADConfigDialognJoy::OnKeyDown(wxKeyEvent& event)
|
|||
void PADConfigDialognJoy::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
// Allow wxWidgets to close the window
|
||||
event.Skip();
|
||||
//event.Skip();
|
||||
|
||||
// Stop the timer
|
||||
m_ConstantTimer->Stop();
|
||||
|
||||
// Close pads, unless we are running a game
|
||||
if (!g_EmulatorRunning) Shutdown();
|
||||
//if (!g_EmulatorRunning) Shutdown();
|
||||
|
||||
EndModal(wxID_CLOSE);
|
||||
}
|
||||
|
||||
// Call about dialog
|
||||
|
@ -252,7 +255,8 @@ void PADConfigDialognJoy::DoSave(bool ChangePad, int Slot)
|
|||
if (ChangePad)
|
||||
{
|
||||
// Since we are selecting the pad to save to by the Id we can't update it when we change the pad
|
||||
for(int i = 0; i < 4; i++) SaveButtonMapping(i, true);
|
||||
for(int i = 0; i < 4; i++)
|
||||
SaveButtonMapping(i, true);
|
||||
|
||||
g_Config.Save(Slot);
|
||||
// Now we can update the ID
|
||||
|
@ -261,7 +265,9 @@ void PADConfigDialognJoy::DoSave(bool ChangePad, int Slot)
|
|||
else
|
||||
{
|
||||
// Update PadMapping[] from the GUI controls
|
||||
for(int i = 0; i < 4; i++) SaveButtonMapping(i);
|
||||
for(int i = 0; i < 4; i++)
|
||||
SaveButtonMapping(i);
|
||||
|
||||
g_Config.Save(Slot);
|
||||
}
|
||||
|
||||
|
@ -301,13 +307,15 @@ void PADConfigDialognJoy::DoChangeJoystick()
|
|||
void PADConfigDialognJoy::NotebookPageChanged(wxNotebookEvent& event)
|
||||
{
|
||||
// Save current settings now, don't wait for OK
|
||||
if (ControlsCreated && !g_Config.bSaveByID) DoSave(false, notebookpage);
|
||||
if (ControlsCreated && !g_Config.bSaveByID)
|
||||
DoSave(false, notebookpage);
|
||||
|
||||
// Update the global variable
|
||||
notebookpage = event.GetSelection();
|
||||
|
||||
// Update GUI
|
||||
if (ControlsCreated) UpdateGUI(notebookpage);
|
||||
if (ControlsCreated)
|
||||
UpdateGUI(notebookpage);
|
||||
}
|
||||
|
||||
// Replace the harder to understand -1 with "" for the sake of user friendliness
|
||||
|
@ -362,7 +370,8 @@ void PADConfigDialognJoy::UpdateGUIAll(int Slot)
|
|||
{
|
||||
if (Slot == -1)
|
||||
{
|
||||
for (int i = 0; i < 4; i++) UpdateGUI(i);
|
||||
for (int i = 0; i < 4; i++)
|
||||
UpdateGUI(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -387,11 +396,8 @@ void PADConfigDialognJoy::ChangeSettings( wxCommandEvent& event )
|
|||
case IDC_SHOWADVANCED:
|
||||
g_Config.bShowAdvanced = m_CBShowAdvanced[notebookpage]->IsChecked();
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
UpdateGUI(i);
|
||||
m_CBShowAdvanced[i]->SetValue(g_Config.bShowAdvanced);
|
||||
m_sMainRight[i]->Show(g_Config.bShowAdvanced);
|
||||
}
|
||||
UpdateGUI(notebookpage);
|
||||
// Resize the window without the need of any weird hack
|
||||
SetSizerAndFit(m_MainSizer);
|
||||
break;
|
||||
|
@ -400,34 +406,30 @@ void PADConfigDialognJoy::ChangeSettings( wxCommandEvent& event )
|
|||
case IDCB_CHECKFOCUS:
|
||||
g_Config.bCheckFocus = m_CBCheckFocus[notebookpage]->IsChecked();
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
m_CBCheckFocus[i]->SetValue(g_Config.bCheckFocus);
|
||||
}
|
||||
break;
|
||||
case IDCB_FILTER_SETTINGS:
|
||||
g_Config.bNoTriggerFilter = m_AdvancedMapFilter[notebookpage]->IsChecked();
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
m_AdvancedMapFilter[i]->SetValue(g_Config.bNoTriggerFilter);
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_CONTROLTYPE:
|
||||
if(!g_Config.bSaveByID)
|
||||
{
|
||||
PadMapping[notebookpage].controllertype = m_ControlType[notebookpage]->GetSelection();
|
||||
UpdateGUI(notebookpage);
|
||||
//UpdateGUI(notebookpage);
|
||||
}
|
||||
case IDC_TRIGGERTYPE:
|
||||
if(!g_Config.bSaveByID)
|
||||
{
|
||||
PadMapping[notebookpage].triggertype = m_TriggerType[notebookpage]->GetSelection();
|
||||
UpdateGUI(notebookpage);
|
||||
//UpdateGUI(notebookpage);
|
||||
}
|
||||
break;
|
||||
case IDC_ENABLERUMBLE:
|
||||
PadMapping[notebookpage].rumble = m_Rumble[notebookpage]->IsChecked();
|
||||
UpdateGUI(notebookpage);
|
||||
//UpdateGUI(notebookpage);
|
||||
break;
|
||||
case IDC_RUMBLESTRENGTH:
|
||||
g_Config.RumbleStrength = m_RStrength[notebookpage]->GetSelection();
|
||||
|
@ -435,11 +437,17 @@ void PADConfigDialognJoy::ChangeSettings( wxCommandEvent& event )
|
|||
case IDC_JOYNAME:
|
||||
DoChangeJoystick();
|
||||
break;
|
||||
case IDC_ENABLE:
|
||||
PadMapping[notebookpage].enable = m_Enable[notebookpage]->IsChecked();
|
||||
UpdateGUI(notebookpage);
|
||||
// Resize the window without the need of any weird hack
|
||||
SetSizerAndFit(m_MainSizer);
|
||||
break;
|
||||
}
|
||||
|
||||
// Update all slots that use this device
|
||||
if(g_Config.bSaveByID) SaveButtonMappingAll(notebookpage);
|
||||
if(g_Config.bSaveByID) UpdateGUIAll(notebookpage);
|
||||
//if(g_Config.bSaveByID) UpdateGUIAll(notebookpage);
|
||||
}
|
||||
|
||||
|
||||
|
@ -507,6 +515,10 @@ void PADConfigDialognJoy::UpdateGUI(int _notebookpage)
|
|||
else m_CoBDiagonalC[_notebookpage]->Enable(false);
|
||||
}
|
||||
|
||||
m_sKeys[_notebookpage]->Show(PadMapping[_notebookpage].enable);
|
||||
m_sSettings[_notebookpage]->Show(PadMapping[_notebookpage].enable);
|
||||
m_sMainRight[_notebookpage]->Show(g_Config.bShowAdvanced && PadMapping[_notebookpage].enable);
|
||||
|
||||
// Repaint the background
|
||||
m_Controller[_notebookpage]->Refresh();
|
||||
}
|
||||
|
@ -525,7 +537,7 @@ void PADConfigDialognJoy::OnPaint(wxPaintEvent &event)
|
|||
// Populate the config window
|
||||
void PADConfigDialognJoy::CreateGUIControls()
|
||||
{
|
||||
INFO_LOG(PAD, "CreateGUIControls()\n");
|
||||
INFO_LOG(PAD, "CreateGUIControls()");
|
||||
|
||||
#ifndef _DEBUG
|
||||
SetTitle(wxT("Configure: nJoy Input Plugin"));
|
||||
|
@ -721,17 +733,18 @@ void PADConfigDialognJoy::CreateGUIControls()
|
|||
// Populate Controller sizer
|
||||
// Groups
|
||||
#ifdef _WIN32
|
||||
m_Joyname[i] = new wxComboBox(m_Controller[i], IDC_JOYNAME, arrayStringFor_Joyname[0], wxDefaultPosition, wxSize(476, 21), arrayStringFor_Joyname, wxCB_READONLY);
|
||||
m_Joyname[i] = new wxComboBox(m_Controller[i], IDC_JOYNAME, arrayStringFor_Joyname[0], wxDefaultPosition, wxSize(300, 25), arrayStringFor_Joyname, wxCB_READONLY);
|
||||
#else
|
||||
m_Joyname[i] = new wxComboBox(m_Controller[i], IDC_JOYNAME, arrayStringFor_Joyname[0], wxDefaultPosition, wxSize(450, 25), arrayStringFor_Joyname, 0, wxDefaultValidator, wxT("m_Joyname"));
|
||||
m_Joyname[i] = new wxComboBox(m_Controller[i], IDC_JOYNAME, arrayStringFor_Joyname[0], wxDefaultPosition, wxSize(300, 25), arrayStringFor_Joyname, 0, wxDefaultValidator, wxT("m_Joyname"));
|
||||
#endif
|
||||
|
||||
m_gJoyname[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Controller"));
|
||||
m_gJoyname[i]->Add(m_Joyname[i], 0, (wxLEFT | wxRIGHT), 5);
|
||||
|
||||
m_Joyname[i]->SetToolTip(wxT("Save your settings and configure another joypad"));
|
||||
|
||||
m_Enable[i] = new wxCheckBox(m_Controller[i], IDC_ENABLE, wxT("Pad Enabled"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_Enable[i]->SetToolTip(wxT("Enable this pad to send input events to game"));
|
||||
|
||||
m_gJoyname[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Controller"));
|
||||
m_gJoyname[i]->Add(m_Joyname[i], 0, wxEXPAND | (wxLEFT | wxRIGHT), 5);
|
||||
m_gJoyname[i]->Add(m_Enable[i], 0, wxEXPAND | (wxLEFT | wxRIGHT), 5);
|
||||
|
||||
// General settings
|
||||
|
||||
|
@ -979,7 +992,14 @@ void PADConfigDialognJoy::CreateGUIControls()
|
|||
#endif
|
||||
|
||||
// Set window size
|
||||
SetSizer(m_MainSizer);
|
||||
Layout();
|
||||
Fit();
|
||||
// Center the window if there is room for it
|
||||
#ifdef _WIN32
|
||||
if (GetSystemMetrics(SM_CYFULLSCREEN) > 600)
|
||||
Center();
|
||||
#endif
|
||||
|
||||
// All done
|
||||
ControlsCreated = true;
|
||||
|
|
|
@ -99,6 +99,7 @@ class PADConfigDialognJoy : public wxDialog
|
|||
// ---------
|
||||
|
||||
wxComboBox *m_Joyname[4];
|
||||
wxCheckBox *m_Enable[4];
|
||||
wxComboBox *m_ControlType[4], *m_TriggerType[4];
|
||||
wxComboBox *m_Deadzone[4];
|
||||
|
||||
|
@ -212,7 +213,7 @@ class PADConfigDialognJoy : public wxDialog
|
|||
|
||||
ID_KEYSPANEL1, ID_KEYSPANEL2, ID_KEYSPANEL3, ID_KEYSPANEL4,
|
||||
|
||||
IDG_JOYSTICK, IDC_JOYNAME,
|
||||
IDG_JOYSTICK, IDC_JOYNAME, IDC_ENABLE,
|
||||
|
||||
IDG_EXTRASETTINGS, IDC_DEADZONE, // Extra settings
|
||||
|
||||
|
@ -312,6 +313,7 @@ class PADConfigDialognJoy : public wxDialog
|
|||
};
|
||||
|
||||
private:
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void AboutClick(wxCommandEvent& event);
|
||||
void OKClick(wxCommandEvent& event);
|
||||
void CancelClick(wxCommandEvent& event);
|
||||
|
@ -324,7 +326,6 @@ class PADConfigDialognJoy : public wxDialog
|
|||
void ChangeSettings(wxCommandEvent& event);
|
||||
void ComboChange(wxCommandEvent& event);
|
||||
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void CreateGUIControls();
|
||||
void CreateAdvancedControls(int i);
|
||||
wxBitmap CreateBitmap();
|
||||
|
|
|
@ -52,6 +52,7 @@ void PADConfigDialognJoy::UpdateGUIButtonMapping(int controller)
|
|||
|
||||
// Update selected gamepad
|
||||
m_Joyname[controller]->SetSelection(PadMapping[controller].ID);
|
||||
m_Enable[controller]->SetValue(PadMapping[controller].enable);
|
||||
|
||||
tmp << PadMapping[controller].buttons[InputCommon::CTL_L_SHOULDER]; m_JoyShoulderL[controller]->SetValue(tmp); tmp.clear();
|
||||
tmp << PadMapping[controller].buttons[InputCommon::CTL_R_SHOULDER]; m_JoyShoulderR[controller]->SetValue(tmp); tmp.clear();
|
||||
|
@ -341,7 +342,7 @@ void PADConfigDialognJoy::DoGetButtons(int GetId)
|
|||
|
||||
// Start the timer
|
||||
#if wxUSE_TIMER
|
||||
m_ButtonMappingTimer->Start( floor((double)(1000 / TimesPerSecond)) );
|
||||
m_ButtonMappingTimer->Start(1000 / TimesPerSecond);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -81,6 +81,9 @@ void Pad_Use_Rumble(u8 _numPAD)
|
|||
|
||||
void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
|
||||
{
|
||||
if (!PadMapping[_numPAD].enable)
|
||||
return;
|
||||
|
||||
Pad_Use_Rumble(_numPAD);
|
||||
|
||||
int Strenght = 0;
|
||||
|
|
|
@ -181,7 +181,7 @@ void DllDebugger(HWND _hParent, bool Show) {}
|
|||
// --------------------------
|
||||
void Initialize(void *init)
|
||||
{
|
||||
INFO_LOG(PAD, "Initialize: %i\n", SDL_WasInit(0));
|
||||
INFO_LOG(PAD, "Initialize: %i", SDL_WasInit(0));
|
||||
g_PADInitialize = (SPADInitialize*)init;
|
||||
g_EmulatorRunning = true;
|
||||
|
||||
|
@ -195,6 +195,30 @@ void Initialize(void *init)
|
|||
|
||||
// Populate joyinfo for all attached devices
|
||||
Search_Devices(joyinfo, NumPads, NumGoodPads);
|
||||
|
||||
g_Config.Load(); // load settings
|
||||
}
|
||||
|
||||
void Close_Devices()
|
||||
{
|
||||
PAD_RumbleClose();
|
||||
/* Close all devices carefully. We must check that we are not accessing any undefined
|
||||
vector elements or any bad devices */
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (SDL_WasInit(0) && joyinfo.size() > (u32)PadMapping[i].ID)
|
||||
if (PadState[i].joy && joyinfo.at(PadMapping[i].ID).Good)
|
||||
if(SDL_JoystickOpened(PadMapping[i].ID))
|
||||
{
|
||||
SDL_JoystickClose(PadState[i].joy);
|
||||
PadState[i].joy = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the physical device info
|
||||
joyinfo.clear();
|
||||
NumPads = 0;
|
||||
NumGoodPads = 0;
|
||||
}
|
||||
|
||||
// Shutdown PAD (stop emulation)
|
||||
|
@ -214,25 +238,7 @@ void Shutdown()
|
|||
DEBUG_QUIT();
|
||||
#endif
|
||||
|
||||
PAD_RumbleClose();
|
||||
|
||||
/* Close all devices carefully. We must check that we are not accessing any undefined
|
||||
vector elements or any bad devices */
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (SDL_WasInit(0) && joyinfo.size() > (u32)PadMapping[i].ID)
|
||||
if (PadState[i].joy && joyinfo.at(PadMapping[i].ID).Good)
|
||||
if(SDL_JoystickOpened(PadMapping[i].ID))
|
||||
{
|
||||
SDL_JoystickClose(PadState[i].joy);
|
||||
PadState[i].joy = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the physical device info
|
||||
joyinfo.clear();
|
||||
NumPads = 0;
|
||||
NumGoodPads = 0;
|
||||
Close_Devices();
|
||||
|
||||
// Finally close SDL
|
||||
if (SDL_WasInit(0))
|
||||
|
@ -286,7 +292,8 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
|||
{
|
||||
// Check if the pad is avaliable, currently we don't disable pads just because they are
|
||||
// disconnected
|
||||
if (!PadState[_numPAD].joy) return;
|
||||
if (!PadState[_numPAD].joy || !PadMapping[_numPAD].enable)
|
||||
return;
|
||||
|
||||
// Clear pad status
|
||||
memset(_pPADStatus, 0, sizeof(SPADStatus));
|
||||
|
@ -442,6 +449,9 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
|||
// ----------------
|
||||
bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_NumGoodPads)
|
||||
{
|
||||
// Close opened devices first
|
||||
Close_Devices();
|
||||
|
||||
bool Success = InputCommon::SearchDevices(_joyinfo, _NumPads, _NumGoodPads);
|
||||
|
||||
// Warn the user if no gamepads are detected
|
||||
|
@ -451,9 +461,6 @@ bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_N
|
|||
return false;
|
||||
}
|
||||
|
||||
// Load PadMapping[] etc
|
||||
g_Config.Load();
|
||||
|
||||
// Update the PadState[].joy handle
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
@ -486,9 +493,3 @@ return true;
|
|||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
|
||||
// Custom Functions
|
||||
// ----------------
|
||||
void Close_Devices();
|
||||
bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_NumGoodPads);
|
||||
void DEBUG_INIT();
|
||||
void DEBUG_QUIT();
|
||||
|
|
Loading…
Reference in New Issue