HID Wiimote Source Code available

Wuhu! I have published the Source Code of HID Wiimote on Github.
Some have already asked for it, now i finally did it!

Check it out: https://github.com/jloehr/HID-Wiimote

I am going to fill it with Issues and Milestones in the next days.
But you can add Issues on your own, when encountering a bug.
If you manage to fix a bug, or come up with a cool feature, feel free to contribute.
Fork it, fix it, send a Pull Request!


IR-Mouse HID Wiimote Hotfix

Small hotfix for the IR-Mouse version of HID Wiimote. I stupidly removed the Hardware ID from the .inf file, thinking the IR-Mouse doesn’t need it, because the “-TR” Wii Remote shares it with the Wii U Pro Controller.

Added it back to the .inf file and made a new package batch. When you want to use the newer Wii Remotes with the IR-Mouse driver, uninstall the old one and get the fresh packages from the download page.

Since the Wii U Pro Controller has the same Hardware ID as the newer Wiimotes, the IR-Mouse driver gets also loaded for the Wii U Pro Controller, although it doesn’t have an IR-Sensor.

Changes to IR-Mouse

  • Hotfix for IR-Mouse to enable “-TR” Wii Remotes

HID Wiimote Update 01.06.15

I’ve finally finished the IR-Mouse Version of HID Wiimote!
With that driver you are able to control your mouse pointer by pointing your Wii Remote at your screen. You just need some kind of IR source with up to four points, but best is a Sensor Bar.
The input is slightly steadied but has therefore a small input delay. You can download the driver from the HID Wiimote page. If you are looking for the old DPad-Version you can find it here.

Additionally i made a small update to the Gamepad Version. I fixed a small issue, so the input state is reset when the connection to the controller is lost. You can get the update from the project site as well.

Next i am going to work on the XUSB communication, so i can create a XUSB/XInput Driver for the Wii U Pro Controller.

New IR-Mouse Version

  • Tracks up to four IR-Points
  • Interpolates with previous points to steady
  • Therefore slight delay

Changes to Gamepad

  • Input State is reset, when the connection is lost

HID Wiimote Update 20.04.2015

Wii U Pro Controller

Yay, Update for HID Wiimote! The Nunchuck and Classic Controller (Pro) Extensions are now supported. In Addition to that the Wii U Pro Controller is supported as well.

I’ve added a lot of Buttons and some more Axis as well as a Hat Switch to the Properties Dialog. The Button Mapping switches dynamically when an Extension is plugged in.

With my Wii Remote the Extension is sometimes not correctly detected. In that case you have to remove the Extension and plug it in again until it works (Sometimes take up to 10 tries; but maybe my Wiimote has just a loose contact and there is normally no such problem).

My next task is creating an IR-Mouse driver as many have requested. I’ve already made quite good progress on that.

I would be very happy when you spread the news and this Blog entry or the HID Wiimote Project Page is shared on Facebook, Twitter, Reddit and all other sites.

Last but not least, i am streaming my coding sessions on Livecoding.tv and Twitch.tv. So feel free to join my streams and ask questions. My regular streaming schedule is every Monday starting at 08:00 PM (Berlin/UTC+1).

So get the newest version here.


  • Nunchuck, Classic Controller (Pro) and Wii U Pro Controller are now supported
  • Added more Axis, Buttons and a Hat Switch
  • Unfortunately no more Vista Builds
  • Windows 8.1 Build

Small Update & Streaming

Here is a small update on the progress on HID Wiimote. I’ve almost finished up extension support for the Nunchuck, Classic Controller (Pro) and Wii U Pro Controller.
So i’m confident to release the new build in 1 or 2 weeks.

In the meantime i started to stream my coding sessions on HID Wiimote. So this means you can watch me working on it. My streaming schedule is every Monday starting at 8:00 AM (Berlin/UTC+1). Additional there might be spontaneous streams, so follow me on my streaming channels and Twitter to get notified. My streaming channels are:

After finishing the extension support, i am going to start on an IR-Mouse Driver Version.

OpenAL-MOB with openFrameworks on Android


