controller_patcher/README.md
2016-07-31 13:05:32 +02:00

2.5 KiB

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.

How to create config files

Detailed information about creating config files and adding support for more controller can be found in the wiki

Where can I find config files

Configfiles for all controllers are collection in this repository

#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.
To be able to use in other projects, you will need some external data though.

  • At first, you need a copy of the dynamic_libs in your src/dynamic_libs folder.
  • To able to log something, you need the right logger functions.

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 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