Skip to content
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

SDL2 | Various Control Mapping Issues (including CD32) #17

Closed
HoraceAndTheSpider opened this issue Sep 26, 2016 · 49 comments
Closed

SDL2 | Various Control Mapping Issues (including CD32) #17

HoraceAndTheSpider opened this issue Sep 26, 2016 · 49 comments
Assignees

Comments

@HoraceAndTheSpider
Copy link
Contributor

HoraceAndTheSpider commented Sep 26, 2016

As requested, the controller issues to be raised here:

For context, I am using a PS3 pad on uae4arm. In all examples i am setting 'port 1' as the most common option.

  • with 'dpad as joy' or 'dpad as cd32' , i get no results.... no fire / no movement.
  • if i select 'sony ps3 controller' ....
    -- Analogue only works as directional controls (nothing on the d-pad)
    -- I cannot set joystick or cd32 options for the PS3 pad without using 'custom' setting.
    -- using custom setting, i am missing the option of adding anything to the PS3 start/select buttons. This creates an issue for CD32 pad mapping, as it is lacking a input button (i.e. having only 6 to choose, where my controller has 9 available and the CD32 has 7 to map)
    -- the cd32 options , when set on 'custom' do not appear to work, no response on testing so far.

-- there is no 'cd32 red' 'cd32 blue' or 'cd32 play' available in the custom drop downs.... please note that red/joy fire 1 and blue/joy fire 2 are not the same input.
Although they often operate the same, the code to read the (amiga side) differs, and this does cause 'fire' not to work in some games where 'red' does. (there is common CD32 WHDLoad asm reading code that has this difference)

If it helps, i have a small program for testing cd32 inputs, you are welcome to use

https://www.dropbox.com/s/3o505q9h8hh1of9/CD32-tester%20%282016%29.adf?dl=0
[link updated to latest version - 14/05/2017]

This was needed for resolving similar issues on PSPUAE development, some years ago.

I would also welcome the ability to map to all available host inputs, and not ony the ones 'equal' to the Pandora, as some controllers have extra buttons we cannot yet map to.

Similarly, the abilty to map some UAE controls (quit program, 'pause' , display menu etc) would be welcomed.

FOL, the final developer of PSPUAE added these comments on the same topic:

"Theres also an issue with multi-key press games, i.e. Microcosm, Subwar 2050. You can not press FWD and say Yellow at same time. It may be related to RED and BLUE input code. Every game I have tried that requires RWD or FWD + Colour keys do not work."

Many thanks for your work on this project.

@midwan
Copy link
Collaborator

midwan commented Sep 26, 2016

@HoraceAndTheSpider
Thanks for the feedback on this. I'll start looking into it and update this issue with any news.

@midwan midwan self-assigned this Sep 26, 2016
@HoraceAndTheSpider
Copy link
Contributor Author

thanks midwan. Happy to test whatever i can.

On the latest build (yours) with 'dpad as joy' or 'dpad as cd32' , i get no results.... no fire / no movement still.

if i select 'sony ps3 controller' the fire button appears to be the 'select' button, which i am fairly sure is button '0' .... this pretty much limits me to going back to the 0.4 version of uae4arm sadly.

Anything you can do to make this more like FS-UAE, seperating host (saved under global config) and emulated (saved with game config) controls, the better it will be imho.

This means that you'd need 'standard' mappings for the "dpad as joy" etc, that will directly relate to the type of controller, but maybe the fs-uae files for those could even be re-used? FrodeSolheim (the author) is a pretty friendly and helpful guy, and would probably give some pointers.

The game config itself would simply decide if its to map to mouse/joy/cd32 or a custom layout, which would be great as they could be shared universally for project such as this:

https://www.facebook.com/groups/1854320841462593

(please feel free to join the group!)

@HoraceAndTheSpider
Copy link
Contributor Author

Right, so the thing about FS-UAE controllers got me looking into it more.

The controller files really would be easy to 'borrow'!

I've pasted an example here: For Mapping the PS3 pad (file says 'linux' but it came from the OSX version)

http://pastebin.com/CidFJuH0

The critical bit is the [default] section

On the left hand side, it basically lists out all of the available axis/buttons. On the right hand side, it 'maps' it to an Emulator-Side control.

