merged the halfpress keys down to just one, and tried to set the base for actually having 4 controllers. still need a way to list keyboard+connected xpads in the wxChoice :)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@712 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2008-09-26 14:29:38 +00:00
parent d5116c196c
commit 7a615e9353
3 changed files with 102 additions and 129 deletions

View File

@ -40,21 +40,19 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_BUTTON(CTL_START,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_START,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_L,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_L,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_R,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_R,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_HALFTRIGGER,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_MAINUP,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_MAINUP,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_MAINDOWN,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_MAINDOWN,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_MAINLEFT,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_MAINLEFT,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_MAINRIGHT,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_MAINRIGHT,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_HALFMAIN,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_SUBUP,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_SUBUP,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_SUBDOWN,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_SUBDOWN,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_SUBLEFT,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_SUBLEFT,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_SUBRIGHT,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_SUBRIGHT,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_HALFSUB,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_DPADUP,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_DPADUP,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_DPADDOWN,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_DPADDOWN,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_DPADLEFT,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_DPADLEFT,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_DPADRIGHT,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_DPADRIGHT,ConfigDialog::OnButtonClick)
EVT_BUTTON(CTL_HALFPRESS,ConfigDialog::OnButtonClick)
END_EVENT_TABLE() END_EVENT_TABLE()
ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style) ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
@ -140,7 +138,13 @@ void ConfigDialog::CreateGUIControls()
m_Attached[i]->SetValue(pad[i].attached); m_Attached[i]->SetValue(pad[i].attached);
m_Disable[i]->SetValue(pad[i].disable); m_Disable[i]->SetValue(pad[i].disable);
m_Rumble[i]->SetValue(pad[i].rumble); m_Rumble[i]->SetValue(pad[i].rumble);
m_Rumble[i]->Show(pad[i].type); m_Rumble[i]->Enable(pad[i].type);
//TEMP
m_DeviceName[i]->SetSelection(pad[i].XPad);
for(int x = 0; x < 5; x++)
{
m_DeviceName[i]->Append(wxString::Format("%i", x));
}
sDeviceTop[i]->Add(m_DeviceName[i], 1, wxEXPAND|wxALL, 1); sDeviceTop[i]->Add(m_DeviceName[i], 1, wxEXPAND|wxALL, 1);
sDeviceTop[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1); sDeviceTop[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1);
@ -167,7 +171,7 @@ void ConfigDialog::CreateGUIControls()
sModifiers[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Modifiers")); sModifiers[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Modifiers"));
AddControl(m_Controller[i], &(m_HalfPress[i]), sModifiers[i], "1/2 Press: ", CTL_HALFTRIGGER, i); AddControl(m_Controller[i], &(m_HalfPress[i]), sModifiers[i], "1/2 Press: ", CTL_HALFPRESS, i);
sStick[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Main Stick")); sStick[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Main Stick"));
@ -259,12 +263,14 @@ void ConfigDialog::DeviceChanged(wxCommandEvent& event)
{ {
// Keyboard // Keyboard
pad[page].type = 0; pad[page].type = 0;
m_Rumble[page]->Disable();
} }
else else
{ {
// XPad, so also set xpad number // XPad, so also set xpad number
pad[page].type = 1; pad[page].type = 1;
pad[page].XPad = event.GetSelection() + 1; pad[page].XPad = event.GetSelection() - 1;
m_Rumble[page]->Enable();
} }
} }

View File

