This commit is contained in:
PJarczak 2026-04-07 01:55:22 +02:00
parent 3d1d16331d
commit 2e724fb0ae
10 changed files with 684 additions and 391 deletions

View file

@ -145,6 +145,50 @@ jobs:
shell: pwsh
run: .\build_release_vs.bat slicer
- name: Ensure WSL is available for runtime validation
shell: pwsh
run: |
$wsl = Join-Path $env:WINDIR 'System32\wsl.exe'
if (!(Test-Path $wsl)) { throw 'wsl.exe not found' }
$ready = $false
try {
& $wsl --status
if ($LASTEXITCODE -eq 0) { $ready = $true }
} catch {}
if (-not $ready) {
& $wsl --install --no-distribution
if ($LASTEXITCODE -ne 0) { throw 'wsl --install --no-distribution failed' }
}
& $wsl --update
if ($LASTEXITCODE -ne 0) { throw 'wsl --update failed' }
& $wsl --status
if ($LASTEXITCODE -ne 0) { throw 'WSL is still not ready after install/update' }
- name: Show packaged Orca runtime files
shell: pwsh
run: |
Get-ChildItem -Force "$env:GITHUB_WORKSPACE\build\OrcaSlicer" | Format-Table Name, Length -AutoSize
- name: Install bundled WSL2 Orca runtime into live plugins dir
shell: pwsh
run: |
& "$env:GITHUB_WORKSPACE\build\OrcaSlicer\install_runtime.ps1" -ReplaceExisting
- name: Show live Orca plugin dir after installer
shell: pwsh
run: |
Get-ChildItem -Force "$env:APPDATA\OrcaSlicer\plugins" | Format-Table Name, Length -AutoSize
- name: Validate live Orca plugin dir bootstrap package
shell: pwsh
run: |
& "$env:APPDATA\OrcaSlicer\plugins\verify_runtime.ps1" -PackageDir "$env:APPDATA\OrcaSlicer\plugins" -PluginCacheDir "$env:APPDATA\OrcaSlicer\plugins" -AllowMissingLinuxPlugin
- name: Create installer Win
working-directory: ${{ github.workspace }}/build
shell: pwsh

1
.gitignore vendored
View file

@ -26,7 +26,6 @@ deps/build*/*
install_*
!tools/pjarczak_bambu_runtime/wsl/install_runtime.ps1
!tools/pjarczak_bambu_runtime/wsl/install_runtime.cmd
tools/pjarczak_bambu_runtime/rootfs/windows-wsl2-rootfs.tar
build_*/
SVG
src/OrcaSlicer-doc/

View file

