Project

General

Profile

Actions

Emulator Issues #13777

open

Emulated Wiimote Aiming is Nonlinear

Added by bdp.inbox@gmail.com 11 days ago. Updated 10 days ago.

Status:
New
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

Game Name?
Metroid Prime 3

Game ID? (right click the game in the game list, Properties, Info tab)

RM3E01 (00010000524d3345)

MD5 Hash? (right click the game in the game list, Properties, Verify tab, Verify Integrity button)

6a6fc8eb6873f80c5d240b0e89f8518c

What's the problem? Describe what went wrong.
Aiming the emulated wiimote with the mouse seems to be nonlinear, making it difficult and counter-intuitive to aim. Linearly mapping the mouse position to a wiimote angle will result in a nonlinear position of the wiimote cursor. A bit of algebra is needed to make aiming with the mouse behave as expected.

What steps will reproduce the problem?

Configure and calibrate an emulated wiimote with mouse aiming

Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.

2503
Branch: HEAD
Revision: 9763c0a1e2b9db0c3861d25bc2f5a0ace6a15ee3

Is the issue present in the latest release? For future reference, please also write down the version number of the latest release.

2503
Branch: HEAD
Revision: 9763c0a1e2b9db0c3861d25bc2f5a0ace6a15ee3

If the issue isn't present in the latest release, which is the first broken version? (You can find the first broken version by bisecting. Windows users can use the tool https://forums.dolphin-emu.org/Thread-green-notice-development-thread-unofficial-dolphin-bisection-tool-for-finding-broken-builds and anyone who is building Dolphin on their own can use git bisect.)

2503
Branch: HEAD
Revision: 9763c0a1e2b9db0c3861d25bc2f5a0ace6a15ee3

If your issue is a graphical issue, please attach screenshots and record a three frame fifolog of the issue if possible. Screenshots showing what it is supposed to look like from either console or older builds of Dolphin will help too. For more information on how to use the fifoplayer, please check here: https://wiki.dolphin-emu.org/index.php?title=FifoPlayer

[Attach any fifologs if possible, write a description of fifologs and screenshots here to assist people unfamiliar with the game.]

