Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ps2xRuntime/src/lib/Kernel/Stubs/Pad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,10 @@ namespace ps2_stubs
data[13] = pressureValue(state, portState, kPadBtnCircle);
data[14] = pressureValue(state, portState, kPadBtnCross);
data[15] = pressureValue(state, portState, kPadBtnSquare);
// DualShock 2 pressure order: right, left, up, down, triangle, circle, cross, square, L1, R1, L2, R2.
data[16] = pressureValue(state, portState, kPadBtnL1);
data[17] = pressureValue(state, portState, kPadBtnL2);
data[18] = pressureValue(state, portState, kPadBtnR1);
data[17] = pressureValue(state, portState, kPadBtnR1);
data[18] = pressureValue(state, portState, kPadBtnL2);
data[19] = pressureValue(state, portState, kPadBtnR2);
}

Expand Down
17 changes: 15 additions & 2 deletions ps2xTest/src/pad_input_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,23 @@ void register_pad_input_tests()
t.Equals(data[14], static_cast<uint8_t>(0xFF), "cross pressure should be populated when pressed");
t.Equals(data[15], static_cast<uint8_t>(0x00), "square pressure should be clear when not pressed");
t.Equals(data[16], static_cast<uint8_t>(0xFF), "L1 pressure should be populated when pressed");
t.Equals(data[17], static_cast<uint8_t>(0x00), "L2 pressure should be clear when not pressed");
t.Equals(data[18], static_cast<uint8_t>(0x00), "R1 pressure should be clear when not pressed");
t.Equals(data[17], static_cast<uint8_t>(0x00), "R1 pressure should be clear when not pressed");
t.Equals(data[18], static_cast<uint8_t>(0x00), "L2 pressure should be clear when not pressed");
t.Equals(data[19], static_cast<uint8_t>(0xFF), "R2 pressure should be populated when pressed");

// Shoulder pressure bytes follow the DualShock 2 order L1, R1, L2, R2.
ps2_stubs::setPadOverrideState(static_cast<uint16_t>(0xFFFFu & ~kPadBtnR1), 0x80, 0x80, 0x80, 0x80);
runPadRead(ctx, rdram);
t.Equals(data[16], static_cast<uint8_t>(0x00), "L1 pressure should be clear when only R1 is pressed");
t.Equals(data[17], static_cast<uint8_t>(0xFF), "R1 pressure is byte 17");
t.Equals(data[18], static_cast<uint8_t>(0x00), "L2 pressure should be clear when only R1 is pressed");
t.Equals(data[19], static_cast<uint8_t>(0x00), "R2 pressure should be clear when only R1 is pressed");
ps2_stubs::setPadOverrideState(static_cast<uint16_t>(0xFFFFu & ~kPadBtnL2), 0x80, 0x80, 0x80, 0x80);
runPadRead(ctx, rdram);
t.Equals(data[17], static_cast<uint8_t>(0x00), "R1 pressure should be clear when only L2 is pressed");
t.Equals(data[18], static_cast<uint8_t>(0xFF), "L2 pressure is byte 18");
ps2_stubs::setPadOverrideState(pressedButtons, 0x80, 0x80, 0x80, 0x80);

setRegU32(ctx, 4, 0u);
setRegU32(ctx, 5, 0u);
setRegU32(ctx, 6, static_cast<uint32_t>(kPadBtnL1 | kPadBtnR2));
Expand Down