1
0
mirror of https://github.com/djhackersdev/bemanitools.git synced 2025-01-19 07:17:23 +01:00

vigem-iidxio: Fix Luncatic Rave 2 incompatible button mappings

Reported by Grim:
LR2 cannot make use of the d-pad as buttons for inputs because
reasons. Create a third virtual gamepad to allow handling all
inputs as "normal buttons" including turntables.
This commit is contained in:
icex2 2020-12-18 19:48:35 +01:00
parent 2363498f73
commit 9a5418f6a3
2 changed files with 60 additions and 56 deletions

View File

@ -1,6 +1,6 @@
# ViGEm IIDXIO # ViGEm IIDXIO
This application allows you to use any iidxio backend, e.g. `iidxio-ezusb.dll`, `iidxio-ezusb2.dll` This application allows you to use any iidxio backend, e.g. `iidxio-ezusb.dll`, `iidxio-ezusb2.dll`
or `iidxio-bio2.dll`, to be exposed as two XBOX 360 game controller on Windows. or `iidxio-bio2.dll`, to be exposed as three XBOX 360 game controller on Windows.
Thus, it allows you to use a real cabinet with all its IO with *any* game that supports xinput. Thus, it allows you to use a real cabinet with all its IO with *any* game that supports xinput.
@ -21,33 +21,33 @@ IO board for [ezusb](../iidxhook/iidxio-ezusb.md#setup) or
* To quit the program, hit the `TEST` and `SERVICE` buttons at the same time * To quit the program, hit the `TEST` and `SERVICE` buttons at the same time
## Input mappings ## Input mappings
| Cabinet | XBOX Gamepad 1 | XBOX Gamepad 2 | | Cabinet | XBOX Gamepad 1 | XBOX Gamepad 2 | XBOX Gamepad 3 |
|------------|--------------------|--------------------| |------------|--------------------|--------------------|--------------------|
| P1 Key 1 | A | | | P1 Key 1 | A | | |
| P1 Key 2 | B | | | P1 Key 2 | B | | |
| P1 Key 3 | X | | | P1 Key 3 | X | | |
| P1 Key 4 | Y | | | P1 Key 4 | Y | | |
| P1 Key 5 | Left shoulder | | | P1 Key 5 | Left shoulder | | |
| P1 Key 6 | Rights houlder | | | P1 Key 6 | Rights houlder | | |
| P1 Key 7 | Dpad right | | | P1 Key 7 | Start | | |
| P2 Key 1 | | A | | P2 Key 1 | | A | |
| P2 Key 2 | | B | | P2 Key 2 | | B | |
| P2 Key 3 | | X | | P2 Key 3 | | X | |
| P2 Key 4 | | Y | | P2 Key 4 | | Y | |
| P2 Key 5 | | Left shoulder | | P2 Key 5 | | Left shoulder | |
| P2 Key 6 | | Rights houlder | | P2 Key 6 | | Rights houlder | |
| P2 Key 7 | | Dpad right | | P2 Key 7 | | Start | |
| Start P1 | Start | | | Start P1 | Back | | |
| Start P2 | | Start | | Start P2 | | Back | |
| VEFX | Back | | | VEFX | | | B |
| Effect | | Back | | Effect | | | A |
| Test | Left thumbstick | | | Test | | | X |
| Service | Right thumbstick | | | Service | | | Y |
| Coin | | Left thumbstick | | Coin | | | Start |
| TT P1 Up | Thumbstick X axis+ | | | TT P1 Up | Thumbstick X axis+ | | |
| TT P1 Down | Thumbstick X axis- | | | TT P1 Down | Thumbstick X axis- | | |
| TT P2 Up | | Thumbstick X axis+ | | TT P2 Up | | Thumbstick X axis+ | |
| TT P2 Down | | Thumbstick X axis- | | TT P2 Down | | Thumbstick X axis- | |
Turntables are either in absolute or relative mode depending on how it's defined in the Turntables are either in absolute or relative mode depending on how it's defined in the
`vigem-iidxio.conf`. `vigem-iidxio.conf`.

View File

@ -22,6 +22,8 @@
#define ANALOG_FIXED_SENSITIVITY 256 #define ANALOG_FIXED_SENSITIVITY 256
static const uint8_t JOYSTICKS_NUM = 3;
static int16_t _convert_analog_to_s16(uint8_t val) static int16_t _convert_analog_to_s16(uint8_t val)
{ {
return (int64_t) val * 256; return (int64_t) val * 256;
@ -114,28 +116,28 @@ int main(int argc, char **argv)
return -1; return -1;
} }
PVIGEM_TARGET pad[2]; PVIGEM_TARGET pad[JOYSTICKS_NUM];
bool failed;
pad[0] = vigem_helper_add_pad(client); failed = false;
pad[1] = vigem_helper_add_pad(client);
if (!pad[0] || !pad[1]) { for (uint8_t i = 0; i < JOYSTICKS_NUM; i++) {
if (!pad[0]) { pad[i] = vigem_helper_add_pad(client);
log_warning("vigem_alloc pad 1 failed");
} if (!pad[i]) {
log_warning("vigem_alloc pad %d failed", i);
if (!pad[1]) { failed = true;
log_warning("vigem_alloc pad 2 failed");
} }
}
if (failed) {
iidx_io_fini(); iidx_io_fini();
return -1; return -1;
} }
bool loop = true; bool loop = true;
XUSB_REPORT state[2]; XUSB_REPORT state[JOYSTICKS_NUM];
log_info("vigem init succeeded, beginning poll loop"); log_info("vigem init succeeded, beginning poll loop");
@ -160,8 +162,9 @@ int main(int argc, char **argv)
break; break;
} }
memset(&state[0], 0, sizeof(state[0])); for (uint8_t i = 0; i < JOYSTICKS_NUM; i++) {
memset(&state[1], 0, sizeof(state[1])); memset(&state[i], 0, sizeof(state[i]));
}
// 14 keys // 14 keys
uint16_t keys = iidx_io_ep2_get_keys(); uint16_t keys = iidx_io_ep2_get_keys();
@ -179,7 +182,7 @@ int main(int argc, char **argv)
state[0].wButtons |= _check_assign_key( state[0].wButtons |= _check_assign_key(
keys, IIDX_IO_KEY_P1_6, XUSB_GAMEPAD_RIGHT_SHOULDER); keys, IIDX_IO_KEY_P1_6, XUSB_GAMEPAD_RIGHT_SHOULDER);
state[0].wButtons |= _check_assign_key( state[0].wButtons |= _check_assign_key(
keys, IIDX_IO_KEY_P1_7, XUSB_GAMEPAD_DPAD_RIGHT); keys, IIDX_IO_KEY_P1_7, XUSB_GAMEPAD_BACK);
state[1].wButtons |= _check_assign_key( state[1].wButtons |= _check_assign_key(
keys, IIDX_IO_KEY_P2_1, XUSB_GAMEPAD_A); keys, IIDX_IO_KEY_P2_1, XUSB_GAMEPAD_A);
@ -194,7 +197,7 @@ int main(int argc, char **argv)
state[1].wButtons |= _check_assign_key( state[1].wButtons |= _check_assign_key(
keys, IIDX_IO_KEY_P2_6, XUSB_GAMEPAD_RIGHT_SHOULDER); keys, IIDX_IO_KEY_P2_6, XUSB_GAMEPAD_RIGHT_SHOULDER);
state[1].wButtons |= _check_assign_key( state[1].wButtons |= _check_assign_key(
keys, IIDX_IO_KEY_P2_7, XUSB_GAMEPAD_DPAD_RIGHT); keys, IIDX_IO_KEY_P2_7, XUSB_GAMEPAD_BACK);
// Panel buttons // Panel buttons
uint8_t panel = iidx_io_ep2_get_panel(); uint8_t panel = iidx_io_ep2_get_panel();
@ -203,20 +206,21 @@ int main(int argc, char **argv)
panel, IIDX_IO_PANEL_LIGHT_P1_START, XUSB_GAMEPAD_START); panel, IIDX_IO_PANEL_LIGHT_P1_START, XUSB_GAMEPAD_START);
state[1].wButtons |= _check_assign_key( state[1].wButtons |= _check_assign_key(
panel, IIDX_IO_PANEL_LIGHT_P2_START, XUSB_GAMEPAD_START); panel, IIDX_IO_PANEL_LIGHT_P2_START, XUSB_GAMEPAD_START);
state[0].wButtons |= _check_assign_key(
panel, IIDX_IO_PANEL_LIGHT_VEFX, XUSB_GAMEPAD_BACK); state[2].wButtons |= _check_assign_key(
state[1].wButtons |= _check_assign_key( panel, IIDX_IO_PANEL_LIGHT_VEFX, XUSB_GAMEPAD_B);
panel, IIDX_IO_PANEL_LIGHT_EFFECT, XUSB_GAMEPAD_BACK); state[2].wButtons |= _check_assign_key(
panel, IIDX_IO_PANEL_LIGHT_EFFECT, XUSB_GAMEPAD_A);
// System buttons // System buttons
uint8_t system = iidx_io_ep2_get_sys(); uint8_t system = iidx_io_ep2_get_sys();
state[0].wButtons |= _check_assign_key( state[2].wButtons |= _check_assign_key(
system, IIDX_IO_SYS_TEST, XUSB_GAMEPAD_LEFT_THUMB); system, IIDX_IO_SYS_TEST, XUSB_GAMEPAD_X);
state[0].wButtons |= _check_assign_key( state[2].wButtons |= _check_assign_key(
system, IIDX_IO_SYS_SERVICE, XUSB_GAMEPAD_RIGHT_THUMB); system, IIDX_IO_SYS_SERVICE, XUSB_GAMEPAD_Y);
state[1].wButtons |= _check_assign_key( state[2].wButtons |= _check_assign_key(
system, IIDX_IO_SYS_COIN, XUSB_GAMEPAD_LEFT_THUMB); system, IIDX_IO_SYS_COIN, XUSB_GAMEPAD_START);
// Turntable // Turntable
uint8_t turntable[2]; uint8_t turntable[2];
@ -303,7 +307,7 @@ int main(int argc, char **argv)
Sleep(10); Sleep(10);
for (int i = 0; i < 2; i++) { for (uint8_t i = 0; i < JOYSTICKS_NUM; i++) {
vigem_target_remove(client, pad[i]); vigem_target_remove(client, pad[i]);
vigem_target_free(pad[i]); vigem_target_free(pad[i]);
} }