Skip to content

Commit 3495fb1

Browse files
trekawekclaude
andcommitted
Read the serial line high when no link peer is connected
Peer2PeerSerialEndpoint.sendBit() returned 0 when no peer was attached, so an internal-clock serial transfer with no cable filled SB with 0x00. An unconnected link cable actually floats high, so the null endpoint (and real hardware) return 0xFF. Single-player sessions always wire a Peer2PeerSerialEndpoint for potential netplay, so every link-aware game saw a phantom partner: Alleyway runs a serial handshake at stage start, misdetected a connected Game Boy, and hung waiting for it with the paddle frozen - the reported input failure (issue #63). sendBit() now returns 1 when peer is null, matching the null endpoint; the connected path is unchanged so netplay is unaffected. Full battery and the controller/netplay suites stay green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J1wLWscyUGS7CFwc3CjJR8
1 parent bc194b4 commit 3495fb1

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

core/src/main/java/eu/rekawek/coffeegb/core/serial/Peer2PeerSerialEndpoint.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ public void startSending() {
5151
@Override
5252
public int sendBit() {
5353
if (peer == null) {
54-
return 0;
54+
// an unconnected link cable reads high, so an internal-clock transfer with no
55+
// peer receives all ones (SB becomes 0xFF), like the null endpoint. Returning
56+
// 0 here made link-aware games see a phantom partner and hang waiting for it
57+
// (Alleyway freezes with the paddle stuck, issue #63).
58+
return 1;
5559
}
5660
peer.bitsReceived.incrementAndGet();
5761
return shift();

0 commit comments

Comments
 (0)