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
NumPlay Studio: big Game Boy games in Retro-Go, with Epsilon 26 or Nwagra
Mason36319547c4453a6
diff --git a/README.md b/README.mdindex f6395b72..e830f9c1 100644--- a/README.md+++ b/README.md@@ -153,7 +153,7 @@ These are too big to fit next to NumPlay, so each one is its own app. Install it</tr></table>-Retro-Go plays the Game Boy, Game Boy Color, NES, Master System and Game Gear games you choose: games you own, or free ones like homebrew games. It isn't in NumPlay.nwa. Drop your games on [NumPlay Studio](https://mason363.github.io/NumPlay/customize/) and you get a NumPlay with Retro-Go and your games inside.+Retro-Go plays the Game Boy, Game Boy Color, NES, Master System and Game Gear games you choose: games you own, or free ones like homebrew games. It isn't in NumPlay.nwa. Drop your games on [NumPlay Studio](https://mason363.github.io/NumPlay/customize/) and you get a NumPlay with Retro-Go and your games inside. Big games, like the 2 MB Game Boy Color ones, need the extra space of Epsilon 26 or Nwagra: pick it in NumPlay Studio.## How to installdiff --git a/customize/app.js b/customize/app.jsindex 18003586..f8e83b95 100644--- a/customize/app.js+++ b/customize/app.js@@ -347,12 +347,24 @@const bytes = new Uint8Array(await f.arrayBuffer());const r = { key: ++romKey, sys, bytes, name: romName(f.name) };const over = total(ordered(), st.roms.concat([r])) - capacity();- if (over > 0) { bump($('#drop'), 'shake'); overflow(over); continue; }+ if (over > 0) { bump($('#drop'), 'shake'); tooBig(r) || overflow(over); continue; }st.roms.push(r);fetchObj(objPath(rg.id)).catch(() => {});}render();}+ // a game too big for this space even with nothing else in NumPlay: the space it needs, plainly+ function tooBig(r) {+ const alone = total([], [r]);+ if (alone <= capacity()) return false;+ const fit = (id) => spaces().some((s) => s.id === id && s.size >= alone);+ const needs = st.cap === 'std' && fit('e26') ? 'Epsilon 26 or Nwagra' : !nwagra() && fit(st.cap === 'e26' ? 'xl26' : 'xl') ? 'Nwagra'+ : st.cap === 'xl' && fit('xl26') ? SPACES.xl26 : '';+ toast(r.name + ' is ' + mb(r.bytes.length) + (needs ? ': a game that big needs ' + needs : ', too big for the calculator'));+ $('#screen').classList.add('over');+ setTimeout(() => render(), 500);+ return true;+ }function romName(file) { // (its name without the extension, at most 40 bytes of UTF-8, no letter cut)const enc = new TextEncoder();let n = '';diff --git a/games/retrogo/README.md b/games/retrogo/README.mdindex 815b75ba..3c49b543 100644--- a/games/retrogo/README.md+++ b/games/retrogo/README.md@@ -7,7 +7,7 @@ Play your own Game Boy, Game Boy Color, NES, Master System and Game Gear games oYou pick the games on NumPlay's customizer website: it puts them inside your NumPlay (or inside Retro-Go on its own), and they stay in the calculator's memory for apps. Only games you own or that are free to share, like the homebrew games in the pictures here.- **Retro-Go's launcher:** a tab for each system with its own colours, the game list, and for each game Resume game, New game, Delete save and Properties.-- **Game Boy and Game Boy Color** with gnuboy, the emulator Retro-Go started from: the cartridges with MBC1, MBC2, MBC3 (with its clock), MBC5, HuC1 and HuC3 bank controllers, up to 32 KB of cartridge RAM.+- **Game Boy and Game Boy Color** with gnuboy, the emulator Retro-Go started from: the cartridges with MBC1, MBC2, MBC3 (with its clock), MBC5, HuC1 and HuC3 bank controllers, up to 32 KB of cartridge RAM. Big games fit too, like the 2 MB Game Boy Color ones, in a NumPlay made for Epsilon 26 or Nwagra (NumPlay Studio says when a game needs it).- **NES** with nofrendo, Retro-Go's NES emulator at its start: 34 mappers, among them NROM, MMC1, UNROM, CNROM, MMC3, MMC5, AxROM, MMC2, Namco 163 and the Konami VRC chips.- **Master System and Game Gear** with a machine written for NumPlay around superzazu's Z80: Sega's, Codemasters' and the Korean mappers, the cartridges' RAM, the 224-line pictures, the European games that need 50 Hz, and the Game Gear games made for the Master System's mode.- **Full speed** on every calculator: as Retro-Go does, a frame is drawn, then at least one is skipped, more when the calculator can't keep up, so the game always runs at its own speed.diff --git a/games/retrogo/tests/test_big.py b/games/retrogo/tests/test_big.pynew file mode 100644index 00000000..cb30cd94--- /dev/null+++ b/games/retrogo/tests/test_big.py@@ -0,0 +1,63 @@+#!/usr/bin/env python3+"""Retro-Go with big Game Boy Color games, in tools/emu.py as with Enlarged Extra Apps (nwagyu's Nwagra): the+cartridges tests/bigrom.py makes, 2 MB with an MBC3 (as Pokemon Gold) and 4 MB with an MBC5, each in a RetroGo.nwa+of its own. Each is started and must show green: every bank read back right through its bank controller, its battery+RAM held, and (the MBC3) its clock running; red or yellow is a bank or the RAM read wrong.++usage: test_big.py (builds output/test/retrogo-big<N>.nwa)"""+import os+import subprocess+import sys+import tempfile++here = os.path.dirname(os.path.abspath(__file__))+game = os.path.dirname(here)+sys.path.insert(0, os.path.join(game, "..", "..", "tools"))+sys.path.insert(0, here)+import bigrom # noqa: E402+import emu # noqa: E402++K = emu.KEYS+++def colours(c):+ """how much of the screen is green, red and yellow (the cartridge's RGB555 colours, as drawn)"""+ n = green = red = yellow = 0+ for i in range(0, len(c.screen), 2):+ px = c.screen[i] | c.screen[i + 1] << 8+ r, g, b = (px >> 11) & 31, (px >> 5) & 63, px & 31+ n += 1+ green += g > 50 and r < 10+ red += r > 25 and g < 20+ yellow += r > 25 and g > 50 and b < 10+ return green / n, red / n, yellow / n+++def main():+ out = os.path.join(game, "output", "test")+ os.makedirs(out, exist_ok=True)+ problems = []+ emu.configure(xl=True)+ for mb in (2, 4):+ rom = os.path.join(out, f"Big{mb}.gbc")+ open(rom, "wb").write(bigrom.rom(mb))+ nwa = os.path.join(out, f"retrogo-big{mb}.nwa")+ subprocess.run(["make", "-C", game, "output/retrogo-full.nwa", "ROMS=" + rom,+ "NWLINK=" + os.environ.get("NWLINK", "nwlink")], check=True, stdout=subprocess.DEVNULL)+ os.replace(os.path.join(game, "output", "retrogo-full.nwa"), nwa)+ with tempfile.TemporaryDirectory() as d:+ c = emu.Calculator(nwa, storage_file=os.path.join(d, "storage.bin"))+ # (the Game Boy Color's tab, its game, a new game, past the controls)+ c.keys = [(300, 400, K["right"]), (900, 1000, K["ok"]), (1500, 1600, K["ok"]), (2100, 2200, K["ok"]),+ (2700, 2800, K["ok"])]+ c.run(7000)+ green, red, yellow = colours(c)+ ok = green > 0.2 and red == 0 and yellow == 0+ print(f"{'ok ' if ok else 'FAIL'} {mb} MB: {green:.0%} green, {red:.1%} red, {yellow:.1%} yellow")+ if not ok:+ problems.append(f"{mb} MB")+ sys.exit(1 if problems else 0)+++if __name__ == "__main__":+ main()