remove PAD_GetAttachedPads() from PadSimple and nJoy (and plugin specs). It hasn't done anything except get in the way/cause confusion since changing SI devices was added. Also I declare PadSimpleEvent and nJoy .4 as dead/rotting code. someone can feel free to prove me wrong...but know they are on my hitlist :p

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3739 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman
2009-07-11 00:27:32 +00:00
parent 6a4bf11d3b
commit 2a236a4631
15 changed files with 34 additions and 176 deletions

View File

@ -127,7 +127,6 @@ void Config::Save(int Slot)
// Slot specific settings only
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::string SectionName = StringFromFormat("PAD%i", i+1);
file.Set(SectionName.c_str(), "enabled", PadMapping[i].enabled);
// Save the physical device ID
file.Set(SectionName.c_str(), "joy_id", PadMapping[i].ID);
@ -228,10 +227,9 @@ void Config::Load(bool ChangePad, bool ChangeSaveByID)
std::string SectionName = StringFromFormat("PAD%i", i+1);
// Don't update this when we are loading settings from the PADConfigDialognJoy
if(!ChangePad)
if (!ChangePad)
{
file.Get(SectionName.c_str(), "joy_id", &PadMapping[i].ID, 0);
file.Get(SectionName.c_str(), "enabled", &PadMapping[i].enabled, 1);
}
// ==================================================================

View File

