2022-04-01 00:48:51 +00:00
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2020-present Fewtarius
# Source predefined functions and variables
. /etc/profile
2022-05-05 19:33:34 +00:00
if [ ! -z " ${ 1 } " ] && [ -s " ${ 1 } " ]
2022-04-01 00:48:51 +00:00
then
OPTIONS = "-run"
CART = " ${ 1 } "
else
OPTIONS = "-splore"
fi
2022-09-04 19:06:52 +00:00
if [ " ${ HW_ARCH } " = "aarch64" ]
then
STATIC_BIN = "pico8_64"
elif [ " ${ HW_ARCH } " = "x86_64" ]
then
STATIC_BIN = "pico8"
fi
2022-04-01 00:48:51 +00:00
cp -f /usr/config/SDL-GameControllerDB/gamecontrollerdb.txt /storage/roms/pico-8/sdl_controllers.txt
2022-09-04 19:06:52 +00:00
if [ -e " /storage/roms/pico-8/ ${ STATIC_BIN } " ]
2022-04-06 01:22:12 +00:00
then
2022-09-04 19:06:52 +00:00
jslisten set " ${ STATIC_BIN } "
/storage/roms/pico-8/${ STATIC_BIN } -home -root_path /storage/roms/pico-8 -joystick 0 ${ OPTIONS } " ${ CART } "
2022-09-12 21:33:16 +00:00
fi
if [ -e "/storage/roms/pico-8/pico8_dyn" ] || [ ! " $? " = 0 ]
2022-04-01 00:48:51 +00:00
then
2022-04-06 02:02:10 +00:00
jslisten set "pico8_dyn"
2022-04-06 01:22:12 +00:00
/storage/roms/pico-8/pico8_dyn -home -root_path /storage/roms/pico-8 -joystick 0 ${ OPTIONS } " ${ CART } "
else
2022-09-04 19:06:52 +00:00
text_viewer -e -w -t "Missing Pico-8 binaries!" -m "Extract your purchased pico8 and pico8.dat and place them in the pico-8 directory on your games partition."
2022-04-01 00:48:51 +00:00
fi
ret_error = $?
exit $ret_error