-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SJ@JX Arcade] Using start select in Makecode(detected&working) #10
Comments
I'll try my best, even though it's hard to be precise and correct when I don't have first hand access myself to your particular gamepad. We therefore have to try to help eachother on the way. First a brief introduction to how MakeCode Arcade games and McAirpos handles game controller inputs: Basically, there are 2 kinds of button/input event types for the various supported controllers(keyboards, gamepads etc.):
Then there is the fact that MakeCode Arcade games operates with "RAW"/physical/most basic inputs, totally unaware of any higher level gamepad systems/libraries, like SDL etc. in RetroPie etc. To be precise, MC Arcade games uses input events directly from Linux Input Subsystem, and how these were implemented in the gamepad hardware driver, which has no adapted standard between gamepad producers, and where e.g. value -127 for a given input could be either up or down, within or outside bounds etc., and the names for the various axis and buttons varies just as much... MC Arcade games with McAirpos have 3 logical levels to deal with this, in order of higher complexity to get it right:
The good news are that with most buttons/axis working, you're already 95% there, and with a high probability of success, hopefully on the first/lowest level. (And if you're lucky, your gamepad driver only sends EV_KEY input events, and you may also choose to optimize away the highest level/uinput-mapper, saving a lot of resources running Python and re-mapping of mappings, with just a few edits to /sd/arcade.cfg.) What you need to do is:
Hopefully(normally) your gamepad driver has registered keys for START and SELECT, and you just have to rewire the two buttons you intended to be START and SELECT, respectively, and everything works out of the box(except for a required quick remap inside RetroPie afterwards). If not, or if you only have EV_KEY inputs, please come back here again, and we'll give it another shot with the various config files. Other issues maybe related to yours: Thanks for the star and nice pictures of and other resources from your great project that you shared on the MakeCode forum! I hope you get this to work for yourself and your students! Br, Vegard |
Great thanks for the info, so
|
Ok figured it out! Start now restarts the game, select takes you out! Just to reiterate this is the joystick I am using, I built another arcade before with a fancy Sanwa Joystick but this works just as well https://www.amazon.ca/gp/product/B07FZ3YT1G/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1 here is a pic with the correct wiring https://docs.google.com/drawings/d/1ZH0-auSRxWGQiEpPQlnAV9Nv_ROVA1Jr8BCn6CPLqPA/edit?usp=sharing and below is the config you should set up for the running the buttons in the correct order (light punch medium punch....) if you want street fighter etc to work Button Config for Street Fighter/fighting games Light Punch - y Light Kick - b Thanks so much for your help! Just need a volume control for my usb and we will be all set! The kids will love this, time for me to get back to focusing on my coding in Makecode, to build out some games for this unit, thanks for all your hard work on this amazing platform, Makecode should be paying close attention to what you are doing! Quick question I unplugged the joystick but I still got that running log, any idea why? thnx |
Great! Glad to hear that it works now!
You are welcome and thank you for the final write-up above for others to follow with similar arcade controllers! The idea stems from wanting to get my son's MakeCode Arcade creations playable on a big screen with some Raspberry Pis and some old PS3 console controllers lying around in the house. But my impression is that various impressive homemade arcade cabinet creations, like yours, is the more common use case. Sadly, I don't have any such arcade controllers at home to test myself, and they come in countless different flavours, so I appreciate your support here!
Also thank you for finding and sharing a solution to the USB sound issues, which many have been complaining about, and that I also have been unable to figure out myself!
Thanks for the kind words! MakeCode is really amazing, with Arcade and alle the supported hardware and interfaces(Minecraft), and the unique seamless transition from block based to text based programming! It's a real treat to watch how my son learns and evolves his programming and creative skills, and all his and the nice community's game creations(and all the creative maker stuff). It is also a bit odd to me that MakeCode therefore isn't the biggest thing around yet since the invention of ice cream... ;-) Anyhow, good luck with future cabinet and MakeCode coding projects for you and your students! Microsoft, by the way, have been really supportive regarding compilation of MC Arcade games for the RPi, figuring out why the games froze the screen initially and the inner workings of the controller support. They also awarded McAirpos a link on the RPi hardware pages, so I guess we cannot complain... ;-) But don't forget that McAirpos is as close to the definition of a kludge/hack as it is possible to get. The elegant and best (and probably not that hard for anyone competent enough in C++/TypeScript)solution to the screen freeze and controller support issues on the RPi(or other OS'es and devices) would have been directly in the compiler source code itself, which is open source, too. I am still battling with Bjarne Stroustrup's books, but this might be a fun challenge for anyone who dares to take it on, and I know that there are people in both the RetroPie and Recalbox teams who are willing to help anyone's efforts to integrate MakeCode Arcade game support into their installers and with their respective gamepad implementations. That would be really cool, but not worth anyone's effort to build on top of the McAirpos hack. I don't know exactly why, but Microsoft seems to prioritize small handheld devices over native execution support on RPi(with many retro game users and systems) and other OS'es and devices, and the RPi community seems a bit lukewarm towards MakeCode. Maybe I am wrong.
I was wondering about the same thing myself. The closest thing I know about was the Raspberry Pi OS built in driver for the PS3 controller, which did not have a "dead zone" for the "analog"/graded thumb joysticks, and showed a similar behaviour. But this does not quite fit with running values in the interval 128-133(strange "center" values), and definitively not when still showing if the joystick is physically disconnected... But some switch/input is definitively in an "ON" state. Maybe a driver or electrical fault, where I would start searching for the error by first identifying what the axis ABS_Z really is. However, if it doesn't noticeably interfere with how your controller works in games, I would just leave it be. One optimization tip, though: To maximize controller support, I added a calibration script to get max values for joystick left, right, up and down, which runs every time you start a game, and some redundant button mappings for uinput-mapper. If you ever get the time or need, the max values can be hard-coded for your specific controller instead and the redundant mappings removed in ../uinput-mapper/configs/arcade1.py to get somewhat better and more stable performance(sometimes your game character sprite might shoot in one direction until you have moved the stick fully in every direction). I once had a grand plan to make or gather from the community uinput-mapper config files for common controllers that should be supported, but I am personally not that fond of doing almost the same config operation many times over... ;-) |
Thanks for all that, ive learned a lot from this little adventure, one more question before I go, I am now attempting to use a potentiometer for the volume. It looks like I will need to use 4 GPIOs, I am assuming the joystick/button encoder takes up some of these GPIOs, how would I determine which ones those are? thnx |
Sorry, I have no experience with the GPIOs beyond a power button and script that I use. Your controller states a USB interface, and you mentioned audio over USB, as well. I thought USB was fully independent of the GPIOs on the RPi? I would image, just like it is possible to read GPIO signals from a button press in the power Python script I am using, that it would be possible to have a program reading either voltages from a potentiometer position or button presses(up and down) from the GPIOs and then translate to volume levels or volume in-/decrements? But really I have no tested idea. |
Thnx again, have a great day! |
I reopened this issue for @sofiania, for the same controllers, from this issue:
Please read and follow this issue as best you can, and maybe you could ping @QuadDam (@dace at the MakeCode Arcade forum) for help here, as he is one who has actually had success with this.
No, not that I know of outside:
I understand your confusion(which I share...), controller support is a giant subject, where everything has to play together in the correct order, from:
Therefore, after advise from the creators of MakeCode Arcade, I have tried to the best of my abilities to maximize controller support out of the box in McAirpos, and then I leave it up to the community to help each other, share knowledge and maybe write guides, publish pull requests etc., and I try to help with the issues here and update the code when I have time.
Please reset /sd/arcade.cfg and the ~/McAirpos/McAirpos/uinput-mapper/configs/arcadeX.py_ files to their original McAirpos state, where they are configured to play nicely together: Then, please start at the physical step 1. above, maybe with some help from reading further up inside this issue or from @QuadDam (@dace at the MakeCode Arcade forum). Remember, that MakeCode Arcade games uses raw input event codes from keyboards and controllers, so normally you have to start from the beginning with checking the physical wiring(most common issue with DIY arcade controllers), and the, when it all works in McAirpos, reconfigure RetroPie etc. again/accordingly. McAirpos controller setup does not know about controller configuration in RetroPie, Recalbox etc., because it operates directly in the OS level below. If stuck after trying a while, please post another question here. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Try using Edit: close quote |
This comment has been minimized.
This comment has been minimized.
Closing this issue again as originally solved by @QuadDam, and can reopen again if others experience issues with the SJ@JX controller, or if @sofiania reverts to it later and still needs support. |
Hi! I talked a bit about this on the Makecode Arcade forum with you. At a bit of a loss how to do this I am using this encoder https://www.amazon.ca/gp/product/B07FZ3YT1G/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1
and when setting up the joystick and keys in emulation station I configure them all. However as I mentioned the start/select will not bring me out of Makecode as it does in Mame. I know you mentioned the .cfg files but I am a bit new to Raspberry Pi so if you could walk me through how to get those to work in Makecode that would be awesome.
The text was updated successfully, but these errors were encountered: