Патч для 19.1.4/20 beta Apple Silicon/Intel
Полос при рендере нет.
Патчи те же, что и у monter group, но различие в файлах не в мегабайты, а в несколько байтов - они зачем-то добавили секции с отладочными символами (видимо, из IDA?) прямо в исполняемый файл. В секции кода отличий у них тоже всего несколько байт.
Но поскольку мне как-то ближе пропатчить официальный релиз и не ставить из сторонних источников, написал скрипт.
скрипт в спойлере
скрытый текст
Код:
#!/bin/bash -ue
set -ueo pipefail
fail() {
>&2 echo -e "\nError: $1"
exit 1
}
is_dry_run () {
if [ ${dry_run+x} ]; then
return 0
else
return 1
fi
}
have_ggrep () {
if which ggrep >/dev/null; then
return 0
else
return 1
fi
}
do_backup() {
bakfile="$1.bak"
test -f "$bakfile" || cp -n "$1" "$bakfile"
}
do_patch_file_pattern() {
file=$1
pattern=$2
patch=$3
patchOffset=$4
is_dry_run || do_backup "$file"
escaped_pat=$(echo "$pattern" | sed -e 's/xx/./g' -e 's/\([0-9a-fA-F]\{2\}\)/\\x\1/g' -e 's/ //g')
ret=0
if have_ggrep ; then
grep_cmd=ggrep
grep_extra_opts="--perl-regexp"
else
grep_cmd=grep
grep_extra_opts=
fi
if matches=$(LANG=C "$grep_cmd" -m 2 --only-matching --byte-offset --binary --text $grep_extra_opts --regexp="${escaped_pat}" "${file}");
then
match_cnt=$( wc -l <<<"${matches}")
if [ "${match_cnt}" -ne 1 ]
then
fail "File {$file} pattern ${pattern} found ${match_cnt} matches, should be exactly one"
fi
else
errcode=$?
if [ $errcode -eq 1 ]
then
if ! is_dry_run; then
fail "ggrep: pattern ${pattern} not found in file ${file}"
else
echo "Dry run: ignoring error: ggrep: pattern ${pattern} not found in file ${file}"
return 0
fi
else
fail "ggrep error $?"
fi
fi
offset=$(LANG=C cut -f '1' -d ':' <<<"${matches}")
if is_dry_run ;then
printf "Dry run: not patching %s at offset 0x%x\n" "$(basename "$file")" "$[patchOffset + offset]"
else
printf "\\x${patch// /\\x}" | dd of="${file}" seek="$[patchOffset + offset]" bs=1 conv=notrunc status=none
fi
}
get_files_to_patch() {
path="$1"
echo "${path}/Contents/MacOS/Resolve"
echo "${path}/Contents/Libraries/Fusion/libfusionsystem.dylib"
}
check_perms() {
IFS=$'\n' read -rd '' -a files < <(get_files_to_patch "$1") || true
for file in "${files[@]}"; do
echo -n "Checking ${file} write permissions.."
if [ ! -w "${file}" ]; then
fail "We don't have write permission to ${file}, please re-run with sudo or change directory permissions"
fi
echo OK
done
}
ensure_license() {
licfile="/Library/Application Support/Blackmagic Design/DaVinci Resolve/.license/blackmagic.lic"
licpath=$(dirname "$licfile")
mkdir -p "$licpath"
test -f "$licfile" || cat <<EOF >"$licfile"
LICENSE blackmagic davinciresolvestudio 999999 permanent uncounted
hostid=ANY issuer=CGP customer=CGP issued=28-dec-2023
akey=0000-0000-0000-0000 _ck=00 sig="00"
EOF
}
do_codesign() {
pushd "$1"
codesign --force --sign - --deep . || fail "Error during codesign, make sure your application path ($path) is correct and that you have write permissions"
popd
}
do_usage() {
cat <<EOF
Usage: $0 [options] [path_to_DaVinci_Resolve.app]
Options:
-n|--dry-run : Check if patches apply, don't actually patch anything
-h|--help : Show this message
Examples:
$0
- Apply patches to application at the default path '/Applications/DaVinci Resolve/DaVinci Resolve.app'
$0 --dry-run /Applications/DaVinci Resolve 19/DaVinci Resolve.app
- Check if patches apply to version installed to '/Applications/DaVinci Resolve 19'
EOF
exit 0
}
do_patch() {
IFS=$'\n' read -rd '' -a files < <(get_files_to_patch "$1") || true
resolve="${files[0]}"
fusion="${files[1]}"
# Resolve and libfusion
# patch out call to __rlm_auth_stat
arm_pat1="a0 03 5f f8 a1 83 5e f8 e3 0f 40 b9"
intel_pat1="31 c0 89 c2 48 8b 7d f0 48 8b 75 e8 8b 4d cc"
# Resolve only
# 2BMDCloudLicenseError(int, int)
# 1OnBMDCloudLicenseError(int, int)
# ignore license check results
arm_pat2="ff 43 01 d1 f6 57 02 a9 f4 4f 03 a9 fd 7b 04 a9 fd 03 01 91 f3 03 00 aa xx xx xx 97 xx xx xx xx xx xx xx 34 xx xx xx 97"
intel_pat2="55 48 89 e5 41 57 41 56 41 54 53 48 83 ec 20 48 89 fb e8 xx xx xx ff 48 89 c7"
arm_patch1="00 00 80 d2"
arm_patch2="20 00 80 52"
# xor rax, rax
intel_patch1="48 31 c0 90 90"
# mov al, 1
intel_patch2="b0 01 90 90 90"
# arm
do_patch_file_pattern "$resolve" "$arm_pat1" "$arm_patch1" 16
do_patch_file_pattern "$fusion" "$arm_pat1" "$arm_patch1" 16
do_patch_file_pattern "$resolve" "$arm_pat2" "$arm_patch2" 28
do_patch_file_pattern "$resolve" "$arm_pat2" "$arm_patch2" 40
# intel
do_patch_file_pattern "$resolve" "$intel_pat1" "$intel_patch1" 15
do_patch_file_pattern "$fusion" "$intel_pat1" "$intel_patch1" 15
do_patch_file_pattern "$resolve" "$intel_pat2" "$intel_patch2" 26
do_patch_file_pattern "$resolve" "$intel_pat2" "$intel_patch2" 47
}
while [[ $# -gt 0 ]]; do
case $1 in
-n|--dry-run)
dry_run=1
shift # past value
;;
-h|--help)
do_usage
shift # past value
;;
*)
break
esac
done
path="${1:-/Applications/DaVinci Resolve/DaVinci Resolve.app/}"
check_perms "$path"
do_patch "$path"
if ! is_dry_run ; then
ensure_license
do_codesign "$path"
echo All files patched successfully
fi
Запускать
sudo ./patch.sh или просто
./patch.sh если добавить своему пользователю права записи на папку и все дочерние объекты '/Applications/DaVinci Resolve/DaVinci Resolve.app/Contents'
Update: Спасибо
Moridin, получилось заменить gnu grep на родной grep встроенный в mac os. Теперь не требуется установка сторонних утилит

Также добавил создание файла лицензии в скрипт.
Update2: Добавил поддержку версии 20 beta