Dolphin, the GameCube and Wii emulator - Forums
FreePIE - Printable Version

+- Dolphin, the GameCube and Wii emulator - Forums (https://forums.dolphin-emu.org)
+-- Forum: Dolphin Emulator Discussion and Support (https://forums.dolphin-emu.org/Forum-dolphin-emulator-discussion-and-support)
+--- Forum: Controllers (https://forums.dolphin-emu.org/Forum-controllers)
+--- Thread: FreePIE (/Thread-freepie)



FreePIE - clairane - 12-14-2015

I'm using FreePIE as an alternative GlovePIE for my Wiimote+Nunchuck everything works fine with the following script but the analog stick is being treated like rapid fire instead of single touches, in notepad it shows up as

IIIIIIIIIIIIIIIIJJJJJJJJJJJJJJJJJJJJJJJJJJKKKKKKKKKKKKKKKKKKKKLLLLLLLLLLLLLLLLLLLL instead of just IJKL.

Any help guys do i need to add anything extra like deadzones or timing interval?

Code:
def analogStick():
   if wiimote[0].nunchuck.stick.y > 40:
      keyboard.setPressed(Key.I)
   if wiimote[0].nunchuck.stick.y < -40:
      keyboard.setPressed(Key.K)
   if wiimote[0].nunchuck.stick.x > 40:
      keyboard.setPressed(Key.L)
   if wiimote[0].nunchuck.stick.x < -40:
      keyboard.setPressed(Key.J)

def map_wiimote_to_key(wiimote_index, wiimote_button, key):
    # Check the global wiimote object's button state and set the global
    # keyboard object's corresponding key.
    if wiimote[wiimote_index].buttons.button_down(wiimote_button):
        keyboard.setKeyDown(key)
    else:
        keyboard.setKeyUp(key)
        
def map_nunchuck_to_key(wiimote_index, wiimote_button, key):
    # Check the global nunchuck object's button state and set the global
    # keyboard object's corresponding key.
    if wiimote[wiimote_index].nunchuck.buttons.button_down(wiimote_button):
        keyboard.setKeyDown(key)
    else:
        keyboard.setKeyUp(key)
        
def update():
    # Sideways controls (DPad). Map each of our desired keys.
    map_wiimote_to_key(0, WiimoteButtons.DPadRight, Key.D)
    map_wiimote_to_key(0, WiimoteButtons.DPadLeft, Key.A)
    map_wiimote_to_key(0, WiimoteButtons.DPadUp, Key.W)
    map_wiimote_to_key(0, WiimoteButtons.DPadDown, Key.S)
    
    # 1 button --> 1 key
    map_wiimote_to_key(0, WiimoteButtons.One, Key.D1)
    # 2 button --> 2 key
    map_wiimote_to_key(0, WiimoteButtons.Two, Key.D2)
    
    # - button --> - key
    map_wiimote_to_key(0, WiimoteButtons.Minus, Key.Minus)
    # + button --> + key
    map_wiimote_to_key(0, WiimoteButtons.Plus, Key.NumberPadPlus)
    
    # A button --> X key
    map_wiimote_to_key(0, WiimoteButtons.A, Key.X)
    # B button --> B key
    map_wiimote_to_key(0, WiimoteButtons.B, Key.B)
    
    # Home button --> Return key
    map_wiimote_to_key(0, WiimoteButtons.Home, Key.Return)
    
    #nunchuck
    map_nunchuck_to_key(0, NunchuckButtons.C, Key.C)
    map_nunchuck_to_key(0, NunchuckButtons.Z, Key.Z)
    
# If we're starting up, then hook up our update function.
if starting:
    global previous
    previous = False
    wiimote[0].nunchuck.update += analogStick
    wiimote[0].buttons.update += update