Comments (12)
Can you be more specific about the specific controller you're using? Additionally, if you could run the following command while the controller is connected and share its output, it would be helpful:
ioreg -c IOHIDInterface -k ReportDescriptor | grep -E '"(ReportDescriptor|Product)" = ' | sed -E "s/^[ |]+//g"
The output should be more or less similar to this, and include the name of your controller as well as its HID report descriptor:
"Product" = "Apple Keyboard"
"ReportDescriptor" = <05010906a101050719e029e715002501750195088102950175088101050819012905950575019102950175039101050719002aff0095057508150026ff00810005ff0903750895018102c0>
"Product" = "Apple Keyboard"
"ReportDescriptor" = <050c0901a101050c750195011500250109cd810609b5810209b6810209b8810609e2810609ea810209e981028101c0>
"Product" = "Magic Mouse 2"
"ReportDescriptor" = <0600ff090ba1010600ff090b150026ff00750896040085e08122090b960100859a8122c00600ff0914a101859005847501950315002501096105850944094681029505810175089501150026ff0009658102c0>
"Product" = "Magic Mouse 2"
"ReportDescriptor" = <05010902a1010901a1000509190129021500250185129502750181029501750681010501093009311601fe26ff0136c0fe4640016513550d751095028106950275088101c0c0050d0905a1010600ff090c150026ff0075089510853f8122c00600ff090ca1010600ff090c150026ff0085447508966f018100c0>
"Product" = "Magic Mouse 2"
"ReportDescriptor" = <0600ff0903a1010600ff0903150026ff0085c0966b0075088102c0>
"Product" = "Magic Mouse 2"
"ReportDescriptor" = <05010902a10185120509190129021500250195027501810295017506810305010901a1001601f826ff073601fb46ff046513550d09300931751095028106750895028101c00602ff09558555150026ff0075089540b1a2c00600ff0914a101859005847501950315002501096105850944094681029505810175089501150026ff0009658102c0>
from sameboy.
The controller is simply called "Xbox Wireless Controller". Is this one: https://www.xbox.com/en-US/accessories/controllers/xbox-wireless-controller
This is the info about it in the ioreg
command:
"Product" = "Xbox Wireless Controller"
"ReportDescriptor" = <05010905a10185010901a10009300931150027ffff0000950275108102c00901a10009320935150027ffff0000950275108102c0050209c5150026ff039501750a810215002500750695018103050209c4150026ff039501750a81021500250075069501810305010939150125083500463b016614007504950181427504950115002500350045006500810305091901290f150025017501950f810215002500750195018103050c0ab2001500250195017501810215002500750795018103050f09218503a102099715002501750495019102150025007504950191030970150025647508950491020950660110550e150026ff0075089501910209a7150026ff0075089501910265005500097c150026ff00750895019102c0c0>
from sameboy.
One more thing I'd like to make sure of (Since I don't have a similar controller to test with) – when you actually press one of the d-pad buttons, does SameBoy interpret the correct button presses? I.e., is pressing the left d-pad button actually trigger a left button press in a game? If not, what are they actually doing?
from sameboy.
Yes, I can move left and right and even down without moving up at the same time, but as soon as I release the buttons it moves up again.
from sameboy.
I have the same controller and am experiencing the same issue. This controller works fine with other games and emulators.
from sameboy.
I wrote a small utility to help me debug this. Run this in the terminal while performing the following on your Xbox controller:
- Press and release the A button
- Hold the D-Pad down button
- Press and release the B button
- Release the D-pad down button
- Hold the D-Pad up button
- Press and release the X button
- Release the D-pad up button
Paste the output after performing these actions and it should provide enough information to allow fixing this issue.
from sameboy.
Thanks @LIJI32 for taking the time to look into this issue.
This is the output I got:
λ > ./joydebug
2023-04-15 12:22:44.380 joydebug[179:13253253] Controller connected: <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>, report descriptor: {length = 283, bytes = 0x05010905 a1018501 0901a100 09300931 ... 75089501 9102c0c0 }
2023-04-15 12:22:54.687 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: Got report <016380dd 7e9b7ced 7d000000 00000200 00>
2023-04-15 12:22:54.687 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: <JOYButton: 0x6000005ee010, B (6); State: Presssed>
2023-04-15 12:22:54.814 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: Got report <016380dd 7e9b7ced 7d000000 00000000 00>
2023-04-15 12:22:54.814 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: <JOYButton: 0x6000005ee010, B (6); State: Released>
2023-04-15 12:22:55.684 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: Got report <0163800e 7f9b7ced 7d000000 00050000 00>
2023-04-15 12:22:55.684 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: <JOYHat: 0x600000be4540 (1b); State: 90.000000 degrees>
2023-04-15 12:22:55.789 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: Got report <0163800e 7f9b7ced 7d000000 00000000 00>
2023-04-15 12:22:55.789 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: <JOYHat: 0x600000be4540 (1b); State: released>
2023-04-15 12:22:57.094 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: Got report <0163800e 7f9b7ced 7d000000 00000100 00>
2023-04-15 12:22:57.094 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: <JOYButton: 0x6000005edf80, A (5); State: Presssed>
2023-04-15 12:22:57.229 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: Got report <0163800e 7f9b7ced 7d000000 00000000 00>
2023-04-15 12:22:57.229 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: <JOYButton: 0x6000005edf80, A (5); State: Released>
2023-04-15 12:22:57.634 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: Got report <0163800e 7f9b7ced 7d000000 00050000 00>
2023-04-15 12:22:57.634 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: <JOYHat: 0x600000be4540 (1b); State: 90.000000 degrees>
2023-04-15 12:22:57.753 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: Got report <0163800e 7f9b7ced 7d000000 00000000 00>
2023-04-15 12:22:57.753 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: <JOYHat: 0x600000be4540 (1b); State: released>
2023-04-15 12:23:05.119 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: Got report <0163800e 7f9b7ced 7d000000 00010000 00>
2023-04-15 12:23:05.119 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: <JOYHat: 0x600000be4540 (1b); State: 270.000000 degrees>
2023-04-15 12:23:05.208 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: Got report <0163800e 7f9b7ced 7d000000 00000000 00>
2023-04-15 12:23:05.208 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: <JOYHat: 0x600000be4540 (1b); State: released>
2023-04-15 12:23:05.718 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: Got report <0163800e 7f9b7ced 7d000000 00000800 00>
2023-04-15 12:23:05.718 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: <JOYButton: 0x6000005ee0d0, Y (8); State: Presssed>
2023-04-15 12:23:05.838 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: Got report <0163800e 7f9b7ced 7d000000 00000000 00>
2023-04-15 12:23:05.838 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: <JOYButton: 0x6000005ee0d0, Y (8); State: Released>
2023-04-15 12:23:06.184 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: Got report <0163800e 7f9b7ced 7d000000 00010000 00>
2023-04-15 12:23:06.184 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: <JOYHat: 0x600000be4540 (1b); State: 270.000000 degrees>
2023-04-15 12:23:06.273 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: Got report <0163800e 7f9b7ced 7d000000 00000000 00>
2023-04-15 12:23:06.273 joydebug[179:13253253] <JOYController: 0x7f786c706080, Xbox Wireless Controller, 09711354825238>: <JOYHat: 0x600000be4540 (1b); State: released>
from sameboy.
I'm using 8bitdo Pro2 and experiencing the same thing, as soon as I press any d-pad button up button gets stuck and character starts moving upwards continuously. Analog stick works fine.
When I tried to configure controller from settings it doesn't recognize d-pad up button. Other buttons are recognized but SameBoy keeps using default controller settings.
OS: MacOS 12.6
SameBoy: 0.15.8
from sameboy.
From my understanding the issue is caused by JoyKit/JOYHat.m
line 54, where if calculation result is negative, state
gets 0 assigned to it. For any nonnegative _state
the button is considered pressed.
Changing this line to
signed state = ([_element value] - _element.min) * 360.0 / self.resolution;
makes the Xbox controller work correctly, though unfortunately I don't have access to other controllers to test it with.
Perhaps it would make more sense to set _state
explicitly to -1 when controller dpad is released, as this is the idle value JOYHat
is initialized with.
Again, for modern Xbox controller
signed state;
if ([_element value] == 0) {
state = -1;
} else {
state = ([_element value] - [_element min]) * 360.0 / self.resolution;
}
works.
OS: macOS 13.4.1
SameBoy: Current master (e9be438)
from sameboy.
Ahhh I think I see the issue now, thank you so much for figuring it out, I really couldn't find anyone I could borrow this controller from. Can you see if merely changing unsigned state
to signed state
in the function fixes it? This would allow support for controllers where 0 is a valid Hat value.
from sameboy.
Yes, changing to signed state
works (it gets set to -45 when Xbox controller's dpad is released). I also checked if it works with Dualshock 4 and see no issues. Setting state to -1 when Hat value is 0 would break DS 4 – thanks for pointing that out.
from sameboy.
Awesome! I'll commit this fix and close this issue, thanks!
from sameboy.
Related Issues (20)
- GB Classic: F1 Race - flickering line midscreen
- macOS: Do not hide panels when app focus is lost
- Iphone HOT 2
- Switch Pro Controller iOS recognized, but unable to use HOT 2
- iOS: Gameboy Advance Games don’t get recognised HOT 3
- Add custom palette for iOS HOT 2
- Cloud sync iOS HOT 3
- Polished Crystal iOS (Fixed) HOT 1
- Hex digits invisible in SameBoy Cocoa v0.16.5 HOT 1
- Pocket Family (HuC-3) doesn’t do sound test HOT 3
- [Feature Request] Toggle all cameras on iOS port
- Instructions for testing the gameboy camera integration on real iOS devices HOT 5
- Turbo Speed does not stay HOT 4
- Associate ROM files with SameBoy on Windows HOT 3
- libretro Makefile will need an update to support new Wii U toolchain HOT 1
- Pokémon brown color scheme HOT 4
- [Feature request] Automatically switch emulated console depending on opened ROM
- Requesting a new iOS release for the multi-lens camera feature HOT 3
- Rumble does not work on windows HOT 3
- Cannot load .gb or .gbc file on macOS HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sameboy.