libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.32k stars 1.84k forks source link

Mouse unavailable - Retroarch 1.8.4 Mac #10168

Closed groelk closed 4 years ago

groelk commented 4 years ago

Hi, Running RA 1.8.4 on Mac OS 10.5.3, with the PUAE core, there's no way the pointer will move with a mouse or trackpad, only with the keyboard. I think I tried all available settings to get mouse input to work. It does not seem to be core-related. PUAE works fine with RA on smartphones. No issues with the pointer at all on Android. Is this a known issue, and are there any ways to fix it? Many thanks!

RobLoach commented 4 years ago

I've seen the same with master on Linux/Ubuntu 18.04. Assumed it had been a permissions thing on my machine.

What Input Driver are you using? I'm on udev.

groelk commented 4 years ago

On OS X the input driver is cocoa

groelk commented 4 years ago

Any recommendations? Thanks!

rsn8887 commented 4 years ago

Same here, I cannot move the mouse pointer in any core on MacOS. Tried both touchpad and physical USB mouse. Tried selecting Toggle Mouse Grab, no difference. In the Ozone menu it works fine.

OctopusButtons commented 4 years ago

I have the same issue. There is no way to get any mouse device working in-game on Mac OS X, neither to move the crosshair nor to fire. I’m mostly attempting Time Crisis on PS1 but also it’s the same problem in Lethal Enforcers on SNES, regardless of core.

Things I tried:

There is no way to make the crosshair move at all, even a single pixel, in Time Crisis on PlayStation (Beetle core, also the PCArmed core). Mouse fire for lightgun Fire doesn’t work either. The binding of “Lightgun Trigger” and “Lightgun Reload” to Mouse 1 and Mouse 2 seems to work fine in the Retroarch menu, so the software detects and works with the mouse in the interface, but it does nothing in-game.

All these mouses (Bluetooth mouse, Apple Trackpad, generic USB mouse, built-in MacBook Peo trackpad) work fine in the OS and in the Retroarch front end menu, and they also work fine as in-game devices in MAME (standalone, not Retroarch) after I set the Device Mapping option “Lightgun = Mouse” in MAME before entering the arcade game.

As soon as I change Retroarch to a controller input, I can move the controller cursor with Dpad or keyboard arrows. But mouse movement in-game, I see the crosshair stuck in middle of screen but no movement.

OctopusButtons commented 4 years ago

Also this means no mouse/trackpad in DS cores in Retroarch on Mac. No mouse control for anything at all on Mac currently in RA.

groelk commented 4 years ago

Thanks for sharing your experience on this issue for Mac users. Seems there is no way to solve this, apart from a future RA update that would address it.

RobLoach commented 4 years ago

Post logs? Bisect? https://docs.libretro.com/guides/generating-retroarch-logs/

groelk commented 4 years ago

Sorry for the delayed answer. Found out the Terminal command to generate RetroArch logs: /Applications/RetroArch.app/Contents/MacOS/RetroArch --menu --verbose --log-file ~/retroarch.log

Below is the generated log. I tried a mouse-based game with PUAE.