@ -58,15 +58,6 @@ void PADConfigDialognJoy::PadGetStatus()
return;
}
// Return if it's not enabled
if (!PadMapping[notebookpage].enabled)
{
m_TStatusIn[notebookpage]->SetLabel(wxT("Not enabled")); m_TStatusOut[notebookpage]->SetLabel(wxT("Not enabled"));
m_TStatusInC[notebookpage]->SetLabel(wxT("Not enabled")); m_TStatusOutC[notebookpage]->SetLabel(wxT("Not enabled"));
m_TStatusTriggers[notebookpage]->SetLabel(wxT("Not enabled"));
return;
}
// Get physical device status
int PhysicalDevice = PadMapping[notebookpage].ID;
int TriggerType = PadMapping[notebookpage].triggertype;
@ -171,9 +162,6 @@ void PADConfigDialognJoy::PadGetStatus()
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::string ShowStatus(int VirtualController)
{
// Check if it's enabled
if (!PadMapping[VirtualController].enabled) return StringFromFormat("%i disabled", VirtualController);
// Save the physical device
int PhysicalDevice = PadMapping[VirtualController].ID;
@ -221,9 +209,7 @@ std::string ShowStatus(int VirtualController)
}
return StringFromFormat(
//"Version: %i.%i.%i\n"
"All pads:\n"
"Enabled: %i %i %i %i\n"
"ID: %i %i %i %i\n"
"Controllertype: %i %i %i %i\n"
"SquareToCircle: %i %i %i %i\n\n"
@ -237,8 +223,6 @@ std::string ShowStatus(int VirtualController)
"Hats: %s\n"
"But: %s\n"
"Device: Ax: %i Balls:%i Hats:%i But:%i",
//Version.major, Version.minor, Version.patch,
PadMapping[0].enabled, PadMapping[1].enabled, PadMapping[2].enabled, PadMapping[3].enabled,
PadMapping[0].ID, PadMapping[1].ID, PadMapping[2].ID, PadMapping[3].ID,
PadMapping[0].controllertype, PadMapping[1].controllertype, PadMapping[2].controllertype, PadMapping[3].controllertype,
PadMapping[0].bSquareToCircle, PadMapping[1].bSquareToCircle, PadMapping[2].bSquareToCircle, PadMapping[3].bSquareToCircle,

View File

@ -56,9 +56,8 @@ BEGIN_EVENT_TABLE(PADConfigDialognJoy,wxDialog)
EVT_BUTTON(ID_CANCEL, PADConfigDialognJoy::CancelClick)
EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, PADConfigDialognJoy::NotebookPageChanged)
// Change and enable or disable gamepad
// Change gamepad
EVT_COMBOBOX(IDC_JOYNAME, PADConfigDialognJoy::ChangeSettings)
EVT_CHECKBOX(IDC_JOYATTACH, PADConfigDialognJoy::ChangeSettings)
// Other settings
EVT_CHECKBOX(IDC_SAVEBYID, PADConfigDialognJoy::ChangeSettings)
@ -298,18 +297,12 @@ void PADConfigDialognJoy::OnSaveById()
the plugin. Joyinfo[].joy is only used the first time the pads are checked. */
void PADConfigDialognJoy::DoChangeJoystick()
{
// Close the current pad, unless it's used by another slot
//if (PadMapping[notebookpage].enabled) PadClose(notebookpage);
// Before changing the pad we save potential changes to the current pad (to support SaveByID)
DoSave(true);
// Load the settings for the new Id
g_Config.Load(true);
UpdateGUI(notebookpage); // Update the GUI
// Open the new pad
if (PadMapping[notebookpage].enabled) PadOpen(notebookpage);
}
void PADConfigDialognJoy::PadOpen(int Open) // Open for slot 1, 2, 3 or 4
{
@ -481,15 +474,6 @@ void PADConfigDialognJoy::ChangeSettings( wxCommandEvent& event )
case IDC_JOYNAME:
DoChangeJoystick();
break;
case IDC_JOYATTACH:
// We will enable this device
int Enable = PadMapping[notebookpage].enabled = !PadMapping[notebookpage].enabled;
// Close or open pad handle
if(Enable) PadOpen(notebookpage); else PadClose(notebookpage);
// Update the GUI
UpdateGUI(notebookpage);
return; // Don't save this for all slots
}
// Update all slots that use this device
@ -550,25 +534,6 @@ void PADConfigDialognJoy::UpdateGUI(int _notebookpage)
m_CheckPlayback[_notebookpage]->SetValue(g_Config.bPlayback);
#endif
// There is no FindItem in linux so this doesn't work
#ifdef _WIN32
// Disabled pages
bool Enabled = PadMapping[_notebookpage].enabled == 1 ? true : false;
// Enable or disable all buttons
for(int i = IDB_ANALOG_MAIN_X; i <= IDB_BUTTONHALFPRESS; i++)
m_Controller[_notebookpage]->FindItem(i)->Enable(Enabled);
// Controller type settings
m_Controller[_notebookpage]->FindItem(IDC_DEADZONE)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDC_CONTROLTYPE)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDC_TRIGGERTYPE)->Enable(Enabled && XInput);
m_Controller[_notebookpage]->FindItem(IDCB_MAINSTICK_RADIUS)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDCB_MAINSTICK_CB_RADIUS)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDCB_MAINSTICK_DIAGONAL)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDCB_MAINSTICK_S_TO_C)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDCB_FILTER_SETTINGS)->Enable(Enabled);
#endif
// Replace the harder to understand -1 with "" for the sake of user friendliness
ToBlank();
@ -597,10 +562,7 @@ void PADConfigDialognJoy::OnPaint(wxPaintEvent &event)
wxPaintDC dcWin(m_pKeys[notebookpage]);
PrepareDC( dcWin );
if(PadMapping[notebookpage].enabled)
dcWin.DrawBitmap( WxStaticBitmap1_BITMAP, 94, 0, true );
else
dcWin.DrawBitmap( WxStaticBitmap1_BITMAPGray, 94, 0, true );
dcWin.DrawBitmap( WxStaticBitmap1_BITMAP, 94, 0, true );
}
// Populate the config window
@ -650,11 +612,6 @@ void PADConfigDialognJoy::CreateGUIControls()
// Define bitmap for EVT_PAINT
WxStaticBitmap1_BITMAP = wxBitmap(ConfigBox_WxStaticBitmap1_XPM);
// Gray version
wxImage WxImageGray = WxStaticBitmap1_BITMAP.ConvertToImage();
WxImageGray = WxImageGray.ConvertToGreyscale();
WxStaticBitmap1_BITMAPGray = wxBitmap(WxImageGray);
// Search for devices and add them to the device list
wxArrayString arrayStringFor_Joyname; // The string array
if(NumGoodPads > 0)
@ -808,16 +765,12 @@ void PADConfigDialognJoy::CreateGUIControls()
// 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_Joyattach[i] = new wxCheckBox(m_Controller[i], IDC_JOYATTACH, wxT("Controller attached"), wxDefaultPosition, wxSize(109, 25));
#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_Joyattach[i] = new wxCheckBox(m_Controller[i], IDC_JOYATTACH, wxT("Controller attached"), wxDefaultPosition, wxSize(140, 25), 0, wxDefaultValidator, wxT("Controller attached"));
#endif
m_Joyattach[i]->SetToolTip(wxString::Format(wxT("Decide if Controller %i shall be detected by the game."), i + 1));
m_gJoyname[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Controller"));
m_gJoyname[i]->Add(m_Joyname[i], 0, (wxLEFT | wxRIGHT), 5);
m_gJoyname[i]->Add(m_Joyattach[i], 0, (wxRIGHT | wxLEFT | wxBOTTOM), 1);
m_Joyname[i]->SetToolTip(wxT("Save your settings and configure another joypad"));
@ -1042,14 +995,6 @@ void PADConfigDialognJoy::CreateGUIControls()
// Show or hide it. We have to do this after we add it to its sizer
m_sMainRight[i]->Show(g_Config.bShowAdvanced);
// Don't allow these changes when running
if(g_EmulatorRunning)
{
//m_Joyname[i]->Enable(false);
m_Joyattach[i]->Enable(false);
//m_ControlType[i]->Enable(false);
}
// Update GUI
UpdateGUI(i);
} // end of loop

