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

@ -19,23 +19,22 @@
namespace Common namespace Common
{ {
PluginPAD::PluginPAD(const char *_Filename) : CPlugin(_Filename), validPAD(false)
{
PAD_GetStatus = reinterpret_cast<TPAD_GetStatus>
(LoadSymbol("PAD_GetStatus"));
PAD_Input = reinterpret_cast<TPAD_Input>
(LoadSymbol("PAD_Input"));
PAD_Rumble = reinterpret_cast<TPAD_Rumble>
(LoadSymbol("PAD_Rumble"));
PAD_GetAttachedPads = reinterpret_cast<TPAD_GetAttachedPads>
(LoadSymbol("PAD_GetAttachedPads"));
if ((PAD_GetStatus != 0) && PluginPAD::PluginPAD(const char *_Filename) : CPlugin(_Filename), validPAD(false)
(PAD_Input != 0) && {
(PAD_Rumble != 0) && PAD_GetStatus = reinterpret_cast<TPAD_GetStatus>
(PAD_GetAttachedPads != 0)) (LoadSymbol("PAD_GetStatus"));
validPAD = true; PAD_Input = reinterpret_cast<TPAD_Input>
} (LoadSymbol("PAD_Input"));
PAD_Rumble = reinterpret_cast<TPAD_Rumble>
(LoadSymbol("PAD_Rumble"));
if ((PAD_GetStatus != 0) &&
(PAD_Input != 0) &&
(PAD_Rumble != 0))
validPAD = true;
}
PluginPAD::~PluginPAD() {}
PluginPAD::~PluginPAD() {}
} // Namespace } // Namespace

View File

@ -26,7 +26,6 @@ namespace Common {
typedef void (__cdecl* TPAD_GetStatus)(u8, SPADStatus*); typedef void (__cdecl* TPAD_GetStatus)(u8, SPADStatus*);
typedef void (__cdecl* TPAD_Input)(u16, u8); typedef void (__cdecl* TPAD_Input)(u16, u8);
typedef void (__cdecl* TPAD_Rumble)(u8, unsigned int, unsigned int); typedef void (__cdecl* TPAD_Rumble)(u8, unsigned int, unsigned int);
typedef unsigned int (__cdecl* TPAD_GetAttachedPads)();
class PluginPAD : public CPlugin { class PluginPAD : public CPlugin {
public: public:
@ -37,7 +36,6 @@ public:
TPAD_GetStatus PAD_GetStatus; TPAD_GetStatus PAD_GetStatus;
TPAD_Input PAD_Input; TPAD_Input PAD_Input;
TPAD_Rumble PAD_Rumble; TPAD_Rumble PAD_Rumble;
TPAD_GetAttachedPads PAD_GetAttachedPads;
private: private:
bool validPAD; bool validPAD;

View File

@ -85,7 +85,6 @@ struct CONTROLLER_MAPPING // GC PAD MAPPING
int dpad2[4]; // (See above) int dpad2[4]; // (See above)
int axis[6]; // (See above) int axis[6]; // (See above)
int halfpress; // (See above) int halfpress; // (See above)
int enabled; // Pad attached?
int deadzone; // Deadzone... what else? int deadzone; // Deadzone... what else?
int ID; // SDL joystick device ID int ID; // SDL joystick device ID
int controllertype; // Hat: Hat or custom buttons int controllertype; // Hat: Hat or custom buttons

View File

@ -80,13 +80,5 @@ EXPORT void CALL PAD_Input(u16 _Key, u8 _UpDown);
// //
EXPORT void CALL PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength); EXPORT void CALL PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength);
// __________________________________________________________________________________________________
// Function: PAD_GetAttachedPads
// Purpose: Get mask of attached pads (eg: controller 1 & 4 -> 0x9)
// input: none
// output: number of pads
//
EXPORT unsigned int CALL PAD_GetAttachedPads();
#include "ExportEpilog.h" #include "ExportEpilog.h"
#endif #endif

View File

@ -31,7 +31,6 @@ BEGIN_EVENT_TABLE(PADConfigDialogSimple,wxDialog)
EVT_BUTTON(ID_CLOSE,PADConfigDialogSimple::OnCloseClick) EVT_BUTTON(ID_CLOSE,PADConfigDialogSimple::OnCloseClick)
EVT_BUTTON(ID_PAD_ABOUT,PADConfigDialogSimple::DllAbout) EVT_BUTTON(ID_PAD_ABOUT,PADConfigDialogSimple::DllAbout)
EVT_CHECKBOX(ID_ATTACHED,PADConfigDialogSimple::ControllerSettingsChanged)
EVT_CHECKBOX(ID_X360PAD,PADConfigDialogSimple::ControllerSettingsChanged) EVT_CHECKBOX(ID_X360PAD,PADConfigDialogSimple::ControllerSettingsChanged)
EVT_CHOICE(ID_X360PAD_CHOICE,PADConfigDialogSimple::ControllerSettingsChanged) EVT_CHOICE(ID_X360PAD_CHOICE,PADConfigDialogSimple::ControllerSettingsChanged)
EVT_CHECKBOX(ID_RUMBLE,PADConfigDialogSimple::ControllerSettingsChanged) EVT_CHECKBOX(ID_RUMBLE,PADConfigDialogSimple::ControllerSettingsChanged)
@ -175,13 +174,11 @@ void PADConfigDialogSimple::CreateGUIControls()
sDevice[i] = new wxBoxSizer(wxHORIZONTAL); sDevice[i] = new wxBoxSizer(wxHORIZONTAL);
sbDevice[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Controller Settings")); sbDevice[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Controller Settings"));
m_Attached[i] = new wxCheckBox(m_Controller[i], ID_ATTACHED, wxT("Controller attached"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Disable[i] = new wxCheckBox(m_Controller[i], ID_DISABLE, wxT("Disable when Dolphin is not in focus"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_Disable[i] = new wxCheckBox(m_Controller[i], ID_DISABLE, wxT("Disable when Dolphin is not in focus"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
sbDevice[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1);
sbDevice[i]->Add(m_Disable[i], 0, wxEXPAND|wxALL, 1); sbDevice[i]->Add(m_Disable[i], 0, wxEXPAND|wxALL, 1);
#ifdef _WIN32 #ifdef _WIN32
m_SizeXInput[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("XInput Pad")); m_SizeXInput[i] = new wxStaticBoxSizer(wxHORIZONTAL, m_Controller[i], wxT("XInput Pad"));
m_X360Pad[i] = new wxCheckBox(m_Controller[i], ID_X360PAD, wxT("Enable X360Pad"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_X360Pad[i] = new wxCheckBox(m_Controller[i], ID_X360PAD, wxT("Enable X360Pad"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_X360PadC[i] = new wxChoice(m_Controller[i], ID_X360PAD_CHOICE, wxDefaultPosition, wxDefaultSize, arrayStringFor_X360Pad, 0, wxDefaultValidator); m_X360PadC[i] = new wxChoice(m_Controller[i], ID_X360PAD_CHOICE, wxDefaultPosition, wxDefaultSize, arrayStringFor_X360Pad, 0, wxDefaultValidator);
m_Rumble[i] = new wxCheckBox(m_Controller[i], ID_RUMBLE, wxT("Enable rumble"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_Rumble[i] = new wxCheckBox(m_Controller[i], ID_RUMBLE, wxT("Enable rumble"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
@ -191,7 +188,6 @@ void PADConfigDialogSimple::CreateGUIControls()
m_SizeXInput[i]->Add(m_Rumble[i], 0, wxEXPAND | wxALL, 1); m_SizeXInput[i]->Add(m_Rumble[i], 0, wxEXPAND | wxALL, 1);
#endif #endif
// Set values // Set values
m_Attached[i]->SetValue(pad[i].bAttached);
m_Disable[i]->SetValue(pad[i].bDisable); m_Disable[i]->SetValue(pad[i].bDisable);
#ifdef _WIN32 #ifdef _WIN32
@ -398,9 +394,6 @@ void PADConfigDialogSimple::ControllerSettingsChanged(wxCommandEvent& event)
switch (event.GetId()) switch (event.GetId())
{ {
// General settings // General settings
case ID_ATTACHED:
pad[page].bAttached = m_Attached[page]->GetValue();
break;
case ID_DISABLE: case ID_DISABLE:
pad[page].bDisable = m_Disable[page]->GetValue(); pad[page].bDisable = m_Disable[page]->GetValue();
break; break;

View File

@ -63,7 +63,6 @@ class PADConfigDialogSimple : public wxDialog
wxArrayString arrayStringFor_X360Pad; wxArrayString arrayStringFor_X360Pad;
wxCheckBox *m_X360Pad[4]; wxCheckBox *m_X360Pad[4];
wxChoice *m_X360PadC[4]; wxChoice *m_X360PadC[4];
wxCheckBox *m_Attached[4];
wxCheckBox *m_Disable[4]; wxCheckBox *m_Disable[4];
wxCheckBox *m_Rumble[4]; wxCheckBox *m_Rumble[4];
@ -115,7 +114,6 @@ class PADConfigDialogSimple : public wxDialog
ID_SAVE_RECORDING, ID_SAVE_RECORDING,
// General settings // General settings
ID_ATTACHED,
ID_DISABLE, ID_DISABLE,
ID_PAD_ABOUT ID_PAD_ABOUT
}; };

View File

@ -823,24 +823,6 @@ void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
#endif #endif
} }
unsigned int PAD_GetAttachedPads()
{
unsigned int connected = 0;
LoadConfig();
if(pad[0].bAttached)
connected |= 1;
if(pad[1].bAttached)
connected |= 2;
if(pad[2].bAttached)
connected |= 4;
if(pad[3].bAttached)
connected |= 8;
return connected;
}
//****************************************************************************** //******************************************************************************
// Load and save the configuration // Load and save the configuration
//****************************************************************************** //******************************************************************************
@ -936,7 +918,6 @@ void LoadConfig()
sprintf(SectionName, "PAD%i", i+1); sprintf(SectionName, "PAD%i", i+1);
file.Get(SectionName, "UseXPad", &pad[i].bEnableXPad, i==0); file.Get(SectionName, "UseXPad", &pad[i].bEnableXPad, i==0);
file.Get(SectionName, "Attached", &pad[i].bAttached, i==0);
file.Get(SectionName, "DisableOnBackground", &pad[i].bDisable, false); file.Get(SectionName, "DisableOnBackground", &pad[i].bDisable, false);
file.Get(SectionName, "Rumble", &pad[i].bRumble, true); file.Get(SectionName, "Rumble", &pad[i].bRumble, true);
file.Get(SectionName, "RumbleStrength", &pad[i].RumbleStrength, 8000); file.Get(SectionName, "RumbleStrength", &pad[i].RumbleStrength, 8000);
@ -972,7 +953,6 @@ void SaveConfig()
sprintf(SectionName, "PAD%i", i+1); sprintf(SectionName, "PAD%i", i+1);
file.Set(SectionName, "UseXPad", pad[i].bEnableXPad); file.Set(SectionName, "UseXPad", pad[i].bEnableXPad);
file.Set(SectionName, "Attached", pad[i].bAttached);
file.Set(SectionName, "DisableOnBackground", pad[i].bDisable); file.Set(SectionName, "DisableOnBackground", pad[i].bDisable);
file.Set(SectionName, "Rumble", pad[i].bRumble); file.Set(SectionName, "Rumble", pad[i].bRumble);
file.Set(SectionName, "RumbleStrength", pad[i].RumbleStrength); file.Set(SectionName, "RumbleStrength", pad[i].RumbleStrength);

View File

@ -78,7 +78,6 @@ static const char* controlNames[] =
struct SPads struct SPads
{ {
bool bEnableXPad; // Use an XPad in addition to the keyboard? bool bEnableXPad; // Use an XPad in addition to the keyboard?
bool bAttached; // Pad is "attached" to the gamecube/wii
bool bDisable; // Disabled when dolphin isn't in focus bool bDisable; // Disabled when dolphin isn't in focus
bool bRumble; // Rumble for xpad bool bRumble; // Rumble for xpad
unsigned int RumbleStrength; // Rumble strength unsigned int RumbleStrength; // Rumble strength

View File

@ -127,7 +127,6 @@ void Config::Save(int Slot)
// Slot specific settings only // Slot specific settings only
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
std::string SectionName = StringFromFormat("PAD%i", i+1); std::string SectionName = StringFromFormat("PAD%i", i+1);
file.Set(SectionName.c_str(), "enabled", PadMapping[i].enabled);
// Save the physical device ID // Save the physical device ID
file.Set(SectionName.c_str(), "joy_id", PadMapping[i].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); std::string SectionName = StringFromFormat("PAD%i", i+1);
// Don't update this when we are loading settings from the PADConfigDialognJoy // 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(), "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;
} }
// 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 // Get physical device status
int PhysicalDevice = PadMapping[notebookpage].ID; int PhysicalDevice = PadMapping[notebookpage].ID;
int TriggerType = PadMapping[notebookpage].triggertype; int TriggerType = PadMapping[notebookpage].triggertype;
@ -171,9 +162,6 @@ void PADConfigDialognJoy::PadGetStatus()
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
std::string ShowStatus(int VirtualController) std::string ShowStatus(int VirtualController)
{ {
// Check if it's enabled
if (!PadMapping[VirtualController].enabled) return StringFromFormat("%i disabled", VirtualController);
// Save the physical device // Save the physical device
int PhysicalDevice = PadMapping[VirtualController].ID; int PhysicalDevice = PadMapping[VirtualController].ID;
@ -221,9 +209,7 @@ std::string ShowStatus(int VirtualController)
} }
return StringFromFormat( return StringFromFormat(
//"Version: %i.%i.%i\n"
"All pads:\n" "All pads:\n"
"Enabled: %i %i %i %i\n"
"ID: %i %i %i %i\n" "ID: %i %i %i %i\n"
"Controllertype: %i %i %i %i\n" "Controllertype: %i %i %i %i\n"
"SquareToCircle: %i %i %i %i\n\n" "SquareToCircle: %i %i %i %i\n\n"
@ -237,8 +223,6 @@ std::string ShowStatus(int VirtualController)
"Hats: %s\n" "Hats: %s\n"
"But: %s\n" "But: %s\n"
"Device: Ax: %i Balls:%i Hats:%i But:%i", "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].ID, PadMapping[1].ID, PadMapping[2].ID, PadMapping[3].ID,
PadMapping[0].controllertype, PadMapping[1].controllertype, PadMapping[2].controllertype, PadMapping[3].controllertype, PadMapping[0].controllertype, PadMapping[1].controllertype, PadMapping[2].controllertype, PadMapping[3].controllertype,
PadMapping[0].bSquareToCircle, PadMapping[1].bSquareToCircle, PadMapping[2].bSquareToCircle, PadMapping[3].bSquareToCircle, 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_BUTTON(ID_CANCEL, PADConfigDialognJoy::CancelClick)
EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, PADConfigDialognJoy::NotebookPageChanged) EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, PADConfigDialognJoy::NotebookPageChanged)
// Change and enable or disable gamepad // Change gamepad
EVT_COMBOBOX(IDC_JOYNAME, PADConfigDialognJoy::ChangeSettings) EVT_COMBOBOX(IDC_JOYNAME, PADConfigDialognJoy::ChangeSettings)
EVT_CHECKBOX(IDC_JOYATTACH, PADConfigDialognJoy::ChangeSettings)
// Other settings // Other settings
EVT_CHECKBOX(IDC_SAVEBYID, PADConfigDialognJoy::ChangeSettings) 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. */ the plugin. Joyinfo[].joy is only used the first time the pads are checked. */
void PADConfigDialognJoy::DoChangeJoystick() 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) // Before changing the pad we save potential changes to the current pad (to support SaveByID)
DoSave(true); DoSave(true);
// Load the settings for the new Id // Load the settings for the new Id
g_Config.Load(true); g_Config.Load(true);
UpdateGUI(notebookpage); // Update the GUI 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 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: case IDC_JOYNAME:
DoChangeJoystick(); DoChangeJoystick();
break; 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 // Update all slots that use this device
@ -550,25 +534,6 @@ void PADConfigDialognJoy::UpdateGUI(int _notebookpage)
m_CheckPlayback[_notebookpage]->SetValue(g_Config.bPlayback); m_CheckPlayback[_notebookpage]->SetValue(g_Config.bPlayback);
#endif #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 // Replace the harder to understand -1 with "" for the sake of user friendliness
ToBlank(); ToBlank();
@ -597,10 +562,7 @@ void PADConfigDialognJoy::OnPaint(wxPaintEvent &event)
wxPaintDC dcWin(m_pKeys[notebookpage]); wxPaintDC dcWin(m_pKeys[notebookpage]);
PrepareDC( dcWin ); PrepareDC( dcWin );
if(PadMapping[notebookpage].enabled) dcWin.DrawBitmap( WxStaticBitmap1_BITMAP, 94, 0, true );
dcWin.DrawBitmap( WxStaticBitmap1_BITMAP, 94, 0, true );
else
dcWin.DrawBitmap( WxStaticBitmap1_BITMAPGray, 94, 0, true );
} }
// Populate the config window // Populate the config window
@ -650,11 +612,6 @@ void PADConfigDialognJoy::CreateGUIControls()
// Define bitmap for EVT_PAINT // Define bitmap for EVT_PAINT
WxStaticBitmap1_BITMAP = wxBitmap(ConfigBox_WxStaticBitmap1_XPM); 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 // Search for devices and add them to the device list
wxArrayString arrayStringFor_Joyname; // The string array wxArrayString arrayStringFor_Joyname; // The string array
if(NumGoodPads > 0) if(NumGoodPads > 0)
@ -808,16 +765,12 @@ void PADConfigDialognJoy::CreateGUIControls()
// Groups // Groups
#ifdef _WIN32 #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(476, 21), arrayStringFor_Joyname, wxCB_READONLY);
m_Joyattach[i] = new wxCheckBox(m_Controller[i], IDC_JOYATTACH, wxT("Controller attached"), wxDefaultPosition, wxSize(109, 25));
#else #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(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 #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] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Controller"));
m_gJoyname[i]->Add(m_Joyname[i], 0, (wxLEFT | wxRIGHT), 5); 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")); 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 // Show or hide it. We have to do this after we add it to its sizer
m_sMainRight[i]->Show(g_Config.bShowAdvanced); 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 // Update GUI
UpdateGUI(i); UpdateGUI(i);
} // end of loop } // end of loop

View File

@ -90,7 +90,7 @@ class PADConfigDialognJoy : public wxDialog
wxBoxSizer * m_MainSizer; wxBoxSizer * m_MainSizer;
wxPanel *m_pKeys[4], *m_pInStatus[4], *m_pOutStatus[4], *m_pInStatusC[4], *m_pOutStatusC[4]; 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]; wxStaticBoxSizer * m_sKeys[4];
wxBoxSizer *m_sMain[4], *m_sMainLeft[4], *m_sMainRight[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_Joyname[4];
wxComboBox *m_ControlType[4], *m_TriggerType[4]; wxComboBox *m_ControlType[4], *m_TriggerType[4];
wxComboBox *m_Deadzone[4]; wxComboBox *m_Deadzone[4];
wxCheckBox *m_Joyattach[4]; // Attached pad
wxStaticBoxSizer *m_gJoyname[4]; wxStaticBoxSizer *m_gJoyname[4];
wxStaticBoxSizer *m_gExtrasettings[4]; // Extra settings wxStaticBoxSizer *m_gExtrasettings[4]; // Extra settings
@ -218,7 +217,7 @@ class PADConfigDialognJoy : public wxDialog
ID_KEYSPANEL1, ID_KEYSPANEL2, ID_KEYSPANEL3, ID_KEYSPANEL4, 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 IDG_EXTRASETTINGS, IDC_DEADZONE, // Extra settings

View File

@ -53,9 +53,6 @@ void PADConfigDialognJoy::UpdateGUIButtonMapping(int controller)
// Update selected gamepad // Update selected gamepad
m_Joyname[controller]->SetSelection(PadMapping[controller].ID); 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_L_SHOULDER]; m_JoyShoulderL[controller]->SetValue(tmp); tmp.clear();
tmp << PadMapping[controller].buttons[InputCommon::CTL_R_SHOULDER]; m_JoyShoulderR[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 /* Populate the PadMapping array with the dialog items settings (for example
selected joystick, enabled or disabled status and so on) */ selected joystick and so on) */
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void PADConfigDialognJoy::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot) void PADConfigDialognJoy::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot)
{ {
// Temporary storage // Temporary storage
@ -124,9 +120,8 @@ void PADConfigDialognJoy::SaveButtonMapping(int controller, bool DontChangeId, i
// Replace "" with "-1" in the GUI controls // Replace "" with "-1" in the GUI controls
ToBlank(false); ToBlank(false);
// Set enabled or disable status and other settings // Set other settings
if(!DontChangeId) PadMapping[controller].ID = m_Joyname[FromSlot]->GetSelection(); 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].controllertype = m_ControlType[FromSlot]->GetSelection();
PadMapping[controller].triggertype = m_TriggerType[FromSlot]->GetSelection(); PadMapping[controller].triggertype = m_TriggerType[FromSlot]->GetSelection();
PadMapping[controller].deadzone = m_Deadzone[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 // a DInput device is created even if rumble is disabled on startup
// this way, you can toggle the rumble setting while in game // 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 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 */ vector elements or any bad devices */
for (int i = 0; i < 4; i++) 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 (joyinfo.at(PadMapping[i].ID).Good)
if(SDL_JoystickOpened(PadMapping[i].ID)) if(SDL_JoystickOpened(PadMapping[i].ID))
{ {
@ -376,25 +376,6 @@ void DoState(unsigned char **ptr, int mode)
#endif #endif
} }
// Set PAD attached pads
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
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 // Set PAD status
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@ -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); //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 */ disconnected */
if (!PadMapping[_numPAD].enabled || !PadState[_numPAD].joy) return; if (!PadState[_numPAD].joy) return;
// ------------------------------------------- // -------------------------------------------
// Play back input instead of accepting any user input // 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 // Update the PadState[].joy handle
for (int i = 0; i < 4; i++) 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(joyinfo.at(PadMapping[i].ID).Good)
PadState[i].joy = SDL_JoystickOpen(PadMapping[i].ID); PadState[i].joy = SDL_JoystickOpen(PadMapping[i].ID);
} }
@ -644,10 +625,10 @@ bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_N
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
bool ReloadDLL() bool ReloadDLL()
{ {
if ( (PadMapping[0].enabled && PadState[0].joy == NULL) if ( (PadState[0].joy == NULL)
|| (PadMapping[1].enabled && PadState[1].joy == NULL) || (PadState[1].joy == NULL)
|| (PadMapping[2].enabled && PadState[2].joy == NULL) || (PadState[2].joy == NULL)
|| (PadMapping[3].enabled && PadState[3].joy == NULL)) || (PadState[3].joy == NULL))
{ {
// Check if it was an error and not just no pads connected // Check if it was an error and not just no pads connected
std::string StrError = SDL_GetError(); std::string StrError = SDL_GetError();