diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml index 72109b5..c62a695 100644 --- a/.builds/freebsd.yml +++ b/.builds/freebsd.yml @@ -1,5 +1,5 @@ -image: freebsd/14.x +image: freebsd/13.x sources: - https://git.sr.ht/~thestr4ng3r/chiaki @@ -7,8 +7,7 @@ sources: packages: - cmake - protobuf - - py311-setuptools # should not be needed with nanopb >= 0.4.9 - - py311-protobuf + - py39-protobuf - opus - qt5-core - qt5-qmake diff --git a/.builds/openbsd.yml b/.builds/openbsd.yml index e1595ac..2f513c0 100644 --- a/.builds/openbsd.yml +++ b/.builds/openbsd.yml @@ -7,7 +7,6 @@ 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 1a94b66..5be248c 100644 --- a/README.md +++ b/README.md @@ -10,17 +10,12 @@ 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. -## Project Status and Contributing +![Screenshot](assets/screenshot.png) + +## Project Status 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 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) +No major updates are planned and contributions are only accepted in special cases. ## Installing @@ -33,7 +28,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 [F-Droid](https://f-droid.org/packages/com.metallic.chiaki/) or download the APK from Sourcehut. +* **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. * **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 new file mode 100644 index 0000000..2548a2d --- /dev/null +++ b/scripts/Dockerfile.bionic @@ -0,0 +1,16 @@ + +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 deleted file mode 100644 index abc33c3..0000000 --- a/scripts/Dockerfile.noble +++ /dev/null @@ -1,13 +0,0 @@ - -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 05c0428..ab025af 100755 --- a/scripts/build-appimage.sh +++ b/scripts/build-appimage.sh @@ -7,6 +7,8 @@ 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 @@ -16,7 +18,7 @@ cd build_appimage cmake \ -GNinja \ -DCMAKE_BUILD_TYPE=Release \ - "-DCMAKE_PREFIX_PATH=`pwd`/../appimage/ffmpeg-prefix;`pwd`/../appimage/sdl2-prefix" \ + "-DCMAKE_PREFIX_PATH=`pwd`/../appimage/ffmpeg-prefix;`pwd`/../appimage/sdl2-prefix;/opt/qt512" \ -DCHIAKI_ENABLE_TESTS=ON \ -DCHIAKI_ENABLE_CLI=OFF \ -DCHIAKI_ENABLE_GUI=ON \ @@ -38,6 +40,9 @@ 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 9b6348f..d00b962 100755 --- a/scripts/build-ffmpeg.sh +++ b/scripts/build-ffmpeg.sh @@ -5,7 +5,7 @@ cd "./$1" shift ROOT="`pwd`" -TAG=n4.3.9 +TAG=n4.3.1 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 new file mode 100755 index 0000000..e1d2d2f --- /dev/null +++ b/scripts/fetch-protoc.sh @@ -0,0 +1,13 @@ +#!/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 new file mode 100644 index 0000000..2c95d3e --- /dev/null +++ b/scripts/kitware-archive-latest.asc @@ -0,0 +1,64 @@ +-----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 +MykgPGRlYmlhbkBraXR3YXJlLmNv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sVmIr1GYu0sySyknFuXooftnsLPY +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 5024952..5dea4b4 100755 --- a/scripts/run-podman-build-appimage.sh +++ b/scripts/run-podman-build-appimage.sh @@ -3,14 +3,13 @@ set -xe cd "`dirname $(readlink -f ${0})`" -podman build --arch amd64 -t localhost/chiaki-noble . -f Dockerfile.noble +podman build -t chiaki-bionic . -f Dockerfile.bionic cd .. podman run --rm \ - --arch amd64 \ -v "`pwd`:/build/chiaki" \ -w "/build/chiaki" \ --device /dev/fuse \ --cap-add SYS_ADMIN \ - -t localhost/chiaki-noble \ + -t chiaki-bionic \ /bin/bash -c "scripts/build-appimage.sh /build/appdir" diff --git a/scripts/switch/dev-container.sh b/scripts/switch/dev-container.sh deleted file mode 100755 index 4cfedb3..0000000 --- a/scripts/switch/dev-container.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/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 513cdc8..0e8dede 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 \ - quay.io/thestr4ng3r/chiaki-build-switch:v3 \ + thestr4ng3r/chiaki-build-switch:v2 \ ${1:-/bin/bash -c "scripts/switch/build.sh"} diff --git a/switch/CMakeLists.txt b/switch/CMakeLists.txt index 3d5639a..4916a2e 100644 --- a/switch/CMakeLists.txt +++ b/switch/CMakeLists.txt @@ -61,16 +61,17 @@ target_include_directories(borealis PUBLIC find_package(glfw3 REQUIRED) find_library(EGL EGL) -target_link_libraries(borealis PUBLIC +find_library(GLAPI glapi) +find_library(DRM_NOUVEAU drm_nouveau) +target_link_libraries(borealis glfw - ${EGL}) + ${EGL} + ${GLAPI} + ${DRM_NOUVEAU}) 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/") @@ -113,7 +114,9 @@ target_link_libraries(chiaki-borealis if(CHIAKI_IS_SWITCH) # libnx is forced by the switch toolchain find_library(Z z) - target_link_libraries(chiaki-borealis ${Z} ${GLAPI}) + 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}) endif() install(TARGETS chiaki-borealis diff --git a/switch/include/io.h b/switch/include/io.h index 3bb6fd1..3c1031d 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; - const AVCodec *codec; + 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 6bcb445..72fc491 100644 --- a/switch/include/settings.h +++ b/switch/include/settings.h @@ -61,6 +61,7 @@ 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 1dd33de..6b7c95e 100644 --- a/switch/src/main.cpp +++ b/switch/src/main.cpp @@ -28,6 +28,8 @@ 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 7d3300a..fb39861 100644 --- a/switch/src/settings.cpp +++ b/switch/src/settings.cpp @@ -29,7 +29,11 @@ Settings::ConfigurationItem Settings::ParseLine(std::string *line, std::string * return UNKNOWN; } -#define B64_ENCODED_SIZE(in) (((4 * in / 3) + 3) & ~3) +size_t Settings::GetB64encodeSize(size_t in) +{ + // calculate base64 buffer size after encode + return ((4 * in / 3) + 3) & ~3; +} Settings *Settings::instance = nullptr; @@ -454,7 +458,8 @@ std::string Settings::GetHostRPKey(Host *host) { if(host->rp_key_data || host->registered) { - char rp_key_b64[B64_ENCODED_SIZE(0x10) + 1] = { 0 }; + size_t rp_key_b64_sz = this->GetB64encodeSize(0x10); + char rp_key_b64[rp_key_b64_sz + 1] = { 0 }; ChiakiErrorCode err; err = chiaki_base64_encode( host->rp_key, 0x10, @@ -497,7 +502,8 @@ std::string Settings::GetHostRPRegistKey(Host *host) { if(host->rp_key_data || host->registered) { - char rp_regist_key_b64[B64_ENCODED_SIZE(CHIAKI_SESSION_AUTH_SIZE) + 1] = { 0 }; + 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 }; ChiakiErrorCode err; err = chiaki_base64_encode( (uint8_t *)host->rp_regist_key, CHIAKI_SESSION_AUTH_SIZE,