Skip to content

Commit b0f22e1

Browse files
committed
fMSX add button callbacks
Signed-off-by: Joseph Mattiello <[email protected]>
1 parent 004f626 commit b0f22e1

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Cores/fmsx/PVfMSXCore/PVfMSXCoreBridge.mm

+33
Original file line numberDiff line numberDiff line change
@@ -273,4 +273,37 @@ - (void *)getVariable:(const char *)variable {
273273
#undef V
274274
return NULL;
275275
}
276+
277+
- (void)didPushMSXButton:(PVMSXButton)button forPlayer:(NSInteger)player {
278+
_pad[player][button] = 1;
279+
}
280+
281+
-(void)didReleaseMSXButton:(enum PVMSXButton)button forPlayer:(NSInteger)player {
282+
_pad[player][button] = 0;
283+
}
284+
285+
- (void)didMoveMSXJoystickDirection:(enum PVMSXButton)button withValue:(CGFloat)value forPlayer:(NSInteger)player {
286+
/*
287+
float xvalue = gamepad.leftThumbstick.xAxis.value;
288+
s8 x=(s8)(xvalue*127);
289+
joyx[0] = x;
290+
291+
float yvalue = gamepad.leftThumbstick.yAxis.value;
292+
s8 y=(s8)(yvalue*127 * - 1); //-127 ... + 127 range
293+
joyy[0] = y;
294+
*/
295+
}
296+
297+
-(void)didMoveJoystick:(NSInteger)button withValue:(CGFloat)value forPlayer:(NSInteger)player {
298+
[self didMoveMSXJoystickDirection:(enum PVMSXButton)button withValue:value forPlayer:player];
299+
}
300+
301+
- (void)didPush:(NSInteger)button forPlayer:(NSInteger)player {
302+
[self didPushMSXButton:(PVMSXButton)button forPlayer:player];
303+
}
304+
305+
- (void)didRelease:(NSInteger)button forPlayer:(NSInteger)player {
306+
[self didReleaseMSXButton:(PVMSXButton)button forPlayer:player];
307+
}
308+
276309
@end

0 commit comments

Comments
 (0)