46 lines
1.6 KiB
Bash
Executable File
46 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
dir=`dirname "$(readlink -f $0)"`
|
|
|
|
if [ ! -x /lib/ld-linux-armhf.so.3 ] ; then
|
|
echo "/lib/ld-linux-armhf.so.3 not found, installing..."
|
|
set -x
|
|
sudo cp -v "$dir/lib/ld-linux-armhf.so.3" /lib/
|
|
set +x
|
|
fi
|
|
|
|
export LD_LIBRARY_PATH="$dir/lib"
|
|
export MOZ_PLUGIN_PATH="$dir/lib/plugins/"
|
|
export XDG_CONFIG_HOME="$dir/etc/"
|
|
if pactl stat &> /dev/null ; then
|
|
export ALSA_CONFIG_PATH="$dir/etc/asound.conf"
|
|
fi
|
|
cd "$dir"
|
|
|
|
game_swf=`ls -1 "$dir"/Anodyne*.swf | head -1`
|
|
game_savefile="$dir/etc/freshwrapper-data/Shockwave Flash/WritableRoot/#SharedObjects/ANODYNE1/#localWithNet/$game_swf/ANODYNE_SAVE_123.sol"
|
|
|
|
if [[ "${1:-NaN}" =~ ^[1-9][0-9]*$ ]] ; then
|
|
scale="$1"
|
|
elif [[ "${1:-NaN}" =~ ^-*[fF] ]] ; then
|
|
display_height=$(xdpyinfo | grep -E '^ *dimensions:' | grep -Po '(?<=[0-9]x)[0-9]+(?= pixels)')
|
|
scale=`echo "scale=10; $display_height/180" | $dir/bin/bc`
|
|
fs_param="--fullscreen"
|
|
else
|
|
scale=$( (grep -Poa '(?<=scale_factor.).' "$game_savefile" | od -An -N1 -td1) || echo 3)
|
|
# default is x6 for some reason, which would make an obscenely large window
|
|
# after a player saved without touching the setting...
|
|
if [ "$scale" == 6 ] ; then
|
|
scale=3
|
|
fi
|
|
fi
|
|
|
|
width=`echo "($scale * 160)/1" | $dir/bin/bc`
|
|
height=`echo "($scale * 180)/1" | $dir/bin/bc`
|
|
device_scale=`echo "scale=10; sqrt($scale/3)" | $dir/bin/bc`
|
|
|
|
sed -i "s/^device_scale = .*/device_scale = $device_scale/" "$dir/etc/freshwrapper.conf"
|
|
|
|
exec "$dir/bin/npplayer" ${fs_param:-} src="$game_swf" width="$width" height="$height" pepperflash_path="$dir/lib/plugins/libpepflashplayer.so"
|