The right-hand side is universal. I think UAE4ARM 0.4 already has something like this, which resides from the Pandora code. So you would simply tell it that ;

If Port_X_CD32 mode = enabled
south_button = Port_X_CD32_Red
east_button = Port_X_CD32_Blue
north_button = Port_X_CD32_Yellow
right_shoulder = Port_X_CD32_FWD
.. .etc ..

if Port_X_joystick mode
south_button = Port_X_Fire
east_button = Port_X_Fire2
north_button = null
right_shoulder = null

if Port_X_parallel mode
south_button = Port_X_Fire
east_button = null
north_button = null
right_shoulder = null

Obviously you'd need to double the code so that you check for multiple input devices (2-4 player for joypads etc) , but you would still be able to grab the mapping of many controllers from existing files!

Hope this proves helpful

@midwan
Copy link
Collaborator

midwan commented Sep 27, 2016

This looks promising, thanks!

@midwan midwan changed the title Various Control Mapping Issues (including CD32) SDL2 | Various Control Mapping Issues (including CD32) Jan 24, 2017
@midwan
Copy link
Collaborator

midwan commented Jan 24, 2017

@osvaldolove @HoraceAndTheSpider
We'll look into implementing a better input handling approach in the SDL2 branch, so I'm moving this issue there accordingly.

@HoraceAndTheSpider
Copy link
Contributor Author

The more i look at this, the easier i think it would be for this to be 'libretro' friendly.... since libretro maps -> 'internal' host maps (south_button , north_button etc) would replace the joy input -> 'internal' host maps section.

This would allow focus on 'internal' host maps -> game specific layouts (CD32, standard joystick, or custom) to be made as simple as possible, but retain functionality.

I hope I will have some time to try and help in this area.

@midwan
Copy link
Collaborator

midwan commented Feb 8, 2017

Note to self:

  • Map mouse left / right button to the controller - the amount of games that require a mouse click to get past the crack screen

  • Map certain keyboard keys to the controller - some games require space bar to bypass the crack screen. The "P" key represents Pause in many games, would be useful to have in a controller button.

  • Assign mouse movement to the right analog stick.

  • Ability to map Savestate Load / Save to controller button

@ransom1122
Copy link

ransom1122 commented Apr 30, 2017

I got a cd32 game working with latest amiberry using ps3 controller. check out my .uae file i renamed to txt, with custom mapped ps3 controller for cd32 functions. I tried Project X CD32 works perfect, all movement, fire button, weapon select.

Project-X & F17 Challenge v2.0 (1993)(Team 17)[!][compilation][CDD3499].txt

still missing yellow & Green button mapping though? Very strange??

@HoraceAndTheSpider
Copy link
Contributor Author

Yes, since my original post, PS3 has a specific hard-coded routine for cd32 mapping that I added... just set ye joystick input type to cd32joy :)

It's just ever other pad that needs the work now ;)

@ransom1122
Copy link

Great excellent! One other question where do we post issues with games? I cant get Turrican II Working, it plays for about 5 seconds then quits back to emulation station. Can't work out what type of config would make it work with gui settings?

@midwan
Copy link
Collaborator

midwan commented May 5, 2017

The issue with Turrican II is already reported here: #103

@ransom1122
Copy link

Has there been any advancements in cd32 mapping for ps3 controllers?

It seems that directions work, also BLUE/RED/PLAY work
Mapped buttons are;
Square = PLAY
X = RED
O = BLUE

Where is yellow, green Forward reverse? I have tried sutom controls and allocate Yellow or green to another button on the ps3 controller but it doesnt work?

@ransom1122
Copy link

ransom1122 commented May 12, 2017

@HoraceAndTheSpider

Yes, since my original post, PS3 has a specific hard-coded routine for cd32 mapping that I added... just set ye joystick input type to cd32joy :)

It's just ever other pad that needs the work now ;)

Which part below do i type "cd32joy"

joyport1=joy1
joyport1autofire=none
joyport1mode=djoy
joyportfriendlyname1=PLAYSTATION(R)3 Controller
joyportname1=JOY1

