mirror of
https://github.com/ARMSX2/ARMSX3.git
synced 2026-08-24 16:58:52 -07:00
0.9 shipped seven permanently-connected pads. Reported against LittleBigPlanet 2, which reacts to the connected count and behaved as though 4+ controllers were plugged in at all times. Claiming all seven ports for the virtual handler is what lets a second controller work at all -- that was the 0.9 fix and it stays -- but initVirtualPad called Init with CELL_PAD_STATUS_CONNECTED unconditionally, and "this port exists" and "a controller is plugged into this port" are not the same statement. cellPad derives now_connect by counting ports whose status carries the CONNECTED bit, so every game asking how many pads were attached was told seven. Port 0 therefore starts CONNECTED and ports 1-6 start 0, with the bit set on a port the first time real input arrives for it in _rpcsx_overlayPadData. No new event plumbing is needed: pad_thread::update_pad_states already polls is_connected() against its cached m_pads_connected -- value-initialised to false, so a port that starts disconnected fires nothing at boot -- and calls pad_state_notify_state_change on a change, which is what propagates m_port_status into cellPad's reported_info. Setting the bit is enough for the existing path to publish it. m_player_id is a const set at construction, not by Init, so reading it to pick the initial status is safe at this point.