What are your PC specifications? (CPU, GPU, Operating System, more)
System:
Kernel: 6.8.0-49-generic arch: x86_64 bits: 64 compiler: gcc v: 13.2.0 clocksource: tsc
Desktop: Cinnamon v: 6.4.8 tk: GTK v: 3.24.41 wm: Muffin v: 6.4.1 vt: 7 dm: LightDM v: 1.30.0
Distro: Linux Mint 22.1 Xia base: Ubuntu 24.04 noble
Machine:
Type: Desktop Mobo: ASRock model: Z270 Taichi serial:
uuid: UEFI-[Legacy]: American Megatrends v: P2.10 date: 05/09/2017
Battery:
Device-1: hidpp_battery_0 model: Logitech K350 serial: charge: 70% (should be ignored)
rechargeable: yes status: discharging
Device-2: hidpp_battery_1 model: Logitech Wireless Mouse M510 serial:
charge: 55% (should be ignored) rechargeable: yes status: discharging
CPU:
Info: quad core model: Intel Core i7-7700 bits: 64 type: MT MCP smt: enabled arch: Kaby Lake
rev: 9 cache: L1: 256 KiB L2: 1024 KiB L3: 8 MiB
Speed (MHz): avg: 800 high: 801 min/max: 800/4200 cores: 1: 800 2: 800 3: 801 4: 800 5: 800
6: 800 7: 800 8: 800 bogomips: 57600
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
Device-1: NVIDIA GP104 [GeForce GTX 1070] vendor: ASUSTeK driver: nvidia v: 570.133.07
arch: Pascal pcie: speed: 8 GT/s lanes: 16 ports: active: none off: HDMI-A-1 empty: DP-1, DP-2,
DVI-D-1, HDMI-A-2 bus-ID: 01:00.0 chip-ID: 10de:1b81 class-ID: 0300
Display: x11 server: X.Org v: 21.1.11 with: Xwayland v: 23.2.6 driver: X: loaded: nvidia
gpu: nvidia,nvidia-nvswitch display-ID: :0 screens: 1
Screen-1: 0 s-res: 1920x1080 s-dpi: 69 s-size: 707x392mm (27.83x15.43") s-diag: 808mm (31.83")
Monitor-1: HDMI-A-1 mapped: HDMI-0 note: disabled model: Samsung res: 1920x1080 hz: 60 dpi: 55
size: 886x498mm (34.88x19.61") diag: 801mm (31.5") modes: max: 1920x1080 min: 640x480
API: EGL v: 1.5 hw: drv: nvidia platforms: device: 0 drv: nvidia device: 2 drv: swrast gbm:
drv: nvidia surfaceless: drv: nvidia x11: drv: nvidia inactive: wayland,device-1
API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 570.133.07 glx-v: 1.4
direct-render: yes renderer: NVIDIA GeForce GTX 1070/PCIe/SSE2
API: Vulkan v: 1.3.275 layers: 9 surfaces: xcb,xlib device: 0 type: discrete-gpu driver: N/A
device-ID: 10de:1b81 device: 1 type: discrete-gpu driver: N/A device-ID: 10de:1b81 device: 2
type: cpu driver: N/A device-ID: 10005:0000
Audio:
Device-1: Intel 200 Series PCH HD Audio vendor: ASRock driver: snd_hda_intel v: kernel
bus-ID: 00:1f.3 chip-ID: 8086:a2f0 class-ID: 0403
Device-2: NVIDIA GP104 High Definition Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel
pcie: speed: 8 GT/s lanes: 16 bus-ID: 01:00.1 chip-ID: 10de:10f0 class-ID: 0403
API: ALSA v: k6.8.0-49-generic status: kernel-api
Server-1: PipeWire v: 1.0.5 status: active with: 1: pipewire-pulse status: active
2: wireplumber status: active 3: pipewire-alsa type: plugin
Network:
Device-1: Intel Ethernet I219-V vendor: ASRock driver: e1000e v: kernel port: N/A bus-ID: 00:1f.6
chip-ID: 8086:15b8 class-ID: 0200
IF: enp0s31f6 state: up speed: 1000 Mbps duplex: full mac:
Device-2: Intel Dual Band Wireless-AC 3168NGW [Stone Peak] driver: iwlwifi v: kernel pcie:
speed: 2.5 GT/s lanes: 1 bus-ID: 06:00.0 chip-ID: 8086:24fb class-ID: 0280
IF: wlp6s0 state: down mac:
Device-3: Intel I211 Gigabit Network vendor: ASRock driver: igb v: kernel pcie: speed: 2.5 GT/s
lanes: 1 port: d000 bus-ID: 07:00.0 chip-ID: 8086:1539 class-ID: 0200
IF: enp7s0 state: down mac:
IF-ID-1: br-314b26a1b2f0 state: down mac:
IF-ID-2: docker0 state: down mac:
Bluetooth:
Device-1: Intel Wireless-AC 3168 Bluetooth driver: btusb v: 0.8 type: USB rev: 2.0 speed: 12 Mb/s
lanes: 1 bus-ID: 1-9:5 chip-ID: 8087:0aa7 class-ID: e001
Report: hciconfig ID: hci0 rfk-id: 0 state: up address: bt-v: 4.2 lmp-v: 8 sub-v: 1100
hci-v: 8 rev: 1100 class-ID: 6c0000
Drives:
Local Storage: total: 2.49 TiB used: 1.76 TiB (70.7%)
ID-1: /dev/sda vendor: Intel model: SSDSCKKW240H6 size: 223.57 GiB speed: 6.0 Gb/s tech: SSD
serial: fw-rev: G100 scheme: MBR
ID-2: /dev/sdb vendor: Samsung model: SSD 870 EVO 500GB size: 465.76 GiB speed: 6.0 Gb/s
tech: SSD serial: fw-rev: 2B6Q scheme: MBR
ID-3: /dev/sdc vendor: Seagate model: ST2000DM006-2DM164 size: 1.82 TiB speed: 6.0 Gb/s
tech: HDD rpm: 7200 serial: fw-rev: CC26
Partition:
ID-1: / size: 456.89 GiB used: 330.2 GiB (72.3%) fs: ext4 dev: /dev/sdb5
ID-2: /boot/efi size: 511 MiB used: 11.3 MiB (2.2%) fs: vfat dev: /dev/sdb1
Swap:
ID-1: swap-1 type: file size: 2 GiB used: 0 KiB (0.0%) priority: -2 file: /swapfile
USB:
Hub-1: 1-0:1 info: hi-speed hub with single TT ports: 16 rev: 2.0 speed: 480 Mb/s lanes: 1
chip-ID: 1d6b:0002 class-ID: 0900
Device-1: 1-1:2 info: Logitech Unifying Receiver type: keyboard,mouse,HID
driver: logitech-djreceiver,usbhid interfaces: 3 rev: 2.0 speed: 12 Mb/s lanes: 1 power: 98mA
chip-ID: 046d:c52b class-ID: 0300
Device-2: 1-4:3 info: Logitech Unifying Receiver type: keyboard,mouse,HID
driver: logitech-djreceiver,usbhid interfaces: 3 rev: 2.0 speed: 12 Mb/s lanes: 1 power: 98mA
chip-ID: 046d:c52b class-ID: 0300
Hub-2: 1-6:4 info: ASMedia ASM1074 High-Speed hub ports: 4 rev: 2.1 speed: 480 Mb/s lanes: 1
power: 100mA chip-ID: 174c:2074 class-ID: 0900
Device-1: 1-9:5 info: Intel Wireless-AC 3168 Bluetooth type: bluetooth driver: btusb
interfaces: 2 rev: 2.0 speed: 12 Mb/s lanes: 1 power: 100mA chip-ID: 8087:0aa7 class-ID: e001
Hub-3: 2-0:1 info: super-speed hub ports: 10 rev: 3.0 speed: 5 Gb/s lanes: 1 chip-ID: 1d6b:0003
class-ID: 0900
Hub-4: 2-6:2 info: ASMedia ASM1074 SuperSpeed hub ports: 4 rev: 3.0 speed: 5 Gb/s lanes: 1
power: 8mA chip-ID: 174c:3074 class-ID: 0900
Hub-5: 3-0:1 info: hi-speed hub with single TT ports: 2 rev: 2.0 speed: 480 Mb/s lanes: 1
chip-ID: 1d6b:0002 class-ID: 0900
Hub-6: 4-0:1 info: super-speed hub ports: 2 rev: 3.1 speed: 10 Gb/s lanes: 1 chip-ID: 1d6b:0003
class-ID: 0900
Sensors:
System Temperatures: cpu: 52.0 C mobo: N/A gpu: nvidia temp: 33 C
Fan Speeds (rpm): N/A gpu: nvidia fan: 0%
Repos:
Packages: 4299 pm: dpkg pkgs: 4251 pm: flatpak pkgs: 34 pm: snap pkgs: 14
No active apt repos in: /etc/apt/sources.list
Active apt repos in: /etc/apt/sources.list.d/docker.list
1: deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https: //download.docker.com/linux/ubuntu jammy stable
No active apt repos in: /etc/apt/sources.list.d/github_git-lfs.list
Active apt repos in: /etc/apt/sources.list.d/google-chrome.list
1: deb [arch=amd64] https: //dl.google.com/linux/chrome/deb/ stable main
No active apt repos in: /etc/apt/sources.list.d/lutris-team-lutris-focal.list
No active apt repos in: /etc/apt/sources.list.d/nodesource.list
Active apt repos in: /etc/apt/sources.list.d/obsproject-obs-studio-jammy.list
1: deb [signed-by=/etc/apt/keyrings/obsproject-obs-studio-jammy.gpg] https: //ppa.launchpadcontent.net/obsproject/obs-studio/ubuntu jammy main
Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list
1: deb http: //packages.linuxmint.com xia main upstream import backport
2: deb http: //archive.ubuntu.com/ubuntu noble main restricted universe multiverse
3: deb http: //archive.ubuntu.com/ubuntu noble-updates main restricted universe multiverse
4: deb http: //archive.ubuntu.com/ubuntu noble-backports main restricted universe multiverse
5: deb http: //security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
No active apt repos in: /etc/apt/sources.list.d/plexmediaserver.list
Active apt repos in: /etc/apt/sources.list.d/saiarcot895-flightgear-focal.list
1: deb http: //ppa.launchpad.net/saiarcot895/flightgear/ubuntu noble main
No active apt repos in: /etc/apt/sources.list.d/steam-beta.list
Active apt repos in: /etc/apt/sources.list.d/steam-stable.list
1: deb [arch=amd64,i386 signed-by=/usr/share/keyrings/steam.gpg] https: //repo.steampowered.com/steam/ stable steam
2: deb-src [arch=amd64,i386 signed-by=/usr/share/keyrings/steam.gpg] https: //repo.steampowered.com/steam/ stable steam
No active apt repos in: /etc/apt/sources.list.d/sublime-text.list
No active apt repos in: /etc/apt/sources.list.d/unityhub.list
Active apt repos in: /etc/apt/sources.list.d/waydroid.list
1: deb [signed-by=/usr/share/keyrings/waydroid.gpg] https: //repo.waydro.id/ jammy main
Active apt repos in: /etc/apt/sources.list.d/wfg-0ad-focal.list
1: deb http: //ppa.launchpad.net/wfg/0ad/ubuntu noble main
Active apt repos in: /etc/apt/sources.list.d/wfg-0ad-jammy.list
1: deb [signed-by=/etc/apt/keyrings/wfg-0ad-jammy.gpg] https: //ppa.launchpadcontent.net/wfg/0ad/ubuntu jammy main
No active dnf repos in: /etc/dnf/dnf.conf
Info:
Memory: total: 16 GiB available: 15.58 GiB used: 3.9 GiB (25.1%)
Processes: 315 Power: uptime: 19m states: freeze,mem,disk suspend: deep wakeups: 0
hibernate: platform Init: systemd v: 255 target: graphical (5) default: graphical
Compilers: gcc: 13.3.0 alt: 9/11/12 Client: Cinnamon v: 6.4.8 inxi: 3.3.34

