Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
01663 DIP/Input Major Always Apr 3, 2008, 16:00 Apr 4, 2008, 07:39
Tester Mr_Person View Status Public Platform MAME (Self-compiled)
Assigned To couriersud Resolution Fixed OS Windows XP/Vista 64-bit
Status [?] Resolved Driver
Version 0.124u1 Fixed in Version 0.124u2 Build I686
Fixed in Git Commit Github Pull Request #
Summary 01663: Hat switches not working
Description Hat switch inputs are not read at all, even in the control setup menu.

Reverting the following change to input.c seems to make things work as they did before, though I don't understand the input system well enough to make heads or tails of what's breaking.

@@ -409,11 +476,11 @@
 INLINE input_item_class input_item_standard_class(input_device_class devclass, input_item_id itemid)
 {
 	/* most everything standard is a switch, apart from the axes */
-	if (itemid == ITEM_ID_OTHER_SWITCH || itemid < ITEM_ID_XAXIS || itemid > ITEM_ID_SLIDER2)
+	if (itemid == ITEM_ID_OTHER_SWITCH || itemid < ITEM_ID_XAXIS || (itemid > ITEM_ID_SLIDER2 && itemid < ITEM_ID_ADD_ABSOLUTE1))
 		return ITEM_CLASS_SWITCH;
Steps To Reproduce
Additional Information
Github Commit
Flags
Regression Version
Affected Sets / Systems
Attached Files
? file icon t.diff (828 bytes) Apr 3, 2008, 21:10
[Show Content]
Relationships
There are no relationship linked to this issue.
Notes
9
User avatar
No.00516
Tafoid
Administrator
Apr 3, 2008, 16:20
Please give us an example of a game or driver which no longer works due to this error. A report is hard to test when you don't know any games off the top of your head that contain hat switch input :)
User avatar
No.00517
Mr_Person
Tester
Apr 3, 2008, 16:25
Sorry. I mean that the hat switches on my physical joysticks/gamepads are non-functional i.e. the d-pad of the gamepad I have sitting on my desk no longer works.
User avatar
No.00519
etabeta
Developer
Apr 3, 2008, 17:14
edited on: Apr 3, 2008, 17:14
have you tried to remove cfg/default.cfg and to remap the inputs?
User avatar
No.00532
couriersud
Developer
Apr 3, 2008, 21:08
Looks like the hats are registered as an axis. Can you try the following patch instead of your changes?

--- /tmp/sdlmame0124u1/src/emu/input.c	2008-04-03 15:03:22.000000000 +0200
+++ src/emu/input.c	2008-04-03 23:06:04.000000000 +0200
@@ -759,6 +759,7 @@
 void input_device_item_add(input_device *device, const char *name, void *internal, input_item_id itemid, item_get_state_func getstate)
 {
 	input_device_item *item;
+	input_item_id itemid_std = itemid;
 
 	assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT, "Can only call input_device_item_add at init time!");
 	assert(name != NULL);
@@ -787,7 +788,7 @@
 	item->name = astring_cpyc(auto_astring_alloc(), name);
 	item->token = NULL;
 	item->internal = internal;
-	item->itemclass = input_item_standard_class(device->devclass, itemid);
+	item->itemclass = input_item_standard_class(device->devclass, itemid_std);
 	item->itemid = itemid;
 	item->getstate = getstate;
User avatar
No.00533
couriersud
Developer
Apr 3, 2008, 21:10
I have uploaded the above diff as well (t.diff). The patch in the note will not work if copy/pasted.
User avatar
No.00534
Mr_Person
Tester
Apr 3, 2008, 21:35
Figures that I refreshed at 21:09...

Seems to work properly now, as far as I can tell. Tested a few randomly launched sets and in menus.
User avatar
No.00538
Fujix
Administrator
Apr 4, 2008, 03:16
Disabled text wrapping between pre tags and it recovers escaped characters correctly.
Copy & paste of source code should work now :)
User avatar
No.00541
couriersud
Developer
Apr 4, 2008, 07:35
Good to see it working! Thanks a lot for your support.

@Fujix: Thanks for changing the setting. This makes me like mantis even more.
User avatar
No.00542
couriersud
Developer
Apr 4, 2008, 07:39
All custom itemids were mapped to class SWITCH. With the recent modification, this implicitly changed to ABSOLUTE.
The fix submitted will use the passed itemid to determine the class.