On work i am currently working on a mobile game project. We are using openFrameworks v0.8.4 in combination with OpenAL for Audio output because we need the HRTF for binaural sounds. The OpenAL implementation is OpenAL-MOB, since it’s an OpenAL-Soft fork with HRTF support and especially supports mobile platforms.

To get OpenAL-MOB integrated into openFrameworks we are using our own wrapper, but the openFrameworks Addon ofxALSoft will do just fine. Just merge the OpenAL-MOB folder into the ofxALSoft addon folder and you are ready to go.


Our main target platform is iOS, so my development system is a Mac OS X. I am therefore referring to the Mac Terminal, but for Linux and Windows the steps should be the same.

To get OpenAL-MOB running and deployed on an iOS Device is quite easy. Just add the ofxALSoft addon and the OpenAL-MOB-ios XCode project to your openFrameworks project in XCode. XCode compiles OpenAL-MOB and links it into your app on its own. So everything is fine.


Our second target platform is Android and the last couple of workdays i tried to get the project running on our Android device.

Currently openFrameworks supported Android IDE is still Eclipse, so i am referring to Eclipse. If you use Android Studio you might to have adjust some additional things.

The problem with openFrameworks for Android is it uses custom makefiles to compile your openFrameworks project and create a shared library. Additionally it is ignoring the Android.mk and Application.mk generating them each build.

OpenAL-MOB provides Android makefiles but since openFrameworks ignores its Android.mk you can’t create a dependency. Even worse due to openFrameworks custom makefiles the addons are compiled as well and everything is linked into one shared library. In this linking process the ofxALSoft addon needs something to be linked again, which is the OpenAL-MOB lib, that needs to be built beforehand.


I came up with a way to get it running anyway. I didn’t create a dependency to automatically  build OpenAL-MOB each deplay, but rather build the library manually. However if you won’t change OpenAL-MOB you just to need to build it once.

The first step is to build a static library of OpenAL-MOB and then include it into the linkage of the openFrameworks shared lib of your project.

Building OpenAL-MOB

Adjusting the Makefile

Open Android.mk in “Path/to/of/addons/ofxALSoft/build_android/jni/“.

First we need to add one compiler flag otherwise we will get some linker errors later when building the openFrameworks project. So add beneath the “ifreq … else … endif” block around the LOCAL_CFLAGS:

LOCAL_CFLAGS += -fno-stack-protector

Second change it to build a static library instead of a shared one. To do so change the last line from




At the end the bottom half of the file should look like:

# set the platform flags
ifeq ($(APP_ABI),x86)
 LOCAL_CFLAGS += -D HAVE_NEON -mfloat-abi=softfp -mfpu=neon -marm

LOCAL_CFLAGS += -fno-stack-protector




Now we are ready to compile it. The ndk-build tool is a little bit broken (or it was in revision 9b) because it evaluates the ifreq … block just once in a call so we need to run two compile passes. First compile for ARM and then in a second run for x86.

Open Application.mk in “Path/to/of/addons/ofxALSoft/build_android/jni/” and set

APP_ABI := armeabi armeabi-v7a

Now open a Terminal and navigate with cd to “Path/to/of/addons/ofxALSoft/build_android/jni/“. Run “Path/to/ndk/ndk-build” in this directory to compile it.

If you get compile errors because he can’t find some header files, specify the APP_PLATFORM argument. You can either add it to your Application.mk file or pass it as command line argument to ndk-build. And make sure the specified Android Version is included in the NDK package.

After building the static libraries for ARM open “/addons/ofxALSoft/build_android/obj/” and rename the folder local to android. OpenFrameworks will later search for the static lib in a directory structure similar to “*/android/$(abi)/libname.a“. Furthermore ndk-build cleans previously build static libs for all target in the local directory when run. So it would delete our previously build libs on the second build pass.

For the second build pass set

 APP_ABI :=x86

in the Application.mk and run ndk-build again.

Copy the “local/x86” folder into “android/x86“.

We now have three static libraries of OpenAL-MOB for each architecture. And can start to add them to the openFrameworks project.

