From f146bbb3865571cff778cf59179548e29e1a0065 Mon Sep 17 00:00:00 2001 From: Joseph Mattiello Date: Tue, 31 Dec 2024 15:57:07 -0500 Subject: [PATCH] fMSX add button callbacks Signed-off-by: Joseph Mattiello --- Cores/fmsx/PVfMSXCore/PVfMSXCoreBridge.mm | 37 +++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Cores/fmsx/PVfMSXCore/PVfMSXCoreBridge.mm b/Cores/fmsx/PVfMSXCore/PVfMSXCoreBridge.mm index 96600301b4..a9c4fbc37c 100644 --- a/Cores/fmsx/PVfMSXCore/PVfMSXCoreBridge.mm +++ b/Cores/fmsx/PVfMSXCore/PVfMSXCoreBridge.mm @@ -273,4 +273,41 @@ - (void *)getVariable:(const char *)variable { #undef V return NULL; } + + +-(void)didReleaseMSXButton:(enum PVMSXButton)button forPlayer:(NSInteger)player { +// if (button == PVDSButtonL) { +// lt[player] |= 0xff * false; +// } else if (button == PVDSButtonR) { +// rt[player] |= 0xff * false; +// } else { +// int mapped = DSMap[button]; +// kcode[player] |= (mapped); +// } +} + +- (void)didMoveMSXJoystickDirection:(enum PVMSXButton)button withValue:(CGFloat)value forPlayer:(NSInteger)player { + /* + float xvalue = gamepad.leftThumbstick.xAxis.value; + s8 x=(s8)(xvalue*127); + joyx[0] = x; + + float yvalue = gamepad.leftThumbstick.yAxis.value; + s8 y=(s8)(yvalue*127 * - 1); //-127 ... + 127 range + joyy[0] = y; + */ +} + +-(void)didMoveJoystick:(NSInteger)button withValue:(CGFloat)value forPlayer:(NSInteger)player { + [self didMoveMSXJoystickDirection:(enum PVMSXButton)button withValue:value forPlayer:player]; +} + +- (void)didPush:(NSInteger)button forPlayer:(NSInteger)player { + [self didPushMSXButton:(PVMSXButton)button forPlayer:player]; +} + +- (void)didRelease:(NSInteger)button forPlayer:(NSInteger)player { + [self didReleaseMSXButton:(PVMSXButton)button forPlayer:player]; +} + @end