diff options
author | 2023-01-10 04:53:25 +1100 | |
---|---|---|
committer | 2023-01-10 04:53:25 +1100 | |
commit | 06da34a209ac5482a3e06c07d5a0f3305c049c52 (patch) | |
tree | 2a387565123fd73c3aa85969281598787d5b812d /src | |
parent | a435366d8ffc6b571de82ed59205558d8cbd3c95 (diff) |
-Input code cleanup:
* dinput, xinput: Use proper item IDs for hat switches rather than
"other switch".
* xinput: Map right thumb stick to Z/rZ for consistency with SDL and
DirectInput.
* xinput: Map triggers to additional absolute axes 1 and 2.
* xinput: Map start and back buttons to start and select.
* Added default assignments for player 5-10 start/select.
* Added default assignments for 5P-8P start and coin 5-8.
-namco/namcos2.cpp: Changed collective pitch control to AD Stick Z.
Diffstat (limited to 'src')
-rw-r--r-- | src/emu/inpttype.ipp | 48 | ||||
-rw-r--r-- | src/mame/namco/namcos2.cpp | 2 | ||||
-rw-r--r-- | src/osd/interface/inputcode.h | 35 | ||||
-rw-r--r-- | src/osd/modules/input/input_dinput.cpp | 48 | ||||
-rw-r--r-- | src/osd/modules/input/input_xinput.cpp | 35 |
5 files changed, 116 insertions, 52 deletions
diff --git a/src/emu/inpttype.ipp b/src/emu/inpttype.ipp index fc4ca40b8d4..6741fd7de12 100644 --- a/src/emu/inpttype.ipp +++ b/src/emu/inpttype.ipp @@ -380,8 +380,8 @@ namespace { INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON14, N_p("input-name", "%p Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON15, N_p("input-name", "%p Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON16, N_p("input-name", "%p Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(4)) ) \ - INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, START, N_p("input-name", "%p Start"), input_seq() ) \ - INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, SELECT, N_p("input-name", "%p Select"), input_seq() ) \ + INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, START, N_p("input-name", "%p Start"), input_seq(JOYCODE_START_INDEXED(4)) ) \ + INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, SELECT, N_p("input-name", "%p Select"), input_seq(JOYCODE_SELECT_INDEXED(4)) ) \ CORE_INPUT_TYPES_END() #define CORE_INPUT_TYPES_P6 \ @@ -414,8 +414,8 @@ namespace { INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON14, N_p("input-name", "%p Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON15, N_p("input-name", "%p Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON16, N_p("input-name", "%p Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(5)) ) \ - INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, START, N_p("input-name", "%p Start"), input_seq() ) \ - INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, SELECT, N_p("input-name", "%p Select"), input_seq() ) \ + INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, START, N_p("input-name", "%p Start"), input_seq(JOYCODE_START_INDEXED(5)) ) \ + INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, SELECT, N_p("input-name", "%p Select"), input_seq(JOYCODE_SELECT_INDEXED(5)) ) \ CORE_INPUT_TYPES_END() #define CORE_INPUT_TYPES_P7 \ @@ -448,8 +448,8 @@ namespace { INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON14, N_p("input-name", "%p Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON15, N_p("input-name", "%p Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON16, N_p("input-name", "%p Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(6)) ) \ - INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, START, N_p("input-name", "%p Start"), input_seq() ) \ - INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, SELECT, N_p("input-name", "%p Select"), input_seq() ) \ + INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, START, N_p("input-name", "%p Start"), input_seq(JOYCODE_START_INDEXED(6)) ) \ + INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, SELECT, N_p("input-name", "%p Select"), input_seq(JOYCODE_SELECT_INDEXED(6)) ) \ CORE_INPUT_TYPES_END() #define CORE_INPUT_TYPES_P8 \ @@ -482,8 +482,8 @@ namespace { INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON14, N_p("input-name", "%p Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON15, N_p("input-name", "%p Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON16, N_p("input-name", "%p Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(7)) ) \ - INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, START, N_p("input-name", "%p Start"), input_seq() ) \ - INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, SELECT, N_p("input-name", "%p Select"), input_seq() ) \ + INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, START, N_p("input-name", "%p Start"), input_seq(JOYCODE_START_INDEXED(7)) ) \ + INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, SELECT, N_p("input-name", "%p Select"), input_seq(JOYCODE_SELECT_INDEXED(7)) ) \ CORE_INPUT_TYPES_END() #define CORE_INPUT_TYPES_P9 \ @@ -516,8 +516,8 @@ namespace { INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON14, N_p("input-name", "%p Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON15, N_p("input-name", "%p Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON16, N_p("input-name", "%p Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(8)) ) \ - INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, START, N_p("input-name", "%p Start"), input_seq() ) \ - INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, SELECT, N_p("input-name", "%p Select"), input_seq() ) \ + INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, START, N_p("input-name", "%p Start"), input_seq(JOYCODE_START_INDEXED(8)) ) \ + INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, SELECT, N_p("input-name", "%p Select"), input_seq(JOYCODE_SELECT_INDEXED(8)) ) \ CORE_INPUT_TYPES_END() #define CORE_INPUT_TYPES_P10 \ @@ -550,8 +550,8 @@ namespace { INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON14, N_p("input-name", "%p Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON15, N_p("input-name", "%p Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON16, N_p("input-name", "%p Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(9)) ) \ - INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, START, N_p("input-name", "%p Start"), input_seq() ) \ - INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, SELECT, N_p("input-name", "%p Select"), input_seq() ) \ + INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, START, N_p("input-name", "%p Start"), input_seq(JOYCODE_START_INDEXED(9)) ) \ + INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, SELECT, N_p("input-name", "%p Select"), input_seq(JOYCODE_SELECT_INDEXED(9)) ) \ CORE_INPUT_TYPES_END() #define CORE_INPUT_TYPES_START \ @@ -560,10 +560,10 @@ namespace { INPUT_PORT_DIGITAL_TYPE( 0, OTHER, START2, N_p("input-name", "2 Players Start"), input_seq(KEYCODE_2, input_seq::or_code, JOYCODE_START_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 0, OTHER, START3, N_p("input-name", "3 Players Start"), input_seq(KEYCODE_3, input_seq::or_code, JOYCODE_START_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 0, OTHER, START4, N_p("input-name", "4 Players Start"), input_seq(KEYCODE_4, input_seq::or_code, JOYCODE_START_INDEXED(3)) ) \ - INPUT_PORT_DIGITAL_TYPE( 0, OTHER, START5, N_p("input-name", "5 Players Start"), input_seq() ) \ - INPUT_PORT_DIGITAL_TYPE( 0, OTHER, START6, N_p("input-name", "6 Players Start"), input_seq() ) \ - INPUT_PORT_DIGITAL_TYPE( 0, OTHER, START7, N_p("input-name", "7 Players Start"), input_seq() ) \ - INPUT_PORT_DIGITAL_TYPE( 0, OTHER, START8, N_p("input-name", "8 Players Start"), input_seq() ) \ + INPUT_PORT_DIGITAL_TYPE( 0, OTHER, START5, N_p("input-name", "5 Players Start"), input_seq(JOYCODE_START_INDEXED(4)) ) \ + INPUT_PORT_DIGITAL_TYPE( 0, OTHER, START6, N_p("input-name", "6 Players Start"), input_seq(JOYCODE_START_INDEXED(5)) ) \ + INPUT_PORT_DIGITAL_TYPE( 0, OTHER, START7, N_p("input-name", "7 Players Start"), input_seq(JOYCODE_START_INDEXED(6)) ) \ + INPUT_PORT_DIGITAL_TYPE( 0, OTHER, START8, N_p("input-name", "8 Players Start"), input_seq(JOYCODE_START_INDEXED(7)) ) \ CORE_INPUT_TYPES_END() #define CORE_INPUT_TYPES_COIN \ @@ -572,10 +572,10 @@ namespace { INPUT_PORT_DIGITAL_TYPE( 0, OTHER, COIN2, N_p("input-name", "Coin 2"), input_seq(KEYCODE_6, input_seq::or_code, JOYCODE_SELECT_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 0, OTHER, COIN3, N_p("input-name", "Coin 3"), input_seq(KEYCODE_7, input_seq::or_code, JOYCODE_SELECT_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 0, OTHER, COIN4, N_p("input-name", "Coin 4"), input_seq(KEYCODE_8, input_seq::or_code, JOYCODE_SELECT_INDEXED(3)) ) \ - INPUT_PORT_DIGITAL_TYPE( 0, OTHER, COIN5, N_p("input-name", "Coin 5"), input_seq() ) \ - INPUT_PORT_DIGITAL_TYPE( 0, OTHER, COIN6, N_p("input-name", "Coin 6"), input_seq() ) \ - INPUT_PORT_DIGITAL_TYPE( 0, OTHER, COIN7, N_p("input-name", "Coin 7"), input_seq() ) \ - INPUT_PORT_DIGITAL_TYPE( 0, OTHER, COIN8, N_p("input-name", "Coin 8"), input_seq() ) \ + INPUT_PORT_DIGITAL_TYPE( 0, OTHER, COIN5, N_p("input-name", "Coin 5"), input_seq(JOYCODE_SELECT_INDEXED(4)) ) \ + INPUT_PORT_DIGITAL_TYPE( 0, OTHER, COIN6, N_p("input-name", "Coin 6"), input_seq(JOYCODE_SELECT_INDEXED(5)) ) \ + INPUT_PORT_DIGITAL_TYPE( 0, OTHER, COIN7, N_p("input-name", "Coin 7"), input_seq(JOYCODE_SELECT_INDEXED(6)) ) \ + INPUT_PORT_DIGITAL_TYPE( 0, OTHER, COIN8, N_p("input-name", "Coin 8"), input_seq(JOYCODE_SELECT_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 0, OTHER, COIN9, N_p("input-name", "Coin 9"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 0, OTHER, COIN10, N_p("input-name", "Coin 10"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 0, OTHER, COIN11, N_p("input-name", "Coin 11"), input_seq() ) \ @@ -889,10 +889,10 @@ namespace { INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_RECORD_MNG, N_p("input-name", "Record MNG"), input_seq(KEYCODE_F12, KEYCODE_LSHIFT, input_seq::not_code, KEYCODE_LCONTROL) ) \ INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_RECORD_AVI, N_p("input-name", "Record AVI"), input_seq(KEYCODE_F12, KEYCODE_LSHIFT, KEYCODE_LCONTROL) ) \ INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_TOGGLE_CHEAT, N_p("input-name", "Toggle Cheat"), input_seq(KEYCODE_F6) ) \ - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_UP, N_p("input-name", "UI Up"), input_seq(KEYCODE_UP, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(0)) ) \ - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DOWN, N_p("input-name", "UI Down"), input_seq(KEYCODE_DOWN, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(0)) ) \ - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_LEFT, N_p("input-name", "UI Left"), input_seq(KEYCODE_LEFT, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(0)) ) \ - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_RIGHT, N_p("input-name", "UI Right"), input_seq(KEYCODE_RIGHT, input_seq::or_code, JOYCODE_X_RIGHT_SWITCH_INDEXED(0)) ) \ + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_UP, N_p("input-name", "UI Up"), input_seq(KEYCODE_UP, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(0), input_seq::or_code, JOYCODE_HAT1UP_INDEXED(0)) ) \ + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DOWN, N_p("input-name", "UI Down"), input_seq(KEYCODE_DOWN, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(0), input_seq::or_code, JOYCODE_HAT1DOWN_INDEXED(0)) ) \ + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_LEFT, N_p("input-name", "UI Left"), input_seq(KEYCODE_LEFT, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(0), input_seq::or_code, JOYCODE_HAT1LEFT_INDEXED(0)) ) \ + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_RIGHT, N_p("input-name", "UI Right"), input_seq(KEYCODE_RIGHT, input_seq::or_code, JOYCODE_X_RIGHT_SWITCH_INDEXED(0), input_seq::or_code, JOYCODE_HAT1RIGHT_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_HOME, N_p("input-name", "UI Home"), input_seq(KEYCODE_HOME) ) \ INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_END, N_p("input-name", "UI End"), input_seq(KEYCODE_END) ) \ INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_PAGE_UP, N_p("input-name", "UI Page Up"), input_seq(KEYCODE_PGUP) ) \ diff --git a/src/mame/namco/namcos2.cpp b/src/mame/namco/namcos2.cpp index 0e9b3323752..7cef91669bc 100644 --- a/src/mame/namco/namcos2.cpp +++ b/src/mame/namco/namcos2.cpp @@ -1541,7 +1541,7 @@ static INPUT_PORTS_START( metlhawk ) PORT_START("AN6") /* Joystick X */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(100) PORT_KEYDELTA(16) PORT_START("AN7") /* Lever */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(100) PORT_KEYDELTA(16) PORT_REVERSE PORT_PLAYER(2) + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Z ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(100) PORT_KEYDELTA(16) PORT_START("MCUH") /* 63B05Z0 - PORT H */ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) diff --git a/src/osd/interface/inputcode.h b/src/osd/interface/inputcode.h index 1d5b1156ae5..13e053923f8 100644 --- a/src/osd/interface/inputcode.h +++ b/src/osd/interface/inputcode.h @@ -868,5 +868,40 @@ constexpr input_code JOYCODE_SELECT_INDEXED(int n) { return input_code(DEVICE_ #define JOYCODE_START JOYCODE_START_INDEXED(0) #define JOYCODE_SELECT JOYCODE_SELECT_INDEXED(0) +// joystick hats +constexpr input_code JOYCODE_HAT1UP_INDEXED(int n) { return input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT1UP); } +constexpr input_code JOYCODE_HAT1DOWN_INDEXED(int n) { return input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT1DOWN); } +constexpr input_code JOYCODE_HAT1LEFT_INDEXED(int n) { return input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT1LEFT); } +constexpr input_code JOYCODE_HAT1RIGHT_INDEXED(int n) { return input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT1RIGHT); } +constexpr input_code JOYCODE_HAT2UP_INDEXED(int n) { return input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT2UP); } +constexpr input_code JOYCODE_HAT2DOWN_INDEXED(int n) { return input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT2DOWN); } +constexpr input_code JOYCODE_HAT2LEFT_INDEXED(int n) { return input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT2LEFT); } +constexpr input_code JOYCODE_HAT2RIGHT_INDEXED(int n) { return input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT2RIGHT); } +constexpr input_code JOYCODE_HAT3UP_INDEXED(int n) { return input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT3UP); } +constexpr input_code JOYCODE_HAT3DOWN_INDEXED(int n) { return input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT3DOWN); } +constexpr input_code JOYCODE_HAT3LEFT_INDEXED(int n) { return input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT3LEFT); } +constexpr input_code JOYCODE_HAT3RIGHT_INDEXED(int n) { return input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT3RIGHT); } +constexpr input_code JOYCODE_HAT4UP_INDEXED(int n) { return input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT4UP); } +constexpr input_code JOYCODE_HAT4DOWN_INDEXED(int n) { return input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT4DOWN); } +constexpr input_code JOYCODE_HAT4LEFT_INDEXED(int n) { return input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT4LEFT); } +constexpr input_code JOYCODE_HAT4RIGHT_INDEXED(int n) { return input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT4RIGHT); } + +#define JOYCODE_HAT1UP JOYCODE_HAT1UP_INDEXED(0) +#define JOYCODE_HAT1DOWN JOYCODE_HAT1DOWN_INDEXED(0) +#define JOYCODE_HAT1LEFT JOYCODE_HAT1EFT_INDEXED(0) +#define JOYCODE_HAT1RIGHT JOYCODE_HAT1RIGHT_INDEXED(0) +#define JOYCODE_HAT2UP JOYCODE_HAT2UP_INDEXED(0) +#define JOYCODE_HAT2DOWN JOYCODE_HAT2DOWN_INDEXED(0) +#define JOYCODE_HAT2LEFT JOYCODE_HAT2EFT_INDEXED(0) +#define JOYCODE_HAT2RIGHT JOYCODE_HAT2RIGHT_INDEXED(0) +#define JOYCODE_HAT3UP JOYCODE_HAT3UP_INDEXED(0) +#define JOYCODE_HAT3DOWN JOYCODE_HAT3DOWN_INDEXED(0) +#define JOYCODE_HAT3LEFT JOYCODE_HAT3EFT_INDEXED(0) +#define JOYCODE_HAT3RIGHT JOYCODE_HAT3RIGHT_INDEXED(0) +#define JOYCODE_HAT4UP JOYCODE_HAT4UP_INDEXED(0) +#define JOYCODE_HAT4DOWN JOYCODE_HAT4DOWN_INDEXED(0) +#define JOYCODE_HAT4LEFT JOYCODE_HAT4EFT_INDEXED(0) +#define JOYCODE_HAT4RIGHT JOYCODE_HAT4RIGHT_INDEXED(0) + #endif // MAME_OSD_INTERFACE_INPUTCODE_H diff --git a/src/osd/modules/input/input_dinput.cpp b/src/osd/modules/input/input_dinput.cpp index 77467f80d59..56f46532eb1 100644 --- a/src/osd/modules/input/input_dinput.cpp +++ b/src/osd/modules/input/input_dinput.cpp @@ -314,9 +314,9 @@ public: // dinput_device - base directinput device //============================================================ -dinput_device::dinput_device(running_machine &machine, std::string &&name, std::string &&id, input_device_class deviceclass, input_module &module) - : device_info(machine, std::move(name), std::move(id), deviceclass, module), - dinput({nullptr}) +dinput_device::dinput_device(running_machine &machine, std::string &&name, std::string &&id, input_device_class deviceclass, input_module &module) : + device_info(machine, std::move(name), std::move(id), deviceclass, module), + dinput({nullptr}) { } @@ -352,9 +352,9 @@ HRESULT dinput_device::poll_dinput(LPVOID pState) const // dinput_keyboard_device - directinput keyboard device //============================================================ -dinput_keyboard_device::dinput_keyboard_device(running_machine &machine, std::string &&name, std::string &&id, input_module &module) - : dinput_device(machine, std::move(name), std::move(id), DEVICE_CLASS_KEYBOARD, module), - keyboard({{0}}) +dinput_keyboard_device::dinput_keyboard_device(running_machine &machine, std::string &&name, std::string &&id, input_module &module) : + dinput_device(machine, std::move(name), std::move(id), DEVICE_CLASS_KEYBOARD, module), + keyboard({{0}}) { } @@ -377,9 +377,9 @@ void dinput_keyboard_device::reset() // dinput_mouse_device - directinput mouse device //============================================================ -dinput_mouse_device::dinput_mouse_device(running_machine &machine, std::string &&name, std::string &&id, input_module &module) - : dinput_device(machine, std::move(name), std::move(id), DEVICE_CLASS_MOUSE, module), - mouse({0}) +dinput_mouse_device::dinput_mouse_device(running_machine &machine, std::string &&name, std::string &&id, input_module &module) : + dinput_device(machine, std::move(name), std::move(id), DEVICE_CLASS_MOUSE, module), + mouse({0}) { } @@ -404,9 +404,9 @@ void dinput_mouse_device::reset() // dinput_joystick_device - directinput joystick device //============================================================ -dinput_joystick_device::dinput_joystick_device(running_machine &machine, std::string &&name, std::string &&id, input_module &module) - : dinput_device(machine, std::move(name), std::move(id), DEVICE_CLASS_JOYSTICK, module), - joystick({{0}}) +dinput_joystick_device::dinput_joystick_device(running_machine &machine, std::string &&name, std::string &&id, input_module &module) : + dinput_device(machine, std::move(name), std::move(id), DEVICE_CLASS_JOYSTICK, module), + joystick({{0}}) { } @@ -493,19 +493,35 @@ int dinput_joystick_device::configure() // left name = dinput_module::device_item_name(this, offsetof(DIJOYSTATE2, rgdwPOV) + povnum * sizeof(DWORD), default_pov_name(povnum).c_str(), "Left"); - device()->add_item(name, ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<uintptr_t>(povnum * 4 + POVDIR_LEFT))); + device()->add_item( + name, + input_item_id(povnum * 4 + ITEM_ID_HAT1LEFT), + dinput_joystick_pov_get_state, + reinterpret_cast<void *>(uintptr_t(povnum * 4 + POVDIR_LEFT))); // right name = dinput_module::device_item_name(this, offsetof(DIJOYSTATE2, rgdwPOV) + povnum * sizeof(DWORD), default_pov_name(povnum).c_str(), "Right"); - device()->add_item(name, ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<uintptr_t>(povnum * 4 + POVDIR_RIGHT))); + device()->add_item( + name, + input_item_id(povnum * 4 + ITEM_ID_HAT1RIGHT), + dinput_joystick_pov_get_state, + reinterpret_cast<void *>(uintptr_t(povnum * 4 + POVDIR_RIGHT))); // up name = dinput_module::device_item_name(this, offsetof(DIJOYSTATE2, rgdwPOV) + povnum * sizeof(DWORD), default_pov_name(povnum).c_str(), "Up"); - device()->add_item(name, ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<uintptr_t>(povnum * 4 + POVDIR_UP))); + device()->add_item( + name, + input_item_id(povnum * 4 + ITEM_ID_HAT1UP), + dinput_joystick_pov_get_state, + reinterpret_cast<void *>(uintptr_t(povnum * 4 + POVDIR_UP))); // down name = dinput_module::device_item_name(this, offsetof(DIJOYSTATE2, rgdwPOV) + povnum * sizeof(DWORD), default_pov_name(povnum).c_str(), "Down"); - device()->add_item(name, ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<uintptr_t>(povnum * 4 + POVDIR_DOWN))); + device()->add_item( + name, + input_item_id(povnum * 4 + ITEM_ID_HAT1DOWN), + dinput_joystick_pov_get_state, + reinterpret_cast<void *>(uintptr_t(povnum * 4 + POVDIR_DOWN))); } // populate the buttons diff --git a/src/osd/modules/input/input_xinput.cpp b/src/osd/modules/input/input_xinput.cpp index 22171895c97..e7242a4e38a 100644 --- a/src/osd/modules/input/input_xinput.cpp +++ b/src/osd/modules/input/input_xinput.cpp @@ -38,8 +38,8 @@ const input_item_id xinput_axis_ids[] = { ITEM_ID_XAXIS, ITEM_ID_YAXIS, - ITEM_ID_RXAXIS, - ITEM_ID_RYAXIS + ITEM_ID_ZAXIS, + ITEM_ID_RZAXIS }; const USHORT xinput_pov_dir[] = { @@ -63,10 +63,10 @@ const USHORT xinput_buttons[] = { XINPUT_GAMEPAD_Y, XINPUT_GAMEPAD_LEFT_SHOULDER, XINPUT_GAMEPAD_RIGHT_SHOULDER, - XINPUT_GAMEPAD_START, - XINPUT_GAMEPAD_BACK, XINPUT_GAMEPAD_LEFT_THUMB, XINPUT_GAMEPAD_RIGHT_THUMB, + XINPUT_GAMEPAD_START, + XINPUT_GAMEPAD_BACK }; const char *const xinput_button_names[] = { @@ -76,10 +76,23 @@ const char *const xinput_button_names[] = { "Y", "LB", "RB", - "Start", - "Back", "LS", - "RS" + "RS", + "Start", + "Back" +}; + +const input_item_id xinput_button_ids[] = { + ITEM_ID_BUTTON1, + ITEM_ID_BUTTON2, + ITEM_ID_BUTTON3, + ITEM_ID_BUTTON4, + ITEM_ID_BUTTON5, + ITEM_ID_BUTTON6, + ITEM_ID_BUTTON7, + ITEM_ID_BUTTON8, + ITEM_ID_START, + ITEM_ID_SELECT }; @@ -266,7 +279,7 @@ void xinput_joystick_device::configure() { device()->add_item( xinput_pov_names[povnum], - ITEM_ID_OTHER_SWITCH, + input_item_id(ITEM_ID_HAT1UP + povnum), // matches up/down/left/right order generic_button_get_state<BYTE>, &gamepad.povs[povnum]); } @@ -276,20 +289,20 @@ void xinput_joystick_device::configure() { device()->add_item( xinput_button_names[butnum], - static_cast<input_item_id>(ITEM_ID_BUTTON1 + butnum), + xinput_button_ids[butnum], generic_button_get_state<BYTE>, &gamepad.buttons[butnum]); } device()->add_item( "RT", - ITEM_ID_ZAXIS, + ITEM_ID_ADD_ABSOLUTE1, generic_axis_get_state<LONG>, &gamepad.right_trigger); device()->add_item( "LT", - ITEM_ID_RZAXIS, + ITEM_ID_ADD_ABSOLUTE2, generic_axis_get_state<LONG>, &gamepad.left_trigger); |