@ -257,34 +257,27 @@ void ScaleStickValues(unsigned char* outx,
#ifdef _WIN32 #ifdef _WIN32
void DInput_Read(int _numPad, SPADStatus* _pPADStatus) void DInput_Read(int _numPad, SPADStatus* _pPADStatus)
{ {
/*We can do all now :D
if (_numPad != 0)
{
return;
}*/
dinput.Read(); dinput.Read();
int mainvalue = (dinput.diks[pad[_numPad].keyForControl[CTL_HALFMAIN]] & 0xFF) ? 40 : 100; int stickvalue = (dinput.diks[pad[_numPad].keyForControl[CTL_HALFPRESS]] & 0xFF) ? 40 : 100;
int subvalue = (dinput.diks[pad[_numPad].keyForControl[CTL_HALFSUB]] & 0xFF) ? 40 : 100; int triggervalue = (dinput.diks[pad[_numPad].keyForControl[CTL_HALFPRESS]] & 0xFF) ? 100 : 255;
int triggervalue = (dinput.diks[pad[_numPad].keyForControl[CTL_HALFTRIGGER]] & 0xFF) ? 100 : 255;
// get the new keys // get the new keys
if (dinput.diks[pad[_numPad].keyForControl[CTL_MAINLEFT]] & 0xFF){_pPADStatus->stickX -= mainvalue;} if (dinput.diks[pad[_numPad].keyForControl[CTL_MAINLEFT]] & 0xFF){_pPADStatus->stickX -= stickvalue;}
if (dinput.diks[pad[_numPad].keyForControl[CTL_MAINRIGHT]] & 0xFF){_pPADStatus->stickX += mainvalue;} if (dinput.diks[pad[_numPad].keyForControl[CTL_MAINRIGHT]] & 0xFF){_pPADStatus->stickX += stickvalue;}
if (dinput.diks[pad[_numPad].keyForControl[CTL_MAINDOWN]] & 0xFF){_pPADStatus->stickY -= mainvalue;} if (dinput.diks[pad[_numPad].keyForControl[CTL_MAINDOWN]] & 0xFF){_pPADStatus->stickY -= stickvalue;}
if (dinput.diks[pad[_numPad].keyForControl[CTL_MAINUP]] & 0xFF){_pPADStatus->stickY += mainvalue;} if (dinput.diks[pad[_numPad].keyForControl[CTL_MAINUP]] & 0xFF){_pPADStatus->stickY += stickvalue;}
if (dinput.diks[pad[_numPad].keyForControl[CTL_SUBLEFT]] & 0xFF){_pPADStatus->substickX -= subvalue;} if (dinput.diks[pad[_numPad].keyForControl[CTL_SUBLEFT]] & 0xFF){_pPADStatus->substickX -= stickvalue;}
if (dinput.diks[pad[_numPad].keyForControl[CTL_SUBRIGHT]] & 0xFF){_pPADStatus->substickX += subvalue;} if (dinput.diks[pad[_numPad].keyForControl[CTL_SUBRIGHT]] & 0xFF){_pPADStatus->substickX += stickvalue;}
if (dinput.diks[pad[_numPad].keyForControl[CTL_SUBDOWN]] & 0xFF){_pPADStatus->substickY -= subvalue;} if (dinput.diks[pad[_numPad].keyForControl[CTL_SUBDOWN]] & 0xFF){_pPADStatus->substickY -= stickvalue;}
if (dinput.diks[pad[_numPad].keyForControl[CTL_SUBUP]] & 0xFF){_pPADStatus->substickY += subvalue;} if (dinput.diks[pad[_numPad].keyForControl[CTL_SUBUP]] & 0xFF){_pPADStatus->substickY += stickvalue;}
if (dinput.diks[pad[_numPad].keyForControl[CTL_L]] & 0xFF) if (dinput.diks[pad[_numPad].keyForControl[CTL_L]] & 0xFF)
{ {
@ -334,66 +327,65 @@ void XInput_Read(int _numPAD, SPADStatus* _pPADStatus)
XINPUT_STATE xstate; XINPUT_STATE xstate;
DWORD xresult = XInputGetState(_numPAD, &xstate); DWORD xresult = XInputGetState(_numPAD, &xstate);
if ((xresult != ERROR_SUCCESS) && (_numPAD != 0)) if(xresult != ERROR_SUCCESS)
{ {
return; return;
} }
// In addition, let's .. yes, let's use XINPUT! // In addition, let's .. yes, let's use XINPUT!
if (xresult == ERROR_SUCCESS) if(xresult == ERROR_SUCCESS)
{ {
const XINPUT_GAMEPAD& pad = xstate.Gamepad; const XINPUT_GAMEPAD& xpad = xstate.Gamepad;
if ((_pPADStatus->stickX == base) && (_pPADStatus->stickY == base)) if((_pPADStatus->stickX == base) && (_pPADStatus->stickY == base))
{ {
ScaleStickValues( ScaleStickValues(
&_pPADStatus->stickX, &_pPADStatus->stickX,
&_pPADStatus->stickY, &_pPADStatus->stickY,
pad.sThumbLX, xpad.sThumbLX,
pad.sThumbLY); xpad.sThumbLY);
} }
if ((_pPADStatus->substickX == base) && (_pPADStatus->substickY == base)) if((_pPADStatus->substickX == base) && (_pPADStatus->substickY == base))
{ {
ScaleStickValues( ScaleStickValues(
&_pPADStatus->substickX, &_pPADStatus->substickX,
&_pPADStatus->substickY, &_pPADStatus->substickY,
pad.sThumbRX, xpad.sThumbRX,
pad.sThumbRY); xpad.sThumbRY);
} }
_pPADStatus->triggerLeft = pad.bLeftTrigger; _pPADStatus->triggerLeft = xpad.bLeftTrigger;
_pPADStatus->triggerRight = pad.bRightTrigger; _pPADStatus->triggerRight = xpad.bRightTrigger;
if (pad.bLeftTrigger > 20){_pPADStatus->button |= PAD_TRIGGER_L;} if (xpad.bLeftTrigger > 20){_pPADStatus->button |= PAD_TRIGGER_L;}
if (pad.bRightTrigger > 20){_pPADStatus->button |= PAD_TRIGGER_R;} if (xpad.bRightTrigger > 20){_pPADStatus->button |= PAD_TRIGGER_R;}
if (pad.wButtons & XINPUT_GAMEPAD_A){_pPADStatus->button |= PAD_BUTTON_A;} if (xpad.wButtons & XINPUT_GAMEPAD_A){_pPADStatus->button |= PAD_BUTTON_A;}
if (pad.wButtons & XINPUT_GAMEPAD_X){_pPADStatus->button |= PAD_BUTTON_B;} if (xpad.wButtons & XINPUT_GAMEPAD_X){_pPADStatus->button |= PAD_BUTTON_B;}
if (pad.wButtons & XINPUT_GAMEPAD_B){_pPADStatus->button |= PAD_BUTTON_X;} if (xpad.wButtons & XINPUT_GAMEPAD_B){_pPADStatus->button |= PAD_BUTTON_X;}
if (pad.wButtons & XINPUT_GAMEPAD_Y){_pPADStatus->button |= PAD_BUTTON_Y;} if (xpad.wButtons & XINPUT_GAMEPAD_Y){_pPADStatus->button |= PAD_BUTTON_Y;}
if (pad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER){_pPADStatus->button |= PAD_TRIGGER_Z;} if (xpad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER){_pPADStatus->button |= PAD_TRIGGER_Z;}
if (pad.wButtons & XINPUT_GAMEPAD_START){_pPADStatus->button |= PAD_BUTTON_START;} if (xpad.wButtons & XINPUT_GAMEPAD_START){_pPADStatus->button |= PAD_BUTTON_START;}
if (pad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT){_pPADStatus->button |= PAD_BUTTON_LEFT;} if (xpad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT){_pPADStatus->button |= PAD_BUTTON_LEFT;}
if (pad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT){_pPADStatus->button |= PAD_BUTTON_RIGHT;} if (xpad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT){_pPADStatus->button |= PAD_BUTTON_RIGHT;}
if (pad.wButtons & XINPUT_GAMEPAD_DPAD_UP){_pPADStatus->button |= PAD_BUTTON_UP;} if (xpad.wButtons & XINPUT_GAMEPAD_DPAD_UP){_pPADStatus->button |= PAD_BUTTON_UP;}
if (pad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN){_pPADStatus->button |= PAD_BUTTON_DOWN;} if (xpad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN){_pPADStatus->button |= PAD_BUTTON_DOWN;}
} }
#endif #endif
} }
#endif #endif
#if defined(__linux__) #if defined(__linux__)
@ -471,21 +463,20 @@ void X11_Read(int _numPAD, SPADStatus* _pPADStatus)
break; break;
} }
} }
int mainvalue = (KeyStatus[CTL_HALFMAIN]) ? 40 : 100; int stickvalue = (KeyStatus[CTL_HALFPRESS]) ? 40 : 100;
int subvalue = (KeyStatus[CTL_HALFSUB]) ? 40 : 100; int triggervalue = (KeyStatus[CTL_HALFPRESS]) ? 100 : 255;
int triggervalue = (KeyStatus[CTL_HALFTRIGGER]) ? 100 : 255;
if (KeyStatus[CTL_MAINLEFT]){_pPADStatus->stickX -= stickvalue;}
if (KeyStatus[CTL_MAINLEFT]){_pPADStatus->stickX -= mainvalue;} if (KeyStatus[CTL_MAINUP]){_pPADStatus->stickY += stickvalue;}
if (KeyStatus[CTL_MAINUP]){_pPADStatus->stickY += mainvalue;} if (KeyStatus[CTL_MAINRIGHT]){_pPADStatus->stickX += stickvalue;}
if (KeyStatus[CTL_MAINRIGHT]){_pPADStatus->stickX += mainvalue;} if (KeyStatus[CTL_MAINDOWN]){_pPADStatus->stickY -= stickvalue;}
if (KeyStatus[CTL_MAINDOWN]){_pPADStatus->stickY -= mainvalue;}
if (KeyStatus[CTL_SUBLEFT]){_pPADStatus->substickX -= stickvalue;}
if (KeyStatus[CTL_SUBLEFT]){_pPADStatus->substickX -= subvalue;} if (KeyStatus[CTL_SUBUP]){_pPADStatus->substickY += stickvalue;}
if (KeyStatus[CTL_SUBUP]){_pPADStatus->substickY += subvalue;} if (KeyStatus[CTL_SUBRIGHT]){_pPADStatus->substickX += stickvalue;}
if (KeyStatus[CTL_SUBRIGHT]){_pPADStatus->substickX += subvalue;} if (KeyStatus[CTL_SUBDOWN]){_pPADStatus->substickY -= stickvalue;}
if (KeyStatus[CTL_SUBDOWN]){_pPADStatus->substickY -= subvalue;}
if (KeyStatus[CTL_DPADLEFT]){_pPADStatus->button |= PAD_BUTTON_LEFT;} if (KeyStatus[CTL_DPADLEFT]){_pPADStatus->button |= PAD_BUTTON_LEFT;}
if (KeyStatus[CTL_DPADUP]){_pPADStatus->button |= PAD_BUTTON_UP;} if (KeyStatus[CTL_DPADUP]){_pPADStatus->button |= PAD_BUTTON_UP;}
if (KeyStatus[CTL_DPADRIGHT]){_pPADStatus->button |= PAD_BUTTON_RIGHT;} if (KeyStatus[CTL_DPADRIGHT]){_pPADStatus->button |= PAD_BUTTON_RIGHT;}
@ -523,7 +514,7 @@ void X11_Read(int _numPAD, SPADStatus* _pPADStatus)
void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
{ {
// check if all is okay // Check if all is okay
if ((_pPADStatus == NULL)) if ((_pPADStatus == NULL))
{ {
return; return;
@ -534,11 +525,8 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
return; return;
#endif #endif
const int base = 0x80; const int base = 0x80;
// clear pad // Clear pad
memset(_pPADStatus, 0, sizeof(SPADStatus)); memset(_pPADStatus, 0, sizeof(SPADStatus));
_pPADStatus->stickY = base; _pPADStatus->stickY = base;
@ -547,16 +535,25 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
_pPADStatus->substickY = base; _pPADStatus->substickY = base;
_pPADStatus->button |= PAD_USE_ORIGIN; _pPADStatus->button |= PAD_USE_ORIGIN;
#ifdef _WIN32 #ifdef _WIN32
// just update pad on focus // Just update pad on focus
//if (g_PADInitialize.hWnd != ::GetForegroundWindow()) // TODO fix g_PADInitialize.hWnd != DolphinWX frame
// return; if(pad[_numPAD].disable)
{
if(g_PADInitialize.hWnd != GetForegroundWindow())
return;
}
#endif #endif
_pPADStatus->err = PAD_ERR_NONE; _pPADStatus->err = PAD_ERR_NONE;
// keyboard is hardwired to player 1.
#ifdef _WIN32 #ifdef _WIN32
DInput_Read(_numPAD, _pPADStatus); if(pad[_numPAD].type == 0)
XInput_Read(_numPAD, _pPADStatus); {
DInput_Read(_numPAD, _pPADStatus);
}
else
{
XInput_Read(_numPAD, _pPADStatus);
}
#elif defined(__linux__) #elif defined(__linux__)
X11_Read(_numPAD, _pPADStatus); X11_Read(_numPAD, _pPADStatus);
#endif #endif
@ -635,23 +632,21 @@ void LoadConfig()
DIK_C, DIK_C,
DIK_D, DIK_D,
DIK_RETURN, DIK_RETURN,
DIK_LCONTROL,
DIK_Q, DIK_Q,
DIK_W, DIK_W,
DIK_UP, //mainstick DIK_UP, //mainstick
DIK_DOWN, DIK_DOWN,
DIK_LEFT, DIK_LEFT,
DIK_RIGHT, DIK_RIGHT,
DIK_LSHIFT,
DIK_I, //substick DIK_I, //substick
DIK_K, DIK_K,
DIK_J, DIK_J,
DIK_L, DIK_L,
DIK_LSHIFT,
DIK_T, //dpad DIK_T, //dpad
DIK_G, DIK_G,
DIK_F, DIK_F,
DIK_H DIK_H,
DIK_LSHIFT
}; };
#else #else
const int defaultKeyForControl[NUMCONTROLS] = const int defaultKeyForControl[NUMCONTROLS] =
@ -662,23 +657,21 @@ void LoadConfig()
XK_c, XK_c,
XK_d, XK_d,
XK_Return, XK_Return,
XK_Control_L,
XK_q, XK_q,
XK_w, XK_w,
XK_Up, //mainstick XK_Up, //mainstick
XK_Down, XK_Down,
XK_Left, XK_Left,
XK_Right, XK_Right,
XK_Shift_L,
XK_i, //substick XK_i, //substick
XK_K, XK_K,
XK_j, XK_j,
XK_l, XK_l,
XK_Shift_L,
XK_t, //dpad XK_t, //dpad
XK_g, XK_g,
XK_f, XK_f,
XK_h XK_h,
XK_Shift_L //halfpress
}; };
#endif #endif
IniFile file; IniFile file;
@ -689,32 +682,21 @@ void LoadConfig()
char SectionName[32]; char SectionName[32];
sprintf(SectionName, "PAD%i", i+1); sprintf(SectionName, "PAD%i", i+1);
if(pad[i].type == 0) file.Get(SectionName, "Type", &pad[i].type);
file.Get(SectionName, "Attached", &pad[i].attached, i==0);
file.Get(SectionName, "DisableOnBackground", &pad[i].disable, false);
file.Get(SectionName, "Rumble", &pad[i].rumble, true);
file.Get(SectionName, "XPad#", &pad[i].XPad);
for (int x = 0; x < NUMCONTROLS; x++)
{ {
//keyboard settings file.Get(SectionName, controlNames[x], &pad[i].keyForControl[x],
file.Get(SectionName, "Type", &pad[i].type); (i==0)?defaultKeyForControl[x]:0);
file.Get(SectionName, "Attached", &pad[i].attached, i==0);
file.Get(SectionName, "DisableOnBackground", &pad[i].disable, false);
for (int x = 0; x < NUMCONTROLS; x++)
{
file.Get(SectionName, controlNames[x], &pad[i].keyForControl[x],
(i==0)?defaultKeyForControl[x]:0);
#ifndef _WIN32 #ifndef _WIN32
// In linux we have a problem assigning the upper case of the // In linux we have a problem assigning the upper case of the
// keys because they're not being recognized // keys because they're not being recognized
pad[i].keyForControl[x] = tolower(pad[i].keyForControl[x]); pad[i].keyForControl[x] = tolower(pad[i].keyForControl[x]);
#endif #endif
}
}
else
{
//xpad settings
file.Get(SectionName, "Type", &pad[i].type);
file.Get(SectionName, "Attached", &pad[i].attached, false);
file.Get(SectionName, "DisableOnBackground", &pad[i].disable, false);
file.Get(SectionName, "Rumble", &pad[i].rumble, true);
file.Get(SectionName, "XPad#", &pad[i].XPad);
} }
} }
} }
@ -730,26 +712,15 @@ void SaveConfig()
char SectionName[32]; char SectionName[32];
sprintf(SectionName, "PAD%i", i+1); sprintf(SectionName, "PAD%i", i+1);
if(pad[i].type == 0) file.Set(SectionName, "Type", pad[i].type);
file.Set(SectionName, "Attached", pad[i].attached);
file.Set(SectionName, "DisableOnBackground", pad[i].disable);
file.Set(SectionName, "Rumble", pad[i].rumble);
file.Set(SectionName, "XPad#", pad[i].XPad);
for (int x = 0; x < NUMCONTROLS; x++)
{ {
//keyboard settings file.Set(SectionName, controlNames[x], pad[i].keyForControl[x]);
file.Set(SectionName, "Type", pad[i].type);
file.Set(SectionName, "Attached", pad[i].attached);
file.Set(SectionName, "DisableOnBackground", pad[i].disable);
for (int x = 0; x < NUMCONTROLS; x++)
{
file.Set(SectionName, controlNames[x], pad[i].keyForControl[x]);
}
}
else
{
//xpad settings
file.Set(SectionName, "Type", pad[i].type);
file.Set(SectionName, "Attached", pad[i].attached);
file.Set(SectionName, "DisableOnBackground", pad[i].disable);
file.Set(SectionName, "Rumble", pad[i].rumble);
file.Set(SectionName, "XPad#", pad[i].XPad);
} }
} }
file.Save("pad.ini"); file.Save("pad.ini");