Is there anything else that can help developers narrow down the issue? (e.g. logs, screenshots,
configuration files, savefiles, savestates)

Try playing any FPS game with the mouse =)

Actions #1

Updated by Billiard26 11 days ago · Edited

Yeah. A linear angle doesn't properly simulate pointing at a linear TV screen position. The games apply so much smoothing to the cursor it's almost a lost cause, but I suppose the math could be improved a bit for little effort.

It's maybe worth mentioning that Zelda Skyward Sword probably wouldn't benefit from this change, but it's a weird one.

Actions #2

Updated by bdp.inbox@gmail.com 10 days ago

I'm not familiar with the codebase but it appears the issue is on line 255 of this file https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/Core/HW/WiimoteEmu/Dynamics.cpp

Assuming x=0 is the center of the screen, it would be something like target_yaw_angle = tan^-1(pixels_per_meter * x / NEUTRAL_DISTANCE)

Actions #3

Updated by bdp.inbox@gmail.com 10 days ago

This isn't perfect but it solves the issue of the pointer moving faster/slower on different parts of the screen. It's now linear and smooth:

 const auto target_angle = Common::Vec3(pitch_scale * -atan(cursor.y), 0, yaw_scale * -atan(cursor.x));

It still needs some scaling, the cursor moves farther on the X than Y per pixel of mouse movement.

Actions #4

Updated by JMC4789 10 days ago

Have you tested this on various games? Different games calibrate the infrared differently.

Actions #5

Updated by Billiard26 10 days ago · Edited

Metroid Prime 3 (and all games) do so much cursor smoothing, I really can barely tell the difference. But yeah, this is probably more correct.

I think this would be the adjusted code that accounts for the Total Yaw and Total Pitch values properly.

  // Convert linear cursor position to TV screen position angles.
  const auto yaw = std::atan(-cursor.x * std::tan(yaw_scale));
  const auto pitch = std::atan(-cursor.y * std::tan(pitch_scale));

  const auto target_angle = Common::Vec3(pitch, 0, yaw);
Actions #6

Updated by bdp.inbox@gmail.com 10 days ago

The difference is most noticeable when the cursor transitions from the center of the screen towards the outer edges, without the change it speeds up quite a bit. Subjectively, point-and-click-sequence style interactions are now way easier.

Testing on "The Conduit" - good results with the fix, seems fine without it.

Those two are the Wii games I'm familiar with that require a lot of pointing. I'm happy to test others as well if folks have suggestions.

Actions

Also available in: Atom PDF