Adding it to your Project

At last we need to include the OpenAL-MOB library into the openFrameworks make process.

Navigate to your openFrameworks project folder and open config.make.

First we need to add the library headers to be included for the addon. Add


at the appropriate position.

Then we need to include the static lib into the linkage. Add

PROJECT_LDFLAGS += $(OF_ROOT)/addons/ofxALSoft-MOB/build_android/obj/$(ABI_LIB_SUBPATH)/libOpenAL-MOB.a

for the linker flag.

Now hit run or build all in eclipse and your project should successfully compile and deploy to your device.


As said the OpenAL-MOB library is built manually, but unless you modify it you just need to build it once and can add it to your repository as prebuilt library. There might be a way to include the build into the openFrameworks makesystem but since i don’t need that i am skipping that step.

HID Wiimote Update 12.10.2014

It has been a while since the last update, but i didn’t had a lot of time in the last couple of months. Due to that this is just a minor update. I looked into the problem with the certificates and the driver signing. Unfortunately i wasn’t able to remove or avoid the necessary driver signature verification deactivation on 64bit systems. But at least i got Windows into loading my driver over the default one, so changing the driver each time should be gone now.

Additionally someone requested to have a driver to use the Wii Remote as mouse.  I’ve made a special build, so the Wii Remote is recognized as mouse. You can move the mouse with the DPad, left and right click is on 1 and 2 and the middle mouse button is mapped to B. In the future i’m going to work on another build to control the mouse with the IR sensor, but this will take some additional time.

Last but not least someone other requested also to have Vista builds. So from now on i will provide Vista builds as well.

Get the newest version here, or the direct download directory


    • Added another installer, so Windows will use HID Wiimote as default driver for the Wii Remote
    • PDad-Mouse Build

HID Wiimote Update 01.07.2014

Today i borrowed a Wii Remote with Plus inside, one of the newer ones (RVL-CNT-01-TR) with the Sync Button on the battery cover. My hearings were true, they have a different hardware ID, but that was just a minor problem and fixed with one line in the INF-file. The bigger problem was, that they differ a little bit in behavior. So in the end you can’t connect the new Wii Remotes by pressing the 1 and 2 buttons, instead you have to use the Sync button each time. There were some additional trouble, but i fixed that as well.

Another new feature are a second X and Y axes for tilt. Currently tilt is only tracked by the accelerometer, so it’s a little bit inaccurate and you have to hold the Wii Remote still. The Motion Plus gyroskop is not supported yet, but that will be my next task. You might need to recalibrate the asxes via the gamecontroller properties dialog. The reason is, that all Wii Remotes are not well calibrated, so the middle, minima and maxiuma are a little bit shifted.

Hower, newest version can be downloaded here: HID Wiimote


  • Added support of the newer Wii Remotes (RVL-CNT-01-TR)
  • Added second X/Y axes representing tilt (Currently only tracked by the accelerometer) 
Properties dialog with driver
Properties dialog of the new driver verion

HID Wiimote Update 26.06.2014

In the past days i’ve worked a lot on the driver. Unfortunatly there were some problems with the last uploads. Now i’ve tested everything and it should work properly. If you still encounter any error, please let me know.

For download visit: HID Wiimote



  • The d-pad is represented as X/Y axes now, instead of four different buttons.
  • The four LEDs will now represent the remaining battery charge.
  • On Windows 8 the Wii Remote will now be marked as Offline, when powering it off or Windows is rebooted.


  • Added an Installer. DPInst.exe is a Microsoft provided default installer for driver packages. The installer will also add an entry to your Programs and Features for uninstalling the driver.

Stacraft 2 Galaxy Editor: User Data

I am recently working on an Extension Mod for Starcraft 2. Doing so is quite difficult because there are very few tutorials and no official documentary. Especially if you never used the Warcraft 3 Editor before, the Editor is very overwhelming. But still if you used it, the Galaxy Editor has many new features. So i want to share some of my knowledge.

The topic is ‘User Data’, a way to store your map or extension custom data. This article is based on the Starcraft 2 and Galaxy Editor version Heart of the Swarm 2.1.1.