View File

@ -26,23 +26,21 @@ enum
CTL_Y, CTL_Y,
CTL_Z, CTL_Z,
CTL_START, CTL_START,
CTL_HALFTRIGGER,
CTL_L, CTL_L,
CTL_R, CTL_R,
CTL_MAINUP, CTL_MAINUP,
CTL_MAINDOWN, CTL_MAINDOWN,
CTL_MAINLEFT, CTL_MAINLEFT,
CTL_MAINRIGHT, CTL_MAINRIGHT,
CTL_HALFMAIN,
CTL_SUBUP, CTL_SUBUP,
CTL_SUBDOWN, CTL_SUBDOWN,
CTL_SUBLEFT, CTL_SUBLEFT,
CTL_SUBRIGHT, CTL_SUBRIGHT,
CTL_HALFSUB,
CTL_DPADUP, CTL_DPADUP,
CTL_DPADDOWN, CTL_DPADDOWN,
CTL_DPADLEFT, CTL_DPADLEFT,
CTL_DPADRIGHT, CTL_DPADRIGHT,
CTL_HALFPRESS,
NUMCONTROLS NUMCONTROLS
}; };
@ -55,23 +53,21 @@ static const char* controlNames[] =
"Y_button", "Y_button",
"Z_trigger", "Z_trigger",
"Start", "Start",
"Soft_trigger_switch",
"L_button", "L_button",
"R_button", "R_button",
"Main_stick_up", "Main_stick_up",
"Main_stick_down", "Main_stick_down",
"Main_stick_left", "Main_stick_left",
"Main_stick_right", "Main_stick_right",
"Soft_main_switch",
"Sub_stick_up", "Sub_stick_up",
"Sub_stick_down", "Sub_stick_down",
"Sub_stick_left", "Sub_stick_left",
"Sub_stick_right", "Sub_stick_right",
"Soft_sub_switch",
"D-Pad_up", "D-Pad_up",
"D-Pad_down", "D-Pad_down",
"D-Pad_left", "D-Pad_left",
"D-Pad_right", "D-Pad_right",
"half_press_toggle",
}; };
struct SPads { struct SPads {