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.

Kit: NumPlay in French and Chinese, and how it starts comes with its name

Mason363180edd748800
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 48f187f1..acd0dad6 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -42,7 +42,7 @@ jobs:
rustup target add thumbv7em-none-eabihf
- name: Build
- run: make -j4 nwa apps check NWLINK=nwlink && make lang NWLINK=nwlink && make kit NWLINK=nwlink
+ run: make -j4 nwa apps check NWLINK=nwlink && make lang NWLINK=nwlink && make kit-langs NWLINK=nwlink
- uses: actions/upload-artifact@v4
with:
diff --git a/Makefile b/Makefile
index 86cca9c2..da9ffb49 100644
--- a/Makefile
+++ b/Makefile
@@ -62,7 +62,7 @@ ARM_CFLAGS = -std=gnu11 $(EADK_CFLAGS) -DNP_VERSION='"$(VERSION)"' -Os -Wall -We
ARM_LINK = -nostartfiles --specs=nano.specs -Wl,--relocatable -Wl,--gc-sections -Wl,-e,main \
-Wl,-u,eadk_app_name -Wl,-u,eadk_app_icon -Wl,-u,eadk_api_level
-.PHONY: all nwa apps check sim emu clean lang kit FORCE
+.PHONY: all nwa apps check sim emu clean lang kit kit-langs FORCE
all: nwa apps
nwa: $(foreach v,$(VARIANTS),$(B)/$(v).nwa) $(B)/NumPlay-Upsilon.nwa
@@ -176,7 +176,17 @@ kit: $(KIT)/base.o $(B)/arm/arena.o $(KIT_GAMES) $(B)/NumPlay.nwa \
$(foreach v,$(VARIANTS),$(B)/variant/$(v)-name.o $(B)/variant/$(v)-icon.o)
$(PY) tools/kit.py games/games.json $(B) $(B)/site-kit --version $(VERSION) --variants "$(VARIANTS)" \
--default "$(GAMES)" --upsilon "$(UPSILON_GAMES)" --app-space $(APP_SPACE) --ram $(CUSTOM_RAM) \
- --upsilon-ram $(UPSILON_RAM) --nwlink "$(NWLINK)"
+ --upsilon-ram $(UPSILON_RAM) --nwlink "$(NWLINK)" --langs "$(LANGS)"
+
+# ...and in French and Chinese, from each language's tree (make lang), in site-kit/<code>
+kit-langs: kit
+ @for l in $(LANGS); do \
+ [ -d $(B)/lang/$$l ] || $(PY) tools/lang.py tree $$l $(B)/lang/$$l || exit 1; \
+ $(MAKE) -C $(B)/lang/$$l kit NWLINK="$(NWLINK)" || exit 1; \
+ rm -rf $(B)/site-kit/$$l && mkdir -p $(B)/site-kit/$$l && \
+ cp -R $(B)/lang/$$l/build/site-kit/kit.json $(B)/lang/$$l/build/site-kit/base.o.gz \
+ $(B)/lang/$$l/build/site-kit/arena.o.gz $(B)/lang/$$l/build/site-kit/games $(B)/site-kit/$$l/ || exit 1; \
+ done
check: nwa apps
@x=$$(cat $(B)/gen/arena_extra); \
diff --git a/launcher/app_name.c b/launcher/app_name.c
index ea07fc54..af75ff32 100644
--- a/launcher/app_name.c
+++ b/launcher/app_name.c
@@ -1,3 +1,14 @@
/* The app's name on the calculator's home screen. The Makefile builds NumPlay
* under a few names and icons (VARIANTS); everything else is the same. */
const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = NP_APP_NAME;
+
+/* How NumPlay starts until its Settings are changed (launcher/src/storage.c): 'D', version 1,
+ * then numplay.set's flags (1: as Matrices, 2: no hint) and its secret. NumPlay Studio, the
+ * customizer website, writes its own with the name. */
+#ifndef NP_START_FLAGS
+#define NP_START_FLAGS 0
+#endif
+#ifndef NP_START_SECRET
+#define NP_START_SECRET 0
+#endif
+const unsigned char np_defaults[4] __attribute__((section(".rodata.np_defaults"))) = {'D', 1, NP_START_FLAGS, NP_START_SECRET};
diff --git a/launcher/src/storage.c b/launcher/src/storage.c
index 8ca7f8b8..e0472b43 100644
--- a/launcher/src/storage.c
+++ b/launcher/src/storage.c
@@ -60,10 +60,21 @@ bool np_reset_game(int game) {
#define CONFIG_NAME "numplay.set"
#define CONFIG_MAGIC 0x4E /* 'N' */
+#if !NP_SIMULATOR
+extern const uint8_t np_defaults[4]; /* how this NumPlay starts: launcher/app_name.c, or the website */
+#endif
+
void np_config_load(np_config_t *c) {
c->disguise = false;
c->secret = NP_SECRET_XNT;
c->hint = true;
+#if !NP_SIMULATOR
+ if (np_defaults[0] == 'D' && np_defaults[1] == 1) {
+ c->disguise = np_defaults[2] & 1;
+ c->hint = !(np_defaults[2] & 2);
+ if (np_defaults[3] < NP_SECRET_COUNT) c->secret = np_defaults[3];
+ }
+#endif
uint32_t len = 0;
const uint8_t *d = ef_read(CONFIG_NAME, &len);
if (!d || len != 4 || d[0] != CONFIG_MAGIC || d[1] != 1) return;
diff --git a/tools/kit.py b/tools/kit.py
index d8296247..bff25ea0 100644
--- a/tools/kit.py
+++ b/tools/kit.py
@@ -92,6 +92,7 @@ def main():
ap.add_argument("--ram", type=int, required=True)
ap.add_argument("--upsilon-ram", type=int, required=True)
ap.add_argument("--nwlink", default="nwlink")
+ ap.add_argument("--langs", default="", help="the languages make kit-langs adds (site-kit/<code>)")
a = ap.parse_args()
B, O = a.build, a.out
manifest = json.load(open(a.manifest))
@@ -138,6 +139,7 @@ def main():
icon = icon_of(i)
if icon:
shutil.copy(icon, os.path.join(O, "icons", i + ".png"))
+ preview = os.path.exists(os.path.join(ROOT, "docs", "media", "gallery", f"{i}.gif"))
thumb = os.path.join(ROOT, "docs", "media", f"thumb_{i}.png")
if os.path.exists(thumb):
shutil.copy(thumb, os.path.join(O, "thumbs", i + ".png"))
@@ -147,7 +149,7 @@ def main():
"flash": flash, "ram": ram, "default": i in default, "upsilon": i in upsilon,
"roms": bool(g.get("roms")), "systems": g.get("systems"), "xl": bool(g.get("xl")),
"bytes": os.path.getsize(os.path.join(O, "games", i + ".o.gz")),
- "icon": bool(icon), "thumb": os.path.exists(thumb)})
+ "icon": bool(icon), "thumb": os.path.exists(thumb), "preview": preview})
# ---- check: the default games, linked from the kit, are NumPlay.nwa on the calculator
ld_script = os.path.join(tmp, "custom.ld")
@@ -183,7 +185,7 @@ def main():
kit = {"version": a.version, "appSpace": a.app_space, "ram": a.ram, "upsilonRam": a.upsilon_ram,
"arena": int(re.search(r"\.space (\d+)", open(os.path.join(B, "gen", "arena.s")).read()).group(1)),
"base": base, "runtime": runtime, "numplay": len(bins[0]), "link": LINK, "variants": variants,
- "script": script, "games": games}
+ "langs": ["en"] + a.langs.split(), "script": script, "games": games}
json.dump(kit, open(os.path.join(O, "kit.json"), "w"), indent=1)
shutil.rmtree(tmp)
print(f"kit: {len(games)} games, NumPlay.nwa's {len(bins[0])} bytes linked again from {O}")