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
TI-84 CE: a save appvar of its own for each game
Mason363ce8a5a14d328
diff --git a/platform/ti84ce/README.md b/platform/ti84ce/README.mdindex de7aada3..a9e346e1 100644--- a/platform/ti84ce/README.md+++ b/platform/ti84ce/README.md@@ -26,7 +26,7 @@ make port TARGET=ti84ce (in a game's folder): build/ti84ce/<game>/bin/<GA2nd is OK because it sits by the arrows, as OK does on a NumWorks, and enter is EXE at the bottom right. An arrow or del held down repeats in the menus.-Saves: the appvar `NP` + the game's id (6 letters), archived when the game ends.+Saves: the appvar `NP` + the game's id, its first 5 letters and its last when it's longer than 6 (`NPflappd` for Flappy Bird), archived when the game ends.## Roomdiff --git a/platform/ti84ce/np_ce.c b/platform/ti84ce/np_ce.cindex daa2e192..950ee049 100644--- a/platform/ti84ce/np_ce.c+++ b/platform/ti84ce/np_ce.c@@ -5,7 +5,7 @@* A game draws straight into the LCD's memory, a rectangle at a time, as on a NumWorks: nothing is copied but what* it sends. Time is the 32768 Hz clock (timer 1).*- * Build defines: NP_APP_ID (the game's id). The appvar is "NP" and the id's first 6 letters. */+ * Build defines: NP_APP_ID (the game's id). The appvar is "NP" and the id (6 letters at most). */#include <eadk.h>#include <fileioc.h>#include <keypadc.h>@@ -151,16 +151,18 @@ bool eadk_usb_is_plugged(void) { return false; }const char *eadk_external_data = 0;size_t eadk_external_data_size = 0;-/* the files: a 4 KB buffer, the appvar "NP" + the id's first 6 letters */+/* the files: a 4 KB buffer, kept in the appvar */#define STORAGE_SIZE 4096static uint8_t storage[STORAGE_SIZE + 16];static bool loaded;static char var[9];-static const char *var_name(void) {+static const char *var_name(void) { /* NP, then the id: its first 5 letters and its last past 6 (NPflappd, NPflappk) */if (!var[0]) {+ const char *id = NP_APP_ID;+ size_t n = strlen(id);var[0] = 'N', var[1] = 'P';- for (int i = 0; i < 6 && NP_APP_ID[i]; i++) var[2 + i] = NP_APP_ID[i];+ for (size_t i = 0; i < 6 && i < n; i++) var[2 + i] = id[i < 5 || n <= 6 ? i : n - 1];}return var;}