@@ -7,6 +7,7 @@ declare -a FAILED_PORTS=()
77HEADLESS=false
88FAST=false
99AUDIO=false
10+ RENDER_ON_API=false
1011FORCE_KILL=true
1112KILL_ONLY=false
1213STATUS_ONLY=false
@@ -35,21 +36,24 @@ Usage: $0 [OPTIONS]
3536 $0 --status
3637
3738Options:
38- -p, --port PORT Specify port for Balatro instance (can be used multiple times)
39- Default: 12346 if no port specified
40- --headless Enable headless mode (sets BALATROBOT_HEADLESS=1)
41- --fast Enable fast mode (sets BALATROBOT_FAST=1)
42- --audio Enable audio (disabled by default, sets BALATROBOT_AUDIO=1)
43- --kill Kill all running Balatro instances and exit
44- --status Show information about running Balatro instances
45- -h, --help Show this help message
39+ -p, --port PORT Specify port for Balatro instance (can be used multiple times)
40+ Default: 12346 if no port specified
41+ --headless Enable headless mode (sets BALATROBOT_HEADLESS=1)
42+ --fast Enable fast mode (sets BALATROBOT_FAST=1)
43+ --audio Enable audio (disabled by default, sets BALATROBOT_AUDIO=1)
44+ --render-on-api Enable on-demand rendering - draws frame only on API calls
45+ Incompatible with --headless
46+ --kill Kill all running Balatro instances and exit
47+ --status Show information about running Balatro instances
48+ -h, --help Show this help message
4649
4750Examples:
4851 $0 # Start single instance on default port 12346
4952 $0 -p 12347 # Start single instance on port 12347
5053 $0 -p 12346 -p 12347 # Start two instances on ports 12346 and 12347
5154 $0 --headless --fast # Start with headless and fast mode on default port
5255 $0 --audio # Start with audio enabled on default port
56+ $0 --render-on-api # Start with on-demand rendering on default port
5357 $0 --kill # Kill all running Balatro instances
5458 $0 --status # Show running instances
5559
@@ -84,6 +88,10 @@ parse_arguments() {
8488 AUDIO=true
8589 shift
8690 ;;
91+ --render-on-api)
92+ RENDER_ON_API=true
93+ shift
94+ ;;
8795 --kill)
8896 KILL_ONLY=true
8997 shift
@@ -134,6 +142,15 @@ parse_arguments() {
134142 fi
135143 done
136144 PORTS=(" ${unique_ports[@]} " )
145+
146+ # Validate mutually exclusive options
147+ if [[ " $RENDER_ON_API " == " true" ]] && [[ " $HEADLESS " == " true" ]]; then
148+ echo " Error: --render-on-api and --headless are mutually exclusive" >&2
149+ echo " Choose one rendering mode:" >&2
150+ echo " --headless No rendering at all (most efficient)" >&2
151+ echo " --render-on-api Render only on API calls" >&2
152+ exit 1
153+ fi
137154}
138155
139156# Check if a port is available
@@ -252,6 +269,9 @@ start_balatro_instance() {
252269 if [[ " $AUDIO " == " true" ]]; then
253270 export BALATROBOT_AUDIO=1
254271 fi
272+ if [[ " $RENDER_ON_API " == " true" ]]; then
273+ export BALATROBOT_RENDER_ON_API=1
274+ fi
255275
256276 # Set up platform-specific Balatro configuration
257277 # Platform-specific launch
0 commit comments