From db746c7aac42ee8bf28380642897fdd82cf8f2bc Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Fri, 8 Aug 2025 13:23:15 -0400 Subject: [PATCH] Start work on ps3netsrv --- Dockerfile | 15 +++++++++++++++ docker/Dockerfile | 27 +++++++++++++++++++++++++++ entrypoint.sh | 13 +++++++++++++ 3 files changed, 55 insertions(+) diff --git a/Dockerfile b/Dockerfile index ddcbf2bd4..1d57097d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,6 +54,21 @@ RUN sed -i '22a #include ' ./src/Util.h \ && cp ./bin64/RAHasher /usr/bin/RAHasher RUN rm -rf /tmp/RALibretro +# Install ps3netsrv +ARG PS3NETSRV_VERSION=20250501 +ARG PS3NETSRV_URL=https://github.com/aldostools/ps3netsrv/releases/download/${PS3NETSRV_RELEASE}/ps3netsrv_${PS3NETSRV_VERSION}_linux.zip + +RUN \ + echo "Building ps3netsrv from release..." && \ + curl -sL --output /tmp/ps3netsrv.zip "${PS3NETSRV_URL}" && \ + unzip /tmp/ps3netsrv.zip -d /tmp && \ + find "/tmp" -type d -maxdepth 1 -iname "*ps3netsrv_*" -exec mv -f {} "/tmp/ps3netsrv" \; && \ + cd /tmp/ps3netsrv/src && \ + meson build --buildtype=release && \ + ninja -C build/ && \ + cp -v build/ps3netsrv /usr/bin/ps3netsrv && \ + rm -rf /tmp/ps3netsrv* + # Install frontend dependencies COPY frontend/package.json /app/frontend/ WORKDIR /app/frontend diff --git a/docker/Dockerfile b/docker/Dockerfile index 34530e21f..a488a8569 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,6 +3,7 @@ # - backend-build: Build backend environment # - backend-dev-build: Similar to `backend-build`, but also compiles and installs development dependencies # - rahasher-build: Build RAHasher +# - ps3netsrv-build: Build ps3netsrv # - emulator-stage: Fetch and extract emulators # - nginx-build: Build nginx modules # - production-stage: Setup frontend and backend @@ -79,6 +80,31 @@ RUN git clone --recursive --branch "${RALIBRETRO_VERSION}" --depth 1 https://git ./src/libchdr/deps/zlib-1.3.1/gzwrite.c && \ make HAVE_CHD=1 -f ./Makefile.RAHasher +# Alpine 3.18's g++ v12 is the latest version that works with ps3netsrv, +# while g++ v13 fails to compile it +FROM alpine:3.18 AS ps3netsrv-build + +RUN apk add --no-cache \ + g++ \ + linux-headers \ + curl \ + meson \ + mbedtls-dev + +ARG PS3NETSRV_VERSION=20250501 +ARG PS3NETSRV_URL=https://github.com/aldostools/ps3netsrv/releases/download/${PS3NETSRV_RELEASE}/ps3netsrv_${PS3NETSRV_VERSION}_linux.zip + +RUN \ + echo "Building ps3netsrv from release..." && \ + curl -sL --output /tmp/ps3netsrv.zip "${PS3NETSRV_URL}" && \ + unzip /tmp/ps3netsrv.zip -d /tmp && \ + find "/tmp" -type d -maxdepth 1 -iname "*ps3netsrv_*" -exec mv -f {} "/tmp/ps3netsrv" \; && \ + cd /tmp/ps3netsrv/src && \ + meson build --buildtype=release && \ + ninja -C build/ && \ + mkdir -p /tmp/ps3netsrv-bin && \ + cp -v build/ps3netsrv /tmp/ps3netsrv-bin/ + FROM alpine:${ALPINE_VERSION} AS emulator-stage @@ -152,6 +178,7 @@ COPY --from=python-alias /usr/local/lib/libpython* /usr/local/lib/ COPY --from=python-alias /usr/local/lib/python${PYTHON_VERSION} /usr/local/lib/python${PYTHON_VERSION} COPY --from=rahasher-build /RALibretro/bin64/RAHasher /usr/bin/RAHasher +COPY --from=ps3netsrv-build /tmp/ps3netsrv-bin/ps3netsrv /usr/bin/ps3netsrv COPY --from=nginx-build ./nginx/objs/ngx_http_zip_module.so /usr/lib/nginx/modules/ COPY --from=frontend-build /front/dist ${WEBSERVER_FOLDER} diff --git a/entrypoint.sh b/entrypoint.sh index cf20b42a1..fc380bed0 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -72,6 +72,19 @@ watchfiles \ 'uv run python watcher.py' \ /app/romm/library & +echo "Starting ps3netsrv..." +# Create ps3netsrv directory structure with symbolic links +PS3NETSRV_ROOT="/app/romm/library/ps3netsrv" +mkdir -p "${PS3NETSRV_ROOT}" + +# Create symbolic links for ps3netsrv expected folder structure +if [[ -d "/app/romm/library/roms/ps3" ]]; then + ln -sf "/app/romm/library/roms/ps3" "${PS3NETSRV_ROOT}/GAMES" +fi + +# Start ps3netsrv with the prepared directory +ps3netsrv "${PS3NETSRV_ROOT}" 38008 * & + # Start the frontend dev server cd /app/frontend npm run dev &