Skip to content

Commit

Permalink
fMSX add button callbacks
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Mattiello <[email protected]>
  • Loading branch information
JoeMatt committed Dec 31, 2024
1 parent 004f626 commit b0f22e1
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Cores/fmsx/PVfMSXCore/PVfMSXCoreBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,37 @@ - (void *)getVariable:(const char *)variable {
#undef V
return NULL;
}

- (void)didPushMSXButton:(PVMSXButton)button forPlayer:(NSInteger)player {
_pad[player][button] = 1;
}

-(void)didReleaseMSXButton:(enum PVMSXButton)button forPlayer:(NSInteger)player {
_pad[player][button] = 0;
}

- (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

0 comments on commit b0f22e1

Please sign in to comment.