Skip to content

Commit

Permalink
Ctrl: Always mark non-user buttons released.
Browse files Browse the repository at this point in the history
This matches behavior on real firmware and fixes a test failure.
  • Loading branch information
unknownbrackets committed Jun 6, 2018
1 parent 07e178a commit e69e844
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Core/HLE/sceCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,26 +503,28 @@ static int sceCtrlPeekBufferNegative(u32 ctrlDataPtr, u32 nBufs)
return done;
}

void __CtrlWriteUserLatch(CtrlLatch *userLatch) {
static void __CtrlWriteUserLatch(CtrlLatch *userLatch, int bufs) {
*userLatch = latch;
userLatch->btnBreak &= CTRL_MASK_USER;
userLatch->btnMake &= CTRL_MASK_USER;
userLatch->btnPress &= CTRL_MASK_USER;
userLatch->btnRelease &= CTRL_MASK_USER;
if (bufs > 0) {
userLatch->btnRelease |= CTRL_MASK_USER;

This comment has been minimized.

Copy link
@hrydgard

hrydgard Mar 12, 2019

Owner

@unknownbrackets shouldn't this really be userLatch->btnRelease |= ~CTRL_MASK_USER; ?

}
}

static u32 sceCtrlPeekLatch(u32 latchDataPtr) {
auto userLatch = PSPPointer<CtrlLatch>::Create(latchDataPtr);
if (userLatch.IsValid()) {
__CtrlWriteUserLatch(userLatch);
__CtrlWriteUserLatch(userLatch, ctrlLatchBufs);
}
return hleLogSuccessI(SCECTRL, ctrlLatchBufs);
}

static u32 sceCtrlReadLatch(u32 latchDataPtr) {
auto userLatch = PSPPointer<CtrlLatch>::Create(latchDataPtr);
if (userLatch.IsValid()) {
__CtrlWriteUserLatch(userLatch);
__CtrlWriteUserLatch(userLatch, ctrlLatchBufs);
}
return hleLogSuccessI(SCECTRL, __CtrlResetLatch());
}
Expand Down

0 comments on commit e69e844

Please sign in to comment.