BlitterStudio / amiberry

Optimized Amiga emulator for Linux/macOS
https://amiberry.com
GNU General Public License v3.0
643 stars 86 forks source link

[Feature-Request] Gamepad analoge L/R controller for mouse #275

Closed tednilsen closed 6 years ago

tednilsen commented 6 years ago

Let the user choose the gamepad analoge L/R controller for the mouse. Right now I'm using "mouse mode" option on my gamepad controller, but using the R analoge for mouse would really take away the need for mouse and keyboard (I see that you plan for overlay keyboard).

HoraceAndTheSpider commented 6 years ago

Doesn’t “mouse map=right” do this for you already?

HoraceAndTheSpider commented 6 years ago

reading the post again - you , I assume, have the controller mode set to “mouse” but a joypad attached?

Set the controller to “joystick” and the “mouse map” to right/both and you should get what you need. (Still in port 0)

I will be changing the system so that a joypad set in “mouse” mode on the input panel achieves something similar anyway in the future, but this is only planned as an adaptation of what is already there :)

tednilsen commented 6 years ago

you are right, thank man. I found the mousemap=left/right and got a bit confused with the controller-mode set to mouse I guess - AND I have been away from the project for a while... Looking forward to seeing keyboard implemented alongside analoge L/R gamepad-controller for mouse ;-)

ghost commented 6 years ago

Do you have any plans to make the mouse work on Right Analogue with the Gamepad in Port 1 (i.e. the correct port) ? Why do we have to use the Gamepad in the Mouse port ? This would mean that the second player in two player games would be selected, would it ?

HoraceAndTheSpider commented 6 years ago

The mousemap option already work on either / both ports - there is an option for this on either.

@ZappaUtopia sorry, I am not sure what you mean about having to use a certain controller in either port thought?

The (host) device you wish to use (either a controller or a real mouse) must be connected to the Amiga Port that you wish it to control.

For a mouse game, put your device to Port 0 , for a Joystick game, you would generally connect your device to Port 1 (and, as you say, a second controller would then control player 2 in port 0) There is always going to be a need to specific the 'primary' port for each game on an individual basis sadly.

ghost commented 6 years ago

Sorry, I didn't make my question very clear. What I meant was could you make the gamepad control mouse and joystick at the same time without needing to swap ports ? The Right Analogue stick would control Port 0 (Mouse) and the Left Analogue/D-Pad would control Port 1 (Joystick). You could then freely map the mouse buttons to L1/R1 etc. The Android version can control Port 0 Mouse with the Right Analogue stick by default so now that the ports have been merged wouldn't this be possible for the RPi etc. ?

HoraceAndTheSpider commented 6 years ago

To control both on a single pad (i.e. controlling Amiga Mouse in Port 0, and Amiga Joystick in Port 1) you would need to create a custom control layout, as this features input events from both ports for thsi reason :)
(e.g. if you need LMB to skip a cracktro on an otherwise Joystick controlled game).

You would not be able to have both analogue sticks differ on which Amiga Ports they control though, but could achieve this with DPAD/HAT controls by adding custom events to those. ... this has been raised before but I don't see many (any?) use cases that required more than this?

Unfortunately it is not easy to add other remapping to seperate analogue sticks due to the way their input events are handled, but i will look to add more flexibility in this area in the future, but hopefully this covers the need you have.

ghost commented 6 years ago

I was thinking of using the gamepad as Joystick and Mouse combo for more than just games. You could use the mouse for games that start in a workbench screen and you have to open the folder and double click the icon then use the joystick for the actual game. Or moving a highlight up/down with mouse on a trainer screen before the game starts etc. It's not possible to map mouse up/down/left/right to Right Analogue stick ? How does the Android version do it but the Pi can't, yet the code is now merged ?

HoraceAndTheSpider commented 6 years ago

I have not looked at the Android approach, but if it is behaving differently to the default in 'amiberry_input.cpp` (which it must be if the latest build works as you describe on Android) then I suspect it has a limited approach that fixes certain Amiga events to specific Axis.

However, as i said, you can already achieve this by using the very adaptable custom remapping features to the DPad, and if you also require the left axis to behave the same you can use it with the "remap Dpad to Left Axis" features.

I hope this helps explains that in "normal behaviour" you can map the Axis to joystick/mouse differently on each Axis using the mouse-map feature, but without customisations only across the same input port (i.e. Port 0 if you want to use the mouse) otherwise you need to use the available custom remapping by using the Dpad, but can then apply that to the remap-dpad-to-axis.

I have not tested this, but i think this should achieve what you want:

Even though developing this further it is not something I feel is of great importance I will still be looking at the way Axis are mapped (looking to make them more customisable), so this option may be more clearly avaialble in the future.

HoraceAndTheSpider commented 6 years ago

When I add the option to simply use “mouse” as a mode on the input controller (thus removing the mousemap option) then I will see about adding some kind of “hybrid” option in there also :)

ghost commented 6 years ago

Thanks, I'll give this a try tomorrow. Would it be easier to add a 'Swap ports' feature ? For instance, you could have the default as Port 0 mouse and Port 1 joystick, then if you press the mapped 'Swap' button then the gamepad would swap to port 0 and allow you to control the mouse using the gamepad. Press swap and you'd be back to Port 1 joystick mode.

Now that I've just read my post the swap feature sounds like a really good idea ! Surely this would be quite easy to add ? A lot easier than mapping buttons for mouse !

HoraceAndTheSpider commented 6 years ago

There is a swap ports feature in the imported WinUAE code but I am 99% sure it doesn’t work since the merge into uae4arm->Amiberry anyway, and might be a lot of work to restore.

Events from the controller which trigger emulator activities (eg i’d like one to change the mouse speed) have proved particularly troublesome so far unfortunately

ghost commented 6 years ago

That's a shame. It sounded like a very logical answer to the problem, just swap the ports around.