When you start making maps or extensions, you create all of your specific Units and Behaviors. But in some cases some data is left you don’t know where to put it, e.g. data for your quests, or which wave will contain how many of what unit. Then you are most likely tempted to put that information into triggers and their variables. You can do so, but that can end in a mess.

A better way is to use the ‘User Data’. You can create ‘User Types’ in the Data Editor and fill those with your ‘User Data’. ‘User Types’ are like Records in the Trigger Editor but you fill them right away like creating a new Unit.

The benefit of using ‘User Data’ is the separation of your trigger logic and your data. In programming terms, using the Trigger variables and defining them via Triggers is like hard coding your data. (In fact Starcraft 2 does translate your triggers to galaxy script and compiles it, so your data is indeed hard coded)


An ‘User Type’ is a Data Entity like an Unit. At first you have to create a new ‘User Type’ in the Data Editor. Then you define its Fields with its types. After that you define Instances which are like rows in a database. Each Instance can have an unique index and an Id to identify it. The index is an Integer whereas the Id is a string.

Example of a ‘User Type’ with Fields and Instances

In Triggers you can then access and get the Value of a Field for an Instance via Setter Actions and Getter Functions. Furthermore you can save References of Instances in variables as well.

Data Editor

Create ‘User Types’

All you need is the Data Editor. Open the ‘User Types’ tab by clicking on the green plus, move you mouse over ‘Edit Advanced Data’ and choose ‘User Types’

'Green Plus' -> 'Edit Advanced Data' -> 'User Types'
Open the ‘User Types’ Tab via ‘Green Plus’ -> ‘Edit Advanced Data’ -> ‘User Types’

Then right click in the top white box an choose ‘Add User Type…’ so an ‘User Type Properties’ dialog will show up.

User Type Properties Dialog
Right click in the ‘User Type’ list and choose ‘Add User Type’

Define a ‘Name’ for your ‘User Type’. This name will be used in dialogs in the Galaxy Editor, wherever you have to select a ‘User Type’. The ‘ID’ will be used inside the engine to refer to this ‘User Type’ and has to be unique. Just use the suggested name by clicking the ‘Suggest’ button after you filled in the name.

The ‘Define Default Values’ checkbox makes the ‘User Type’ a parent only. This means, it defines a type with its fields, but does not have any instance (it can have instances but those do not have any values for their fields). A new ‘User Type’ can then be cloned from a parent.

With ‘Parent’ you select an ‘User Type’ which will function as a parent for creation. On creation the parent will be cloned with its fields (but without it’s values). This means the new ‘User Type’ will have the same fields like its parent. However if you change the parent afterwards, the children’s fields won’t change. The ‘Show Non-Default’ checkbox will list all ‘User Types’ in the drop-down list, else only ‘User Type’ with ‘Define Default Values’ checked will be listed.

The ‘Editor Prefix’ and ‘Editor Suffix’ will just add text to the name displayed in the Editor.

‘Field Values’ defines from which the field values will be copied on creation.

After creating the ‘User Type’ you have to add fields. Fields define what kind of data the ‘User Type’ consists of. Select the new type on the left, so you see its properties on the right. If you use the Table View, first right click on Fields and choose ‘Modify Value’. Then in either views click on ‘Add…’ below the ‘Fields’ list.

Click on ‘Add…’ beneath the Fields list

Choose an ‘Id’ for the new Field. It is also the name displayed within the Editor.

Next choose the ‘Type’ of data the Field will contain.

‘Value Count’ defines how many values are stored in this field. If it is greater than one the field is like an array.

If you set ‘Editor Column’ greater than one the field and its value are displayed in the Instances List.

Editor Coloumn
Three Fields with ‘Editor Column’ greater than one

I don’t know what ‘Editor Text’ does. But it changes nothing, so it seems not to be important.

With ‘Modifiable’ checked, you can change the value of this Field with Triggers while the map is running. If not the Field is considered as read only.

‘Conversation State’ makes this field available to be used within conversation conditions and states.

Fill it with data

