Refresh switch to build again

This commit is contained in:
Florian Märkl 2025-06-09 12:20:27 +02:00
parent 94fcdc3c61
commit 4eb90a7a65
7 changed files with 21 additions and 23 deletions

10
scripts/switch/dev-container.sh Executable file
View file

@ -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

View file

@ -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"}

View file

@ -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

View file

@ -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;

View file

@ -61,7 +61,6 @@ class Settings
};
ConfigurationItem ParseLine(std::string * line, std::string * value);
size_t GetB64encodeSize(size_t);
public:
// singleton configuration

View file

@ -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,

View file

@ -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,