View File

@ -90,7 +90,7 @@ class PADConfigDialognJoy : public wxDialog
wxBoxSizer * m_MainSizer;
wxPanel *m_pKeys[4], *m_pInStatus[4], *m_pOutStatus[4], *m_pInStatusC[4], *m_pOutStatusC[4];
wxBitmap WxStaticBitmap1_BITMAP, WxStaticBitmap1_BITMAPGray;
wxBitmap WxStaticBitmap1_BITMAP;
wxStaticBoxSizer * m_sKeys[4];
wxBoxSizer *m_sMain[4], *m_sMainLeft[4], *m_sMainRight[4];
@ -101,8 +101,7 @@ class PADConfigDialognJoy : public wxDialog
wxComboBox *m_Joyname[4];
wxComboBox *m_ControlType[4], *m_TriggerType[4];
wxComboBox *m_Deadzone[4];
wxCheckBox *m_Joyattach[4]; // Attached pad
wxStaticBoxSizer *m_gJoyname[4];
wxStaticBoxSizer *m_gExtrasettings[4]; // Extra settings
@ -218,7 +217,7 @@ class PADConfigDialognJoy : public wxDialog
ID_KEYSPANEL1, ID_KEYSPANEL2, ID_KEYSPANEL3, ID_KEYSPANEL4,
IDG_JOYSTICK, IDC_JOYNAME, IDC_JOYATTACH, // Controller attached
IDG_JOYSTICK, IDC_JOYNAME,
IDG_EXTRASETTINGS, IDC_DEADZONE, // Extra settings

View File

