controller_patcher/README.md

53 lines
2.1 KiB
Markdown
Raw Normal View History

# What is in this controller_patcher repository
These files are the magic behind tools like HID to VPAD and can used to use your USB HID Device on your WiiU console.
#Dependencies for including it in other applications
This controller_patcher is build to be used in serveral projects. It don't uses some ultra fancy external libraries. </br>
To be able to use in other projects, you will need some external data though.</br>
- At first, you need a copy of the [dynamic_libs](https://github.com/Maschell/dynamic_libs) in your src/dynamic_libs folder.
- To able to log something, you need the right [logger functions](https://github.com/Maschell/hid_to_vpad/tree/master/src/utils).
# Example implementation
###How to "install" it
In order to add hid support to your application, you need add these lines add each start up.
```
#include "controller_patcher/controller_patcher.h"
#include "controller_patcher/config_reader.h"
#include "controller_patcher/cp_retain_vars.h"
int __entry_menu(int argc, char **argv){
[...]
init_config_controller(); //Inits the data
init_button_remapping(); // inits the data for the buttons remapping
if(gConfig_done == HID_INIT_DONE){ // Only read the SD content once (When we're in the Mii Maker and have the rights to do it)
gConfig_done = HID_SDCARD_READ;
ConfigReader::getInstance(); //doing the magic automatically
ConfigReader::destroyInstance(); //destroying the SD reader
}
[...]
}
```
When you return back to the homebrew launcher, simply add the following line:
```
deinit_config_controller();
```
Take a look at the [HID to VPAD](https://github.com/Maschell/hid_to_vpad) sources for an actual example.
###How to use it:
Once you set up everything correctly, you can use the "setControllerDataFromHID" method to fill a VPADData pointer. Example:
```
VPADData buffer;
setControllerDataFromHID(&buffer,HID_ALL_CONNECTED_DEVICES);
```
This example will add the input from ALL connected HID devices into the created VPADData.
#Credits:
- Maschell
- FIX94 - huge thanks to him and his initally created gc-to-vpad. Was a motivation and base to start all this