Last active
January 30, 2024 09:07
-
-
Save screeny05/f96fa516daa5e60d85a116dd5b5ba333 to your computer and use it in GitHub Desktop.
Box64 Tricks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# [Starting Winetricks] | |
export GLIBC_BIN=$PREFIX/glibc/bin | |
pkg install cabextract unzip p7zip which | |
wget https://github.com/ptitSeb/box64/raw/main/tests/bash | |
mv bash $GLIBC_BIN/bash86 | |
chmod +x $GLIBC_BIN/bash86 | |
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks | |
mv winetricks $GLIBC_BIN/winetricks | |
chmod +x $GLIBC_BIN/winetricks | |
unset LD_PRELOAD | |
WINESERVER=$PREFIX/glibc/bin/wineserver WINE=$PREFIX/glibc/bin/wine64 $PREFIX/glibc/bin/box64 $PREFIX/glibc/bin/bash86 $PREFIX/glibc/bin/winetricks | |
export LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so | |
# [/Starting Winetricks] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# [Starting TFM] | |
export GLIBC_BIN=$PREFIX/glibc/bin | |
. $PREFIX/glibc/opt/scripts/configs | |
. $PREFIX/glibc/opt/conf/path.conf &>/dev/null | |
. $PREFIX/glibc/opt/conf/cores.conf &>/dev/null | |
. $PREFIX/glibc/opt/conf/force_compatibility.conf &>/dev/null | |
load_configs | |
termux-x11 :0 &>/dev/null & | |
unset LD_PRELOAD | |
DISPLAY=:0 WINESERVER=$PREFIX/glibc/bin/wineserver WINE=$PREFIX/glibc/bin/wine64 $PREFIX/glibc/bin/box64 $PREFIX/glibc/bin/wine64 explorer /desktop=shell $PREFIX/glibc/opt/apps/tfm.exe | |
export LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so | |
# [/Starting TFM] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir -p /sdcard/Android/data/com.termux/files/Download | |
function stop-all { | |
pkill -f "app_process / com.termux.x11" | |
rm -rf $PREFIX/tmp/pulse-* | |
pulseaudio -k &>/dev/null | |
unset PULSE_SERVER | |
pkill pulseaudio | |
rm -rf $PREFIX/tmp/.virgl_test &>/dev/null | |
pkill virgl | |
rm -rf $PREFIX/tmp/.virgl_test &>/dev/null | |
} | |
stop-all | |
if [ -e $PREFIX/glibc/opt/virgl/virgl-enabled ]; then | |
chmod +x $PREFIX/glibc/opt/virgl/libvirgl_test_server.so | |
TMPDIR=$PREFIX/tmp $PREFIX/glibc/opt/virgl/libvirgl_test_server.so &>/dev/null & | |
fi | |
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 | |
termux-x11 :0 &>/dev/null & | |
sleep 1 | |
if [ -e $PREFIX/glibc/opt/virgl/virgl-enabled ]; then | |
chmod 777 $PREFIX/tmp/.virgl_test | |
fi | |
export RESOLUTION=1280x1024 | |
if [ "$STARTUP_COMPATIBILITY_MODE" = "1" ]; then | |
autores="" | |
else | |
autores=$(DISPLAY=:0 xrandr | grep current | awk '{print $8$9$10}' | tr -d ,) | |
fi | |
if [ ! "$autores" = "1280x1024" ] && [ ! "$autores" = "" ]; then | |
export RESOLUTION=$autores | |
echo "$autores">$PREFIX/glibc/opt/last-resolution.conf | |
elif [ -e $PREFIX/glibc/opt/last-resolution.conf ]; then | |
export RESOLUTION=$(cat $PREFIX/glibc/opt/last-resolution.conf) | |
fi | |
chmod +x $PREFIX/glibc/bin/{box86,box64} | |
chmod +x $WINE_PATH/bin/{wine,wine64,wineserver} | |
patchelf --force-rpath --set-rpath $PREFIX/glibc/lib --set-interpreter $PREFIX/glibc/lib/ld-linux-aarch64.so.1 $PREFIX/glibc/bin/box64 | |
patchelf --force-rpath --set-rpath $PREFIX/glibc/lib32 --set-interpreter $PREFIX/glibc/lib32/ld-linux-armhf.so.3 $PREFIX/glibc/bin/box86 | |
rm -rf $PREFIX/glibc/bin/{wine,wine64,wineserver} | |
ln -sf $WINE_PATH/bin/wine $PREFIX/glibc/bin/wine | |
ln -sf $WINE_PATH/bin/wine64 $PREFIX/glibc/bin/wine64 | |
ln -sf $WINE_PATH/bin/wineserver $PREFIX/glibc/bin/wineserver | |
export GLIBC_BIN=$PREFIX/glibc/bin | |
## export PATH=$PREFIX/glibc/wine/lib:$PREFIX/glibc/wine/lib64:$PATH | |
unset LD_PRELOAD | |
## $GLIBC_BIN/box64 $GLIBC_BIN/wineserver -k &>/dev/null | |
load_configs | |
export PULSE_SERVER=127.0.0.1 | |
ln -sf $(df -H | grep -o "/storage/....-....") "$WINEPREFIX/dosdevices/f:" &>/dev/null | |
DISPLAY=:0 LC_ALL=$(cat $PREFIX/glibc/opt/locale.conf) taskset -c $PRIMARY_CORES $GLIBC_BIN/box64 $GLIBC_BIN/wine64 explorer /desktop=shell,$RESOLUTION $PREFIX/glibc/opt/apps/tfm.exe >$LOG_PATH 2>&1 & | |
taskset -c $SECONDARY_CORES $GLIBC_BIN/box64 $GLIBC_BIN/wine64 explorer /desktop=shell,$RESOLUTION $PREFIX/glibc/bin/ib.exe &>/dev/null & | |
DISPLAY=:0 taskset -c $SECONDARY_CORES $GLIBC_BIN/box64 $GLIBC_BIN/wine64 explorer /desktop=shell,$RESOLUTION $PREFIX/glibc/opt/apps/f5taskmgr.exe &>/dev/null & | |
sleep 2 | |
if [ "$STARTUP_WINEDEVICE_MODE" = "0" ]; then | |
$GLIBC_BIN/box64 $GLIBC_BIN/wine64 taskkill /f /im services.exe &>/dev/null & | |
fi | |
am start --user 0 -n com.termux.x11/.MainActivity &>/dev/null | |
DISPLAY=:0 LC_ALL=$(cat $PREFIX/glibc/opt/locale.conf) $GLIBC_BIN/box64 $GLIBC_BIN/wine64 explorer /desktop=shell,1280x1024 $PREFIX/glibc/opt/apps/tfm.exe | |
echo "Enter 1 to stop" | |
REBOOT=0 | |
while true; do | |
if [ -e $PREFIX/glibc/opt/shutdown ]; then | |
rm -rf $PREFIX/glibc/opt/shutdown | |
$GLIBC_BIN/box64 $GLIBC_BIN/wineserver -k &>/dev/null | |
break | |
fi | |
if [ -e $PREFIX/glibc/opt/reboot ]; then | |
rm -rf $PREFIX/glibc/opt/reboot | |
$GLIBC_BIN/box64 $GLIBC_BIN/wineserver -k &>/dev/null | |
REBOOT=1 | |
break | |
fi | |
read -t 3 i | |
case "$i" in | |
1) | |
$GLIBC_BIN/box64 $GLIBC_BIN/wineserver -k &>/dev/null | |
break | |
;; | |
esac | |
done | |
export LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so | |
stop-all | |
if [ "$REBOOT" = "1" ]; then | |
exec $0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment