Do you use the Wiimote on your PC, yet?

Discussion in 'Wii - Hacking' started by OrR, Jan 5, 2007.

Jan 5, 2007
  1. OrR
    OP

    Member OrR Rice-megatron Expert

    Joined:
    Nov 24, 2005
    Messages:
    1,562
    Location:
    Hildesheim/Germany
    Country:
    Germany
    This is so awesome... I just played some Half Life 2 and it works perfectly! [​IMG]
    Here is the easy to modify GlovePIE script I use for pretty much everything. It's got IR pointing (use candles!) and arrow keys mapped to the Nunchuck analog, B and A as left and right mouse buttons as well as every other Wiimote and Nunchuck button mapped to a random keyboard key.
    I could use a nunchuck-shake to button skript as well as other motion scripts. Do you have some?
    CODE//Mouse Control Script using IR
    //by vkapadia with much assistance from inio
    //vkapadia@vkapadia.com
    //
    //Calibration:
    //To calibrate, run this program and put the Wiimote on a flat surface face-up.
    //Then read the values in the debug line (next to the run button).
    //Change these values until the debug line reads approx. all zeros.
    var.xtrim = 6
    var.ytrim = -31
    var.ztrim = 6
    //
    //Options:
    var.deadzone = 5 //distance in pixels that you have to move the wiimote in
    Â //order for it to register movement. Creates a "dead zone" around the pointer
    Â //to make it easier to click. Higher = smoother but less accurate.
    var.KITTspeed = 100 ms //delay speed for flashing LEDs. higher = slower
    var.rumble = false //makes the wiimote rumble if you hit the edge of the screen
    //more options to be added later

    //Controls:
    //Point Wiimote = Move Mouse
    //D-Pad = Arrow Keys
    //B-Button = Left Click
    //Home = Middle Click
    //A-Button = Right Click
    //Plus and Minus = Control Volume
    //One = Unmapped
    //Two = Unmapped
    //
    //If the pointer hits the edge of the screen, the Wiimote will rumble a bit.
    //
    //The LEDs attempt to emulate KITT's grill from Knight Rider

    //***Do not edit anything below this line unless you know what you are doing.***

    //Mouse Buttons
    Mouse.RightButton = Wiimote.A
    Mouse.LeftButton = Wiimote.B
    Mouse.MiddleButton = Wiimote.Home

    // analog = movement
    Up = Wiimote.Nunchuk.JoyY < -0.2
    Down = Wiimote.Nunchuk.JoyY > 0.2
    Left = Wiimote.Nunchuk.JoyX < -0.2
    Right = Wiimote.Nunchuk.JoyX > 0.2

    //wiimote One and Two
    e = Wiimote.One
    r = Wiimote.Two
    //Plus and Minus
    t = Wiimote.Plus
    z = Wiimote.Minus
    //Nunchuck Buttons
    u = Wiimote.Nunchuk.CButton
    i = Wiimote.Nunchuk.ZButton
    //Wiimote D-Pad
    w = Wiimote.Up
    s = Wiimote.Down
    a = Wiimote.Left
    d = Wiimote.Right

    //LEDs look somewhat like KITT's grill from Knight Rider
    if 0 = 0 then
    Âif var.kitt = 0 then
    Â Âwiimote.Leds = 1
    Âendif
    Âif var.kitt = 1 then
    Â Âwiimote.Leds = 3
    Âendif
    Âif var.kitt = 2 then
    Â Âwiimote.Leds = 6
    Âendif
    Âif var.kitt = 3 then
    Â Âwiimote.Leds = 12
    Âendif
    Âif var.kitt = 4 then
    Â Âwiimote.Leds = 8
    Âendif
    Âif var.kitt = 5 then
    Â Âwiimote.Leds = 12
    Âendif
    Âif var.kitt = 6 then
    Â Âwiimote.Leds = 6
    Âendif
    Âif var.kitt = 7 then
    Â Âwiimote.Leds = 3
    Âendif
    Âwait var.KITTspeed
    Âvar.kitt = (var.kitt + 1) % 8
    endif

    //If the mouse reaches the end, rumble for 200 milliseconds
    if var.rumble and (mouse.x = 0 or mouse.x = 1 or mouse.y = 0 or mouse.y = 1) then
    Âif var.rmbl = false
    Â Âwiimote.Rumble = 1
    Â Âwait 200 ms
    Â Âwiimote.Rumble = 0
    Âendif
    Âvar.rmbl = true
    else
    Âvar.rmbl = false
    endif

    var.accx = wiimote.RawForceX + var.xtrim
    var.accy = wiimote.RawForceY + var.ytrim
    var.accz = wiimote.RawForceZ + var.ztrim

    if wiimote.dot1vis and wiimote.dot2vis then

    Âif var.accy > -7 then
    Â Âvar.orientation = 0
    Âelseif var.accy > -45 then
    Â Âif var.accx < 0 then
    Â Â Âvar.orientation = 3
    Â Âelse
    Â Â Âvar.orientation = 1
    Â Âendif
    Âelse
    Â Âvar.orientation = 2
    Âendif

    Âif var.leftpoint = 0 then
    Â Âif var.orientation = 0 then
    Â Â Âif wiimote.dot1x < wiimote.dot2x then
    Â Â Â Âvar.leftpoint = 1
    Â Â Âelse
    Â Â Â Âvar.leftpoint = 2
    Â Â Âendif
    Â Âendif
    Â Âif var.orientation = 1 then
    Â Â Âif wiimote.dot1y > wiimote.dot2y then
    Â Â Â Âvar.leftpoint = 1
    Â Â Âelse
    Â Â Â Âvar.leftpoint = 2
    Â Â Âendif
    Â Âendif
    Â Âif var.orientation = 2 then
    Â Â Âif wiimote.dot1x > wiimote.dot2x then
    Â Â Â Âvar.leftpoint = 1
    Â Â Âelse
    Â Â Â Âvar.leftpoint = 2
    Â Â Âendif
    Â Âendif
    Â Âif var.orientation = 3 then
    Â Â Âif wiimote.dot1y < wiimote.dot2y then
    Â Â Â Âvar.leftpoint = 1
    Â Â Âelse
    Â Â Â Âvar.leftpoint = 2
    Â Â Âendif
    Â Âendif
    Âendif

    Âif var.leftpoint = 1 then
    Â Âvar.fix1x = wiimote.dot1x
    Â Âvar.fix1y = wiimote.dot1y
    Â Âvar.fix2x = wiimote.dot2x
    Â Âvar.fix2y = wiimote.dot2y
    Âelse
    Â Âvar.fix1x = wiimote.dot2x
    Â Âvar.fix1y = wiimote.dot2y
    Â Âvar.fix2x = wiimote.dot1x
    Â Âvar.fix2y = wiimote.dot1y
    Âendif

    Âvar.dx = var.fix2x - var.fix1x
    Âvar.dy = var.fix2y - var.fix1y
    Âvar.cx = (var.fix1x+var.fix2x)/1024.0 - 1
    Âvar.cy = (var.fix1y+var.fix2y)/1024.0 - .75

    Âvar.d = sqrt(var.dx*var.dx+var.dy*var.dy)

    Âvar.dx = var.dx / var.d
    Âvar.dy = var.dy / var.d

    Âvar.ox = -var.dy*var.cy-var.dx*var.cx;
    Âvar.oy = -var.dx*var.cy+var.dy*var.cx;

    Âvar.ax = (var.ox * screen.desktopwidth) + (screen.desktopwidth / 2)
    Âvar.ay = (-var.oy * screen.desktopwidth) + (screen.desktopheight / 2)




    Âvar.dx = var.ax - mouse.cursorposx
    Âvar.dy = var.ay - mouse.cursorposy

    Âvar.d = sqrt((var.dx*var.dx)+(var.dy*var.dy))

    Âvar.a = 180 / (200 + var.d * var.d * var.d * .001)

    Âif var.d
     


  2. Gangsta_L

    Newcomer Gangsta_L Member

    Joined:
    Nov 16, 2006
    Messages:
    43
    Country:
    Netherlands
    ... I wanna borrow the Bluetooth USB Adapter from my brother but he can't find it [​IMG]
     
  3. Opium

    Former Staff Opium PogoShell it to me ™

    Joined:
    Dec 22, 2002
    Messages:
    8,185
    Location:
    Australia
    Country:
    Australia
    I used my bluetooth adapter, my computer found the wiimote but GlovePIE did not [​IMG]
     
  4. Shinji

    Member Shinji ҉҉ ҉҉

    Joined:
    Nov 6, 2002
    Messages:
    2,374
    Location:
    City of Delusion
    Country:
    United States
    Oh GlovePIE, ive had so many problems with that. I went through 3 different stacks then finally went back to my original BlueSoleil settings and it works for the most part...
     
  5. sun

    Newcomer sun Newbie

    Joined:
    Jan 1, 2007
    Messages:
    8
    Country:
    on wiili.org you can find all about wiimote hacking and sure if you have scripting skills you can do pretty much everything.

    i'd like to controll my mouse with wiimote and right and left click with A B..
    with an exe application that when started change mouse controll to wiimote
    someone can do this simple script and post here?

    thanks
     
  6. laserclod

    Newcomer laserclod Newbie

    Joined:
    Dec 13, 2006
    Messages:
    7
    Country:
    All the scripts you wants exists in the Wiimotescripts directory of glovepie... inclusive wiimouse IR.pie.
     
  7. Elrinth

    Member Elrinth :Master beyond your imagination:

    Joined:
    Nov 6, 2002
    Messages:
    2,795
    Location:
    Home @ UMEÅ
    Country:
    Sweden
    i'm going to try it this night for world of warcraft [​IMG]
    tho I'm not sure what I'm going to use as IR... [​IMG]
    Do I really dare bringing small candle thingies to school? guess I'm going to have to bring my wii [​IMG]
     
  8. Hitto

    Member Hitto MKDS Tournament Winner

    Joined:
    Nov 29, 2005
    Messages:
    1,450
    Location:
    Nice, France
    Country:
    France
    Thanks for sharing, dude! I didn't know they got the onscreen pointer thingy working out!

    I'm getting a bluetooth adapter this afternoon, gonna see if it works!
     
  9. OrR
    OP

    Member OrR Rice-megatron Expert

    Joined:
    Nov 24, 2005
    Messages:
    1,562
    Location:
    Hildesheim/Germany
    Country:
    Germany
    I never had any problems once I finally understood how to connect my Wiimote with BlueSolei...
     
  10. Hitto

    Member Hitto MKDS Tournament Winner

    Joined:
    Nov 29, 2005
    Messages:
    1,450
    Location:
    Nice, France
    Country:
    France
    I dunno, I tried (not for long, though), and even though the wiimote was correctly "detected" by wiinremote, mii megamall and glovepie, it didn't detect any input at all... And I tried pressing 1 and 2 several times whenever some faq said you have to, but it didn't change a thing... Do you need to keep pressing them, or does it need to be only twice?

    What's the best driver for this to work? Didn't get any noticeable results with the vanilla microsoft stack or the toshiba stack provided with my connectland bluetooth key.
     
  11. OrR
    OP

    Member OrR Rice-megatron Expert

    Joined:
    Nov 24, 2005
    Messages:
    1,562
    Location:
    Hildesheim/Germany
    Country:
    Germany
    I think the Wiili Wiki recommends the BlueSolei drivers. Luckily they came with my stick but they should be available for download somewhere.
    You only have to press 1&2 until your Wiimote is connected to your PC...
     
  12. taubstumm

    Newcomer taubstumm Advanced Member

    Joined:
    Mar 27, 2003
    Messages:
    50
    Country:
    Germany
    Here is a script I made. You can add anywhere at bottoms of other sctips to display Wiimote battery status with the leds.


    CODEvar.bat = Wiimote.Battery
    var.leds = 4




    Âif var.bat < 0.25 then
    Â Âvar.leds = 1

    Âelseif var.bat > 0.25 then
    Â Âif var.bat < 0.5 then
    Â Â Âvar.leds = 2
    Â Â Âelseif Âvar.bat > 0.5 then
    Â Â Â Âif var.bat > 0.75 then
    Â Â Â Â Â var.leds = 3
    Â Â Â Âelse var.leds = 4
    Â Â Âendif
    Â Âelse var.leds = 4
    Â Âendif

    endif
    endif

    if var.leds = 4 then
    Wiimote.Led1 = true
    Wiimote.Led2 = true
    Wiimote.Led3 = true
    Wiimote.Led4 = true
    endif

    if var.leds = 3 then
    Wiimote.Led1 = true
    Wiimote.Led2 = true
    Wiimote.Led3 = true
    Wiimote.Led4 = false
    endif

    if var.leds = 2 then
    Wiimote.Led1 = true
    Wiimote.Led2 = true
    Wiimote.Led3 = false
    Wiimote.Led4 = false
    endif

    if var.leds = 1 then
    Wiimote.Led1 = true
    Wiimote.Led2 = false
    Wiimote.Led3 = false
    Wiimote.Led4 = false
    endif
     
  13. king_j1984

    Newcomer king_j1984 Member

    Joined:
    Mar 14, 2006
    Messages:
    25
    Country:
    United Kingdom
    i only use my wiimote to trade miis over the internet, i don't understand how to get anything else to work!!!
     
  14. Gangsta_L

    Newcomer Gangsta_L Member

    Joined:
    Nov 16, 2006
    Messages:
    43
    Country:
    Netherlands
    who can help me? I have set up a bluetooth adapter (Widdcom) and it finds the Wiimote, I have connected it but the PC only sends data to the Wiimote (which leds have to go on, or rumble) but doesn't receive like tilting the Wiimote, button presses etc :S
     
  15. OrR
    OP

    Member OrR Rice-megatron Expert

    Joined:
    Nov 24, 2005
    Messages:
    1,562
    Location:
    Hildesheim/Germany
    Country:
    Germany
    Do you use GlovePIE? Did you start a script? Which one? Have you made sure to provide infrared sources if you are using IR pointing?
     
  16. Hitto

    Member Hitto MKDS Tournament Winner

    Joined:
    Nov 29, 2005
    Messages:
    1,450
    Location:
    Nice, France
    Country:
    France
    Turns out I didn't need to install the bluesoleil drivers, the toshiba ones worked fine!
    I just... Needed to reboot. I was so proud of my fucklong uptime, that it blinded me to the simplest truth : fuck windows.

    (god, I feel stupid)
     
  17. MaHe

    Member MaHe one lazy schmo

    Joined:
    Aug 4, 2006
    Messages:
    1,101
    Location:
    Maribor
    Country:
    Slovenia
    Yup, I tried connecting the Wiimote to my father's laptop. Works perfectly, though I haven't tried GlovePIE yet, Wiinmote is okay for everything that doesn't require a nunchuck.
     
  18. directive0

    Member directive0 GBAtemp Regular

    Joined:
    Aug 15, 2006
    Messages:
    285
    Location:
    Toronto, Ont.
    Country:
    Canada
    I've been using mine to play old nes games on my macbook. Pretty rad that I know have a 2 in 1 controller for both my console and my computer.
     
  19. OrR
    OP

    Member OrR Rice-megatron Expert

    Joined:
    Nov 24, 2005
    Messages:
    1,562
    Location:
    Hildesheim/Germany
    Country:
    Germany
    Yeah, first I thought making the Xbox 360 controller available for Windows was a good idea but this is so much better. [​IMG]
    Did anyone connect it to their Playstation 3 Linux, yet? [​IMG]
     
  20. Hitto

    Member Hitto MKDS Tournament Winner

    Joined:
    Nov 29, 2005
    Messages:
    1,450
    Location:
    Nice, France
    Country:
    France
    That last post has "OH SNAP" written all over it [​IMG]
     

Share This Page