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.

Hollow Knight: Fungal Wastes on the other targets, with Hollow Knight's saves

Mason363a32323299381
diff --git a/games/hkfungal/.gitignore b/games/hkfungal/.gitignore
index ea1472ec..342d9dda 100644
--- a/games/hkfungal/.gitignore
+++ b/games/hkfungal/.gitignore
@@ -1 +1,2 @@
output/
+build/
diff --git a/games/hkfungal/Makefile b/games/hkfungal/Makefile
index 92a8be0a..6d75485d 100644
--- a/games/hkfungal/Makefile
+++ b/games/hkfungal/Makefile
@@ -11,3 +11,13 @@ build check:
clean:
rm -rf $(BUILD_DIR)
+
+# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce; its files are Hollow Knight's
+HK = ../hollowknight/src
+PORT_ID = hkfungal
+PORT_NAME = Hollow Knight: Fungal Wastes
+PORT_SRC = $(addprefix $(HK)/,res.c tex.c room.c gfx.c phys.c anim.c hero.c camera.c game.c world.c obj.c enemy.c hud.c spell.c text.c npc.c title.c vm.c msg.c save.c death.c menu.c inv.c shop.c collect.c stag.c map.c lzma/LzmaDec.c plat_eadk.c main.c)
+PORT_ASM = $(HK)/data.S
+PORT_FLAGS = -DDATA_BIN='"$(HK)/data_fw.bin"' -DEPSILON_XL=1 -DHK_FW=1 -DNP_FILES_ID='"hollowknight"'
+PORT_ICON = $(HK)/icon_fw.png
+include ../../platform/port.mk
diff --git a/platform/casio-cg/np_casio_cg.c b/platform/casio-cg/np_casio_cg.c
index 5427881d..06e7499a 100644
--- a/platform/casio-cg/np_casio_cg.c
+++ b/platform/casio-cg/np_casio_cg.c
@@ -20,6 +20,9 @@
#ifndef NP_APP_ID
#define NP_APP_ID "numplay"
#endif
+#ifndef NP_FILES_ID /* (its files' name: the game's own, or that of the game whose saves it shares) */
+#define NP_FILES_ID NP_APP_ID
+#endif
/* the RAM after a game's own: 128 KB (the add-in's 512 KB hold its data, this and the stack) */
__asm__(".section .bss\n.balign 16\n.global __heap_start\n__heap_start:\n.space 131072\n.global __heap_end\n__heap_end:\n"
@@ -185,7 +188,7 @@ static bool loaded, unsaved;
static int last_save;
static void save_path(uint16_t *out) {
char p[40] = "\\\\fls0\\";
- strncat(p, NP_APP_ID, 8);
+ strncat(p, NP_FILES_ID, 8);
strcat(p, ".sav");
Bfile_StrToName_ncpy(out, p, 40);
}
diff --git a/platform/nspire/np_nspire.c b/platform/nspire/np_nspire.c
index 2064e627..79dbf896 100644
--- a/platform/nspire/np_nspire.c
+++ b/platform/nspire/np_nspire.c
@@ -15,6 +15,9 @@
#ifndef NP_APP_ID
#define NP_APP_ID "numplay"
#endif
+#ifndef NP_FILES_ID /* (its files' name: the game's own, or that of the game whose saves it shares) */
+#define NP_FILES_ID NP_APP_ID
+#endif
/* the RAM after a game's own: 1 MB (the CX has 64) */
__asm__(".section .bss\n.balign 16\n.globl _heap_start\n_heap_start:\n.space 1048576\n.globl _heap_end\n_heap_end:\n"
@@ -182,7 +185,7 @@ size_t eadk_external_data_size = 0;
#define STORAGE_SIZE (64 * 1024)
static uint8_t storage[STORAGE_SIZE + 64];
static bool loaded;
-#define SAVE_PATH "/documents/ndless/numplay_" NP_APP_ID ".sav.tns"
+#define SAVE_PATH "/documents/ndless/numplay_" NP_FILES_ID ".sav.tns"
static uint32_t storage_end(void) {
uint32_t at = 0;
while (at + 2 <= STORAGE_SIZE && (storage[at] | storage[at + 1] << 8)) at += storage[at] | storage[at + 1] << 8;
diff --git a/platform/port.mk b/platform/port.mk
index 435df3d9..37a362c4 100644
--- a/platform/port.mk
+++ b/platform/port.mk
@@ -7,11 +7,13 @@
# PORT_DEPS files its build makes first (generated tables its sources include)
# PORT_FONT its own copy of the launcher's font_data.c, if it has one (not in PORT_SRC then)
# PORT_CXX its C++ files (a physics engine...), and PORT_CXXFLAGS their own flags: no exceptions, no RTTI
+# PORT_ICON its icon, if not src/icon.png
# then `make port TARGET=sdl` builds build/sdl/<id>. TARGET: sdl (a computer, a Raspberry Pi).
TARGET ?= sdl
NP_PLATFORM := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
NP_ROOT := $(NP_PLATFORM)/..
PORT_OUT = build/$(TARGET)
+PORT_ICON ?= src/icon.png
# the font eadk_display_draw_string draws with: the launcher's (a game with its own copy of it names that instead)
PORT_FONT ?= $(NP_ROOT)/launcher/src/font_data.c
PORT_COMMON = $(NP_PLATFORM)/common/eadk_text.c $(PORT_FONT) \
@@ -130,7 +132,7 @@ $(PORT_OUT)/$(PORT_ID).g3a: $(PORT_DEPS) $(CG_SRC) $(PORT_ASM) $(PORT_CXX_OBJ) $
$$objs $(PORT_CXX_OBJ) -Wl,--gc-sections -Wl,-u,initialize -L$(CG_LIBC)/lib -L$(FXCG)/sdk/lib $(if $(PORT_CXX),-lstdc++) -lc -lm -lgcc -lfxcg -lc -lgcc \
-o $(CG_DIR)/$(PORT_ID).elf
$(Q) PATH="$(CG_PATH):$$PATH" sh3eb-elf-objcopy -O binary -R .ilram $(CG_DIR)/$(PORT_ID).elf $(CG_DIR)/$(PORT_ID).bin
- $(Q) python3 $(NP_PLATFORM)/casio-cg/g3a.py $(CG_DIR)/$(PORT_ID).bin $@ --name "$(PORT_NAME)" --icon src/icon.png
+ $(Q) python3 $(NP_PLATFORM)/casio-cg/g3a.py $(CG_DIR)/$(PORT_ID).bin $@ --name "$(PORT_NAME)" --icon $(PORT_ICON)
@echo "CASIO $@"
else
port:
diff --git a/platform/sdl/np_sdl.c b/platform/sdl/np_sdl.c
index 27e75d1a..18ce489f 100644
--- a/platform/sdl/np_sdl.c
+++ b/platform/sdl/np_sdl.c
@@ -1,7 +1,7 @@
/* NumPlay on a computer (Windows, macOS, Linux, a Raspberry Pi) with SDL 3: the 320 x 240 screen in a window, the
* NumWorks keypad on the keyboard (platform/sdl/README.md), the files in one file per game.
*
- * Build defines: NP_APP_ID (the game's id: its files' name), NP_APP_NAME (the window's title). In the environment:
+ * Build defines: NP_APP_ID (the game's id: its files' name, or NP_FILES_ID's), NP_APP_NAME (the window's title). In the environment:
* NP_SAVES the folder for the files (default ~/.numplay), NP_SCALE the window's size, 1 to 6 (default 3).
*
* Tests (tools/verify.py), with NP_HEADLESS=1 for no window: NP_KEYS "1500-1700:ok,3000:back" holds keys
@@ -20,6 +20,9 @@
#ifndef NP_APP_ID
#define NP_APP_ID "numplay"
#endif
+#ifndef NP_FILES_ID /* (its files' name: the game's own, or that of the game whose saves it shares) */
+#define NP_FILES_ID NP_APP_ID
+#endif
#ifndef NP_APP_NAME
#define NP_APP_NAME "NumPlay"
#endif
@@ -282,7 +285,7 @@ static void storage_path(char *p, size_t n) {
SDL_CreateDirectory(home);
dir = home;
}
- snprintf(p, n, "%s/%s.files", dir, NP_APP_ID);
+ snprintf(p, n, "%s/%s.files", dir, NP_FILES_ID);
}
#ifdef __EMSCRIPTEN__
@@ -304,7 +307,7 @@ uint8_t *np_storage(uint32_t *size) {
if (!storage_loaded) {
storage_loaded = true;
#ifdef __EMSCRIPTEN__
- size_t n = (size_t)web_load("numplay:" NP_APP_ID, storage, STORAGE_SIZE);
+ size_t n = (size_t)web_load("numplay:" NP_FILES_ID, storage, STORAGE_SIZE);
if (n) {
#else
char p[600];
@@ -328,7 +331,7 @@ void np_storage_changed(void) {
#ifdef __EMSCRIPTEN__
uint32_t used = 0;
while (used + 2 <= STORAGE_SIZE && (storage[used] | storage[used + 1] << 8)) used += storage[used] | storage[used + 1] << 8;
- web_save("numplay:" NP_APP_ID, storage, (int)used + 2);
+ web_save("numplay:" NP_FILES_ID, storage, (int)used + 2);
return;
#endif
char p[600], tmp[620];
diff --git a/platform/ti84ce/np_ce.c b/platform/ti84ce/np_ce.c
index fda0f3f3..75c8100b 100644
--- a/platform/ti84ce/np_ce.c
+++ b/platform/ti84ce/np_ce.c
@@ -21,6 +21,9 @@
#ifndef NP_APP_ID
#define NP_APP_ID "numplay"
#endif
+#ifndef NP_FILES_ID /* (its files' name: the game's own, or that of the game whose saves it shares) */
+#define NP_FILES_ID NP_APP_ID
+#endif
static uint16_t *const lcd = (uint16_t *)lcd_Ram;
@@ -159,7 +162,7 @@ static char var[9];
static const char *var_name(void) { /* NP, then the id: its first 5 letters and its last past 6 (NPflappd, NPflappk) */
if (!var[0]) {
- const char *id = NP_APP_ID;
+ const char *id = NP_FILES_ID;
size_t n = strlen(id);
var[0] = 'N', var[1] = 'P';
for (size_t i = 0; i < 6 && i < n; i++) var[2 + i] = id[i < 5 || n <= 6 ? i : n - 1];