diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1e5c289 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/sourcefiles/*.swf +/dist +/workdir diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c3ce90f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "external/nspluginwrapper"] + path = external/nspluginwrapper + url = https://git.vvn.space/lifning/nspluginwrapper +[submodule "external/freshplayerplugin"] + path = external/freshplayerplugin + url = https://github.com/i-rinat/freshplayerplugin/ diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..9052184 --- /dev/null +++ b/build.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +export XBPS_ARCH=armv6l +void_repository=https://alpha.us.repo.voidlinux.org/ + +set -eo pipefail +command -v curl tar zstd xz 7z zcat sudo rsync +test -f external/freshplayerplugin/CMakeLists.txt +test -f external/nspluginwrapper/configure + +mkdir -p workdir +cd workdir + +if [ ! -x usr/bin/xbps-install.static ] ; then + mkdir -p etc/xbps.d + cat > etc/xbps.d/00-repository-main.conf < chromeos.bin + 7z e chromeos.bin ROOT-A.img -y + test -f ROOT-A.img + rm chromeos.bin + 7z e ROOT-A.img libpepflashplayer.so -r -y + test -f libpepflashplayer.so + rm ROOT-A.img + mkdir -p ../dist/lib/plugins + mv libpepflashplayer.so ../dist/lib/plugins/ +fi + +if [ ! -f ../dist/lib/alsa-lib/libasound_module_pcm_pulse.so ] ; then + cat ../pkglist | xargs usr/bin/xbps-install.static -r $PWD -SDy + + set +e + for i in var/cache/xbps/*.xbps; do + tar --wildcards -xf $i ./usr/lib/\* 2>/dev/null + done + set -e + tar --wildcards -xf var/cache/xbps/bc-*.xbps ./usr/bin/\*bc + + mkdir -p ../dist/lib/alsa-lib ../dist/bin + cp usr/bin/*bc ../dist/bin/bc + cp usr/lib/lib*.so.* ../dist/lib/ + rm ../dist/lib/lib*.so.*.* + cp usr/lib/ld-linux-armhf.so.3 ../dist/lib/ + cp usr/lib/pulseaudio/libpulsecommon-*.so ../dist/lib/ + cp usr/lib/alsa-lib/libasound_module_pcm_pulse.so ../dist/lib/alsa-lib/ + chmod -x ../dist/lib/lib* ../dist/lib/alsa-lib/libasound_module_pcm_pulse.so +fi + +if [ ! -x /lib/ld-linux-armhf.so.3 ] ; then + echo "/lib/ld-linux-armhf.so.3 not found, installing..." + sudo cp -v ../dist/lib/ld-linux-armhf.so.3 /lib/ +fi + +if [ ! -x ../dist/bin/npplayer ] ; then + cat ../devpkglist | xargs usr/bin/xbps-install.static -r $PWD -Sy + ln -sf usr/lib . + ln -sf usr/bin . + mkdir -p src tmp dev + touch dev/null + cp -al ../external/* src/ + + cat > inner-build.sh < /dev/null ; then @@ -15,23 +18,28 @@ if pactl stat &> /dev/null ; then fi cd "$dir" -game_swf="$dir/Anodyne_STANDALONE_1_506.swf" +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" | bc` + 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" | bc` -height=`echo "($scale * 180)/1" | bc` -device_scale=`echo "scale=10; sqrt($scale/3)" | bc` +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 env LD_LIBRARY_PATH="$dir/lib" "$dir/bin/npplayer" ${fs_param:-} src="$game_swf" width="$width" height="$height" pepperflash_path="$dir/lib/plugins/libpepflashplayer.so" +exec "$dir/bin/npplayer" ${fs_param:-} src="$game_swf" width="$width" height="$height" pepperflash_path="$dir/lib/plugins/libpepflashplayer.so"