Atari 5200: New version of Atari800 (Beta): two triggers (Moon Patrol!!!), hat start and exit buttons
-
@future-child Been wrestling with this for a few days now, and not succeeding. I've got your version of atari800 installed, and the option/select/start buttons work great. I can play games using the arrow keys.
But my control panel is one of those weird Xin Mo clones where the axes don't quite work right. I followed a workaround which suggested to just attach the joystick to four open button connections instead. This works great in every other emu I've tried (which, granted, they are all either libretro ones or MAME).
But I cannot see a way to get this to work with atari800. Putting in button codes like so does not work, because the cfg expects keycodes:
SDL_JOY_0_LEFT=8 SDL_JOY_0_RIGHT=10 SDL_JOY_0_UP=11 SDL_JOY_0_DOWN=9 SDL_JOY_0_TRIGGER=0
EmulationStation sees those keycodes as a DPad in every other emu. I am running the atari5200.py script to map things, but apparently the autoconfig doesn't work because they aren't an axis, maybe?
Any ideas? Can the emu be updated to support buttons as joystick directions?
If there isn't an easy solution, I may have to delve into the mysteries of xboxdrv...
-
@rkoster The SDL_JOY_0_LEFT, RIGHT, UP and DOWN variables are used for keyboard to joystick input (scan codes may be found here).
So unless your controller sends keyboard scan codes, axis data or HAT values it will not work.
Button support for directional input may happen in the future, but i never seen joysticks sending neither HAT nor axis data.If your controller does send HAT (D-PAD), you have to set JOY_0_SECOND_AXIS_ENABLED = FALSE and possibly JOY_SPEED_ADJUST=11.
Also make sure you have the latest version (and config parameters) as there have been some changes/fixes lately.
-
@future.child Yeah, that was what I suspected.
The issue is that the controller I have is a Xin Mo clone, the 3H Dual Arcade, and there is some sort of strange driver issue whereby left and up directions do not register. There's a way to recompile the kernel and add support for it (see https://retropie.org.uk/forum/topic/7832/fix-up-left-joystick-direction-for-tht-2p-arcade-controller-with-device-id-0x75e1), but it didn't work for me when I tried it, and hosed things badly enough that I ended up having to start over.
So the workaround that is suggested online is to simply wire up the joystick directions to some of the excess buttons. Worked fine in all other emus, just not in atari800. :(
Basically, I need the equivalent of joy2key for the Pi. xboxdrv seems like the closest thing I can find. Unless there's a way to send keystrokes from buttons buried somewhere in the Retropie controlelr config. (Seems like there must be, come to think of it).
Or else try the kernel upgrade again, which is the "right" solution, of course.
Thanks for investigating!
-
@rkoster Is there a reason for not using joy2key ? afaik it is available for retropie.
-
@future.child said in Atari 5200: New version of Atari800 (Beta): two triggers (Moon Patrol!!!), hat start and exit buttons:
@Used2BeRX
Bug1/2:
When you do have two controllers plugged in, do you use the same ports and plug in joystick 1 first ?
The emulator assigns the first controller it sees as joystick 1, jfroco presumably created his python script with this in mind, as it uses the emulationstation joystick numbering to determine which is joystick 1 and 2.In case my ban wasn't an accident and it doesn't get lifted please continue to contact me through this doc until we find a better solution: https://docs.google.com/document/d/18cfXi3eO7Gj1piWbzans8zS5CQ2ATaUrxeM0jmdzal8/edit?usp=sharing What we're doing is too valuable to stop because somebody didn't like something I posted and didn't just remove it. I have no idea why I was banned and they didn't give me any reason. At this point I'm thinking it's just an accident.
About your question. I always use the same port on a Hub that's attached to the Pi for the 1st player joystick. That never changes. Early on in our testing I had them reversed but they weren't working right at all when the 2nd player was plugged in (I don't remember exactly what was wrong and I didn't bother writing it down anywhere).
We have made some changes since then. I can try to do it the other way again and see what happens.
EDIT: I did some digging around and I found another off-brand PS3/4 controller. The one I was using before for 2nd player was an "Afterglow XBox 360" controller. That was causing some of the problems. I know the controller is good because it works perfectly for PC applications, but the Pi Zero I have doesn't seem to like it. When I plug just that controller in by itself I can't even control the emulationstation menus with it.
So, now that I'm using 2 identical off-brand PS3/4 controllers, here's where we're at...
BUG 1: This one is strange. In countermeasure I'm able to fire the cannon, some of the time. Whether or not it's going to fire seems completely up in the air. When I unplug the 2nd joystick and play 1 player this is not an issue at all.
Even though Choplifter is a 1 player game, it's showing the same behavior. Sometimes I can fire, sometimes I can't. I'm not sure, but it seems like if I use the stick for movement at all it automatically keeps me from firing. If I waggle the D-Pad around a bit it seems to fire again.
BUG 1: Still an issue. Every button on the 2nd player joystick that was mapped to anything on the 1st player joystick only does one action. For instance, if I'm playing Berzerk, I can fire the gun by pressing CROSS, SQUARE, SELECT, START or HOME buttons. This alone wouldn't be any major issue, but any game that requires two different trigger functions like Moon Patrol or Countermeasure won't work because only one of the trigger functions are available to you.
-
Offtopic:
@mediamogul @herb_fargus Sorry to bother, but i could not find a pm function for this.
Do you guys have an idea why @Used2BeRX has been banned ?
He doesn't, and i can't think of any reason (admittedly based on this thread alone) as well.Back on topic: I spent the day playing with different approaches on improving the joystick sensitivity problem.
The problem lies in mapping the physical controller input (-32767 to 32767, 0 is center) to atari's input (0 to 228, 114 is center).A lookup table doesn't work as it throws timing way off, and the table would be ginormous.
A math function seems the best approach, i have two formulas which in theory should do it.
f(x)=114+0.0020997955127507414x+1.29351713e-12x^3
f(x)=114+0.000591444990459655x+2.66474736e-12x^3
But when added to the code i get very weird results, perhaps someone with greater math and coding skills can have a look.Also i am starting to believe that modern day controllers are just to sensitive.
There is a 40 degrees range of motion for 65535 values, opposed to the original controller's 60 degrees for 228 values.
Plus the original controller had a larger handle allowing for a larger range of travel than modern thumbsticks.So for now i am leaving the sensitivity part as lowered priority for now and advise to configure mouse as trackball (or as paddle for Kaboom! ).
In this regard kat5200 does seem to be the better emulator for 5200. -
@future.child It should just be
analogpos / 287.42982 + 114
287.42982 is the ratio of 65534 to 228.
Worked out:
Control min max range Analog -32767 32767 65534 Atari 0 228 228
One unit = 65534 / 228 = 287.42982
Analogpos Value -32767 0 32767 228 0 114 16384 171.00174
-
I should add, this won't do anything regarding the 40 vs 60 degree range of motion. But I don't think you should address that since sensitivity is usually adjustable via OS or other tools.
-
@future.child Back in action. Thanks for helping me out there bud. :)
I'm going to keep putting my notes in the spraedsheet instead of mucking up this thread if that's alright with you. Seems like you guys might be on to something with the analog controls?
I've got quite a few notes in the spreadsheet. Check out the questions tab and take a look at the red objects in the notes column. I have a good breakdown of what games have problems and maybe you can figure it out since I isolated it quite a bit.
More in the "interesting" category, it took me FOREVER to figure out how to get 2 players working in Miner 2049er. The game manual was full of crap (and I know that's the real manual they scanned because I remember having it). They say you need to hit * to get to the hi-score screen and then hit * again to change from 1 to 2 players. Nope. I had to program "OPTION" to get to the hi-score screen. Then you have to press SELECT to switch between 1 and 2 players.
But.... The 5200 didn't have an OPTION or SELECT button..... so what gives? Oh well. At least I have it mapped now.
-
@rkoster Thanks, this is actually the current way i implemented it, this linear conversion however is too sensitive for some roms.
That is why i am trying for a more elaborate math function, so there is a sort of slope to controls.
I have not found any way for adjustment in OS or other tool, so i am open to suggestions.@Used2BeRX Good to have you back, clerical error ?
As far as Miner goes, unless the manual is wrong, your rom seems to be a dump of an A8 version ported to A52 instead of a true A52 version, or perhaps you're running in A8 machine mode (doubtful), you are able to check the last one by going in emulator menu and checking under system settings.
Could also be the emulator is flawed causing the rom to think it's in A8 mode, same way some roms switch to trackball or paddle mode. -
@future.child Yup. Nobody's sure what happened, but they got me back here. I guess a permanent ban was issued. Those stay on your record, so I guess they got an asterisk by it. :)
Interesting about the Miner 2049er. I'll look into it. Would rather have it work normally so you don't have to hit select for 2 players. That would be the only game you have to do that for if I can't fix it.
I posted the controls to my standard configuration. I don't know by looking at yours what would be happening to me. Maybe you can look at what I've got and see it right away?
EDIT: I finished the configurations for all of the 5200 games on the spreadsheet. Bugs are in red. Nothing really except for the issues I'm having with the 2 player controls. I tried comparing our controller configs but couldn't figure anything that would fix it on my end. Hope you notice something that I didn't.
-
@future.child What sort of curve do you want? Small movements have less effect?
-
@rkoster Yes, that's exactly what i want as the controller now is way too sensitive.
The current code is (i.e. for joystick 1 y axis)
int joy1_y = SDL_JoystickGetAxis(joystick0, 1); int pot1 = (joy1_y/287.429824561)+114; if(pot1 < 0) pot1 = 0; if(pot1 > 227) pot1 = 227; POKEY_POT_input[1] = pot1;
This is beautifully linear, but little movements of the analog thumbstick are huge in the emulator.
-
Simplest would be to keep it linear, and change the relationship. Try changing the unit factor from 287. That adjusts the linear mapping. You're already clamping pot1, so all it will do is discard extreme values. That would be doing kind of the same thing that a circular restrictor does on an analog arcade stick.
-
@rkoster I have been fiddling with this, problem is when having a higher number the atari does not get the full input range making some roms unplayable, while lowering the value actually makes it more sensitive.
I currently have a adjustable relationship (in the code the 287.429824561 is actually a default value of a variable) in place as a temporary workaround for a few roms, but some roms like caste crisis and Kaboom expect the full range of input.
-
Ah, you're definitely diving into trickier territory then. Different gamepads will actually have different response curves for that. You may want to look at this article.
I'd start with an anlog deadzone to begin with, to see if that makes a difference.
-
@future.child I managed to get the kernel recompiled. The joystick works correctly now. :) Thanks for your help!
-
As a heads-up to anyone else who might run into this.
If you have a problem where you run the atari800 emulator the first time and everything works fine, and then you run it a second time and it exits the emu when you push right on the joystick, the issue is that you have joy2key enabled.
You can hit F4 to exit to the command line and type
sudo killall joy2key.py
Now you can play the atari800 emu again.
To solve the problem permanently, you can to go the RetroPie menu, Run Command Configuration, and make sure that "Launch menu joystick control" is set to Disabled.
I am not sure what's happening, but it seems like having this option on leaves it running when the atari800 emu exits. The result is that hitting the joystick is also sending keystrokes. You can even go into jstest while it's happening, and see that keys are being hit when the joystick moves.
-
@future.child Hey bud. Just wondering how the progress has been going. I haven't heard from you in a while.
I borked my Pi so I had to re-start on a new SD card. That's probably a good thing though because it's a fresh install that my brother didn't fiddle around with and it's 4.2 instead of the 4.1 that he was using. I'm hoping once I get everything up and running and back to the state it was in before that those controller and game save issues that I was having don't crop up again.
-
@Used2BeRX Well things haven't really been progressing that much.
The analog controls are still a problem, i now have a less sensitive joystick with a curve to it but for some reason the extra step it takes to do the adjustment in between reading the joystick and passing the modified value to the emulator takes too long for game-play (about a half to a full second of delay depending on how much adjustment is needed).
Without the curve, there is no noticeable lag but this curve is needed for certain roms (i use Kaboom! for testing) where the paddle sometimes needs to travel fast and at other times needs to travel more slowly but accurate.I can't see any other way than using a mouse for now.
So your controller issues have been solved with a fresh install ?
Does that include the crosstalk from controller 2 to controller 1 ?
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.