From 18c595887a12ef23e0d54c63f83c91c99e7f4827 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Tue, 28 Feb 2023 18:16:52 -0600 Subject: [PATCH] Supports local multiplayer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Heavily based on Ian Clawson’s PR: #1 --- Sources/GPGXBridge/GPGXEmulatorBridge.m | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Sources/GPGXBridge/GPGXEmulatorBridge.m b/Sources/GPGXBridge/GPGXEmulatorBridge.m index a901558..53f6a70 100644 --- a/Sources/GPGXBridge/GPGXEmulatorBridge.m +++ b/Sources/GPGXBridge/GPGXEmulatorBridge.m @@ -131,22 +131,23 @@ - (void)runFrameAndProcessVideo:(BOOL)processVideo #pragma mark - Inputs - -- (void)activateInput:(NSInteger)inputValue value:(double)value +- (void)activateInput:(NSInteger)inputValue value:(double)value playerIndex:(NSInteger)playerIndex { - int player = 0; - input.pad[player * 4] |= inputValue; + //TODO: Is this correct? + input.pad[playerIndex * 4] |= inputValue; } -- (void)deactivateInput:(NSInteger)inputValue +- (void)deactivateInput:(NSInteger)inputValue playerIndex:(NSInteger)playerIndex { - int player = 0; - input.pad[player * 4] &= ~inputValue; + input.pad[playerIndex * 4] &= ~inputValue; } - (void)resetInputs { - int player = 0; - input.pad[player * 4] = 0; + for (int playerIndex = 0; playerIndex < 2; playerIndex++) + { + input.pad[playerIndex * 4] = 0; + } } #pragma mark - Game Saves -