2023-05-27 20:10:31 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@-flags.conf"
|
2023-06-02 21:52:38 +02:00
|
|
|
krisp_bin="${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@/@PKGVER@/modules/@PKGNAME@_krisp/@PKGNAME@_krisp.node"
|
2023-05-27 20:10:31 +02:00
|
|
|
|
|
|
|
declare -a flags
|
|
|
|
|
2023-06-02 21:52:38 +02:00
|
|
|
if hash rizin &> /dev/null; then
|
|
|
|
# Patch Krisp binary to ignore signature check
|
|
|
|
if [[ -f "${krisp_bin}" && $(b2sum "${krisp_bin}" | head -c 128) == @KRISPB2@ ]]; then
|
|
|
|
addr=$(rz-find -x '4889dfe8........4889dfe8' "${krisp_bin}" | head -n1)
|
|
|
|
rizin -q -w -c "s $addr + 0x12 ; wao nop" "${krisp_bin}" &> /dev/null
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2023-05-27 20:10:31 +02:00
|
|
|
if [[ -f "${flags_file}" ]]; then
|
2023-06-02 21:52:38 +02:00
|
|
|
if grep -q '\--ignore-gpu-blacklist' "${flags_file}"; then
|
2023-05-28 23:55:52 +02:00
|
|
|
sed -i "s|--ignore-gpu-blacklist|--ignore-gpu-blocklist|" "${flags_file}"
|
2023-06-02 21:52:38 +02:00
|
|
|
fi
|
2023-05-27 20:10:31 +02:00
|
|
|
mapfile -t < "${flags_file}"
|
|
|
|
else
|
|
|
|
cat > "${flags_file}" <<EOF
|
2023-05-27 21:55:29 +02:00
|
|
|
#--ignore-gpu-blocklist
|
2023-05-27 20:10:31 +02:00
|
|
|
#--enable-gpu-rasterization
|
|
|
|
#--enable-zero-copy
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
|
|
|
for line in "${MAPFILE[@]}"; do
|
|
|
|
if [[ ! "${line}" =~ ^[[:space:]]*#.* ]]; then
|
|
|
|
flags+=("${line}")
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
exec /usr/bin/electron@ELECTRON@ \
|
|
|
|
/usr/lib/@PKGNAME@/app.asar \
|
|
|
|
--ozone-platform-hint=auto \
|
|
|
|
"${flags[@]}" "$@"
|