Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/various gamepad issues #243

Merged
merged 3 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions source/modules/love/scripts/callbacks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,16 @@ function love.createhandlers()
return love.gamepadaxis(joystick, axis, value)
end
end,
-- joystickadded = function(joystick)
-- if love.joystickadded then
-- return love.joystickadded(joystick)
-- end
-- end,
-- joystickremoved = function(joystick)
-- if love.joystickremoved then
-- return love.joystickremoved(joystick)
-- end
-- end,
joystickadded = function(joystick)
if love.joystickadded then
return love.joystickadded(joystick)
end
end,
joystickremoved = function(joystick)
if love.joystickremoved then
return love.joystickremoved(joystick)
end
end,
focus = function(focused)
if love.focus then
return love.focus(focused)
Expand Down Expand Up @@ -227,6 +227,12 @@ function love.run()
love.load(love.parsedGameArguments, love.rawGameArguments)
end

-- https://love2d.org/wiki/love.joystickadded
-- This callback is also triggered after love.load for every Joystick which was already connected when the game started up.
for _, j in ipairs(love.joystick.getJoysticks()) do
love.handlers.joystickadded(j)
end

if love.timer then
love.timer.step()
end
Expand Down
2 changes: 1 addition & 1 deletion source/utilities/guid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static constexpr love::guid::GamepadInfo gamepadInfo[] =
{ 12, 8, 0, "Nintendo 3DS", "{B58A259A-13AA-46E0-BDCB-31898EDAB24E}", false, false }, // GAMEPAD_TYPE_NINTENDO_3DS
{ 12, 12, 0, "New Nintendo 3DS", "{7BC9702D-7D81-4EBB-AD4F-8C94076588D5}", true, true }, // GAMEPAD_TYPE_NEW_NINTENDO_3DS
{ 14, 6, 0, "Nintendo Switch", "{6EBE242C-820F-46E1-9A66-DC8200686D51}", true, true }, // GAMEPAD_TYPE_NINTENDO_SWITCH_HANDHELD
{ 14, 6, 0, "Nintendo Switch Pro Controller", "{42ECF5C5-AFA5-4EDE-B1A2-4E9C2287559A}", true, false }, // GAMEPAD_TYPE_NINTENDO_SWITCH_PRO
{ 14, 6, 0, "Nintendo Switch Pro Controller", "{42ECF5C5-AFA5-4EDE-B1A2-4E9C2287559A}", true, true }, // GAMEPAD_TYPE_NINTENDO_SWITCH_PRO
{ 7, 12, 0, "Joy-Con L", "{660EBC7E-3953-4B74-8406-AD5992FCC5C7}", true, false }, // GAMEPAD_TYPE_JOYCON_LEFT
{ 7, 12, 0, "Joy-Con R", "{AD770831-A7E4-41A8-8DD0-FD48323E0043}", false, true }, // GAMEPAD_TYPE_JOYCON_RIGHT
{ 14, 18, 0, "Joy-Con Pair", "{701B198B-9AD9-4730-8EEB-EBECF707B9DF}", true, true }, // GAMEPAD_TYPE_JOYCON_PAIR
Expand Down
Loading