Emulator Issues #4334
closedFix proposal for [4185] - Wiimote spurious disconnection
0%
Description
Hi,
Like describe in bug 4185, I had spurious disconnection while playing with Mario Galaxy and I could not even play with Epic Mickey, my wiimote being always declared as disconnected.
Here comes a patch proposal that that solve those two bugs.
My system is running under linux 2.6.35 fedora 15 with a quad core CPU and only one wiimote. This patch has only be tested on this system.
I tried to do the same changes in the windows portion of the modified sources, but I do not have VisualStudio to compile and tests those changes in a VM.
The modifications are:
Source/Core/Core/Src/CoreTiming.*: refactoring to have a threadsafe fifo. This is not related with those bugs, but as I tested my patch with it, I provide it.
Source/Core/Common/Src/Thread.*: new wait function with a timeout parameter for Event objects / new function to get the name of the thread under unix (windows version is only "stub")
Source/Core/Common/Src/StdConditionVariable.h: timeout parameter for Event (could not test on windows, may be it does not even build)
Source/Core/Common/Src/FifoQueue.h: I do not think that the previous implementation was threadsafe. So here is a new version.
Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.*: Use two thread. One for reading the other for sending.
Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp: connected and disconnect functions updated to handle the 2 threads. Modification of the way the returns values of read() and write() function are used.
Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp: Tried to modify the connected() and disconnect() functions to handle the 2 threads, but I can not test it.
I hope the patch will work for other system, and will be merge.
Regards.