Page 1 of 1

Lemmings with two mice

Posted: Mon Jun 21, 2021 1:58 am
by pgimeno
This may be a long shot, but thing is, I was always fascinated that the Amiga version of Lemmings could be played by two players simultaneously, each with a separate mouse. Sadly, plugging two USB mice and booting Minimig does not do what I hoped, because both mice move the same pointer.

Is there a chance that each mouse controls one different joystick port?

Re: Lemmings with two mice

Posted: Mon Jun 21, 2021 7:20 am
by ToothbrushThreepwood
At the moment, no, as the MiSTer framework merges all USB mouse inputs to one.
Maybe it’ll change some day, but Sorgelig does not consider it an issue/priority, since so few games support it. At least not when I made an issue on github some months ago.
Hopefully that will change if people keep requesting/bringing it up (it does come up every once in a while). Especially since MiST implemented it last year and the minimig supports it there, so a roadmap for doing that exists.

Implementing non-standard mouse inputs would only benefit a handful of amiga/SNES games. And a few PC games supported a second mouse connected via serial, if that could be supported on MiSTer.
I wanted dual mice to play Lemmings and The Settlers on the minimig and Settlers 2 on the ao486 core. I managed to play 2-player Settlers on the ao486 core using analog stick input to control player 2. It’s not perfect, but it works alright, and certainly better than my childhood memories of playing it with a joystick, which I recall as being downright unplayable.
Unfortunately, I don’t think lemmings or settlers on the amiga supports other inputs for player 2 besides a second mouse.

Re: Lemmings with two mice

Posted: Mon Jun 21, 2021 7:41 am
by Caldor
Oh, this reminds me I think I saw and update that might have fixed this but I forgot about it again and did not test it.

I do not remember what the update said, but I was pretty sure it meant it should be possible to use two mice. I think what it did was making it possible to add serial devices... but it might also have been the AO486 core and not the Amiga core this feature was added to.

On DOS machines, the Settlers game got around having two mouse at the same by by using two different connections, one being... PS/2 usually, and the other being serial. Which is why I think that update should work.

Reading through Toothbrushes reply, you got it to work on AO486? Using Analog input for one controller is how it was done on DOS machines, so I do think that is how it has to work with the AO486 core.

Re: Lemmings with two mice

Posted: Mon Jun 21, 2021 2:00 pm
by bazza_12
i didnt even know lemmings had a split screen 2 player mode that used 2 mice.. i hope this feature gets added at some point.. looking at the game on youtube, it looks great with 2players, 2 mice..

Re: Lemmings with two mice

Posted: Mon Jun 21, 2021 4:37 pm
by bbond007
It may with a FT232 USB serial converter and a serial mouse.

You would need to select Uart:Modem, Link:Serial, Baud 9600.

I have not tested this idea - can't find a serial mouse (only PS2) and I guess I lost all my little converters...

Re: Lemmings with two mice

Posted: Mon Jun 21, 2021 6:12 pm
by ToothbrushThreepwood
Caldor wrote: Mon Jun 21, 2021 7:41 am Oh, this reminds me I think I saw and update that might have fixed this but I forgot about it again and did not test it.

I do not remember what the update said, but I was pretty sure it meant it should be possible to use two mice. I think what it did was making it possible to add serial devices... but it might also have been the AO486 core and not the Amiga core this feature was added to.

On DOS machines, the Settlers game got around having two mouse at the same by by using two different connections, one being... PS/2 usually, and the other being serial. Which is why I think that update should work.

Reading through Toothbrushes reply, you got it to work on AO486? Using Analog input for one controller is how it was done on DOS machines, so I do think that is how it has to work with the AO486 core.
Settlers 1 did both in DOS: If it detected a serial mouse on COM1 it would use that for player two. If it didn’t detect one, it would use the joystick input and prompt you to calibrate the stick when starting a two-player game.
On MiSTer you have to switch in and out of mouse mode to calibrate it, and you have to map different buttons for mouse clicks and joystick buttons, but other than that it’s it works without any quirks. And after some practice player 2 with analog is only slightly handicapped vs. player 1 on joystick mouse mode, and wireless controls is really addictive :)
Unfortunately, I think Settlers 2 only supported serial mouse for player 2, but not joystick.

