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.
C calculatorcalculator-gamescasiochesscrossy-roaddrive-madfx-cg50gamesgeometry-dashgraphing-calculatorndlessnumworksnumworks-appsnumworks-calculatornumworks-gamenumworks-gamestetristi-84-plus-ceti-nspire
Ports: 62 games build and run on a computer
Mason363009cc217910d
diff --git a/games/angrybirds/Makefile b/games/angrybirds/Makefileindex d6be9778..71ed84f4 100644--- a/games/angrybirds/Makefile+++ b/games/angrybirds/Makefile@@ -115,3 +115,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = angrybirds+PORT_NAME = Angry Birds+PORT_SRC = src/main.c src/ui.c src/game.c src/res.c src/save.c src/inflate.c src/names.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -I../../launcher/src -Isrc -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/angrybirds/src/plat_eadk.c b/games/angrybirds/src/plat_eadk.cindex aa81b372..9c43a755 100644--- a/games/angrybirds/src/plat_eadk.c+++ b/games/angrybirds/src/plat_eadk.c@@ -4,8 +4,10 @@#include "../../common/epsilon_files.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Angry Birds";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/badtime/Makefile b/games/badtime/Makefileindex aa44b7d2..7997733b 100644--- a/games/badtime/Makefile+++ b/games/badtime/Makefile@@ -91,3 +91,10 @@ test: build/playclean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = badtime+PORT_NAME = Bad Time Simulator+PORT_SRC = src/main.c src/save.c src/text.c src/art.c src/attacks.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c src/sim.c src/draw.c src/fight.c src/plat_eadk.c+PORT_FLAGS = -DEPSILON_XL=1 -I../../launcher/src -Isrc+include ../../platform/port.mkdiff --git a/games/badtime/src/plat_eadk.c b/games/badtime/src/plat_eadk.cindex be021e3b..b3d1ac95 100644--- a/games/badtime/src/plat_eadk.c+++ b/games/badtime/src/plat_eadk.c@@ -5,8 +5,10 @@#include "bt.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Bad Time";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/balatro/Makefile b/games/balatro/Makefileindex f627e4b2..aaf3b6f2 100644--- a/games/balatro/Makefile+++ b/games/balatro/Makefile@@ -72,3 +72,10 @@ $(BUILD_DIR)/sim-module.o: $(SRC) $(HDR) | $(BUILD_DIR)$(Q) for f in $(basename $(notdir $(filter-out src/libc.c,$(SRC)))); do cc -std=c99 -O2 -fPIC \$(shell $(NWLINK) eadk-cflags-simulator) -Dmain=np_balatro_main -c src/$$f.c -o $(BUILD_DIR)/sim/$$f.o || exit 1; done$(Q) ld -r $(BUILD_DIR)/sim/*.o -exported_symbol _np_balatro_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = balatro+PORT_NAME = Balatro+PORT_SRC = src/art.c src/assets.c src/bg.c src/cons.c src/data.c src/draw.c src/ev.c src/flame.c src/fx.c src/game.c src/gfx.c src/jokers.c src/main.c src/save.c src/score.c src/ui.c src/util.c+PORT_FLAGS = -Isrc+include ../../platform/port.mkdiff --git a/games/balatro/src/main.c b/games/balatro/src/main.cindex d98011a6..311f0424 100644--- a/games/balatro/src/main.c+++ b/games/balatro/src/main.c@@ -13,9 +13,11 @@#include "util.h"#ifdef __ELF__+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Balatro";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endifstatic np_jump_t leave;static int in_game, has_save;diff --git a/games/blockblast/Makefile b/games/blockblast/Makefileindex a01a71b0..babe4832 100644--- a/games/blockblast/Makefile+++ b/games/blockblast/Makefile@@ -68,3 +68,9 @@ $(BUILD_DIR)/sim-module.o: $(SRC) $(HEADERS) | $(BUILD_DIR)$(Q) cc -std=c11 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) -DNP_MODULE=1 -Dmain=np_blockblast_main \-c $(SRC) -o $(BUILD_DIR)/sim/main.o$(Q) ld -r $(BUILD_DIR)/sim/main.o -exported_symbol _np_blockblast_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = blockblast+PORT_NAME = Block Blast+PORT_SRC = src/main.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+include ../../platform/port.mkdiff --git a/games/blockblast/src/main.c b/games/blockblast/src/main.cindex 97e77c0a..bdc700a5 100644--- a/games/blockblast/src/main.c+++ b/games/blockblast/src/main.c@@ -20,8 +20,10 @@#include "../../common/epsilon_files.h"#define np_file_read ef_read#define np_file_write ef_write+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Block Blast";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifvoid np_push(int x, int y, int w, int h, const color_t *px) {eadk_display_push_rect((eadk_rect_t){(uint16_t)x, (uint16_t)y, (uint16_t)w, (uint16_t)h}, px);}diff --git a/games/breakout/Makefile b/games/breakout/Makefileindex 03dab3e5..645fc0fe 100644--- a/games/breakout/Makefile+++ b/games/breakout/Makefile@@ -49,3 +49,9 @@ $(BUILD_DIR)/sim-module.o: $(SRC) $(HEADERS) | $(BUILD_DIR)$(Q) mkdir -p $(BUILD_DIR)/sim$(Q) cc -std=c11 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) -Dmain=np_breakout_main -c $(SRC) -o $(BUILD_DIR)/sim/main.o$(Q) ld -r $(BUILD_DIR)/sim/main.o -exported_symbol _np_breakout_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = breakout+PORT_NAME = Block Breaker+PORT_SRC = src/main.c+include ../../platform/port.mkdiff --git a/games/breakout/src/main.c b/games/breakout/src/main.cindex ff0e277e..69014673 100644--- a/games/breakout/src/main.c+++ b/games/breakout/src/main.c@@ -17,9 +17,11 @@#include "../../common/np_text.h"#ifdef __ELF__ /* app name and API level, for the calculator's installer */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Block Breaker";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endif#define W 320#define H 240diff --git a/games/buckshot/Makefile b/games/buckshot/Makefileindex e1e53c8c..fd5d58a1 100644--- a/games/buckshot/Makefile+++ b/games/buckshot/Makefile@@ -66,3 +66,9 @@ $(BUILD_DIR)/sim-module.o: $(SRC) $(HDR) | $(BUILD_DIR)$(Q) for f in $(basename $(notdir $(filter-out src/libc.c,$(SRC)))); do cc -std=c99 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) \-Dmain=np_buckshot_main -c src/$$f.c -o $(BUILD_DIR)/sim/$$f.o || exit 1; done$(Q) ld -r $(BUILD_DIR)/sim/*.o -exported_symbol _np_buckshot_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = buckshot+PORT_NAME = Buckshot Roulette+PORT_SRC = src/main.c src/game.c src/scene.c src/anim.c src/story.c src/gfx.c src/pixcode.c src/assets.c src/font.c+include ../../platform/port.mkdiff --git a/games/buckshot/src/main.c b/games/buckshot/src/main.cindex f51b21a4..6029fbc8 100644--- a/games/buckshot/src/main.c+++ b/games/buckshot/src/main.c@@ -10,9 +10,11 @@#include "story.h"#ifdef __ELF__ /* app name and API level, for the calculator's installer */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Buckshot";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endif#ifndef BR_START_STAGE#define BR_START_STAGE 0diff --git a/games/catninja/Makefile b/games/catninja/Makefileindex be7be0e7..9dfff68f 100644--- a/games/catninja/Makefile+++ b/games/catninja/Makefile@@ -91,3 +91,10 @@ test: build/playclean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = catninja+PORT_NAME = Cat Ninja+PORT_SRC = src/main.c src/game.c src/env.c src/draw.c src/data.c src/plat_eadk.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c ../../launcher/src/inflate.c+PORT_FLAGS = -DEPSILON_XL=1 -I../../launcher/src -Isrc+include ../../platform/port.mkdiff --git a/games/catninja/src/plat_eadk.c b/games/catninja/src/plat_eadk.cindex 794c2ba5..2d1050c6 100644--- a/games/catninja/src/plat_eadk.c+++ b/games/catninja/src/plat_eadk.c@@ -5,8 +5,10 @@#include "gfx.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Cat Ninja";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/celeste/Makefile b/games/celeste/Makefileindex 1be82caa..940ea56c 100644--- a/games/celeste/Makefile+++ b/games/celeste/Makefile@@ -65,3 +65,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = celeste+PORT_NAME = Celeste+PORT_SRC = src/res.c src/gfx.c src/util.c src/ent.c src/level.c src/tiles.c src/style.c src/player.c src/entities.c src/fx.c src/ptypes.c src/font.c src/light.c src/spinner.c src/berry.c src/save.c src/text.c src/wipe.c src/cutscene.c src/npc.c src/talk.c src/heart.c src/cassette.c src/dust.c src/breath.c src/pic.c src/menu.c src/ch0.c src/ch1.c src/ch2.c src/ch3.c src/ch4.c src/ch5.c src/ch6.c src/ch7.c src/ch8.c src/ch9.c src/game.c src/lzma/LzmaDec.c src/plat_eadk.c src/main.c+PORT_ASM = src/data.S+PORT_FLAGS = -DDATA_BIN='"src/data.bin"' -DEPSILON_XL=1+include ../../platform/port.mkdiff --git a/games/celeste/src/data.S b/games/celeste/src/data.Sindex 885ab471..46889fab 100644--- a/games/celeste/src/data.S+++ b/games/celeste/src/data.S@@ -1,10 +1,19 @@/* data.bin (tools/pack.py) in the app's read-only data */+#ifdef __APPLE__+ .const_data+ .p2align 2+ .globl _cel_data+_cel_data:+ .incbin DATA_BIN+ .p2align 2+#else.section .rodata.cel_data,"a".balign 4.global cel_datacel_data:.incbin DATA_BIN.balign 4+#endif#ifdef __ELF__.section .note.GNU-stack,"",%progbits#endifdiff --git a/games/celeste/src/main.c b/games/celeste/src/main.cindex e7782b03..ff3ceffa 100644--- a/games/celeste/src/main.c+++ b/games/celeste/src/main.c@@ -8,8 +8,10 @@#include "celeste.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Celeste";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifextern const uint8_t cel_data[];void plat_begin(void);diff --git a/games/championisland/Makefile b/games/championisland/Makefileindex 8ec5b586..0d171a6b 100644--- a/games/championisland/Makefile+++ b/games/championisland/Makefile@@ -87,3 +87,11 @@ live:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = championisland+PORT_NAME = Champion Island+PORT_SRC = src/store.c src/menus.c src/dialog.c src/hud.c src/film.c src/names.c src/sport_archery.c src/sport_climbing.c src/sport_marathon.c src/sport_pingpong.c src/sport_rugby.c src/sport_skate.c src/sport_swim.c src/res.c src/spr.c src/gfx.c src/font.c src/font_data.c src/node.c src/ent.c src/phys.c src/game.c src/world.c src/lzma/LzmaDec.c src/plat_eadk.c src/main.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/championisland/src/main.c b/games/championisland/src/main.cindex 5d401536..089f05f9 100644--- a/games/championisland/src/main.c+++ b/games/championisland/src/main.c@@ -8,9 +8,11 @@#include "gfx.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Champion Island";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endifvoid plat_begin(void);int plat_end(void);diff --git a/games/chess/Makefile b/games/chess/Makefileindex 25d61acf..18037e1f 100644--- a/games/chess/Makefile+++ b/games/chess/Makefile@@ -60,3 +60,9 @@ $(BUILD_DIR)/sim-module.o: src/main.c src/chess.c src/chess.h src/sprites.h | $($(Q) for f in main chess; do cc -std=c99 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) \-Dmain=np_chess_main -c src/$$f.c -o $(BUILD_DIR)/sim/$$f.o || exit 1; done$(Q) ld -r $(BUILD_DIR)/sim/*.o -exported_symbol _np_chess_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = chess+PORT_NAME = Chess+PORT_SRC = src/main.c src/chess.c+include ../../platform/port.mkdiff --git a/games/chess/src/main.c b/games/chess/src/main.cindex 3db18285..56a17145 100644--- a/games/chess/src/main.c+++ b/games/chess/src/main.c@@ -8,9 +8,11 @@#include "sprites.h"#ifdef __ELF__ /* app name and API level, for the calculator's installer */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Chess";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endiftypedef uint16_t C;#define RGB(r, g, b) ((C)((((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | ((b) >> 3)))diff --git a/games/clashroyale/Makefile b/games/clashroyale/Makefileindex 96f877eb..9084ac09 100644--- a/games/clashroyale/Makefile+++ b/games/clashroyale/Makefile@@ -77,3 +77,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build/rules build/host-saves build/shots++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = clashroyale+PORT_NAME = Clash Royale+PORT_SRC = src/bot.c src/game.c src/main.c src/save.c src/tables.c src/gfx.c src/view.c src/sim.c src/plat_eadk.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/clashroyale/src/main.c b/games/clashroyale/src/main.cindex d5abdff6..3d90cb3a 100644--- a/games/clashroyale/src/main.c+++ b/games/clashroyale/src/main.c@@ -8,8 +8,10 @@#include "res.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Clash Royale";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifextern const uint8_t cr_data[];const uint8_t *cr_bin;diff --git a/games/common/epsilon_app.h b/games/common/epsilon_app.hindex a016a391..250fd850 100644--- a/games/common/epsilon_app.h+++ b/games/common/epsilon_app.h@@ -53,6 +53,7 @@ static inline bool epsilon_is_upsilon(void) { return false; }static inline bool epsilon_slow_model(void) { return np_slow(); }static inline void np_app_begin(void) { np_begin(); }static inline int np_app_end(void) { return np_end(); }+#define numplay_launcher ((const uint8_t *)NULL) /* never inside NumPlay there */#elif PLATFORM_DEVICE && !defined(HOST)#include <eadk.h>diff --git a/games/connectfour/Makefile b/games/connectfour/Makefileindex 153c0763..3145a350 100644--- a/games/connectfour/Makefile+++ b/games/connectfour/Makefile@@ -49,3 +49,9 @@ $(BUILD_DIR)/sim-module.o: $(SRC) $(HEADERS) | $(BUILD_DIR)$(Q) mkdir -p $(BUILD_DIR)/sim$(Q) cc -std=c11 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) -Dmain=np_connectfour_main -c $(SRC) -o $(BUILD_DIR)/sim/main.o$(Q) ld -r $(BUILD_DIR)/sim/main.o -exported_symbol _np_connectfour_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = connectfour+PORT_NAME = Connect Four+PORT_SRC = src/main.c+include ../../platform/port.mkdiff --git a/games/connectfour/src/main.c b/games/connectfour/src/main.cindex 86dcb332..8b0cdf83 100644--- a/games/connectfour/src/main.c+++ b/games/connectfour/src/main.c@@ -15,9 +15,11 @@#include "../../common/np_text.h"#ifdef __ELF__ /* app name and API level, for the calculator's installer */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Connect 4";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endiftypedef uint16_t color;#define RGB(c) (color)((((c) >> 8) & 0xF800) | (((c) >> 5) & 0x07E0) | (((c) >> 3) & 0x1F))diff --git a/games/cookieclicker/Makefile b/games/cookieclicker/Makefileindex 2e814c0b..c28b61a7 100644--- a/games/cookieclicker/Makefile+++ b/games/cookieclicker/Makefile@@ -80,3 +80,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = cookieclicker+PORT_NAME = Cookie Clicker+PORT_SRC = src/ascend.c src/elder.c src/game.c src/garden.c src/grimoire.c src/logic.c src/lumps.c src/main.c src/menus.c src/minigames.c src/news.c src/numbers.c src/pantheon.c src/prestige.c src/rows.c src/save.c src/season.c src/shimmer.c src/special.c src/text.c src/tooltip.c src/ui.c src/ui_left.c src/ui_store.c src/upgrades.c src/gfx.c src/plat_eadk.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/cookieclicker/src/main.c b/games/cookieclicker/src/main.cindex 711a803b..d47fb831 100644--- a/games/cookieclicker/src/main.c+++ b/games/cookieclicker/src/main.c@@ -32,8 +32,10 @@ void cc_frame(uint32_t pressed, uint32_t held) {}#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Cookie Clicker";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifuint32_t perf_frames __attribute__((used)); /* read by tools/emu.py */uint32_t perf_updates __attribute__((used));diff --git a/games/coreball/Makefile b/games/coreball/Makefileindex a172a6d0..d2897117 100644--- a/games/coreball/Makefile+++ b/games/coreball/Makefile@@ -81,3 +81,9 @@ build/play: $(SRC) tests/play.c tests/spec.h $(HEADERS)@echo "HOST $@"test: build/playbuild/play test++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = coreball+PORT_NAME = Core Ball+PORT_SRC = src/main.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+include ../../platform/port.mkdiff --git a/games/coreball/src/main.c b/games/coreball/src/main.cindex 052836ba..1ed904d5 100644--- a/games/coreball/src/main.c+++ b/games/coreball/src/main.c@@ -23,9 +23,11 @@#define np_file_read ef_read#define np_file_write ef_write#ifndef HOST /* (a computer build of the tests has no app header) */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Core Ball";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endifvoid np_push(int x, int y, int w, int h, const color_t *px) {eadk_display_push_rect((eadk_rect_t){(uint16_t)x, (uint16_t)y, (uint16_t)w, (uint16_t)h}, px);}diff --git a/games/crossyroad/src/crossy.c b/games/crossyroad/src/crossy.cindex 0804e7c9..f66606d1 100644--- a/games/crossyroad/src/crossy.c+++ b/games/crossyroad/src/crossy.c@@ -34,9 +34,11 @@ __attribute__((used, externally_visible)) void *memcpy(void *d, const void *s, s#endif#ifdef __ELF__ /* app name and API level, for the calculator's installer */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Crossy Road";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endif#define SW 320#define SH 240diff --git a/games/deltarune/Makefile b/games/deltarune/Makefileindex bc94ed34..011aec4d 100644--- a/games/deltarune/Makefile+++ b/games/deltarune/Makefile@@ -79,3 +79,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = deltarune+PORT_NAME = Deltarune+PORT_SRC = src/battle.c src/blk.c src/dw.c src/enemies.c src/event.c src/game.c src/gmtexts.c src/lw.c src/main.c src/menu.c src/res.c src/rooms.c src/save.c src/tables.c src/text.c src/world.c src/lzma/LzmaDec.c src/gfx.c src/plat_eadk.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/deltarune/src/main.c b/games/deltarune/src/main.cindex 46615578..10b13473 100644--- a/games/deltarune/src/main.c+++ b/games/deltarune/src/main.c@@ -11,8 +11,10 @@#include "res.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Deltarune";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifextern const uint8_t dr_data[];uint32_t perf_frames __attribute__((used)); /* read by tools/emu.py */diff --git a/games/dinorun/Makefile b/games/dinorun/Makefileindex bec00c40..0bf93ffd 100644--- a/games/dinorun/Makefile+++ b/games/dinorun/Makefile@@ -47,3 +47,9 @@ host-test: | $(OUT)sprites:python3 tools/sprites.py $(SHEET)++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = dinorun+PORT_NAME = Chrome Dino+PORT_SRC = src/main.c+include ../../platform/port.mkdiff --git a/games/dinorun/src/main.c b/games/dinorun/src/main.cindex 6326e09b..ad5669bc 100644--- a/games/dinorun/src/main.c+++ b/games/dinorun/src/main.c@@ -19,9 +19,11 @@#include "sprites.h"#ifdef __ELF__+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Chrome Dino";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endif/* ---------------------------------------------------------------- the screen */#define W 320diff --git a/games/donkeykong/Makefile b/games/donkeykong/Makefileindex 0de85faa..7c2b3944 100644--- a/games/donkeykong/Makefile+++ b/games/donkeykong/Makefile@@ -61,3 +61,10 @@ art:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = donkeykong+PORT_NAME = Donkey Kong+PORT_SRC = src/main.c src/sim.c src/draw.c src/save.c src/plat_eadk.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+PORT_FLAGS = -DEPSILON_XL=1+include ../../platform/port.mkdiff --git a/games/donkeykong/src/plat_eadk.c b/games/donkeykong/src/plat_eadk.cindex fab3acaf..bf21efda 100644--- a/games/donkeykong/src/plat_eadk.c+++ b/games/donkeykong/src/plat_eadk.c@@ -5,8 +5,10 @@#include "../../../launcher/src/np.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Donkey Kong";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/doodlejump/Makefile b/games/doodlejump/Makefileindex 66d1ca88..b1272165 100644--- a/games/doodlejump/Makefile+++ b/games/doodlejump/Makefile@@ -81,3 +81,9 @@ build/play: $(SRC) tests/play.c $(HEADERS)@echo "HOST $@"test: build/playbuild/play test++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = doodlejump+PORT_NAME = Doodle Jump+PORT_SRC = src/main.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+include ../../platform/port.mkdiff --git a/games/doodlejump/src/main.c b/games/doodlejump/src/main.cindex 96a9bcbd..4cfdf571 100644--- a/games/doodlejump/src/main.c+++ b/games/doodlejump/src/main.c@@ -23,9 +23,11 @@#define np_file_read ef_read#define np_file_write ef_write#ifndef HOST /* (a computer build of the tests has no app header) */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Doodle Jump";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endifvoid np_push(int x, int y, int w, int h, const color_t *px) {eadk_display_push_rect((eadk_rect_t){(uint16_t)x, (uint16_t)y, (uint16_t)w, (uint16_t)h}, px);}diff --git a/games/doom/Makefile b/games/doom/Makefileindex 6f580d79..dc3aa3c2 100644--- a/games/doom/Makefile+++ b/games/doom/Makefile@@ -161,3 +161,11 @@ build/wad/doom.mip: build/wad/doom.whx tools/mips.pyclean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = doom+PORT_NAME = Doom+PORT_SRC = src/d_event.c src/d_iwad.c src/d_loop.c src/d_mode.c src/deh_str.c src/image_decoder.c src/m_argv.c src/m_bbox.c src/m_cheat.c src/m_config.c src/m_controls.c src/m_fixed.c src/m_misc.c src/memio.c src/tables.c src/tiny_huff.c src/v_diskicon.c src/v_video.c src/w_checksum.c src/w_file.c src/w_file_memory.c src/w_main.c src/w_merge.c src/w_wad.c src/z_zone.c src/doom/am_map.c src/doom/d_items.c src/doom/d_main.c src/doom/d_net.c src/doom/doomdef.c src/doom/doomstat.c src/doom/dstrings.c src/doom/f_finale.c src/doom/f_wipe.c src/doom/g_game.c src/doom/hu_lib.c src/doom/hu_stuff.c src/doom/info.c src/doom/m_menu.c src/doom/m_random.c src/doom/p_ceilng.c src/doom/p_doors.c src/doom/p_enemy.c src/doom/p_floor.c src/doom/p_inter.c src/doom/p_lights.c src/doom/p_map.c src/doom/p_maputl.c src/doom/p_mobj.c src/doom/p_plats.c src/doom/p_pspr.c src/doom/p_saveg.c src/doom/p_setup.c src/doom/p_sight.c src/doom/p_spec.c src/doom/p_switch.c src/doom/p_telept.c src/doom/p_tick.c src/doom/p_user.c src/doom/r_bsp.c src/doom/r_data.c src/doom/r_data_whd.c src/doom/r_draw.c src/doom/r_main.c src/doom/r_plane.c src/doom/r_segs.c src/doom/r_sky.c src/doom/r_things.c src/doom/s_sound.c src/doom/sounds.c src/doom/st_lib.c src/doom/st_stuff.c src/doom/statdump.c src/doom/wi_stuff.c src/nw/i_system.c src/nw/i_video.c src/nw/i_input.c src/nw/i_sound.c src/nw/saves.c src/nw/main.c src/nw/scan.c src/nw/plat_eadk.c+PORT_ASM = src/nw/data.S+PORT_FLAGS = -DEPSILON_XL=1 -Isrc -Isrc/doom -Isrc/compat -Isrc/nw -DNDEBUG -DDOOM_WHX='"src/doom1.whx"' -DDOOM_MIP='"src/doom1.mip"'+include ../../platform/port.mkdiff --git a/games/doom/src/nw/main.c b/games/doom/src/nw/main.cindex b6f8be12..42d07565 100644--- a/games/doom/src/nw/main.c+++ b/games/doom/src/nw/main.c@@ -16,8 +16,10 @@ void D_DoomMain(void);int nw_warp = NW_WARP;#if !defined(HOST)+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Doom";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#else#define main nw_main /* (tests/play.c has the computer's main) */int nw_main(void);diff --git a/games/dune/Makefile b/games/dune/Makefileindex dc14fe75..36fcd455 100644--- a/games/dune/Makefile+++ b/games/dune/Makefile@@ -60,3 +60,10 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = dune+PORT_NAME = Dune+PORT_SRC = src/main.c src/game.c src/draw.c src/save.c src/art.c src/plat_eadk.c+PORT_FLAGS = -DEPSILON_XL=1+include ../../platform/port.mkdiff --git a/games/dune/src/plat_eadk.c b/games/dune/src/plat_eadk.cindex 6facbc28..da35f82b 100644--- a/games/dune/src/plat_eadk.c+++ b/games/dune/src/plat_eadk.c@@ -4,8 +4,10 @@#include "../../common/epsilon_files.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Dune";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/famidash/Makefile b/games/famidash/Makefileindex d3d5a4a1..3928ec8f 100644--- a/games/famidash/Makefile+++ b/games/famidash/Makefile@@ -94,3 +94,10 @@ build/bot: tests/bot.c src/main.c src/game.c src/ppu.c src/data.c $(HEADERS)$(Q) mkdir -p build$(Q) cc -std=gnu11 -O2 -DHOST -DFD_BOT -I$(L) -Isrc tests/bot.c src/game.c src/ppu.c src/data.c $(L)/gfx.c $(L)/font_data.c $(L)/xfont.c -lm -o $@@echo "HOST $@"++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = famidash+PORT_NAME = Famidash+PORT_SRC = src/main.c src/game.c src/ppu.c src/data.c src/plat_eadk.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+PORT_FLAGS = -DEPSILON_XL=1 -I../../launcher/src -Isrc+include ../../platform/port.mkdiff --git a/games/famidash/src/plat_eadk.c b/games/famidash/src/plat_eadk.cindex 83c3041a..e56f2587 100644--- a/games/famidash/src/plat_eadk.c+++ b/games/famidash/src/plat_eadk.c@@ -5,8 +5,10 @@#include "gfx.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Famidash";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/finalearth2/Makefile b/games/finalearth2/Makefileindex f9032b84..d7a34305 100644--- a/games/finalearth2/Makefile+++ b/games/finalearth2/Makefile@@ -94,3 +94,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = finalearth2+PORT_NAME = The Final Earth 2+PORT_SRC = src/assign.c src/bld.c src/bld_decoration.c src/bld_draw.c src/bld_entertainment.c src/bld_hobbies.c src/bld_houses.c src/bld_production.c src/bld_services.c src/bld_transport.c src/bld_unique.c src/bld_window.c src/bld_world.c src/build.c src/citizen.c src/city.c src/classes.c src/game.c src/input.c src/lang_data.c src/path.c src/save.c src/savecopy.c src/sim.c src/stories_data.c src/story.c src/systems.c src/ui.c src/ui_bwin.c src/ui_city.c src/ui_draw.c src/ui_info.c src/ui_menu.c src/ui_pick.c src/ui_story.c src/ui_win.c src/unlocks.c src/upgrades.c src/upgrades_data.c src/view.c src/gfx.c src/bg.c src/plat_eadk.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/finalearth2/src/game.c b/games/finalearth2/src/game.cindex f47c90e8..a3be2888 100644--- a/games/finalearth2/src/game.c+++ b/games/finalearth2/src/game.c@@ -14,9 +14,11 @@#include "view.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Final Earth 2";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endifbool game_running = true;uint32_t game_ticks;diff --git a/games/flappybird/Makefile b/games/flappybird/Makefileindex e97c86e4..50fb33cf 100644--- a/games/flappybird/Makefile+++ b/games/flappybird/Makefile@@ -49,3 +49,9 @@ $(BUILD_DIR)/sim-module.o: $(SRC) $(HEADERS) | $(BUILD_DIR)$(Q) mkdir -p $(BUILD_DIR)/sim$(Q) cc -std=c11 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) -Dmain=np_flappybird_main -c $(SRC) -o $(BUILD_DIR)/sim/main.o$(Q) ld -r $(BUILD_DIR)/sim/main.o -exported_symbol _np_flappybird_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = flappybird+PORT_NAME = Flappy Bird+PORT_SRC = src/main.c+include ../../platform/port.mkdiff --git a/games/flappybird/src/main.c b/games/flappybird/src/main.cindex 569d04fc..b7ae7e43 100644--- a/games/flappybird/src/main.c+++ b/games/flappybird/src/main.c@@ -15,9 +15,11 @@#include "../../common/np_text.h"#ifdef __ELF__ /* app name and API level, for the calculator's installer */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Flappy Bird";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endif#define W 320#define H 240diff --git a/games/flappydunk/Makefile b/games/flappydunk/Makefileindex 658ce610..18f11e05 100644--- a/games/flappydunk/Makefile+++ b/games/flappydunk/Makefile@@ -81,3 +81,9 @@ build/play: $(SRC) tests/play.c $(HEADERS)@echo "HOST $@"test: build/playbuild/play test++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = flappydunk+PORT_NAME = Flappy Dunk+PORT_SRC = src/main.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+include ../../platform/port.mkdiff --git a/games/flappydunk/src/main.c b/games/flappydunk/src/main.cindex dc0c649a..90397e15 100644--- a/games/flappydunk/src/main.c+++ b/games/flappydunk/src/main.c@@ -23,9 +23,11 @@#define np_file_read ef_read#define np_file_write ef_write#ifndef HOST /* (a computer build of the tests has no app header) */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Flappy Dunk";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endifvoid np_push(int x, int y, int w, int h, const color_t *px) {eadk_display_push_rect((eadk_rect_t){(uint16_t)x, (uint16_t)y, (uint16_t)w, (uint16_t)h}, px);}diff --git a/games/fnaf/Makefile b/games/fnaf/Makefileindex d8cbd105..c06d8da5 100644--- a/games/fnaf/Makefile+++ b/games/fnaf/Makefile@@ -80,3 +80,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = fnaf+PORT_NAME = Five Nights at Freddys+PORT_SRC = src/calls.c src/game.c src/main.c src/night.c src/save.c src/view.c src/pic.c src/gfx.c src/plat_eadk.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/fnaf/src/main.c b/games/fnaf/src/main.cindex 6751bf02..760c2136 100644--- a/games/fnaf/src/main.c+++ b/games/fnaf/src/main.c@@ -8,8 +8,10 @@#include "res.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "FNAF";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifextern const uint8_t fnaf_data[];const uint8_t *fnaf_bin;diff --git a/games/fnaf2/Makefile b/games/fnaf2/Makefileindex b7b6beaa..da2f2ecb 100644--- a/games/fnaf2/Makefile+++ b/games/fnaf2/Makefile@@ -87,3 +87,11 @@ stand-ins:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = fnaf2+PORT_NAME = Five Nights at Freddys 2+PORT_SRC = src/game.c src/main.c src/night.c src/save.c src/view.c src/pic.c src/gfx.c src/plat_eadk.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/fnaf2/src/main.c b/games/fnaf2/src/main.cindex 6caca85a..8a621bff 100644--- a/games/fnaf2/src/main.c+++ b/games/fnaf2/src/main.c@@ -8,8 +8,10 @@#include "res.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "FNAF 2";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifextern const uint8_t fnaf2_data[];const uint8_t *fnaf2_bin;diff --git a/games/fnaf3/Makefile b/games/fnaf3/Makefileindex 5ed807f2..b089853c 100644--- a/games/fnaf3/Makefile+++ b/games/fnaf3/Makefile@@ -79,3 +79,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = fnaf3+PORT_NAME = Five Nights at Freddys 3+PORT_SRC = src/game.c src/main.c src/mini.c src/night.c src/save.c src/view.c src/pic.c src/gfx.c src/plat_eadk.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/fnaf3/src/main.c b/games/fnaf3/src/main.cindex 38242450..fe8dd306 100644--- a/games/fnaf3/src/main.c+++ b/games/fnaf3/src/main.c@@ -8,8 +8,10 @@#include "res.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "FNAF 3";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifextern const uint8_t fnaf3_data[];const uint8_t *fnaf3_bin;diff --git a/games/fnaf4/Makefile b/games/fnaf4/Makefileindex 89665b7f..ea4614c3 100644--- a/games/fnaf4/Makefile+++ b/games/fnaf4/Makefile@@ -79,3 +79,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = fnaf4+PORT_NAME = Five Nights at Freddys 4+PORT_SRC = src/game.c src/main.c src/night.c src/save.c src/view.c src/pic.c src/gfx.c src/plat_eadk.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/fnaf4/src/main.c b/games/fnaf4/src/main.cindex 21e3bdfb..16d00cc5 100644--- a/games/fnaf4/src/main.c+++ b/games/fnaf4/src/main.c@@ -8,8 +8,10 @@#include "res.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "FNAF 4";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifextern const uint8_t fnaf4_data[];const uint8_t *fnaf4_bin;diff --git a/games/fnafworld/Makefile b/games/fnafworld/Makefileindex d530304e..ffe4ad8a 100644--- a/games/fnafworld/Makefile+++ b/games/fnafworld/Makefile@@ -76,3 +76,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = fnafworld+PORT_NAME = FNAF World+PORT_SRC = src/battle.c src/game.c src/main.c src/rules.c src/save.c src/world.c src/pic.c src/gfx.c src/plat_eadk.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/fnafworld/src/main.c b/games/fnafworld/src/main.cindex 067e90ef..4d58a7f9 100644--- a/games/fnafworld/src/main.c+++ b/games/fnafworld/src/main.c@@ -8,8 +8,10 @@#include "res.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "FNAF World";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifextern const uint8_t fnafw_data[];const uint8_t *fnafw_bin;diff --git a/games/fnf/Makefile b/games/fnf/Makefileindex b1937c26..5a711300 100644--- a/games/fnf/Makefile+++ b/games/fnf/Makefile@@ -77,3 +77,10 @@ test: build/playclean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = fnf+PORT_NAME = Friday Night Funkin+PORT_SRC = src/main.c src/app.c src/game.c src/draw.c src/screens.c src/save.c src/inflate.c src/plat_eadk.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c $(BUILD_DIR)/gen/data.c+PORT_FLAGS = -DEPSILON_XL=1 -I../../launcher/src -Isrc -I$(BUILD_DIR)/gen+include ../../platform/port.mkdiff --git a/games/fnf/src/plat_eadk.c b/games/fnf/src/plat_eadk.cindex 7c4cadc9..d7f0b3bd 100644--- a/games/fnf/src/plat_eadk.c+++ b/games/fnf/src/plat_eadk.c@@ -4,8 +4,10 @@#include "../../common/epsilon_files.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Friday Night Funkin'";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/g2048/Makefile b/games/g2048/Makefileindex 2e6f88a3..e204ba1a 100644--- a/games/g2048/Makefile+++ b/games/g2048/Makefile@@ -54,3 +54,9 @@ $(BUILD_DIR)/sim-module.o: $(SRC) $(HEADERS) | $(BUILD_DIR)$(Q) mkdir -p $(BUILD_DIR)/sim$(Q) cc -std=c11 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) -Dmain=np_g2048_main -c $(SRC) -o $(BUILD_DIR)/sim/main.o$(Q) ld -r $(BUILD_DIR)/sim/main.o -exported_symbol _np_g2048_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = g2048+PORT_NAME = 2048+PORT_SRC = src/main.c+include ../../platform/port.mkdiff --git a/games/g2048/src/main.c b/games/g2048/src/main.cindex 5dbf1954..bc2a8fb1 100644--- a/games/g2048/src/main.c+++ b/games/g2048/src/main.c@@ -13,9 +13,11 @@#include "../../common/np_text.h"#ifdef __ELF__ /* app name and API level, for the calculator's installer */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "2048";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endif#define W 320#define H 240diff --git a/games/hillclimb/Makefile b/games/hillclimb/Makefileindex c3053e6c..d3142808 100644--- a/games/hillclimb/Makefile+++ b/games/hillclimb/Makefile@@ -102,3 +102,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = hillclimb+PORT_NAME = Hill Climb Racing+PORT_SRC = src/game.c src/main.c src/menu.c src/res.c src/run.c src/save.c src/vehicle.c src/gfx.c src/stage.c src/plat_eadk.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/hillclimb/src/main.c b/games/hillclimb/src/main.cindex a638dd91..af159a85 100644--- a/games/hillclimb/src/main.c+++ b/games/hillclimb/src/main.c@@ -7,8 +7,10 @@#include "plat.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Hill Climb";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifuint32_t perf_frames __attribute__((used)); /* read by tools/emu.py */uint32_t perf_max __attribute__((used));diff --git a/games/hollowknight/Makefile b/games/hollowknight/Makefileindex eae9dcc2..75c24050 100644--- a/games/hollowknight/Makefile+++ b/games/hollowknight/Makefile@@ -62,3 +62,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = hollowknight+PORT_NAME = Hollow Knight+PORT_SRC = src/res.c src/tex.c src/room.c src/gfx.c src/phys.c src/anim.c src/hero.c src/camera.c src/game.c src/world.c src/obj.c src/enemy.c src/hud.c src/spell.c src/text.c src/npc.c src/title.c src/vm.c src/msg.c src/save.c src/death.c src/menu.c src/inv.c src/shop.c src/collect.c src/stag.c src/map.c src/lzma/LzmaDec.c src/plat_eadk.c src/main.c+PORT_ASM = src/data.S+PORT_FLAGS = -DDATA_BIN='"src/data.bin"' -DEPSILON_XL=1+include ../../platform/port.mkdiff --git a/games/hollowknight/src/data.S b/games/hollowknight/src/data.Sindex 5a8e9965..68a0a16e 100644--- a/games/hollowknight/src/data.S+++ b/games/hollowknight/src/data.S@@ -1,10 +1,19 @@/* data.bin (tools/pack.py) in the app's read-only data */+#ifdef __APPLE__+ .const_data+ .p2align 2+ .globl _hk_data+_hk_data:+ .incbin DATA_BIN+ .p2align 2+#else.section .rodata.hk_data,"a".balign 4.global hk_datahk_data:.incbin DATA_BIN.balign 4+#endif#ifdef __ELF__.section .note.GNU-stack,"",%progbits#endifdiff --git a/games/hollowknight/src/main.c b/games/hollowknight/src/main.cindex 97d55bc1..7bdc91ed 100644--- a/games/hollowknight/src/main.c+++ b/games/hollowknight/src/main.c@@ -5,8 +5,10 @@#include "game.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Hollow Knight";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifextern const uint8_t hk_data[];void plat_begin(void);diff --git a/games/invaders/Makefile b/games/invaders/Makefileindex dc599b4b..1f6efe96 100644--- a/games/invaders/Makefile+++ b/games/invaders/Makefile@@ -81,3 +81,9 @@ $(BUILD_DIR)/sim-module.o: $(SRC) $(HEADERS) | $(BUILD_DIR)$(Q) cc -std=c11 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) -DNP_MODULE=1 -Dmain=np_invaders_main \-c $(SRC) -o $(BUILD_DIR)/sim/main.o$(Q) ld -r $(BUILD_DIR)/sim/main.o -exported_symbol _np_invaders_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = invaders+PORT_NAME = Space Invaders+PORT_SRC = src/main.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+include ../../platform/port.mkdiff --git a/games/invaders/src/main.c b/games/invaders/src/main.cindex 461e51a1..5b2a03d6 100644--- a/games/invaders/src/main.c+++ b/games/invaders/src/main.c@@ -30,9 +30,11 @@#define np_file_read ef_read#define np_file_write ef_write#ifndef HOST /* (a computer build of the tests has no app header) */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Space Invaders";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endifvoid np_push(int x, int y, int w, int h, const color_t *px) {eadk_display_push_rect((eadk_rect_t){(uint16_t)x, (uint16_t)y, (uint16_t)w, (uint16_t)h}, px);}diff --git a/games/isaac/Makefile b/games/isaac/Makefileindex e7660570..bd691597 100644--- a/games/isaac/Makefile+++ b/games/isaac/Makefile@@ -77,3 +77,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = isaac+PORT_NAME = The Binding of Isaac+PORT_SRC = src/bosses.c src/ents.c src/floor.c src/game.c src/hud.c src/items.c src/main.c src/monsters.c src/pickups.c src/player.c src/room.c src/save.c src/tears.c src/gfx.c src/res.c src/plat_eadk.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/isaac/src/main.c b/games/isaac/src/main.cindex 818777f1..709c03bf 100644--- a/games/isaac/src/main.c+++ b/games/isaac/src/main.c@@ -8,8 +8,10 @@#include "res.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Isaac";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifextern const uint8_t is_data[];uint32_t perf_frames __attribute__((used)); /* read by tools/emu.py */diff --git a/games/jetpackjoyride/Makefile b/games/jetpackjoyride/Makefileindex 48ab3b7f..bf3cc260 100644--- a/games/jetpackjoyride/Makefile+++ b/games/jetpackjoyride/Makefile@@ -61,3 +61,10 @@ art:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = jetpackjoyride+PORT_NAME = Jetpack Joyride+PORT_SRC = src/main.c src/sim.c src/draw.c src/save.c src/plat_eadk.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+PORT_FLAGS = -DEPSILON_XL=1+include ../../platform/port.mkdiff --git a/games/jetpackjoyride/src/plat_eadk.c b/games/jetpackjoyride/src/plat_eadk.cindex 4fc3c801..95acc6e4 100644--- a/games/jetpackjoyride/src/plat_eadk.c+++ b/games/jetpackjoyride/src/plat_eadk.c@@ -5,8 +5,10 @@#include "../../../launcher/src/np.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Jetpack Joyride";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/kingdomrush/Makefile b/games/kingdomrush/Makefileindex 531cfbcd..81037475 100644--- a/games/kingdomrush/Makefile+++ b/games/kingdomrush/Makefile@@ -76,3 +76,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = kingdomrush+PORT_NAME = Kingdom Rush+PORT_SRC = src/bullet.c src/enemy.c src/enemy2.c src/game.c src/level.c src/main.c src/menus.c src/play.c src/power.c src/save.c src/site.c src/soldier.c src/special.c src/stats.c src/strings.c src/tower.c src/ui.c src/pic.c src/gfx.c src/plat_eadk.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/kingdomrush/src/main.c b/games/kingdomrush/src/main.cindex c8ed0da3..51542173 100644--- a/games/kingdomrush/src/main.c+++ b/games/kingdomrush/src/main.c@@ -8,8 +8,10 @@#include "res.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Kingdom Rush";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifextern const uint8_t kr_data[];const uint8_t *kr_bin;diff --git a/games/leveldevil/Makefile b/games/leveldevil/Makefileindex a657745b..6933c7d4 100644--- a/games/leveldevil/Makefile+++ b/games/leveldevil/Makefile@@ -73,3 +73,10 @@ build/play: $(SRC) src/pictures.h $(ROOMS) tests/play.c $(HEADERS)@echo "HOST $@"test: build/playbuild/play solve++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = leveldevil+PORT_NAME = Level Devil+PORT_SRC = src/main.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+PORT_FLAGS = -DEPSILON_XL=1 -I$(BUILD_DIR)+include ../../platform/port.mkdiff --git a/games/leveldevil/src/main.c b/games/leveldevil/src/main.cindex c2f9afc6..1106fe99 100644--- a/games/leveldevil/src/main.c+++ b/games/leveldevil/src/main.c@@ -22,9 +22,11 @@#include "../../common/epsilon_files.h"#ifndef HOST /* (a computer build of the tests has no app header) */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Level Devil";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endifvoid np_push(int x, int y, int w, int h, const color_t *px) {eadk_display_push_rect((eadk_rect_t){(uint16_t)x, (uint16_t)y, (uint16_t)w, (uint16_t)h}, px);}diff --git a/games/mahjong/Makefile b/games/mahjong/Makefileindex cf01dcc4..13caa398 100644--- a/games/mahjong/Makefile+++ b/games/mahjong/Makefile@@ -89,3 +89,10 @@ test: build/playclean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = mahjong+PORT_NAME = Mahjong+PORT_SRC = src/main.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+PORT_FLAGS = -DEPSILON_XL=1 -I../../launcher/src+include ../../platform/port.mkdiff --git a/games/mahjong/src/main.c b/games/mahjong/src/main.cindex e8398eb1..87b45202 100644--- a/games/mahjong/src/main.c+++ b/games/mahjong/src/main.c@@ -29,9 +29,11 @@ bool host_write(const char *name, const void *data, uint32_t len);#include "../../common/epsilon_files.h"#define file_read ef_read#define file_write ef_write+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Mahjong";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endifvoid np_push(int x, int y, int w, int h, const color_t *px) {eadk_display_push_rect((eadk_rect_t){(uint16_t)x, (uint16_t)y, (uint16_t)w, (uint16_t)h}, px);}diff --git a/games/meowdoku/Makefile b/games/meowdoku/Makefileindex b0558897..b7a980c0 100644--- a/games/meowdoku/Makefile+++ b/games/meowdoku/Makefile@@ -82,3 +82,9 @@ $(BUILD_DIR)/sim-module.o: $(SRC) $(HEADERS) | $(BUILD_DIR)$(Q) cc -std=c11 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) -DNP_MODULE=1 -Dmain=np_meowdoku_main \-c $(SRC) -o $(BUILD_DIR)/sim/main.o$(Q) ld -r $(BUILD_DIR)/sim/main.o -exported_symbol _np_meowdoku_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = meowdoku+PORT_NAME = Meowdoku+PORT_SRC = src/main.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+include ../../platform/port.mkdiff --git a/games/meowdoku/src/main.c b/games/meowdoku/src/main.cindex 18f8f969..d638df6c 100644--- a/games/meowdoku/src/main.c+++ b/games/meowdoku/src/main.c@@ -28,9 +28,11 @@ bool np_file_write(const char *name, const void *data, uint32_t len);#include "../../common/epsilon_files.h"#define np_file_read ef_read#define np_file_write ef_write+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Meowdoku";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endifvoid np_push(int x, int y, int w, int h, const color_t *px) {eadk_display_push_rect((eadk_rect_t){(uint16_t)x, (uint16_t)y, (uint16_t)w, (uint16_t)h}, px);}diff --git a/games/minesweeper/Makefile b/games/minesweeper/Makefileindex 94791175..2f8a7809 100644--- a/games/minesweeper/Makefile+++ b/games/minesweeper/Makefile@@ -53,3 +53,9 @@ $(BUILD_DIR)/sim-module.o: $(SRC) $(HEADERS) | $(BUILD_DIR)$(Q) mkdir -p $(BUILD_DIR)/sim$(Q) cc -std=c11 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) -Dmain=np_minesweeper_main -c $(SRC) -o $(BUILD_DIR)/sim/main.o$(Q) ld -r $(BUILD_DIR)/sim/main.o -exported_symbol _np_minesweeper_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = minesweeper+PORT_NAME = Minesweeper+PORT_SRC = src/main.c+include ../../platform/port.mkdiff --git a/games/minesweeper/src/main.c b/games/minesweeper/src/main.cindex 32b30a65..5630ff13 100644--- a/games/minesweeper/src/main.c+++ b/games/minesweeper/src/main.c@@ -16,9 +16,11 @@#include "../../common/np_text.h"#ifdef __ELF__ /* app name and API level, for the calculator's installer */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Minesweeper";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endiftypedef uint16_t color;#define RGB(c) (color)((((c) >> 8) & 0xF800) | (((c) >> 5) & 0x07E0) | (((c) >> 3) & 0x1F))diff --git a/games/monkeymart/Makefile b/games/monkeymart/Makefileindex a06f55a0..3cddd03d 100644--- a/games/monkeymart/Makefile+++ b/games/monkeymart/Makefile@@ -60,3 +60,10 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = monkeymart+PORT_NAME = Monkey Mart+PORT_SRC = src/main.c src/game.c src/draw.c src/save.c src/data.c src/art.c src/plat_eadk.c+PORT_FLAGS = -DEPSILON_XL=1+include ../../platform/port.mkdiff --git a/games/monkeymart/src/plat_eadk.c b/games/monkeymart/src/plat_eadk.cindex 402cbef7..ddd24f93 100644--- a/games/monkeymart/src/plat_eadk.c+++ b/games/monkeymart/src/plat_eadk.c@@ -4,8 +4,10 @@#include "../../common/epsilon_files.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Monkey Mart";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/mrbullet/Makefile b/games/mrbullet/Makefileindex 4a793b29..421cf70f 100644--- a/games/mrbullet/Makefile+++ b/games/mrbullet/Makefile@@ -116,3 +116,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = mrbullet+PORT_NAME = Mr Bullet+PORT_SRC = src/main.c src/ui.c src/game.c src/res.c src/save.c src/inflate.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -I../../launcher/src -Isrc -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/mrbullet/src/plat_eadk.c b/games/mrbullet/src/plat_eadk.cindex bae01e83..8e55b94b 100644--- a/games/mrbullet/src/plat_eadk.c+++ b/games/mrbullet/src/plat_eadk.c@@ -4,8 +4,10 @@#include "../../common/epsilon_files.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Mr Bullet";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/numblocks/Makefile b/games/numblocks/Makefileindex 173e9926..615ab425 100644--- a/games/numblocks/Makefile+++ b/games/numblocks/Makefile@@ -111,3 +111,10 @@ $(BUILD_DIR)/sim-module.o: $(GAME) src/plat_eadk.c $(HEADERS) | $(BUILD_DIR)$(shell $(NWLINK) eadk-cflags-simulator) -fno-math-errno -Dmain=np_numblocks_main -c src/$$f.c \-o $(BUILD_DIR)/sim/$$f.o || exit 1; done$(Q) ld -r $(BUILD_DIR)/sim/*.o -exported_symbol _np_numblocks_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = numblocks+PORT_NAME = NumBlocks+PORT_SRC = src/main.c src/world.c src/edits.c src/render.c src/player.c src/phys.c src/inv.c src/entity.c src/mob.c src/tick.c src/gui.c src/hand.c src/save.c src/names.c src/command.c src/gen.c src/data_dims.c src/dims.c src/end.c src/plat_eadk.c+PORT_FLAGS = -DNB_DIMS=1+include ../../platform/port.mkdiff --git a/games/numblocks/src/main.c b/games/numblocks/src/main.cindex fb33fb42..0aa1a905 100644--- a/games/numblocks/src/main.c+++ b/games/numblocks/src/main.c@@ -7,9 +7,11 @@#pragma GCC optimize("Os") /* (not where the time goes: small) */#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "NumBlocks";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endifuint32_t perf_frames __attribute__((used)); /* read by tools/emu.py */uint32_t perf_max __attribute__((used)); /* (and the slowest frame in a world, ms) */diff --git a/games/numdash/Makefile b/games/numdash/Makefileindex dde933ea..ff2d093b 100644--- a/games/numdash/Makefile+++ b/games/numdash/Makefile@@ -68,3 +68,9 @@ build/sim-module.o: $(COMMON) src/platform_eadk.c src/main.c $(HEADERS) node_modfor f in $(COMMON) src/platform_eadk.c src/main.c; do cc -std=c11 -O2 -fPIC -Isrc \$(shell $(NWLINK) eadk-cflags-simulator) -Dmain=np_numdash_main -c $$f -o build/sim/$$(basename $$f .c).o || exit 1; doneld -r build/sim/*.o -exported_symbol _np_numdash_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = numdash+PORT_NAME = NumDash+PORT_SRC = src/game.c src/trig.c src/level.c src/inflate.c src/leveldata.c src/objdefs.c src/assets.c src/assets_lv.c src/gfx.c src/scene.c src/fx.c src/save.c src/ui.c src/app.c src/menu.c src/play.c src/editor.c src/platform_eadk.c src/main.c+include ../../platform/port.mkdiff --git a/games/numdash/src/main.c b/games/numdash/src/main.cindex 9174f782..1f6cec0a 100644--- a/games/numdash/src/main.c+++ b/games/numdash/src/main.c@@ -3,9 +3,11 @@#include "app.h"#if PLATFORM_DEVICE#include <eadk.h>+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "NumDash";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endif/* Frames drawn so far, read by tools/emu.py to measure frame rates. */__attribute__((used)) volatile uint32_t perf_frames;diff --git a/games/numdrive/Makefile b/games/numdrive/Makefileindex 14daf38c..fb4f58dd 100644--- a/games/numdrive/Makefile+++ b/games/numdrive/Makefile@@ -14,7 +14,7 @@ CFLAGS = -std=gnu11 -Wall -Wno-unused-function -fsingle-precision-constantifeq ($(PLATFORM),device)CC = arm-none-eabi-gcc-TARGET = $(BUILD_DIR)/numdrive.nwa+APP_FILE = $(BUILD_DIR)/numdrive.nwaCFLAGS += $(shell $(NWLINK) eadk-cflags-device) -OsCFLAGS += -flto -flto-partition=one -fno-fat-lto-objects -fwhole-program -fvisibility=internal -fno-math-errno -fno-identLDFLAGS = $(shell $(NWLINK) eadk-ldflags-device) --specs=nano.specs@@ -23,16 +23,16 @@ LDFLAGS += -flinker-output=nolto-relEXTRA = $(BUILD_DIR)/icon.oelseCC = gcc-TARGET = $(BUILD_DIR)/numdrive.nwb+APP_FILE = $(BUILD_DIR)/numdrive.nwbCFLAGS += $(shell $(NWLINK) eadk-cflags-simulator) -O2 -DNO_STORAGELDFLAGS = $(shell $(NWLINK) eadk-ldflags-simulator)EXTRA =endif.PHONY: build clean-build: $(TARGET)+build: $(APP_FILE)-$(TARGET): $(OBJECTS) $(EXTRA)+$(APP_FILE): $(OBJECTS) $(EXTRA)@echo "LD $@"$(Q) $(CC) $(CFLAGS) $^ $(LDFLAGS) -lm -o $@ifeq ($(PLATFORM),device)@@ -82,3 +82,10 @@ output/sim-module.o: $(addprefix src/,$(SOURCES)) src/pack.bin src/*.h-c src/$$f -o output/npsim/$${f%.c}.o || exit 1; done$(Q) cc -fPIC -c output/npsim/pack_bin.c -o output/npsim/pack_bin.o$(Q) ld -r output/npsim/*.o -exported_symbol _np_numdrive_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = numdrive+PORT_NAME = NumDrive+PORT_SRC = src/main.c src/world.c src/vm.c src/physics.c src/render.c src/inflate.c src/gfx.c src/ui.c src/save.c src/font.c src/platform_eadk.c+PORT_ASM = src/pack_data.S+include ../../platform/port.mkdiff --git a/games/numdrive/src/main.c b/games/numdrive/src/main.cindex 9ffcb05a..001566e0 100644--- a/games/numdrive/src/main.c+++ b/games/numdrive/src/main.c@@ -14,10 +14,12 @@#ifndef HOST#include <eadk.h>#ifdef __ELF__ /* app name and API level, for the calculator's installer */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "NumDrive";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif#endif+#endif/* read by tools/emu.py: frames drawn while driving, the slowest, those over 33 ms, and the time spent in* the simulation and in drawing */diff --git a/games/numpico/Makefile b/games/numpico/Makefileindex 99bf62b8..8c2fa832 100644--- a/games/numpico/Makefile+++ b/games/numpico/Makefile@@ -103,3 +103,10 @@ $(BUILD_DIR)/perf.nwa: $(OBJ) $(BUILD_DIR)/icon.o $(BUILD_DIR)/perf-carts.o src/$(Q) $(CC) $(CFLAGS) $(APP_OPT) $(LDFLAGS) -Wl,-T,src/carts.ld $(OBJ) $(BUILD_DIR)/icon.o $(BUILD_DIR)/perf-carts.o -lm -o $@perf: $(OBJ)$(Q) NWLINK="$(NWLINK)" $(PYTHON) tests/perf.py $(TEST_CARTS)++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = numpico+PORT_NAME = NumPico+PORT_SRC = src/femto8/lua/lapi.c src/femto8/lua/lauxlib.c src/femto8/lua/lbaselib.c src/femto8/lua/lcode.c src/femto8/lua/lcorolib.c src/femto8/lua/lctype.c src/femto8/lua/ldebug.c src/femto8/lua/ldo.c src/femto8/lua/lfunc.c src/femto8/lua/lgc.c src/femto8/lua/linit.c src/femto8/lua/llex.c src/femto8/lua/lmem.c src/femto8/lua/lobject.c src/femto8/lua/lopcodes.c src/femto8/lua/lparser.c src/femto8/lua/lpico8lib.c src/femto8/lua/lstate.c src/femto8/lua/lstring.c src/femto8/lua/lstrlib.c src/femto8/lua/ltable.c src/femto8/lua/ltablib.c src/femto8/lua/ltm.c src/femto8/lua/lvm.c src/femto8/lua/lzio.c src/femto8/p8_lua.c src/pico.c src/heap.c src/main.c src/carts.c src/plat_eadk.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+PORT_FLAGS = -DEPSILON_XL=1 -DNDEBUG -I../../launcher/src -Isrc -Isrc/femto8 -Isrc/femto8/lua+include ../../platform/port.mkdiff --git a/games/numpico/src/plat_eadk.c b/games/numpico/src/plat_eadk.cindex 36e0745d..773640b8 100644--- a/games/numpico/src/plat_eadk.c+++ b/games/numpico/src/plat_eadk.c@@ -5,8 +5,10 @@#include "gfx.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "NumPico";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/numpowder/Makefile b/games/numpowder/Makefileindex eb2104b2..87abdb11 100644--- a/games/numpowder/Makefile+++ b/games/numpowder/Makefile@@ -80,3 +80,10 @@ gen:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = numpowder+PORT_NAME = NumPowder+PORT_SRC = src/canmove_data.c src/elements_data.c src/font.c src/font_data.c src/gol.c src/gravity.c src/input.c src/main.c src/tools.c src/ui.c src/ui_draw.c src/ui_menu.c src/ui_opts.c src/ui_save.c src/walls.c src/air.c src/el_elec.c src/el_fire.c src/el_force.c src/el_gases.c src/el_liquids.c src/el_misc.c src/el_nuclear.c src/el_pipe.c src/el_powders.c src/el_sensors.c src/el_solids.c src/el_special.c src/el_stkm.c src/render.c src/render_el.c src/render_el2.c src/render_ovl.c src/sim.c src/sim_move.c src/simsave.c src/plat_eadk.c+PORT_FLAGS = -DEPSILON_XL=1+include ../../platform/port.mkdiff --git a/games/numpowder/src/main.c b/games/numpowder/src/main.cindex d4c68f27..0be71467 100644--- a/games/numpowder/src/main.c+++ b/games/numpowder/src/main.c@@ -6,9 +6,11 @@#include "ui.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "NumPowder";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endif/* the frame time: as fast as it goes, up to the original's 60 frames a second */#define FRAME_MS 16diff --git a/games/numvisuals/Makefile b/games/numvisuals/Makefileindex 82f8df48..db4ff518 100644--- a/games/numvisuals/Makefile+++ b/games/numvisuals/Makefile@@ -49,3 +49,9 @@ $(BUILD_DIR)/sim-module.o: $(SRC) $(HEADERS) | $(BUILD_DIR)$(Q) mkdir -p $(BUILD_DIR)/sim$(Q) cc -std=c11 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) -Dmain=np_numvisuals_main -c $(SRC) -o $(BUILD_DIR)/sim/main.o$(Q) ld -r $(BUILD_DIR)/sim/main.o -exported_symbol _np_numvisuals_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = numvisuals+PORT_NAME = NumVisuals+PORT_SRC = src/main.c+include ../../platform/port.mkdiff --git a/games/numvisuals/src/main.c b/games/numvisuals/src/main.cindex c0fdd6b4..a2511390 100644--- a/games/numvisuals/src/main.c+++ b/games/numvisuals/src/main.c@@ -12,9 +12,11 @@#include "../../common/np_text.h"#ifdef __ELF__ /* app name and API level, for the calculator's installer */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "NumVisuals";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endif#define W 320#define H 240diff --git a/games/pacman/Makefile b/games/pacman/Makefileindex 860f462d..df915b43 100644--- a/games/pacman/Makefile+++ b/games/pacman/Makefile@@ -49,3 +49,9 @@ $(BUILD_DIR)/sim-module.o: $(SRC) $(HEADERS) | $(BUILD_DIR)$(Q) mkdir -p $(BUILD_DIR)/sim$(Q) cc -std=c11 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) -Dmain=np_pacman_main -c $(SRC) -o $(BUILD_DIR)/sim/main.o$(Q) ld -r $(BUILD_DIR)/sim/main.o -exported_symbol _np_pacman_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = pacman+PORT_NAME = Pac-Man+PORT_SRC = src/main.c+include ../../platform/port.mkdiff --git a/games/pacman/src/main.c b/games/pacman/src/main.cindex c604b0ce..c23de66f 100644--- a/games/pacman/src/main.c+++ b/games/pacman/src/main.c@@ -18,9 +18,11 @@#include "../../common/np_text.h"#ifdef __ELF__ /* app name and API level, for the calculator's installer */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Pac-Man";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endiftypedef uint16_t color;#define RGB(c) (color)((((c) >> 8) & 0xF800) | (((c) >> 5) & 0x07E0) | (((c) >> 3) & 0x1F))diff --git a/games/paperclips/Makefile b/games/paperclips/Makefileindex 672b917c..268772b1 100644--- a/games/paperclips/Makefile+++ b/games/paperclips/Makefile@@ -74,3 +74,10 @@ build/fr/play: $(HOST_SRC) $(wildcard src/*) lang/fr.txt tools/french.pyclean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = paperclips+PORT_NAME = Universal Paperclips+PORT_SRC = src/main.c src/sim.c src/projects.c src/num.c src/ui.c src/save.c src/plat_eadk.c src/font_data.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c $(BUILD_DIR)/fr/main.c $(BUILD_DIR)/fr/sim.c $(BUILD_DIR)/fr/projects.c $(BUILD_DIR)/fr/num.c $(BUILD_DIR)/fr/ui.c $(BUILD_DIR)/fr/save.c $(BUILD_DIR)/fr/plat_eadk.c $(BUILD_DIR)/fr/font_data.c+PORT_FLAGS = -DEPSILON_XL=1 -I../../launcher/src -Isrc -DPC_FR=1+include ../../platform/port.mkdiff --git a/games/paperclips/src/plat_eadk.c b/games/paperclips/src/plat_eadk.cindex 4eff6b54..c18b182e 100644--- a/games/paperclips/src/plat_eadk.c+++ b/games/paperclips/src/plat_eadk.c@@ -4,8 +4,10 @@#include "../../common/epsilon_files.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Paperclips";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/polytrack/Makefile b/games/polytrack/Makefileindex d1fc90ba..d3d1a3ec 100644--- a/games/polytrack/Makefile+++ b/games/polytrack/Makefile@@ -107,3 +107,11 @@ test: build/playclean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = polytrack+PORT_NAME = PolyTrack+PORT_SRC = src/main.c src/draw.c src/save.c src/ghost.c src/data.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -I../../launcher/src -Isrc -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/polytrack/src/plat_eadk.c b/games/polytrack/src/plat_eadk.cindex 6b0b92ec..b6093b23 100644--- a/games/polytrack/src/plat_eadk.c+++ b/games/polytrack/src/plat_eadk.c@@ -4,8 +4,10 @@#include "../../common/epsilon_files.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "PolyTrack";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/polytrack/tests/armcheck.c b/games/polytrack/tests/armcheck.cindex 1919808c..65c21424 100644--- a/games/polytrack/tests/armcheck.c+++ b/games/polytrack/tests/armcheck.c@@ -5,8 +5,10 @@#include "../src/car.h"#include "routes.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "PTCheck";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif__attribute__((used, externally_visible)) uint32_t check_out[2 * PT_NTRACKS], check_done;/* (the emulator sets how many tracks, then go, once the app waits) */diff --git a/games/polytrack/tests/armperf.c b/games/polytrack/tests/armperf.cindex 35ea984e..7aad1495 100644--- a/games/polytrack/tests/armperf.c+++ b/games/polytrack/tests/armperf.c@@ -10,8 +10,10 @@#include "../src/save.h"#include "routes.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "PTPerf";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif/* in: the track, then go (set by the emulator once the app waits); out: frames, work (ms) in all, the slowest,frames over 33 ms, frames at qualities 2..5, the finish, at 1, the triangles and the chunks of the slow frames in all, at 0 */diff --git a/games/portal/Makefile b/games/portal/Makefileindex 9f12c9ea..420b71d7 100644--- a/games/portal/Makefile+++ b/games/portal/Makefile@@ -72,3 +72,9 @@ host: $(BUILD_DIR)/host$(BUILD_DIR)/host: $(SRC) $(HDR) test/host.c | $(BUILD_DIR)$(Q) cc -std=gnu99 -O2 -w -DPORTAL_TEST $(shell $(NWLINK) eadk-cflags-simulator) -Dmain=portal_main -c src/main.c -o $(BUILD_DIR)/host_main.o$(Q) cc -std=gnu99 -O2 -w -DPORTAL_TEST $(shell $(NWLINK) eadk-cflags-simulator) test/host.c src/game.c src/gfx.c src/inflate.c $(BUILD_DIR)/host_main.o -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = portal+PORT_NAME = Portal Returns+PORT_SRC = src/main.c src/game.c src/gfx.c src/inflate.c+include ../../platform/port.mkdiff --git a/games/portal/src/main.c b/games/portal/src/main.cindex d14bd4dc..48b8f07b 100644--- a/games/portal/src/main.c+++ b/games/portal/src/main.c@@ -7,9 +7,11 @@#include "assets.h"#ifdef __ELF__ /* app name and API level, for the calculator's installer */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Portal";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endif#define SPT(a) (S_E1C7 + ((a) - 0xE1C7))diff --git a/games/pvz/Makefile b/games/pvz/Makefileindex b218319c..f5373224 100644--- a/games/pvz/Makefile+++ b/games/pvz/Makefile@@ -80,3 +80,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = pvz+PORT_NAME = Plants vs. Zombies+PORT_SRC = src/board.c src/boss.c src/boss_art.c src/defs.c src/draw.c src/hud.c src/main.c src/plants.c src/save.c src/screens.c src/zombies.c ../../launcher/src/inflate.c src/gfx.c src/plat_eadk.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/pvz/src/main.c b/games/pvz/src/main.cindex 3e6bae7e..32401a5f 100644--- a/games/pvz/src/main.c+++ b/games/pvz/src/main.c@@ -10,8 +10,10 @@const uint8_t *pvz_bin;#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Plants vs. Zombies";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifextern const uint8_t pvz_data[];uint32_t perf_frames __attribute__((used)); /* read by tools/emu.py */diff --git a/games/retrogo/Makefile b/games/retrogo/Makefileindex 87004d8f..a60456d6 100644--- a/games/retrogo/Makefile+++ b/games/retrogo/Makefile@@ -126,3 +126,10 @@ test: $(BUILD_DIR)/host/core $(BUILD_DIR)/host/romtable $(BUILD_DIR)/host/pack $$(Q) $(PY) tests/test_romtable.py $(BUILD_DIR)/host/romtable$(Q) $(PY) tests/test_cores.py $(BUILD_DIR)/host/core $(TEST_ROMS) $(BUILD_DIR)/host/z80$(Q) NWLINK="$(NWLINK)" $(PY) tests/test_app.py++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = retrogo+PORT_NAME = Retro-Go+PORT_SRC = src/gb/cpu.c src/gb/hw.c src/gb/mem.c src/gb/lcdc.c src/gb/rtc.c src/gb/lcd.c src/gb/gb.c src/nes/nes6502.c src/nes/nes_ppu.c src/nes/nes_mmc.c src/nes/mmclist.c src/nes/nes_apu.c src/nes/nes.c src/nes/mappers/map000.c src/nes/mappers/map001.c src/nes/mappers/map002.c src/nes/mappers/map003.c src/nes/mappers/map004.c src/nes/mappers/map005.c src/nes/mappers/map007.c src/nes/mappers/map008.c src/nes/mappers/map009.c src/nes/mappers/map011.c src/nes/mappers/map015.c src/nes/mappers/map016.c src/nes/mappers/map018.c src/nes/mappers/map019.c src/nes/mappers/map024.c src/nes/mappers/map032.c src/nes/mappers/map033.c src/nes/mappers/map034.c src/nes/mappers/map040.c src/nes/mappers/map064.c src/nes/mappers/map065.c src/nes/mappers/map066.c src/nes/mappers/map070.c src/nes/mappers/map075.c src/nes/mappers/map078.c src/nes/mappers/map079.c src/nes/mappers/map085.c src/nes/mappers/map094.c src/nes/mappers/map099.c src/nes/mappers/map231.c src/nes/mappers/mapvrc.c src/sms/z80.c src/sms/sms.c src/sms/coleco_bios.c src/main.c src/romtable.c src/pack.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+PORT_FLAGS = -Isrc/nes+include ../../platform/port.mkdiff --git a/games/retrogo/src/main.c b/games/retrogo/src/main.cindex bc39a70b..15b62931 100644--- a/games/retrogo/src/main.c+++ b/games/retrogo/src/main.c@@ -35,8 +35,10 @@#define np_file_read ef_read#define np_file_write ef_write#define file_delete ef_remove+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Retro-Go";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifvoid np_push(int x, int y, int w, int h, const color_t *px) {eadk_display_push_rect((eadk_rect_t){(uint16_t)x, (uint16_t)y, (uint16_t)w, (uint16_t)h}, px);}diff --git a/games/rider/Makefile b/games/rider/Makefileindex 8d71a01d..4d3219b3 100644--- a/games/rider/Makefile+++ b/games/rider/Makefile@@ -116,3 +116,10 @@ test: build/playclean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = rider+PORT_NAME = Rider+PORT_SRC = src/main.c src/game.c src/draw.c src/plat_eadk.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+PORT_FLAGS = -DEPSILON_XL=1 -I../../launcher/src -Isrc -DB2_TREE_NODES=320 -DB2_STACK_SIZE=16384 -DB2_CHUNK_SIZE=1024 -DB2_CHUNK_ARRAY_INCREMENT=64 -DPH_ARENA=102400+include ../../platform/port.mkdiff --git a/games/rider/src/plat_eadk.c b/games/rider/src/plat_eadk.cindex 6a203d08..37037c26 100644--- a/games/rider/src/plat_eadk.c+++ b/games/rider/src/plat_eadk.c@@ -5,8 +5,10 @@#include "gfx.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Rider";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/snake/src/main.c b/games/snake/src/main.cindex 032e97cf..8734de77 100644--- a/games/snake/src/main.c+++ b/games/snake/src/main.c@@ -17,9 +17,11 @@#include "../../common/np_text.h"#ifdef __ELF__ /* app name and API level, for the calculator's installer */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Snake";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endiftypedef uint16_t color;#define RGB(c) (color)((((c) >> 8) & 0xF800) | (((c) >> 5) & 0x07E0) | (((c) >> 3) & 0x1F))diff --git a/games/snowrider/Makefile b/games/snowrider/Makefileindex 283829ed..5c703793 100644--- a/games/snowrider/Makefile+++ b/games/snowrider/Makefile@@ -75,3 +75,10 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = snowrider+PORT_NAME = Snow Rider 3D+PORT_SRC = src/data.c src/draw.c src/game.c src/logo.c src/main.c src/plat_eadk.c src/r3d.c src/save.c src/sr.c src/ui.c src/world.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+PORT_FLAGS = -DEPSILON_XL=1 -I../../launcher/src+include ../../platform/port.mkdiff --git a/games/snowrider/src/main.c b/games/snowrider/src/main.cindex 3ca83f46..87e9cb94 100644--- a/games/snowrider/src/main.c+++ b/games/snowrider/src/main.c@@ -8,14 +8,18 @@/* (gfx.c's own strips and arena are not used: it draws into the renderer's bands) */void np_push(int x, int y, int w, int h, const color_t *px) { plat_push(x, y, w, h, px); }+#ifndef NP_PORTvoid *np_alloc(uint32_t size) { (void)size; return 0; }+#endif#ifndef HOST#ifdef SR_BENCH#include "../tests/auto.h"#endif+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Snow Rider 3D";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifuint32_t perf_frames __attribute__((used)); /* read by tools/emu.py */uint32_t perf_max __attribute__((used));diff --git a/games/sokoban/Makefile b/games/sokoban/Makefileindex 33ca68ce..f3998eb0 100644--- a/games/sokoban/Makefile+++ b/games/sokoban/Makefile@@ -98,3 +98,10 @@ $(BUILD_DIR)/sim-module.o: $(SRC) $(BUILD_DIR)/numplay/levels.inc $(HEADERS) | $$(Q) cc -std=c11 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) -I$(BUILD_DIR)/numplay -DNP_MODULE=1 \-Dmain=np_sokoban_main -c $(SRC) -o $(BUILD_DIR)/sim/main.o$(Q) ld -r $(BUILD_DIR)/sim/main.o -exported_symbol _np_sokoban_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = sokoban+PORT_NAME = Sokoban+PORT_SRC = src/main.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c ../../launcher/src/inflate.c+PORT_FLAGS = -I$(BUILD_DIR)+include ../../platform/port.mkdiff --git a/games/sokoban/src/main.c b/games/sokoban/src/main.cindex 9c769f02..8cd47db5 100644--- a/games/sokoban/src/main.c+++ b/games/sokoban/src/main.c@@ -25,9 +25,11 @@#define np_file_read ef_read#define np_file_write ef_write#ifndef HOST /* (a computer build of the tests has no app header) */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Sokoban";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endifvoid np_push(int x, int y, int w, int h, const color_t *px) {eadk_display_push_rect((eadk_rect_t){(uint16_t)x, (uint16_t)y, (uint16_t)w, (uint16_t)h}, px);}diff --git a/games/solitaire/Makefile b/games/solitaire/Makefileindex fa0288b1..c673b585 100644--- a/games/solitaire/Makefile+++ b/games/solitaire/Makefile@@ -54,3 +54,9 @@ $(BUILD_DIR)/sim-module.o: $(SRC) $(HEADERS) | $(BUILD_DIR)$(Q) mkdir -p $(BUILD_DIR)/sim$(Q) cc -std=c11 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) -Dmain=np_solitaire_main -c $(SRC) -o $(BUILD_DIR)/sim/main.o$(Q) ld -r $(BUILD_DIR)/sim/main.o -exported_symbol _np_solitaire_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = solitaire+PORT_NAME = Solitaire+PORT_SRC = src/main.c+include ../../platform/port.mkdiff --git a/games/solitaire/src/main.c b/games/solitaire/src/main.cindex ef285678..394074b4 100644--- a/games/solitaire/src/main.c+++ b/games/solitaire/src/main.c@@ -17,9 +17,11 @@#include "../../common/np_text.h"#ifdef __ELF__ /* app name and API level, for the calculator's installer */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Solitaire";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endiftypedef uint16_t color;#define RGB(c) (color)((((c) >> 8) & 0xF800) | (((c) >> 5) & 0x07E0) | (((c) >> 3) & 0x1F))diff --git a/games/sonic/Makefile b/games/sonic/Makefileindex 920ed3e9..a9f6d4e1 100644--- a/games/sonic/Makefile+++ b/games/sonic/Makefile@@ -77,3 +77,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build/play build/shots++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = sonic+PORT_NAME = Sonic the Hedgehog+PORT_SRC = src/anim.c src/collide.c src/dle.c src/ending.c src/game.c src/hud.c src/level.c src/main.c src/menus.c src/obj.c src/obj_cards.c src/obj_common.c src/obj_ghz.c src/obj_items.c src/obj_lz.c src/obj_mz.c src/obj_sbz.c src/obj_slz.c src/obj_syz.c src/objects.c src/palette.c src/react.c src/save.c src/screens.c src/solid.c src/sonic.c src/special.c src/ui.c src/water.c src/vdp.c src/plat_eadk.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/sonic/src/plat_eadk.c b/games/sonic/src/plat_eadk.cindex bbf2ae5f..a240ed20 100644--- a/games/sonic/src/plat_eadk.c+++ b/games/sonic/src/plat_eadk.c@@ -7,8 +7,10 @@#include "../../common/epsilon_files.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Sonic";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/stickmanhook/Makefile b/games/stickmanhook/Makefileindex a94c7243..9eb6c375 100644--- a/games/stickmanhook/Makefile+++ b/games/stickmanhook/Makefile@@ -65,3 +65,10 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = stickmanhook+PORT_NAME = Stickman Hook+PORT_SRC = src/main.c src/game.c src/draw.c src/save.c src/levels.c src/art.c src/plat_eadk.c+PORT_FLAGS = -DEPSILON_XL=1+include ../../platform/port.mkdiff --git a/games/stickmanhook/src/plat_eadk.c b/games/stickmanhook/src/plat_eadk.cindex 421138fa..d20ad941 100644--- a/games/stickmanhook/src/plat_eadk.c+++ b/games/stickmanhook/src/plat_eadk.c@@ -4,8 +4,10 @@#include "../../common/epsilon_files.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Stickman Hook";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/subway/Makefile b/games/subway/Makefileindex 66c888ef..710337ba 100644--- a/games/subway/Makefile+++ b/games/subway/Makefile@@ -72,3 +72,10 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = subway+PORT_NAME = Subway Surfers+PORT_SRC = src/actors.c src/app.c src/assets.c src/data.c src/draw.c src/game.c src/icons.c src/main.c src/plat_eadk.c src/r3d.c src/save.c src/scene.c src/world.c+PORT_FLAGS = -DEPSILON_XL=1+include ../../platform/port.mkdiff --git a/games/subway/src/main.c b/games/subway/src/main.cindex bdc236d9..96dfdbdb 100644--- a/games/subway/src/main.c+++ b/games/subway/src/main.c@@ -10,8 +10,10 @@#include "r3d.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Subway Surfers";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifuint32_t perf_frames __attribute__((used)); /* read by tools/emu.py */uint32_t perf_max __attribute__((used));diff --git a/games/sudoku/Makefile b/games/sudoku/Makefileindex d346745c..e4e6bc15 100644--- a/games/sudoku/Makefile+++ b/games/sudoku/Makefile@@ -84,3 +84,9 @@ $(BUILD_DIR)/sim-module.o: $(SRC) $(HEADERS) | $(BUILD_DIR)$(Q) cc -std=c11 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) -DNP_MODULE=1 -Dmain=np_sudoku_main \-c $(SRC) -o $(BUILD_DIR)/sim/main.o$(Q) ld -r $(BUILD_DIR)/sim/main.o -exported_symbol _np_sudoku_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = sudoku+PORT_NAME = Sudoku+PORT_SRC = src/main.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+include ../../platform/port.mkdiff --git a/games/sudoku/src/main.c b/games/sudoku/src/main.cindex a0d3a1c8..383379af 100644--- a/games/sudoku/src/main.c+++ b/games/sudoku/src/main.c@@ -26,9 +26,11 @@#define np_file_read ef_read#define np_file_write ef_write#ifndef HOST /* (a computer build of the tests has no app header) */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Sudoku";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endifvoid np_push(int x, int y, int w, int h, const color_t *px) {eadk_display_push_rect((eadk_rect_t){(uint16_t)x, (uint16_t)y, (uint16_t)w, (uint16_t)h}, px);}diff --git a/games/suika/Makefile b/games/suika/Makefileindex 1d760f92..272e9117 100644--- a/games/suika/Makefile+++ b/games/suika/Makefile@@ -82,3 +82,9 @@ build/play: $(SRC) tests/play.c $(HEADERS)@echo "HOST $@"test: build/playbuild/play test++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = suika+PORT_NAME = Suika Game+PORT_SRC = src/main.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+include ../../platform/port.mkdiff --git a/games/suika/src/main.c b/games/suika/src/main.cindex ac393eb2..bc78d09c 100644--- a/games/suika/src/main.c+++ b/games/suika/src/main.c@@ -25,9 +25,11 @@#define np_file_read ef_read#define np_file_write ef_write#ifndef HOST /* (a computer build of the tests has no app header) */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Suika Game";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endifvoid np_push(int x, int y, int w, int h, const color_t *px) {eadk_display_push_rect((eadk_rect_t){(uint16_t)x, (uint16_t)y, (uint16_t)w, (uint16_t)h}, px);}diff --git a/games/templerun/Makefile b/games/templerun/Makefileindex a4199477..13e61049 100644--- a/games/templerun/Makefile+++ b/games/templerun/Makefile@@ -87,3 +87,10 @@ hud:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = templerun+PORT_NAME = Temple Run+PORT_SRC = src/app.c src/assets.c src/data.c src/draw.c src/floor.c src/game.c src/hud.c src/main.c src/path.c src/plat_eadk.c src/r3d.c src/save.c src/scene.c+PORT_FLAGS = -DEPSILON_XL=1+include ../../platform/port.mkdiff --git a/games/templerun/src/main.c b/games/templerun/src/main.cindex b8953f2c..abca1c4b 100644--- a/games/templerun/src/main.c+++ b/games/templerun/src/main.c@@ -14,8 +14,10 @@#ifdef TR_BENCH#include "../tests/bot.h"#endif+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Temple Run";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifuint32_t perf_frames __attribute__((used)); /* read by tools/emu.py */uint32_t perf_max __attribute__((used));diff --git a/games/tombofthemask/Makefile b/games/tombofthemask/Makefileindex 3f956741..a0b3cf68 100644--- a/games/tombofthemask/Makefile+++ b/games/tombofthemask/Makefile@@ -62,3 +62,10 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = tombofthemask+PORT_NAME = Tomb of the Mask+PORT_SRC = src/main.c src/game.c src/world.c src/player.c src/things.c src/progress.c src/draw.c src/save.c src/data.c src/art.c src/plat_eadk.c+PORT_FLAGS = -DEPSILON_XL=1+include ../../platform/port.mkdiff --git a/games/tombofthemask/src/plat_eadk.c b/games/tombofthemask/src/plat_eadk.cindex 4a364d78..b57586b2 100644--- a/games/tombofthemask/src/plat_eadk.c+++ b/games/tombofthemask/src/plat_eadk.c@@ -4,8 +4,10 @@#include "../../common/epsilon_files.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Tomb of the Mask";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/towerblock/Makefile b/games/towerblock/Makefileindex 150ecc83..7378e64f 100644--- a/games/towerblock/Makefile+++ b/games/towerblock/Makefile@@ -81,3 +81,9 @@ build/play: $(SRC) tests/play.c $(HEADERS)@echo "HOST $@"test: build/playbuild/play test++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = towerblock+PORT_NAME = Tower Blocks+PORT_SRC = src/main.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+include ../../platform/port.mkdiff --git a/games/towerblock/src/main.c b/games/towerblock/src/main.cindex cf5e8a7b..3118d682 100644--- a/games/towerblock/src/main.c+++ b/games/towerblock/src/main.c@@ -23,9 +23,11 @@#define np_file_read ef_read#define np_file_write ef_write#ifndef HOST /* (a computer build of the tests has no app header) */+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Tower Blocks";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;#endif+#endifvoid np_push(int x, int y, int w, int h, const color_t *px) {eadk_display_push_rect((eadk_rect_t){(uint16_t)x, (uint16_t)y, (uint16_t)w, (uint16_t)h}, px);}diff --git a/games/twoplayer/Makefile b/games/twoplayer/Makefileindex c378a398..9b191839 100644--- a/games/twoplayer/Makefile+++ b/games/twoplayer/Makefile@@ -83,3 +83,9 @@ $(BUILD_DIR)/sim-module.o: $(SRC) $(HEADERS) | $(BUILD_DIR)$(Q) cc -std=c11 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) -DNP_MODULE=1 -Dmain=np_twoplayer_main \-c $(SRC) -o $(BUILD_DIR)/sim/main.o$(Q) ld -r $(BUILD_DIR)/sim/main.o -exported_symbol _np_twoplayer_main -o $@++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = twoplayer+PORT_NAME = 2 Players+PORT_SRC = src/main.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+include ../../platform/port.mkdiff --git a/games/twoplayer/src/main.c b/games/twoplayer/src/main.cindex 2a5d5310..04b35320 100644--- a/games/twoplayer/src/main.c+++ b/games/twoplayer/src/main.c@@ -22,8 +22,10 @@#include "../../common/epsilon_files.h"#define np_file_read ef_read#define np_file_write ef_write+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "2 Players";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifvoid np_push(int x, int y, int w, int h, const color_t *px) {eadk_display_push_rect((eadk_rect_t){(uint16_t)x, (uint16_t)y, (uint16_t)w, (uint16_t)h}, px);}diff --git a/games/undertale/Makefile b/games/undertale/Makefileindex a55cda4a..c6bfd95d 100644--- a/games/undertale/Makefile+++ b/games/undertale/Makefile@@ -77,3 +77,11 @@ data:clean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = undertale+PORT_NAME = Undertale+PORT_SRC = src/battle.c src/blk.c src/core.c src/coremon.c src/event.c src/events.c src/flowey.c src/game.c src/ht1.c src/ht2.c src/ht3.c src/htmon.c src/htshows.c src/items.c src/main.c src/menu.c src/monsters.c src/newhome.c src/nhmon.c src/papyrus.c src/res.c src/resort.c src/rooms.c src/ruins1.c src/ruins2.c src/ruins3.c src/save.c src/shoot.c src/shop.c src/snowdin1.c src/snowdin2.c src/snowmon.c src/snowtown.c src/text.c src/toriel.c src/wf1.c src/wf2.c src/wf3.c src/wfmon.c src/world.c src/lzma/LzmaDec.c src/gfx.c src/bullets.c src/plat_eadk.c+PORT_ASM = src/data.S+PORT_FLAGS = -DEPSILON_XL=1 -DDATA_BIN='"src/data.bin"'+include ../../platform/port.mkdiff --git a/games/undertale/src/main.c b/games/undertale/src/main.cindex 05da21a5..9b742940 100644--- a/games/undertale/src/main.c+++ b/games/undertale/src/main.c@@ -11,8 +11,10 @@#include "res.h"#ifndef HOST+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Undertale";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifextern const uint8_t ut_data[];uint32_t perf_frames __attribute__((used)); /* read by tools/emu.py */diff --git a/games/uno/Makefile b/games/uno/Makefileindex 1bb3def9..eb1bce7f 100644--- a/games/uno/Makefile+++ b/games/uno/Makefile@@ -54,3 +54,10 @@ test: build/playclean:$(Q) rm -rf $(BUILD_DIR) build++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = uno+PORT_NAME = UNO+PORT_SRC = src/main.c src/game.c src/bot.c src/draw.c src/save.c src/plat_eadk.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+PORT_FLAGS = -DEPSILON_XL=1 -I../../launcher/src+include ../../platform/port.mkdiff --git a/games/uno/src/plat_eadk.c b/games/uno/src/plat_eadk.cindex 1b66fc31..69839124 100644--- a/games/uno/src/plat_eadk.c+++ b/games/uno/src/plat_eadk.c@@ -4,8 +4,10 @@#include "../../common/epsilon_files.h"#include "plat.h"+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "UNO";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endif#define KEY(k) ((uint64_t)1 << (k))diff --git a/games/uttt/Makefile b/games/uttt/Makefileindex df2e136c..9d381237 100644--- a/games/uttt/Makefile+++ b/games/uttt/Makefile@@ -81,3 +81,9 @@ build/check: tests/check.c src/rules.h@echo "HOST $@"test: build/checkbuild/check++# the other targets (platform/port.mk): make port TARGET=sdl, web, nspire, ti84ce+PORT_ID = uttt+PORT_NAME = Ultimate Tic-Tac-Toe+PORT_SRC = src/main.c ../../launcher/src/gfx.c ../../launcher/src/xfont.c+include ../../platform/port.mkdiff --git a/games/uttt/src/main.c b/games/uttt/src/main.cindex e49b3038..63eb8831 100644--- a/games/uttt/src/main.c+++ b/games/uttt/src/main.c@@ -20,8 +20,10 @@#include "../../common/epsilon_files.h"#define np_file_read ef_read#define np_file_write ef_write+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Ultimate TTT";const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;+#endifvoid np_push(int x, int y, int w, int h, const color_t *px) {eadk_display_push_rect((eadk_rect_t){(uint16_t)x, (uint16_t)y, (uint16_t)w, (uint16_t)h}, px);}diff --git a/platform/common/np_alloc.c b/platform/common/np_alloc.cnew file mode 100644index 00000000..4426ca74--- /dev/null+++ b/platform/common/np_alloc.c@@ -0,0 +1,5 @@+/* The launcher's allocator, for the games that draw with its gfx.c (launcher/src/np.h) */+#include <stdint.h>+#include <stdlib.h>+void *np_alloc(uint32_t size) { return calloc(1, size); }+void np_alloc_reset(void) {}diff --git a/platform/port.mk b/platform/port.mkindex 19f2c053..514b1c88 100644--- a/platform/port.mk+++ b/platform/port.mk@@ -9,7 +9,8 @@ TARGET ?= sdlNP_PLATFORM := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))NP_ROOT := $(NP_PLATFORM)/..PORT_OUT = build/$(TARGET)-PORT_COMMON = $(NP_PLATFORM)/common/eadk_text.c $(NP_ROOT)/launcher/src/font_data.c+PORT_COMMON = $(NP_PLATFORM)/common/eadk_text.c $(NP_ROOT)/launcher/src/font_data.c \+ $(if $(filter %launcher/src/gfx.c,$(PORT_SRC)),$(NP_PLATFORM)/common/np_alloc.c)PORT_CFLAGS = -std=gnu11 -O2 -g -Wall -Wno-unused-parameter -Wno-unused-function -DNP_PORT=1 \-DNP_APP_ID='"$(PORT_ID)"' -DNP_APP_NAME='"$(PORT_NAME)"' -I$(NP_PLATFORM)/include $(PORT_FLAGS)diff --git a/tools/ports.py b/tools/ports.pynew file mode 100644index 00000000..f0b3b2e3--- /dev/null+++ b/tools/ports.py@@ -0,0 +1,161 @@+#!/usr/bin/env python3+"""Every game on NumPlay's other targets (platform/README.md).++ python3 tools/ports.py probe [game...] what each game's calculator build compiles, as PORT_* lines+ python3 tools/ports.py build TARGET [game...] [-j N]+ `make port TARGET=...` in each game's folder, a line each+ python3 tools/ports.py run [game...] the computer build (sdl) run headless for a few seconds, its+ screen saved to build/ports/shots/<game>.png++`probe` reads the calculator build's own commands (make -Bn build), so a game's Makefile stays the one+list of its sources."""+import concurrent.futures as cf+import json+import os+import re+import shlex+import subprocess+import sys++ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))+GAMES = os.path.join(ROOT, "games")+NWLINK = os.environ.get("NWLINK", "npx --yes -- [email protected]")+SKIP = {"common", "numdance", "tetris"} # tetris: Rust, for the calculator's ARM only+++def games(args):+ if args:+ return args+ ids = [g["id"] for g in json.load(open(os.path.join(GAMES, "games.json")))]+ return [g for g in ids if g not in SKIP and os.path.exists(os.path.join(GAMES, g, "Makefile"))]+++def probe(g):+ """The C and assembly files and the -D/-I flags of the game's calculator build."""+ out = os.path.join(ROOT, "build", "data", "games", g)+ r = subprocess.run(["make", "-C", os.path.join(GAMES, g), "-Bn", "build", f"BUILD_DIR={out}", f"OUT={out}",+ f"NWLINK={NWLINK}", "Q="], capture_output=True, text=True)+ src, asm, flags = [], [], []+ for line in r.stdout.splitlines():+ line = line.strip()+ if not re.match(r"(cd \S+ && )?arm-none-eabi-(gcc|g\+\+)\b", line):+ continue+ try:+ words = shlex.split(line)+ except ValueError:+ continue+ for w in words:+ if w.endswith(".c") and "launcher/src/" not in w or w.endswith(("launcher/src/gfx.c", "launcher/src/xfont.c",+ "launcher/src/inflate.c")):+ if w not in src:+ src.append(w)+ elif w.endswith((".S", ".s")) and w not in asm:+ asm.append(w)+ elif (w.startswith("-D") and not w.startswith("-DPLATFORM_DEVICE")) or \+ (w.startswith("-I") and "nwlink" not in w and "eadk" not in w):+ if w not in flags:+ flags.append(w)+ return src, asm, flags+++def port_lines(g):+ src, asm, flags = probe(g)+ return src, asm, flags+++def build(target, g):+ r = subprocess.run(["make", "-C", os.path.join(GAMES, g), "port", f"TARGET={target}", f"NWLINK={NWLINK}"],+ capture_output=True, text=True)+ err = [l for l in (r.stdout + r.stderr).splitlines() if "error" in l.lower()]+ return r.returncode == 0, err[:6]+++def run(g, keys="1500-1600:ok,3500-3600:ok", quit_ms=7000):+ """The computer build, headless: OK twice, the screen at 1.2 s and 6 s, then Home. Its result: how it ended+ (ok: it saved and quit when told), and the screens as PNG in build/ports/shots."""+ import tempfile+ from PIL import Image+ exe = os.path.join(GAMES, g, "build", "sdl", g)+ if not os.path.exists(exe):+ return "not built", []+ shots = os.path.join(ROOT, "build", "ports", "shots")+ os.makedirs(shots, exist_ok=True)+ with tempfile.TemporaryDirectory() as tmp:+ env = dict(os.environ, NP_HEADLESS="1", NP_SAVES=tmp, NP_KEYS=keys, NP_QUIT_MS=str(quit_ms),+ NP_SHOTS=f"1200:{tmp}/a.ppm,{quit_ms - 1000}:{tmp}/b.ppm")+ try:+ r = subprocess.run([exe], cwd=os.path.join(GAMES, g), env=env, capture_output=True, timeout=quit_ms / 1000 + 15)+ how = "ok" if r.returncode == 0 else f"exit {r.returncode}"+ except subprocess.TimeoutExpired:+ how = "didn't quit"+ out = []+ for n in "ab":+ f = os.path.join(tmp, n + ".ppm")+ if os.path.exists(f):+ im = Image.open(f).convert("RGB")+ png = os.path.join(shots, f"{g}_{n}.png")+ im.save(png)+ out.append((png, len(set(im.resize((80, 60)).getdata())) > 1))+ if not out:+ how += ", no screen"+ elif not any(v for _, v in out):+ how += ", blank screen"+ return how, [p for p, _ in out]+++def sheet(results, path):+ """All the games' screens side by side (2 per game), named."""+ from PIL import Image, ImageDraw+ w, h = 160, 120+ cols = 6+ rows = (len(results) + cols - 1) // cols+ im = Image.new("RGB", (cols * (2 * w + 8), rows * (h + 14)), "white")+ d = ImageDraw.Draw(im)+ for i, (g, how, pngs) in enumerate(results):+ x, y = (i % cols) * (2 * w + 8), (i // cols) * (h + 14)+ for k, p in enumerate(pngs[:2]):+ im.paste(Image.open(p).resize((w, h)), (x + k * w, y + 14))+ d.text((x + 2, y + 1), f"{g}: {how}", fill="black" if how == "ok" else "red")+ im.save(path)+++def main():+ a = sys.argv[1:]+ if not a:+ print(__doc__)+ return 1+ cmd = a.pop(0)+ jobs = 6+ if "-j" in a:+ i = a.index("-j")+ jobs = int(a[i + 1])+ del a[i:i + 2]+ if cmd == "probe":+ for g in games(a):+ src, asm, flags = probe(g)+ print(f"{g}\n PORT_SRC = {' '.join(src)}\n PORT_ASM = {' '.join(asm)}\n PORT_FLAGS = {' '.join(flags)}")+ elif cmd == "build":+ target = a.pop(0)+ todo = games(a)+ ok = 0+ with cf.ThreadPoolExecutor(jobs) as ex:+ for g, (good, err) in zip(todo, ex.map(lambda g: build(target, g), todo)):+ ok += good+ print(f"{'ok ' if good else 'FAIL'} {g}" + ("" if good else "\n " + "\n ".join(err)))+ print(f"{ok}/{len(todo)} build for {target}")+ return 0 if ok == len(todo) else 1+ elif cmd == "run":+ todo = games(a)+ with cf.ThreadPoolExecutor(jobs) as ex:+ results = [(g, *r) for g, r in zip(todo, ex.map(run, todo))]+ for g, how, _ in results:+ print(f"{'ok ' if how == 'ok' else 'BAD '} {g}: {how}")+ sheet(results, os.path.join(ROOT, "build", "ports", "shots.png"))+ print(f"{sum(h == 'ok' for _, h, _ in results)}/{len(results)} run; build/ports/shots.png")+ else:+ print(__doc__)+ return 1+++if __name__ == "__main__":+ sys.exit(main())