Skip to content

Commit

Permalink
Merge pull request #61 from EpixScripts/revision
Browse files Browse the repository at this point in the history
Add option to view strings as hex in remote spy
  • Loading branch information
Upbolt authored Mar 10, 2022
2 parents a7f1714 + 9c52de3 commit 473b1a9
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion ui/modules/RemoteSpy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ local scriptContext = ContextMenuButton.new("rbxassetid://4800244808", "Generate
local callingScriptContext = ContextMenuButton.new("rbxassetid://4800244808", "Get Calling Script")
local spyClosureContext = ContextMenuButton.new("rbxassetid://4666593447", "Spy Calling Function")
local repeatCallContext = ContextMenuButton.new("rbxassetid://4907151581", "Repeat Call")
local viewAsHexContext = ContextMenuButton.new("rbxassetid://9058292613", "Toggle String Hex View")

local removeConditionContext = ContextMenuButton.new("rbxassetid://4702831188", "Remove Condition")

Expand All @@ -117,7 +118,7 @@ local removeConditionContextSelected = ContextMenuButton.new("rbxassetid://47028

local remoteListMenu = ContextMenu.new({ pathContext, conditionContext, clearContext, ignoreContext, blockContext, removeContext })
local remoteListMenuSelected = ContextMenu.new({ pathContextSelected, clearContextSelected, ignoreContextSelected, unignoreContextSelected, blockContextSelected, unblockContextSelected, removeContextSelected })
local remoteLogsMenu = ContextMenu.new({ scriptContext, callingScriptContext, spyClosureContext, repeatCallContext })
local remoteLogsMenu = ContextMenu.new({ scriptContext, callingScriptContext, spyClosureContext, repeatCallContext, viewAsHexContext })
local remoteConditionMenu = ContextMenu.new({ removeConditionContext })
local remoteConditionMenuSelected = ContextMenu.new({ removeConditionContextSelected })

Expand Down Expand Up @@ -377,6 +378,7 @@ local function createArg(instance, index, value)
end

arg.Label.TextColor3 = oh.Constants.Syntax[valueType]
arg.Name = tostring(index)
arg.Parent = instance.Contents

return arg.AbsoluteSize.Y + 5
Expand Down Expand Up @@ -406,6 +408,7 @@ function ArgsLog.new(log, callInfo)
selected.args = callInfo.args
selected.callingScript = callInfo.script
selected.func = callInfo.func
selected.callPodButton = button
end)

button.Instance.Size = button.Instance.Size + UDim2.new(0, 0, 0, height)
Expand Down Expand Up @@ -928,6 +931,29 @@ repeatCallContext:SetCallback(function()
oh.setStatus(oldStatus)
end)

viewAsHexContext:SetCallback(function()
selected.callPodButton.hexViewEnabled = not selected.callPodButton.hexViewEnabled
if not selected.callPodButton.oldStrings then
selected.callPodButton.oldStrings = {}
end

for idx, arg in pairs(selected.args) do
if type(arg) == "string" then
local textObject = selected.callPodButton.Instance.Contents[tostring(idx)].Label
if selected.callPodButton.hexViewEnabled then
selected.callPodButton.oldStrings[idx] = arg
local hexString = ""
for i = 1, #arg do
hexString = hexString .. string.format("%02X ", arg:byte(i, i))
end
textObject.Text = hexString
else
textObject.Text = dataToString(selected.callPodButton.oldStrings[idx])
end
end
end
end)

removeConditionContext:SetCallback(function()
selected.condition:Remove()
selected.condition = nil
Expand Down

0 comments on commit 473b1a9

Please sign in to comment.