Skip to content

Commit

Permalink
add Hangover
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreRH committed Oct 28, 2024
1 parent 82d8790 commit 9aafd5b
Show file tree
Hide file tree
Showing 8 changed files with 342 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/Hangover/credits
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AndreRH
10 changes: 10 additions & 0 deletions apps/Hangover/description
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Hangover runs simple Win64 and Win32 applications on arm64 Linux. Only the application is emulated instead of a whole Wine installation.

Examples on how to run:

$ wine your_x86_64_application.exe # Uses FEX for 64-bit apps
$ wine your_x86_application.exe # To use Box64 for 32-bit apps
$ HODLL=libwow64fex.dll wine your_x86_application.exe # To use FEX for 32-bit apps
$ HODLL=xtajit.dll taskset -c 1 wine your_x86_application.exe # To use QEMU for 32-bit apps

For more information see https://github.com/AndreRH/hangover/blob/master/README.md
Binary file added apps/Hangover/icon-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/Hangover/icon-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
305 changes: 305 additions & 0 deletions apps/Hangover/install-64
Original file line number Diff line number Diff line change
@@ -0,0 +1,305 @@
#!/bin/bash

version=9.20

# https://github.com/raspberrypi/bookworm-feedback/issues/107
PAGE_SIZE="$(getconf PAGE_SIZE)"
if [[ "$PAGE_SIZE" == "16384" ]]; then
#switch to 4K pagesize kernel
if [ -f /boot/config.txt ] || [ -f /boot/firmware/config.txt ]; then
if [ -f /boot/firmware/config.txt ]; then
boot_config="/boot/firmware/config.txt"
elif [ -f /boot/config.txt ]; then
boot_config="/boot/config.txt"
fi
text="Raspberry Pi 5 PiOS images ship by default with a 16K PageSize Linux Kernel.
This kernel causes incompatibilities with some software including Wine https://github.com/raspberrypi/bookworm-feedback/issues/107
Would you like to automatically switch to a 4K PageSize Linux Kernel?"
userinput_func "$text" "No, keep 16K PageSize Kernel and Exit" "Yes, switch to 4K PageSize Kernel"
if [ "$output" == "No, keep 16K PageSize Kernel and Exit" ]; then
error "User error: Your current running kernel is built with 16K PageSize and is incompatible with Wine (x64) with Box64. You must switch to a 4K PageSize kernel (and chose to not do so automatically) before installing Wine (x64)."
fi
echo "" | sudo tee --append $boot_config >/dev/null
echo "[pi5]" | sudo tee --append $boot_config >/dev/null
echo "kernel=kernel8.img" | sudo tee --append $boot_config >/dev/null
echo -e "The 4K PageSize Kernel has been enabled by adding 'kernel=kernel8.img' to $boot_config\nPlease reboot now and install the Wine (x64) app again."
sleep infinity
else
error "User error (reporting allowed): Your current running kernel is built with 16K PageSize and is incompatible with Wine (x64) with Box64. Changing kernels automatically cannot be done since no /boot/config.txt or /boot/firmware/config.txt file was found."
fi
fi

if [ "$__os_codename" == "bullseye" ]; then
ho_distro="debian11"
elif [ "$__os_codename" == "bookworm" ]; then
ho_distro="debian12"
elif [ "$__os_codename" == "focal" ]; then
ho_distro="ubuntu2004"
elif [ "$__os_codename" == "jammy" ]; then
ho_distro="ubuntu2204"
elif [ "$__os_codename" == "noble" ]; then
ho_distro="ubuntu2404"
else
error "User error: You are not using a supported Pi-Apps distribution."
fi