@ -1,263 +1,283 @@
@REM OrcaSlicer build script for Windows with VS auto-detect
@echo off
set WP=%CD%
set _START_TIME=%TIME%
@REM Check for Ninja Multi-Config option (-x)
set USE_NINJA=0
for %%a in (%*) do (
if "%%a"=="-x" set USE_NINJA=1
)
if "%USE_NINJA%"=="1" (
echo Using Ninja Multi-Config generator
set CMAKE_GENERATOR="Ninja Multi-Config"
set VS_VERSION=Ninja
goto :generator_ready
)
@REM Detect Visual Studio version using msbuild
echo Detecting Visual Studio version using msbuild...
@REM Try to get MSBuild version - the output format varies by VS version
set VS_MAJOR=
for /f "tokens=*" %%i in ('msbuild -version 2^>^&1 ^| findstr /r "^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"') do (
for /f "tokens=1 delims=." %%a in ("%%i") do set VS_MAJOR=%%a
set MSBUILD_OUTPUT=%%i
goto :version_found
)
@REM Alternative method for newer MSBuild versions
if "%VS_MAJOR%"=="" (
for /f "tokens=*" %%i in ('msbuild -version 2^>^&1 ^| findstr /r "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"') do (
for /f "tokens=1 delims=." %%a in ("%%i") do set VS_MAJOR=%%a
set MSBUILD_OUTPUT=%%i
goto :version_found
)
)
:version_found
echo MSBuild version detected: %MSBUILD_OUTPUT%
echo Major version: %VS_MAJOR%
if "%VS_MAJOR%"=="" (
echo Error: Could not determine Visual Studio version from msbuild
echo Please ensure Visual Studio and MSBuild are properly installed
exit /b 1
)
if "%VS_MAJOR%"=="16" (
set VS_VERSION=2019
set CMAKE_GENERATOR="Visual Studio 16 2019"
) else if "%VS_MAJOR%"=="17" (
set VS_VERSION=2022
set CMAKE_GENERATOR="Visual Studio 17 2022"
) else if "%VS_MAJOR%"=="18" (
set VS_VERSION=2026
set CMAKE_GENERATOR="Visual Studio 18 2026"
) else (
echo Error: Unsupported Visual Studio version: %VS_MAJOR%
echo Supported versions: VS2019 (16.x^), VS2022 (17.x^), VS2026 (18.x^)
exit /b 1
)
echo Detected Visual Studio %VS_VERSION% (version %VS_MAJOR%)
echo Using CMake generator: %CMAKE_GENERATOR%
:generator_ready
@REM Pack deps
if "%1"=="pack" (
setlocal ENABLEDELAYEDEXPANSION
cd %WP%/deps/build
for /f "tokens=2-4 delims=/ " %%a in ('date /t') do set build_date=%%c%%b%%a
echo packing deps: OrcaSlicer_dep_win64_!build_date!_vs!VS_VERSION!.zip
%WP%/tools/7z.exe a OrcaSlicer_dep_win64_!build_date!_vs!VS_VERSION!.zip OrcaSlicer_dep
goto :done
)
set debug=OFF
set debuginfo=OFF
if "%1"=="debug" set debug=ON
if "%2"=="debug" set debug=ON
if "%1"=="debuginfo" set debuginfo=ON
if "%2"=="debuginfo" set debuginfo=ON
if "%debug%"=="ON" (
set build_type=Debug
set build_dir=build-dbg
) else (
if "%debuginfo%"=="ON" (
set build_type=RelWithDebInfo
set build_dir=build-dbginfo
) else (
set build_type=Release
set build_dir=build
)
)
echo build type set to %build_type%
call :resolve_wsl_rootfs
if errorlevel 1 exit /b 1
setlocal DISABLEDELAYEDEXPANSION
cd deps
mkdir %build_dir%
cd %build_dir%
set "SIG_FLAG="
if defined ORCA_UPDATER_SIG_KEY set "SIG_FLAG=-DORCA_UPDATER_SIG_KEY=%ORCA_UPDATER_SIG_KEY%"
if "%1"=="slicer" (
GOTO :slicer
)
echo "building deps.."
echo on
REM Set minimum CMake policy to avoid <3.5 errors
set CMAKE_POLICY_VERSION_MINIMUM=3.5
if "%USE_NINJA%"=="1" (
cmake ../ -G %CMAKE_GENERATOR% -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target deps
) else (
cmake ../ -G %CMAKE_GENERATOR% -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target deps -- -m
)
@echo off
if "%1"=="deps" goto :done
:slicer
echo "building Orca Slicer..."
cd %WP%
mkdir %build_dir%
cd %build_dir%
echo on
set CMAKE_POLICY_VERSION_MINIMUM=3.5
if "%USE_NINJA%"=="1" (
cmake .. -G %CMAKE_GENERATOR% -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target ALL_BUILD
) else (
cmake .. -G %CMAKE_GENERATOR% -A x64 -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target ALL_BUILD -- -m
)
@echo off
cd ..
call scripts/run_gettext.bat
cd %build_dir%
cmake --build . --target install --config %build_type%
call :copy_linux_bridge_runtime
if errorlevel 1 exit /b 1
:done
@echo off
for /f "tokens=1-3 delims=:.," %%a in ("%_START_TIME: =0%") do set /a "_start_s=%%a*3600+%%b*60+%%c"
for /f "tokens=1-3 delims=:.," %%a in ("%TIME: =0%") do set /a "_end_s=%%a*3600+%%b*60+%%c"
set /a "_elapsed=_end_s - _start_s"
if %_elapsed% lss 0 set /a "_elapsed+=86400"
set /a "_hours=_elapsed / 3600"
set /a "_remainder=_elapsed - _hours * 3600"
set /a "_mins=_remainder / 60"
set /a "_secs=_remainder - _mins * 60"
echo.
echo Build completed in %_hours%h %_mins%m %_secs%s
exit /b 0
:resolve_wsl_rootfs
set "ROOTFS_TAR_RESOLVED="
if defined PJARCZAK_WSL_ROOTFS_TAR (
if exist "%PJARCZAK_WSL_ROOTFS_TAR%" (
set "ROOTFS_TAR_RESOLVED=%PJARCZAK_WSL_ROOTFS_TAR%"
goto :resolve_wsl_rootfs_done
)
echo PJARCZAK_WSL_ROOTFS_TAR is set but file does not exist:
echo %PJARCZAK_WSL_ROOTFS_TAR%
exit /b 1
)
if exist "%WP%\tools\pjarczak_bambu_runtime\rootfs\windows-wsl2-rootfs.tar" (
set "ROOTFS_TAR_RESOLVED=%WP%\tools\pjarczak_bambu_runtime\rootfs\windows-wsl2-rootfs.tar"
goto :resolve_wsl_rootfs_done
)
if exist "%WP%\tools\pjarczak_bambu_runtime\windows-wsl2-rootfs.tar" (
set "ROOTFS_TAR_RESOLVED=%WP%\tools\pjarczak_bambu_runtime\windows-wsl2-rootfs.tar"
goto :resolve_wsl_rootfs_done
)
echo Missing windows-wsl2-rootfs.tar.
echo Provide one of:
echo %WP%\tools\pjarczak_bambu_runtime\rootfs\windows-wsl2-rootfs.tar
echo %WP%\tools\pjarczak_bambu_runtime\windows-wsl2-rootfs.tar
echo or set PJARCZAK_WSL_ROOTFS_TAR to a valid tar file path.
exit /b 1
:resolve_wsl_rootfs_done
exit /b 0
:copy_linux_bridge_runtime
set "INSTALL_DIR=%WP%\%build_dir%\OrcaSlicer"
set "HOST_RUNTIME_DIR=%WP%\tools\pjarczak_bambu_linux_host\runtime\linux-x86_64"
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host" (
echo Missing linux host runtime: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host
echo Build it first on Linux with:
echo tools\pjarczak_bambu_linux_host\package_linux_host_runtime.sh
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host.runtime" (
echo Missing linux host runtime directory: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host.runtime
exit /b 1
)
if not exist "%ROOTFS_TAR_RESOLVED%" (
echo Missing WSL rootfs tar: %ROOTFS_TAR_RESOLVED%
exit /b 1
)
if not exist "%INSTALL_DIR%" (
echo Missing install directory: %INSTALL_DIR%
exit /b 1
)
if not exist "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" (
if exist "%WP%\%build_dir%\pjarczak_bambu_networking_bridge.dll" (
copy /Y "%WP%\%build_dir%\pjarczak_bambu_networking_bridge.dll" "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" >nul
)
)
if not exist "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" (
if exist "%WP%\%build_dir%\src\%build_type%\pjarczak_bambu_networking_bridge.dll" (
copy /Y "%WP%\%build_dir%\src\%build_type%\pjarczak_bambu_networking_bridge.dll" "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" >nul
)
)
if not exist "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" (
echo Missing bridge DLL in install output: %INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll
exit /b 1
)
copy /Y "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host" "%INSTALL_DIR%\pjarczak_bambu_linux_host" >nul
if errorlevel 1 (
echo Failed to copy linux host binary into %INSTALL_DIR%
exit /b 1
)
copy /Y "%ROOTFS_TAR_RESOLVED%" "%INSTALL_DIR%\windows-wsl2-rootfs.tar" >nul
if errorlevel 1 (
echo Failed to copy WSL rootfs tar into %INSTALL_DIR%
exit /b 1
)
if exist "%INSTALL_DIR%\pjarczak_bambu_linux_host.runtime" (
rmdir /S /Q "%INSTALL_DIR%\pjarczak_bambu_linux_host.runtime"
)
xcopy "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host.runtime" "%INSTALL_DIR%\pjarczak_bambu_linux_host.runtime\\" /E /I /Y >nul
if errorlevel 4 (
echo Failed to copy linux host runtime directory into %INSTALL_DIR%
exit /b 1
)
exit /b 0
@REM OrcaSlicer build script for Windows with VS auto-detect
@echo off
set WP=%CD%
set _START_TIME=%TIME%
@REM Check for Ninja Multi-Config option (-x)
set USE_NINJA=0
for %%a in (%*) do (
if "%%a"=="-x" set USE_NINJA=1
)
if "%USE_NINJA%"=="1" (
echo Using Ninja Multi-Config generator
set CMAKE_GENERATOR="Ninja Multi-Config"
set VS_VERSION=Ninja
goto :generator_ready
)
@REM Detect Visual Studio version using msbuild
echo Detecting Visual Studio version using msbuild...
@REM Try to get MSBuild version - the output format varies by VS version
set VS_MAJOR=
for /f "tokens=*" %%i in ('msbuild -version 2^>^&1 ^| findstr /r "^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"') do (
for /f "tokens=1 delims=." %%a in ("%%i") do set VS_MAJOR=%%a
set MSBUILD_OUTPUT=%%i
goto :version_found
)
@REM Alternative method for newer MSBuild versions
if "%VS_MAJOR%"=="" (
for /f "tokens=*" %%i in ('msbuild -version 2^>^&1 ^| findstr /r "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"') do (
for /f "tokens=1 delims=." %%a in ("%%i") do set VS_MAJOR=%%a
set MSBUILD_OUTPUT=%%i
goto :version_found
)
)
:version_found
echo MSBuild version detected: %MSBUILD_OUTPUT%
echo Major version: %VS_MAJOR%
if "%VS_MAJOR%"=="" (
echo Error: Could not determine Visual Studio version from msbuild
echo Please ensure Visual Studio and MSBuild are properly installed
exit /b 1
)
if "%VS_MAJOR%"=="16" (
set VS_VERSION=2019
set CMAKE_GENERATOR="Visual Studio 16 2019"
) else if "%VS_MAJOR%"=="17" (
set VS_VERSION=2022
set CMAKE_GENERATOR="Visual Studio 17 2022"
) else if "%VS_MAJOR%"=="18" (
set VS_VERSION=2026
set CMAKE_GENERATOR="Visual Studio 18 2026"
) else (
echo Error: Unsupported Visual Studio version: %VS_MAJOR%
echo Supported versions: VS2019 ^(16.x^), VS2022 ^(17.x^), VS2026 ^(18.x^)
exit /b 1
)
echo Detected Visual Studio %VS_VERSION% (version %VS_MAJOR%)
echo Using CMake generator: %CMAKE_GENERATOR%
:generator_ready
@REM Pack deps
if "%1"=="pack" (
setlocal ENABLEDELAYEDEXPANSION
cd %WP%/deps/build
for /f "tokens=2-4 delims=/ " %%a in ('date /t') do set build_date=%%c%%b%%a
echo packing deps: OrcaSlicer_dep_win64_!build_date!_vs!VS_VERSION!.zip
%WP%/tools/7z.exe a OrcaSlicer_dep_win64_!build_date!_vs!VS_VERSION!.zip OrcaSlicer_dep
goto :done
)
set debug=OFF
set debuginfo=OFF
if "%1"=="debug" set debug=ON
if "%2"=="debug" set debug=ON
if "%1"=="debuginfo" set debuginfo=ON
if "%2"=="debuginfo" set debuginfo=ON
if "%debug%"=="ON" (
set build_type=Debug
set build_dir=build-dbg
) else (
if "%debuginfo%"=="ON" (
set build_type=RelWithDebInfo
set build_dir=build-dbginfo
) else (
set build_type=Release
set build_dir=build
)
)
echo build type set to %build_type%
setlocal DISABLEDELAYEDEXPANSION
cd deps
mkdir %build_dir%
cd %build_dir%
set "SIG_FLAG="
if defined ORCA_UPDATER_SIG_KEY set "SIG_FLAG=-DORCA_UPDATER_SIG_KEY=%ORCA_UPDATER_SIG_KEY%"
if "%1"=="slicer" (
GOTO :slicer
)
echo "building deps.."
echo on
REM Set minimum CMake policy to avoid <3.5 errors
set CMAKE_POLICY_VERSION_MINIMUM=3.5
if "%USE_NINJA%"=="1" (
cmake ../ -G %CMAKE_GENERATOR% -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target deps
) else (
cmake ../ -G %CMAKE_GENERATOR% -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target deps -- -m
)
@echo off
if "%1"=="deps" goto :done
:slicer
call :check_linux_bridge_runtime_inputs
if errorlevel 1 exit /b 1
echo "building Orca Slicer..."
cd %WP%
mkdir %build_dir%
cd %build_dir%
echo on
set CMAKE_POLICY_VERSION_MINIMUM=3.5
if "%USE_NINJA%"=="1" (
cmake .. -G %CMAKE_GENERATOR% -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target ALL_BUILD
) else (
cmake .. -G %CMAKE_GENERATOR% -A x64 -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target ALL_BUILD -- -m
)
@echo off
cd ..
call scripts/run_gettext.bat
cd %build_dir%
cmake --build . --target install --config %build_type%
call :copy_linux_bridge_runtime
if errorlevel 1 exit /b 1
:done
@echo off
for /f "tokens=1-3 delims=:.," %%a in ("%_START_TIME: =0%") do set /a "_start_s=%%a*3600+%%b*60+%%c"
for /f "tokens=1-3 delims=:.," %%a in ("%TIME: =0%") do set /a "_end_s=%%a*3600+%%b*60+%%c"
set /a "_elapsed=_end_s - _start_s"
if %_elapsed% lss 0 set /a "_elapsed+=86400"
set /a "_hours=_elapsed / 3600"
set /a "_remainder=_elapsed - _hours * 3600"
set /a "_mins=_remainder / 60"
set /a "_secs=_remainder - _mins * 60"
echo.
echo Build completed in %_hours%h %_mins%m %_secs%s
exit /b 0
:resolve_rootfs_tar
if defined PJARCZAK_ROOTFS_TAR exit /b 0
if defined PJARCZAK_WSL_ROOTFS_TAR (
if exist "%PJARCZAK_WSL_ROOTFS_TAR%" (
set "PJARCZAK_ROOTFS_TAR=%PJARCZAK_WSL_ROOTFS_TAR%"
exit /b 0
)
echo Missing file from PJARCZAK_WSL_ROOTFS_TAR: %PJARCZAK_WSL_ROOTFS_TAR%
exit /b 1
)
if exist "%WP%\tools\pjarczak_bambu_runtime\rootfs\windows-wsl2-rootfs.tar" (
set "PJARCZAK_ROOTFS_TAR=%WP%\tools\pjarczak_bambu_runtime\rootfs\windows-wsl2-rootfs.tar"
exit /b 0
)
if exist "%WP%\tools\pjarczak_bambu_runtime\windows-wsl2-rootfs.tar" (
set "PJARCZAK_ROOTFS_TAR=%WP%\tools\pjarczak_bambu_runtime\windows-wsl2-rootfs.tar"
exit /b 0
)
echo Missing windows-wsl2-rootfs.tar
echo Expected one of:
echo %WP%\tools\pjarczak_bambu_runtime\rootfs\windows-wsl2-rootfs.tar
echo %WP%\tools\pjarczak_bambu_runtime\windows-wsl2-rootfs.tar
echo Or set PJARCZAK_WSL_ROOTFS_TAR to an absolute path.
exit /b 1
:check_linux_bridge_runtime_inputs
set "HOST_RUNTIME_DIR=%WP%\tools\pjarczak_bambu_linux_host\runtime\linux-x86_64"
call :resolve_rootfs_tar
if errorlevel 1 exit /b 1
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host" (
echo Missing linux host runtime: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host
echo Build it first on Linux with:
echo tools\pjarczak_bambu_linux_host\package_linux_host_runtime.sh
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host.runtime" (
echo Missing linux host runtime directory: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host.runtime
exit /b 1
)
echo Linux bridge preflight OK
echo host runtime: %HOST_RUNTIME_DIR%
echo rootfs tar: %PJARCZAK_ROOTFS_TAR%
exit /b 0
:copy_linux_bridge_runtime
set "INSTALL_DIR=%WP%\%build_dir%\OrcaSlicer"
set "HOST_RUNTIME_DIR=%WP%\tools\pjarczak_bambu_linux_host\runtime\linux-x86_64"
if not defined PJARCZAK_ROOTFS_TAR (
call :resolve_rootfs_tar
if errorlevel 1 exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host" (
echo Missing linux host runtime: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host
echo Build it first on Linux with:
echo tools\pjarczak_bambu_linux_host\package_linux_host_runtime.sh
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host.runtime" (
echo Missing linux host runtime directory: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host.runtime
exit /b 1
)
if not exist "%INSTALL_DIR%" (
echo Missing install directory: %INSTALL_DIR%
exit /b 1
)
if not exist "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" (
if exist "%WP%\%build_dir%\pjarczak_bambu_networking_bridge.dll" (
copy /Y "%WP%\%build_dir%\pjarczak_bambu_networking_bridge.dll" "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" >nul
)
)
if not exist "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" (
if exist "%WP%\%build_dir%\src\%build_type%\pjarczak_bambu_networking_bridge.dll" (
copy /Y "%WP%\%build_dir%\src\%build_type%\pjarczak_bambu_networking_bridge.dll" "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" >nul
)
)
if not exist "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" (
echo Missing bridge DLL in install output: %INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll
exit /b 1
)
copy /Y "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host" "%INSTALL_DIR%\pjarczak_bambu_linux_host" >nul
if errorlevel 1 (
echo Failed to copy linux host binary into %INSTALL_DIR%
exit /b 1
)
if exist "%INSTALL_DIR%\pjarczak_bambu_linux_host.runtime" (
rmdir /S /Q "%INSTALL_DIR%\pjarczak_bambu_linux_host.runtime"
)
xcopy "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host.runtime" "%INSTALL_DIR%\pjarczak_bambu_linux_host.runtime\" /E /I /Y >nul
if errorlevel 4 (
echo Failed to copy linux host runtime directory into %INSTALL_DIR%
exit /b 1
)
copy /Y "%PJARCZAK_ROOTFS_TAR%" "%INSTALL_DIR%\windows-wsl2-rootfs.tar" >nul
if errorlevel 1 (
echo Failed to copy windows-wsl2-rootfs.tar into %INSTALL_DIR%
exit /b 1
)
exit /b 0

