diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml index c62a695..72109b5 100644 --- a/.builds/freebsd.yml +++ b/.builds/freebsd.yml @@ -1,5 +1,5 @@ -image: freebsd/13.x +image: freebsd/14.x sources: - https://git.sr.ht/~thestr4ng3r/chiaki @@ -7,7 +7,8 @@ sources: packages: - cmake - protobuf - - py39-protobuf + - py311-setuptools # should not be needed with nanopb >= 0.4.9 + - py311-protobuf - opus - qt5-core - qt5-qmake diff --git a/.builds/openbsd.yml b/.builds/openbsd.yml index 2f513c0..e1595ac 100644 --- a/.builds/openbsd.yml +++ b/.builds/openbsd.yml @@ -7,6 +7,7 @@ sources: packages: - cmake - protobuf + - py3-setuptools # should not be needed with nanopb >= 0.4.9 - py3-protobuf - opus - qtbase diff --git a/README.md b/README.md index 5be248c..1a94b66 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,17 @@ Chiaki is a Free and Open Source Software Client for PlayStation 4 and PlayStation 5 Remote Play for Linux, FreeBSD, OpenBSD, NetBSD, Android, macOS, Windows, Nintendo Switch and potentially even more platforms. -![Screenshot](assets/screenshot.png) - -## Project Status +## Project Status and Contributing As all relevant features are implemented, this project is considered to be finished and in maintenance mode only. -No major updates are planned and contributions are only accepted in special cases. +No major updates are planned and contributions are only accepted in special cases such as security issues. +The objective is to keep a stable base and not break existing support for less mainstream platforms such as BSDs. + +**For a more active, fast moving and community-oriented project, refer +to [chiaki-ng](https://streetpea.github.io/chiaki-ng/) ("next generation"). +If you would like to contribute, this will likely also be the best place to do so.** + +![Screenshot](assets/screenshot.png) ## Installing @@ -28,7 +33,7 @@ Builds are provided for Linux, Android, macOS, Nintendo Switch and Windows. You can download them [here](https://git.sr.ht/~thestr4ng3r/chiaki/refs). * **Linux**: The provided file is an [AppImage](https://appimage.org/). Simply make it executable (`chmod +x .AppImage`) and run it. -* **Android**: Install from [Google Play](https://play.google.com/store/apps/details?id=com.metallic.chiaki), [F-Droid](https://f-droid.org/packages/com.metallic.chiaki/) or download the APK from Sourcehut. +* **Android**: Install from [F-Droid](https://f-droid.org/packages/com.metallic.chiaki/) or download the APK from Sourcehut. * **macOS**: Drag the application from the `.dmg` into your Applications folder. * **Windows**: Extract the `.zip` file and execute `chiaki.exe`. * **Switch**: Download the `.nro` file and copy it into the `switch/` directory on your SD card. diff --git a/scripts/Dockerfile.bionic b/scripts/Dockerfile.bionic deleted file mode 100644 index 2548a2d..0000000 --- a/scripts/Dockerfile.bionic +++ /dev/null @@ -1,16 +0,0 @@ - -FROM ubuntu:bionic - -RUN apt-get update -RUN apt-get install -y software-properties-common gpg wget -RUN add-apt-repository ppa:beineri/opt-qt-5.12.10-bionic -COPY kitware-archive-latest.asc /kitware-archive-latest.asc -RUN cat /kitware-archive-latest.asc | gpg --dearmor > /usr/share/keyrings/kitware-archive-keyring.gpg -RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' > /etc/apt/sources.list.d/kitware.list -RUN apt-get update -RUN apt-get -y install git g++ cmake ninja-build curl pkg-config unzip python3-pip \ - libssl-dev libopus-dev qt512base qt512multimedia qt512svg \ - libgl1-mesa-dev nasm libudev-dev libva-dev fuse libevdev-dev libudev-dev - -CMD [] - diff --git a/scripts/Dockerfile.noble b/scripts/Dockerfile.noble new file mode 100644 index 0000000..abc33c3 --- /dev/null +++ b/scripts/Dockerfile.noble @@ -0,0 +1,13 @@ + +FROM ubuntu:noble + +RUN apt-get update +# Hint: python3-setuptools should not be needed with nanopb >= 0.4.9 +RUN apt-get -y install git g++ cmake ninja-build curl pkg-config unzip \ + python3-protobuf protobuf-compiler \ + python3-setuptools \ + libssl-dev libopus-dev qtbase5-dev qtmultimedia5-dev libqt5multimedia5-plugins libqt5svg5-dev \ + libgl1-mesa-dev nasm libudev-dev libva-dev fuse libevdev-dev libudev-dev file + +CMD [] + diff --git a/scripts/build-appimage.sh b/scripts/build-appimage.sh index ab025af..05c0428 100755 --- a/scripts/build-appimage.sh +++ b/scripts/build-appimage.sh @@ -7,8 +7,6 @@ appdir=${1:-`pwd`/appimage/appdir} mkdir appimage -pip3 install --user protobuf==3.19.5 # need support for python 3.6 for running on bionic -scripts/fetch-protoc.sh appimage export PATH="`pwd`/appimage/protoc/bin:$PATH" scripts/build-ffmpeg.sh appimage scripts/build-sdl2.sh appimage @@ -18,7 +16,7 @@ cd build_appimage cmake \ -GNinja \ -DCMAKE_BUILD_TYPE=Release \ - "-DCMAKE_PREFIX_PATH=`pwd`/../appimage/ffmpeg-prefix;`pwd`/../appimage/sdl2-prefix;/opt/qt512" \ + "-DCMAKE_PREFIX_PATH=`pwd`/../appimage/ffmpeg-prefix;`pwd`/../appimage/sdl2-prefix" \ -DCHIAKI_ENABLE_TESTS=ON \ -DCHIAKI_ENABLE_CLI=OFF \ -DCHIAKI_ENABLE_GUI=ON \ @@ -40,9 +38,6 @@ curl -L -O https://github.com/linuxdeploy/linuxdeploy/releases/download/continuo chmod +x linuxdeploy-x86_64.AppImage curl -L -O https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage chmod +x linuxdeploy-plugin-qt-x86_64.AppImage -set +e -source /opt/qt512/bin/qt512-env.sh -set -e export LD_LIBRARY_PATH="`pwd`/sdl2-prefix/lib:$LD_LIBRARY_PATH" export EXTRA_QT_PLUGINS=opengl diff --git a/scripts/build-ffmpeg.sh b/scripts/build-ffmpeg.sh index d00b962..9b6348f 100755 --- a/scripts/build-ffmpeg.sh +++ b/scripts/build-ffmpeg.sh @@ -5,7 +5,7 @@ cd "./$1" shift ROOT="`pwd`" -TAG=n4.3.1 +TAG=n4.3.9 git clone https://git.ffmpeg.org/ffmpeg.git --depth 1 -b $TAG && cd ffmpeg || exit 1 diff --git a/scripts/fetch-protoc.sh b/scripts/fetch-protoc.sh deleted file mode 100755 index e1d2d2f..0000000 --- a/scripts/fetch-protoc.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -set -xe - -cd $(dirname "${BASH_SOURCE[0]}")/.. -cd "./$1" -ROOT="`pwd`" - -URL=https://github.com/protocolbuffers/protobuf/releases/download/v3.9.1/protoc-3.9.1-linux-x86_64.zip - -curl -L "$URL" -o protoc.zip -unzip protoc.zip -d protoc - diff --git a/scripts/kitware-archive-latest.asc b/scripts/kitware-archive-latest.asc deleted file mode 100644 index 2c95d3e..0000000 --- a/scripts/kitware-archive-latest.asc +++ /dev/null @@ -1,64 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- - -mQINBGK0u/sBEADD57vA+Zjb9sEUOM2HlwW8l0OJyxW/G4oxcTIaiC2Iuki5fXN1 -VgQD646hUmUh/eMxRcwMpUpihHLcmQxoFWMFwBmljB9Ext8vgthwJoOSr0UwjRTe -qt8IpgEk+2VTQ5/T2XSu//fhw28rP7k5+fMqdIC/COaM/+jCZC17trSkjFcPcPNY -jyC/p40iPfYPDzMdUZhCcxC4ovtlImI6Bkr0x1/NDdy1FsQ4mxFirvV2a0XgjizY -4r25CpgKkMolf9bjAT3Cx2RGYJ5etnB6Ck74NP0bKQikkeWLo2jmrnix+oU07p2Q -PgjsNw5soIczHwHm6mEtSN7vduqNa6QkGFFce0eDK2NIajxt620HUB53zrtaKj/J -ACwHj6SxCszbbHo83GiULGR+hmkPHnio5ob0gJwjMp6iWcbtgL4y19i+b8J696t+ -LL5IRBKqXM75XmHZW1munrAVeICWjSpQSYbIGEmYlcCtvxIl3VwH4KZUuhO3BAR6 -V5IgFjYIQkz/ngTywY/8KKaxMUWs2wE/lMLnJKPnDgGlvJ+JCPom0wjrdM2xm2WI -+PBAUXe8onw1hB/ozP6/pPN4p/H6+ZsiQ2razJcjgE9AYtGZY8tEB2fi7f5wNeg0 -irTmK363zMkqp7pfZMtARkogKBRzmR/8g+EHT4eFBwd3qm/g0Z98KcNaXwARAQAB -tEVLaXR3YXJlIEFwdCBBcmNoaXZlIEF1dG9tYXRpYyBTaWduaW5nIEtleSAoMjAy -MykgPGRlYmlhbkBraXR3YXJl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asLU1sVmIr1GYu0sySyknFuXooftnsLPY -hcw2gllLNK58XOARsuyWFa+b3NhmrJ+S4+hc0nMlEqsJPE8SksWjCTACtsK0CMnz -DbwDy1R5oV2+nzkRN1Up6341bbXLu6JrWVxegkrVa3mcDU3Z3/3Y4+vzn09lc2vz -wBpygs5ZvOWPPNamQf6QnlnWbjdDdjC+1qJZC5aM66vD7lbpVtDFIbzb+rGuCf3P -mw//angfnJh26pxzDGYkkkPqradV3IGfI36QFCZ6WBL1c8C3/P5gMLS+cswjl+yq -CuwjOLC9LXjSygXJdR4vfKbW9ReOBv9hG9TmDDuR3YmXOYwBcZKxalSrHpC4/n5o -K3a8LX74AHMp7zD9EGuqo0Dr5A0nr5QpgZ4JIWhUNzHKNQEe5lW3Q9tujdZzu9ZT -k6uTRMc+jpyWM6R4/SDo3UE7ClIgXEgswM+vyILFiymSZOxiHQBJFno3bkm1NO8v -+rWrHdy9/1tivQLXh3GWc/uYkytRKgdorbcoZ8D6OOIFaNJlJW6yxZ+V6sAB1K6l -cPOaHch+SGtzPfg5eeW/9QuUuXrDk1M7hvxhV9BBA6Enz7Ns6Zn7gehQSRkUc4aW -HcbkXCxZQzCoUDJPLr7Vw1lrfPgvVfWdxvtgOuDFGmnX4V0xCXI2j4ETtDlyLDi4 -VxoZ9CoyWT99hwEeIr5qa3+4WiMO/3pijKm88gh80thC1udHfNUicv3BG4jrEkyb -k1+2dk9Gath9gs++oymifoRdQP2vrEVb+2Tdxf4AFW/JY+pzOJVL5+sxrX+E5+gT -H5qClep/LdPlgPOYJzldb9aV+t5ku9OkSg30Yoi1+4Y2Rn43zKchL+1YdYJebvAF -btmO4yp5zFUfUjMQ3iRZyQ4VIVQvakojbVfTvMcSW5Vrggk= -=8BHh ------END PGP PUBLIC KEY BLOCK----- diff --git a/scripts/run-podman-build-appimage.sh b/scripts/run-podman-build-appimage.sh index 5dea4b4..5024952 100755 --- a/scripts/run-podman-build-appimage.sh +++ b/scripts/run-podman-build-appimage.sh @@ -3,13 +3,14 @@ set -xe cd "`dirname $(readlink -f ${0})`" -podman build -t chiaki-bionic . -f Dockerfile.bionic +podman build --arch amd64 -t localhost/chiaki-noble . -f Dockerfile.noble cd .. podman run --rm \ + --arch amd64 \ -v "`pwd`:/build/chiaki" \ -w "/build/chiaki" \ --device /dev/fuse \ --cap-add SYS_ADMIN \ - -t chiaki-bionic \ + -t localhost/chiaki-noble \ /bin/bash -c "scripts/build-appimage.sh /build/appdir" diff --git a/scripts/switch/dev-container.sh b/scripts/switch/dev-container.sh new file mode 100755 index 0000000..4cfedb3 --- /dev/null +++ b/scripts/switch/dev-container.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +cd "`dirname $(readlink -f ${0})`/../.." + +podman run --rm \ + -v "`pwd`:/build/chiaki" \ + -w "/build/chiaki" \ + -it \ + quay.io/thestr4ng3r/chiaki-build-switch:v3 \ + /bin/bash diff --git a/scripts/switch/run-podman-build-chiaki.sh b/scripts/switch/run-podman-build-chiaki.sh index 0e8dede..513cdc8 100755 --- a/scripts/switch/run-podman-build-chiaki.sh +++ b/scripts/switch/run-podman-build-chiaki.sh @@ -6,5 +6,5 @@ podman run --rm \ -v "`pwd`:/build/chiaki" \ -w "/build/chiaki" \ -it \ - thestr4ng3r/chiaki-build-switch:v2 \ + quay.io/thestr4ng3r/chiaki-build-switch:v3 \ ${1:-/bin/bash -c "scripts/switch/build.sh"} diff --git a/switch/CMakeLists.txt b/switch/CMakeLists.txt index 4916a2e..3d5639a 100644 --- a/switch/CMakeLists.txt +++ b/switch/CMakeLists.txt @@ -61,17 +61,16 @@ target_include_directories(borealis PUBLIC find_package(glfw3 REQUIRED) find_library(EGL EGL) -find_library(GLAPI glapi) -find_library(DRM_NOUVEAU drm_nouveau) -target_link_libraries(borealis +target_link_libraries(borealis PUBLIC glfw - ${EGL} - ${GLAPI} - ${DRM_NOUVEAU}) + ${EGL}) if(CHIAKI_IS_SWITCH) target_compile_definitions(borealis PUBLIC BOREALIS_RESOURCES="romfs:/") + find_library(GLAPI glapi) + find_library(DRM_NOUVEAU drm_nouveau) + target_link_libraries(borealis PUBLIC ${GLAPI} ${DRM_NOUVEAU}) else() target_compile_definitions(borealis PUBLIC BOREALIS_RESOURCES="./switch/res/") @@ -114,9 +113,7 @@ target_link_libraries(chiaki-borealis if(CHIAKI_IS_SWITCH) # libnx is forced by the switch toolchain find_library(Z z) - find_library(GLAPI glapi) # TODO: make it transitive from borealis - find_library(DRM_NOUVEAU drm_nouveau) # TODO: make it transitive from borealis - target_link_libraries(chiaki-borealis ${Z} ${GLAPI} ${DRM_NOUVEAU}) + target_link_libraries(chiaki-borealis ${Z} ${GLAPI}) endif() install(TARGETS chiaki-borealis diff --git a/switch/include/io.h b/switch/include/io.h index 3c1031d..3bb6fd1 100644 --- a/switch/include/io.h +++ b/switch/include/io.h @@ -67,7 +67,7 @@ class IO // default nintendo switch res int screen_width = 1280; int screen_height = 720; - AVCodec *codec; + const AVCodec *codec; AVCodecContext *codec_context; AVFrame *frame; SDL_AudioDeviceID sdl_audio_device_id = 0; diff --git a/switch/include/settings.h b/switch/include/settings.h index 72fc491..6bcb445 100644 --- a/switch/include/settings.h +++ b/switch/include/settings.h @@ -61,7 +61,6 @@ class Settings }; ConfigurationItem ParseLine(std::string * line, std::string * value); - size_t GetB64encodeSize(size_t); public: // singleton configuration diff --git a/switch/src/main.cpp b/switch/src/main.cpp index 6b7c95e..1dd33de 100644 --- a/switch/src/main.cpp +++ b/switch/src/main.cpp @@ -28,8 +28,6 @@ bool appletMainLoop() // use a custom nintendo switch socket config // chiaki requiers many threads with udp/tcp sockets static const SocketInitConfig g_chiakiSocketInitConfig = { - .bsdsockets_version = 1, - .tcp_tx_buf_size = 0x8000, .tcp_rx_buf_size = 0x10000, .tcp_tx_buf_max_size = 0x40000, diff --git a/switch/src/settings.cpp b/switch/src/settings.cpp index fb39861..7d3300a 100644 --- a/switch/src/settings.cpp +++ b/switch/src/settings.cpp @@ -29,11 +29,7 @@ Settings::ConfigurationItem Settings::ParseLine(std::string *line, std::string * return UNKNOWN; } -size_t Settings::GetB64encodeSize(size_t in) -{ - // calculate base64 buffer size after encode - return ((4 * in / 3) + 3) & ~3; -} +#define B64_ENCODED_SIZE(in) (((4 * in / 3) + 3) & ~3) Settings *Settings::instance = nullptr; @@ -458,8 +454,7 @@ std::string Settings::GetHostRPKey(Host *host) { if(host->rp_key_data || host->registered) { - size_t rp_key_b64_sz = this->GetB64encodeSize(0x10); - char rp_key_b64[rp_key_b64_sz + 1] = { 0 }; + char rp_key_b64[B64_ENCODED_SIZE(0x10) + 1] = { 0 }; ChiakiErrorCode err; err = chiaki_base64_encode( host->rp_key, 0x10, @@ -502,8 +497,7 @@ std::string Settings::GetHostRPRegistKey(Host *host) { if(host->rp_key_data || host->registered) { - size_t rp_regist_key_b64_sz = this->GetB64encodeSize(CHIAKI_SESSION_AUTH_SIZE); - char rp_regist_key_b64[rp_regist_key_b64_sz + 1] = { 0 }; + char rp_regist_key_b64[B64_ENCODED_SIZE(CHIAKI_SESSION_AUTH_SIZE) + 1] = { 0 }; ChiakiErrorCode err; err = chiaki_base64_encode( (uint8_t *)host->rp_regist_key, CHIAKI_SESSION_AUTH_SIZE,