Ouya Controller doesn't fully work

Issue #12 resolved
Landon “Karai” Manning created an issue

The directional pad seems to work, but other buttons do not. Probably an SDL issue.

Comments (21)

  1. Landon “Karai” Manning reporter
    function love.joystickpressed(joystick, button)
      love.graphics.print(joystick .. " - " .. button, 100, 100)
      print(joystick, button)
    end
    

    This should print out every recognized button on any controller. If a button does not print anything, love/SDL is not registering said button.

  2. Colby Klein

    I wasn't getting anything with my Ouya controllers in my testing, googling showed that SDL2 has had some work on controllers (among other things) in Android post-2.0.1 (in HG tip) so this just might be resolvable by bumping the SDL version.

  3. Colby Klein

    Controllers are working great now! The only issue I've found so far is that the Ouya system button doesn't respond (and it should - it's usually used for pause).

  4. Landon “Karai” Manning reporter

    perhaps it is registering as a hat instead of a button, or some other wonky issue?

  5. Carlo Cabanilla

    The ouya controller wasn't working for me as a gamepad until I manually mapped the buttons:

    gamepads = {
        -- ouya controller
        ["4f5559412047616d6520436f6e74726f"] = {
            {"a", "button", 6},
            {"b", "button", 7},
            {"x", "button", 9},
            {"y", "button", 10},
            {"leftstick", "button", 16},
            {"rightstick", "button", 17},
            {"leftshoulder", "button", 12},
            {"rightshoulder", "button", 13},
            {"dpup", "button", 1},
            {"dpdown", "button", 2},
            {"dpleft", "button", 3},
            {"dpright", "button", 4},
            {"leftx", "axis", 1},
            {"lefty", "axis", 2},
            {"rightx", "axis", 4},
            {"righty", "axis", 5},
            {"triggerleft", "axis", 3},
            {"triggerright", "axis", 6},
        }
    }
    
     for guid, mappings in pairs(gamepads) do
        for i, mapping in pairs(mappings) do
            love.joystick.setGamepadMapping(guid, unpack(mapping))
        end
    end
    
  6. Pavol Rusnak

    I used code from previous comment to create a config for Moga Pro controller.

    gamepads = {
        -- moga pro controller
        ["42726f6164636f6d20426c7565746f6f"] = {
            {"a", "button", 6},
            {"b", "button", 7},
            {"x", "button", 9},
            {"y", "button", 10},
            {"leftshoulder", "button", 12},
            {"rightshoulder", "button", 13},
            {"start", "button", 18},
            {"leftx", "axis", 1},
            {"lefty", "axis", 2},
            {"rightx", "axis", 3},
            {"righty", "axis", 4},
            {"triggerright", "axis", 5},
            {"triggerleft", "axis", 6},
            {"dpx", "axis", 7},
            {"dpy", "axis", 8},
    
        }
    }
    

    Digital Pad behaves like two axis 7 & 8, with values -1,0,1. Not sure what the naming conventions for such setup are.

    Feel free to adapt and push to SDL_gamecontrollerdb.h in SDL2.

  7. Alex Szpakowski

    For l1/r1 and l2/r2 did you mean to do leftshoulder/rightshoulder and triggerleft/triggerright ?

    Feel free to adapt and push to SDL_gamecontrollerdb.h in SDL2.

    Also keep in mind if doing this that you'll have to account for button/axis/hat indices starting from 1 in LÖVE's API, and from 0 in SDL's (i.e. you'll need to put button 5 instead of button 6 for the 'a' button in the string used by SDL.)

  8. Pavol Rusnak

    Alex: Right, you are correct. I fixed the snippet. What about digital pad naming? Is dpx/dpy OK? I could not find an example where digital pad is represented as two axis. All I found were four buttons.

  9. Jairo Luiz

    I just test. The OUYA menu button is mapped to a key named menu. You can access this key with love.keypressed and love.keyreleased callbacks.

  10. Landon “Karai” Manning reporter

    Let's all take a moment to reflect on the thought that someone at OUYA deliberately made the menu button on the controller register as a global key press, instead of a joystick-specific button press. This was a design decision.

    -- imnotsorry.lua
    function love.keypressed(key, isrepeat)
        if key == "menu" then
            love.joystickpressed(1, key)
        end
    end
    
    function love.joystickpressed(joystick, button)
        if button == "menu" then
            -- OUYAAAAAAAAAAAAAAAAAAAAAAAAAAA
        end
    end
    
  11. Carlo Cabanilla

    Oh weird, glad you figured that out. So that means we won't be able to tell which joystick actually pressed the menu button huh.

    @Landon “Karai” Manning: that'll only work work in love 0.8 since 0.9 passes in joystick objects instead of joystick numbers. You'll probably wanna do

    function love.keypressed(key, isrepeat)
        if key == "menu" then
            love.joystickpressed(love.joystick.getJoysticks()[1], key)
        end
    end
    
  12. Martin Felis repo owner

    So I guess the Ouya controller then works (somewhat mind-boggling), right? At least it does not seem to be an issue of the port, rather of SDL or the controller itself.

    Feel free to re-open if I did not read correctly or you do not agree.

  13. Log in to comment