Re: Lemmings with two mice

Posted: Tue Jun 22, 2021 4:22 am
by limi
Lemmings with two mice is mayhem in the best possible way, and a core part of the Amiga gaming experience 😄

Re: Lemmings with two mice

Posted: Tue Jun 22, 2021 7:51 am
by mahen
Could it work by any chance with the multiplexed SNAC implementation of Antonio Villena ? You could ask him in the sellers area ?

Hmm, too bad I only had one mouse back in the days ;)

Re: Lemmings with two mice

Posted: Tue Jun 22, 2021 9:13 am
by bazza_12
mahen wrote: Tue Jun 22, 2021 7:51 am Hmm, too bad I only had one mouse back in the days ;)
yeah i was thinking that. i never even selected two players cos.. er... i've got no friends.. :lol:

Re: Lemmings with two mice

Posted: Tue Jun 22, 2021 1:40 pm
by Caldor
ToothbrushThreepwood wrote: Mon Jun 21, 2021 6:12 pm
Caldor wrote: Mon Jun 21, 2021 7:41 am Oh, this reminds me I think I saw and update that might have fixed this but I forgot about it again and did not test it.

I do not remember what the update said, but I was pretty sure it meant it should be possible to use two mice. I think what it did was making it possible to add serial devices... but it might also have been the AO486 core and not the Amiga core this feature was added to.

On DOS machines, the Settlers game got around having two mouse at the same by by using two different connections, one being... PS/2 usually, and the other being serial. Which is why I think that update should work.

Reading through Toothbrushes reply, you got it to work on AO486? Using Analog input for one controller is how it was done on DOS machines, so I do think that is how it has to work with the AO486 core.
Settlers 1 did both in DOS: If it detected a serial mouse on COM1 it would use that for player two. If it didn’t detect one, it would use the joystick input and prompt you to calibrate the stick when starting a two-player game.
On MiSTer you have to switch in and out of mouse mode to calibrate it, and you have to map different buttons for mouse clicks and joystick buttons, but other than that it’s it works without any quirks. And after some practice player 2 with analog is only slightly handicapped vs. player 1 on joystick mouse mode, and wireless controls is really addictive :)
Unfortunately, I think Settlers 2 only supported serial mouse for player 2, but not joystick.
Wow... had no idea Settlers 1 supported a joystick for the other player. But was that even worth it?

Re: Lemmings with two mice

Posted: Tue Jun 22, 2021 8:14 pm
by ToothbrushThreepwood
Caldor wrote: Tue Jun 22, 2021 1:40 pm
ToothbrushThreepwood wrote: Mon Jun 21, 2021 6:12 pm
Caldor wrote: Mon Jun 21, 2021 7:41 am Oh, this reminds me I think I saw and update that might have fixed this but I forgot about it again and did not test it.

I do not remember what the update said, but I was pretty sure it meant it should be possible to use two mice. I think what it did was making it possible to add serial devices... but it might also have been the AO486 core and not the Amiga core this feature was added to.

On DOS machines, the Settlers game got around having two mouse at the same by by using two different connections, one being... PS/2 usually, and the other being serial. Which is why I think that update should work.

Reading through Toothbrushes reply, you got it to work on AO486? Using Analog input for one controller is how it was done on DOS machines, so I do think that is how it has to work with the AO486 core.
Settlers 1 did both in DOS: If it detected a serial mouse on COM1 it would use that for player two. If it didn’t detect one, it would use the joystick input and prompt you to calibrate the stick when starting a two-player game.
On MiSTer you have to switch in and out of mouse mode to calibrate it, and you have to map different buttons for mouse clicks and joystick buttons, but other than that it’s it works without any quirks. And after some practice player 2 with analog is only slightly handicapped vs. player 1 on joystick mouse mode, and wireless controls is really addictive :)
Unfortunately, I think Settlers 2 only supported serial mouse for player 2, but not joystick.
Wow... had no idea Settlers 1 supported a joystick for the other player. But was that even worth it?
Yes and no. Mouse is best, mouse emu with sniper mode is a close second, and joystick depends on the precision of the analog stick.
It’s a hard compromise in terms of sensitivity, since there’s no sniper mode like there is for the MiSTers mouse emu mode.
The joystick sensitivity is too low to allow you to quickly move the cursor across the screen, and still too high to allow easy precise movements. With a precise analog stick on a modern joystick, it’s possible to make fine-grain movements with only a little overshooting back and forth at times (my experience with a 8bitdo SN30 Pro after some practice), and since it’s not exactly a high-paced game, you can still manage.
I do remember trying to use a flightstick as a kid in the mid-90s, and that was absolutely unplayable and impossibly frustrating trying to make fine movements - constantly overshooting the target by a quarter of a screen-width just as the cursor finally got within a few pixels of the target.

