This commit is contained in:
Hay1tsme 2021-12-22 23:23:42 -05:00 committed by Hay1tsme
parent 08832ea140
commit 040b9f8dcf
3 changed files with 18 additions and 100 deletions

View File

@ -52,11 +52,11 @@ static HRESULT mercury_io4_poll(void *ctx, struct io4_state *state)
mercury_dll.get_opbtns(&opbtn); mercury_dll.get_opbtns(&opbtn);
if (opbtn & MAI2_IO_OPBTN_TEST) { if (opbtn & MERCURY_IO_OPBTN_TEST) {
state->buttons[0] |= IO4_BUTTON_TEST; state->buttons[0] |= IO4_BUTTON_TEST;
} }
if (opbtn & MAI2_IO_OPBTN_SERVICE) { if (opbtn & MERCURY_IO_OPBTN_SERVICE) {
state->buttons[0] |= IO4_BUTTON_SERVICE; state->buttons[0] |= IO4_BUTTON_SERVICE;
} }

View File

@ -26,89 +26,13 @@ HRESULT mercury_io_init(void)
HRESULT mercury_io_poll(void) HRESULT mercury_io_poll(void)
{ {
mercury_opbtn = 0; mercury_opbtn = 0;
mercury_player1_btn = 0;
mercury_player2_btn = 0;
if (GetAsyncKeyState(mercury_io_cfg.vk_test)) { if (GetAsyncKeyState(mercury_io_cfg.vk_test)) {
mercury_opbtn |= MAI2_IO_OPBTN_TEST; mercury_opbtn |= MERCURY_IO_OPBTN_TEST;
} }
if (GetAsyncKeyState(mercury_io_cfg.vk_service)) { if (GetAsyncKeyState(mercury_io_cfg.vk_service)) {
mercury_opbtn |= MAI2_IO_OPBTN_SERVICE; mercury_opbtn |= MERCURY_IO_OPBTN_SERVICE;
}
//Player 1
if (GetAsyncKeyState(mercury_io_cfg.vk_1p_btn[0])) {
mercury_player1_btn |= MAI2_IO_GAMEBTN_1;
}
if (GetAsyncKeyState(mercury_io_cfg.vk_1p_btn[1])) {
mercury_player1_btn |= MAI2_IO_GAMEBTN_2;
}
if (GetAsyncKeyState(mercury_io_cfg.vk_1p_btn[2])) {
mercury_player1_btn |= MAI2_IO_GAMEBTN_3;
}
if (GetAsyncKeyState(mercury_io_cfg.vk_1p_btn[3])) {
mercury_player1_btn |= MAI2_IO_GAMEBTN_4;
}
if (GetAsyncKeyState(mercury_io_cfg.vk_1p_btn[4])) {
mercury_player1_btn |= MAI2_IO_GAMEBTN_5;
}
if (GetAsyncKeyState(mercury_io_cfg.vk_1p_btn[5])) {
mercury_player1_btn |= MAI2_IO_GAMEBTN_6;
}
if (GetAsyncKeyState(mercury_io_cfg.vk_1p_btn[6])) {
mercury_player1_btn |= MAI2_IO_GAMEBTN_7;
}
if (GetAsyncKeyState(mercury_io_cfg.vk_1p_btn[7])) {
mercury_player1_btn |= MAI2_IO_GAMEBTN_8;
}
if (GetAsyncKeyState(mercury_io_cfg.vk_1p_btn[8])) {
mercury_player1_btn |= MAI2_IO_GAMEBTN_SELECT;
}
//Player 2
if (GetAsyncKeyState(mercury_io_cfg.vk_2p_btn[0])) {
mercury_player2_btn |= MAI2_IO_GAMEBTN_1;
}
if (GetAsyncKeyState(mercury_io_cfg.vk_2p_btn[1])) {
mercury_player2_btn |= MAI2_IO_GAMEBTN_2;
}
if (GetAsyncKeyState(mercury_io_cfg.vk_2p_btn[2])) {
mercury_player2_btn |= MAI2_IO_GAMEBTN_3;
}
if (GetAsyncKeyState(mercury_io_cfg.vk_2p_btn[3])) {
mercury_player2_btn |= MAI2_IO_GAMEBTN_4;
}
if (GetAsyncKeyState(mercury_io_cfg.vk_2p_btn[4])) {
mercury_player2_btn |= MAI2_IO_GAMEBTN_5;
}
if (GetAsyncKeyState(mercury_io_cfg.vk_2p_btn[5])) {
mercury_player2_btn |= MAI2_IO_GAMEBTN_6;
}
if (GetAsyncKeyState(mercury_io_cfg.vk_2p_btn[6])) {
mercury_player2_btn |= MAI2_IO_GAMEBTN_7;
}
if (GetAsyncKeyState(mercury_io_cfg.vk_2p_btn[7])) {
mercury_player2_btn |= MAI2_IO_GAMEBTN_8;
}
if (GetAsyncKeyState(mercury_io_cfg.vk_2p_btn[8])) {
mercury_player2_btn |= MAI2_IO_GAMEBTN_SELECT;
} }
return S_OK; return S_OK;
@ -123,11 +47,5 @@ void mercury_io_get_opbtns(uint8_t *opbtn)
void mercury_io_get_gamebtns(uint16_t *player1, uint16_t *player2) void mercury_io_get_gamebtns(uint16_t *player1, uint16_t *player2)
{ {
if (player1 != NULL) {
*player1 = mercury_player1_btn;
}
if (player2 != NULL ){
*player2 = mercury_player2_btn;
}
} }

View File

@ -5,20 +5,20 @@
#include <stdint.h> #include <stdint.h>
enum { enum {
MAI2_IO_OPBTN_TEST = 0x01, MERCURY_IO_OPBTN_TEST = 0x01,
MAI2_IO_OPBTN_SERVICE = 0x02, MERCURY_IO_OPBTN_SERVICE = 0x02,
}; };
enum { enum {
MAI2_IO_GAMEBTN_1 = 0x01, MERCURY_IO_GAMEBTN_1 = 0x01,
MAI2_IO_GAMEBTN_2 = 0x02, MERCURY_IO_GAMEBTN_2 = 0x02,
MAI2_IO_GAMEBTN_3 = 0x04, MERCURY_IO_GAMEBTN_3 = 0x04,
MAI2_IO_GAMEBTN_4 = 0x08, MERCURY_IO_GAMEBTN_4 = 0x08,
MAI2_IO_GAMEBTN_5 = 0x10, MERCURY_IO_GAMEBTN_5 = 0x10,
MAI2_IO_GAMEBTN_6 = 0x20, MERCURY_IO_GAMEBTN_6 = 0x20,
MAI2_IO_GAMEBTN_7 = 0x40, MERCURY_IO_GAMEBTN_7 = 0x40,
MAI2_IO_GAMEBTN_8 = 0x80, MERCURY_IO_GAMEBTN_8 = 0x80,
MAI2_IO_GAMEBTN_SELECT = 0x100, MERCURY_IO_GAMEBTN_SELECT = 0x100,
}; };
/* Get the version of the Wacca IO API that this DLL supports. This /* Get the version of the Wacca IO API that this DLL supports. This
@ -47,7 +47,7 @@ HRESULT mercury_io_init(void);
HRESULT mercury_io_poll(void); HRESULT mercury_io_poll(void);
/* Get the state of the cabinet's operator buttons as of the last poll. See /* Get the state of the cabinet's operator buttons as of the last poll. See
MAI2_IO_OPBTN enum above: this contains bit mask definitions for button MERCURY_IO_OPBTN enum above: this contains bit mask definitions for button
states returned in *opbtn. All buttons are active-high. states returned in *opbtn. All buttons are active-high.
Minimum API version: 0x0100 */ Minimum API version: 0x0100 */
@ -55,7 +55,7 @@ HRESULT mercury_io_poll(void);
void mercury_io_get_opbtns(uint8_t *opbtn); void mercury_io_get_opbtns(uint8_t *opbtn);
/* Get the state of the cabinet's gameplay buttons as of the last poll. See /* Get the state of the cabinet's gameplay buttons as of the last poll. See
MAI2_IO_GAMEBTN enum above for bit mask definitions. Inputs are split into MERCURY_IO_GAMEBTN enum above for bit mask definitions. Inputs are split into
a left hand side set of inputs and a right hand side set of inputs: the bit a left hand side set of inputs and a right hand side set of inputs: the bit
mappings are the same in both cases. mappings are the same in both cases.