input.1.joystick.0.friendlyname=dPad as joystick
input.1.joystick.0.name=JOY0
input.1.joystick.0.empty=true
input.1.joystick.0.disabled=false
input.1.joystick.1.friendlyname=PLAYSTATION(R)3 Controller
input.1.joystick.1.name=JOY1
input.1.joystick.1.empty=true
input.1.joystick.1.disabled=false

@osvaldolove
Copy link
Contributor

osvaldolove commented May 12, 2017 via email

@ransom1122
Copy link

@osvaldolove Does this allow all cd32 buttons functions to work with a ps3 Controller? I will try it tonight :)

@osvaldolove
Copy link
Contributor

osvaldolove commented May 12, 2017 via email

@ransom1122
Copy link

ransom1122 commented May 12, 2017

OK That did the trick, I am able to play Arabian Nights CD32 perfectly now. BUT when I did I ran the AmigaCD32test.adf I am missing the BLUE Button?? How can I add the blue button in? Previous config with joyport1mode=djoy BLUE = CIRCLE Button. But now CIRCLE Button shows no Function with the CD32ADF Tester?

PS3 Controller mapping

CIRCLE = ??No Function??
SQUARE = GREEN
TRIANGLE = YELLOW
X = RED
L1 = REWIND
R1 = FF
START = PLAY

@HoraceAndTheSpider
Copy link
Contributor Author

There was a "hack" in place to fix the blue button. I assume this has been left in.

Second button and blue are not the same in the Amiga hardware so possible the tester is reading the wrong one (or midwan removed the hack) .... are you using my tester from above?

@ransom1122
Copy link

@HoraceAndTheSpider
Yes I used your cd32 tester adf all is working except for CIRCLE Button which is supposed to be cd32 blue button?

use any cd32 game with the config "cd32joy" added. try the cd32 adf tester and you will see blue button / PS3 CIRCLE Button doesnt work?

@HoraceAndTheSpider
Copy link
Contributor Author

As I said it could be the tester.

Try Cannon Fodder Cd32 and see if you throw grenades (I have done this and it worked ok, using PS3 pad)

@osvaldolove
Copy link
Contributor

osvaldolove commented May 12, 2017

@HoraceAndTheSpider Wasn't your hack only in the SDL1 master branch? Don't think it was pulled in to the SDL2 branch but could be wrong.

@ransom1122
Copy link

ransom1122 commented May 12, 2017

No it does not throw bombs, Circle Button Shoots the guns?

I also tried Bitmap Brothers Collection [OCS] (CD32)** with cd32joy. On the menu all options work except for the blue button? Same problem here.

@ransom1122
Copy link

