feat: PS4RP daemon source + working PS4 build

Full daemon source (C, PS4 native):
- log/cfg/jsonlite/b64: logging, /data/PS4RP/config.json, JSON, base64
- http.c: OAuth2 token exchange via SceHttp (authorization_code + refresh)
- ws.c: WebSocket over SceNet + LibreSSL (SSLv23_client_method),
  DNS via sceNetResolverStartNtoa, OrbisNetSockaddr packing
- discord.c: gateway connect/identify/heartbeat/presence set+clear
- detect.c: foreground game via sceUserServiceGetForegroundUser
  + app.xml/app.db title-name resolution
- main.c: poll loop (config poll_interval_s)

Build verified on macOS (LLVM 21 + OpenOrbis toolchain v0.5.4):
- 9 objects compile, lld 21 links build/ps4rp.elf (169KB)
- create-fself produces valid SCE ASLR payload build/ps4rp.fself
- libSceLibreSSL exports the OpenSSL-style TLS API used by ws.c
This commit is contained in:
SirHumza committed 2026-08-14 08:43:09 +02:00
1 parent 1f659e16a8
commit 20c13f1ead
20 files changed
+1087 -243

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
#!/bin/bash
# build.sh - PS4RP: compile payload ELF + fself for PS4.
# Usage: ./scripts/build.sh [elf|fself|all] default: all
set -euo pipefail
SDK="${OO_PS4_TOOLCHAIN:-/Users/mac/PS4Toolchain/OpenOrbis/PS4Toolchain}"
LLVM_BIN="${LLVM_HOME:-/usr/local/opt/llvm}/bin"
export PATH="$LLVM_BIN:$SDK/bin/macos:$PATH"
CC="$LLVM_BIN/clang"
LD="${LLD:-/usr/local/opt/lld@21/bin/ld.lld}"
TARGET="x86_64-pc-freebsd12-elf"
CFLAGS="--target=$TARGET -fPIC -std=gnu11 -Wall -Wno-unused \
-Wno-int-conversion -Wno-incompatible-pointer-types \
-isystem $SDK/include"
LIBS="-lc -lkernel -lSceNet -lSceNetCtl -lSceSsl -lSceHttp -lSceSysmodule \
-lSceUserService -lSceAppInstUtil -lSceAppContent"
LDFLAGS="-m elf_x86_64 -pie --eh-frame-hdr -L$SDK/lib $LIBS $SDK/lib/crt1.o --script $SDK/link.x"
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
OUT="$ROOT/build"; mkdir -p "$OUT"
echo "=== compiling ==="
for f in log cfg jsonlite b64 http ws detect discord main; do
"$CC" $CFLAGS -c -o "$OUT/$f.o" "PS4RP/$f.c" || { echo "compile $f FAILED"; exit 1; }
done
echo "=== linking ($LD) ==="
"$LD" $OUT/*.o -o "$OUT/ps4rp.elf" $LDFLAGS || { echo "link FAILED"; exit 1; }
echo "ELF -> $OUT/ps4rp.elf"
MODE="${1:-all}"
if [ "$MODE" = "fself" ] || [ "$MODE" = "all" ]; then
"$SDK/bin/macos/create-fself-macos" -in="$OUT/ps4rp.elf" \
-out="$OUT/ps4rp.fself" --eboot "$OUT/ps4rp.bin" --paid 0x3800000000000011
echo "FSELF -> $OUT/ps4rp.fself"
fi
echo "done."