To fill an ‘User Type’ with data you define Instances. Click on ‘Add…’ under the Instances list. In the Table View first you have to right click on Instances and choose ‘Modify Value’.

First choose an ‘Id’ which will be also the name of this Instance. The ‘id’ will be displayed within the Editor and has to be unique within the ‘User Type’.

The ‘User Data Instance’ Dialog; the right side will change depending on the selected Field

On the left you can then select a Field you want to set its value. The right side of the dialog will change then depending on the type of the Field. Fill in the value of the Field and after you filled in all the data for this Instance click on ‘OK’.

If the selected Field has a ‘Value Count’ greater than one a list with indices and values will be displayed.

Example UserData
Example of Fields and Data for an ‘User Type’

You might wonder what the first Instance [Default] might be. It defines the default values for each field when adding a new Instance. E.g. if you want to add more Instances and the Field Integer has the value 10 in many cases.  Then you could change the value of the Integer Field for the default instance. So when creating a new instance the value of Integer will be preset to 10.


After creating a ‘User Type’ and filling it with some data the next step is to access the data within your Triggers. The Editor provides several Actions to modify ‘User Data’ and Functions to retrieve the data. Additional there are also two different Variable types to work with ‘User Data’


Those Variable types are ‘User Data Instance’ and ‘User Data Field’. First one is used to refer to an ‘User Data’ Instance and the second one is used to refer to an ‘User Data’ Field type.

Variable declaration settings

Both of those variables have a ‘User Type’ drop-down menu in their declaration settings. It is used to specify which ‘User Type’ will be saved in the variable and is part of its type declaration.

To fill such variable with an instance two ways are given. First one is to pick one Instance from an drop-down list and the other is to use a predefined (or user-defined) function.

Choosing a ‘User Data Instance’ from the dropdown list


The common function to get an ‘User Type’ Instance is the ‘User Data Instance’ function. It takes two arguments and returns an ‘User Data’ Instance.

The ‘User Data Instance’ Function

User Data Instance – User data instance 1 for User Type

  • User Type: Specifies the ‘User Type’ from which the Instance is loaded.
  • 1: The index of the Instance to be loaded.

To retrieve data from an Instance the Editor provides several Functions. They’re all the same in the manner of arguments and how they work. The only difference is their return type. So for each data type exists one function to request it. Their names are ‘User Data (Type)’, where Type stands for the respective return type.

The ‘User Data (Type)’ Function for Strings

‘User Data (Type)’ – User data (User Type, Instance, Field, 1)

  • User Type: Specifies what ‘User Type’ will be accessed and what type the Instance is.
  • Instance: The Instance you want to retrieve the value from.
  • Field: From which Field you want to get the value.
  • 1: The index of the value within the Field. This parameter refers to the ‘Value Count’ you specify when creating a new field. If ‘Value Count’ is one leave it unchanged, it is the index of the value within the list of values.

Besides you can get some some more information about the ‘User Type’. The Editor provides three functions to get some numbers.

Additional Functions for ‘User Data’

Those three are ‘Number Of User Data Fields’, ‘Number Of User Data Instances’ and ‘Value Count Of User Data Field’. Their return type is Integer. You can use them to iterate over the respective Fields, Instances or Values.

The first one:

‘Number Of User Data Fields’ – Number of user data field for User Type

  • User Type: The ‘User Type’ you want to get the number of fields from.

The second one:

‘Number Of User Data Instances’ – Number of user data instances for User Type

  • User Type: The ‘User Type’ you want to get the number of Instances from.

The last function:

Value Count Of User Data Field‘ – Value count of Field for User Type

  • Field: The Field of the ‘User Type’ the count of values will be returned.
  • User Type: The ‘User Type’ of the Field you want to get the value count.

When using Value Count Of User Data Field‘ it will return the value specified as ‘Value Count’ when you created the Field. So even when the value array is not completely filled it will return the maximal count of values.


