From 2e14fb913dbf2fa5085eccf6cdfc22abb7f09bee Mon Sep 17 00:00:00 2001 From: clobber Date: Mon, 11 May 2020 14:10:15 -0600 Subject: [PATCH] More mouse cleanup; fix bit shifting for simultaneous inputs. --- MednafenGameCore.mm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/MednafenGameCore.mm b/MednafenGameCore.mm index 5a74e3d..c48a773 100644 --- a/MednafenGameCore.mm +++ b/MednafenGameCore.mm @@ -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(&buf[4], 0); } else { @@ -3615,7 +3619,7 @@ - (oneway void)leftMouseDownAtPoint:(OEIntPoint)point [self mouseMovedAtPoint:point]; uint8_t *buf = (uint8_t *)_inputBuffer[0]; - MDFN_enlsb(&buf[4], 1 << 0); // TRIGGER + MDFN_enlsb(&buf[4], buf[4] |= 1 << 0); // TRIGGER } } @@ -3624,7 +3628,7 @@ - (oneway void)leftMouseUp if(_isSSVirtuaGunSupportedGame) { uint8_t *buf = (uint8_t *)_inputBuffer[0]; - MDFN_enlsb(&buf[4], 0); // release TRIGGER + MDFN_enlsb(&buf[4], buf[4] &= ~(1 << 0)); // release TRIGGER } } @@ -3633,7 +3637,7 @@ - (oneway void)rightMouseDownAtPoint:(OEIntPoint)point if(_isSSVirtuaGunSupportedGame) { uint8_t *buf = (uint8_t *)_inputBuffer[0]; - MDFN_enlsb(&buf[4], 1 << 2); // Offscreen Shot aka RELOAD + MDFN_enlsb(&buf[4], buf[4] |= 1 << 2); // Offscreen Shot aka RELOAD } } @@ -3642,7 +3646,7 @@ - (oneway void)rightMouseUp if(_isSSVirtuaGunSupportedGame) { uint8_t *buf = (uint8_t *)_inputBuffer[0]; - MDFN_enlsb(&buf[4], 0); // release Offscreen Shot aka RELOAD + MDFN_enlsb(&buf[4], buf[4] &= ~(1 << 2)); // release Offscreen Shot aka RELOAD } }