A game talks to a virtual controller as it would to a real one, and the system
keeps what it asked for. scePadVirtualDeviceGetRemoteSetting reads it back in
the layout of a DualShock 4's output report: the two motors at [3] and [4], the
light bar at [5..7]. The layout was read on the console while games rumbled and
users signed in, and feedback.c is tested against those exact buffers.
The service reads it every 16 ms for each controller; games pulse rumble for
only tens of milliseconds, which a 100 ms poll missed.
- Rumble goes to the controller's owner as {"method":"v","params":[pad,large,
small]}, once per change, and to whoever takes a controller over, so a page
never keeps buzzing on old news. The page already drove an Android phone's
vibration and a gamepad's actuators from it.
- The light bar goes into the status everyone sees. The PS4 sets player colours
at a quarter strength, so the colour is brightened to full, keeping its hue;
an unlit bar keeps the controller's own colour.
- Without the call, controllers work as before and it is logged once.
Also: the page says "Choose user on PS4", not "on TV", since not everyone plays
on a TV. The test stub takes C4F-TEST-FEEDBACK lines to set what the "game"
wants, and the test client can wait for messages the service pushes.
4.3 KiB
Contributing to Control4Free
Thanks for helping! Bug reports, compatibility reports, fixes and reviews are all welcome.
Reporting a bug
Use the bug report form. The most useful details:
- the Control4Free version, shown at the bottom of the page and of the app;
- the firmware and GoldHEN versions;
- the phone or computer and browser you used;
- what you did and what happened;
- the service's log, if you can get it:
/data/control4free/control4free.logon the PS4, over GoldHEN's FTP server (port 2121). The previous run is kept incontrol4free.log.previous.
The log contains your console's network address. Remove it before posting if you prefer.
Security problems: please follow SECURITY.md instead of opening a public issue.
Building
Everything builds in Docker, so Docker is all you need:
git clone https://github.com/MoHadiShibli/Control4Free
cd Control4Free
docker build -t control4free-build docker/
docker build -t control4free-launcher-build -f docker/Dockerfile.launcher docker/
docker run --rm -v "$PWD:/src" -w /src control4free-launcher-build bash -lc 'make && make -C launcher'
build/control4free.elfis the service, with the page and its icon built in.build/Control4Free-<version>.pkgis the app, with its own copy of the service.
The first image pins the ps4-payload-sdk release that builds the
service; the second adds the OpenOrbis toolchain,
pinned by digest, for the app and the package. On Windows, tools/build-launcher.ps1 runs all three steps.
The version comes from the VERSION file and nowhere else: the Makefiles and the packager read it, and
the page and the app show the version the service reports.
Testing
docker run --rm --network none -v "$PWD:/src" -w /src control4free-launcher-build python3 -B tests/run.py
The suites build the real sources for the host with only the PS4 calls stubbed, so they need no console:
test_webandtest_recoveryrun the actual service against a fake kernel log (tests/web_stub.c) that writes the same lines firmware 10.01 does, over real HTTP and WebSocket connections;test_frontendruns the page's own functions under Node;test_launcherdrives the app's logic, renders every state of its screen tobuild/launcher-preview-*.png, and checks the package'sparam.sfo;test_loggingcovers the log, the kernel-log opener and DeviceId matching.
Add a test with your fix: one that fails without it. Then test on a real console if you can, and say in your pull request which firmware, GoldHEN version and games you tried.
To try changes to the page without rebuilding, open client/index.html from disk and enter the console's
address, or add ?host=<ps4-ip>:4264 to the page's URL.
Code style
Match the code around your change:
- C with GNU extensions (gnu11), 4-space indent,
camelCasefunctions with ac4fprefix,C4ftypes andC4F_macros; - log with
c4fLog.c4fNotifyshows a notification on the PS4's screen: keep those rare; - comments explain why, not what;
- only button bits confirmed on hardware go in
include/c4f_sce.h; - the page is one file with no build step and no libraries: keep it that way;
- OpenOrbis's headers give
MSG_NOSIGNAL,SIGSYSandCLOCK_MONOTONICtheir Linux values, which the PS4 reads as something else. Don't use them directly inlauncher/; a test checks.
Build without new warnings; the app is built with -Werror.
Releasing
- Update
VERSION, and add a section toCHANGELOG.md. - Commit, tag
vX.Y.Z, and push the tag. - CI builds both images, runs the tests, and publishes the release with the ELF, the package and
SHA256SUMS. It refuses a tag that doesn't matchVERSION.
Reviewing AI-written code
Much of Control4Free was written with the help of AI models (Claude Opus 5.5 by Anthropic and Astra GPT-6 by OpenAI). It has been tested, on the console as well, but AI-written code can look right and still be wrong. Please read it critically: if you find dead code, wrong assumptions or needless complexity, open an issue or send a pull request.
License
Contributions are accepted under the GNU General Public License v3, the project's license.