Emulator Issues #10625
When utilizing a Real Wii Remote through the emulated Bluetooth adapter, launching directly into a game with the -e parameter results in a crash
N/A (Any Wii Game)
Game ID? (right click the game in the game list, properties, info tab)
N/A (Any Wii Game)
MD5 Hash? (right click the game in the game list, properties, info tab, MD5 Hash: Compute)
What's the problem? Describe what went wrong.
When launching Dolphin and a Wii game directly using the -e launch parameter, Dolphin will crash when connecting to a real wiimote if "Real Wii Remote" is selected as the control options. The crash only occurs if the controller actually connects to Dolphin. If no controller connects, this issue doesn't occur.
What steps will reproduce the problem?
Set the controller input to "Real Wii Remote" and make sure continuous scanning is on so it'll connect right away.
Launch Dolphin using the -e parameter to load a game directly
Dolphin will load, you'll get a black screen in the emulation window, the controller will vibrate signaling it's connected, then Dolphin will crash (no HUD text is ever drawn)
Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.
Is the issue present in the latest stable version?
No. 5.0 Stable
If the issue isn't present in the latest stable version, 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.)
What are your PC specifications? (CPU, GPU, Operating System, more)
Windows 10 Fall Creator's Update
Is there anything else that can help developers narrow down the issue? (e.g. logs, screenshots,
configuration files, savefiles, savestates)
I was using a Dolphinbar and a RVL-CNT-01-TR
#3 Updated by NarryG over 3 years ago
Might be specific to Windows. I cannot reproduce the issue on Linux with Bluetooth (bluez) or the DolphinBar (hidapi).
Turns out there may be more to this.
As of the latest build when writing this (5.0-5944) it actually appears to be inconsistent. Sometimes the wiimote will start vibrating, dolphin will crash, and the wiimote will keep vibrating until the error reporting window goes away. Other times it'll work fine.
Here's a video of it occurring almost every time on the latest build/
Now here's the part that I say makes it weird. I went back and re-tested it on 5707 and if I restart enough times, the same issue will crop up. The difference is, instead crashing the majority of the time it crashes the minority of the time.
Video of it occurring after many restarts on 5707:
#5 Updated by NarryG over 3 years ago
I'll remove the regression marker, then.
I've done some research and found that it appears to be a thread sync issue. If I put my computer under heavy load then launch Dolphin, the issue does not occur (even on the latest dev build as of posting this). If I make sure everything is closed and use a recent build, it happens almost every single time.
If I had to guess, it's probably something with initializing the Wiimote before something else is initialized.
#6 Updated by NarryG over 3 years ago
I'm also running a batch script which automatically restarts Dolphin the moment it crashes (I'm corrupting the game so it's crashy) which seems to trigger it more. If you use this script it makes it occur even more than if you manually re-open the program over and over again.
title dolphin.com Watchdog :dolphin echo (%time%) dolphin started. Dolphin.exe -b -e "F:\Dropbox\Emulation\Roms\Nintendo GameCube\Metroid Prime (USA) (v1.00).gcz" echo (%time%) WARNING: dolphin closed or crashed, restarting. goto dolphin
#7 Updated by NarryG over 3 years ago
Sorry to spam with updates, but I just confirmed the theory.
WiimoteReal.cpp, void Wiimote::ThreadFunc()
Adding a 1000ms sleep after bool ok = ConnectInternal(); results in the issue going away.
Increasing the sleep that's already present right after this line (within the if (!ok) block) doesn't fix the issue. Someone with more knowledge of how it functions can probably find where the sync issue lies and implement a better fix than just waiting for 1000ms.