@ -53,9 +53,6 @@ void PADConfigDialognJoy::UpdateGUIButtonMapping(int controller)
// Update selected gamepad
m_Joyname[controller]->SetSelection(PadMapping[controller].ID);
// Update the enabled checkbox
m_Joyattach[controller]->SetValue(PadMapping[controller].enabled == 1 ? true : false);
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();
@ -110,8 +107,7 @@ void PADConfigDialognJoy::UpdateGUIButtonMapping(int controller)
}
/* Populate the PadMapping array with the dialog items settings (for example
selected joystick, enabled or disabled status and so on) */
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
selected joystick and so on) */
void PADConfigDialognJoy::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot)
{
// Temporary storage
@ -124,9 +120,8 @@ void PADConfigDialognJoy::SaveButtonMapping(int controller, bool DontChangeId, i
// Replace "" with "-1" in the GUI controls
ToBlank(false);
// Set enabled or disable status and other settings
// Set other settings
if(!DontChangeId) PadMapping[controller].ID = m_Joyname[FromSlot]->GetSelection();
if(FromSlot == controller) PadMapping[controller].enabled = m_Joyattach[FromSlot]->GetValue(); // Only enable one
PadMapping[controller].controllertype = m_ControlType[FromSlot]->GetSelection();
PadMapping[controller].triggertype = m_TriggerType[FromSlot]->GetSelection();
PadMapping[controller].deadzone = m_Deadzone[FromSlot]->GetSelection();

View File

@ -343,10 +343,8 @@ BOOL CALLBACK EnumFFDevicesCallback(const DIDEVICEINSTANCE* pInst, VOID* pContex
{
// a DInput device is created even if rumble is disabled on startup
// this way, you can toggle the rumble setting while in game
if (PadMapping[i].enabled) // && PadMapping[i].rumble
{
//if (PadMapping[i].enabled) // && PadMapping[i].rumble
pRumble[i].g_pDevice = pDevice; // everything looks good, save the DInput device
}
}
}

View File

@ -311,7 +311,7 @@ void Shutdown()
vector elements or any bad devices */
for (int i = 0; i < 4; 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)
if(SDL_JoystickOpened(PadMapping[i].ID))
{
@ -376,25 +376,6 @@ void DoState(unsigned char **ptr, int mode)
#endif
}
// Set PAD attached pads
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned int PAD_GetAttachedPads()
{
unsigned int connected = 0;
g_Config.Load();
if (PadMapping[0].enabled) connected |= 1;
if (PadMapping[1].enabled) connected |= 2;
if (PadMapping[2].enabled) connected |= 4;
if (PadMapping[3].enabled) connected |= 8;
//INFO_LOG(CONSOLE, "PAD_GetAttachedPads: %i %i %i %i\n", PadMapping[0].enabled, PadMapping[1].enabled, PadMapping[2].enabled, PadMapping[3].enabled);
return connected;
}
// Set PAD status
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -404,9 +385,9 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
{
//INFO_LOG(CONSOLE, "PAD_GetStatus(): %i %i %i\n", _numPAD, PadMapping[_numPAD].enabled, PadState[_numPAD].joy);
/* Check if the pad is enabled and avaliable, currently we don't disable pads just because they are
/* Check if the pad is avaliable, currently we don't disable pads just because they are
disconnected */
if (!PadMapping[_numPAD].enabled || !PadState[_numPAD].joy) return;
if (!PadState[_numPAD].joy) return;
// -------------------------------------------
// Play back input instead of accepting any user input
@ -629,7 +610,7 @@ bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_N
// Update the PadState[].joy handle
for (int i = 0; i < 4; 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);
}
@ -644,10 +625,10 @@ bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_N
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool ReloadDLL()
{
if ( (PadMapping[0].enabled && PadState[0].joy == NULL)
|| (PadMapping[1].enabled && PadState[1].joy == NULL)
|| (PadMapping[2].enabled && PadState[2].joy == NULL)
|| (PadMapping[3].enabled && PadState[3].joy == NULL))
if ( (PadState[0].joy == NULL)
|| (PadState[1].joy == NULL)
|| (PadState[2].joy == NULL)
|| (PadState[3].joy == NULL))
{
// Check if it was an error and not just no pads connected
std::string StrError = SDL_GetError();