[INFO] === Build ======================================= [INFO] CPU Model Name: Intel(R) Core(TM) M-5Y51 CPU @ 1.10GHz [INFO] Capabilities: MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE4.2 AES AVX AVX2 [INFO] Built: Jan 15 2020 [INFO] Version: 1.8.4 [INFO] ================================================= [INFO] [Environ]: SET_PIXEL_FORMAT: RGB565. [INFO] Redirecting save file to "/Users/ben/Documents/RetroArch/saves/.srm". [INFO] Redirecting savestate to "/Users/ben/Documents/RetroArch/states/.state". [INFO] Version of libretro API: 1 [INFO] Compiled against API: 1 [INFO] [Audio]: Set audio input rate to: 30000.00 Hz. [INFO] [Video]: Video @ 960x720 [INFO] [GL]: Found GL context: cocoagl [INFO] [GL]: Detecting screen resolution 960x720. [INFO] [GL]: Vendor: Intel Inc., Renderer: Intel(R) HD Graphics 5300. [INFO] [GL]: Version: 2.1 INTEL-14.4.23. [INFO] [GL]: Using resolution 1920x1440 [INFO] [GL]: Default shader backend found: glsl. [INFO] [Shader driver]: Using GLSL shader backend. [INFO] [GLSL]: Checking GLSL shader support ... [WARN] [GL]: Stock GLSL shaders will be used. [INFO] [GLSL]: Found GLSL vertex shader. [INFO] [GLSL]: Found GLSL fragment shader. [INFO] [GLSL]: Linking GLSL program. [INFO] [GLSL]: Found GLSL vertex shader. [INFO] [GLSL]: Found GLSL fragment shader. [INFO] [GLSL]: Linking GLSL program. [INFO] [GLSL]: Found GLSL vertex shader. [INFO] [GLSL]: Found GLSL fragment shader. [INFO] [GLSL]: Linking GLSL program. [INFO] Setting up menu pipeline shaders for XMB ... [INFO] [GLSL]: Compiling ribbon shader.. [INFO] [GLSL]: Found GLSL vertex shader. [INFO] [GLSL]: Found GLSL fragment shader. [INFO] [GLSL]: Linking GLSL program. [INFO] [GLSL]: Compiling simple ribbon shader.. [INFO] [GLSL]: Found GLSL vertex shader. [INFO] [GLSL]: Found GLSL fragment shader. [INFO] [GLSL]: Linking GLSL program. [INFO] [GLSL]: Compiling snow shader.. [INFO] [GLSL]: Found GLSL vertex shader. [INFO] [GLSL]: Found GLSL fragment shader. [INFO] [GLSL]: Linking GLSL program. [INFO] [GLSL]: Compiling modern snow shader.. [INFO] [GLSL]: Found GLSL vertex shader. [INFO] [GLSL]: Found GLSL fragment shader. [INFO] [GLSL]: Linking GLSL program. [INFO] [GLSL]: Compiling bokeh shader.. [INFO] [GLSL]: Found GLSL vertex shader. [INFO] [GLSL]: Found GLSL fragment shader. [INFO] [GLSL]: Linking GLSL program. [INFO] [GLSL]: Compiling snowflake shader.. [INFO] [GLSL]: Found GLSL vertex shader. [INFO] [GLSL]: Found GLSL fragment shader. [INFO] [GLSL]: Linking GLSL program. [INFO] [GL]: Using 4 textures. [INFO] [GL]: Loaded 1 program(s). [INFO] [Font]: Using font rendering backend: bitmap. [INFO] [Video]: Graphics driver did not initialize an input driver. Attempting to pick a suitable driver. [INFO] Found HID driver: "iohidmanager". [INFO] [Joypad]: Found joypad driver: "hid". [INFO] [Video]: Found display server: null [INFO] Found shader "/Applications/RetroArch.app/Contents/Resources/shaders/retroarch.glslp" [INFO] [CoreAudio]: Using output sample rate of 48000.0 Hz [INFO] [CoreAudio]: Using buffer size of 24576 bytes: (latency = 64 ms) [INFO] [Menu]: Found menu display driver: "gl". [INFO] [Font]: Using font rendering backend: stb-unicode. [INFO] [Font]: Using font rendering backend: stb-unicode. [INFO] [Menu]: Found menu display driver: "gl". [INFO] [Font]: Using font rendering backend: stb-unicode. [INFO] [Font]: Using font rendering backend: stb-unicode. [INFO] [LED]: LED driver = 'null' 0x10bf3e278 [INFO] [MIDI]: Initializing ... [INFO] [MIDI]: Input disabled. [INFO] [MIDI]: Output disabled. [INFO] [MIDI]: Initialized "null" driver. [WARN] Input device ID 259 is unknown to this libretro implementation. Using RETRO_DEVICE_JOYPAD. [INFO] SRAM will not be saved. [INFO] Loading history file: [/Users/ben/Library/Application Support/RetroArch/config/content_history.lpl]. [INFO] Loading history file: [/Users/ben/Library/Application Support/RetroArch/config/content_music_history.lpl]. [INFO] Loading history file: [/Users/ben/Library/Application Support/RetroArch/config/content_image_history.lpl]. [INFO] Loading favorites file: [/Users/ben/Library/Application Support/RetroArch/config/content_favorites.lpl]. [INFO] [GL]: VSync => on [INFO] [GL]: VSync => on [INFO] [Font]: Using font rendering backend: stb-unicode. [INFO] [Font]: Using font rendering backend: stb-unicode. [WARN] Error parsing JSON. [WARN] Error: Invalid JSON at line 11, column 15 (input byte 194) - the input ends in the middle of a token. [INFO] Using content: /Users/ben/roms/Commodore - Amiga/7 Colors (Europe) (En,Fr,De,Es,It).adf. [INFO] arg #0: retroarch [INFO] arg #1: /Users/ben/roms/Commodore - Amiga/7 Colors (Europe) (En,Fr,De,Es,It).adf [INFO] arg #2: -s [INFO] arg #3: /Users/ben/Documents/RetroArch/saves [INFO] arg #4: -S [INFO] arg #5: /Users/ben/Documents/RetroArch/states [INFO] arg #6: -c [INFO] arg #7: /Users/ben/Library/Application Support/RetroArch/config/retroarch.cfg [INFO] arg #8: -L [INFO] arg #9: /Applications/RetroArch.app/Contents/Resources/cores/puae_libretro.dylib [INFO] Content ran for a total of: 00 hours, 00 minutes, 00 seconds. [INFO] Unloading game.. [INFO] Unloading core.. [INFO] Unloading core symbols.. [INFO] [Video]: Does not have enough samples for monitor refresh rate estimation. Requires to run for at least 4096 frames. [INFO] Set config file to : /Users/ben/Library/Application Support/RetroArch/config/retroarch.cfg [INFO] Redirecting save file to "/Users/ben/Documents/RetroArch/saves/7 Colors (Europe) (En,Fr,De,Es,It).srm". [INFO] Redirecting savestate to "/Users/ben/Documents/RetroArch/states/7 Colors (Europe) (En,Fr,De,Es,It).state". [INFO] === Build ======================================= [INFO] CPU Model Name: Intel(R) Core(TM) M-5Y51 CPU @ 1.10GHz [INFO] Capabilities: MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE4.2 AES AVX AVX2 [INFO] Built: Jan 15 2020 [INFO] Version: 1.8.4 [INFO] ================================================= [INFO] Loading dynamic libretro core from: "/Applications/RetroArch.app/Contents/Resources/cores/puae_libretro.dylib" [INFO] [Overrides] no core-specific overrides found at /Users/ben/Library/Application Support/RetroArch/config/PUAE/PUAE.cfg. [INFO] [Overrides] no content-dir-specific overrides found at /Users/ben/Library/Application Support/RetroArch/config/PUAE/Commodore - Amiga.cfg. [INFO] [Overrides] game-specific overrides found at /Users/ben/Library/Application Support/RetroArch/config/PUAE/7 Colors (Europe) (En,Fr,De,Es,It).cfg. [INFO] Config: appending config "/Users/ben/Library/Application Support/RetroArch/config/PUAE/7 Colors (Europe) (En,Fr,De,Es,It).cfg"

