-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_console.sh
More file actions
52 lines (38 loc) · 1.26 KB
/
run_console.sh
File metadata and controls
52 lines (38 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# run from inside the repo directory
PWD=$(pwd)
PICO_8_PATH=$1
# home dir is where the pico 8 config files are generated
HOME_DIR=$PWD/pico8-home
STARTUP_CART=$HOME_DIR/carts/lab-console.p8
BACKEND_SCREEN_NAME=p8_console_backend
BACKEND_SCRIPT_PATH=$PWD/backend.py
# terminal colors from https://en.wikipedia.org/wiki/ANSI_escape_code
CYAN='\033[0;36m'
NC='\033[0m' # No Color
echo "Running Pico-8 from: $PICO_8_PATH"
echo "Using startup cart: $STARTUP_CART"
echo "Using home dir: $HOME_DIR"
mkdir -p $HOME_DIR
echo "Starting backend script..."
# kill backend screen if one is running
screen -X -S $BACKEND_SCREEN_NAME quit
# start backend screen
screen -dmS $BACKEND_SCREEN_NAME python $BACKEND_SCRIPT_PATH
echo "Backend script started on screen: $BACKEND_SCREEN_NAME"
while [ 1 ]
do
# Update
git pull
# run pico-8, using our custom home directory and console startup cart
$PICO_8_PATH -home $HOME_DIR -run $STARTUP_CART
clear
TIMESTAMP=$(date)
echo
echo -e "${CYAN}==================${NC}"
echo -e "Alt-Ctrl-Lab Pico-8 console has shut down ($TIMESTAMP)"
echo -e "${CYAN}Restarting in 3 seconds...${NC}"
echo -e "${CYAN}==================${NC}"
sleep 3
done
# kill backend screen and process
screen -X -S $BACKEND_SCREEN_NAME quit