Show the running app version on the Switch launcher header.

Add an NX-only yellow version chip so players can confirm which build is on the microSD after OTA or zip updates.
This commit is contained in:
Andrew Quenehen
2026-08-05 02:08:20 -03:00
parent 4dd4c5c463
commit ae5276b2d1
2 changed files with 42 additions and 0 deletions
+16
View File
@@ -33,6 +33,7 @@ local Theme = require("src.ui.kit.Theme")
local Layout = require("src.ui.kit.Layout") local Layout = require("src.ui.kit.Layout")
local Loader = require("src.ui.kit.Loader") local Loader = require("src.ui.kit.Loader")
local GameVersion = require("src.core.GameVersion") local GameVersion = require("src.core.GameVersion")
local Version = require("src.core.Version")
local Strings = require("src.core.Strings") local Strings = require("src.core.Strings")
local PAL = Theme.PAL local PAL = Theme.PAL
@@ -340,6 +341,21 @@ local function buildHeader(imp, m)
local rx = m.x + m.w - m.pad local rx = m.x + m.w - m.pad
local by = y + (rowH - gear) / 2 local by = y + (rowH - gear) / 2
-- Switch-only: show the running app version opposite the settings gear so
-- players can confirm which build is on the microSD (OTA / zip updates).
if imp.isNX then
local label = "v" .. tostring(Version.engine or "?")
local tw = Kit.textWidth("small", label)
local padX = math.floor(12 * m.s)
local chipW = math.max(tw + 2 * padX, gear)
local lx = m.x + m.pad
Theme.fill(lx, by, chipW, gear, PAL.bg, 1)
Theme.stroke(lx, by, chipW, gear, PAL.yellow, Theme.A.hover, 1)
local th = Kit.textHeight("small")
Kit.text("small", label, lx + math.floor((chipW - tw) / 2),
by + math.floor((gear - th) / 2), PAL.yellow)
end
-- Settings gear, top-right corner. -- Settings gear, top-right corner.
imp._gearIcon = imp._gearIcon imp._gearIcon = imp._gearIcon
or love.graphics.newImage("assets/launcher/gear.png") or love.graphics.newImage("assets/launcher/gear.png")
@@ -0,0 +1,26 @@
-- Switch launcher shows the running engine version in the header (NX only).
-- Desktop/Android/iOS must not paint that chip.
local function read(path)
local f = assert(io.open(path, "r"))
local s = f:read("*a")
f:close()
return s
end
local src = read("src/import/LauncherView.lua")
assert(src:find('local Version = require%("src%.core%.Version"%)')
or src:find('require%("src%.core%.Version"%)'),
"LauncherView must require Version")
assert(src:find("imp%.isNX", 1, false), "version chip must gate on isNX")
-- The chip is inside an isNX block and prints Version.engine
local nxBlock = src:match("if imp%.isNX then(.-)end\n\n %-%- Settings gear")
assert(nxBlock, "expected Switch-only version chip before the settings gear")
assert(nxBlock:find("Version%.engine", 1, false), "chip must show Version.engine")
assert(nxBlock:find('"v"', 1, true) or nxBlock:find('"v" %.%.', 1, false),
"chip label should be a v-prefixed version")
print("ok — Switch launcher version chip is NX-gated and uses Version.engine")