Glovepie Wiimote Mouse Script

понедельник 02 сентябряadmin
Glovepie Wiimote Mouse Script Rating: 9,6/10 1173 reviews

Aug 30, 2009  First: Sorry to bother you with such a simple request! I now spent about 5 hours until I finaly got my wiimote connected with my new HTPC and to set everything up so that the wiimote autoconnects with the 1+2 and Bluesoleil + GlovePIE.

//pie.framerate = screen.RefreshRate
pie.framerate = 120
var.f = removeunits(pie.framerate)
var.x = deadzone(joy.X,0.03)
var.y = deadzone(joy.Y,0.03)
var.scale = 60
var.x = ensuremaprange(var.x,-1,1,-var.scale,var.scale)
var.y = ensuremaprange(var.y,-1,1,-var.scale,var.scale)
var.dial = EnsureMapRange(joy.dial, -0.62, 1, -1, 1)
//allow mouse movement by other means and update position if it moved
if [round(,round(] != mouse.CursorPos then
debug = [,]
[,] = mouse.CursorPos
if pressed(joy.Button7) then
if var.stickmode 0 then
//cursor1.Visible = false
//cursor2.Visible = false
//cursor3.Visible = false
//cursor4.Visible = false
//cursor1.Visible = true
//cursor2.Visible = true
//cursor3.Visible = true
//cursor4.Visible = true
if var.stickmode 0 then
//floating point storage to improve slow movement. R button pressure slows more
//debug = [var.x/60,tan(var.x)] //
[var.x,var.y] = [tan(var.x),tan(var.y)] * (1800/var.f) /(var.dial*4+5)
//debug = [var.x,var.y] //
[,] = [,] + [var.x,var.y]
//cursor1.CursorPos = [,]
//cursor2.CursorPos = [,]
//cursor3.CursorPos = [,]
//cursor4.CursorPos = [,]
[key.up,key.down] = [deadzone(joy.y,0.35) < 0,deadzone(joy.y,0.35) > 0]
[key.left,key.right] = [deadzone(joy.x,0.35) < 0,deadzone(joy.x,0.35) > 0]
//avoid moving the mouse to the same spot its already at
if [var.x,var.y] != [0,0] then mouse.cursorpos = [,]
//debug = [,] // behold the power of subpixels!
GlovePIE specific: it is actually extremely important to set X and Y
positions in a SINGLE assignment command or line of code
mouse.CursorPos = [,]
[mouse.CursorPosX,mouse.CursorPosY] = [,]
mouse.CursorPosX =
mouse.CursorPosY =
Q: why is it bad?
A: you will get a stair effect when moving diagonally
// left click, middle click, right click
if pie.frame > 2 then // this check once covered up a bug when clicking RUN
press(mouse.leftbutton) = pressed(joy.Button1 or joy.slider>-0.5)
release(mouse.leftbutton) = released(joy.Button1 or joy.slider>-0.5)
mouse.MiddleButton = joy.Button4
mouse.rightbutton = joy.Button3
// double click
if pressed(joy.Button2) then
//[key.up,key.down] = [joy.Pov1up,joy.Pov1down]
//[key.left,key.right] = [joy.Pov1left,joy.Pov1right]
[key.up,key.down] = [joy.Button12,joy.Button11]
[key.left,key.right] = [joy.Button9,joy.Button10]
//debug = [-deadzone(joy.r,0.35),deadzone(joy.r,0.35)*10]
var.cleft = deadzone(joy.z,0.35) < 0 and deadzone(joy.r,0.35) 0
var.cright = deadzone(joy.z,0.35) > 0 and deadzone(joy.r,0.35) 0
var.cup = deadzone(joy.r,0.35) < 0 and deadzone(joy.z,0.35) 0
var.cdown = deadzone(joy.r,0.35) > 0 and deadzone(joy.z,0.35) 0
mouse.wheelup = pressed(var.cup)
mouse.wheeldown = pressed(var.cdown)
if helddown(var.cup,0.25s) then var.w = 1
if helddown(var.cdown,0.25s) then var.w = -1
if var.w 1 then
wait 50ms
if var.w -1 then
wait 50ms
if pressed(var.cup 0 and var.cdown 0) then var.w = 0
[,] = [var.cleft,var.cright]
key.enter = joy.Button8
//key.backspace = joy.Button7
using the 3in1 magic joybox from mayflash (PC035) without installing driver.
caution: holding the start button for 3 seconds changes modes in the hardware
Note for people unfamiliar with GameCube Controllers but who are
familiar with PS3, Xbox360 controls or PC gamepads with
analogue trigger buttons:
the L and R buttons are both analogue triggers and digital buttons.
you cannot press L and R digital buttons without pressing the triggers all the way.
L and R triggers have their own axes (DirectInput calls them Slider and Dial)
L and R triggers range from -1 (resting) to +1 (pressed)
there is an extra button (Z) above R but not L
when comparing ABXY on GameCube with ABXY on Xbox, X and B have swapped sides
GameCube does not have buttons under the analogue sticks
when mapping controls in some games, you have to hold L and R half-way
consequently, those games can't detect LT/RT until you press more than half-way
gamecube controls: triggered PC inputs in this script:
analog stick x = joy.x Mouse X
analog stick y = joy.y Mouse Y
dpad left = joy.Button9 Keyboard Left
dpad right = joy.Button10 Keyboard Right
dpad down = joy.Button11 Keyboard Down
dpad up = joy.Button12 Keyboard Up
c stick x = joy.z Keyboard CTRL+Tab or CTRL+Shift+Tab
c stick y = joy.r Mouse Scroll up + down
L pressure = joy.slider Mouse Left Click
R pressure = joy.dial Slows down Mouse X Y
button A = joy.Button1 Mouse Left Click
button B = joy.Button2 Mouse Double Left Click
button X = joy.Button3 Mouse Right Click
button Y = joy.Button4 Mouse Middle(ScrollWheel) Click
button L = joy.Button5 not bound
button R = joy.Button6 not bound
button Z = joy.Button7 switches modes (Left Stick + Arrow keys)
button Start = joy.Button8 Keyboard Enter/Return
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Welcome to FreePIE!

FreePIE (Programmable Input Emulator) is a application for bridging and emulating input devices. It has applications primarily in video gaming but can also be used for VR interaction, remote control, and other applications. A typical application might be controlling the mouse in a PC game using a Wiimote. Device control schemes are customized for specific applications by executing scripts from the FreePIE GUI. The script language is based on the Python syntax and offers non-programmers an easy way to interface devices.

FreePIE is very similar to the popular utility GlovePIE, but encourages open development and integration with any device. The software is designed to allow third party developers to add their own I/O plugins either through direct integration into the core library or through a separately compiled plugin mechanism.

  • For an example on how to implement an I/O plugin for FreePIE please see this wiki page. Plugin development
  • Please see the scripting section for help with scripting syntax. Scripting
  • How to use FreePIE IO from external software

List of supported hardware

  • Mouse
  • Keyboard
  • TrackIR
  • Freetrack
  • Wiimote with M+
  • Wii Classic Controller
  • Wii Guitar Hero controllers
  • Razor AHRS
  • FreeIMU
  • Android
  • iPhone
  • ppJoy
  • Xbox360
  • Hillcrest Labs Freespace
  • Vuzix
  • DX Joysticks
  • Razer Hydra
  • FreePIE IO
  • Carl Zeiss Cinemizer OLED
  • Yei 3 Space Trackers
  • Oculus Rift
  • vJoy
  • MS Speech
  • MIDI
  • Tobii EyeX

Version history

Changelog 1.11.724.0

  • Added support for the Wii Balanceboard
  • System tray feature use /t to minimize to tray from command line
  • Recent files menu and other smaller UI updates
  • Various stability fixes

Changelog 1.10.666.0 Biffy clyro biggest hit.

  • Added support for the Wii Classic Controller
  • Added support for the Wii Guitar Hero controllers
  • Added some interaction with the foreground window
  • Fixed Wiimote calibration for multiple wiimotes

Changelog 1.9.629.0

  • Added possibility to index joysticks on device name
  • Updated Oculus VR (SDK 0.8)
  • Added setPressed(Key key, bool state) to keyboard, mouse etc plugins.
  • Updated vJoy to latest SDK

Changelog 1.9.611.0

  • Added support for Tobii EyeX
  • Stability and performance fixes for the Android APK
  • Added ThreadYieldMicroSeconds to be able to run FreePIE in intervals below 1ms
  • Various stability fixes

Changelog 1.8.567.0

  • Fixed support for latest version of vjoy driver
  • Cosmetic fix for code completion and Windows 8

Changelog 1.8.563.0

  • Added support for MIDI devices (Read only for now)
  • Python engine update
  • Android APK rewritten as a service for a more stable experience
  • Some small fixes like removing unused update event from mouse and keyboard plugin (They wont fire)

Changelog 1.7.528.0

  • Android protocol optimized (Install new APK required)
  • Android raw data accessible to scripts
  • Razor hydra hemisphere tracking
  • Improvements to AHRS protocol, retart of script no longer required
  • Better logging while starting up script engine
  • Updated YEI API
  • Updated Oculus VR (SDK 0.4.3)
  • Improved curve editor

Changelog 1.6.512.0

  • Portable mode added, app files will be saved in program folder
  • Autorun file from cmd using /r
  • Improved editor, ctrl+F among others
  • Oculus VR DK2 support (SDK 4.2)
  • Various stability and logging fixes
  • Added new filters (scaled deadband, ensureMapRange, stopWatch)
  • Added xRotation and yRotation to JoystickPlugin

Changelog 1.5.475.0

  • Spelling filters.continousRotation > filters.continuousRotation
  • Added possibility to load scripts from command line
  • Fixed bug with iPhone
  • Added possibility to change voice with MS Speech

Changelog 1.5.459.0

  • Fixed problems with Wiimote M+ calibration
  • Added Wiimote calibration success event
  • Added Wiimote setting for M+ data fusion
  • Added mouse wheel support
  • Fixed performance issue with large script files
  • Fixed so that FreePIE always inject its own Freetrack client path in registry (Freetrack should now work even if Facetracknoir is installed)
  • MS Speech support addded
  • Headsoft vJoy replaced with Sourceforge open source vJoy
  • FreePIE should now log all managed code crashes

Changelog 1.4.433.0

  • Fixed bug with TrackIR emulation for games like Euro truck sim 2 among others
  • Oculus VR SDK updated

Changelog 1.3.422.0

  • Added support for multiple Android devices (Requires reinstall of APK)
  • Added Hydra (Sixense) SDK emulation
  • Added possibility to set thread timing, enabling the script to run at 1000hz
  • Wiimote M+ and Nunchuck support added, custom library that should work with most motes (Beta)
  • Yei plugin updated to work with Wireless devices
  • Oculus VR SDK updated, sensor prediction added in settings

Changelog 1.2.375.0

  • Fixed mouse emulation so that it works with very small movements
  • Deadband filter added that can be used to eliminate drift with the new more sensitive mouse emulation
  • Added continous rotation filter that can be used to eliminate jumps in mouse emulation when passing tracker center
  • Added support for VJoy

Changelog 1.1.362.0

  • Added support for Oculus Rift

Changelog 1.0.355.0

  • FreePIE should now work on w7 and w8 without admin rights
  • Fixed bugs with Android data contract (Requires reinstall of APK)
  • Freetrack client is no longer required to spoof Freetrack (Client dll is included with FreePIE)
  • Added a IO plugin that third party software can use to read/write from/to FreePIE
  • Added support for Carl Zeiss Cinemizer OLED
  • Added support for Yei 3 Space trackers
  • Added support for multiple XBox controllers
  • GUI performance fixes
  • Various stability fixes


  • Totaly remade GUI to use a Visual Studio like docking view
  • Added a apply button to Edit Selected Curve point for usability reasons (Curve settings)
  • Improved Watch window
  • Improved Error window, added script linenumber for error
  • Improved Console window and added a Context menu
  • Various stability fixes for code completion


  • TrackIR should now work with TrackIR fixer titles
  • Added Razer Hydra Support
  • Dataformat bug fixed for Android APK
  • Added generic button support to Mouse plugin
  • Added a stopping global that scripts can listen to for tear down tasks


  • Various stability fixes for the python engine
  • Various bug fixes for code completion
  • Added menu shortcuts


  • Changed scripting language to Python
  • Added support for TrackIR
  • Added support for Android
  • Added support for Xbox360 controller
  • Added support for DirectX joysticks and controllers


  • Added code completion (Early beta)
  • Added support for WiiMote (Only buttons)
  • Added support for Hillcrest Labs Freespace IMU
  • Added support for ppJoy Joystick emulation
  • Added proper enum support
  • Added Property support to plugins


  • Added support for iDevices via Sensor data app
  • Added support for Vuzix tracker