From 4eb90a7a658c93bca3b681b9d8e4282f21258b4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Mon, 9 Jun 2025 12:20:27 +0200 Subject: [PATCH] Refresh switch to build again --- scripts/switch/dev-container.sh | 10 ++++++++++ scripts/switch/run-podman-build-chiaki.sh | 2 +- switch/CMakeLists.txt | 15 ++++++--------- switch/include/io.h | 2 +- switch/include/settings.h | 1 - switch/src/main.cpp | 2 -- switch/src/settings.cpp | 12 +++--------- 7 files changed, 21 insertions(+), 23 deletions(-) create mode 100755 scripts/switch/dev-container.sh 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,