Skip to content

Commit

Permalink
More mouse cleanup; fix bit shifting for simultaneous inputs.
Browse files Browse the repository at this point in the history
  • Loading branch information
clobber committed May 11, 2020
1 parent bace4ad commit 2e14fb9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions MednafenGameCore.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3199,6 +3199,10 @@ - (BOOL)loadFileAtPath:(NSString *)path error:(NSError **)error
// Force Stunner / Virtua Gun to Port 1 and Gamepad to Port 2
game->SetInput(0, "gun", (uint8_t *)_inputBuffer[0]);
game->SetInput(1, "gamepad", (uint8_t *)_inputBuffer[1]);

// Clear mouse inputs
uint8_t *buf = (uint8_t *)_inputBuffer[0];
MDFN_enlsb<uint8_t>(&buf[4], 0);
}
else
{
Expand Down Expand Up @@ -3615,7 +3619,7 @@ - (oneway void)leftMouseDownAtPoint:(OEIntPoint)point
[self mouseMovedAtPoint:point];

uint8_t *buf = (uint8_t *)_inputBuffer[0];
MDFN_enlsb<uint8_t>(&buf[4], 1 << 0); // TRIGGER
MDFN_enlsb<uint8_t>(&buf[4], buf[4] |= 1 << 0); // TRIGGER
}
}

Expand All @@ -3624,7 +3628,7 @@ - (oneway void)leftMouseUp
if(_isSSVirtuaGunSupportedGame)
{
uint8_t *buf = (uint8_t *)_inputBuffer[0];
MDFN_enlsb<uint8_t>(&buf[4], 0); // release TRIGGER
MDFN_enlsb<uint8_t>(&buf[4], buf[4] &= ~(1 << 0)); // release TRIGGER
}
}

Expand All @@ -3633,7 +3637,7 @@ - (oneway void)rightMouseDownAtPoint:(OEIntPoint)point
if(_isSSVirtuaGunSupportedGame)
{
uint8_t *buf = (uint8_t *)_inputBuffer[0];
MDFN_enlsb<uint8_t>(&buf[4], 1 << 2); // Offscreen Shot aka RELOAD
MDFN_enlsb<uint8_t>(&buf[4], buf[4] |= 1 << 2); // Offscreen Shot aka RELOAD
}
}

Expand All @@ -3642,7 +3646,7 @@ - (oneway void)rightMouseUp
if(_isSSVirtuaGunSupportedGame)
{
uint8_t *buf = (uint8_t *)_inputBuffer[0];
MDFN_enlsb<uint8_t>(&buf[4], 0); // release Offscreen Shot aka RELOAD
MDFN_enlsb<uint8_t>(&buf[4], buf[4] &= ~(1 << 2)); // release Offscreen Shot aka RELOAD
}
}

Expand Down

0 comments on commit 2e14fb9

Please sign in to comment.