realnc / dosbox-core

A DOSBox core for use in RetroArch and other libretro frontends.
GNU General Public License v2.0
42 stars 16 forks source link

mouse input not working? #41

Closed evbo closed 2 years ago

evbo commented 2 years ago

I have dosbox-svn running win95 and the mouse works great. I try the same win95 install with dosbox core but the mouse is not controllable though the keyboard input works great. I checked both input settings and controls and ensure keyboard+mouse is enabled.

Does a mouse device not work? Must I use a gamepad only? I have installed retroarch git version 9ec7cec and dosbox core db798da

Thanks! I'm hoping it runs win 9x much better than svn!

realnc commented 2 years ago

The additions of dosbox-core do not affect the mouse. However, dosbox-core is based on the latest upstream dosbox SVN code (4471), while the dosbox-svn core is using an old version from 2020 (4393.) Maybe something in dosbox itself has changed.

In any event, installing windows in this core isn't actually supported. If it works for some people, it works. If not, there's nothing I can do about it. It might be a good idea to test with a stand-alone build of dosbox (svn 4471).

evbo commented 2 years ago

I figured it wouldn't hurt testing that the latest (jan 2021) version of dosbox: dosbox_0.74-4.2+deb9u2_amd64.deb

Yup - you're right mouse doesn't work ;(

Or does it? I studied the dosbox conf and found this:

[sdl] autolock: Mouse will automatically lock, if you click on the screen. (Press CTRL-F10 to unlock

Sure enough setting autolock=false fixed it (or I bet pressing CTRL-F10 would too, but that's hard to do from gamepad!)

With dosbox core I tried and tried to press CTRL-F10 but it didn't unlock the mouse. Is there a way to add autolock to the retroarch config to disable it?

realnc commented 2 years ago

Sure enough setting autolock=false fixed it (or I bet pressing CTRL-F10 would too, but that's hard to do from gamepad!)

With dosbox core I tried and tried to press CTRL-F10 but it didn't unlock the mouse. Is there a way to add autolock to the retroarch config to disable it?

There is no such thing in the core. That's handled by the frontend. In retroarch. There's two ways to lock the mouse. With the "Grab Mouse (Toggle)" hotkey, which is F11 by default, or with "Game Focus (Toggle)", which is bound to the Scroll Lock key by default.

evbo commented 2 years ago

There is no such thing in the core

Can you clarify because I thought dosbox core supported most config from standalone config?: dosbox

There's two ways to lock the mouse. With the "Grab Mouse (Toggle)" hotkey, which is F11 by default, or with "Game Focus (Toggle)"

Unfortunately they are locking the host's mouse, but what I am referring to is the guest mouse inside of dosbox being locked. In the latest standalone dosbox 0.74-4, when I disabled autolock the mouse input from my host freely moved the mouse in the guest, but with it enabled the mouse was frozen in position in the middle of the screen on the guest.

So since this behavior is exactly reproduced in dosbox 0.74-4, can you clarify why that very same solution I applied by disabling autolock can't be supported in dosbox-core?

Thanks by the way for a great core

realnc commented 2 years ago

There is no such thing in the core

Can you clarify because I thought dosbox core supported most config from standalone config?

Anything in the [sdl] section is not something that exists in the core, because SDL is replaced by the frontend. Stand-alone dosbox uses SDL to read input from the mouse, draw the graphics, create the window, etc. The core doesn't do any of that. Retroarch does all that.

However, with that being said, I'll need to look into whether dosbox applies other internal settings when that SDL option is enabled/disabled. Something that would affect mouse emulation, not just locking the mouse inside the dosbox window.

evbo commented 2 years ago

Apparently this is a known issue that others have repeated similarly on Xubuntu due to Xorg: https://www.vogons.org/viewtopic.php?p=791605#p791605

So I avoid the issue completely using autolock=false with standalone. There's a compounding issue with Ctrl+F10 not getting sent to dosbox on Xubuntu (even after adjusting window manager key bindings), so I may just have to look into using a different distro, such as LibElec which is what Lakka uses with Retroarch.

realnc commented 2 years ago

So I just checked and there's nothing in the autolock function that would affect mouse emulation.

Also, dosbox 0.74-4 is based on 12 years old source code with only a few bugfixes on top of it. dosbox-core is based on current dosbox SVN trunk. You should try and build that.

If you run dosbox with:

dosbox --version

0.74-4 prints:

copyright 2002-2010 DOSBox Team.

If you build current SVN trunk, you'll see:

copyright 2002-2021 DOSBox Team

You can either fetch current dosbox SVN trunk with svn, or you can checkout the master branch of dosbox-core, which contains just vanilla, stand-alone latest dosbox. You can also download it as a zip:

https://github.com/realnc/dosbox-core/archive/refs/heads/master.zip

realnc commented 2 years ago

Also, since I can't test any of this myself, you could link me to some HDD image file that has w95 installed.

evbo commented 2 years ago

So I ran this same version of dosbox-core on Lakka 3.6, which is running LibElec Linux distro and I think I may have found the culprit. By setting mouse grab to "auto" it revealed that feature is broken:

[WARN] [udev]: Mouse grab/ungrab feature unavailable.

So if the mouse isn't grabbing that would do it, eh?

Do I file this as a bug in RetroArch? Or is it dosbox that isn't registering that option exists?

andres-asm commented 2 years ago

why would you need to grab mouse on Lakka? Lakka is always fullscreen

evbo commented 2 years ago

@realnc :clap: :clap: :clap:

dosbox-core I am declaring the champion of all retroarch cores when it comes to running win9x. Yes, it is a bit slower than dosbox-svn or dosbox-pure, but the graphics emulation you have enabled is what make it the first Retroarch experience I have enjoyed playing my beloved Windows 95 games!

The trick to this problem with the mouse was that, during initial setup, the mouse driver isn't copied over. But the next time you restart windows it is active and then mouse input works. Jon Campbell explains it perfectly here: https://github.com/joncampbell123/dosbox-x/issues/2948#issuecomment-1045566720

I have been searching for this solution for many years now. Your latest release is a huge accomplishment for windows gamers! Thank you!

For anyone else like me looking to get started, simply follow the guide here for creating a windows image: http://dosbox95.darktraveler.com/guide%20select.html

The dosbox-x tutorial is better written in this regard: https://dosbox-x.com/wiki/Guide%3AMicrosoft-Windows-in-DOSBox%E2%80%90X

You're of course going to need to use dosbox-svn or dosbox-x standalone to run imgmake and xcopy, but after that all setup should be run using dosbox-core.

You might find other guides saying windows will run on "dosbox-", but what's important to distinguish about dosbox-core is that it has emulated graphics that just work on Linux, which means you can run the awesome Lakka and enjoy the convenience of Retroarch while gaming on windows 95 (probably windows 98 too, haven't done that yet...)