#!/usr/bin/env bash # Assemble the pinned OBS runtime for Windows x64 from the official release zip. # # Files are copied byte-for-byte from the OBS release so the signed Game # Capture hook (graphics-hook64.dll, inject-helper, get-graphics-offsets) keeps # its original signature. Runs on Linux or Git Bash; needs curl, unzip and # sha256sum. set -euo pipefail script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # shellcheck source=versions.env source "${script_dir}/versions.env" cache_dir="${CLIPBIN_CACHE_DIR:-${XDG_CACHE_HOME:-$HOME/.cache}/clipbin}" zip_name="OBS-Studio-${OBS_VERSION}-Windows-x64.zip" zip_path="${cache_dir}/${zip_name}" extract_dir="${cache_dir}/obs-windows-${OBS_VERSION}" bundle_dir="${CLIPBIN_OBS_RUNTIME:-${script_dir}/../../target/obs-runtime/windows-x86_64}" # Official plugins the recorder uses: Game/Window Capture, WASAPI audio, # hardware encoders (AMF lives in obs-ffmpeg) and the FFmpeg muxer. plugins=(win-capture win-wasapi obs-ffmpeg obs-nvenc obs-qsv11) # OBS front-end, scripting and software-encoder files Clipbin does not use. # Subdirectories of bin/64bit are Qt plugins and are skipped too. excluded_bin='^(obs64\.exe|obs-frontend-api\.dll|obs-scripting\.dll|lua51\.dll|Qt6.*\.dll|datachannel\.dll|libx264-.*\.dll|.*\.pdb)$' mkdir -p "${cache_dir}" if [[ ! -f "${zip_path}" ]]; then curl -fL --retry 3 -o "${zip_path}.partial" \ "https://github.com/obsproject/obs-studio/releases/download/${OBS_VERSION}/${zip_name}" mv "${zip_path}.partial" "${zip_path}" fi echo "${OBS_WINDOWS_X64_SHA256} ${zip_path}" | sha256sum --check --quiet rm -rf "${extract_dir}" unzip -q "${zip_path}" -d "${extract_dir}" # Keep the OBS install layout: OBS looks for obs-ffmpeg-mux.exe next to the # running executable, so Clipbin's executable lives in bin/64bit. rm -rf "${bundle_dir}" mkdir -p "${bundle_dir}/bin/64bit" "${bundle_dir}/obs-plugins/64bit" "${bundle_dir}/data/obs-plugins" for file in "${extract_dir}"/bin/64bit/*; do name="$(basename "${file}")" if [[ -f "${file}" && ! "${name}" =~ ${excluded_bin} ]]; then cp -a "${file}" "${bundle_dir}/bin/64bit/" fi done cp -a "${extract_dir}/data/libobs" "${bundle_dir}/data/libobs" for plugin in "${plugins[@]}"; do cp -a "${extract_dir}/obs-plugins/64bit/${plugin}.dll" "${bundle_dir}/obs-plugins/64bit/" if [[ -d "${extract_dir}/data/obs-plugins/${plugin}" ]]; then cp -a "${extract_dir}/data/obs-plugins/${plugin}" "${bundle_dir}/data/obs-plugins/" fi done find "${bundle_dir}" -name '*.pdb' -delete # Record the signed capture-hook files so a Windows check can verify them # against Get-AuthenticodeSignature before packaging. (cd "${bundle_dir}" && sha256sum data/obs-plugins/win-capture/*.exe data/obs-plugins/win-capture/*.dll) \ > "${bundle_dir}/SIGNED-HOOKS.sha256" cat > "${bundle_dir}/VERSION" <