nJoy: Fixed the Hat / Custom D-Pad setting in the save by slot mode

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2194 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-02-10 00:41:43 +00:00
parent 2162e3ce80
commit c18613a580
8 changed files with 31 additions and 15 deletions

View File

@ -86,7 +86,6 @@ struct CONTROLLER_MAPPING // GC PAD MAPPING
int triggertype; // Triggers range
std::string SDiagonal;
bool bSquareToCircle;
bool bNoTriggerFilter;
int eventnum; // Linux Event Number, Can't be found dynamically yet
};
@ -181,7 +180,6 @@ struct CONTROLLER_MAPPING_NEW // GC PAD MAPPING
int triggertype; // SDL or XInput trigger
std::string SDiagonal;
bool bSquareToCircle;
bool bNoTriggerFilter;
};
////////////////////////////

View File

@ -59,6 +59,7 @@ void Config::Load(bool ChangePad)
// Slot specific settings
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
std::string SectionName = StringFromFormat("Wiimote%i", i + 1);
iniFile.Get(SectionName.c_str(), "NoTriggerFilter", &bNoTriggerFilter, false);
// Don't update this when we are loading settings from the ConfigBox
if(!ChangePad)
@ -91,7 +92,6 @@ void Config::Load(bool ChangePad)
iniFile.Get(SectionName.c_str(), "TriggerType", &WiiMoteEmu::PadMapping[i].triggertype, 0);
iniFile.Get(SectionName.c_str(), "Diagonal", &WiiMoteEmu::PadMapping[i].SDiagonal, "100%");
iniFile.Get(SectionName.c_str(), "SquareToCircle", &WiiMoteEmu::PadMapping[i].bSquareToCircle, false);
iniFile.Get(SectionName.c_str(), "NoTriggerFilter", &WiiMoteEmu::PadMapping[i].bNoTriggerFilter, false);
}
// =============================
Console::Print("Load()\n");
@ -124,6 +124,7 @@ void Config::Save()
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
std::string SectionName = StringFromFormat("Wiimote%i", i + 1);
iniFile.Set(SectionName.c_str(), "Enabled", WiiMoteEmu::PadMapping[i].enabled);
iniFile.Set(SectionName.c_str(), "NoTriggerFilter", bNoTriggerFilter);
// Save the physical device ID number
iniFile.Set(SectionName.c_str(), "DeviceID", WiiMoteEmu::PadMapping[i].ID);
@ -154,7 +155,6 @@ void Config::Save()
iniFile.Set(SectionName.c_str(), "TriggerType", WiiMoteEmu::PadMapping[i].triggertype);
//iniFile.Set(SectionName.c_str(), "Diagonal", PadMapping[i].SDiagonal);
//iniFile.Set(SectionName.c_str(), "SquareToCircle", PadMapping[i].bSquareToCircle);
iniFile.Set(SectionName.c_str(), "NoTriggerFilter", WiiMoteEmu::PadMapping[i].bNoTriggerFilter);
// ======================================
}

View File

@ -33,6 +33,9 @@ struct Config
bool bConnectRealWiimote, bUseRealWiimote, bUpdateRealWiimote;
int iAccNeutralX, iAccNeutralY, iAccNeutralZ;
int iAccNunNeutralX, iAccNunNeutralY, iAccNunNeutralZ;
// Gamepad
bool bNoTriggerFilter;
};
extern Config g_Config;

View File

@ -254,7 +254,7 @@ void ConfigDialog::DoGetButtons(int GetId)
bool Hat = false; // No hats allowed
bool NoTriggerFilter = WiiMoteEmu::PadMapping[Controller].bNoTriggerFilter;
bool NoTriggerFilter = g_Config.bNoTriggerFilter;
// Values used in this function
char format[128];

View File

@ -109,6 +109,7 @@ void Config::Save(int Slot)
file.Set("General", "ShowAdvanced", g_Config.bShowAdvanced);
file.Set("General", "SaveByID", g_Config.bSaveByID);
file.Set("General", "CheckForFocus", g_Config.bCheckFocus);
file.Set("General", "NoTriggerFilter", g_Config.bNoTriggerFilter);
// ========================
for (int i = 0; i < 4; i++)
@ -167,8 +168,7 @@ void Config::Save(int Slot)
file.Set(SectionName.c_str(), "eventnum", PadMapping[i].eventnum);
file.Set(SectionName.c_str(), "Diagonal", PadMapping[i].SDiagonal);
file.Set(SectionName.c_str(), "SquareToCircle", PadMapping[i].bSquareToCircle);
file.Set(SectionName.c_str(), "AdvancedMapFilter", PadMapping[i].bNoTriggerFilter);
file.Set(SectionName.c_str(), "SquareToCircle", PadMapping[i].bSquareToCircle);
// ======================================
// Debugging
@ -197,6 +197,8 @@ void Config::Load(bool ChangePad, bool ChangeSaveByID)
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
file.Get("General", "ShowAdvanced", &g_Config.bShowAdvanced, false);
file.Get("General", "CheckForFocus", &g_Config.bCheckFocus, false);
file.Get("General", "NoTriggerFilter", &g_Config.bNoTriggerFilter, false);
if(!ChangeSaveByID)
{
file.Get("General", "SaveByID", &Tmp, false); g_Config.bSaveByID = Tmp;
@ -255,7 +257,6 @@ void Config::Load(bool ChangePad, bool ChangeSaveByID)
file.Get(SectionName.c_str(), "Diagonal", &PadMapping[i].SDiagonal, "100%");
file.Get(SectionName.c_str(), "SquareToCircle", &Tmp, false); PadMapping[i].bSquareToCircle = Tmp;
file.Get(SectionName.c_str(), "AdvancedMapFilter", &Tmp, false); PadMapping[i].bNoTriggerFilter = Tmp;
// =============================
// Debugging

View File

@ -29,6 +29,7 @@ struct Config
bool bShowAdvanced; // Only allow one of these
bool bSaveByID;
bool bCheckFocus;
bool bNoTriggerFilter;
};
extern Config g_Config;

