mirror of
https://github.com/MoHadiShibli/Control4Free.git
synced 2026-10-06 13:00:27 +02:00
For consoles it fails on, so a user can send screenshots instead of digging out log files. `make C4F_DIAG=1` and `make -C launcher C4F_DIAG=1` (or tools/build-launcher.ps1 -Diag) build Control4Free-<version>-diag.pkg, listed as "Control4Free (diagnostic)". Its app shows plain pages in place of the normal screen: a summary with a verdict (firmware, GoldHEN, sandbox, auto-start files, the service and the last start), the service log and the previous one, and the kernel log, filtered and in full. The kernel log is read only in short windows, at start-up, around a start and on Options, since Control4Free needs it to sign controllers in. The pages are also saved to /data/control4free/diag-report.txt, and to a USB stick when one is plugged in. The payload says on screen that it started, and logs the kernel addresses the SDK found and the process PayLoader runs it in.
87 lines
2.7 KiB
Makefile
87 lines
2.7 KiB
Makefile
# Control4Free -- system-wide virtual controllers for the PS4 (GoldHEN payload).
|
|
#
|
|
# Build:
|
|
# make # build/control4free.elf
|
|
# make C4F_PROBE=1 # plus the rumble/light-bar research probe (dev only)
|
|
# make C4F_DIAG=1 # diagnostic build for a console it fails on
|
|
# make clean
|
|
#
|
|
# A build needs the ps4-payload-sdk; docker/Dockerfile has it, and
|
|
# tools/build.ps1 runs this inside the container.
|
|
|
|
ifdef PS4_PAYLOAD_SDK
|
|
include $(PS4_PAYLOAD_SDK)/toolchain/orbis.mk
|
|
else
|
|
$(error PS4_PAYLOAD_SDK is undefined -- build in Docker, or point it at an SDK)
|
|
endif
|
|
|
|
VERSION := $(shell cat VERSION)
|
|
|
|
NAME := control4free
|
|
ELF := build/$(NAME).elf
|
|
OBJDIR := build/payload
|
|
SOURCES := src/main.c src/log.c src/vda.c src/klog_line.c src/feedback.c src/web.c src/net.c
|
|
|
|
# Research build: logs what scePadVirtualDeviceGetRemoteSetting returns. Its ELF
|
|
# gets its own name, so it can never be mistaken for a release.
|
|
ifdef C4F_PROBE
|
|
EXTRA_CFLAGS := -DC4F_PROBE_SETTING
|
|
ELF := build/$(NAME)-probe.elf
|
|
OBJDIR := build/probe
|
|
endif
|
|
|
|
# Diagnostic build: logs what the SDK found in the kernel and the host process,
|
|
# and says on screen that it started. The launcher's C4F_DIAG build carries it.
|
|
ifdef C4F_DIAG
|
|
EXTRA_CFLAGS += -DC4F_DIAG
|
|
VERSION := $(VERSION)-diag
|
|
ELF := build/$(NAME)-diag.elf
|
|
OBJDIR := build/diag
|
|
endif
|
|
|
|
OBJECTS := $(SOURCES:src/%.c=$(OBJDIR)/%.o) $(OBJDIR)/client.o $(OBJDIR)/assets.o $(OBJDIR)/qrcodegen.o
|
|
|
|
CFLAGS += -std=gnu11 -Wall -Wextra -Wpointer-arith -g -O2
|
|
CFLAGS += -MMD -MP
|
|
CFLAGS += -Iinclude -Ivendor/jsmn -Ivendor/qrcodegen -DC4F_VERSION='"$(VERSION)"' $(EXTRA_CFLAGS)
|
|
LDFLAGS += -lScePad -lSceUserService -ldl -lpthread
|
|
|
|
.PHONY: all clean
|
|
.DEFAULT_GOAL := all
|
|
|
|
-include $(OBJECTS:.o=.d)
|
|
|
|
all: $(ELF)
|
|
|
|
$(OBJDIR) build:
|
|
mkdir -p $@
|
|
|
|
# VERSION is compiled into the objects, and make doesn't notice a changed flag,
|
|
# so a new version has to rebuild them.
|
|
$(OBJDIR)/%.o: src/%.c VERSION | $(OBJDIR)
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
build/client.c: client/index.html tools/embed_client.py | build
|
|
python3 tools/embed_client.py $< $@
|
|
|
|
# The page's Invite QR code (MIT, the same copy the app uses).
|
|
$(OBJDIR)/qrcodegen.o: vendor/qrcodegen/qrcodegen.c | $(OBJDIR)
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
$(OBJDIR)/client.o: build/client.c | $(OBJDIR)
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
# The manifest and icon the page points at, so it can live on a home screen.
|
|
build/assets.c: client/manifest.webmanifest client/icon-192.png tools/embed_file.py | build
|
|
python3 tools/embed_file.py $@ c4fManifest=client/manifest.webmanifest c4fIcon=client/icon-192.png
|
|
|
|
$(OBJDIR)/assets.o: build/assets.c | $(OBJDIR)
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
$(ELF): $(OBJECTS) | build
|
|
$(CC) -o $@ $(OBJECTS) $(LDFLAGS)
|
|
@echo "built $@ ($(VERSION))"
|
|
|
|
clean:
|
|
rm -rf build
|