### Install MkDocs and Plugins Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/builddocs.md Installs mkdocs and essential plugins for building the chiaki-ng documentation. Requires pip3. ```bash pip3 install mkdocs mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-print-site-plugin ``` -------------------------------- ### Install Flatpak Runtime and SDK Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/buildit.md Installs the necessary Flatpak runtime (org.kde.Platform//6.9), SDK (org.kde.Sdk//6.9), and base app from Flathub. ```bash flatpak install -y flathub org.kde.Platform//6.9 flathub org.kde.Sdk//6.9 ``` -------------------------------- ### Install Flatpak SDK Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/builddocs.md Installs the necessary SDK for Flatpak development. This is a prerequisite for running the devel Flatpak. ```bash flatpak install -y --user org.kde.Sdk//6.9 ``` -------------------------------- ### Install SDK and Debug extensions Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/steamdeckdev.md Installs the required KDE SDK and its corresponding debug extensions for development. ```bash flatpak install --user org.kde.Sdk//6.9 ``` ```bash flatpak install --user org.kde.Sdk.Debug//6.9 ``` -------------------------------- ### Install Chiaki-ng on Windows Source: https://github.com/streetpea/chiaki-ng/blob/main/doc/release_notes.md Installation commands for Windows using winget or chocolatey package managers. ```powershell winget install --id=StreetPea.chiaki-ng -e ``` ```powershell choco install chiaki-ng ``` -------------------------------- ### Command-Line Streaming Example Source: https://context7.com/streetpea/chiaki-ng/llms.txt This example demonstrates how to use the Chiaki-NG command-line tool to discover a PlayStation console and initiate a streaming session. ```APIDOC ## Command-Line Streaming ### Description This section shows how to use the `flatpak run io.github.streetpea.Chiaki4deck` command to discover a PlayStation console and start a streaming session. ### Usage 1. **Wait for console readiness:** The script first checks the status of the console until it is 'ready'. It includes a timeout mechanism to prevent indefinite waiting. 2. **Start streaming session:** Once the console is ready, a streaming session is initiated using the `--passcode` and `stream` arguments, specifying the console name and address. ### Example ```bash # Wait for console to become ready while ! echo "${ps_status}" | grep -q ready; do if [ ${SECONDS} -gt 35 ]; then if echo "${ps_status}" | grep -q standby; then wakeup_error else timeout_error fi fi sleep 1 ps_status="$(flatpak run io.github.streetpea.Chiaki4deck discover -h ${addr} 2>/dev/null)" done # Start streaming session flatpak run io.github.streetpea.Chiaki4deck --passcode 1234 --zoom stream 'PS5-012' ${addr} ``` ``` -------------------------------- ### Install Chiaki-NG via Flatpak (Linux) Source: https://context7.com/streetpea/chiaki-ng/llms.txt Recommended installation method for Linux using Flatpak from Flathub. Ensures easy updates and management. ```bash # Linux Flatpak (recommended) via Flathub flatpak install -y io.github.streetpea.Chiaki4deck ``` -------------------------------- ### Serve Documentation Locally Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/builddocs.md Starts a local development server for the chiaki-ng documentation. Changes are reflected in real-time. ```bash mkdocs serve ``` -------------------------------- ### Install Flatpak Builder on Steam OS Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/buildit.md Installs the flatpak-builder package on Steam OS after GPG key setup. ```bash sudo pacman -Syy && sudo pacman -S flatpak-builder ``` -------------------------------- ### Install Chiaki-NG Devel Flatpak Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/builddocs.md Installs the development version of the Flatpak for chiaki-ng. Requires Flatpak and the SDK. ```bash flatpak install -y --user https://raw.githubusercontent.com/streetpea/chiaki-ng/main/scripts/flatpak/io.github.streetpea.Chiaki4deck-devel.flatpakref ``` -------------------------------- ### Install Chiaki-NG via Winget (Windows) Source: https://context7.com/streetpea/chiaki-ng/llms.txt Installation command for Windows users using the Winget package manager. ```bash # Windows via Winget winget install streetpea.chiaki-ng ``` -------------------------------- ### Install chiaki-ng via Flatpak Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/setup/installation.md Use this command in the terminal if the application is not visible in the Discover store. ```bash flatpak install -y io.github.streetpea.Chiaki4deck ``` -------------------------------- ### Install development flatpak Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/steamdeckdev.md Installs the development version of the Chiaki4deck flatpak with debug extensions. ```bash flatpak install --user --include-debug -y https://raw.githubusercontent.com/streetpea/chiaki-ng/main/scripts/flatpak/io.github.streetpea.Chiaki4deck-devel.flatpakref ``` -------------------------------- ### Start Streaming Session Source: https://context7.com/streetpea/chiaki-ng/llms.txt Launch a streaming session with various display modes, authentication, and profile configurations. ```bash flatpak run io.github.streetpea.Chiaki4deck stream 'PS5-012' 192.168.1.16 flatpak run io.github.streetpea.Chiaki4deck --zoom stream 'PS5-012' 192.168.1.16 flatpak run io.github.streetpea.Chiaki4deck --stretch stream 'PS5-012' 192.168.1.16 flatpak run io.github.streetpea.Chiaki4deck --passcode 1234 stream 'PS5-012' 192.168.1.16 flatpak run io.github.streetpea.Chiaki4deck --profile myprofile stream 'PS5-012' 192.168.1.16 flatpak run io.github.streetpea.Chiaki4deck --exit-app-on-stream-exit stream 'PS5-012' 192.168.1.16 ``` -------------------------------- ### Example Script Template Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/setup/automation.md A template script demonstrating error handling functions for connection failures. ```bash #!/usr/bin/env bash connect_error_loc() { echo "Error: Couldn't connect to your PlayStation console from your local address!" >&2 echo "Error: Please check that your Steam Deck and PlayStation are on the same network" >&2 echo "Error: ...and that you have the right PlayStation IP address or hostname!" >&2 exit 1 } connect_error_ext() { ``` -------------------------------- ### Install Flatpak Dependencies on Arch Linux Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/buildit.md Installs gpg, curl, flatpak, and flatpak-builder on Arch Linux. ```bash sudo pacman -Syy && sudo pacman -S gnupg curl flatpak flatpak-builder ``` -------------------------------- ### Run the Launcher Generator Script Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/setup/automation.md Execute the automated setup script to generate launch configurations. This command requires an active internet connection to download and run the script. ```bash bash <(curl -sLo- https://raw.githubusercontent.com/streetpea/chiaki-ng/main/scripts/gen-launcher.sh) ``` ```bash bash <(curl -sLo- https://raw.githubusercontent.com/streetpea/chiaki-ng/main/scripts/gen-launcher.sh) 1) PlayStation 4 2) PlayStation 5 ``` -------------------------------- ### Install Fedora Build Dependencies Source: https://github.com/streetpea/chiaki-ng/blob/main/doc/platform-build.md Installs necessary development packages on Fedora using dnf. Ensure all listed packages are installed before proceeding with the build. ```bash sudo dnf install cmake make qt5-qtmultimedia-devel qt5-qtsvg-devel qt5-qtbase-gui ffmpeg-devel opus-devel openssl-devel python3-protobuf protobuf-c protobuf-devel qt5-rpm-macros SDL2-devel libevdev-devel systemd-devel speexdsp ``` -------------------------------- ### Chiaki Configuration File Example Source: https://github.com/streetpea/chiaki-ng/blob/main/switch/README.md This is an example of the chiaki.conf file, which is generated by the application and contains sensitive data. Required fields include the PS* name, host address, and PSN online ID. ```ini # required: PS*-*** (PS4/PS5 local name) # name from Settings > System > system information [PS*-***] # required: lan PlayStation IP address # IP from Settings > System > system information host_addr = *.*.* # required: sony oline id (login) psn_online_id = ps_online_id # required (PS4>7.0 Only): https://git.sr.ht/~thestr4ng3r/chiaki/tree/master/item/README.md#obtaining-your-psn-accountid psn_account_id = ps_base64_account_id # optional(default 60): remote play fps (must be 30 or 60) video_fps = 60 # optional(default 720p): remote play resolution (must be 720p, 540p or 360p) video_resolution = 720p ``` -------------------------------- ### Install Flatpak Dependencies on Ubuntu/Debian Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/buildit.md Installs gpg, curl, flatpak, and flatpak-builder on Ubuntu or Debian-based systems. ```bash sudo apt update && sudo apt install -y gnupg curl flatpak flatpak-builder ``` -------------------------------- ### Install Chiaki-NG via Chocolatey (Windows) Source: https://context7.com/streetpea/chiaki-ng/llms.txt Installation command for Windows users using the Chocolatey package manager. ```bash # Windows via Chocolatey choco install chiaki-ng ``` -------------------------------- ### Install Flatpak from Local Remote Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/buildit.md Installs a Flatpak application from a previously added local remote repository. This is useful for testing custom builds. ```bash flatpak --user install chiaki-ng-diy io.github.streetpea.Chiaki4deck ``` -------------------------------- ### Install Flatpak Dependencies on RHEL/CentOS Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/buildit.md Installs gpg, curl, flatpak, and flatpak-builder on RHEL or CentOS-based systems. ```bash sudo yum update && sudo yum install -y gnupg curl flatpak flatpak-builder ``` -------------------------------- ### Automated Launcher Script Source: https://context7.com/streetpea/chiaki-ng/llms.txt A bash script example that detects network status, discovers the console, and wakes it up if necessary. ```bash #!/usr/bin/env bash # Error handling functions connect_error_loc() { echo "Error: Couldn't connect to PlayStation from local address!" >&2 exit 1 } wakeup_error() { echo "Error: Couldn't wake up PlayStation console from sleep!" >&2 exit 2 } timeout_error() { echo "Error: PlayStation didn't become ready in 35 seconds!" >&2 exit 1 } # Network detection - use local or external address if [ "$(iwgetid -r)" == "MyHomeNetwork-5G" ]; then addr="192.168.1.16" local=true else addr="myexternalhost.example.com" local=false fi SECONDS=0 # Wait for console to be discoverable (sleep or ready state) ps_status="$(flatpak run io.github.streetpea.Chiaki4deck discover -h ${addr} 2>/dev/null)" while ! echo "${ps_status}" | grep -q 'ready\|standby'; do if [ ${SECONDS} -gt 35 ]; then connect_error_loc fi sleep 1 ps_status="$(flatpak run io.github.streetpea.Chiaki4deck discover -h ${addr} 2>/dev/null)" done # Wake console if in standby mode if ! echo "${ps_status}" | grep -q ready; then flatpak run io.github.streetpea.Chiaki4deck wakeup -5 -h ${addr} -r '2ebf539d' 2>/dev/null fi ``` -------------------------------- ### Install Chiaki-ng on macOS via Homebrew Source: https://github.com/streetpea/chiaki-ng/blob/main/doc/release_notes.md Use Homebrew to install the Chiaki-ng cask on macOS systems. ```bash brew install --cask streetpea/streetpea/chiaki-ng ``` -------------------------------- ### Chiaki-ng Script with Passcode Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/setup/automation.md Example of how to launch Chiaki-ng with a specific passcode. Replace '1111' with your actual passcode and '192.168.1.16' with your console's IP address. ```bash flatpak run io.github.streetpea.Chiaki4deck --passcode 1111 --zoom stream 'PS5-012' 192.168.1.16 ``` -------------------------------- ### C Library Session API Source: https://context7.com/streetpea/chiaki-ng/llms.txt This C code example demonstrates how to initialize and manage a remote play session using the libchiaki C API, including handling events and video callbacks. ```APIDOC ## C Library Session API ### Description Initialize and manage a remote play session using the libchiaki C API. The session handles video/audio streaming, controller input, and console communication. ### Usage 1. **Include Headers:** Include `` and ``. 2. **Define Callbacks:** Implement `session_event_cb` for handling session events (connected, PIN request, quit, etc.) and `video_sample_cb` for processing video frames. 3. **Initialize Logging:** Set up the `ChiakiLog` structure. 4. **Configure Connection:** Populate `ChiakiConnectInfo` with host, PS5 status, registration keys, and video profile settings. 5. **Initialize Session:** Call `chiaki_session_init` with the connection info and log structure. 6. **Set Callbacks:** Register the event and video sample callbacks using `chiaki_session_set_event_cb` and `chiaki_session_set_video_sample_cb`. 7. **Start Session:** Initiate the session thread with `chiaki_session_start`. 8. **Join Session:** Wait for the session to complete using `chiaki_session_join`. 9. **Cleanup:** Finalize the session with `chiaki_session_fini`. ### Example ```c #include #include // Event callback for session events void session_event_cb(ChiakiEvent *event, void *user) { switch(event->type) { case CHIAKI_EVENT_CONNECTED: printf("Connected to PlayStation!\n"); break; case CHIAKI_EVENT_LOGIN_PIN_REQUEST: printf("Login PIN requested (incorrect: %d)\n", event->login_pin_request.pin_incorrect); // Call chiaki_session_set_login_pin() with PIN break; case CHIAKI_EVENT_QUIT: printf("Session quit: %s\n", chiaki_quit_reason_string(event->quit.reason)); break; case CHIAKI_EVENT_RUMBLE: printf("Rumble: left=%d, right=%d\n", event->rumble.left, event->rumble.right); break; case CHIAKI_EVENT_TRIGGER_EFFECTS: // Handle DualSense adaptive trigger effects break; } } // Video sample callback bool video_sample_cb(uint8_t *buf, size_t buf_size, int32_t frames_lost, bool frame_recovered, void *user) { // Decode and render video frame // Return true if successfully processed return true; } int main() { ChiakiLog log; chiaki_log_init(&log, CHIAKI_LOG_ALL & ~CHIAKI_LOG_VERBOSE, chiaki_log_cb_print, NULL); // Configure connection ChiakiConnectInfo connect_info = {0}; connect_info.ps5 = true; connect_info.host = "192.168.1.16"; // Fill regist_key from registration (pad with \0 to 16 bytes) memcpy(connect_info.regist_key, "2ebf539d", 8); // Fill morning key from registration // memcpy(connect_info.morning, morning_key, 16); // Configure video profile chiaki_connect_video_profile_preset(&connect_info.video_profile, CHIAKI_VIDEO_RESOLUTION_PRESET_1080p, CHIAKI_VIDEO_FPS_PRESET_60); connect_info.video_profile_auto_downgrade = true; connect_info.enable_dualsense = true; // Initialize session ChiakiSession session; ChiakiErrorCode err = chiaki_session_init(&session, &connect_info, &log); if(err != CHIAKI_ERR_SUCCESS) { printf("Failed to init session: %s\n", chiaki_error_string(err)); return 1; } // Set callbacks chiaki_session_set_event_cb(&session, session_event_cb, NULL); chiaki_session_set_video_sample_cb(&session, video_sample_cb, NULL); // Start session thread err = chiaki_session_start(&session); if(err != CHIAKI_ERR_SUCCESS) { printf("Failed to start session: %s\n", chiaki_error_string(err)); chiaki_session_fini(&session); return 1; } // Wait for session to complete chiaki_session_join(&session); chiaki_session_fini(&session); return 0; } ``` ``` -------------------------------- ### Build Chiaki NG with CMake on Fedora Source: https://github.com/streetpea/chiaki-ng/blob/main/doc/platform-build.md Standard CMake build process for Chiaki NG after dependencies are installed. This includes updating submodules, creating a build directory, configuring with CMake, and compiling. ```bash git submodule update --init mkdir build && cd build cmake .. make ``` -------------------------------- ### Wait for Console Ready and Start Streaming (Bash) Source: https://context7.com/streetpea/chiaki-ng/llms.txt This script waits for the console status to be 'ready' before initiating a streaming session. It includes error handling for timeouts and standby states. Ensure the 'addr' variable is set to the console's IP address. ```bash while ! echo "${ps_status}" | grep -q ready; do if [ ${SECONDS} -gt 35 ]; then if echo "${ps_status}" | grep -q standby; then wakeup_error else timeout_error fi fi sleep 1 ps_status="$(flatpak run io.github.streetpea.Chiaki4deck discover -h ${addr} 2>/dev/null)" done # Start streaming session flatpak run io.github.streetpea.Chiaki4deck --passcode 1234 --zoom stream 'PS5-012' ${addr} ``` -------------------------------- ### Build Chiaki-NG from Source (Flatpak) Source: https://context7.com/streetpea/chiaki-ng/llms.txt Steps to build Chiaki-NG from source for Flatpak, including downloading the manifest and building the package. ```bash # Build from source (Flatpak) mkdir -p ~/build-chiaki-ng && cd ~/build-chiaki-ng curl -Lo chiaki-ng.yaml https://raw.githubusercontent.com/streetpea/chiaki-ng/main/scripts/flatpak/chiaki4deck.yaml flatpak install -y flathub org.kde.Platform//6.9 flathub org.kde.Sdk//6.9 flatpak-builder --repo=chiaki-ng-repo --force-clean build chiaki-ng.yaml flatpak --user remote-add --no-gpg-verify chiaki-ng-local chiaki-ng-repo flatpak --user install chiaki-ng-local io.github.streetpea.Chiaki4deck ``` -------------------------------- ### Configure MbedTLS with FetchContent Source: https://github.com/streetpea/chiaki-ng/blob/main/CMakeLists.txt Downloads and configures MbedTLS using FetchContent if enabled. ```cmake if(CHIAKI_LIB_ENABLE_MBEDTLS) add_definitions(-DCHIAKI_LIB_ENABLE_MBEDTLS) if(CHIAKI_LIB_MBEDTLS_EXTERNAL_PROJECT) set(FETCHCONTENT_QUIET CACHE BOOL FALSE) include(FetchContent) set(ENABLE_TESTING CACHE INTERNAL OFF) set(ENABLE_PROGRAMS CACHE INTERNAL OFF) set(USE_SHARED_MBEDTLS_LIBRARY CACHE INTERNAL OFF) FetchContent_Declare( mbedtls GIT_REPOSITORY https://github.com/Mbed-TLS/mbedtls.git GIT_TAG 8b3f26a5ac38d4fdccbc5c5366229f3e01dafcc0 # v2.28.0 GIT_PROGRESS TRUE ) FetchContent_MakeAvailable(mbedtls) endif() endif() ``` -------------------------------- ### Create Launcher Script File Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/setup/automation.md Initializes the blank shell script file required for the Chiaki-ng launcher configuration. ```bash touch "${HOME}/.var/app/io.github.streetpea.Chiaki4deck/config/Chiaki/Chiaki-launcher.sh" ``` -------------------------------- ### Install VA-API Drivers on Fedora Source: https://github.com/streetpea/chiaki-ng/blob/main/doc/platform-build.md Installs VA-API drivers for hardware decoding on Fedora, specific to GPU vendor. Choose the appropriate driver for your Intel, AMD, or Nvidia GPU. ```bash libva-intel-driver libva-intel-hybrid-driver libva-vdpau-driver ``` -------------------------------- ### Initialize and Manage Remote Play Session (C Library) Source: https://context7.com/streetpea/chiaki-ng/llms.txt This C code demonstrates initializing and managing a remote play session using the libchiaki C API. It includes setting up connection information, configuring video profiles, and handling session events via callbacks. Ensure necessary headers are included and the 'regist_key' is correctly populated. ```c #include #include // Event callback for session events void session_event_cb(ChiakiEvent *event, void *user) { switch(event->type) { case CHIAKI_EVENT_CONNECTED: printf("Connected to PlayStation!\n"); break; case CHIAKI_EVENT_LOGIN_PIN_REQUEST: printf("Login PIN requested (incorrect: %d)\n", event->login_pin_request.pin_incorrect); // Call chiaki_session_set_login_pin() with PIN break; case CHIAKI_EVENT_QUIT: printf("Session quit: %s\n", chiaki_quit_reason_string(event->quit.reason)); break; case CHIAKI_EVENT_RUMBLE: printf("Rumble: left=%d, right=%d\n", event->rumble.left, event->rumble.right); break; case CHIAKI_EVENT_TRIGGER_EFFECTS: // Handle DualSense adaptive trigger effects break; } } // Video sample callback bool video_sample_cb(uint8_t *buf, size_t buf_size, int32_t frames_lost, bool frame_recovered, void *user) { // Decode and render video frame // Return true if successfully processed return true; } int main() { ChiakiLog log; chiaki_log_init(&log, CHIAKI_LOG_ALL & ~CHIAKI_LOG_VERBOSE, chiaki_log_cb_print, NULL); // Configure connection ChiakiConnectInfo connect_info = {0}; connect_info.ps5 = true; connect_info.host = "192.168.1.16"; // Fill regist_key from registration (pad with \0 to 16 bytes) memcpy(connect_info.regist_key, "2ebf539d", 8); // Fill morning key from registration // memcpy(connect_info.morning, morning_key, 16); // Configure video profile chiaki_connect_video_profile_preset(&connect_info.video_profile, CHIAKI_VIDEO_RESOLUTION_PRESET_1080p, CHIAKI_VIDEO_FPS_PRESET_60); connect_info.video_profile_auto_downgrade = true; connect_info.enable_dualsense = true; // Initialize session ChiakiSession session; ChiakiErrorCode err = chiaki_session_init(&session, &connect_info, &log); if(err != CHIAKI_ERR_SUCCESS) { printf("Failed to init session: %s\n", chiaki_error_string(err)); return 1; } // Set callbacks chiaki_session_set_event_cb(&session, session_event_cb, NULL); chiaki_session_set_video_sample_cb(&session, video_sample_cb, NULL); // Start session thread err = chiaki_session_start(&session); if(err != CHIAKI_ERR_SUCCESS) { printf("Failed to start session: %s\n", chiaki_error_string(err)); chiaki_session_fini(&session); return 1; } // Wait for session to complete chiaki_session_join(&session); chiaki_session_fini(&session); return 0; } ``` -------------------------------- ### Initialize GPG Keyring on Steam OS Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/buildit.md Initializes the pacman GPG keyring on Steam OS. ```bash sudo pacman-key --init ``` -------------------------------- ### Copy configuration files Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/steamdeckdev.md Copies the existing Chiaki configuration to the development flatpak instance. ```bash cp ~/.var/app/io.github.streetpea.Chiaki4deck/config/Chiaki/Chiaki.conf ~/.var/app/io.github.streetpea.Chiaki4deck-devel/config/Chiaki/Chiaki.conf ``` -------------------------------- ### Update Chiaki-NG via Flatpak (Linux) Source: https://context7.com/streetpea/chiaki-ng/llms.txt Command to update an existing Chiaki-NG installation managed by Flatpak. ```bash # Update existing installation flatpak update -y io.github.streetpea.Chiaki4deck ``` -------------------------------- ### Re-enable Read-Only Mode on Steam OS Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/buildit.md Re-enables the read-only filesystem on Steam OS after package installation. ```bash sudo steamos-readonly enable ``` -------------------------------- ### Enter development flatpak environment Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/steamdeckdev.md Launches a bash shell inside the development flatpak container. ```bash flatpak run --command=bash --devel io.github.streetpea.Chiaki4deck-devel ``` -------------------------------- ### Configure libsetsu Build Source: https://github.com/streetpea/chiaki-ng/blob/main/setsu/CMakeLists.txt Sets up the minimum CMake version, project name, and module path. This is the initial configuration for the build system. ```cmake cmake_minimum_required(VERSION 3.2) project(libsetsu) ``` ```cmake option(SETSU_BUILD_DEMOS "Build testing executables for libsetsu" OFF) ``` ```cmake list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") ``` -------------------------------- ### Configure Setsu and GUI dependencies Source: https://github.com/streetpea/chiaki-ng/blob/main/CMakeLists.txt Handles SDL2 requirements and Setsu input library dependencies. ```cmake if(CHIAKI_ENABLE_GUI) find_package(SDL2 MODULE REQUIRED) endif() ``` ```cmake if(CHIAKI_ENABLE_SETSU) if(CHIAKI_ENABLE_SETSU STREQUAL AUTO AND SDL2_FOUND AND (SDL2_VERSION_MINOR GREATER 0 OR SDL2_VERSION_PATCH GREATER_EQUAL 14)) message(STATUS "SDL version ${SDL2_VERSION} is >= 2.0.14, disabling Setsu") set(CHIAKI_ENABLE_SETSU OFF) else() find_package(Udev QUIET) find_package(Evdev QUIET) if(Udev_FOUND AND Evdev_FOUND) set(CHIAKI_ENABLE_SETSU ON) else() if(NOT CHIAKI_ENABLE_SETSU STREQUAL AUTO) message(FATAL_ERROR " CHIAKI_ENABLE_SETSU is set to ON, but its dependencies (udev and evdev) could not be resolved. Keep in mind that setsu is only supported on Linux!") endif() set(CHIAKI_ENABLE_SETSU OFF) endif() if(CHIAKI_ENABLE_SETSU) add_subdirectory(setsu) endif() endif() endif() ``` -------------------------------- ### Disable Read-Only Mode on Steam OS Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/buildit.md Temporarily disables the read-only filesystem on Steam OS to allow package installation. ```bash sudo steamos-readonly disable ``` -------------------------------- ### Build Chiaki-NG Flatpak Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/buildit.md Builds the Chiaki-NG Flatpak using the specified repository, manifest file, and GPG signing key. --force-clean ensures a clean build environment. ```bash flatpak-builder --repo=chiaki-ng-diy --force-clean build chiaki-ng.yaml --gpg-sign chiaki-ng-diy ``` -------------------------------- ### Clone Repository via GitHub CLI Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/builddocs.md Clones the chiaki-ng repository using the GitHub CLI. Requires the GitHub CLI to be installed. ```bash gh repo clone streetpea/chiaki-ng ``` -------------------------------- ### Update Chiaki-NG Flatpak (Legacy) Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/updates/releases.md Update chiaki-ng installed via the legacy konsole repository. Use this command if you have not yet migrated to Flathub. ```bash flatpak update --user -y re.chiaki.Chiaki4deck ``` -------------------------------- ### Build Optional Demo Executables Source: https://github.com/streetpea/chiaki-ng/blob/main/setsu/CMakeLists.txt Conditionally builds 'setsu-demo-touchpad' and 'setsu-demo-motion' executables if SETSU_BUILD_DEMOS is enabled. These demos are linked against the 'setsu' library. ```cmake if(SETSU_BUILD_DEMOS) add_executable(setsu-demo-touchpad demo/touchpad.c) target_link_libraries(setsu-demo-touchpad setsu) add_executable(setsu-demo-motion demo/motion.c) target_link_libraries(setsu-demo-motion setsu) endif() ``` -------------------------------- ### Update Chiaki-NG Flatpak (Flathub) Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/updates/releases.md Update chiaki-ng installed via Flathub using the Discover store or the konsole. This command ensures you have the latest version from the Flathub repository. ```bash flatpak update -y io.github.streetpea.Chiaki4deck ``` -------------------------------- ### Create Build Directory Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/buildit.md Creates a directory for build files and changes the current directory to it. ```bash mkdir -p ~/build-chiaki-ng-flatpak && cd ~/build-chiaki-ng-flatpak ``` -------------------------------- ### Troubleshoot Chiaki Build with addr2line Source: https://github.com/streetpea/chiaki-ng/blob/main/switch/README.md Use addr2line to decode backtrace addresses during troubleshooting. Replace 0xCCB5C with the actual backtrace address (PC - Backtrace Start Address). ```bash # replace 0xCCB5C with the backtrace adress (PC - Backtrace Start Address) aarch64-none-elf-addr2line \ -e ./build_switch/switch/chiaki \ -f -p -C -a 0xCCB5C ``` -------------------------------- ### Find and Link Oboe Audio Library Source: https://github.com/streetpea/chiaki-ng/blob/main/android/app/CMakeLists.txt Finds the Oboe audio library, which is required for low-latency audio operations on Android, and links it to the 'chiaki-jni' target. Ensure Oboe is installed and discoverable by CMake. ```cmake find_package (oboe REQUIRED CONFIG) target_link_libraries(chiaki-jni oboe::oboe) ``` -------------------------------- ### Run and debug executables Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/steamdeckdev.md Commands to execute the built binary, optionally using gdb for debugging. ```bash gdb ./gui/chiaki ``` ```bash ./gui/chiaki ``` -------------------------------- ### Push Chiaki Build to Switch Netloader Source: https://github.com/streetpea/chiaki-ng/blob/main/switch/README.md Use this script to push the built Chiaki application to your Switch's Netloader. Replace X.X.X.X with your Switch's IP address. ```bash # where X.X.X.X is the IP of your switch bash scripts/switch/push-podman-build-chiaki.sh -a 192.168.0.200 ``` -------------------------------- ### Build Chiaki for Nintendo Switch Source: https://github.com/streetpea/chiaki-ng/blob/main/switch/README.md Execute this command to build the Chiaki project for the Nintendo Switch using the provided script. Ensure DevKitPro is set up. ```bash bash scripts/switch/run-podman-build-chiaki.sh ``` -------------------------------- ### Build chiaki-ng with CMake Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/steamdeckdev.md Commands to configure and build the project for Debug or Release targets. ```bash mkdir Debug ``` ```bash cd Debug ``` ```bash cmake -DCMAKE_BUILD_TYPE=Debug .. ``` ```bash make ``` ```bash mkdir Release ``` ```bash cd Release ``` ```bash cmake -DCMAKE_BUILD_TYPE=Release .. ``` ```bash make ``` -------------------------------- ### Run Chiaki-NG via Flatpak Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/setup/configuration.md Execute chiaki-ng from the command line using its Flatpak identifier. This is useful if the application does not appear in your system's game or application menu. ```bash flatpak run io.github.streetpea.chiaki-ng ``` -------------------------------- ### Download Chiaki-NG Flatpak Manifest Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/diy/buildit.md Downloads the flatpak manifest file for chiaki-ng from the specified URL. ```bash curl -Lo chiaki-ng.yaml https://raw.githubusercontent.com/streetpea/chiaki-ng/main/scripts/flatpak/chiaki4deck.yaml ``` -------------------------------- ### Run Chiaki-ng Script Source: https://github.com/streetpea/chiaki-ng/blob/main/docs/setup/automation.md Command to execute the Chiaki-ng launcher script after making it executable. This will initiate the remote play session. ```bash "${HOME}/.var/app/io.github.streetpea.Chiaki4deck/config/Chiaki/Chiaki-launcher.sh" ``` -------------------------------- ### Build libsetsu Library Source: https://github.com/streetpea/chiaki-ng/blob/main/setsu/CMakeLists.txt Defines the main library 'setsu' with its header and source files, and specifies public include directories. This is essential for creating the core library. ```cmake add_library(setsu include/setsu.h src/setsu.c) ``` ```cmake target_include_directories(setsu PUBLIC include) ```