Skip to content

Free games for graphing calculators: NumWorks, TI-Nspire CX, Casio fx-CG50 and soon TI-84 Plus CE. Balatro, Celeste, Hollow Knight, Minecraft and more.

Ports: a game's own TI-84 Plus CE version

Mason3635212ba1c05e8
diff --git a/platform/port.mk b/platform/port.mk
index 37044ae5..924b4289 100644
--- a/platform/port.mk
+++ b/platform/port.mk
@@ -45,7 +45,16 @@ CEDEV ?= $(HOME)/Documents/Assets/toolchains/CEdev
CE_NAME = $(shell echo '$(PORT_ID)' | tr a-z A-Z | tr -cd 'A-Z0-9' | cut -c1-8)
CE_DIR = $(PORT_OUT)/$(PORT_ID)
CE_ALL = $(abspath $(PORT_SRC) $(NP_PLATFORM)/ti84ce/np_ce.c $(PORT_COMMON))
+ifneq ($(PORT_CE),)
+# a game with a CE version of its own (PORT_CE: its folder, a CE toolchain project): its program and appvars
+port: $(PORT_DEPS)
+ $(Q) PATH="$(CEDEV)/bin:$$PATH" $(MAKE) -C $(PORT_CE) --no-print-directory
+ @mkdir -p $(CE_DIR)/bin
+ $(Q) for f in $(PORT_CE)/bin/*.8xp $(PORT_CE)/bin/*.8xv; do [ -f "$$f" ] && cp "$$f" $(CE_DIR)/bin/; done; true
+ @echo "CE $(CE_DIR)/bin"
+else
port: $(CE_DIR)/bin/$(CE_NAME).8xp
+endif
$(CE_DIR)/bin/$(CE_NAME).8xp: $(PORT_DEPS) $(PORT_SRC) $(wildcard $(NP_PLATFORM)/include/*.h) $(NP_PLATFORM)/ti84ce/np_ce.c
@rm -rf $(CE_DIR)/src && mkdir -p $(CE_DIR)/src
@n=0; for f in $(CE_ALL); do n=$$((n+1)); echo "#include \"$$f\"" > $(CE_DIR)/src/f$$n.c; done
diff --git a/tools/ports.py b/tools/ports.py
index 7b229f81..e04ae59b 100644
--- a/tools/ports.py
+++ b/tools/ports.py
@@ -60,8 +60,10 @@ def ce_name(g):
def outputs(target, g):
"""The files `make port` leaves for the calculator: (the path, its name in a zip)."""
b = os.path.join(GAMES, g, "build", target)
- if target == "ti84ce":
- return [(os.path.join(b, g, "bin", ce_name(g) + ".8xp"), ce_name(g) + ".8xp")]
+ if target == "ti84ce": # its program, and the appvars of a game with its own CE version (PORT_CE)
+ d = os.path.join(b, g, "bin")
+ fs = sorted(f for f in os.listdir(d) if f.endswith((".8xp", ".8xv"))) if os.path.isdir(d) else []
+ return [(os.path.join(d, f), f) for f in fs] or [(os.path.join(d, ce_name(g) + ".8xp"), ce_name(g) + ".8xp")]
if target == "nspire":
return [(os.path.join(b, g + ".tns"), g + ".tns")]
if target == "casio-cg":
@@ -169,11 +171,13 @@ def kit(d):
there = set(os.listdir(folder)) - {"README.txt"}
listed = {}
for g in games([], t):
- (_, name), = outputs(t, g)
- if name not in there:
- raise SystemExit(f"kit: {t}/{name} ({g}) missing")
- listed[g] = {"file": name, "size": os.path.getsize(os.path.join(folder, name))}
- extra = there - {v["file"] for v in listed.values()}
+ names = [name for _, name in outputs(t, g)]
+ for name in names:
+ if name not in there:
+ raise SystemExit(f"kit: {t}/{name} ({g}) missing")
+ size = sum(os.path.getsize(os.path.join(folder, n)) for n in names)
+ listed[g] = {"file": names[0], "size": size} if len(names) == 1 else {"files": names, "size": size}
+ extra = there - {n for v in listed.values() for n in v.get("files", [v.get("file")])}
if extra:
raise SystemExit(f"kit: {t}/ has files of no game: {' '.join(sorted(extra))}")
targets[t] = listed