forked from Ports/perfect_dark
Support for two-sticks, one controller
port: implements analog movement for pc controllers port: Implement menu movement with the C stick port: Implement analog leaning port: Implement 1.2 + 1 analog zooming port: pd input lib now handles 32 buttons port: modern crouch implementation port: implement analog slayer airbraking port: xbla farsight strafing Map crouch buttons - map cycle crouch to L3 - sensible 1964-style crouch bindings
This commit is contained in:
1 parent
1eb1e9686a
commit
80d787caf9
24 files changed
+526
-160
No files matched your search
+30
-12
@@ -73,6 +73,22 @@ static const char *ckNames[CK_TOTAL_COUNT] = {
|
||||
"Z_TRIG",
|
||||
"B_BUTTON",
|
||||
"A_BUTTON",
|
||||
"CK_0001",
|
||||
"CK_0002",
|
||||
"CK_0004",
|
||||
"CK_0008",
|
||||
"CK_0010",
|
||||
"CK_0020",
|
||||
"CK_0040",
|
||||
"CK_0080",
|
||||
"CK_0100",
|
||||
"CK_0200",
|
||||
"CK_0400",
|
||||
"CK_0800",
|
||||
"CK_1000",
|
||||
"CK_2000",
|
||||
"CK_4000",
|
||||
"CK_8000"
|
||||
"STICK_XNEG",
|
||||
"STICK_XPOS",
|
||||
"STICK_YNEG",
|
||||
@@ -153,6 +169,8 @@ void inputSetDefaultKeyBinds(void)
|
||||
{ CK_STICK_XPOS, SDL_SCANCODE_RIGHT, 0 },
|
||||
{ CK_STICK_YNEG, SDL_SCANCODE_DOWN, 0 },
|
||||
{ CK_STICK_YPOS, SDL_SCANCODE_UP, 0 },
|
||||
{CK_4000, SDL_SCANCODE_LSHIFT, 0 },
|
||||
{CK_2000, SDL_SCANCODE_LCTRL, 0 }
|
||||
};
|
||||
|
||||
static const u32 joybinds[][2] = {
|
||||
@@ -167,7 +185,7 @@ void inputSetDefaultKeyBinds(void)
|
||||
{ CK_START, SDL_CONTROLLER_BUTTON_START },
|
||||
{ CK_C_D, SDL_CONTROLLER_BUTTON_DPAD_DOWN },
|
||||
{ CK_C_U, SDL_CONTROLLER_BUTTON_DPAD_UP },
|
||||
{ CK_C_R, SDL_CONTROLLER_BUTTON_DPAD_RIGHT },
|
||||
{ CK_8000, SDL_CONTROLLER_BUTTON_LEFTSTICK },
|
||||
{ CK_C_L, SDL_CONTROLLER_BUTTON_DPAD_LEFT },
|
||||
};
|
||||
|
||||
@@ -526,12 +544,6 @@ s32 inputReadController(s32 idx, OSContPad *npad)
|
||||
rightX = inputAxisScale(rightX, deadzone[axisMap[1][0]], stickSens[axisMap[1][0]]);
|
||||
rightY = inputAxisScale(rightY, deadzone[axisMap[1][1]], stickSens[axisMap[1][1]]);
|
||||
|
||||
if (stickCButtons) {
|
||||
if (rightX < -0x4000) npad->button |= L_CBUTTONS;
|
||||
if (rightX > +0x4000) npad->button |= R_CBUTTONS;
|
||||
if (rightY < -0x4000) npad->button |= U_CBUTTONS;
|
||||
if (rightY > +0x4000) npad->button |= D_CBUTTONS;
|
||||
}
|
||||
|
||||
if (!npad->stick_x && leftX) {
|
||||
npad->stick_x = leftX / 0x100;
|
||||
@@ -542,9 +554,14 @@ s32 inputReadController(s32 idx, OSContPad *npad)
|
||||
npad->stick_y = (stickY == 128) ? 127 : stickY;
|
||||
}
|
||||
|
||||
stickY = -rightY / 0x100;
|
||||
npad->rstick_y = (stickY == 128) ? 127 : stickY;
|
||||
npad->rstick_x = rightX / 0x100;
|
||||
if (!npad->rstick_x && rightX) {
|
||||
npad->rstick_x = rightX / 0x100;
|
||||
}
|
||||
|
||||
s32 rStickY = -rightY / 0x100;
|
||||
if (!npad->rstick_y && rStickY) {
|
||||
npad->rstick_y = (rStickY == 128) ? 127 : rStickY;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -634,6 +651,7 @@ void inputKeyBind(s32 idx, u32 ck, s32 bind, u32 vk)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (bind < 0) {
|
||||
for (s32 i = 0; i < MAX_BINDS; ++i) {
|
||||
if (binds[idx][ck][i] == 0) {
|
||||
@@ -673,7 +691,7 @@ s32 inputKeyPressed(u32 vk)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline u16 inputContToContKey(const u16 cont)
|
||||
static inline u32 inputContToContKey(const u32 cont)
|
||||
{
|
||||
if (cont == 0) {
|
||||
return 0;
|
||||
@@ -682,7 +700,7 @@ static inline u16 inputContToContKey(const u16 cont)
|
||||
return 32 - __builtin_clz(cont - 1);
|
||||
}
|
||||
|
||||
s32 inputButtonPressed(s32 idx, u16 contbtn)
|
||||
s32 inputButtonPressed(s32 idx, u32 contbtn)
|
||||
{
|
||||
if (idx < 0 || idx >= INPUT_MAX_CONTROLLERS) {
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user