alexkornitzer commented 4 years ago

For me this broke (no mouse input in DeSmuME) in 1.7.7, worked fine in 1.7.6. Done a bisect and this seems to be the culprit which would make sense based on the amount of changes within there: https://github.com/libretro/RetroArch/commit/89a6992d0c1705125121d82ab0b2c47e87b7ff08

Looks like a typo between line 201-202 in ui/drivers/ui_cocoa.m

pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil];

This works for the commit but not for master, will dig a little more. Right got it needed to add the following back as well in at line 177:

apple->touch_count = 1;

Will put in an PR for this to see if others agree.

groelk commented 4 years ago

Thanks a lot for checking this out! Looking forward to a future update allowing to use the mouse with RA!

Would you know where to find earlier RA cores? The stable versions on Libretro aren't available before 1.7.5

alexkornitzer commented 4 years ago

You can probably download the latest nightly, otherwise 1.7.6 should work until they bundle the new release. That is assuming this fixes the issues you have.

groelk commented 4 years ago

I encounter a similar issue with the WiiU touchscreen since RA version 1.7.1, the last one which appears to support it. Before submitting a new post I'd like to test it with different pointer-based cores, such as dosbox or puae, as I could only find the ScummVM core for RA 1.7.1.

I have the source files for that RA version, but I don't know how to compile cores. Would you? http://dl.free.fr/wEIHMKRx4

alexkornitzer commented 4 years ago

