x360 temporary right stick hard bind now configurable in ini file.

This commit is contained in:
Henrik Rydgard 2013-06-11 21:29:55 +02:00
parent 5916a345c3
commit b60a2fb819
4 changed files with 32 additions and 9 deletions

View File

@ -145,6 +145,7 @@ void Config::Load(const char *iniFileName)
control->Get("KeyMapping",iMappingMap);
control->Get("AccelerometerToAnalogHoriz", &bAccelerometerToAnalogHoriz, false);
control->Get("ForceInputDevice", &iForceInputDevice, -1);
control->Get("RightStickBind", &iRightStickBind, 0);
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
pspConfig->Get("NickName", &sNickName, "shadow");
@ -236,7 +237,8 @@ void Config::Save()
control->Set("KeyMapping",iMappingMap);
control->Set("AccelerometerToAnalogHoriz", bAccelerometerToAnalogHoriz);
control->Set("ForceInputDevice", iForceInputDevice);
control->Set("RightStickBind", iRightStickBind);
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
pspConfig->Set("NickName", sNickName.c_str());

View File

@ -98,6 +98,12 @@ public:
bool bShowDebugStats;
bool bLargeControls;
bool bAccelerometerToAnalogHoriz;
// Temporary until control mapping rewrite
// 0 = none
// 1 = arrow buttons
// 2 = face buttons
// 3 = L/R
int iRightStickBind;
// Control
std::map<int,int> iMappingMap; // Can be used differently depending on systems

View File

@ -53,7 +53,7 @@ enum {
};
//these might come in handy in the future, if PPSSPP ever supports wifi/ad-hoc
typedef struct SceNetAdhocctlParams
struct SceNetAdhocctlParams
{
int channel; //which ad-hoc channel to connect to
char name[8]; //connection name
@ -61,7 +61,7 @@ typedef struct SceNetAdhocctlParams
char nickname[128]; //PSP's nickname?
};
typedef struct ProductStruct
struct ProductStruct
{
int unknown; //unknown, set to 0
char product[9]; //Product name?

View File

@ -170,15 +170,30 @@ void XinputDevice::ApplyDiff(XINPUT_STATE &state, InputState &input_state) {
state.Gamepad.bRightTrigger > XINPUT_GAMEPAD_TRIGGER_THRESHOLD) {
input_state.pad_buttons |= xinput_ctrl_map[i + 1];
}
}
const SHORT rthreshold = 22000;
if (state.Gamepad.sThumbRX > rthreshold) input_state.pad_buttons |= PAD_BUTTON_RIGHT;
else if (state.Gamepad.sThumbRX < -rthreshold) input_state.pad_buttons |= PAD_BUTTON_LEFT;
if (state.Gamepad.sThumbRY > rthreshold) input_state.pad_buttons |= PAD_BUTTON_UP;
else if (state.Gamepad.sThumbRY < -rthreshold) input_state.pad_buttons |= PAD_BUTTON_DOWN;
switch (g_Config.iRightStickBind) {
case 0:
break;
case 1:
if (state.Gamepad.sThumbRX > rthreshold) input_state.pad_buttons |= PAD_BUTTON_RIGHT;
else if (state.Gamepad.sThumbRX < -rthreshold) input_state.pad_buttons |= PAD_BUTTON_LEFT;
if (state.Gamepad.sThumbRY > rthreshold) input_state.pad_buttons |= PAD_BUTTON_UP;
else if (state.Gamepad.sThumbRY < -rthreshold) input_state.pad_buttons |= PAD_BUTTON_DOWN;
break;
case 2:
if (state.Gamepad.sThumbRX > rthreshold) input_state.pad_buttons |= PAD_BUTTON_B;
else if (state.Gamepad.sThumbRX < -rthreshold) input_state.pad_buttons |= PAD_BUTTON_X;
if (state.Gamepad.sThumbRY > rthreshold) input_state.pad_buttons |= PAD_BUTTON_Y;
else if (state.Gamepad.sThumbRY < -rthreshold) input_state.pad_buttons |= PAD_BUTTON_A;
break;
case 3:
if (state.Gamepad.sThumbRX > rthreshold) input_state.pad_buttons |= PAD_BUTTON_RBUMPER;
else if (state.Gamepad.sThumbRX < -rthreshold) input_state.pad_buttons |= PAD_BUTTON_LBUMPER;
break;
}
}
int XinputDevice::UpdateRawStateSingle(RawInputState &rawState)