@@ -18,7 +18,11 @@ local DEBUG_FONT = graphics.newFont("fonts/melee-bold.otf", 12)
18
18
19
19
local PANEL_SETTINGS
20
20
21
- function love .load ()
21
+ local MAX_PORTS = 4
22
+ local PORT = 0
23
+ local CONTROLLER_PORT_DISPLAY = 0
24
+
25
+ function love .load (args , unfilteredArg )
22
26
if watcher .hasPermissions () then
23
27
love .window .setTitle (" M'Overlay - Waiting for Dolphin..." )
24
28
else
@@ -31,6 +35,22 @@ function love.load()
31
35
PANEL_SETTINGS = gui .create (" Settings" )
32
36
PANEL_SETTINGS :LoadSettings ()
33
37
PANEL_SETTINGS :SetVisible (false )
38
+
39
+ -- Loop through all the commandline arguments
40
+ for n , arg in pairs (args ) do
41
+ -- Check for '--port=N' first..
42
+ local portn = tonumber (string.match (arg , " %-%-port=(%d+)" ))
43
+
44
+ if arg == " --port" then -- Alternative '--port N'
45
+ portn = tonumber (args [n + 1 ]) -- Convert the next argument in the commandline to a number
46
+ end
47
+
48
+ if portn then -- A port number was specified..
49
+ PORT = (portn - 1 ) % MAX_PORTS -- Clamp the number between 0-3
50
+ CONTROLLER_PORT_DISPLAY = love .timer .getTime () + 3 -- Show the port display number for 3 seconds
51
+ break -- Done
52
+ end
53
+ end
34
54
end
35
55
36
56
function love .update (dt )
@@ -62,10 +82,6 @@ function love.joystickreleased(joy, but)
62
82
gui .joyReleased (joy , but )
63
83
end
64
84
65
- local MAX_PORTS = 4
66
- local PORT = 0
67
- local CONTROLLER_PORT_DISPLAY = 0
68
-
69
85
function love .keypressed (key , scancode , isrepeat )
70
86
if key == " escape" and not isrepeat then
71
87
PANEL_SETTINGS :Toggle ()
0 commit comments