@groelk before filing a new issue I would try the latest nightly (https://buildbot.libretro.com/nightly/apple/osx/x86_64/) with the cores that have been an issue for you as it should contain the fix. If the latest nightly is not working for you then I would say this issue tracks the problem already and we would need to triage the issue again.

groelk commented 4 years ago

Tested on OSX 10.15.4: neither mouse nor touchpad move the pointer when using cores PUAE and ScummVM. Mouse click, and touchpad click, do work though, with both cores.

alexkornitzer commented 4 years ago

Ah okay, so I think my PR only addressed clicking as this was the only issue I had at the time. If I get some time later today I will test in the ScummVM core and see if I can replicate.

alexkornitzer commented 4 years ago

Right replicated in ScummVM core, can use the arrow keys and mouse click but not mouse move movement, will try and diagnose later this week.

alexkornitzer commented 4 years ago

Right, so been probing a little further, checked out 1.7.0 to see if it was a regression and input still didn't work in ScummVM, so either this is an issue with the core (doubtful if it works on other systems, which I guess it does) or the issue is in the cocoa input driver input/drivers/cocoa_input.c as the ui component of cocoa is now reporting the coordinates correctly due to the PR above. But it is a strange one cause other cores seem to be happy. A seasoned contributor would probably be able to isolate the cause of this one pretty quickly, which I am not.

groelk commented 4 years ago

Thanks a lot for investigating further! It might not be a core-related issue as the same happens with the PUAE core for instance. PUAE and ScummVM work fine with the pointer on other devices, like Android.

alexkornitzer commented 4 years ago

Yeah, I am thinking it is in input/drivers/cocoa_input.c I am just not up to speed with how input is handled by retroarch. @RobLoach are there quick wins to debug stuff like this?

OctopusButtons commented 4 years ago

AlexKornitzer, thank you for your work on this. The new 1.8.6 release has a patch note about a change to mouse in Mac OS X.

There’s a related bug though: the update didn’t fix the lack of mouse control, but when I change the Beetle PSX HS setting for “Gun Input Mode” to TOUCHSCREEN, now my mouse and my trackpad can move the crosshair in Beetle PSX GunCon emulation. But I’m not on a touchscreen. The “Light gun (use MOUSE-controller light gun)” should be the correct setting, but only the Touchscreen setting works for the mouse.

SNES Mario Paint doesn’t have mouse movement (with SNES Mouse setting on), neither Higan nor nSide cores have an equivalent to the “Light gun: TOUCHSCREEN or Mouse” like in Beetle PSX HW. So still no mouse there. I’d be glad to test other things to learn what exactly is causing it, but I don’t see anything to test sadly.

And some other unexpected behavior with mouse on Mac which might be related: Mouse 1 seems hard coded into Beetle HW PSX for GunCun firing, but it’s not located anywhere inside retroarch.cfg nor in the Retroarch interface (1.8.6 on Mac). Changing Lightgun Trigger bind in RA menu, changing Aux A, B, C, changing CFG setting of input_player1_guntrigger Keyboard or btn or Mbtn, none of these change the fact that Mouse 1 is secretly hard-coded default for firing. (Also, “Retropad A” controller button controls GunCon A button, which makes sense, except “Lightgun Reload” RA bind menu doesn’t do anything, this is the opposite of what the default documentation says. And “Lightgun Reload” in RA Menu changes _gun_offscreen_shot in the cfg, which might be intended behavior, but it’s not what the documentation says, the doc says Lightgun Reload is mapped to a physical gun button not to an in-game off screen reload. None of this is documented in the documentation or the interface unfortunately.)

groelk commented 4 years ago

Thanks @AlexKornitzer for the steps forward with this issue. After updating to 1.8.6 and testing the mouse on OSX with cores Dosbox, P-UAE and ScummVM:

alexkornitzer commented 4 years ago

@OctopusButtons lack of lightgun support is most likely because the case statement for that is missing from the cocoa driver:

Screenshot 2020-05-10 at 20 11 26

Going to do the scientific approach and shove a load of prints in to see if I can track the state changes, will probably hit a wall though :P

Update 1

Have it half working, this should not be too hard actually.

alexkornitzer commented 4 years ago

Right, the above should fix the cursor issue, it is a little rough around the edges but considering this has not worked for so long its better than nothing. Once we know it solves the main problem, then we can iterate on an improved solution.

DOSBox core demonstrates an issue with NSWindow and clipping, so that is next on the list.

groelk commented 4 years ago

Many thanks for this fix! Is it already available in a nightly for testing?

alexkornitzer commented 4 years ago

I would assume its in there, yes. Lets see if it works for you :P

groelk commented 4 years ago

I have tested with cores PUAE and Dosbox. Mouse click works but the pointer will not move with the mouse (it will only when using keyboard arrows).

Just to make sure: for testing I have only replaced those 2 core files (dylib) using the latest available ones among the available nightlies. Are there any other RetroArch application files to update besides the cores?

alexkornitzer commented 4 years ago

@groelk did you download the latest nightly for retroarch as well? As the changes are in there and not the cores.

https://buildbot.libretro.com/nightly/apple/osx/x86_64/RetroArch.dmg

groelk commented 4 years ago

Hey, it's all fixed! With a full reinstall of yesterday's nightly, the P-UAE and Dosbox cores now fully support the mouse on OSX. Big thanks!