Can anyone verify if Cannon Fodder CD32 version (not the whdload CD32 - Blue Button working with grenades after editing the cfg;

joyport1mode=djoy
to
joyport1mode=cd32joy

It seems cd32joy activates all cd32 button presses except for Blue button which should be circle button.

@HoraceAndTheSpider
Copy link
Contributor Author

HoraceAndTheSpider commented May 14, 2017

right, so i have just tested this with the Amiberry i built from source (From RetroPie menu) and i can confirm everything works correctly on PS3 pads in CD32 mode.

The way to demonstrate this in Cannon Fodder CD32: (it does not matter if this is WHDLoad CD32 or not - the joypad input routine is the same!)

set: joyport1mode=djoy

Both buttons should work (Cicle to walk, X to fire) however to throw a grenade you must press both buttons together. This is not possible in this 'second fire only' mode. You will also see if you use the Circle button on a Soldiers name (e.g. JOOLS) then the selection of the character is not correctly made (it will 'flicker' briefly but not select)

now set: joyport1mode=cd32joy

Again both buttons should work (Cicle to walk, X to fire) but it is not possible (once you have collected some) to throw grenades by pressing Circle+X together. You can also test this on level 1 by using Circle to select an individual member of the team, and this will happen correctly.

This works because Cannn Fodders specifically requires 'blue' to operate correctly, and does not work with the 'standard' second button (the equivalent of 'right mouse button')

There is actually a related (incorrect) matter to this in the Amiberry source which will need looking at, which allows this to work.

I will look at the result of the joypad tester seperately.

@osvaldolove - it's in the source here, and works when i am installing direct from RetroPie?

@ransom1122
Copy link

OK, very strange, I cannot test Cannon Fodder now, due to my covers downloading.. I Will try it again later.

but I did test my Bitmap Brothers Collection [OCS] (CD32) Twice. On the menu You cannot press the Blue button to choose the game that represents Blue. (And this is with joyport1mode=cd32joy included the cfg.

@HoraceAndTheSpider
Copy link
Contributor Author

Is that an unofficial collection? It is possible they are detecting 'second fire' instead of 'blue', which would cause the problem.

@ransom1122
Copy link

I am not sure. I will confirm the Cannon Fodder CD32 issue tomorrow. Thanks

@HoraceAndTheSpider
Copy link
Contributor Author

I have just seen that the CD32 tester above is the old one. I have updated the link.

THis will show 'blue' operate correctly, and if 'second fire' is used instead of blue (e..g where joyport1mode=djoy is set) then 'all buttons' (except red) will appear to have been pressed.

@ransom1122
Copy link

Thank you for your quick response and your dedication with this project :)

@ghost
Copy link

ghost commented May 14, 2017

@ransom1122 what version are you testing this on ? I have a feeling you're using SDL1 judging by your other posts that mention 'fast copper', but this thread is labelled SDL2 version. It's a bit confusing.

@HoraceAndTheSpider
Copy link
Contributor Author

I am pretty sure @midwan tagged the thread SDL2 in relation to the original request (as it would be easier in that version) , but the PS3 / cd32 testing will indeed related to the main released version.... no idea if the code is still present in the SDL2 code

@ransom1122
Copy link

Latest version .05

@ransom1122
Copy link

ransom1122 commented May 21, 2017

Nope..?
I am still unable to get the blue button to work. A Simple Official CD32 game to test.
Big 6, The (CD32) On the menu You have RED button to select a game from the list. and BLUE button for instructions. Red works and Blue does not? (I am using the "joyport1mode=cd32joy" in the cfg --- If i set the config for this game to joyport1mode=djoy Blue & Red buttons both work.

Likewise with the new ADFTester every button works except for BLUE

Cannon Fodder Blue button does nothing even when pressed with "X" on PS3 pad with "joyport1mode=cd32joy" as the config. If i change the cfg to joyport1mode=djoy then Blue button (Circle button) works as the fire button.

@HoraceAndTheSpider
Copy link
Contributor Author

HoraceAndTheSpider commented May 21, 2017

Blue would be on circle. red is on X.

What does happen when you press Circle on the new cd32 tester? Can you screenshot, or video demo?

Did you install amiberry from source or binary? I would try installing from Source to see if that helps.... I can point you to the line of code that maybe isn't in the built version.

I am assuming you are using genuine Sony PS3 pad etc.

@HoraceAndTheSpider
Copy link
Contributor Author

pandora_input.cpp

setid(uid, num, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON, gp);

@HoraceAndTheSpider
Copy link
Contributor Author

This can be set to "blue" but then doesn't work correctly (which is what I suspect yours is)

@ransom1122
Copy link

ransom1122 commented May 21, 2017

Blue would be on circle. red is on X.
Correct

What does happen when you press Circle on the new cd32 tester? Can you screenshot?
Nothing. No input. all the rest yellow, red, play, green, rew, ff, direction arrows work with other buttons.

Did you install amiberry from source or binary? I would try installing from Source to see if that helps.... I can point you to the line of code that maybe isn't in the built version.
Source. I followed your YT Tutorial Step by Step. :)

I am assuming you are using genuine Sony PS3 pad etc.
Correct.

Can you please send me your Cannon Fodder CD32 Config so I can see if there is a difference at my end.

Attached is my Cannon Fodder CD32 config
Cannon Fodder (CD32).txt

@HoraceAndTheSpider
Copy link
Contributor Author

I am running it from Whdload (but the cd32 version) - that wouldn't affect the input device though.

I did ask if you installed from Source or binary though?

@ransom1122
Copy link

I installed it from source?

@ransom1122
Copy link

ransom1122 commented May 21, 2017

20170522_084122_resized
Here is a screenshot of my input tab that I use when i load a cd32 config, with joyport1mode=cd32joy Is this similar to yours?

@ghost
Copy link

ghost commented May 24, 2017

@HoraceAndTheSpider I think @ransom1122 could be right. All the CD32 buttons work fine on your CD32 tester in the OP but the blue button doesn't seem to work in games. I even tried adding your fix to the SDL2 version and it didn't work. Below is a link to an absolutely awesome Amiga tester that tests everything, keyboard, sound, video, and joystick/cd32 pads etc. The blue button doesn't work on this either.

https://github.com/keirf/Amiga-Stuff
https://drive.google.com/open?id=0B6F45EdkSMp1ZGhXMWRvOXVDd3M

@HoraceAndTheSpider
Copy link
Contributor Author

@blinkydoos I assume are you using a PS3 Controller also, only you dont say? The fix i made is only for PS3 pads which come up as "Sony PLAYSTATION(R)3 Controller" or "PLAYSTATION(R)3 Controller" - i know some pads show up differently still! (just to make things more confusing, though these are usually fakes)

It would be sort-of 'normal' behaviour for blue not to work on the non-fixed (non-ps3) setup, because it maps 'second fire' only... this is due to the iritating differences in how the input is read by either btst.b #14-8,$DFF016 or and interupt routing with potgo / joy1dat etc

However..... There is definately something wrong in the main code anyway with how this is all handled, I agree there, as i said i had to make a dirty swap to 'second button' to make blue work. However, i have tested a number of CD32 games on amiberry with my PS3 pad now and they all work? :S I am even doing this on a fresh install from source.

I suspect some of this may be fixed when the codebase is updated.

I cited Cannon Fodder CD32 as an example of this, because you cannot play the game properly unless 'actual' blue is working (because although you can move/fire, you cant throw grenades with both buttons pressed), and i am able to play it now.

If you are also on a PS3 pad, I am wondering if swapping the 'commenting out' of the lines here in pandora_input.cpp would work for you. I'd be interested to know.

//setid(uid, num, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_CD32_BLUE : INPUTEVENT_JOY1_CD32_BLUE, gp);

setid(uid, num, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON, gp);

I have just noticed in @ransom1122 's picture 'custom' has been swiched on, and this should not be required for the fix.

@HoraceAndTheSpider
Copy link
Contributor Author

(apologies for accidentally hitting 'close'!)

@ghost
Copy link

ghost commented May 24, 2017

Sorry I forgot to say, yes I am using a PS3 pad and tested on Amiberry SDL1 and SDL2 (compiled from source). I don't have Custom Controls ticked on SDL1 (and midwan completely disabled them on SDL2). I changed the config joyport1mode to cd32joy. I used your tester that you posted and all buttons seem to respond (including blue) but in some games the blue button does nothing. I tried the Codemasters Big 6 that ransom tried, it says press blue for instructions but doesn't work. I think Super Stardust CD32 allows you to redefine the buttons so I'll check that tomorrow. It seems a lot of games just "work" because it treats the blue button as a standard joystick 2nd button and you could probably use a normal joystick to play them on a real Amiga instead of a CD32 pad.

Did you try the tool I posted above as that has a CD32 pad tester and see if the blue button works on yours ?

(I also changed the INPUTEVENT_JOY2_CD32_BLUE line to 2ND_BUTTON etc. before building the SDL2 version).

@ransom1122
Copy link

I still have no joy with the blue button with Cannon Fodder CD32 with the controller setup as "PLAYSTATION(R)3 Controller" input. Tried everything, removing custom control option. etc

Cedric And The Lost Sceptre [CD32] - Blue button seems to work on the main menu to select English language, but I think this game is not an official CD32 game anyway.

I can't figure out why most cd32 games won't allow the blue button?

@ghost
Copy link

ghost commented May 25, 2017

@HoraceAndTheSpider I tried Super Stardust CD32 and all buttons work except the BLUE one. This means your pad tester must only be checking for standing Joystick button 2 and not proper Blue which is why Blue doesn't work in the tester I posted above.

@HoraceAndTheSpider
Copy link
Contributor Author

Almost everything here will be sorted on next version with new mapping options.

The blue/2nd button aspect will need checking in the latest beta.

@midwan
Copy link
Collaborator

midwan commented Dec 3, 2017

I assume this one is now closed? :)

@midwan midwan closed this as completed Dec 3, 2017
@HoraceAndTheSpider
Copy link
Contributor Author

Yes, all of the points raised have been fixed... 15 months(!!) later!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants