emulator-template: Neutralize demo slot, add 10s auto-exit safety hatch
Make the template foolproof to copy-and-fill for a new demo: - examples/Conway/ replaced by a neutral examples/Demo/Demo.cpp sample (bouncing box) documenting the full sketch contract (setup/loop, emuGfx::fb, emuGfx::dirty, emu::keyboard) - Makefile passes the sketch path as -DAPP_SRC; main.cpp now includes APP_SRC instead of hardcoding Conway.cpp, window title uses APP_NAME - Safety hatch: emulator auto-exits after 10 seconds by default so a runaway demo can't hang and eat resources; --user-run disables the cap, --timeout MS adjusts it (default 10000) - README rewritten as a step-by-step recipe: replace the Demo sketch, run 'make run'; documents all CLI flags, drops the unimplemented --dump-interval flag Verified: fresh copy + sketch swap builds and renders; hatch fires at 10s (and at --timeout 2000); --user-run runs until --frames cap.
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
# Minimal Makefile for the T-Deck emulator-only template.
|
||||
# Build & run: make run (from this directory)
|
||||
# Build & run: make run (from this directory)
|
||||
# Smoke test: make smoke
|
||||
#
|
||||
# This Makefile is self-contained: all sources (shim, main, sketch)
|
||||
# are relative to this Makefile's directory. Copy the whole folder
|
||||
# for a new project — no path adjustments needed.
|
||||
#
|
||||
# The sketch lives in examples/$(APP)/$(APP).cpp and provides setup()/loop().
|
||||
# Default is the bundled sample demo; replace it to make your own.
|
||||
|
||||
APP ?= Conway
|
||||
APP ?= Demo
|
||||
APP_DIR := examples/$(APP)
|
||||
|
||||
# SDL3 flags via pkg-config
|
||||
@@ -19,15 +22,17 @@ CXXFLAGS ?= -std=gnu++17 -O2 -Wall -Wextra
|
||||
# Include current directory for shim.h, and the sketch directory
|
||||
INC := -I . -I $(APP_DIR)
|
||||
|
||||
# Preprocessor definitions: the .ino filename and app name
|
||||
DEFS += -DAPP_INO='"$(APP).ino"' -DAPP_NAME='"$(APP)"'
|
||||
# Preprocessor definitions: app name, .ino filename, and the sketch source
|
||||
# path. main.cpp does `#include APP_SRC`, so switching APP is enough.
|
||||
DEFS += -DAPP_INO='"$(APP).ino"' -DAPP_NAME='"$(APP)"' \
|
||||
-DAPP_SRC='"$(APP_DIR)/$(APP).cpp"'
|
||||
|
||||
# Source files — the sketch .cpp is included by main.cpp via #include,
|
||||
# so they compile as a single translation unit.
|
||||
SHIMS := $(wildcard *.h) # picks up shim.h at template root
|
||||
|
||||
# Main entry point for this template (standalone, no HW deps)
|
||||
# main.cpp includes examples/Conway/Conway.cpp forming one TU.
|
||||
# main.cpp includes examples/$(APP)/$(APP).cpp forming one TU.
|
||||
EMU_MAIN := src/main.cpp
|
||||
|
||||
EMU := $(APP)-emu
|
||||
|
||||
Reference in New Issue
Block a user