|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share} |
| 4 | + |
| 5 | +if [ -d "/opt/system/Tools/PortMaster/" ]; then |
| 6 | + controlfolder="/opt/system/Tools/PortMaster" |
| 7 | +elif [ -d "/opt/tools/PortMaster/" ]; then |
| 8 | + controlfolder="/opt/tools/PortMaster" |
| 9 | +elif [ -d "$XDG_DATA_HOME/PortMaster/" ]; then |
| 10 | + controlfolder="$XDG_DATA_HOME/PortMaster" |
| 11 | +else |
| 12 | + controlfolder="/roms/ports/PortMaster" |
| 13 | +fi |
| 14 | + |
| 15 | +source $controlfolder/control.txt |
| 16 | + |
| 17 | +[ -f "${controlfolder}/mod_${CFW_NAME}.txt" ] && source "${controlfolder}/mod_${CFW_NAME}.txt" |
| 18 | + |
| 19 | +get_controls |
| 20 | + |
| 21 | +GAMEDIR=/$directory/ports/entropipes |
| 22 | +CONFDIR="$GAMEDIR/conf" |
| 23 | +PYXEL_PKG="entropipes.pyxapp" |
| 24 | + |
| 25 | +cd "${GAMEDIR}" |
| 26 | + |
| 27 | +> "${GAMEDIR}/log.txt" && exec > >(tee "${GAMEDIR}/log.txt") 2>&1 |
| 28 | + |
| 29 | +mkdir -p "$GAMEDIR/conf" |
| 30 | +bind_directories "$HOME/.config/.pyxel/entropipes" "$CONFDIR" |
| 31 | +# note: replace gamename with the appropriate value for the game |
| 32 | + |
| 33 | +# Load Pyxel runtime |
| 34 | +runtime="pyxel_2.2.8_python_3.11" |
| 35 | +export pyxel_dir="$HOME/pyxel" |
| 36 | +mkdir -p "${pyxel_dir}" |
| 37 | + |
| 38 | +if [ ! -f "$controlfolder/libs/${runtime}.squashfs" ]; then |
| 39 | + # Check for runtime if not downloaded via PM |
| 40 | + if [ ! -f "$controlfolder/harbourmaster" ]; then |
| 41 | + pm_message "This port requires the latest PortMaster to run, please go to https://portmaster.games/ for more info." |
| 42 | + sleep 5 |
| 43 | + exit 1 |
| 44 | + fi |
| 45 | + |
| 46 | + $ESUDO $controlfolder/harbourmaster --quiet --no-check runtime_check "${runtime}.squashfs" |
| 47 | +fi |
| 48 | + |
| 49 | +if [[ "$PM_CAN_MOUNT" != "N" ]]; then |
| 50 | + $ESUDO umount "${pyxel_dir}" |
| 51 | +fi |
| 52 | + |
| 53 | +$ESUDO mount "$controlfolder/libs/${runtime}.squashfs" "${pyxel_dir}" |
| 54 | + |
| 55 | +export SDL_GAMECONTROLLERCONFIG="$sdl_controllerconfig" |
| 56 | + |
| 57 | +$GPTOKEYB "pyxel" & |
| 58 | + |
| 59 | +pm_platform_helper "${pyxel_dir}/bin/pyxel" |
| 60 | + |
| 61 | +# Enable Pyxel virtual env |
| 62 | +source "${pyxel_dir}/bin/activate" |
| 63 | +export PYTHONHOME="${pyxel_dir}" |
| 64 | +export PYTHONPYCACHEPREFIX="${GAMEDIR}/${runtime}.cache" |
| 65 | + |
| 66 | +# play the pyxel package stored in gamedata |
| 67 | +"${pyxel_dir}/bin/pyxel" play "${GAMEDIR}/${PYXEL_PKG}" |
| 68 | + |
| 69 | +# Alternatively, run a python script file |
| 70 | +# "${pyxel_dir}/bin/pyxel" run gamedata/main.py |
| 71 | + |
| 72 | +if [[ "$PM_CAN_MOUNT" != "N" ]]; then |
| 73 | + $ESUDO umount "${pyxel_dir}" |
| 74 | +fi |
| 75 | + |
| 76 | +pm_finish |
0 commit comments