cd /tmp || error "Could not move to /tmp folder"
wget https://github.com/AndreRH/hangover/releases/download/hangover-${version}/hangover_${version}_${ho_distro}_${__os_codename}_arm64.tar || error "Failed to download Hangover!"
tar -xf hangover_${version}_${ho_distro}_${__os_codename}_arm64.tar || error "Failed to extract Hangover!"
rm -f hangover_${version}_${ho_distro}_${__os_codename}_arm64.tar
install_packages /tmp/hangover-libarm64ecfex_${version}_arm64.deb /tmp/hangover-libqemu_${version}~${__os_codename}_arm64.deb /tmp/hangover-libwow64fex_${version}_arm64.deb /tmp/hangover-wine_${version}~${__os_codename}_arm64.deb || exit 1
rm -f ./hangover-libarm64ecfex_${version}_arm64.deb ./hangover-libqemu_${version}~${__os_codename}_arm64.deb ./hangover-libwow64fex_${version}_arm64.deb ./hangover-wine_${version}~${__os_codename}_arm64.deb

cat << EOF | sudo tee /usr/local/bin/generate-hangover-prefix >/dev/null
#!/bin/bash
echo
#set up functions
$(declare -f error)
$(declare -f status)
$(declare -f status_green)
$(declare -f warning)
$(declare -f userinput_func)
if [ "\$(id -u)" == 0 ];then
error "Please don't run this script with sudo."
fi
if [ -z "\$WINEPREFIX" ];then
WINEPREFIX="\$HOME/.wine"
fi
export WINEPREFIX
if [ -f "\$WINEPREFIX/system.reg" ];then
registry_exists=true
else
registry_exists=false
fi
export WINEDEBUG=-virtual #hide harmless memory errors
if [ -e "\$WINEPREFIX" ];then
status "Checking Wine prefix at \$WINEPREFIX..."
echo "To choose another prefix, set the WINEPREFIX variable."
echo -n "Waiting 5 seconds... "
sleep 5
echo
# check for existance of incompatible prefix (see server_init_process https://github.com/wine-mirror/wine/blob/884cff821481b4819f9bdba455217bd5a3f97744/dlls/ntdll/unix/server.c#L1544-L1670)
# Boot wine and check for errors (make fresh wineprefix)
output="\$(set -o pipefail; wine wineboot 2>&1 | tee /dev/stderr; )" #this won't display any dialog boxes that require a button to be clicked
if [ "\$?" != 0 ]; then
text="Your previously existing Wine prefix failed with an error (see terminal log).
Would you like to remove and regenerate your Wine prefix? Doing so will delete anything you may have installed into your Wine prefix."
userinput_func "\$text" "No, keep broken Wine prefix and Exit" "Yes, delete and regenerate Wine prefix"
if [ "\$output" == "No, keep broken Wine prefix and Exit" ]; then
error "User error: Your current Wine prefix caused Wine to error on launch and you chose to keep it. Manually correct your Wine prefix before installing or updating Wine (x64)."
fi
warning "Your previously existing Wine prefix failed with an error (see above). You chose to remove it and so it will be re-generated."
rm -rf "\$WINEPREFIX"
registry_exists=false
wine wineboot #this won't display any dialog boxes that require a button to be clicked
fi
#wait until above process exits
sleep 2
while [ ! -z "\$(pgrep -i 'wine C:')" ];do
sleep 1
done
else
status "Generating Wine prefix at \$WINEPREFIX..."
echo "To choose another prefix, set the WINEPREFIX variable."
echo "Waiting 5 seconds..."
sleep 5
# Boot wine (make fresh wineprefix)
wine wineboot #this won't display any dialog boxes that require a button to be clicked
#wait until above process exits
sleep 2
while [ ! -z "\$(pgrep -i 'wine C:')" ];do
sleep 1
done
fi
if [ "\$registry_exists" == false ];then
status "Making registry changes..."
TMPFILE="\$(mktemp)" || exit 1
echo 'REGEDIT4' > \$TMPFILE
#enable font smoothing - see https://askubuntu.com/a/219795
echo " - Font smoothing"
MODE=2 # 0 = disabled; 2 = enabled
TYPE=2 # 1 = regular; 2 = subpixel
ORIENTATION=1 # 0 = BGR; 1 = RGB
echo '
[HKEY_CURRENT_USER\Control Panel\Desktop]
"FontSmoothing"="'\$MODE'"
"FontSmoothingOrientation"=dword:0000000'\$ORIENTATION'
"FontSmoothingType"=dword:0000000'\$TYPE'
"FontSmoothingGamma"=dword:00000578' >> \$TMPFILE
echo " - Windows 10 appearance theme"
mkdir -p "\$WINEPREFIX/drive_c/windows/Resources/Themes/Windows_10"
cp -f /opt/wine-${version}/Windows_10.msstyles "\$WINEPREFIX/drive_c/windows/Resources/Themes/Windows_10"
echo '
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ThemeManager]
"ColorName"="NormalColor"
"DllName"="C:\\\\windows\\\\Resources\\\\Themes\\\\Windows_10\\\\Windows_10.msstyles"
"FlatMenu"=dword:00000000
"GradientCaption"=dword:00000001
"IconTitleFont"=hex:f5,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,\
00,00,00,00,00,00,00,00,22,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"NonClientMetrics"=hex:f8,01,00,00,01,00,00,00,10,00,00,00,10,00,00,00,12,00,\
00,00,12,00,00,00,f5,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,bc,02,00,\
00,00,00,00,00,00,00,00,22,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,0f,00,\
00,00,0f,00,00,00,fa,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,\
00,00,00,00,00,00,00,00,22,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,12,00,\
00,00,12,00,00,00,f5,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,\
00,00,00,00,00,00,00,00,22,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,f5,ff,\
ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,00,00,00,00,00,00,00,\
22,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,f5,ff,ff,ff,00,00,00,00,00,00,\
00,00,00,00,00,00,90,01,00,00,00,00,00,00,00,00,00,22,54,00,61,00,68,00,6f,\
00,6d,00,61,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00
"SizeName"="NormalSize"
"ThemeActive"="1"
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ThemeManager\Control Panel\Colors]
"ActiveBorder"="212 208 200"
"ActiveTitle"="10 36 106"
"AppWorkSpace"="128 128 128"
"Background"="58 110 165"
"ButtonAlternateFace"="181 181 181"
"ButtonDkShadow"="64 64 64"
"ButtonFace"="212 208 200"
"ButtonHilight"="255 255 255"
"ButtonLight"="212 208 200"
"ButtonShadow"="128 128 128"
"ButtonText"="0 0 0"
"GradientActiveTitle"="166 202 240"
"GradientInactiveTitle"="192 192 192"
"GrayText"="128 128 128"
"Hilight"="10 36 106"
"HilightText"="255 255 255"
"HotTrackingColor"="0 0 200"
"InactiveBorder"="212 208 200"
"InactiveTitle"="128 128 128"
"InactiveTitleText"="212 208 200"
"InfoText"="0 0 0"
"InfoWindow"="255 255 225"
"Menu"="212 208 200"
"MenuBar"="212 208 200"
"MenuHilight"="10 36 106"
"MenuText"="0 0 0"
"Scrollbar"="212 208 200"
"TitleText"="255 255 255"
"Window"="255 255 255"
"WindowFrame"="0 0 0"
"WindowText"="0 0 0"
[HKEY_CURRENT_USER\Control Panel\Colors]
"ActiveBorder"="212 208 200"
"ActiveTitle"="115 188 238"
"AppWorkSpace"="128 128 128"
"Background"="0 0 0"
"ButtonAlternateFace"="181 181 181"
"ButtonDkShadow"="106 106 106"
"ButtonFace"="240 240 240"
"ButtonHilight"="255 255 255"
"ButtonLight"="227 227 227"
"ButtonShadow"="165 165 165"
"ButtonText"="0 0 0"
"GradientActiveTitle"="115 188 238"
"GradientInactiveTitle"="158 214 250"
"GrayText"="165 165 165"
"Hilight"="231 239 245"
"HilightText"="0 0 0"
"HotTrackingColor"="59 152 211"
"InactiveBorder"="212 208 200"
"InactiveTitle"="158 214 250"
"InactiveTitleText"="150 150 150"
"InfoText"="0 0 0"
"InfoWindow"="255 255 225"
"Menu"="255 255 255"
"MenuBar"="240 240 240"
"MenuHilight"="230 230 230"
"MenuText"="0 0 0"
"Scrollbar"="212 208 200"
"TitleText"="28 28 28"
"Window"="255 255 255"
"WindowFrame"="0 0 0"
"WindowText"="0 0 0"
[HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics]
"BorderWidth"="1"
"CaptionFont"=hex:08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,bc,02,00,00,\
00,00,00,00,00,00,00,22,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"IconFont"=hex:09,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,00,\
00,00,01,00,00,00,00,53,00,65,00,67,00,6f,00,65,00,20,00,55,00,49,00,20,00,\
53,00,65,00,6d,00,69,00,62,00,6f,00,6c,00,64,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"MenuFont"=hex:08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,00,\
00,00,00,00,00,00,22,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"MessageFont"=hex:08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,\
00,00,00,00,00,00,00,22,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"ScrollHeight"="-255"
"ScrollWidth"="-255"
"SmCaptionFont"=hex:05,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,\
00,00,00,00,01,00,00,00,00,53,00,65,00,67,00,6f,00,65,00,20,00,55,00,49,00,\
20,00,53,00,65,00,6d,00,69,00,62,00,6f,00,6c,00,64,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"SmCaptionHeight"="-300"
"SmCaptionWidth"="-300"
"StatusFont"=hex:08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,\
00,00,00,00,00,00,00,22,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00' >> \$TMPFILE
echo " - Setting DPI to 120"
echo '
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Hardware Profiles\Current\Software\Fonts]
"LogPixels"=dword:00000078
[HKEY_CURRENT_USER\Software\Wine\Fonts]
"LogPixels"=dword:00000078
[HKEY_CURRENT_USER\Control Panel\Desktop]
"LogPixels"=dword:00000078' >> \$TMPFILE
echo " - Disabling Wine mime associations" #see https://askubuntu.com/a/400430
echo '
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServices]
"winemenubuilder"="C:\\\\windows\\\\system32\\\\winemenubuilder.exe -r"
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices]
"winemenubuilder"="C:\\\\windows\\\\system32\\\\winemenubuilder.exe -r"' >> \$TMPFILE
wine regedit \$TMPFILE
rm -f \$TMPFILE
fi #end of if statement that only runs if this script was started when there was no wine registry
true
EOF

