Lunar Porter takes any controller, not the first one

A controller does not always arrive on pad nought. The front end hands out
the numbers the host gave it, so a game that reads only the first one
works on the machine it was written on and silently does nothing on the
next - which is the shape of "the pad is detected, Pad shows it, and the
game ignores it".

Four reads and three ORs. One person flies this and which socket they
plugged into is not a thing they should have to know. Presence is any of
the four bits rather than the low one, for the same reason.

The manifest's pad column takes several fixtures now, comma separated, and
they fill the pads in turn. So cosmosLanderPadOne holds nothing on pad
nought and flies the whole landing on pad one - a test that fails on the
version of this program that shipped an hour ago.

Also confirmed while looking: raylib 6 does refresh which gamepads are
ready every frame in PollInputEvents, so a hot-plugged pad should be seen.
Whatever is stopping that is above us and worth a separate look.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
Anachronaut
2026-09-02 23:36:05 -04:00
co-authored by Claude Opus 5
parent 6def343e97
commit f7be843ed9
16 changed files with 73 additions and 21 deletions
+26 -6
View File
@@ -61,14 +61,13 @@ start:
; ---- Is there a controller ----
;
; Asked once. If there is, the console's arrow keys are ignored: under a window the same
; keypress reaches BOTH - the pad as a level and the console as a byte - and a thruster that
; fired twice for one press would be a mystery to anybody tuning it.
; Asked once, and about all four. If there is one anywhere, the console's arrow keys are
; ignored: under a window the same keypress reaches BOTH - the pad as a level and the
; console as a byte - and a thruster that fired twice for one press would be a mystery to
; anybody tuning it.
INA 0x64
INIB 0x01
AND
SETD.1 HasPad
STQ.1
STA.1 ; ANY bit, so any of the four counts as having one.
everyFrame:
CALL waitFrame
@@ -331,10 +330,31 @@ putLander:
; One read, every button at once, and it does not go away when it is looked at. THIS IS THE
; THING THE CONSOLE CANNOT DO: a key that is down and staying down sends nothing, so a
; thruster driven by the console can only be pumped and never leaned on.
; ---- ANY of the four, not pad nought ----
;
; One person flies this, and which socket they plugged into is not a thing they should have
; to know. A controller does not always land on nought - the front end hands out the numbers
; the host gave it - so a game that reads only the first one works on some machines and
; silently does nothing on others, which is the worst of both.
;
; Four reads and three ORs. A port is an immediate byte inside the instruction that names it,
; so it cannot be computed and the four are written out.
readPad:
INA 0x60
SETD.1 Held
STA.1
INA 0x61
LDB.1
OR
STQ.1
INA 0x62
LDB.1
OR
STQ.1
INA 0x63
LDB.1
OR
STQ.1
RET
; ---- The console, which is still worth reading ----