View file

@ -1500,8 +1500,23 @@ int GUI_App::install_plugin(std::string name, std::string package_name, InstallP
if (pro_fn)
pro_fn(InstallStatusInstallCompleted, 100, cancel);
if (name == "plugins")
if (name == "plugins") {
app_config->set_bool("installed_networking", true);
if (app_config) {
std::string selected_version;
if (NetworkAgent::use_legacy_network)
selected_version = BAMBU_NETWORK_AGENT_VERSION_LEGACY;
else {
selected_version = app_config->get_network_plugin_version();
if (selected_version.empty())
selected_version = get_latest_network_version();
}
if (!selected_version.empty()) {
app_config->set_network_plugin_version(selected_version);
app_config->save();
}
}
}
BOOST_LOG_TRIVIAL(info) << "[install_plugin] success";
return 0;
}
@ -3123,11 +3138,76 @@ bool GUI_App::on_init_inner()
return true;
}
void GUI_App::copy_network_if_available()
namespace {
void pjarczak_copy_runtime_file_if_exists(const boost::filesystem::path& src_dir,
const boost::filesystem::path& dst_dir,
const std::string& file_name)
{
if (app_config->get("update_network_plugin") != "true")
if (file_name.empty())
return;
const auto src = src_dir / file_name;
const auto dst = dst_dir / file_name;
if (!boost::filesystem::exists(src) || boost::filesystem::is_directory(src))
return;
boost::filesystem::create_directories(dst.parent_path());
std::string error_message;
CopyFileResult cfr = copy_file(src.string(), dst.string(), error_message, false);
if (cfr != CopyFileResult::SUCCESS) {
BOOST_LOG_TRIVIAL(error) << "[copy_network_if_available] copy runtime file failed: "
<< PathSanitizer::sanitize(src.string()) << " -> "
<< PathSanitizer::sanitize(dst.string()) << ", code=" << cfr
<< ", err=" << error_message;
return;
}
#ifndef WIN32
static constexpr const auto perms =
fs::owner_read | fs::owner_write | fs::group_read | fs::others_read |
fs::owner_exe | fs::group_exe | fs::others_exe;
try {
fs::permissions(dst, perms);
} catch (...) {}
#endif
}
void pjarczak_copy_local_overlay_runtime(const boost::filesystem::path& plugin_folder)
{
if (!Slic3r::PJarczakLinuxBridge::enabled())
return;
const boost::filesystem::path exe_path(into_u8(wxStandardPaths::Get().GetExecutablePath()));
const boost::filesystem::path exe_dir = exe_path.parent_path();
const std::string runtime_files[] = {
Slic3r::PJarczakLinuxBridge::bridge_network_current_dir_name(),
Slic3r::PJarczakLinuxBridge::host_executable_file_name(),
Slic3r::PJarczakLinuxBridge::mac_host_wrapper_file_name(),
Slic3r::PJarczakLinuxBridge::windows_wsl_distro_file_name(),
Slic3r::PJarczakLinuxBridge::windows_wsl_import_script_file_name(),
Slic3r::PJarczakLinuxBridge::windows_wsl_import_cmd_file_name(),
Slic3r::PJarczakLinuxBridge::windows_wsl_validate_script_file_name(),
Slic3r::PJarczakLinuxBridge::windows_wsl_bootstrap_script_file_name(),
Slic3r::PJarczakLinuxBridge::windows_wsl_rootfs_file_name(),
Slic3r::PJarczakLinuxBridge::linux_payload_manifest_file_name(),
"libc.so.6",
"libstdc++.so.6",
"libgcc_s.so.1",
"libm.so.6"
};
for (const std::string& file_name : runtime_files)
pjarczak_copy_runtime_file_if_exists(exe_dir, plugin_folder, file_name);
}
}
void GUI_App::copy_network_if_available()
{
std::string data_dir_str = data_dir();
boost::filesystem::path data_dir_path(data_dir_str);
auto plugin_folder = data_dir_path / "plugins";
@ -3148,7 +3228,13 @@ void GUI_App::copy_network_if_available()
if (!boost::filesystem::exists(plugin_folder))
boost::filesystem::create_directory(plugin_folder);
pjarczak_copy_local_overlay_runtime(plugin_folder);
if (app_config->get("update_network_plugin") != "true")
return;
const bool pj_force_linux_payload = Slic3r::PJarczakLinuxBridge::enabled();
const std::string manifest_name = Slic3r::PJarczakLinuxBridge::linux_payload_manifest_file_name();
std::string error_message;
auto copy_one = [&](const boost::filesystem::path& src, const boost::filesystem::path& dst) -> bool {
@ -3157,41 +3243,72 @@ void GUI_App::copy_network_if_available()
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": Copying failed(" << cfr << "): " << error_message;
return false;
}
static constexpr const auto perms = fs::owner_read | fs::owner_write | fs::group_read | fs::others_read;
static constexpr const auto perms =
fs::owner_read | fs::owner_write | fs::group_read | fs::others_read |
fs::owner_exe | fs::group_exe | fs::others_exe;
fs::permissions(dst, perms);
return true;
};
if (pj_force_linux_payload) {
for (const auto& file_name : {
Slic3r::PJarczakLinuxBridge::linux_network_library_name(),
Slic3r::PJarczakLinuxBridge::linux_source_library_name(),
Slic3r::PJarczakLinuxBridge::linux_live555_library_name(),
Slic3r::PJarczakLinuxBridge::linux_payload_manifest_file_name() }) {
const auto src = cache_folder / file_name;
if (!boost::filesystem::exists(src))
continue;
if (file_name != Slic3r::PJarczakLinuxBridge::linux_payload_manifest_file_name()) {
std::string validate_reason;
if (!Slic3r::PJarczakLinuxBridge::validate_linux_payload_file(src.string(), &validate_reason)) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": invalid linux payload " << src.string() << ": " << validate_reason;
continue;
}
}
if (!copy_one(src, plugin_folder / file_name))
return;
fs::remove(src);
if (!boost::filesystem::exists(cache_folder)) {
app_config->set("update_network_plugin", "false");
return;
}
const auto manifest = plugin_folder / Slic3r::PJarczakLinuxBridge::linux_payload_manifest_file_name();
if (boost::filesystem::exists(manifest)) {
bool copy_failed = false;
try {
for (boost::filesystem::directory_iterator it(cache_folder); it != boost::filesystem::directory_iterator(); ++it) {
if (!boost::filesystem::is_regular_file(it->status()))
continue;
const std::string file_name = it->path().filename().string();
if (!Slic3r::PJarczakLinuxBridge::is_overlay_runtime_filename(file_name))
continue;
if (Slic3r::PJarczakLinuxBridge::is_linux_payload_filename(file_name)) {
std::string validate_reason;
if (!Slic3r::PJarczakLinuxBridge::validate_linux_payload_file(it->path().string(), &validate_reason)) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": invalid cached linux payload file " << file_name << ", reason=" << validate_reason;
copy_failed = true;
break;
}
}
if (!copy_one(it->path(), plugin_folder / file_name)) {
copy_failed = true;
break;
}
fs::remove(it->path());
}
} catch (...) {
copy_failed = true;
}
pjarczak_copy_local_overlay_runtime(plugin_folder);
const auto manifest = plugin_folder / manifest_name;
if (!copy_failed && boost::filesystem::exists(manifest)) {
std::string validate_reason;
if (!Slic3r::PJarczakLinuxBridge::validate_linux_payload_set_against_manifest(plugin_folder, &validate_reason)) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": manifest validation failed after copy: " << validate_reason;
return;
copy_failed = true;
}
}
if (copy_failed) {
const bool bridge_ready =
boost::filesystem::exists(plugin_folder / Slic3r::PJarczakLinuxBridge::bridge_network_current_dir_name()) &&
boost::filesystem::exists(plugin_folder / Slic3r::PJarczakLinuxBridge::linux_network_library_name()) &&
boost::filesystem::exists(plugin_folder / Slic3r::PJarczakLinuxBridge::linux_source_library_name()) &&
boost::filesystem::exists(plugin_folder / Slic3r::PJarczakLinuxBridge::linux_live555_library_name()) &&
boost::filesystem::exists(plugin_folder / "libagora_rtc_sdk.so") &&
boost::filesystem::exists(plugin_folder / "libagora-fdkaac.so");
if (bridge_ready)
app_config->set("update_network_plugin", "false");
return;
}
if (!cached_version.empty()) {
app_config->set(SETTING_NETWORK_PLUGIN_VERSION, cached_version);
app_config->save();

View file

@ -8,6 +8,7 @@
#include "MsgDialog.hpp"
#include "DownloadProgressDialog.hpp"
#include "slic3r/Utils/NetworkAgent.hpp"
#include "slic3r/Utils/PJarczakLinuxBridge/PJarczakLinuxBridgeConfig.hpp"
#include <boost/lexical_cast.hpp>
@ -766,12 +767,16 @@ bool MediaPlayCtrl::start_stream_service(bool *need_install)
boost::process::pipe intermediate;
boost::filesystem::path start_dir(boost::filesystem::path(data_dir()) / "plugins");
#ifdef __WXMSW__
auto plugins_dir = boost::nowide::widen(data_dir()) + L"\\plugins\\";
for (auto dll : {L"BambuSource.dll", L"live555.dll"}) {
auto file_dll = tools_dir + dll;
auto file_dll2 = plugins_dir + dll;
if (!boost::filesystem::exists(file_dll) || boost::filesystem::last_write_time(file_dll) != boost::filesystem::last_write_time(file_dll2))
boost::filesystem::copy_file(file_dll2, file_dll, boost::filesystem::copy_options::overwrite_existing);
if (!Slic3r::PJarczakLinuxBridge::enabled()) {
auto plugins_dir = boost::nowide::widen(data_dir()) + L"\\plugins\\";
for (auto dll : {L"BambuSource.dll", L"live555.dll", L"agora_rtc_sdk.dll", L"libaosl.dll", L"libagora-ffmpeg.dll", L"libagora-soundtouch.dll"}) {
auto file_dll = tools_dir + dll;
auto file_dll2 = plugins_dir + dll;
if (!boost::filesystem::exists(file_dll2))
continue;
if (!boost::filesystem::exists(file_dll) || boost::filesystem::last_write_time(file_dll) != boost::filesystem::last_write_time(file_dll2))
boost::filesystem::copy_file(file_dll2, file_dll, boost::filesystem::copy_options::overwrite_existing);
}
}
boost::process::child process_source(file_source, file_url2.ToStdWstring(), boost::process::start_dir(tools_dir),
boost::process::windows::create_no_window,

View file

@ -10086,7 +10086,7 @@ void Plater::priv::update_plugin_when_launch(wxCommandEvent &event)
std::string data_dir_str = data_dir();
boost::filesystem::path data_dir_path(data_dir_str);
auto cache_folder = data_dir_path / "ota";
std::string changelog_file = cache_folder.string() + "/plugins/network_plugins.json";
std::string changelog_file = cache_folder.string() + "/network_plugins.json";
UpdatePluginDialog dlg(wxGetApp().mainframe);
dlg.update_info(changelog_file);

View file

@ -1,6 +1,7 @@
#include "wxMediaCtrl2.h"
#include "libslic3r/Time.hpp"
#include "I18N.hpp"
#include "slic3r/Utils/PJarczakLinuxBridge/PJarczakLinuxBridgeConfig.hpp"
#include "GUI_App.hpp"
#include <boost/filesystem/operations.hpp>
#ifdef __WIN32__
@ -91,6 +92,11 @@ void wxMediaCtrl2::Load(wxURI url)
std::string data_dir_str = Slic3r::data_dir();
boost::filesystem::path data_dir_path(data_dir_str);
auto dll_path = data_dir_path / "plugins" / "BambuSource.dll";
if (Slic3r::PJarczakLinuxBridge::enabled()) {
auto fallback_path = data_dir_path / "cameratools" / "BambuSource.dll";
if (boost::filesystem::exists(fallback_path))
dll_path = fallback_path;
}
if (path.empty() || !wxFile::Exists(path) || clsid != CLSID_BAMBU_SOURCE) {
if (boost::filesystem::exists(dll_path)) {
CallAfter(

View file

@ -176,9 +176,77 @@ std::string linux_live555_library_name()
return "liblive555.so";
}
std::string host_executable_file_name()
{
return "pjarczak_bambu_linux_host";
}
std::string mac_host_wrapper_file_name()
{
return "pjarczak-bambu-linux-host-wrapper";
}
std::string windows_wsl_distro_file_name()
{
return "pjarczak_wsl_distro.txt";
}
std::string windows_wsl_import_script_file_name()
{
return "install_runtime.ps1";
}
std::string windows_wsl_import_cmd_file_name()
{
return "install_runtime.cmd";
}
std::string windows_wsl_validate_script_file_name()
{
return "verify_runtime.ps1";
}
std::string windows_wsl_bootstrap_script_file_name()
{
return "pjarczak_wsl_run_host.sh";
}
std::string windows_wsl_rootfs_file_name()
{
return "windows-wsl2-rootfs.tar";
}
bool is_overlay_runtime_filename(const std::string& file_name)
{
if (file_name == "network_plugins.json")
return true;
if (file_name.size() >= 3 && file_name.compare(file_name.size() - 3, 3, ".so") == 0)
return true;
if (file_name.find(".so.") != std::string::npos)
return true;
return file_name == linux_payload_manifest_file_name() ||
file_name == bridge_network_current_dir_name() ||
file_name == host_executable_file_name() ||
file_name == mac_host_wrapper_file_name() ||
file_name == windows_wsl_distro_file_name() ||
file_name == windows_wsl_import_script_file_name() ||
file_name == windows_wsl_import_cmd_file_name() ||
file_name == windows_wsl_validate_script_file_name() ||
file_name == windows_wsl_bootstrap_script_file_name() ||
file_name == windows_wsl_rootfs_file_name() ||
is_linux_payload_filename(file_name);
}
bool is_linux_payload_filename(const std::string& file_name)
{
return file_name == linux_network_library_name() || file_name == linux_source_library_name() || file_name == linux_live555_library_name();
if (file_name.size() >= 3 && file_name.compare(file_name.size() - 3, 3, ".so") == 0)
return true;
if (file_name.find(".so.") != std::string::npos)
return true;
return false;
}
bool validate_linux_so_binary(const std::string& file_path, std::string* reason)
@ -332,22 +400,28 @@ bool validate_linux_payload_set_against_manifest(const boost::filesystem::path&
set_reason(reason, "manifest missing");
return false;
}
for (const auto& name : {linux_network_library_name(), linux_source_library_name()}) {
const auto path = (plugin_folder / name).string();
bool found_any = false;
for (boost::filesystem::directory_iterator it(plugin_folder); it != boost::filesystem::directory_iterator(); ++it) {
if (!boost::filesystem::is_regular_file(it->status()))
continue;
const std::string file_name = it->path().filename().string();
if (!is_linux_payload_filename(file_name))
continue;
found_any = true;
std::string local_reason;
if (!validate_linux_payload_file_against_manifest(path, manifest, &local_reason)) {
set_reason(reason, name + ": " + local_reason);
if (!validate_linux_payload_file_against_manifest(it->path().string(), manifest, &local_reason)) {
set_reason(reason, file_name + ": " + local_reason);
return false;
}
}
const auto live555 = (plugin_folder / linux_live555_library_name());
if (boost::filesystem::exists(live555)) {
std::string local_reason;
if (!validate_linux_payload_file_against_manifest(live555.string(), manifest, &local_reason)) {
set_reason(reason, linux_live555_library_name() + ": " + local_reason);
return false;
}
if (!found_any) {
set_reason(reason, "no linux payload files found");
return false;
}
set_reason(reason, "ok");
return true;
}
@ -373,7 +447,7 @@ bool validate_linux_payload_file(const std::string& file_path, std::string* reas
std::vector<std::string> ota_copy_extensions()
{
return {".so", ".json"};
return {".so", ".json", ".dll", ".dylib", ".ps1", ".cmd", ".txt", ".sh", ".tar"};
}
} // namespace Slic3r::PJarczakLinuxBridge

View file

@ -21,6 +21,16 @@ std::string linux_network_library_name();
std::string linux_source_library_name();
std::string linux_live555_library_name();
std::string host_executable_file_name();
std::string mac_host_wrapper_file_name();
std::string windows_wsl_distro_file_name();
std::string windows_wsl_import_script_file_name();
std::string windows_wsl_import_cmd_file_name();
std::string windows_wsl_validate_script_file_name();
std::string windows_wsl_bootstrap_script_file_name();
std::string windows_wsl_rootfs_file_name();
bool is_overlay_runtime_filename(const std::string& file_name);
bool is_linux_payload_filename(const std::string& file_name);
bool validate_linux_so_binary(const std::string& file_path, std::string* reason = nullptr);
std::string linux_payload_manifest_file_name();

View file

@ -38,6 +38,7 @@
#include "slic3r/Config/Snapshot.hpp"
#include "slic3r/GUI/MarkdownTip.hpp"
#include "libslic3r/miniz_extension.hpp"
#include "slic3r/Utils/PJarczakLinuxBridge/PJarczakLinuxBridgeConfig.hpp"
#include "slic3r/GUI/GUI_Utils.hpp"
namespace fs = boost::filesystem;
@ -795,12 +796,35 @@ void PresetUpdater::priv::sync_tooltip(std::string http_url, std::string languag
// return true means there are plugins files
bool PresetUpdater::priv::get_cached_plugins_version(std::string& cached_version, bool &force)
{
std::string data_dir_str = data_dir();
boost::filesystem::path data_dir_path(data_dir_str);
auto cache_folder = data_dir_path / "ota";
std::string network_library, player_library, live555_library;
const bool bridge_payload = Slic3r::PJarczakLinuxBridge::should_force_linux_plugin_payload("plugins");
auto cache_folder = bridge_payload ? cache_path : (cache_path / "plugins");
bool has_plugins = false;
if (bridge_payload) {
const auto network_library = cache_folder / Slic3r::PJarczakLinuxBridge::linux_network_library_name();
const auto player_library = cache_folder / Slic3r::PJarczakLinuxBridge::linux_source_library_name();
const auto live555_library = cache_folder / Slic3r::PJarczakLinuxBridge::linux_live555_library_name();
const auto agora_library = cache_folder / "libagora_rtc_sdk.so";
const auto fdkaac_library = cache_folder / "libagora-fdkaac.so";
const auto changelog_file = cache_path / "network_plugins.json";
if (fs::exists(network_library)
&& fs::exists(player_library)
&& fs::exists(live555_library)
&& fs::exists(agora_library)
&& fs::exists(fdkaac_library)
&& fs::exists(changelog_file))
{
has_plugins = true;
std::string description;
parse_ota_files(changelog_file.string(), cached_version, force, description);
}
return has_plugins;
}
std::string network_library, player_library, live555_library;
#if defined(_MSC_VER) || defined(_WIN32)
network_library = cache_folder.string() + "/bambu_networking.dll";
player_library = cache_folder.string() + "/BambuSource.dll";
@ -816,28 +840,14 @@ bool PresetUpdater::priv::get_cached_plugins_version(std::string& cached_version
#endif
std::string changelog_file = cache_folder.string() + "/network_plugins.json";
if (boost::filesystem::exists(network_library)
&& boost::filesystem::exists(player_library)
&& boost::filesystem::exists(live555_library)
&& boost::filesystem::exists(changelog_file))
if (fs::exists(network_library)
&& fs::exists(player_library)
&& fs::exists(live555_library)
&& fs::exists(changelog_file))
{
has_plugins = true;
try {
boost::nowide::ifstream ifs(changelog_file);
json j;
ifs >> j;
if (j.contains("version"))
cached_version = j["version"];
if (j.contains("force"))
force = j["force"];
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< ": cached_version = "<<cached_version<<", force = " << force;
}
catch(nlohmann::detail::parse_error &err) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__<< ": parse "<<changelog_file<<" got a nlohmann::detail::parse_error, reason = " << err.what();
//throw ConfigurationError(format("Failed loading json file \"%1%\": %2%", file_path, err.what()));
}
std::string description;
parse_ota_files(changelog_file, cached_version, force, description);
}
return has_plugins;
@ -851,6 +861,7 @@ void PresetUpdater::priv::sync_plugins(std::string http_url, std::string plugin_
}
std::string curr_version = NetworkAgent::use_legacy_network ? BAMBU_NETWORK_AGENT_VERSION_LEGACY : get_latest_network_version();
std::string using_version = curr_version.substr(0, 9) + "00";
const bool bridge_payload = Slic3r::PJarczakLinuxBridge::should_force_linux_plugin_payload("plugins");
std::string cached_version;
bool force_upgrade = false;
@ -885,70 +896,70 @@ void PresetUpdater::priv::sync_plugins(std::string http_url, std::string plugin_
boost::filesystem::path data_dir_path(data_dir_str);
auto cache_folder = data_dir_path / "ota";
auto remove_cache_file = [](const boost::filesystem::path& file_path) {
if (!boost::filesystem::exists(file_path))
return;
BOOST_LOG_TRIVIAL(info) << "[remove_old_networking_plugins] remove the file " << file_path.string();
try {
fs::remove(file_path);
} catch (...) {
BOOST_LOG_TRIVIAL(error) << "Failed removing the plugins file " << file_path.string();
}
};
if (bridge_payload) {
if (!boost::filesystem::exists(cache_folder))
return;
for (boost::filesystem::directory_iterator it(cache_folder); it != boost::filesystem::directory_iterator(); ++it) {
if (!boost::filesystem::is_regular_file(it->status()))
continue;
const std::string file_name = it->path().filename().string();
if (file_name == "network_plugins.json" ||
file_name == Slic3r::PJarczakLinuxBridge::linux_payload_manifest_file_name() ||
Slic3r::PJarczakLinuxBridge::is_linux_payload_filename(file_name))
remove_cache_file(it->path());
}
} else {
#if defined(_MSC_VER) || defined(_WIN32)
auto network_library = cache_folder / "bambu_networking.dll";
auto player_library = cache_folder / "BambuSource.dll";
auto live555_library = cache_folder / "live555.dll";
auto network_library = cache_folder / "bambu_networking.dll";
auto player_library = cache_folder / "BambuSource.dll";
auto live555_library = cache_folder / "live555.dll";
#elif defined(__WXMAC__)
auto network_library = cache_folder / "libbambu_networking.dylib";
auto player_library = cache_folder / "libBambuSource.dylib";
auto live555_library = cache_folder / "liblive555.dylib";
auto network_library = cache_folder / "libbambu_networking.dylib";
auto player_library = cache_folder / "libBambuSource.dylib";
auto live555_library = cache_folder / "liblive555.dylib";
#else
auto network_library = cache_folder / "libbambu_networking.so";
auto player_library = cache_folder / "libBambuSource.so";
auto live555_library = cache_folder / "liblive555.so";
auto network_library = cache_folder / "libbambu_networking.so";
auto player_library = cache_folder / "libBambuSource.so";
auto live555_library = cache_folder / "liblive555.so";
#endif
auto changelog_file = cache_folder / "network_plugins.json";
if (boost::filesystem::exists(network_library))
{
BOOST_LOG_TRIVIAL(info) << "[remove_old_networking_plugins] remove the file "<<network_library.string();
try {
fs::remove(network_library);
} catch (...) {
BOOST_LOG_TRIVIAL(error) << "Failed removing the plugins file " << network_library.string();
}
}
if (boost::filesystem::exists(player_library))
{
BOOST_LOG_TRIVIAL(info) << "[remove_old_networking_plugins] remove the file "<<player_library.string();
try {
fs::remove(player_library);
} catch (...) {
BOOST_LOG_TRIVIAL(error) << "Failed removing the plugins file " << player_library.string();
}
}
if (boost::filesystem::exists(live555_library))
{
BOOST_LOG_TRIVIAL(info) << "[remove_old_networking_plugins] remove the file " << live555_library.string();
try {
fs::remove(live555_library);
} catch (...) {
BOOST_LOG_TRIVIAL(error) << "Failed removing the plugins file " << live555_library.string();
}
}
if (boost::filesystem::exists(changelog_file))
{
BOOST_LOG_TRIVIAL(info) << "[remove_old_networking_plugins] remove the file "<<changelog_file.string();
try {
fs::remove(changelog_file);
} catch (...) {
BOOST_LOG_TRIVIAL(error) << "Failed removing the plugins file " << changelog_file.string();
}
auto changelog_file = cache_folder / "network_plugins.json";
remove_cache_file(network_library);
remove_cache_file(player_library);
remove_cache_file(live555_library);
remove_cache_file(changelog_file);
}
}
}
#if defined(__WINDOWS__)
if (GUI::wxGetApp().is_running_on_arm64() && !NetworkAgent::use_legacy_network) {
//set to arm64 for plugins
std::map<std::string, std::string> current_headers = Slic3r::Http::get_extra_headers();
current_headers["X-BBL-OS-Type"] = "windows_arm";
std::map<std::string, std::string> previous_headers = Slic3r::Http::get_extra_headers();
bool restore_os_type = false;
std::string previous_os_type;
auto os_type_it = previous_headers.find("X-BBL-OS-Type");
if (os_type_it != previous_headers.end()) {
restore_os_type = true;
previous_os_type = os_type_it->second;
}
#if defined(__WINDOWS__)
if (bridge_payload) {
auto current_headers = previous_headers;
current_headers["X-BBL-OS-Type"] = Slic3r::PJarczakLinuxBridge::forced_download_os_type();
Slic3r::Http::set_extra_headers(current_headers);
BOOST_LOG_TRIVIAL(info) << boost::format("set X-BBL-OS-Type to %1%") % Slic3r::PJarczakLinuxBridge::forced_download_os_type();
} else if (GUI::wxGetApp().is_running_on_arm64() && !NetworkAgent::use_legacy_network) {
auto current_headers = previous_headers;
current_headers["X-BBL-OS-Type"] = "windows_arm";
Slic3r::Http::set_extra_headers(current_headers);
BOOST_LOG_TRIVIAL(info) << boost::format("set X-BBL-OS-Type to windows_arm");
}
@ -964,9 +975,16 @@ void PresetUpdater::priv::sync_plugins(std::string http_url, std::string plugin_
BOOST_LOG_TRIVIAL(warning) << format("[Orca Updater] sync_plugins: %1%", e.what());
}
#if defined(__WINDOWS__)
if (GUI::wxGetApp().is_running_on_arm64() && !NetworkAgent::use_legacy_network) {
//set back
std::map<std::string, std::string> current_headers = Slic3r::Http::get_extra_headers();
if (bridge_payload) {
auto current_headers = Slic3r::Http::get_extra_headers();
if (restore_os_type)
current_headers["X-BBL-OS-Type"] = previous_os_type;
else
current_headers.erase("X-BBL-OS-Type");
Slic3r::Http::set_extra_headers(current_headers);
BOOST_LOG_TRIVIAL(info) << boost::format("restore X-BBL-OS-Type after linux bridge plugin sync");
} else if (GUI::wxGetApp().is_running_on_arm64() && !NetworkAgent::use_legacy_network) {
auto current_headers = Slic3r::Http::get_extra_headers();
current_headers["X-BBL-OS-Type"] = "windows";
Slic3r::Http::set_extra_headers(current_headers);