Fan video found on YouTube
by Nick W. on May.02, 2009, under Media
This is the first demo video I’ve found out there on the web made by a downloader of XWii. It rocks to know there are people out there using my code and having fun with it. Thanks to whoever actually made this.
What is XWii anyway?
by Nick W. on May.02, 2009, under What's XWii?
In short: Xwii lets you control your Linux desktop with the Nintendo Wii Remote.
In Long: XWii is a driver application built on top of the Wiiuse library (wiiuse.net). It interprets signals from the Nintendo Wii Remote into X11 keyboard and mouse input, allowing you to control all the programs on your computer with the wiimote.
What you need to get started:
- A bluetooth adapter that works under linux.
- A Wii Remote (obviously).
What features of the Wii Remote are supported?
- Supports all buttons on Wii Remote, Nunchuk, Classic Controller and Wii Guitar Hero 3 Controller
- Map to keyboard keys (single or multiple, eg. Alt+F4), or map to system commands (external programs, scripts, etc.)
- Supports mapping Classic Controller, Nunchuk and Guitar Controller joystick axes as keyboard keys (even the Guitar Controller’s whammy bar!).
- Supports controlling mouse with Wii Remote accelerometers (tilt sensors).
- Supports controlling the mouse via the Wii Remote’s Infra-Red pointing ability (requires Wii Sensor Bar or other dual Infra-Red light source).
- Supports turning on the Wii remote LEDs
- XWii now functions as a daemon, it will wait indefinately for a wiimote connection and you can disconnect and reconnect as much as you like.
How to Create Config Profiles
by Nick W. on May.02, 2009, under Docs
When you start XWii, the command takes this form:
xwii path/to/config/file.xwii
XWii config files are made up of BBCode style “tags” like this:
[a]KEYBOARD Return[/a]
The following is a list of supported tags:
Wii Remote tags
- [a] - the Wii Remote A button
- [b] - the Wii Remote B (trigger) button
- [up] - Up on the Wii Remote D-Pad
- [down] - Down on the Wii Remote D-Pad
- [left] - Left on the Wii Remote D-Pad
- [right] - Right on the Wii Remote D-Pad
- [plus] - “+” button on the Wii Remote
- [minus] - “-” button on the Wii Remote
- [home] - Home button on the Wii Remote
- [1] - 1 button on the Wii Remote
- [2] - 2 button on the Wii Remote
- [flick] - Triggered when any of the Wii Remote’s accelerometers registers a high G force (someone flicked the remote in the air)
- [acc_mouse] - if set to 1, the Wii Remote’s tilt sensors will control mouse movement.
- [ir_mouse] - takes the form [ir_mouse]WIDTHxHEIGHT[/ir_mouse] where WIDTH and HEIGHT are the screen resolution being used (eg. “1280×1024″). Enables IR-Pointer mouse.
- [led1] - set to 1 if you want LED 1 on the wiimote to be lit.
- [led2] - set to 1 if you want LED 2 on the wiimote to be lit.
- [led3] - set to 1 if you want LED 3 on the wiimote to be lit.
- [led4] - set to 1 if you want LED 4 on the wiimote to be lit.
- [tilt_left] - When the wiimote is tilted to the left.
- [tilt_right] - When the wiimote is tilted to the right.
- [tilt_forward] - When the wiimote is tilted forward.
- [tilt_back] - When the wiimote is tilted back.
Classic Controller tags:
- [cc_a] - The Classic Controller A button
- [cc_b] - The Classic Controller B button
- [cc_x] - The Classic Controller X button
- [cc_y] - The Classic Controller Y button
- [cc_plus] - The Classic Controller “+” button
- [cc_minus] - The Classic Controller “-” button
- [cc_home] - The Classic Controller Home button
- [cc_zl] - The Classic Controller left Z button
- [cc_zr] - The Classic Controller right Z button
- [cc_l] - The Classic Controller L shoulder button
- [cc_r] - The Classic Controller R shoulder button
- [cc_dpad_up] - Up on the Classic Controller D-Pad
- [cc_dpad_down] - Down on the Classic Controller D-Pad
- [cc_dpad_left] - Left on the Classic Controller D-Pad
- [cc_dpad_right] - Right on the Classic Controller D-Pad
- [cc_ls_up] - Up on the Classic Controller’s left thumbstick
- [cc_ls_down] - Down on the Classic Controller’s left thumbstick
- [cc_ls_left] - Left on the Classic Controller’s left thumbstick
- [cc_ls_right] - Right on the Classic Controller’s left thumbstick
- [cc_rs_up] - Up on the Classic Controller’s right thumbstick
- [cc_rs_down] - Down on the Classic Controller’s right thumbstick
- [cc_rs_left] - Left on the Classic Controller’s right thumbstick
- [cc_rs_right] - Right on the Classic Controller’s right thumbstick
Nun-Chuck Tags:
- [nc_stick_up] - Up on the Nunchuk control stick
- [nc_stick_down] - Down on the Nunchuk control stick
- [nc_stick_left] - Left on the Nunchuk control stick
- [nc_stick_right] - Right on the Nunchuk control stick
- [nc_c] - Nunchuk C button
- [nc_z] - Nunchuk Z button
- [nc_flick] - Event triggered when the Nunchuk accelerometers register a high Gforce (someone flicked the nunchuk in the air).
Guitar Hero 3 Controller Tags:
- [gtr_stick_up] - Up on the Guitar control stick
- [gtr_stick_down] - Down on the Guitar control stick
- [gtr_stick_left] - Left on the Guitar control stick
- [gtr_stick_right] - Right on the Guitar control stick
- [green] - green fret button
- [red] - red fret button
- [yellow] - yellow fret button
- [blue] - blue fret button
- [orange] - orange fret button
- [gtr_minus] - guitar minus button
- [gtr_plus] - guitar plus button
- [whammy] - triggered when you press down the whammy bar
General Tags:
- [title] - Set this profile’s title, no real use yet, but maybe later.
Usage:
All tags must have the opening and closing tag on the same line of the file. This is because XWii reads the config file one line at a time.
Whatever is between the opening and closing tags is executed as a system command unless it is one of the following:
- KEYBOARD - maps this Wii button to the specified keyboard key(s)
- MOUSECLICK - maps this Wii button to a click of the specified mouse button
- SWITCHPROFILE - loads the config file specified
See the config files included in the “profiles” folder of the source distribution for examples. The complete list of possible keyboard codes is viewable in your /usr/include/X11/keysymdef.h.
Setting Up XWii on your Computer
by Nick W. on May.02, 2009, under Docs
Extract the source distribution (.tar.gz file) to some folder and run the commands:
make
./start_xwii.py
make compiles the source code of xwii into an executable program (I distribute it as source because that way, people on 64-bit architecture, etc. can use the same archive. I can also include a version of wiiuse (the library xwii is based on) compiled for the necessary platform this way. This requires the necessary BlueZ bluetooth libraries to be available on your system.
start_xwii.py runs a python script that lets you select one of the available profiles (a profile defines mappings of the wii remote buttons, joysticks, etc. to mouse/keyboard input) for xwii to use. This requires python to be installed on your system.
XWii 2.8
by Nick W. on May.02, 2009, under Download
This is the first and only release on the new XWii site, so I’m attaching the entire changelog to date. You can download the XWii source tarball below. I’m trying to find the time to learn to make .deb packages, but it may be a while. There are out-of-date packages at GetDeb.
Download: XWii 2.8 Source Tarball (XWii_2.8_source.tar.gz)
How to Build:
cd
make
./start_xwii.py
You must install the following libraries on Ubuntu Jaunty (9.04) in order to compile:
- libbluetooth-dev
- libxtst-dev
As well as the SDL/OpenGL libs to get wiiuse to compile.
Changelog:
Version 2.8
# Added ability to treat wii remote tilting as keyboard events with the
following tags:
# [tilt_left]
# [tilt_right]
# [tilt_forward]
# [tilt_back]
Example usage:
[tilt_left]KEYBOARD a[/tilt_left]
Version 2.7
# Fixed XWii so that on startup (not just after a disconnect) it will search
endlessly for a wiimote until it finds one to connect to (used to give up
after 5 seconds).
Version 2.6
# Patched the makefile a couple of times from the 2.5 (my thanks to Joao Pinto
who maintains the XWii package on GetDeb.net for pointing out my errors).
# Fixed a problem where flick events and accelerometer events weren’t working
after a reconnect.
# Fixed a problem where the LED state wasn’t being set back to what was in the
config file after a reconnect.
Version 2.5
# Updated the whole of XWii to use the newest version of wiiuse (0.12) under
the hood. In particular, the Guitar Hero 3 controller now uses the GH3
specific wiiuse api rather than that Classic Controller handshake hack that it
was using before.
# The above means there are new tags for specifying functionality of the Guitar
Hero 3 Controller controls:
[green][/green] - green fret button
[red][/red] - red fret button
[yellow][/yellow] - yellow fret button
[blue][/blue] - blue fret button
[orange][/orange] - orange fret button
[gtr_plus][/gtr_plus] - guitar plus button
[gtr_minus][/gtr_minus] - guitar minus button
[gtr_stick_up][/gtr_stick_up] - Guitar joystick up
[gtr_stick_down][/gtr_stick_down] - Guitar joystick down
[gtr_stick_left][/gtr_stick_left] - Guitar joystick left
[gtr_stick_right][/gtr_stick_right] - Guitar joystick right
[whammy][/whammy] - Triggered by pressing on the whammy bar
# The bug preventing me from accurately determining what kind of expansion was
plugged in has been resolved so the tags [use_nunchuk] and [use_classic] are
no longer needed (but don’t do anything if they’re still around).
# xwii is now “daemonized”. If you start xwii with a given profile,
you can now power off the wii remote (by holding the power button) and it will
xwii will not exit, but instead do continuous 5 second searches for a new
connection. This way, you can start watching a movie using the wii remote as
a remote control, power off the wii remote with the power button then just
reconnect by holding 1 + 2 if you decide you need to pause and pour a coke
Version 2.2.1
# Added a quick and dirty work around for a bug of unknown origin affecting some
systems where, when using the nunchuk, every possible event on the classic
controller was constantly being triggered. This caused massive (around 10
second) delay on wiimote input.
# The above work around required me to add two new profile tags:
[use_classic]1[/use_classic] # tells XWii to process classic controller
# input
[use_nunchuk]1[/use_nunchuk] # tells XWii to process nunchuk input
I have updated the default profiles in the distribution that use the
classic controller and nunchuk to have these tags, but you will have
to update your own user-created profiles manually.
If a profile doesn’t have the [use_nunchuk] tag set to 1 (for instance),
nunchuk input will not be processed even if some [nc_*] tags are present.
I know this is a bit hackish, this is a work around only. Its purpose is to
make XWii usable until I have time to do a full port of the XWii base code to
a wiiuse 0.12 backend (which has API functions that should enable me to
determine definitively which expansion is plugged in and eliminate the need for
these new tags).
Version 2.2
# Added support for multi-key keyboard events, example:
[a]KEYBOARD q w[/a] # presses q and w on the keyboard simultaneously
# Added support for switching on the LEDs with the following tags:
[led1]1[/led1]
[led2]1[/led2]
[led3]1[/led3]
[led4]1[/led4]
Version 2.1
# Added nunchuk support with the following new tags:
nc_stick_up
nc_stick_down
nc_stick_left
nc_stick_right
nc_c
nc_z
nc_flick
# I have been playing Zelda: Ocarina of Time in mupen64 using similar controls
to Twilight Princess on the Wii, using the included nunchuk_n64.xwii profile.
Version 2.0.1
# Added support for the wiiguitar into the wiiuse source code (not in the version
from wiiuse.net at time of writing).
# Added wiiuse source code to distribution archive. To get Frets on Fire going
with a Wii Guitar is now as simple as:
make
./xwii profiles/guitar.xwii
and then start the game.
# Also, this means that 64bit users don’t have to manually copy their wiiuse.so
and wiiuse.o
Still to Come:
# Nunchuk support
# Better profile switching
Version 2.0
Ported the code base from libcwiid to libwiiuse (wiiuse.net). My thanks go out to Para for creating this great library. Wiiuse interprets wiimote input (the hard work), XWii just translates the results from wiiuse into X11 keyboard and mouse events (the easy work). Para truly deserves most of the credit for the XWii that exists today.
XWii lives on!
by Nick W. on May.01, 2009, under News
Welcome to the new XWii website. It runs on WordPress, I know I said I was going to make a CMS for this kind of stuff, but I’ve run out of spare time and I’ve done CMS work before so I wasn’t really going to learn anything by re-inventing the wheel. On that note, I hope you find this XWii site a whole bunch easier to navigate (and MUCH easier on the eyes!).
God bless,
-Nick