Game Development Reference
In-Depth Information
Figure 8-7. Control sockets for WiiC
The new controllers simply ignore any requests sent thru the Control Pipe. All information
must now flow thru the Data Pipe (port 13). This will work also with old controllers, which
indicates that the Data Pipe was the way to go in the first place. It is unclear why the original
developers chose to use the Control Pipe to send requests or why Nintendo chose to have a
Control Pipe in the first place.
Luckily, this is a simple change in the WiiC source. Locate the file io_nix.c in the Wiimote
project source code for this chapter under Wiimote\jni\WiiCNew\src\wiic within your
workspace. There is a method called wiic_io_write (see Listing 8-4).
Listing 8-4. Changes to WiiC to Send Messages Through the Data Pipe
int wiic_io_write(struct wiimote_t* wm, byte* buf, int len) {
// Old way: send bytes thru the Control Pipe
// return write(wm->ctl_sock, buf, len);
// Now we send thru the Data Pipe
return write(wm->data_sock, buf, len);
}
wiic_io_write is in charge of writing an array of bytes to the Bluetooth socket of the
Wiimote. You simply write the bytes to the data socket (Data Pipe) instead of the control
socket (Control Pipe), as seen in Listing 8-4.
Checking for the New Device Class
The device class is the identifier for the Wiimote as a Bluetooth device. The WiiC library
checks the device class for the old Wiimotes only. This is the main reason why most
emulators out there stopped working after November 2011 when Nintendo released the new
controllers. Therefore, WiiC must be patched to read this new device class. The following
steps outline how WiiC checks for a Wiimote (the full source is available in the io_nix.c file).
 
Search WWH ::




Custom Search