There are some Actions to modify Field values, reset them and save and load ‘User Data’ from and to banks. I haven’t used them yet. But my guess is, you can modify Field values, that are flagged with ‘Modifiable’. You can reset them to their default values with the Reset Actions. Then its possible to save modified ‘User Data’ to bank files to persist the change for the next map start. Next time the map is started you can load the ‘User Data’ from the bank file to restore the previous state.

This might be a nice way to store your current map state. Then it’s very easy to save the progress and recover it on the next map start to continue.



Instead of importing your data via the graphical Editor you can import and even export your data as XML. The key is that the Editor stores all map data as XML (maybe not the terrain but i’m not totally sure). You can switch the Data Editor to XML View by clicking the ‘XML View’ button.

The Data Editor in XML View

The Editor data is then displayed as XML on the right side.

Another way to import and export whole XML files is the Import Editor. Check the ‘Show Reserved’ box and you will see the ‘UserData.xml’ file. To export the file simply click on ‘Data’ and then ‘Export Files …’. Choose a Directory where the file will be put and click ‘OK’.

The Import Editor with reserved files displayed

Importing the ‘UserData.xml’ file is a little bit more difficult and requires some steps.

  1. Rename your XML file to a non-reserved name, else the editor won’t let you import it. E.g. ‘UserData_.xml’
  2. Import the file via ‘Data’ >> ‘Import Files …’. Browse to your XML file, be sure the file is checked and click ‘OK’.
  3. Then rename the newly imported file in the Import Editor by right clicking it and choosing ‘Rename’.
  4. Save the Map/Extension
  5. Restart the Editor, else the new User Data won’t be available in the Data Editor.

Nevertheless how you import XML, the big advantage is you can easily and fast import much data by simply copy paste the XML instead of clicking through the UI dialogs. Imaging you have all your quest data in an Excel table. Importing one hundred of quests would require a lot of time by doing it via the Editor. A much faster way would be a simple script which converts your table into appropriate XML. Then just one copy and paste command and all of your quests are in your Map/Extension.


Instead of creating the ‘User Type’ via XML, i recommend to create its Fields and some sample data with the Editor. Then use the sample data as template and only fill it with further data. Especially when you use non-primitive types (i.e. Unit, Game Link, Model, etc.) create enough sample data so you know how they are encoded. The problem is that the Editor only uses strings, so references to other entities are saved as their IDs.

The XML of our example data

The root node of the XML file is ‘<Catalog></Catalog>’. Every ‘User Type’ is a ‘<CUser></CUser>’ child node. Its name is the attribute ‘id’.

The Fields and Instance are direct childs of the ‘<CUser>’ node. The Fields are each declared as ‘<Fields />’ nodes. For their ID the attribute ‘Id’ (caution: Capital I) is used. The type is encoded as string in the ‘Type’ attribute. The ‘Editor Column’, ‘Value Count’ and Flags are only declared if they differ from their default values.

After the Field nodes the first Instance node is the ‘[Default]’ Instance. If you haven’t changed any of its values the tag will be an empty one. Instances are declared through the ‘<Instance></Instance>’ tag. Their only attribute is ‘Id’ which is their string identifier. The index is their order inside the XML file. So the second ‘<Instance></Instance>’ node will have the index one, the second one index two and so on.

Their values are stored in a rather counter-intuitive way. Each value is declared as a type node, i.e. ‘<Fixed></Fixed>’ for Reals, ‘<Int></Int>’ for Integers and so on. Their value is stored as an attribute named after their type. The reference to which Field this value belongs to is then declared as a ‘<Field />’ child node. The ‘<Field />’ node’s ‘Id’ attribute refers to the Field identifier. If a Field has more than one value (‘Value Count’ higher than one) the ‘<Field />’ node has an additional ‘Index’ attribute, except for the first value node. The ‘Index’ value starts at one.

As you can see in the Image above about the example data in XML, the first value entity for the Field ‘ArrayOfReal’ of each Instance does not have an ‘Index’ attribute, but the second and third one does.


‘User Data’ is a nice way to store you Map/Extension Data, especially if the data comes from an external source. I hope this article gives you an understanding on how to use it. If you have any questions regarding ‘User Data’, feedback to this article or any other concern, please let me know and feel free to leave a comment.