Re: Lemmings with two mice

Posted: Wed Jun 23, 2021 10:11 pm
by pgimeno
I guess that the first obstacle is getting the MiSTer's Linux to handle both mice independently, so that Main can pass that segregated data to the core. If there's a way to do that, it's probably through raw access to the USB input or something like that. In my MiSTer, for example, one mouse is /dev/hidraw2 and the other is /dev/hidraw5; I'm sure there's a way to identify which /dev/hidraw* devices are mice, the problem is that Main then also has to act as a mouse driver that converts HID raw data to mouse data, bypassing the kernel.

Edit: After more research, it seems that it can be done without bypassing the kernel, through /dev/input/*. Main is already doing that, see https://github.com/MiSTer-DB9/Main_MiST ... .cpp#L2570, so it would be a question of distinguishing each mouse separately and providing something like a mouse ID to the cores. Then of course, the Minimig core would need to be changed to interpret the ID as the joystick port number or something alike.

In other words, it's far less difficult than I anticipated. The main difficulty would be to deal with plugging/unplugging mice from the USB port.

Re: Lemmings with two mice

Posted: Thu Jun 24, 2021 5:36 pm
by ToothbrushThreepwood
pgimeno wrote: Wed Jun 23, 2021 10:11 pm I guess that the first obstacle is getting the MiSTer's Linux to handle both mice independently, so that Main can pass that segregated data to the core. If there's a way to do that, it's probably through raw access to the USB input or something like that. In my MiSTer, for example, one mouse is /dev/hidraw2 and the other is /dev/hidraw5; I'm sure there's a way to identify which /dev/hidraw* devices are mice, the problem is that Main then also has to act as a mouse driver that converts HID raw data to mouse data, bypassing the kernel.

Edit: After more research, it seems that it can be done without bypassing the kernel, through /dev/input/*. Main is already doing that, see https://github.com/MiSTer-DB9/Main_MiST ... .cpp#L2570, so it would be a question of distinguishing each mouse separately and providing something like a mouse ID to the cores. Then of course, the Minimig core would need to be changed to interpret the ID as the joystick port number or something alike.

In other words, it's far less difficult than I anticipated. The main difficulty would be to deal with plugging/unplugging mice from the USB port.
If you understand C, you can check out the MiST firmware commit to see how it manages it:
https://github.com/mist-devel/mist-firm ... 9861e87eda

On MiST the firmware checks the if number of USB mice inputs exceeds 1, and forwards the separate inputs to the minimig core if that’s the case.

I think the biggest issue on MiSTer is how to deal with potentially multiple mice and joysticks and toggling mouse emu mode on/off. Not that it’s impossible, just that the MiSTer framework is more refined than MiST in terms of USB inputs.

Re: Lemmings with two mice

Posted: Fri Jun 25, 2021 10:54 am
by pgimeno
ToothbrushThreepwood wrote: Thu Jun 24, 2021 5:36 pm On MiST the firmware checks the if number of USB mice inputs exceeds 1, and forwards the separate inputs to the minimig core if that’s the case.

I think the biggest issue on MiSTer is how to deal with potentially multiple mice and joysticks and toggling mouse emu mode on/off. Not that it’s impossible, just that the MiSTer framework is more refined than MiST in terms of USB inputs.
My understanding is that once each mouse event's source mouse is identified, you just need to send to the core an additional source ID, or a sequential mouse number, that identifies which mouse the current event comes from. Current behaviour is equivalent to ignoring that number and sending all mouse events to the Amiga joystick port 0 regardless of mouse ID; desired behaviour is to use it to select the Amiga joystick port to assign the event to.