chore(switch): add minimal love-nx hardware probe

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Andrew Quenehen
2026-08-01 03:13:57 -03:00
parent d4afa09e03
commit a7a84b6fab
3 changed files with 126 additions and 0 deletions
+45
View File
@@ -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).
+11
View File
@@ -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
+70
View File
@@ -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