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
i dont know how to name commits..
Lily Pitiot2236b822850f
diff --git a/games/hillclimb/src/data.bin b/games/hillclimb/src/data.binindex 9f525c3c..308c70f9 100644Binary files a/games/hillclimb/src/data.bin and b/games/hillclimb/src/data.bin differdiff --git a/games/hillclimb/src/gfx.c b/games/hillclimb/src/gfx.cindex 79cd9242..a81d4af5 100644--- a/games/hillclimb/src/gfx.c+++ b/games/hillclimb/src/gfx.c@@ -415,6 +415,47 @@ __attribute__((noinline)) static void paint_blit(const Cmd *k, int y0, int y1) {}}+/* HC_FONT_ROW_RLE_V1: decode only a requested glyph row; no frame cache or heap. */+__attribute__((noinline)) static void paint_font_rle_row(const Glyph *g, const uint8_t *bitmap,+ unsigned ry, int gx, uint16_t *p,+ uint16_t oc, uint16_t color) {+ const uint8_t *table = bitmap + g->off;+ unsigned start = (unsigned)table[2 * ry] | (unsigned)table[2 * ry + 1] << 8;+ unsigned stop = (unsigned)table[2 * ry + 2] | (unsigned)table[2 * ry + 3] << 8;+ const uint8_t *q = table + 2 * ((unsigned)g->h + 1) + start;+ const uint8_t *end = table + 2 * ((unsigned)g->h + 1) + stop;+ unsigned x = 0;+ while (q < end && x < g->w) {+ unsigned cmd = *q++;+ unsigned n = (cmd & 127u) + 1u;+ if (x + n > g->w) return; /* unexpected/corrupt glyph */+ if (cmd & 128u) {+ if (q >= end) return;+ uint8_t b = *q++;+ if (b) {+ for (unsigned j = 0; j < n; j++) {+ int sx = gx + (int)x + (int)j;+ if ((unsigned)sx >= SCREEN_W) continue;+ if (b & 15) blend(p + sx, oc, (b & 15) * 17u);+ if (b >> 4) blend(p + sx, color, (b >> 4) * 17u);+ }+ }+ } else {+ if ((unsigned)(end - q) < n) return;+ for (unsigned j = 0; j < n; j++) {+ uint8_t b = q[j];+ if (!b) continue;+ int sx = gx + (int)x + (int)j;+ if ((unsigned)sx >= SCREEN_W) continue;+ if (b & 15) blend(p + sx, oc, (b & 15) * 17u);+ if (b >> 4) blend(p + sx, color, (b >> 4) * 17u);+ }+ q += n;+ }+ x += n;+ }+}+__attribute__((noinline)) static void paint_text(const Cmd *k, int y0, int y1) {const Font *f = font(k->text.font);const Glyph *gl = font_glyphs(f);@@ -428,6 +469,12 @@ __attribute__((noinline)) static void paint_text(const Cmd *k, int y0, int y1) {pen += g->adv;int ya = gy > y0 ? gy : y0, yb = gy + g->h < y1 ? gy + g->h : y1;for (int y = ya; y < yb; y++) {+ /* HC_FONT_ROW_RLE_V1: preserve the original hot path for raw glyphs. */+ if (g->pad[0] == 1) {+ paint_font_rle_row(g, bits, (unsigned)(y - gy), gx,+ band + (y - by0) * SCREEN_W, k->text.oc, k->text.c);+ continue;+ }const uint8_t *row = bits + g->off + (y - gy) * g->w;uint16_t *p = band + (y - by0) * SCREEN_W;for (int i = 0; i < g->w; i++) {diff --git a/games/hillclimb/tools/pack.py b/games/hillclimb/tools/pack.pyindex 9387dd78..ea20b227 100644--- a/games/hillclimb/tools/pack.py+++ b/games/hillclimb/tools/pack.py@@ -480,6 +480,64 @@ def font_data(ttf, cap, weight, outline):out += datawhile len(out) % 4:out.append(0)+ return _hc_pack_font_blob(out)+++# HC_FONT_ROW_RLE_V1: lossless per-glyph row PackBits, direct row offsets.+def _hc_rle_font_row(raw):+ out = bytearray()+ i = 0+ while i < len(raw):+ j = i + 1+ while j < len(raw) and raw[j] == raw[i] and j - i < 128:+ j += 1+ if j - i >= 3:+ out += bytes((0x80 | (j-i-1), raw[i]))+ i = j+ continue+ start = i+ i += j - i+ while i < len(raw) and i - start < 128:+ j = i + 1+ while j < len(raw) and raw[j] == raw[i] and j - i < 128:+ j += 1+ if j - i >= 3:+ break+ i += min(j-i, 128-(i-start))+ out.append(i-start-1)+ out += raw[start:i]+ return bytes(out)+++def _hc_pack_font_blob(blob):+ """Existing font/glyph structs, except pad[0]=1 marks compressed glyphs.++ Each compressed glyph payload starts with h+1 little-endian uint16 row+ offsets, followed by the PackBits streams; other glyphs stay direct.+ """+ first, count, height, ascent = struct.unpack_from('<BBBB', blob)+ base = 4 + 12*count+ out = bytearray(blob[:base])+ for j in range(count):+ p = 4 + 12*j+ w, h = struct.unpack_from('<BB', blob, p)+ oldoff = struct.unpack_from('<I', blob, p+8)[0]+ raw = bytes(blob[base+oldoff:base+oldoff+w*h])+ assert len(raw) == w*h and not any(blob[p+5:p+8])+ struct.pack_into('<I', out, p+8, len(out)-base)+ if w and h:+ rows = [_hc_rle_font_row(raw[y*w:(y+1)*w]) for y in range(h)]+ starts = [0]+ for row in rows:+ starts.append(starts[-1] + len(row))+ if starts[-1] <= 65535:+ candidate = struct.pack('<'+'H'*(h+1), *starts) + b''.join(rows)+ if len(candidate) < len(raw):+ out[p+5] = 1+ out += candidate+ continue+ out += raw+ out += bytes((-len(out)) % 4)return out