sudo chmod +x /usr/local/bin/generate-hangover-prefix
/usr/local/bin/generate-hangover-prefix || exit 1
24 changes: 24 additions & 0 deletions apps/Hangover/uninstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

pkill -9 wine
command -v wineserver >/dev/null && wineserver -k

status -n "Removing terminal commands... "
sudo rm -rf /usr/local/bin/generate-wine-prefix
status_green "Done"

status -n "Removing mimetypes... "
#See: https://askubuntu.com/a/400430
rm -f ~/.local/share/mime/packages/x-wine*
rm -f ~/.local/share/applications/wine-extension*
rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*
rm -f ~/.local/share/mime/application/x-wine-extension*
status_green "Done"

purge_packages || exit 1

if [ -e "$HOME/.wine" ];then
echo -e "\n\n\e[93mYou just uninstalled the Hangover app, but it's not completely gone yet.
To prevent data loss, your Wine configuration is still\nlocated in the $HOME/.wine folder. Feel free to delete it to save space or to rename the folder for troubleshooting.\e[39m\n"
fi
true
1 change: 1 addition & 0 deletions apps/Hangover/website
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/AndreRH/hangover
1 change: 1 addition & 0 deletions etc/categories
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Gnumeric|Office
Godot|Games
GParted|System Management
Guake Terminal|Terminals
Hangover|Tools/Emulation
Heroes 2|Games
Https File Server|Tools
HTTrack Website Copier|Internet
Expand Down

0 comments on commit 9aafd5b

Please sign in to comment.