mirror of
https://github.com/knutwurst/patchdl.git
synced 2026-10-06 10:00:22 +02:00
Write param.json + icon0.png into /user/app/<TITLE_ID>/sce_sys/, then call sceAppInstUtilAppInstallTitleDir to register the directory as an app. No package, no code signing — the installer reads the metadata files directly. The tile uses TITLE_ID PTDL00001 and deeplinkUri http://127.0.0.1:12880/, so tapping it opens PatchDL's own UI in the on-console browser. Only useful while the ELF is running. Asset pipeline: param.json + icon0.png live under assets/ and get .incbin'd straight into .rodata. Makefile lists them as TILE_ASSETS so a touch on either forces a relink. Stat-guard: file_matches() diffs each asset against the on-disk copy first; when nothing changed the install API isn't called at all. Keeps repeated payload starts from re-registering the app. Repeated /api/install_tile calls return "already installed and up to date". Backend lazy-load: AppInstUtil isn't mapped until something pokes it, so the helper polls patchdl_install_backend_check() for up to ~15 s before resolving sceAppInstUtilAppInstallTitleDir. Wiring: /api/install_tile POST triggers the install on demand; patchdl_websrv_start() runs it at startup when home_shortcut is on; and flipping the toggle from off to on in /api/config also fires it. All three paths share the stat-guarded helper so they're safe to repeat.
74 lines
2.0 KiB
Makefile
74 lines
2.0 KiB
Makefile
PS5_HOST ?= ps5
|
|
PS5_PORT ?= 9021
|
|
PATCHDL_HTTP_PORT ?= 12880
|
|
ETAHEN_DEPS_DIR ?= vendor/etahen
|
|
|
|
ifdef PS5_PAYLOAD_SDK
|
|
include $(PS5_PAYLOAD_SDK)/toolchain/prospero.mk
|
|
else
|
|
$(error PS5_PAYLOAD_SDK is undefined)
|
|
endif
|
|
|
|
PYTHON ?= python3
|
|
BIN := patchdl-ps5.elf
|
|
|
|
SRCS := src/main.c \
|
|
src/patchdl_assets.c \
|
|
src/patchdl_websrv.c \
|
|
src/patchdl_proc.c \
|
|
src/patchdl_fw.c \
|
|
src/patchdl_scan.c \
|
|
src/patchdl_appdb.c \
|
|
src/patchdl_net.c \
|
|
src/patchdl_resolve.c \
|
|
src/patchdl_verxml.c \
|
|
src/patchdl_install.c \
|
|
src/patchdl_notify.c \
|
|
src/patchdl_tile.c
|
|
|
|
# patchdl_tile.c uses .incbin to embed param.json + icon0.png; touching the
|
|
# assets must trigger a rebuild.
|
|
TILE_ASSETS := assets/param.json assets/icon0.png
|
|
|
|
WEB_ASSETS := web/index.html web/styles.css web/app.js
|
|
GEN_SRCS := $(patsubst web/%,gen/web/%.c,$(WEB_ASSETS))
|
|
|
|
SQLITE_DIR := vendor/sqlite
|
|
SQLITE_OBJ := $(SQLITE_DIR)/sqlite3.o
|
|
SQLITE_CFLAGS := -O2 -w \
|
|
-DSQLITE_THREADSAFE=0 \
|
|
-DSQLITE_OMIT_LOAD_EXTENSION \
|
|
-DSQLITE_OMIT_WAL \
|
|
-DSQLITE_DEFAULT_MEMSTATUS=0 \
|
|
-DSQLITE_OMIT_DEPRECATED
|
|
|
|
CFLAGS := -g -O2 -Wall -Werror -Isrc -I"$(ETAHEN_DEPS_DIR)/include" -I"$(SQLITE_DIR)" -DPATCHDL_HTTP_PORT=$(PATCHDL_HTTP_PORT)
|
|
LDADD := -L"$(ETAHEN_DEPS_DIR)/lib" -lmicrohttpd -lkernel_sys -lpthread
|
|
|
|
ifdef CURL_DIR
|
|
CFLAGS += -DPATCHDL_HAVE_CURL -I"$(CURL_DIR)/include"
|
|
LDADD += -L"$(CURL_DIR)/lib" -lcurl -lpsl -lssl -lcrypto -lzstd -lz
|
|
endif
|
|
|
|
all: $(BIN)
|
|
|
|
gen/web:
|
|
mkdir -p gen/web
|
|
|
|
gen/web/%.c: web/% scripts/gen_asset_module.py | gen/web
|
|
$(PYTHON) scripts/gen_asset_module.py --path $* $< > $@
|
|
|
|
$(SQLITE_OBJ): $(SQLITE_DIR)/sqlite3.c
|
|
$(CC) $(SQLITE_CFLAGS) -c -o $@ $<
|
|
|
|
$(BIN): $(SRCS) $(GEN_SRCS) $(SQLITE_OBJ) $(TILE_ASSETS)
|
|
$(CC) $(CFLAGS) -o $@ $(SRCS) $(GEN_SRCS) $(SQLITE_OBJ) $(LDADD)
|
|
|
|
test: $(BIN)
|
|
$(PS5_DEPLOY) -h $(PS5_HOST) -p $(PS5_PORT) $^
|
|
|
|
clean:
|
|
rm -rf $(BIN) gen $(SQLITE_OBJ)
|
|
|
|
.PHONY: all clean test
|