Skip to content

Commit

Permalink
Added button masks for Neo Geo ASP extended buttons (#845)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepparks committed Feb 21, 2024
1 parent a0dc2dd commit 13d3b29
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion headers/drivers/neogeo/NeoGeoDescriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@
// Button report (16 bits)
#define NEOGEO_MASK_A (1U << 0)
#define NEOGEO_MASK_B (1U << 1)
#define NEOGEO_MASK_R1 (1U << 2)
#define NEOGEO_MASK_C (1U << 3)
#define NEOGEO_MASK_D (1U << 4)
#define NEOGEO_MASK_R2 (1U << 5)
#define NEOGEO_MASK_L1 (1U << 6)
#define NEOGEO_MASK_L2 (1U << 7)
#define NEOGEO_MASK_OPTIONS (1U << 9)
#define NEOGEO_MASK_SELECT (1U << 10)
#define NEOGEO_MASK_START (1U << 11)

#define NEOGEO_JOYSTICK_MID 0x7f

typedef struct __attribute((packed, aligned(1)))
Expand Down
5 changes: 5 additions & 0 deletions src/drivers/neogeo/NeoGeoDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ void NeoGeoDriver::process(Gamepad * gamepad, uint8_t * outBuffer) {
| (gamepad->pressedB2() ? NEOGEO_MASK_D : 0)
| (gamepad->pressedS1() ? NEOGEO_MASK_SELECT : 0)
| (gamepad->pressedS2() ? NEOGEO_MASK_START : 0)
| (gamepad->pressedA1() ? NEOGEO_MASK_OPTIONS : 0)
| (gamepad->pressedL1() ? NEOGEO_MASK_L1 : 0)
| (gamepad->pressedL2() ? NEOGEO_MASK_L2 : 0)
| (gamepad->pressedR1() ? NEOGEO_MASK_R1 : 0)
| (gamepad->pressedR2() ? NEOGEO_MASK_R2 : 0)
;

// Wake up TinyUSB device
Expand Down

0 comments on commit 13d3b29

Please sign in to comment.