From a7a84b6fab083f901e178ebba5701661015d16a8 Mon Sep 17 00:00:00 2001 From: Andrew Quenehen Date: Sat, 1 Aug 2026 03:13:57 -0300 Subject: [PATCH] chore(switch): add minimal love-nx hardware probe Co-authored-by: Cursor --- tools/switch-probe/README.md | 45 +++++++++++++++++++++++ tools/switch-probe/conf.lua | 11 ++++++ tools/switch-probe/main.lua | 70 ++++++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 tools/switch-probe/README.md create mode 100644 tools/switch-probe/conf.lua create mode 100644 tools/switch-probe/main.lua diff --git a/tools/switch-probe/README.md b/tools/switch-probe/README.md new file mode 100644 index 00000000..7d1cd6c1 --- /dev/null +++ b/tools/switch-probe/README.md @@ -0,0 +1,45 @@ +# switch-probe — love-nx hardware probe + +**NOT FOR RELEASE.** This package is a developer-only diagnostic for Nintendo Switch (love-nx). Do not ship it inside `game.love` or release NRO payloads. + +## Purpose + +Validate Phase 0 runtime facts on OLED hardware before running the full Gen1Recomp launcher: + +- `love.system.getOS()` (expect `NX` on Switch) +- Window dimensions (`love.graphics.getDimensions()`) +- Save directory path (`love.filesystem.getSaveDirectory()`) +- Gamepad / joystick / touch event logging + +## Fields shown on screen + +| Field | Source | +| ----- | ------ | +| OS name | `love.system.getOS()` | +| Dimensions | `love.graphics.getDimensions()` | +| Save directory | `love.filesystem.getSaveDirectory()` | +| `love._os` | Engine boot hint (when available) | +| Event log | Last 24 `gamepad*`, `joystick*`, `touch*` events | + +## Build `.love` (from repo root) + +```bash +(cd tools/switch-probe && zip -9 -r ../../.bazinga/work/switch-probe.love main.lua conf.lua) +``` + +Or: + +```bash +mkdir -p .bazinga/work +zip -9 -j .bazinga/work/switch-probe.love tools/switch-probe/main.lua tools/switch-probe/conf.lua +``` + +Deploy beside `gen1recomp.nro` (loose mode) per `docs/switch-development.md`, renaming to `game.love` only for a probe run — use a separate SD folder so probe and game builds do not mix. + +## Desktop smoke (optional) + +```bash +love tools/switch-probe +``` + +Expect desktop `getOS()`; input events appear when using keyboard/gamepad/touch (if available). diff --git a/tools/switch-probe/conf.lua b/tools/switch-probe/conf.lua new file mode 100644 index 00000000..03395856 --- /dev/null +++ b/tools/switch-probe/conf.lua @@ -0,0 +1,11 @@ +function love.conf(t) + t.identity = "switch-probe" + t.version = "11.5" + t.window.title = "switch-probe (NOT FOR RELEASE)" + t.window.width = 1280 + t.window.height = 720 + t.window.fullscreen = true + t.window.resizable = false + t.window.highdpi = false + t.modules.physics = false +end diff --git a/tools/switch-probe/main.lua b/tools/switch-probe/main.lua new file mode 100644 index 00000000..4393d529 --- /dev/null +++ b/tools/switch-probe/main.lua @@ -0,0 +1,70 @@ +-- Minimal love-nx hardware probe. NOT FOR RELEASE — dev-only diagnostic. +-- Draws runtime facts and logs input events to help validate Phase 0 on OLED. + +local lines = {} +local log = {} +local maxLog = 24 + +local function push(msg) + log[#log + 1] = msg + if #log > maxLog then table.remove(log, 1) end +end + +local function refreshStatic() + lines = {} + local osName = love.system.getOS() + lines[#lines + 1] = "switch-probe — NOT FOR RELEASE" + lines[#lines + 1] = "getOS(): " .. tostring(osName) + local w, h = love.graphics.getDimensions() + lines[#lines + 1] = ("dimensions: %d x %d"):format(w, h) + lines[#lines + 1] = "save: " .. tostring(love.filesystem.getSaveDirectory()) + if love._os then + lines[#lines + 1] = "love._os: " .. tostring(love._os) + end +end + +function love.load() + love.graphics.setBackgroundColor(0.08, 0.1, 0.16) + refreshStatic() + push("load") +end + +function love.gamepadpressed(joystick, button) + push(("gamepadpressed %s %s"):format(joystick:getName(), tostring(button))) +end + +function love.gamepadreleased(joystick, button) + push(("gamepadreleased %s %s"):format(joystick:getName(), tostring(button))) +end + +function love.joystickpressed(joystick, button) + push(("joystickpressed %s #%s"):format(joystick:getName(), tostring(button))) +end + +function love.joystickreleased(joystick, button) + push(("joystickreleased %s #%s"):format(joystick:getName(), tostring(button))) +end + +function love.touchpressed(id, x, y, dx, dy, pressure) + push(("touchpressed id=%s (%.0f,%.0f)"):format(tostring(id), x, y)) +end + +function love.touchreleased(id, x, y, dx, dy, pressure) + push(("touchreleased id=%s (%.0f,%.0f)"):format(tostring(id), x, y)) +end + +function love.draw() + refreshStatic() + love.graphics.setColor(0.9, 0.92, 1) + local y = 16 + for _, line in ipairs(lines) do + love.graphics.print(line, 16, y) + y = y + 22 + end + love.graphics.print("— event log —", 16, y + 8) + y = y + 30 + for _, line in ipairs(log) do + love.graphics.print(line, 16, y) + y = y + 18 + end +end