View File

@ -426,6 +426,7 @@ void ConfigBox::ChangeSettings( wxCommandEvent& event )
}
SizeWindow();
break;
// Advanced settings
case IDCB_CHECKFOCUS:
g_Config.bCheckFocus = m_CBCheckFocus[notebookpage]->IsChecked();
for(int i = 0; i < 4; i++)
@ -433,9 +434,21 @@ void ConfigBox::ChangeSettings( wxCommandEvent& event )
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:
case IDC_TRIGGERTYPE:
//UpdateGUI(notebookpage);
if(!g_Config.bSaveByID)
{
PadMapping[notebookpage].controllertype = m_ControlType[notebookpage]->GetSelection();
UpdateGUI(notebookpage);
}
break;
case IDC_JOYNAME:
@ -506,6 +519,7 @@ void ConfigBox::UpdateGUI(int _notebookpage)
m_CBSaveByID[_notebookpage]->SetValue(g_Config.bSaveByID);
m_CBShowAdvanced[_notebookpage]->SetValue(g_Config.bShowAdvanced);
m_CBCheckFocus[_notebookpage]->SetValue(g_Config.bCheckFocus);
m_AdvancedMapFilter[_notebookpage]->SetValue(g_Config.bNoTriggerFilter);
LogMsg("Update: %i\n", g_Config.bSaveByID);

View File

@ -79,14 +79,14 @@ void ConfigBox::UpdateGUIButtonMapping(int controller)
m_Deadzone[controller]->SetSelection(PadMapping[controller].deadzone);
m_CoBDiagonal[controller]->SetValue(wxString::FromAscii(PadMapping[controller].SDiagonal.c_str()));
m_CBS_to_C[controller]->SetValue(PadMapping[controller].bSquareToCircle);
m_AdvancedMapFilter[controller]->SetValue(PadMapping[controller].bNoTriggerFilter);
m_AdvancedMapFilter[controller]->SetValue(g_Config.bNoTriggerFilter);
//LogMsg("m_TriggerType[%i] = %i\n", controller, PadMapping[controller].triggertype);
// Update D-Pad
if(PadMapping[controller].controllertype == InputCommon::CTL_DPAD_HAT)
{
tmp << PadMapping[controller].dpad; m_JoyDpadUp[controller]->SetValue(tmp); tmp.clear();
tmp << PadMapping[controller].dpad; m_JoyDpadDown[controller]->SetValue(tmp); tmp.clear();
}
else
{
@ -122,8 +122,7 @@ void ConfigBox::SaveButtonMapping(int controller, bool DontChangeId, int FromSlo
PadMapping[controller].triggertype = m_TriggerType[FromSlot]->GetSelection();
PadMapping[controller].deadzone = m_Deadzone[FromSlot]->GetSelection();
PadMapping[controller].SDiagonal = m_CoBDiagonal[FromSlot]->GetLabel().mb_str();
PadMapping[controller].bSquareToCircle = m_CBS_to_C[FromSlot]->IsChecked();
PadMapping[controller].bNoTriggerFilter = m_AdvancedMapFilter[FromSlot]->IsChecked();
PadMapping[controller].bSquareToCircle = m_CBS_to_C[FromSlot]->IsChecked();
// The analog buttons
m_JoyAnalogMainX[FromSlot]->GetValue().ToLong(&value); PadMapping[controller].axis[InputCommon::CTL_MAIN_X] = value; tmp.clear();
@ -152,7 +151,7 @@ void ConfigBox::SaveButtonMapping(int controller, bool DontChangeId, int FromSlo
// The digital pad
if(PadMapping[controller].controllertype == InputCommon::CTL_DPAD_HAT)
{
m_JoyDpadUp[FromSlot]->GetValue().ToLong(&value); PadMapping[controller].dpad = value; tmp.clear();
m_JoyDpadDown[FromSlot]->GetValue().ToLong(&value); PadMapping[controller].dpad = value; tmp.clear();
}
else
{
@ -297,7 +296,7 @@ void ConfigBox::DoGetButtons(int GetId)
bool Hat = (GetId >= IDB_DPAD_UP && GetId <= IDB_DPAD_RIGHT) // All DPads
&& (PadMapping[Controller].controllertype == InputCommon::CTL_DPAD_HAT); // Not with the hat option defined
bool NoTriggerFilter = PadMapping[Controller].bNoTriggerFilter;
bool NoTriggerFilter = g_Config.bNoTriggerFilter;
// Values used in this function
char format[128];