![]() |
|
Help porting GC Adapter implementation to a Node.js addon - Printable Version +- Dolphin, the GameCube and Wii emulator - Forums (https://forums.dolphin-emu.org) +-- Forum: Dolphin Emulator Discussion and Support (https://forums.dolphin-emu.org/Forum-dolphin-emulator-discussion-and-support) +--- Forum: Development Discussion (https://forums.dolphin-emu.org/Forum-development-discussion) +--- Thread: Help porting GC Adapter implementation to a Node.js addon (/Thread-help-porting-gc-adapter-implementation-to-a-node-js-addon) |
Help porting GC Adapter implementation to a Node.js addon - yonic - 01-27-2017 I'm currently developing a game with a Node.js engine, and I'd love to add support to the Wii U GameCube Adapter. At first I thought of using the HTML5 Gamepad API, but the support on Chromium is bugged and it won't detect the analog stick and the C-sticks (axes are null for some reason). I made a bug report about this issue on Chromium's issue tracker, but it seems like it's going to slip through the cracks... So I decided to make a Node.js addon with C++ using Dolphin's source as a code base to start. But I've come by a bunch of problems.
This article and this one from the Node.js docs should be more than enough to explain the process and the quirks of writting Node.js native addons with C++. I'd really appreciate some guidance on understanding the code for the adapter's implementation. RE: Help porting GC Adapter implementation to a Node.js addon - degasus - 01-27-2017 I can't give any advice on the GC protocol, but you can't just copy it from dolphin. We don't parse it at all, just pass the binary stream of the WiiU adapter to the game. But we also have the reverse part, called emulated gamepad. RE: Help porting GC Adapter implementation to a Node.js addon - yonic - 01-28-2017 So I started digging on how to get the binary stream from the adapter, when I came to a strange issue. Starting the built program with the adapter just connected on Windows (the driver had already been replaced to WinUSB on Zadig), prompts a LIBUSB_ERROR_TIMEOUT while trying to do a bulk transfer. However, if I start Elmassivo's Wii U GCN USB Driver, and after the input loop begins stop it, then start the program again, the error is gone and seems to get the requested data. This also happens with interrupt transfers, used in Dolphin. Here's my repo if you need to check the code. I must admit, it ended up being a lot like the Dolphin's GCAdapter.cpp Read() and AddGCNAdapter() methods despite not having the intention of copying it, I guess it's most likely because the procedures of getting to actually communicate with USB devices are mostly the same for each device and program. |