megadev-input
Megadev input
Inspect the game's existing input owner and selected toolchain before adding a reader. Megadev's direct helper is a 3-button reader. Device IDs in BIOS headers do not establish a complete six-button, mouse or multitap API. Do not copy SGDK JOY_* calls or assume its slot conventions exist here.
Choose one polling owner
Read Megadev integration before touching ports or replacing a frame handler. The ordinary Main BIOS VBlank path also reads controllers. A second protocol reader can disturb six-button phase state or consume mouse motion twice. Use either the game's established service or one deliberately integrated replacement; consumers read its cached snapshot.
The included Input Lab supplies project-owned pad/mouse/Team Player/EA readers using Megadev register definitions. These are examples, not newly discovered SDK APIs. Its custom interrupt preserves the documented Sub-CPU pulse and avoids BIOS input polling. Do not transplant it over a game's existing graphics, audio, raster or communication owner.
Match the physical device
Use devices and protocols for 3/6-button phases, active-low pad versus active-high mouse buttons, motion signs, handshake limits and adapter port ownership. Team Player and EA 4 Way Play are different protocols. Team Player supports mixed pads/mice on one port; EA owns both ports and is an explicit setup mode here.
Configure only the expected pins as outputs. Restore the idle lines on success and failure. Bound both individual waits and total packet work. Check signatures, lengths and device types before exposing a packet; a missing acknowledgment must not hang the game or retain stale held buttons. Never infer successful hardware support solely from a constant, a cached type or a scripted fixture.
Publish useful state
Use input patterns for held/pressed/released state, first-sample baselining, menu repeat, stable socket-to-player assignments and mouse cursors. Keep the user's controls and player policy. The Lab's A/B/C/Start inspector actions are illustrative, not a default game control scheme.