Skip to content

Commit 3efeb70

Browse files
committed
Added an option "Slippi Replay" to show the inputs of a player when playing back a replay file
Bump version to 1.1.0 Fixed TextEntry panel allowing some text input when disabled
1 parent c67515e commit 3efeb70

File tree

6 files changed

+155
-43
lines changed

6 files changed

+155
-43
lines changed

README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ Latest downloads can be found in [releases](https://github.com/bkacjios/m-overla
88

99
### Slippi replays
1010

11-
By default, this program will NOT work with project Slippi replays or Wii to Dolphin game mirroring, since all controller data is stripped out of memory. However, using a modified version of the program will allow it to work.
12-
13-
You can download that [here](https://github.com/bkacjios/m-overlay/releases/tag/slippi-test-v1.2)
11+
In order to view the inputs of a player when watching a slippi replay or mirring a game from a Wii, please enable "Slippi Replay" in the options menu!
1412

1513
### Usage
1614

1715
- **You can change which controller port is displayed by using the scrollwheel or pressing 1-4 on the keyboard.**
1816
- Access a settings menu by pressing the escape key
19-
- Set what port you are using on launch via commandline (--port=N or --port N)
17+
- Set what port is selected when opening with the launch command (--port=N or --port N)
2018

2119
![Port Commandline](https://i.imgur.com/f9AkS2q.png)
2220

release.iss

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[Setup]
1010
AppName=M'Overlay
1111
AppId=M'Overlay
12-
AppVersion=0.8
12+
AppVersion=1.1.0
1313
WizardStyle=modern
1414
DefaultDirName={autopf}\M'Overlay
1515
DefaultGroupName=M'Overlay

source/main.lua

+94-37
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,27 @@ function love.drawControllerOverlay()
360360

361361
local controller = watcher.controller[PORT + 1]
362362

363+
if PANEL_SETTINGS:IsSlippiReplay() then
364+
local player = watcher.player[PORT + 1]
365+
366+
if not player then return end
367+
368+
local entity
369+
370+
if player.transformed == 256 then
371+
-- If the player has the "transformed" flag set, assume they are now controlling the "partner" entity
372+
entity = player.partner
373+
else
374+
entity = player.entity
375+
end
376+
377+
controller = entity.controller
378+
end
379+
363380
if controller then
364381
-- Draw Joystick
365382

366-
if controller.plugged ~= 0x00 then
383+
if controller.plugged and controller.plugged ~= 0x00 then
367384
local sin = 128 + math.sin(love.timer.getTime()*2) * 128
368385
graphics.setColor(255, 0, 0, sin)
369386
graphics.easyDraw(DC_CON, 512-42-16, 256-42-16, 0, 42, 42)
@@ -449,50 +466,90 @@ function love.drawControllerOverlay()
449466

450467
-- Draw L
451468

452-
local al, ar = watcher.game.translateTriggers(controller.analog.l, controller.analog.r)
469+
if PANEL_SETTINGS:IsSlippiReplay() then
470+
graphics.setLineStyle("smooth")
471+
love.graphics.setLineWidth(3)
453472

454-
graphics.setLineStyle("smooth")
455-
love.graphics.setLineWidth(3)
473+
graphics.stencil(function()
474+
-- Create a rounded rectangle mask
475+
graphics.rectangle("fill", 108 + 14, 16, 100, 12, 6, 6)
476+
end, "replace", 1)
477+
graphics.setStencilTest("greater", 0) -- Only draw within our rounded rectangle mask
478+
-- Analog
456479

457-
graphics.stencil(function()
458-
-- Create a rounded rectangle mask
459-
graphics.rectangle("fill", 24 + 14, 16, 100, 12, 6, 6)
460-
end, "replace", 1)
461-
graphics.setStencilTest("greater", 0) -- Only draw within our rounded rectangle mask
462-
-- L Analog
463-
graphics.rectangle("fill", 24 + 14, 16, 88 * al, 12)
480+
local analog = controller.analog.float
464481

465-
-- L Button
466-
if bit.band(controller.buttons.pressed, BUTTONS.L) == BUTTONS.L then
467-
graphics.rectangle("fill", 24 + 14 + 88, 16, 12, 12)
468-
end
469-
graphics.setStencilTest()
482+
-- L Button
483+
if bit.band(controller.buttons.pressed, BUTTONS.L) == BUTTONS.L then
484+
graphics.rectangle("fill", 108 + 14, 16, 12, 12)
485+
analog = 1
486+
end
470487

471-
-- Draw outline
472-
graphics.rectangle("line", 24 + 14, 16, 100, 12, 6, 6)
473-
-- Draw segment for button press
474-
graphics.line(24 + 14 + 88, 16, 24 + 14 + 88, 16 + 12)
488+
-- R Button
489+
if bit.band(controller.buttons.pressed, BUTTONS.R) == BUTTONS.R then
490+
graphics.rectangle("fill", 108 + 14 + 12 + 76, 16, 12, 12)
491+
analog = 1
492+
end
475493

476-
-- Draw R
494+
local w = 76 * analog
495+
graphics.rectangle("fill", 108 + 14 + 12 + 76/2 - (w/2), 16, w, 12)
496+
graphics.setStencilTest()
497+
498+
-- Draw outline
499+
graphics.rectangle("line", 108 + 14, 16, 100, 12, 6, 6)
500+
-- Draw segment for button press
501+
graphics.line(108 + 14 + 88, 16, 108 + 14 + 88, 16 + 12)
502+
503+
-- Draw segment for button press
504+
graphics.line(108 + 14 + 12, 16, 108 + 14 + 12, 16 + 12)
505+
else
506+
local al, ar = watcher.game.translateTriggers(controller.analog.l, controller.analog.r)
507+
508+
graphics.setLineStyle("smooth")
509+
love.graphics.setLineWidth(3)
510+
511+
graphics.stencil(function()
512+
-- Create a rounded rectangle mask
513+
graphics.rectangle("fill", 24 + 14, 16, 100, 12, 6, 6)
514+
end, "replace", 1)
515+
graphics.setStencilTest("greater", 0) -- Only draw within our rounded rectangle mask
516+
-- L Button
517+
if bit.band(controller.buttons.pressed, BUTTONS.L) == BUTTONS.L then
518+
graphics.rectangle("fill", 24 + 14 + 88, 16, 12, 12)
519+
al = 1
520+
end
477521

478-
graphics.stencil(function()
479-
-- Create a rounded rectangle mask
480-
graphics.rectangle("fill", 48 + 128 + 14, 16, 100, 12, 6, 6)
481-
end, "replace", 1)
482-
graphics.setStencilTest("greater", 0) -- Only draw within our rounded rectangle mask
483-
-- R Analog
484-
graphics.rectangle("fill", 48 + 128 + 14 + 12 + (88 * (1 - ar)), 16, 88 * ar, 12)
522+
-- L Analog
523+
graphics.rectangle("fill", 24 + 14, 16, 88 * al, 12)
524+
graphics.setStencilTest()
525+
526+
-- Draw outline
527+
graphics.rectangle("line", 24 + 14, 16, 100, 12, 6, 6)
528+
-- Draw segment for button press
529+
graphics.line(24 + 14 + 88, 16, 24 + 14 + 88, 16 + 12)
530+
531+
-- Draw R
532+
533+
graphics.stencil(function()
534+
-- Create a rounded rectangle mask
535+
graphics.rectangle("fill", 48 + 128 + 14, 16, 100, 12, 6, 6)
536+
end, "replace", 1)
537+
graphics.setStencilTest("greater", 0) -- Only draw within our rounded rectangle mask
538+
-- R Button
539+
if bit.band(controller.buttons.pressed, BUTTONS.R) == BUTTONS.R then
540+
graphics.rectangle("fill", 48 + 128 + 14, 16, 12, 12)
541+
ar = 1
542+
end
485543

486-
-- R Button
487-
if bit.band(controller.buttons.pressed, BUTTONS.R) == BUTTONS.R then
488-
graphics.rectangle("fill", 48 + 128 + 14, 16, 12, 12)
489-
end
490-
graphics.setStencilTest()
544+
-- R Analog
545+
graphics.rectangle("fill", 48 + 128 + 14 + 12 + (88 * (1 - ar)), 16, 88 * ar, 12)
546+
graphics.setStencilTest()
491547

492-
-- Draw outline
493-
graphics.rectangle("line", 48 + 128 + 14, 16, 100, 12, 6, 6)
494-
-- Draw segment for button press
495-
graphics.line(48 + 128 + 14 + 12, 16, 48 + 128 + 14 + 12, 16 + 12)
548+
-- Draw outline
549+
graphics.rectangle("line", 48 + 128 + 14, 16, 100, 12, 6, 6)
550+
-- Draw segment for button press
551+
graphics.line(48 + 128 + 14 + 12, 16, 48 + 128 + 14 + 12, 16 + 12)
552+
end
496553

497554
-- Draw buttons
498555

source/modules/games/GALE01-2.lua

+45
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,51 @@ local controller_struct = {
2727
[0x41] = { type = "byte", name = "controller.%d.plugged" },
2828
}
2929

30+
local player_static_addresses = {
31+
0x80453080, -- Player 1
32+
0x80453F10, -- Player 2
33+
0x80454DA0, -- Player 3
34+
0x80455C30, -- Player 4
35+
}
36+
37+
local player_static_struct = {
38+
[0x00C] = { type = "short", name = "transformed" },
39+
}
40+
41+
for id, address in ipairs(player_static_addresses) do
42+
for offset, info in pairs(player_static_struct) do
43+
game.memorymap[address + offset] = {
44+
type = info.type,
45+
debug = info.debug,
46+
name = ("player.%i.%s"):format(id, info.name),
47+
}
48+
end
49+
end
50+
51+
local entity_pointer_offsets = {
52+
[0xB0] = "entity",
53+
[0xB4] = "partner", -- Partner entity (For sheik/zelda/iceclimbers)
54+
}
55+
56+
for id, address in ipairs(player_static_addresses) do
57+
for offset, name in pairs(entity_pointer_offsets) do
58+
game.memorymap[address + offset] = {
59+
type = "pointer",
60+
name = ("player.%i.%s"):format(id, name),
61+
debug = false,
62+
struct = {
63+
[0x60 + 0x0620] = { type = "float", name = "controller.joystick.x" },
64+
[0x60 + 0x0624] = { type = "float", name = "controller.joystick.y" },
65+
[0x60 + 0x0638] = { type = "float", name = "controller.cstick.x" },
66+
[0x60 + 0x063C] = { type = "float", name = "controller.cstick.y" },
67+
[0x60 + 0x0650] = { type = "float", name = "controller.analog.float" },
68+
[0x60 + 0x065C] = { type = "int", name = "controller.buttons.pressed" },
69+
},
70+
}
71+
end
72+
end
73+
74+
3075
game.memorymap[0x806E490A] = {
3176
type = "data",
3277
len = 31,

source/modules/gui/panels/core/settings.lua

+11-1
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ function PANEL:Initialize()
2828
self.m_pRIGHT:Dock(DOCK_RIGHT)
2929

3030
self.m_pRLABEL = self.m_pRIGHT:Add("Label")
31-
self.m_pRLABEL:SetText("Netplay")
31+
self.m_pRLABEL:SetText("Slippi")
3232
self.m_pRLABEL:SizeToText()
3333
self.m_pRLABEL:Dock(DOCK_TOP)
3434

35+
self.m_pSLIPPIREPLAY = self.m_pRIGHT:Add("Checkbox")
36+
self.m_pSLIPPIREPLAY:SetText("Slippi Replay")
37+
self.m_pSLIPPIREPLAY:Dock(DOCK_TOP)
38+
3539
self.m_pSLIPPI = self.m_pRIGHT:Add("Checkbox")
3640
self.m_pSLIPPI:SetText("Slippi Netplay")
3741
self.m_pSLIPPI:Dock(DOCK_TOP)
@@ -101,6 +105,7 @@ end
101105

102106
function PANEL:GetSaveTable()
103107
return {
108+
["slippi-replay"] = self:IsSlippiReplay(),
104109
["slippi-netplay"] = self:IsSlippiNetplay(),
105110
["slippi-auto-detect-port"] = self:IsSlippiAutoPortEnabled(),
106111
["slippi-username"] = self:GetSlippiUsername(),
@@ -111,6 +116,10 @@ function PANEL:GetSaveTable()
111116
}
112117
end
113118

119+
function PANEL:IsSlippiReplay()
120+
return self.m_pSLIPPIREPLAY:IsToggled()
121+
end
122+
114123
function PANEL:IsSlippiNetplay()
115124
return self.m_pSLIPPI:IsToggled()
116125
end
@@ -157,6 +166,7 @@ function PANEL:LoadSettings()
157166
if f then
158167
local settings = json.decode(f:read())
159168
f:close()
169+
self.m_pSLIPPIREPLAY:SetToggle(settings["slippi-replay"] or false)
160170
self.m_pSLIPPI:SetToggle(settings["slippi-netplay"] or false)
161171
self.m_pPORTTITLE:SetToggle(settings["port-in-title"] or false)
162172
self.m_pAUTOPORT:SetToggle(settings["slippi-auto-detect-port"] or false)

source/modules/gui/panels/core/textentry.lua

+2
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ function PANEL:SetText(str)
142142
end
143143

144144
function PANEL:OnTextInput(text)
145+
if not self:IsEnabled() then return end
146+
145147
for c in text:gfind("([%z\1-\127\194-\244][\128-\191]*)") do
146148
if not self.m_tCharacterSizes[c] then
147149
self.m_tCharacterSizes[c] = self.m_pFont:getWidth(c)

0 commit comments

Comments
 (0)