mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-20 12:40:21 +02:00
feat(launcher): add bug tab and native device reporting
This commit is contained in:
@@ -875,6 +875,35 @@ local function drawSyncGlyph(x, y, w, h, hot)
|
||||
byy + head)
|
||||
love.graphics.pop()
|
||||
end
|
||||
|
||||
local function drawBugGlyph(x, y, w, h, hot)
|
||||
local box = math.min(w, h)
|
||||
local bx = x + (w - box) / 2
|
||||
local by = y + (h - box) / 2
|
||||
local ink = hot and PAL.inverse or PAL.ink
|
||||
local bodyW = box * 0.28
|
||||
local bodyH = box * 0.46
|
||||
local bodyX = bx + (box - bodyW) / 2
|
||||
local bodyY = by + box * 0.30
|
||||
local radius = math.max(1, box * 0.12)
|
||||
Theme.fillRounded(bodyX, bodyY, bodyW, bodyH, ink, 1, radius)
|
||||
Theme.fillRounded(bx + box * 0.38, by + box * 0.17,
|
||||
box * 0.24, box * 0.24, ink, 1, box * 0.12)
|
||||
love.graphics.push("all")
|
||||
love.graphics.setColor(ink)
|
||||
love.graphics.setLineWidth(math.max(1, box * 0.07))
|
||||
love.graphics.setLineJoin("bevel")
|
||||
for _, offset in ipairs({ 0.35, 0.50, 0.65 }) do
|
||||
love.graphics.line(bodyX, by + box * offset,
|
||||
bx + box * 0.12, by + box * (offset - 0.07))
|
||||
love.graphics.line(bodyX + bodyW, by + box * offset,
|
||||
bx + box * 0.88, by + box * (offset - 0.07))
|
||||
end
|
||||
love.graphics.line(bx + box * 0.44, by + box * 0.18,
|
||||
bx + box * 0.30, by + box * 0.08)
|
||||
love.graphics.line(bx + box * 0.56, by + box * 0.18,
|
||||
bx + box * 0.70, by + box * 0.08)
|
||||
love.graphics.pop()
|
||||
end
|
||||
|
||||
local function drawCross(x, y, size, color)
|
||||
@@ -926,10 +955,13 @@ local HEADER_TABS = {
|
||||
{ id = "mods", key = "tab-mods" },
|
||||
{ id = "find", key = "tab-find" },
|
||||
{ id = "skins", key = "tab-skins", glyph = true },
|
||||
{ id = "bug", key = "tab-bug", glyph = true },
|
||||
}
|
||||
for _, t in ipairs(HEADER_TABS) do
|
||||
t.opts = { face = "tab", font = "tab", color = t.color, letter = t.letter }
|
||||
if t.glyph then t.opts.drawFn = drawSkinGlyph end
|
||||
if t.glyph then
|
||||
t.opts.drawFn = t.id == "bug" and drawBugGlyph or drawSkinGlyph
|
||||
end
|
||||
end
|
||||
|
||||
-- Which cartridge the dropdown is showing: the open game tab, else the last
|
||||
@@ -1923,7 +1955,7 @@ local function buildModsPanel(imp, x, y, w, availH, m)
|
||||
-- notice line
|
||||
local noticeText, noticeCol
|
||||
if safeMode then
|
||||
noticeText, noticeCol = "Safe mode is on. All mods are disabled. Turn it off in Settings to change mod toggles.", PAL.yellow
|
||||
noticeText, noticeCol = "Safe mode is on. All mods are disabled. Turn it off in the Bug tab to change mod toggles.", PAL.yellow
|
||||
elseif imp.modNotice then
|
||||
noticeText = imp.modNotice.text
|
||||
noticeCol = imp.modNotice.ok and PAL.green or PAL.red
|
||||
@@ -2322,6 +2354,69 @@ local function buildSkinsPanel(imp, x, y, w, availH, m)
|
||||
return cy + hintH - y
|
||||
end
|
||||
|
||||
local function buildBugPanel(imp, x, y, w, availH, m)
|
||||
local SaveData = require("src.core.SaveData")
|
||||
local gap = m.gap
|
||||
local pad = math.floor(16 * m.s)
|
||||
local cy = y
|
||||
local safeMode = imp:_safeModeEnabled()
|
||||
|
||||
Kit.text("button", Strings("Bug reports"), x, cy, PAL.heading)
|
||||
cy = cy + Kit.textHeight("button") + gap
|
||||
|
||||
if imp.issueNotice then
|
||||
cy = cy + Kit.textWrapped("small", imp.issueNotice.text, x, cy, w,
|
||||
imp.issueNotice.ok and PAL.green or PAL.red, 2) + gap
|
||||
end
|
||||
|
||||
local switchW = math.floor(92 * m.s)
|
||||
local switchH = math.max(m.btnH, Kit.tapMin())
|
||||
local detail = safeMode
|
||||
and Strings("All mods are disabled and their toggles are locked until safe mode is turned off.")
|
||||
or Strings("Temporarily disable every mod while you reproduce a bug.")
|
||||
local textW = math.max(0, w - 2 * pad - switchW - gap)
|
||||
local detailH = Kit.wrapHeight("small", detail, textW, 3)
|
||||
local safeH = math.max(switchH, Kit.textHeight("small") + math.floor(4 * m.s) + detailH)
|
||||
+ 2 * pad
|
||||
Kit.card(x, cy, w, safeH)
|
||||
local textX = x + pad
|
||||
local textY = cy + pad
|
||||
Kit.text("small", Strings("Safe mode"), textX, textY, PAL.heading)
|
||||
Kit.textWrapped("small", detail, textX,
|
||||
textY + Kit.textHeight("small") + math.floor(4 * m.s), textW,
|
||||
PAL.muted, 3)
|
||||
local toggleX = x + w - pad - switchW
|
||||
local toggleY = cy + math.floor((safeH - switchH) / 2)
|
||||
local _, changed = Kit.toggle(toggleX, toggleY, switchW, switchH, safeMode,
|
||||
"bug-safe-mode")
|
||||
if changed then
|
||||
queueAction(imp, "bug-safe-mode", function() imp:_toggleSafeMode() end)
|
||||
end
|
||||
cy = cy + safeH + gap
|
||||
|
||||
local reportLabel = Strings("Report a bug")
|
||||
local reportW = math.min(w - 2 * pad,
|
||||
Kit.textWidth("small", reportLabel) + math.floor(32 * m.s))
|
||||
local reportDetail = Strings("Open GitHub with the bug form and the available system information filled in.")
|
||||
local reportTextW = math.max(0, w - 2 * pad - reportW - gap)
|
||||
local reportDetailH = Kit.wrapHeight("small", reportDetail, reportTextW, 3)
|
||||
local reportH = math.max(m.btnH, Kit.textHeight("small") + math.floor(4 * m.s) + reportDetailH)
|
||||
+ 2 * pad
|
||||
Kit.card(x, cy, w, reportH)
|
||||
Kit.text("small", Strings("Report an issue"), textX, cy + pad, PAL.heading)
|
||||
Kit.textWrapped("small", reportDetail, textX,
|
||||
cy + pad + Kit.textHeight("small") + math.floor(4 * m.s), reportTextW,
|
||||
PAL.muted, 3)
|
||||
btn(imp, x + w - pad - reportW,
|
||||
cy + math.floor((reportH - m.btnH) / 2), reportW, m.btnH,
|
||||
"bug-report", reportLabel, {
|
||||
kind = "accent", font = "small",
|
||||
action = function()
|
||||
imp:_ensureMods()
|
||||
imp:_reportIssue(SaveData.loadOptions(), nil)
|
||||
end })
|
||||
end
|
||||
|
||||
local function buildFindPanel(imp, x, y, w, availH, m)
|
||||
imp:_ensureFind()
|
||||
imp:_ensureMods()
|
||||
@@ -4822,6 +4917,8 @@ function LauncherView.draw(imp)
|
||||
contentH = buildFindPanel(imp, x, py, panelW, budgetH, m)
|
||||
elseif imp.tab == "skins" then
|
||||
contentH = buildSkinsPanel(imp, x, py, panelW, budgetH, m)
|
||||
elseif imp.tab == "bug" then
|
||||
contentH = buildBugPanel(imp, x, py, panelW, budgetH, m)
|
||||
else
|
||||
contentH = buildGamePanel(imp, x, py, panelW, availH, m, imp.tab, budgetH)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user