gc_bba_test: fix inverted EXI error checks; builds clean

libogc's EXI functions return '1 on success, <=0 on error', but every call
site tested '== 0'.  A -1 error return therefore read as success, so a failed
EXI_Lock or EXI_Select would fall through and the subsequent transfer would
produce garbage reported as a misleading test failure rather than an EXI
error.  All six call sites now test <= 0.

Also retries EXI_Lock for ~100 ms: it fails outright rather than blocking when
another subsystem holds the channel, and Swiss or a libogc driver may hold it
briefly -- without the retry a transient collision surfaces as a test failure.

Builds clean with devkitPPC 16.1.0 / GCC 16, no warnings: 172 KB .dol.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-03 11:24:47 +02:00
parent ccf4eb4996
commit d8725392a5
5 changed files with 54 additions and 21 deletions
+23 -14
View File
@@ -1,3 +1,8 @@
# devkitPro's official image, used only as a source for the GameCube toolchain
# (see the devkitPPC section below). `:latest` tracks devkitPro releases; pin a
# dated tag (e.g. :20250527) if a toolchain update ever breaks the build.
FROM devkitpro/devkitppc:latest AS devkitppc
FROM debian:sid-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -5,6 +10,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
git \
git-lfs \
make \
sudo \
python3 \
python3-venv \
@@ -52,21 +58,24 @@ RUN pip install --no-cache-dir pyftdi pyserial
# ── GameCube homebrew toolchain (devkitPPC + libogc) ────────────────────────
# Needed to build the on-console BBA test app in `gc_bba_test/` into a .dol.
# devkitPro does NOT publish a .deb on GitHub -- the Debian package only exists
# in their own apt repo -- so this uses their maintained installer script, which
# adds the repo, imports the key and installs dkp-pacman. `gamecube-dev` is a
# package GROUP (devkitPPC, libogc, libfat, tools incl. elf2dol).
#
# NOTE this pulls from apt.devkitpro.org / pkg.devkitpro.org. Those hosts are
# blocked (HTTP 403) from inside the running container's network egress, but a
# host-side `docker build` reaches them fine -- which is why this lives in the
# Dockerfile rather than being installed at runtime. Adds roughly 1.5-2 GB.
RUN curl -fsSL https://apt.devkitpro.org/install-devkitpro-pacman -o /tmp/install-devkitpro-pacman \
&& chmod +x /tmp/install-devkitpro-pacman \
&& yes | /tmp/install-devkitpro-pacman \
&& dkp-pacman -S --noconfirm gamecube-dev \
&& dkp-pacman -Scc --noconfirm \
&& rm -f /tmp/install-devkitpro-pacman
# Copied out of devkitPro's official `devkitpro/devkitppc` image rather than
# installed with their `install-devkitpro-pacman` script: apt.devkitpro.org and
# pkg.devkitpro.org sit behind Cloudflare, which answers curl/wget/scripted
# fetches with HTTP 403 (browser user-agents get 200) -- from the host's
# `docker build` too, not just from inside the container. The Docker image is
# devkitPro's sanctioned route for CI/containers and needs no network access to
# their hosts. The binaries only link against libc, so they run fine on sid.
#
# Only the GameCube/PPC parts are copied (~540 MB); devkitARM, wut and the
# Wii/Wii U portlibs from the source image are skipped.
COPY --from=devkitppc /opt/devkitpro/devkitPPC /opt/devkitpro/devkitPPC
COPY --from=devkitppc /opt/devkitpro/libogc /opt/devkitpro/libogc
COPY --from=devkitppc /opt/devkitpro/tools /opt/devkitpro/tools
COPY --from=devkitppc /opt/devkitpro/cmake /opt/devkitpro/cmake
COPY --from=devkitppc /opt/devkitpro/licenses /opt/devkitpro/licenses
COPY --from=devkitppc /opt/devkitpro/portlibs/ppc /opt/devkitpro/portlibs/ppc
COPY --from=devkitppc /opt/devkitpro/portlibs/gamecube /opt/devkitpro/portlibs/gamecube
ENV DEVKITPRO=/opt/devkitpro
ENV DEVKITPPC=/opt/devkitpro/devkitPPC