Files
lilygo-t-deck/emulator/Makefile
T
Dejvino 3cf17a9a5f Add basic sounds and bloops for NetDeck
- Add SoundEngine I2S audio renderer (TONE/SWEEP/NOISE)
- Add gameplay sounds: unit hit, unit death, door open/close, laser fire
- Add network sounds: ICE cracking, trace progress, link severed
- Add UI sounds: click confirm, key presses, view switch, FRENZY/BLIND
- Add network state sounds: node select, link build, ICE cracking
- Emulator: default to 960x720 window (3x scaling)
- Update STATUS.md with M4 done

All 21 tests pass (14 unit + 7 integration, 0 failures).
2026-11-14 19:01:50 +01:00

99 lines
3.5 KiB
Makefile

# SDL3 emulator for T-Deck example sketches (run the app on your PC)
#
# make build the MissileCommand emulator (default)
# make APP=CrtTerminal build the CRT terminal emulator
# make run [APP=...] build + launch the window
# make smoke [APP=...] headless test: N frames, dump the last frame
# make clean [APP=...] remove the binary + smoke frame
#
# The sketch is included by src/main.cpp as a single translation unit:
# -DAPP_INO='"<App>.ino"'. Apps with a sound_engine.cpp get it linked
# automatically (wildcard).
APP ?= MissileCommand
APP_DIR := ../examples/$(APP)
ifeq ($(APP),MissileCommand)
APP_TITLE := Missile Command
DEFS += -DEMU_APP_MISSILECOMMAND
endif
ifeq ($(APP),CrtTerminal)
APP_TITLE := CRT Terminal
endif
ifeq ($(APP),NetDeck)
APP_TITLE := NetDeck // Breach & Board
# the sketch moved to src/netdeck (next to nd_layout.h); its hardware
# shim header utilities.h stays with the pio project in examples/NetDeck
APP_DIR := ../src/netdeck
APP_EXTRA_INC := ../examples/NetDeck
endif
ifeq ($(APP),Lotus3)
APP_TITLE := Lotus 3
DEFS += -DEMU_APP_LOTUS3
ifdef AUTOPLAY
DEFS += -DAUTOPLAY
endif
endif
APP_TITLE ?= $(APP)
CXX ?= g++
CXXFLAGS ?= -std=gnu++17 -O2 -Wall -Wextra
SDLFLAGS := $(shell pkg-config --cflags sdl3 sdl3-ttf)
INC := -Isrc/shim -I$(APP_DIR) $(if $(APP_EXTRA_INC),-I$(APP_EXTRA_INC))
LIBS := $(shell pkg-config --libs sdl3 sdl3-ttf)
DEFS += -DAPP_INO='"$(APP).ino"' -DAPP_NAME='"$(APP_TITLE)"'
SHIMS := $(wildcard src/shim/*.h) $(wildcard src/shim/driver/*.h)
SKETCH_SRCS := $(APP_DIR)/$(APP).ino $(wildcard $(APP_DIR)/*.h)
SOUND_SRC := $(wildcard $(APP_DIR)/sound_engine.cpp)
EMU := $(APP)-emu
# Headless test binaries (tests/): same single-TU sketch inclusion as
# main.cpp, no window. Unit+integration share one fast binary; E2E is a
# separate build driving the real loop() through the device input pipeline.
TESTS := $(wildcard tests/*.h tests/*.cpp tests/e2e/*.cpp)
TESTS_INC := $(INC) -Itests
.PHONY: all run smoke test test-unit test-e2e clean
all: $(EMU)
$(EMU): src/main.cpp $(SOUND_SRC) $(APP_DIR)/$(APP).ino $(SHIMS)
$(CXX) $(CXXFLAGS) $(SDLFLAGS) $(INC) $(DEFS) \
src/main.cpp $(SOUND_SRC) -o $@ $(LIBS)
run: $(EMU)
./$(EMU)
# Headless smoke test: dummy video/audio, run N frames, save the last frame.
# Feed keys via --type "text" (queued a few chars per frame).
smoke: $(EMU)
./$(EMU) --frames 240 --dump smoke_frame.bmp
# --- tests -----------------------------------------------------------------
# fast layer: unit + integration (deterministic, sim stepped directly)
SOUND_SRC := $(wildcard $(APP_DIR)/sound_engine.cpp)
$(APP)-tests: tests/test_main.cpp tests/shim_globals.cpp tests/harness.h \
tests/sim_helpers.h tests/unit_tests.h tests/integration_tests.h \
$(SHIMS) $(SKETCH_SRCS) $(SOUND_SRC)
$(CXX) $(CXXFLAGS) $(SDLFLAGS) $(TESTS_INC) $(DEFS) \
tests/shim_globals.cpp tests/test_main.cpp $(SOUND_SRC) -o $@ $(LIBS)
# slow layer: E2E journeys through the real loop() + input pipeline (own build)
$(APP)-e2e: tests/e2e_tests.cpp tests/shim_globals.cpp tests/harness.h \
tests/sim_helpers.h $(SHIMS) $(SKETCH_SRCS) $(SOUND_SRC)
$(CXX) $(CXXFLAGS) $(SDLFLAGS) $(TESTS_INC) $(DEFS) \
tests/shim_globals.cpp tests/e2e_tests.cpp $(SOUND_SRC) -o $@ $(LIBS)
test-unit: $(APP)-tests
./$(APP)-tests unit
test: test-unit
./$(APP)-tests integration
test-e2e: $(APP)-e2e
SDL_VIDEODRIVER=dummy ./$(APP)-e2e
clean:
rm -f $(EMU) $(APP)-tests $(APP)-e2e smoke_frame.bmp