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
Merge Retro-Go: Game Boy, NES and Sega games you add in NumPlay Studio
Mason3631bf22b4b07b8
diff --cc Makefileindex 91ae80c1,7b1aa272..86cca9c2--- a/Makefile+++ b/Makefile@@@ -107,24 -108,22 +107,31 @@@ $(foreach g,$(STD_GAMES),$(eval MOD_$(gMODULES = $(foreach g,$(GAMES),$(B)/modules/$(g).o)# ------------------------------------------------------------------ generated glue- $(B)/gen/numplay.ld: games/games.json tools/gen_games.py $(foreach g,$(KIT_ALL),$(B)/modules/$(g).o)-$(B)/gen/gametable.c: games/games.json tools/gen_games.py $(MODULES)++$(B)/gen/numplay.ld: games/games.json tools/gen_games.py $(foreach g,$(GAMES) $(OPTIONAL_GAMES),$(B)/modules/$(g).o)$(PY) tools/gen_games.py games/games.json $(B)/modules $(B)/gen$(B)/gen/shots_%.c: games/games.json tools/shots.py $$(SHOTS_$$*) | $(B)cd games/$* && $(PY) ../../tools/shots.py --id $* --index $(INDEX_$*) $(COLORS_$*) ../../$@ $(SHOTS_REL_$*)+ # Retro-Go's table of games (tools/romtable.py): empty, or ROMS="a.gb b.nes" to try some games+ # in a build of one's own; the customizer website makes its own table. It goes with retrogo's+ # module (numplay.ld puts it in retrogo's block of flash).+ ROMS ?=+ $(B)/arm/roms.o: FORCE | $(B)+ $(PY) tools/romtable.py -o $@ $(ROMS)+-# ------------------------------------------------------------------ NumPlay.nwa-ARM_OBJS = $(patsubst launcher/src/%.c,$(B)/arm/%.o,$(LAUNCHER_SRC)) $(B)/arm/gametable.o $(B)/arm/arena.o \- $(B)/arm/marks.o $(foreach g,$(GAMES),$(B)/arm/shots_$(g).o)+# ------------------------------------------------------------------ the kit+# NumPlay.nwa is linked from a kit, the same pieces the customizer website links in the browser+# for a NumPlay with the games you pick (site/): base.o, the launcher with every library function+# a game calls; arena.o, the RAM the games share; the app's name and icon; and one object per game+# with its module, its entry in the launcher's table, its screenshots and the marks of its block.+# Games marked "default": false in games.json (OPTIONAL_GAMES) are only in the kit.+KIT = $(B)/kit+KIT_ALL = $(GAMES) $(OPTIONAL_GAMES)+LAUNCHER_OBJS = $(patsubst launcher/src/%.c,$(B)/arm/%.o,$(LAUNCHER_SRC))+KIT_GAMES = $(foreach g,$(KIT_ALL),$(KIT)/games/$(g).o)+NP_GAMES = $(foreach g,$(GAMES),$(KIT)/games/$(g).o)+KIT_LINK = -r --gc-sections -z noexecstack -e main -u eadk_app_name -u eadk_app_icon -u eadk_api_level$(B)/arm/%.o: launcher/src/%.c $(LAUNCHER_H) VERSION | $(B)$(ARM_CC) $(ARM_CFLAGS) -flto -c $< -o $@diff --cc README.mdindex b564ee60,313a2416..bbd62bb3--- a/README.md+++ b/README.md@@@ -91,26 -83,20 +91,36 @@@ These are too big to fit next to NumPla<td align="center"><a href="games/undertale/README.md"><img src="docs/media/thumb_undertale.png" width="200" alt="Undertale"><br><b>Undertale</b></a><br><sub>The whole Underground, from the golden flowers to the barrier and the neutral ending</sub><br><a href="https://github.com/Mason363/NumPlay/releases/latest/download/Undertale.nwa">Download</a></td></tr><tr>- <td align="center"><a href="#roadmap"><b>More on the way</b></a><br><sub>The Binding of Isaac, Plants vs. Zombies, Doom and more: see the roadmap</sub></td>+ <td align="center"><a href="games/doom/README.md"><img src="docs/media/thumb_doom.png" width="200" alt="Doom"><br><b>Doom</b></a><br><sub>Knee-Deep in the Dead: all nine levels of the shareware episode</sub><br><a href="https://github.com/Mason363/NumPlay/releases/latest/download/Doom.nwa">Download</a></td>+ <td align="center"><a href="games/isaac/README.md"><img src="docs/media/thumb_isaac.png" width="200" alt="The Binding of Isaac"><br><b>The Binding of Isaac</b></a><br><sub>A whole run: the Basement to Mom, her heart, Sheol and the Cathedral</sub><br><a href="https://github.com/Mason363/NumPlay/releases/latest/download/BindingOfIsaac.nwa">Download</a></td>+ <td align="center"><a href="games/pvz/README.md"><img src="docs/media/thumb_pvz.png" width="200" alt="Plants vs. Zombies"><br><b>Plants vs. Zombies</b></a><br><sub>The whole Adventure, from the front lawn to the roof and Dr. Zomboss</sub><br><a href="https://github.com/Mason363/NumPlay/releases/latest/download/PlantsVsZombies.nwa">Download</a></td>+ </tr>+ <tr>+ <td align="center"><a href="games/fnaf/README.md"><img src="docs/media/thumb_fnaf.png" width="200" alt="Five Nights at Freddy's"><br><b>Five Nights at Freddy's</b></a><br><sub>All five nights, the 6th and the Custom Night</sub><br><a href="https://github.com/Mason363/NumPlay/releases/latest/download/FiveNightsAtFreddys.nwa">Download</a></td>+ <td align="center"><a href="games/sonic/README.md"><img src="docs/media/thumb_sonic.png" width="200" alt="Sonic the Hedgehog"><br><b>Sonic the Hedgehog</b></a><br><sub>The whole 1991 game: six zones, the Final Zone, the Special Stages and the ending</sub><br><a href="https://github.com/Mason363/NumPlay/releases/latest/download/SonicTheHedgehog.nwa">Download</a></td>+ <td align="center"><a href="games/subway/README.md"><img src="docs/media/thumb_subway.png" width="200" alt="Subway Surfers"><br><b>Subway Surfers</b></a><br><sub>The endless run down the tracks, in 3D</sub><br><a href="https://github.com/Mason363/NumPlay/releases/latest/download/SubwaySurfers.nwa">Download</a></td>+ </tr>+ <tr>+ <td align="center"><a href="games/hillclimb/README.md"><img src="docs/media/thumb_hillclimb.png" width="200" alt="Hill Climb Racing"><br><b>Hill Climb Racing</b></a><br><sub>Ten stages, eight vehicles and all their upgrades</sub><br><a href="https://github.com/Mason363/NumPlay/releases/latest/download/HillClimbRacing.nwa">Download</a></td>+ <td align="center"><a href="games/cookieclicker/README.md"><img src="docs/media/thumb_cookieclicker.png" width="200" alt="Cookie Clicker"><br><b>Cookie Clicker</b></a><br><sub>The whole game with its own pictures: ascension, the dragon, the Grimoire and the Pantheon</sub><br><a href="https://github.com/Mason363/NumPlay/releases/latest/download/CookieClicker.nwa">Download</a></td>+ <td align="center"><a href="games/leveldevil/README.md"><img src="docs/media/thumb_leveldevil.png" width="200" alt="Level Devil"><br><b>Level Devil</b></a><br><sub>Unept's troll platformer: the game's 80 rooms, with their own traps</sub><br><a href="https://github.com/Mason363/NumPlay/releases/latest/download/LevelDevil.nwa">Download</a></td>+ </tr>+ <tr>+ <td align="center"><a href="https://github.com/Mason363/NumWorks-Super-Mario-64"><b>Super Mario 64</b></a><br><sub>In a repository of its own: NumWorks-Super-Mario-64</sub></td>- <td align="center"><a href="#roadmap"><b>More on the way</b></a><br><sub>Minecraft 1.18.2, Retro-Go and more: see the roadmap</sub></td>++ <td align="center"><a href="#roadmap"><b>More on the way</b></a><br><sub>Minecraft 1.18.2 and more: see the roadmap</sub></td></tr></table>+ ## Your own Game Boy, NES and Sega games++ <table>+ <tr>+ <td align="center" width="33%"><a href="games/retrogo/README.md"><img src="docs/media/thumb_retrogo.png" width="200" alt="Retro-Go"><br><b>Retro-Go</b></a><br><sub>Game Boy, Game Boy Color, NES, Master System and Game Gear games, with Retro-Go's menus and save slots</sub></td>+ </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: you get it, with your games inside, from NumPlay's customizer website.++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.+## How to installYou need your calculator, its USB cable, and a computer with **Google Chrome** or **Microsoft Edge**. It takes about 2 minutes.@@@ -214,25 -186,21 +224,25 @@@ Read **[Make your own NumWorks game](do- [x] The Powder Toy (NumPowder)- [x] Block Blast- [x] Undertale: the whole Underground, from the Ruins to New Home and the neutral ending+- [x] The Binding of Isaac: a whole run, from the Basement to the Cathedral+- [x] Plants vs. Zombies: the whole Adventure, from the front lawn to the roof and Dr. Zomboss+- [x] Doom: Knee-Deep in the Dead, the shareware episode+- [x] Five Nights at Freddy's: all five nights, the 6th and the Custom Night+- [x] Pong and more two-player games: 2 Players, with Pong, Air Hockey, Tanks and Light Cycles+- [x] Cookie Clicker+- [x] Level Devil+- [x] Sonic the Hedgehog: the whole 1991 game, Green Hill to the Final Zone, with the Special Stages+- [x] Subway Surfers+- [x] Hill Climb Racing+- [x] Space Invaders+- [x] Sokoban+- [x] Sudoku+- [x] Ultimate Tic-Tac-Toe+- [x] Super Mario 64, in a repository of its own: [NumWorks-Super-Mario-64](https://github.com/Mason363/NumWorks-Super-Mario-64)+- [x] The Nether and the End in NumBlocks: portals, fortresses, strongholds and the Ender Dragon, in NumBlocks.nwa+ - [x] [Retro-Go](https://github.com/ducalex/retro-go) for Game Boy, Game Boy Color, NES, Master System and Game Gear: upload your own ROMs on the website and get a .nwa app that plays them-- [ ] The Binding of Isaac-- [ ] Plants vs. Zombies-- [ ] Doom-- [ ] Five Nights at Freddy's-- [ ] Pong and more two-player games-- [ ] Cookie Clicker-- [ ] Level Devil-- [ ] Sonic the Hedgehog-- [ ] Subway Surfers-- [ ] Hill Climb Racing-- [ ] Super Mario 64-- [ ] The Nether and the End in NumBlocks- [ ] Full Minecraft 1.18.2 as a standalone app- [ ] A customizer website: pick the games you want in your launcher, with Enlarged Extra Apps support to fit several big games, or big and small ones together- - [ ] [Retro-Go](https://github.com/ducalex/retro-go) for Game Boy, NES and more: upload your own ROMs on the website and get a .nwa app that plays them## Credits@@@ -276,13 -229,13 +286,14 @@@ NumPlay is a fan project, made out of l- **reversal_lava63**, a beta tester who plays NumPlay's apps on a real calculator and reports what's wrong.- **[Gabriel](https://github.com/tomcalif9-stack)**, who made the home screen's moving backgrounds, translated NumPlay into French first, and tests it on Upsilon and an N0115.- **[LanoCodes17](https://github.com/LanoCodes17)**, whose idea the Konami code is: one of the secret ways into NumPlay from Matrices.++- **[Retro-Go](https://github.com/ducalex/retro-go)** by ducalex inspired NumPlay's Retro-Go, whose launcher, menus and frame skipping are written again for NumPlay with no code copied from it. Its emulators are **[gnuboy](https://github.com/rofl0r/gnuboy)** by Laguna and Gilgamesh (GNU GPL v2 or later) for the Game Boy and **nofrendo** by Matthew Conte (GNU LGPL v2, used under the GPL) for the NES; the Master System and Game Gear are NumPlay's own, around **[superzazu's z80](https://github.com/superzazu/z80)** by Nicolas Allemand (MIT License). Its tests use Blargg's test ROMs, Matt Currie's dmg-acid2 and cgb-acid2, kevtris's nestest and Frank Cringle's zexdoc and zexall. Not affiliated with them.- Everyone who reported a bug: **NEE** ([reversallava63](https://github.com/reversallava63)), **Gabriel**, **[briac134](https://github.com/briac134)**, **[Raphanobie](https://github.com/Raphanobie)**, **[zbigzo](https://github.com/zbigzo)**, **Yacine**, **PelicanMan75**, **[Spykube](https://github.com/Spykube)** and **[axio-m](https://github.com/axio-m)**. Thank you!## LicenseNumPlay is licensed under the [GNU General Public License v3.0](LICENSE). Copyright (c) 2026 Mason Chen. Code and fonts from others keep their own licenses: the `UNLICENSE` files in the games' folders and the [LICENSES](LICENSES) folder. The names, artwork and music of the games NumPlay is inspired by belong to their makers and are not covered by it.- <sub>Unofficial fan games, not affiliated with NumWorks, RobTop Games (Geometry Dash), Hipster Whale (Crossy Road), the makers of Drive Mad, LocalThunk or Playstack (Balatro), Mike Klubnika or Critical Reflex (Buckshot Roulette), Hungry Studio (Block Blast!), Mojang or Microsoft (Minecraft), Maddy Makes Games (Celeste), Team Cherry (Hollow Knight), Toby Fox (Undertale), id Software (Doom), Edmund McMillen, Florian Himsl or Nicalis (The Binding of Isaac), PopCap Games or Electronic Arts (Plants vs. Zombies), Scott Cawthon (Five Nights at Freddy's), SEGA (Sonic the Hedgehog), SYBO or Kiloo (Subway Surfers), Fingersoft (Hill Climb Racing), Unept (Level Devil), Atari (Pong), Disney (Tron), Orteil or DashNet (Cookie Clicker), Taito or Midway (Space Invaders), Thinking Rabbit or Falcon (Sokoban), Florian van Strien (The Final Earth 2), The Powder Toy's developers (The Powder Toy), MateoConLechuga (Portal Returns), Valve (Portal), .GEARS (Flappy Bird), Bandai Namco (Pac-Man), Hasbro (Connect Four), Google (Snake, Solitaire, Block Breaker, Chrome Dino, Doodle Champion Island Games), STUDIO4°C or Microsoft (Minesweeper). Tetris is a trademark of The Tetris Company, Chrome of Google LLC, Minecraft of Mojang Synergies AB, Pac-Man of Bandai Namco, Connect Four of Hasbro, DOOM of ZeniMax Media, Sonic the Hedgehog of SEGA and Space Invaders of Taito.</sub>-<sub>Unofficial fan games, not affiliated with NumWorks, RobTop Games (Geometry Dash), Hipster Whale (Crossy Road), the makers of Drive Mad, LocalThunk or Playstack (Balatro), Mike Klubnika or Critical Reflex (Buckshot Roulette), Hungry Studio (Block Blast!), Mojang or Microsoft (Minecraft), Maddy Makes Games (Celeste), Team Cherry (Hollow Knight), Toby Fox (Undertale), Florian van Strien (The Final Earth 2), The Powder Toy's developers (The Powder Toy), MateoConLechuga (Portal Returns), Valve (Portal), .GEARS (Flappy Bird), Bandai Namco (Pac-Man), Hasbro (Connect Four), Google (Snake, Solitaire, Block Breaker, Chrome Dino, Doodle Champion Island Games), STUDIO4°C or Microsoft (Minesweeper), ducalex (Retro-Go), Nintendo (Game Boy, NES), Sega (Master System, Game Gear). Tetris is a trademark of The Tetris Company, Chrome of Google LLC, Minecraft of Mojang Synergies AB, Pac-Man of Bandai Namco, Connect Four of Hasbro, Game Boy, Game Boy Color and NES of Nintendo, and Master System and Game Gear of Sega.</sub>++<sub>Unofficial fan games, not affiliated with NumWorks, RobTop Games (Geometry Dash), Hipster Whale (Crossy Road), the makers of Drive Mad, LocalThunk or Playstack (Balatro), Mike Klubnika or Critical Reflex (Buckshot Roulette), Hungry Studio (Block Blast!), Mojang or Microsoft (Minecraft), Maddy Makes Games (Celeste), Team Cherry (Hollow Knight), Toby Fox (Undertale), id Software (Doom), Edmund McMillen, Florian Himsl or Nicalis (The Binding of Isaac), PopCap Games or Electronic Arts (Plants vs. Zombies), Scott Cawthon (Five Nights at Freddy's), SEGA (Sonic the Hedgehog, Master System, Game Gear), SYBO or Kiloo (Subway Surfers), Fingersoft (Hill Climb Racing), Unept (Level Devil), Atari (Pong), Disney (Tron), Orteil or DashNet (Cookie Clicker), Taito or Midway (Space Invaders), Thinking Rabbit or Falcon (Sokoban), Florian van Strien (The Final Earth 2), The Powder Toy's developers (The Powder Toy), MateoConLechuga (Portal Returns), Valve (Portal), .GEARS (Flappy Bird), Bandai Namco (Pac-Man), Hasbro (Connect Four), Google (Snake, Solitaire, Block Breaker, Chrome Dino, Doodle Champion Island Games), STUDIO4°C or Microsoft (Minesweeper), ducalex (Retro-Go), Nintendo (Game Boy, NES). Tetris is a trademark of The Tetris Company, Chrome of Google LLC, Minecraft of Mojang Synergies AB, Pac-Man of Bandai Namco, Connect Four of Hasbro, DOOM of ZeniMax Media, Sonic the Hedgehog, Master System and Game Gear of SEGA, Space Invaders of Taito, and Game Boy, Game Boy Color and NES of Nintendo.</sub>## Gallery@@@ -293,67 -246,46 +304,68 @@@<td align="center" width="33%"><img src="docs/media/gallery/numblocks.gif" width="100%" alt="NumBlocks: lighting TNT and blowing a crater in the ground"><br><a href="games/numblocks/README.md"><b>NumBlocks</b></a></td></tr><tr>- <td align="center"><img src="docs/media/gallery/numblocks_real.gif" width="100%" alt="NumBlocks on a real NumWorks calculator, walking past trees and a sheep"><br><a href="games/numblocks/README.md"><b>NumBlocks</b></a></td>- <td align="center"><img src="docs/media/gallery/numdrive.gif" width="100%" alt="NumDrive on a real NumWorks calculator: a monster truck jumps off a ramp"><br><a href="games/numdrive/README.md"><b>NumDrive</b></a></td>- <td align="center"><img src="docs/media/gallery/balatro.gif" width="100%" alt="Balatro on a real NumWorks calculator: a hand of cards is scored"><br><a href="games/balatro/README.md"><b>Balatro</b></a></td>+ <td align="center"><img src="docs/media/gallery/numblocks_real.gif" alt="NumBlocks on a real NumWorks calculator, walking past trees and a sheep"><br><a href="games/numblocks/README.md"><b>NumBlocks</b></a></td>+ <td align="center"><img src="docs/media/gallery/numdrive.gif" alt="NumDrive on a real NumWorks calculator: a monster truck jumps off a ramp"><br><a href="games/numdrive/README.md"><b>NumDrive</b></a></td>+ <td align="center"><img src="docs/media/gallery/balatro.gif" alt="Balatro on a real NumWorks calculator: a hand of cards is scored"><br><a href="games/balatro/README.md"><b>Balatro</b></a></td>+ </tr>+ <tr>+ <td align="center"><img src="docs/media/gallery/buckshot.gif" alt="Buckshot Roulette on a real NumWorks calculator: picking up the shotgun"><br><a href="games/buckshot/README.md"><b>Buckshot Roulette</b></a></td>+ <td align="center"><img src="docs/media/gallery/blockblast.gif" alt="Block Blast: two rows clear for Good!, then a combo of 3"><br><a href="games/blockblast/README.md"><b>Block Blast</b></a></td>+ <td align="center"><img src="docs/media/gallery/portal.gif" alt="Portal Returns: jumping through portals in a test chamber"><br><a href="games/portal/README.md"><b>Portal Returns</b></a></td>+ </tr>+ <tr>+ <td align="center"><img src="docs/media/gallery/tetris.gif" alt="Tetris on a real NumWorks calculator: pieces drop and a line clears"><br><a href="games/tetris/README.md"><b>Tetris</b></a></td>+ <td align="center"><img src="docs/media/gallery/dinorun.gif" alt="Chrome Dino: jumping over cacti, then night falls and a pterodactyl flies by"><br><a href="games/dinorun/README.md"><b>Chrome Dino</b></a></td>+ <td align="center"><img src="docs/media/gallery/chess.gif" alt="Chess: the opening moves of a game against a bot"><br><a href="games/chess/README.md"><b>Chess</b></a></td>+ </tr>+ <tr>+ <td align="center"><img src="docs/media/gallery/flappybird.gif" alt="Flappy Bird: flapping through the pipes"><br><a href="games/flappybird/README.md"><b>Flappy Bird</b></a></td>+ <td align="center"><img src="docs/media/gallery/pacman.gif" alt="Pac-Man: eating dots in the maze"><br><a href="games/pacman/README.md"><b>Pac-Man</b></a></td>+ <td align="center"><img src="docs/media/gallery/snake.gif" alt="Snake: the snake eats apples and grows"><br><a href="games/snake/README.md"><b>Snake</b></a></td>+ </tr>+ <tr>+ <td align="center"><img src="docs/media/gallery/connectfour.gif" alt="Connect Four: winning a round against the computer"><br><a href="games/connectfour/README.md"><b>Connect Four</b></a></td>+ <td align="center"><img src="docs/media/gallery/solitaire.gif" alt="Solitaire: moving cards between the columns"><br><a href="games/solitaire/README.md"><b>Solitaire</b></a></td>+ <td align="center"><img src="docs/media/gallery/g2048.gif" alt="2048: sliding and merging tiles up to 128"><br><a href="games/g2048/README.md"><b>2048</b></a></td></tr><tr>- <td align="center"><img src="docs/media/gallery/buckshot.gif" width="100%" alt="Buckshot Roulette on a real NumWorks calculator: picking up the shotgun"><br><a href="games/buckshot/README.md"><b>Buckshot Roulette</b></a></td>- <td align="center"><img src="docs/media/gallery/blockblast.gif" width="100%" alt="Block Blast: two rows clear for Good!, then a combo of 3"><br><a href="games/blockblast/README.md"><b>Block Blast</b></a></td>- <td align="center"><img src="docs/media/gallery/portal.gif" width="100%" alt="Portal Returns: jumping through portals in a test chamber"><br><a href="games/portal/README.md"><b>Portal Returns</b></a></td>+ <td align="center"><img src="docs/media/gallery/minesweeper.gif" alt="Minesweeper: opening the field, flagging the mines and winning"><br><a href="games/minesweeper/README.md"><b>Minesweeper</b></a></td>+ <td align="center"><img src="docs/media/gallery/breakout.gif" alt="Block Breaker: the ball breaks bricks"><br><a href="games/breakout/README.md"><b>Block Breaker</b></a></td>+ <td align="center"><img src="docs/media/gallery/numvisuals.gif" alt="NumVisuals: moving backgrounds, from northern lights to a lava lamp"><br><a href="games/numvisuals/README.md"><b>NumVisuals</b></a></td></tr><tr>- <td align="center"><img src="docs/media/gallery/tetris.gif" width="100%" alt="Tetris on a real NumWorks calculator: pieces drop and a line clears"><br><a href="games/tetris/README.md"><b>Tetris</b></a></td>- <td align="center"><img src="docs/media/gallery/dinorun.gif" width="100%" alt="Chrome Dino: jumping over cacti, then night falls and a pterodactyl flies by"><br><a href="games/dinorun/README.md"><b>Chrome Dino</b></a></td>- <td align="center"><img src="docs/media/gallery/chess.gif" width="100%" alt="Chess: the opening moves of a game against a bot"><br><a href="games/chess/README.md"><b>Chess</b></a></td>+ <td align="center"><img src="docs/media/gallery/numpowder.gif" alt="NumPowder: water floods the sand, then lava pours in and boils it"><br><a href="games/numpowder/README.md"><b>NumPowder</b></a></td>+ <td align="center"><img src="docs/media/gallery/finalearth2.gif" alt="The Final Earth 2: building a house in a city on a floating island"><br><a href="games/finalearth2/README.md"><b>The Final Earth 2</b></a></td>+ <td align="center"><img src="docs/media/gallery/hollowknight.gif" alt="Hollow Knight: fighting the False Knight and Hornet"><br><a href="games/hollowknight/README.md"><b>Hollow Knight</b></a></td></tr><tr>- <td align="center"><img src="docs/media/gallery/flappybird.gif" width="100%" alt="Flappy Bird: flapping through the pipes"><br><a href="games/flappybird/README.md"><b>Flappy Bird</b></a></td>- <td align="center"><img src="docs/media/gallery/pacman.gif" width="100%" alt="Pac-Man: eating dots in the maze"><br><a href="games/pacman/README.md"><b>Pac-Man</b></a></td>- <td align="center"><img src="docs/media/gallery/snake.gif" width="100%" alt="Snake: the snake eats apples and grows"><br><a href="games/snake/README.md"><b>Snake</b></a></td>+ <td align="center"><img src="docs/media/gallery/celeste.gif" alt="Celeste on a real NumWorks calculator: Madeline climbs the first level"><br><a href="games/celeste/README.md"><b>Celeste</b></a></td>+ <td align="center"><img src="docs/media/gallery/championisland.gif" alt="Champion Island: climbing, artistic swimming and the marathon"><br><a href="games/championisland/README.md"><b>Champion Island</b></a></td>+ <td align="center"><img src="docs/media/gallery/undertale.gif" alt="Undertale: Flowey's friendliness pellets, Toriel's tile puzzle and her fire"><br><a href="games/undertale/README.md"><b>Undertale</b></a></td></tr><tr>- <td align="center"><img src="docs/media/gallery/connectfour.gif" width="100%" alt="Connect Four: winning a round against the computer"><br><a href="games/connectfour/README.md"><b>Connect Four</b></a></td>- <td align="center"><img src="docs/media/gallery/solitaire.gif" width="100%" alt="Solitaire: moving cards between the columns"><br><a href="games/solitaire/README.md"><b>Solitaire</b></a></td>- <td align="center"><img src="docs/media/gallery/g2048.gif" width="100%" alt="2048: sliding and merging tiles up to 128"><br><a href="games/g2048/README.md"><b>2048</b></a></td>+ <td align="center"><img src="docs/media/gallery/doom.gif" alt="Doom: imps down a corridor of Phobos Lab, then zombiemen around the yellow key"><br><a href="games/doom/README.md"><b>Doom</b></a></td>+ <td align="center"><img src="docs/media/gallery/isaac.gif" alt="The Binding of Isaac: a room of the Basement, then Monstro"><br><a href="games/isaac/README.md"><b>The Binding of Isaac</b></a></td>+ <td align="center"><img src="docs/media/gallery/pvz.gif" alt="Plants vs. Zombies: the front lawn, the pool and Dr. Zomboss"><br><a href="games/pvz/README.md"><b>Plants vs. Zombies</b></a></td></tr><tr>- <td align="center"><img src="docs/media/gallery/minesweeper.gif" width="100%" alt="Minesweeper: opening the field, flagging the mines and winning"><br><a href="games/minesweeper/README.md"><b>Minesweeper</b></a></td>- <td align="center"><img src="docs/media/gallery/breakout.gif" width="100%" alt="Block Breaker: the ball breaks bricks"><br><a href="games/breakout/README.md"><b>Block Breaker</b></a></td>- <td align="center"><img src="docs/media/gallery/numvisuals.gif" width="100%" alt="NumVisuals: moving backgrounds, from northern lights to a lava lamp"><br><a href="games/numvisuals/README.md"><b>NumVisuals</b></a></td>+ <td align="center"><img src="docs/media/gallery/fnaf.gif" alt="Five Nights at Freddy's: the office, Bonnie at the left door, the door comes down"><br><a href="games/fnaf/README.md"><b>Five Nights at Freddy's</b></a></td>+ <td align="center"><img src="docs/media/gallery/sonic.gif" alt="Sonic the Hedgehog: the title, Green Hill, Marble, Spring Yard and a Special Stage"><br><a href="games/sonic/README.md"><b>Sonic the Hedgehog</b></a></td>+ <td align="center"><img src="docs/media/gallery/subway.gif" alt="Subway Surfers: the title, running between trains, then the jetpack"><br><a href="games/subway/README.md"><b>Subway Surfers</b></a></td></tr><tr>- <td align="center"><img src="docs/media/gallery/numpowder.gif" width="100%" alt="NumPowder: water floods the sand, then lava pours in and boils it"><br><a href="games/numpowder/README.md"><b>NumPowder</b></a></td>- <td align="center"><img src="docs/media/gallery/finalearth2.gif" width="100%" alt="The Final Earth 2: building a house in a city on a floating island"><br><a href="games/finalearth2/README.md"><b>The Final Earth 2</b></a></td>- <td align="center"><img src="docs/media/gallery/hollowknight.gif" width="100%" alt="Hollow Knight: fighting the False Knight and Hornet"><br><a href="games/hollowknight/README.md"><b>Hollow Knight</b></a></td>+ <td align="center"><img src="docs/media/gallery/hillclimb.gif" alt="Hill Climb Racing: a rope bridge on the Countryside, then the Forest's pine trees"><br><a href="games/hillclimb/README.md"><b>Hill Climb Racing</b></a></td>+ <td align="center"><img src="docs/media/gallery/leveldevil.gif" alt="Level Devil: platforms give way, a saw comes out of the floor, the ice slides the runner onto a spring, gravity flips past the saws"><br><a href="games/leveldevil/README.md"><b>Level Devil</b></a></td>+ <td align="center"><img src="docs/media/gallery/twoplayer.gif" alt="2 Players: Pong, Air Hockey, Tanks and Light Cycles against the computer"><br><a href="games/twoplayer/README.md"><b>2 Players</b></a></td></tr><tr>- <td align="center"><img src="docs/media/gallery/celeste.gif" width="100%" alt="Celeste on a real NumWorks calculator: Madeline climbs the first level"><br><a href="games/celeste/README.md"><b>Celeste</b></a></td>- <td align="center"><img src="docs/media/gallery/championisland.gif" width="100%" alt="Champion Island: climbing, artistic swimming and the marathon"><br><a href="games/championisland/README.md"><b>Champion Island</b></a></td>- <td align="center"><img src="docs/media/gallery/undertale.gif" width="100%" alt="Undertale: Flowey's friendliness pellets, Toriel's tile puzzle and her fire"><br><a href="games/undertale/README.md"><b>Undertale</b></a></td>+ <td align="center"><img src="docs/media/gallery/cookieclicker.gif" alt="Cookie Clicker: a golden cookie caught for a Frenzy, the store's upgrades, then an ascension: the cookie bursts and the heavens open"><br><a href="games/cookieclicker/README.md"><b>Cookie Clicker</b></a></td>+ <td align="center"><img src="docs/media/gallery/invaders.gif" alt="Space Invaders: the rack marches down, the saucer is hit for 100"><br><a href="games/invaders/README.md"><b>Space Invaders</b></a></td>+ <td align="center"><img src="docs/media/gallery/sudoku.gif" alt="Sudoku: notes in two cells, a mistake undone, then hints"><br><a href="games/sudoku/README.md"><b>Sudoku</b></a></td></tr><tr>- <td align="center"><img src="docs/media/gallery/retrogo.gif" width="100%" alt="Retro-Go: from the Game Boy tab to the NES list, then Thwaite, a homebrew game, starts and fireworks stop the missiles"><br><a href="games/retrogo/README.md"><b>Retro-Go</b></a></td>+ <td align="center"><img src="docs/media/gallery/uttt.gif" alt="Ultimate Tic-Tac-Toe: a game against the computer, which wins the middle board"><br><a href="games/uttt/README.md"><b>Ultimate Tic-Tac-Toe</b></a></td>+ <td align="center"><img src="docs/media/gallery/sokoban.gif" alt="Sokoban: Microban's ninth level, pushed through to its goals"><br><a href="games/sokoban/README.md"><b>Sokoban</b></a></td>++ <td align="center"><img src="docs/media/gallery/retrogo.gif" alt="Retro-Go: from the Game Boy tab to the NES list, then Thwaite, a homebrew game, starts and fireworks stop the missiles"><br><a href="games/retrogo/README.md"><b>Retro-Go</b></a></td></tr></table>diff --cc customize/app.jsindex 28af067b,00000000..79c8f4c8mode 100644,000000..100644--- a/customize/app.js+++ b/customize/app.js@@@ -1,562 -1,0 +1,563 @@@+/* NumPlay Studio: pick games, add Retro-Go games, and link a NumPlay.nwa of your own in the+ * browser. The kit (kit/, made by `make kit`, tools/kit.py) holds the objects the Makefile links+ * NumPlay.nwa from; GNU ld and objcopy, built as WebAssembly (ld/), link them here the same way. */+'use strict';+(() => {+ const KIT = 'kit/';+ const MiB = 1048576;+ // Enlarged Extra Apps (nwagyu's Nwagra): it moves the end of the app area from the end of+ // Epsilon's slot to the end of the 8 MB flash, so apps go from 0x90200000 to 0x90800000+ const XL_SPACE = 6 * MiB;+ const SYS = {+ 1: { tag: 'GB', name: 'Game Boy', color: '#6d8a0c', shell: '#c9c9cf' },+ 2: { tag: 'GBC', name: 'Game Boy Color', color: '#6a3fb5', shell: '#b9a6d8' },+ 3: { tag: 'NES', name: 'NES', color: '#c43a2f', shell: '#d9d9de' },+ 4: { tag: 'SMS', name: 'Master System', color: '#2f62c4', shell: '#cfd6e4' },+ 5: { tag: 'GG', name: 'Game Gear', color: '#3b3b3b', shell: '#c8c8cc' },+ };+ const EXT = { gb: 1, gbc: 2, nes: 3, sms: 4, gg: 5 };+ const ROM_ENTRY = 52, ROM_HEAD = 12;+ const VARIANT_NAMES = { 'NumPlay': 'NumPlay', 'NumPlay-Invisible': 'Invisible', 'NumPlay-Matrices': 'Matrices' };+ const W = 320, H = 222; // the screen below its status bar, in the calculator's pixels++ const $ = (s) => document.querySelector(s);+ const el = (tag, cls, attrs) => {+ const e = document.createElement(tag);+ if (cls) e.className = cls;+ if (attrs) for (const [k, v] of Object.entries(attrs)) e.setAttribute(k, v);+ return e;+ };+ const align4 = (n) => (n + 3) & ~3;+ const hex = (s) => '#' + String(s).replace(/^0x/i, '').padStart(6, '0');+ const mix = (h, t) => {+ const n = parseInt(h.slice(1), 16), c = [n >> 16, (n >> 8) & 255, n & 255];+ return 'rgb(' + c.map((v) => Math.round(t > 0 ? v + (255 - v) * t : v * (1 + t))).join(',') + ')';+ };+ const size = (b) => b >= MiB ? (b / MiB).toFixed(2) + ' MB' : Math.max(1, Math.round(b / 1024)) + ' KB';++ let kit = null, rg = null;+ const st = { picked: new Set(), roms: [], cap: 'std', variant: 'NumPlay' };+ let romKey = 0;++ // ------------------------------------------------------------------ sizes+ const capacity = () => st.cap === 'xl' ? XL_SPACE : kit.appSpace;+ const romBytes = (r) => ROM_ENTRY + align4(r.bytes.length);+ function items() {+ const out = [{ key: '_core', name: 'NumPlay', bytes: kit.base, color: '#3a3a3c', icon: KIT + 'variants/' + st.variant + '.png' }];+ for (const g of kit.games)+ if (st.picked.has(g.id) && g !== rg)+ out.push({ key: g.id, id: g.id, name: g.title, bytes: g.flash, color: hex(g.top), icon: g.icon ? KIT + 'icons/' + g.id + '.png' : null });+ if (rg && st.roms.length) {+ out.push({ key: rg.id, id: rg.id, name: rg.title, bytes: rg.flash + ROM_HEAD, color: hex(rg.top), icon: rg.icon ? KIT + 'icons/' + rg.id + '.png' : null });+ for (const r of st.roms)+ out.push({ key: 'rom' + r.key, rom: r, name: r.name, bytes: romBytes(r), color: SYS[r.sys].color, tag: SYS[r.sys].tag });+ }+ return out;+ }+ const usedBytes = () => items().reduce((s, it) => s + it.bytes, 0);++ // ------------------------------------------------------------------ the squarified treemap+ function treemap(list, total) {+ const scale = W * H / total;+ let rest = list.slice().sort((a, b) => b.bytes - a.bytes).map((it) => ({ ...it, a: it.bytes * scale }));+ const worst = (row, side) => {+ const s = row.reduce((a, r) => a + r.a, 0), mx = Math.max(...row.map((r) => r.a)), mn = Math.min(...row.map((r) => r.a));+ return Math.max(side * side * mx / (s * s), (s * s) / (side * side * mn));+ };+ let rx = 0, ry = 0, rw = W, rh = H;+ const out = [];+ while (rest.length) {+ const side = Math.min(rw, rh);+ let row = [rest[0]], best = worst(row, side), i = 1;+ while (i < rest.length) {+ const next = row.concat([rest[i]]), w = worst(next, side);+ if (w > best) break;+ row = next; best = w; i++;+ }+ const sum = row.reduce((a, r) => a + r.a, 0);+ if (rw >= rh) {+ const cw = rh ? sum / rh : 0; let cy = ry;+ for (const r of row) { const ch = cw ? r.a / cw : 0; out.push({ ...r, x: rx, y: cy, w: cw, h: ch }); cy += ch; }+ rx += cw; rw -= cw;+ } else {+ const ch = rw ? sum / rw : 0; let cx = rx;+ for (const r of row) { const cw = ch ? r.a / ch : 0; out.push({ ...r, x: cx, y: ry, w: cw, h: ch }); cx += cw; }+ ry += ch; rh -= ch;+ }+ rest = rest.slice(row.length);+ }+ return out;+ }++ // ------------------------------------------------------------------ drawing+ const tiles = new Map(), segs = new Map(), buttons = new Map();+ let shownUsed = 0, tween = 0;++ function render() {+ const list = items(), cap = capacity();+ const used = list.reduce((s, it) => s + it.bytes, 0);+ const over = used > cap;++ // the screen+ const free = cap - used;+ const all = free > cap * 0.002 ? list.concat([{ key: '_free', name: 'Free', bytes: free, free: true }]) : list;+ const laid = treemap(all, Math.max(cap, used));+ const map = $('#map'), seen = new Set(), first = !tiles.size;+ laid.forEach((t, i) => {+ let e = tiles.get(t.key);+ const fresh = !e;+ if (fresh) {+ e = el('div', 'tile enter');+ if (t.icon) e.appendChild(el('img', '', { src: t.icon, alt: '', draggable: 'false' }));+ if (t.tag) e.appendChild(el('b')).textContent = t.tag;+ map.appendChild(e);+ tiles.set(t.key, e);+ if (t.id || t.rom) e.addEventListener('click', () => (t.rom ? removeRom(t.rom) : toggle(t.id)));+ }+ e.classList.remove('leave');+ e.classList.toggle('free', !!t.free);+ e.style.left = (100 * t.x / W) + '%';+ e.style.top = (100 * t.y / H) + '%';+ e.style.width = (100 * t.w / W) + '%';+ e.style.height = (100 * t.h / H) + '%';+ e.style.cursor = t.id || t.rom ? 'pointer' : '';+ if (!t.free)+ e.style.background = 'radial-gradient(130% 130% at 30% 25%, ' + mix(t.color, 0.45) + ' 0%, ' + t.color + ' 45%, ' + mix(t.color, -0.55) + ' 100%)';+ const s = Math.min(t.w, t.h);+ const img = e.querySelector('img');+ if (img) {+ img.style.width = (100 * Math.min(44, s * 0.62) / Math.max(t.w, 1)) + '%';+ img.style.opacity = s >= 13 ? 1 : 0;+ }+ const b = e.querySelector('b');+ if (b) b.style.opacity = s >= 14 ? 1 : 0;+ e.dataset.tip = t.free ? 'Free|' + size(t.bytes) : t.name + '|' + size(t.bytes);+ if (fresh) {+ if (first) { // (the first time, the blocks come in one after another, the biggest first)+ e.style.transitionDelay = (18 * i) + 'ms';+ setTimeout(() => { e.style.transitionDelay = ''; }, 18 * i + 400);+ }+ requestAnimationFrame(() => requestAnimationFrame(() => e.classList.remove('enter')));+ }+ seen.add(t.key);+ });+ for (const [k, e] of tiles) if (!seen.has(k)) { e.classList.add('leave'); tiles.delete(k); setTimeout(() => e.remove(), 260); }++ // the bar beside it: the same blocks, stacked+ const bar = $('#bar'), keys = new Set();+ list.forEach((it, i) => {+ let e = segs.get(it.key);+ if (!e) {+ e = el('span', 'seg');+ let next = null; // (in its place among the blocks there already)+ for (let j = i + 1; j < list.length && !next; j++) next = segs.get(list[j].key) || null;+ segs.set(it.key, e);+ bar.insertBefore(e, next);+ void e.offsetHeight; // (so its height grows from nothing)+ }+ e.style.height = Math.min(100, 100 * it.bytes / cap) + '%';+ e.style.background = 'linear-gradient(90deg, ' + mix(it.color, 0.25) + ', ' + it.color + ' 55%, ' + mix(it.color, -0.3) + ')';+ e.dataset.tip = it.name + '|' + size(it.bytes);+ keys.add(it.key);+ });+ for (const [k, e] of segs) if (!keys.has(k)) { e.style.height = '0'; segs.delete(k); setTimeout(() => e.remove(), 260); }+ bar.classList.toggle('over', over);+ $('#screen').classList.toggle('over', over);+ bar.setAttribute('aria-label', 'Space used: ' + size(used) + ' of ' + size(cap));+ $('#screen').setAttribute('aria-label', 'Space on the calculator: ' + size(used) + ' of ' + size(cap) + ', each game a block its size');++ // the numbers+ const from = shownUsed, t0 = performance.now(), cancel = ++tween;+ const step = (now) => {+ if (cancel !== tween) return;+ const k = Math.min(1, (now - t0) / 220), e = 1 - Math.pow(1 - k, 3);+ shownUsed = from + (used - from) * e;+ $('#used').textContent = (shownUsed / MiB).toFixed(2);+ $('#status-line').textContent = (shownUsed / MiB).toFixed(2) + ' OF ' + +(cap / MiB).toFixed(2) + ' MB';+ $('#battery').style.width = 'calc(' + Math.min(100, 100 * shownUsed / cap) + '% - 2px)';+ if (k < 1) requestAnimationFrame(step);+ };+ step(t0);++ // the icons+ for (const [id, b] of buttons) {+ const g = kit.games.find((x) => x.id === id), on = st.picked.has(id);+ b.classList.toggle('on', on);+ b.classList.toggle('off', !on && used + g.flash <= cap);+ b.classList.toggle('nofit', !on && used + g.flash > cap);+ b.setAttribute('aria-pressed', on);+ b.dataset.tip = g.title + '|' + size(g.flash);+ }+ for (const b of document.querySelectorAll('.cap button')) b.setAttribute('aria-checked', b.dataset.cap === st.cap);+ for (const b of document.querySelectorAll('.variants button')) b.setAttribute('aria-checked', b.dataset.v === st.variant);+ $('#brand-icon').src = KIT + 'variants/' + st.variant + '.png';+ renderCarts();+ save();+ }++ function renderCarts() {+ const box = $('#carts'), add = $('#add-rom');+ if (!rg) { box.hidden = true; return; }+ const have = new Set();+ for (const r of st.roms) {+ have.add('c' + r.key);+ if (box.querySelector('[data-k="c' + r.key + '"]')) continue;+ const s = SYS[r.sys];+ const c = el('button', 'cart enter', { type: 'button', 'data-k': 'c' + r.key, 'aria-label': 'Remove ' + r.name });+ c.style.background = s.shell;+ c.dataset.tip = r.name + '|' + s.name + ', ' + size(r.bytes.length);+ const lab = c.appendChild(el('span', 'label'));+ lab.style.background = s.color;+ lab.textContent = s.tag;+ c.appendChild(el('span', 'x')).innerHTML =+ '<svg viewBox="0 0 24 24" width="10" height="10" fill="none" stroke="currentColor" stroke-width="3.4" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg>';+ c.addEventListener('click', () => removeRom(r));+ c.addEventListener('animationend', () => c.classList.remove('enter'));+ box.insertBefore(c, add);+ }+ for (const c of box.querySelectorAll('.cart[data-k]')) if (!have.has(c.dataset.k)) c.remove();+ }++ // ------------------------------------------------------------------ picking+ function bump(e, cls) {+ e.classList.remove('pop', 'shake');+ void e.offsetWidth;+ e.classList.add(cls);+ setTimeout(() => e.classList.remove(cls), 320);+ }+ function overflow(bytes) {+ toast("That doesn't fit: " + size(bytes) + ' too much');+ const bar = $('#bar');+ bar.classList.add('over');+ setTimeout(() => render(), 500);+ }+ function toggle(id) {+ const g = kit.games.find((x) => x.id === id), b = buttons.get(id);+ if (st.picked.has(id)) st.picked.delete(id);+ else {+ const over = usedBytes() + g.flash - capacity();+ if (over > 0) { if (b) bump(b, 'shake'); overflow(over); return; }+ st.picked.add(id);+ if (b) bump(b, 'pop');+ fetchObj('games/' + id + '.o'); // (ready by the time you install)+ }+ render();+ }++ async function addRoms(files) {+ const ok = new Set(rg && rg.systems ? rg.systems : [1, 2, 3]);+ for (const f of files) {+ const ext = (f.name.split('.').pop() || '').toLowerCase(), sys = EXT[ext];+ if (!sys || !ok.has(sys)) {+ toast('Retro-Go plays ' + [...ok].map((s) => SYS[s].name).join(', ').replace(/, ([^,]*)$/, ' and $1') + ' games');+ continue;+ }+ const bytes = new Uint8Array(await f.arrayBuffer());+ const r = { key: ++romKey, sys, bytes, name: romName(f.name) };+ const extra = (st.roms.length ? 0 : rg.flash + ROM_HEAD) + romBytes(r);+ const over = usedBytes() + extra - capacity();+ if (over > 0) { bump($('#add-rom'), 'shake'); overflow(over); continue; }+ st.roms.push(r);+ fetchObj('games/' + rg.id + '.o');+ }+ render();+ }+ function romName(file) { // (its name without the extension, at most 40 bytes of UTF-8, no letter cut)+ const enc = new TextEncoder();+ let n = '';+ for (const ch of file.replace(/\.[^.]*$/, '')) {+ if (enc.encode(n + ch).length > 40) break;+ n += ch;+ }+ return n;+ }+ function removeRom(r) {+ st.roms = st.roms.filter((x) => x !== r);+ render();+ }++ // ------------------------------------------------------------------ remembering a pick+ function save() {+ const h = 'games=' + kit.games.filter((g) => st.picked.has(g.id)).map((g) => g.id).join(',') ++ (st.cap === 'xl' ? '&space=xl' : '') + (st.variant !== 'NumPlay' ? '&icon=' + st.variant : '');+ try { history.replaceState(null, '', '#' + h); } catch (e) { /* (a file:// page) */ }+ try { localStorage.setItem('numplay-studio', h); } catch (e) { /* (private browsing) */ }+ }+ function restore() {+ let h = location.hash.slice(1);+ if (!h) try { h = localStorage.getItem('numplay-studio') || ''; } catch (e) { h = ''; }+ const p = new URLSearchParams(h);+ if (p.has('games')) {+ const ids = new Set(p.get('games').split(',').filter(Boolean));+ for (const g of kit.games) if (ids.has(g.id) && g !== rg) st.picked.add(g.id);+ } else for (const g of kit.games) if (g.default) st.picked.add(g.id);+ if (p.get('space') === 'xl') st.cap = 'xl';+ if (kit.variants.includes(p.get('icon'))) st.variant = p.get('icon');+ // a pick that no longer fits the calculator (the kit grew): drop the biggest games until it does+ const order = kit.games.filter((g) => st.picked.has(g.id)).sort((a, b) => a.flash - b.flash);+ while (usedBytes() > capacity() && order.length) st.picked.delete(order.pop().id);+ }++ // ------------------------------------------------------------------ the kit+ const cache = new Map();+ function fetchBytes(path) {+ if (!cache.has(path))+ cache.set(path, fetch(path).then((r) => {+ if (!r.ok) throw new Error(path + ': ' + r.status);+ if (!path.endsWith('.gz')) return r.arrayBuffer().then((b) => new Uint8Array(b));+ return new Response(r.body.pipeThrough(new DecompressionStream('gzip'))).arrayBuffer().then((b) => new Uint8Array(b));+ }));+ const p = cache.get(path);+ p.catch(() => cache.delete(path));+ return p;+ }+ const fetchObj = (rel) => fetchBytes(KIT + rel + '.gz');++ let tools = null;+ function script(src) {+ return new Promise((ok, no) => {+ const s = document.createElement('script');+ s.src = src; s.onload = ok; s.onerror = () => no(new Error(src));+ document.head.appendChild(s);+ });+ }+ function loadTools() {+ if (!tools) tools = (async () => {+ const wasm = Promise.all([fetchBytes('ld/ld.wasm'), fetchBytes('ld/objcopy.wasm')]);+ await script('ld/ld.js');+ const ld = window.Module;+ await script('ld/objcopy.js');+ const oc = window.Module;+ const [lw, ow] = await wasm;+ return { ld: [ld, lw], oc: [oc, ow] };+ })().catch((e) => { tools = null; throw e; });+ return tools;+ }+ async function run([factory, wasm], args, files) {+ let log = '';+ const m = await factory({ wasmBinary: wasm, print: (s) => { log += s + '\n'; }, printErr: (s) => { log += s + '\n'; } });+ for (const [n, d] of Object.entries(files)) m.FS.writeFile(n, d);+ let code = 0;+ try { code = m.callMain(args); } catch (e) { if (e && typeof e.status === 'number') code = e.status; else throw e; }+ return { m, code, log };+ }++ // The ROM table Retro-Go reads (np_roms, in its own section): "NPRM", version 1, the count,+ // then 52 bytes per game (offset, size, system, 3 spare bytes, its name in 40), then the games.+ function romTable(roms) {+ let at = align4(ROM_HEAD + ROM_ENTRY * roms.length);+ const offs = roms.map((r) => { const o = at; at = align4(at + r.bytes.length); return o; });+ const d = new Uint8Array(at), v = new DataView(d.buffer), enc = new TextEncoder();+ v.setUint32(0, 0x4D52504E, true); v.setUint32(4, 1, true); v.setUint32(8, roms.length, true);+ roms.forEach((r, i) => {+ const e = ROM_HEAD + ROM_ENTRY * i;+ v.setUint32(e, offs[i], true); v.setUint32(e + 4, r.bytes.length, true); d[e + 8] = r.sys;+ d.set(enc.encode(r.name).slice(0, 40), e + 12);+ d.set(r.bytes, offs[i]);+ });+ return d;+ }+ // ...as a relocatable ARM object: one section, .rodata.np_roms, and the symbol np_roms (as+ // tools/romtable.py makes it, e_flags 0 like nwlink's icon objects)+ function romObject(table) {+ const shstr = '\0.rodata.np_roms\0.symtab\0.strtab\0.shstrtab\0', str = '\0np_roms\0';+ const enc = new TextEncoder(), shs = enc.encode(shstr), sts = enc.encode(str);+ const dataOff = 52, symOff = align4(dataOff + table.length), strOff = symOff + 48;+ const shsOff = strOff + sts.length, shOff = align4(shsOff + shs.length), total = shOff + 40 * 5;+ const b = new Uint8Array(total), v = new DataView(b.buffer);+ b.set([0x7f, 0x45, 0x4c, 0x46, 1, 1, 1], 0);+ v.setUint16(16, 1, true); v.setUint16(18, 40, true); v.setUint32(20, 1, true);+ v.setUint32(32, shOff, true);+ v.setUint16(40, 52, true); v.setUint16(46, 40, true); v.setUint16(48, 5, true); v.setUint16(50, 4, true);+ b.set(table, dataOff);+ // symbols: none, the section, np_roms (global object)+ v.setUint8(symOff + 16 + 12, 3); v.setUint16(symOff + 16 + 14, 1, true);+ v.setUint32(symOff + 32, 1, true); v.setUint32(symOff + 32 + 8, table.length, true);+ v.setUint8(symOff + 32 + 12, 0x11); v.setUint16(symOff + 32 + 14, 1, true);+ b.set(sts, strOff); b.set(shs, shsOff);+ const sh = (i, name, type, flags, off, sz, link, info, al, es) => {+ const o = shOff + 40 * i;+ [name, type, flags, 0, off, sz, link, info, al, es].forEach((x, k) => v.setUint32(o + 4 * k, x, true));+ };+ sh(1, shstr.indexOf('.rodata.np_roms'), 1, 2, dataOff, table.length, 0, 0, 4, 0);+ sh(2, shstr.indexOf('.symtab'), 2, 0, symOff, 48, 3, 2, 4, 16);+ sh(3, shstr.indexOf('.strtab'), 3, 0, strOff, sts.length, 0, 0, 1, 0);+ sh(4, shstr.indexOf('.shstrtab'), 3, 0, shsOff, shs.length, 0, 0, 1, 0);+ return b;+ }++ // Bytes the installer writes for an .nwa (tools/kit.py's installed_size), less its own start code.+ function installedSize(nwa) {+ const v = new DataView(nwa.buffer, nwa.byteOffset, nwa.byteLength);+ const shoff = v.getUint32(32, true), shnum = v.getUint16(48, true), shstrndx = v.getUint16(50, true);+ const sh = (i) => { const o = shoff + 40 * i; return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((k) => v.getUint32(o + 4 * k, true)); };+ const strs = sh(shstrndx), dec = new TextDecoder();+ const name = (n) => { let e = strs[4] + n; while (nwa[e]) e++; return dec.decode(nwa.subarray(strs[4] + n, e)); };+ const secs = [];+ for (let i = 0; i < shnum; i++) { const h = sh(i); if (h[2] & 2 && h[1] !== 8) secs.push([name(h[0]), h[5], Math.max(h[8], 1)]); }+ const group = (n) => n === '.rodata.eadk_app_name' ? 0 : n === '.rodata.eadk_app_icon' ? 1 :+ n === '.text' || n.startsWith('.text.') ? 2 : n === '.rodata.eadk_api_level' ? -1 :+ n === '.data' || n.startsWith('.data.') ? 4 : 3;+ let at = 32;+ for (let g = 0; g < 5; g++) {+ if (g === 2 || g === 4) at = align4(at);+ for (const [n, sz, al] of secs) if (group(n) === g) at = ((at + al - 1) & ~(al - 1)) + sz;+ }+ return at;+ }++ async function build() {+ const sel = kit.games.filter((g) => st.picked.has(g.id) && g !== rg).map((g) => g.id);+ const roms = rg && st.roms.length;+ if (roms) sel.push(rg.id);+ const need = ['base.o', 'arena.o', 'variants/' + st.variant + '-name.o', 'variants/' + st.variant + '-icon.o'].concat(sel.map((id) => 'games/' + id + '.o'));+ const [t, ...objs] = await Promise.all([loadTools()].concat(need.map(fetchObj)));+ const files = { 'base.o': objs[0], 'arena.o': objs[1], 'name.o': objs[2], 'icon.o': objs[3] };+ sel.forEach((id, i) => { files[id + '.o'] = objs[4 + i]; });+ const args = kit.link.concat(['-T', 'numplay.ld', 'base.o', 'arena.o', 'name.o', 'icon.o'], sel.map((id) => id + '.o'));+ if (roms) {+ files['roms.o'] = romObject(romTable(st.roms));+ args.push('roms.o');+ }+ files['numplay.ld'] = kit.script.head + sel.map((id) => kit.script.blocks[id]).join('') + kit.script.tail;+ const l = await run(t.ld, args.concat(['-o', 'out.nwa']), files);+ if (l.code) throw new Error(l.log || 'ld ' + l.code);+ const s = await run(t.oc, ['--strip-unneeded', 'in.nwa', 'out.nwa'], { 'in.nwa': l.m.FS.readFile('out.nwa') });+ if (s.code) throw new Error(s.log || 'objcopy ' + s.code);+ const nwa = s.m.FS.readFile('out.nwa');+ const n = installedSize(nwa) + kit.runtime;+ if (n > capacity()) throw new Error("That's " + size(n - capacity()) + ' more than the calculator holds');+ return nwa;+ }++ function download(bytes) {+ const a = el('a', '', { download: 'NumPlay.nwa', href: URL.createObjectURL(new Blob([bytes], { type: 'application/octet-stream' })) });+ document.body.appendChild(a);+ a.click();+ setTimeout(() => { URL.revokeObjectURL(a.href); a.remove(); }, 2000);+ }+ async function go(btn, sheet) {+ if (btn.classList.contains('busy')) return;+ btn.classList.add('busy');+ try {+ download(await build());+ if (sheet) openSheet();+ } catch (e) {+ console.error(e);+ toast(/more than/.test(e.message) ? e.message : "Couldn't make NumPlay.nwa, try again");+ } finally {+ btn.classList.remove('busy');+ }+ }+ function prefetch() {+ loadTools().catch(() => {});+ for (const p of ['base.o', 'arena.o', 'variants/' + st.variant + '-name.o', 'variants/' + st.variant + '-icon.o']) fetchObj(p).catch(() => {});+ for (const id of st.picked) fetchObj('games/' + id + '.o').catch(() => {});+ if (st.roms.length) fetchObj('games/' + rg.id + '.o').catch(() => {});+ }++ // ------------------------------------------------------------------ the sheet, tips and toasts+ function openSheet() {+ const s = $('#sheet');+ for (const li of s.querySelectorAll('.xl-only')) li.hidden = st.cap !== 'xl';+ s.hidden = false;+ s.querySelector('.sheet-card a.install').focus();+ }+ function closeSheet() { $('#sheet').hidden = true; }+ let toastTimer = 0;+ function toast(msg) {+ const t = $('#toast');+ t.textContent = msg;+ t.classList.add('show');+ clearTimeout(toastTimer);+ toastTimer = setTimeout(() => t.classList.remove('show'), 2600);+ }+ function tips() {+ const tip = $('#tip');+ let on = null;+ document.addEventListener('pointerover', (e) => {+ if (e.pointerType === 'touch') return;+ const t = e.target.closest('[data-tip]');+ if (t === on) return;+ on = t;+ if (!t) { tip.classList.remove('show'); return; }+ const [a, b] = t.dataset.tip.split('|');+ tip.textContent = a;+ if (b) tip.appendChild(el('small')).textContent = b;+ const r = t.getBoundingClientRect(), w = tip.offsetWidth;+ const x = Math.max(8, Math.min(innerWidth - w - 8, r.left + r.width / 2 - w / 2));+ const y = r.top - tip.offsetHeight - 8 < 8 ? r.bottom + 8 : r.top - tip.offsetHeight - 8;+ tip.style.left = x + 'px';+ tip.style.top = y + 'px';+ tip.classList.add('show');+ });+ document.addEventListener('pointerdown', () => tip.classList.remove('show'));+ }++ // ------------------------------------------------------------------ start+ async function start() {+ try {+ kit = await fetch(KIT + 'kit.json').then((r) => { if (!r.ok) throw new Error(r.status); return r.json(); });+ } catch (e) {+ toast("The games didn't load, try again in a minute");+ return;+ }+ rg = kit.games.find((g) => g.roms) || null;++ if (rg) $('#rom-file').accept = Object.keys(EXT).filter((e) => (rg.systems || [1, 2, 3]).includes(EXT[e])).map((e) => '.' + e).join(',');+ const small = $('#small'), big = $('#big');+ for (const g of kit.games) {+ if (g === rg) continue;+ const b = el('button', 'app off', { type: 'button', 'aria-label': g.title, 'aria-pressed': 'false' });+ b.appendChild(el('img', '', { src: KIT + 'icons/' + g.id + '.png', alt: '', draggable: 'false' }));+ b.addEventListener('click', () => toggle(g.id));+ (g.xl ? big : small).appendChild(b);+ buttons.set(g.id, b);+ }+ const vs = $('#variants');+ for (const v of kit.variants) {+ const b = el('button', '', { type: 'button', role: 'radio', 'data-v': v, 'aria-label': VARIANT_NAMES[v] || v, 'data-tip': VARIANT_NAMES[v] || v });+ b.appendChild(el('img', '', { src: KIT + 'variants/' + v + '.png', alt: '' }));+ b.addEventListener('click', () => { st.variant = v; render(); });+ vs.appendChild(b);+ }+ for (const b of document.querySelectorAll('.cap button'))+ b.addEventListener('click', () => {+ if (b.dataset.cap === 'std' && st.cap === 'xl') {+ const over = usedBytes() - kit.appSpace;+ if (over > 0) { bump(b, 'shake'); toast('Take ' + size(over) + ' of games out first'); return; }+ }+ st.cap = b.dataset.cap;+ render();+ });+ $('#install').addEventListener('click', (e) => go(e.currentTarget, true));+ $('#download').addEventListener('click', (e) => go(e.currentTarget, false));+ for (const b of [$('#install'), $('#download')]) {+ b.addEventListener('pointerenter', prefetch, { once: true });+ b.addEventListener('focus', prefetch, { once: true });+ }+ $('#rom-file').addEventListener('change', (e) => { addRoms([...e.target.files]); e.target.value = ''; });+ $('#sheet').addEventListener('click', (e) => { if (e.target.id === 'sheet' || e.target.closest('.sheet-close')) closeSheet(); });+ document.addEventListener('keydown', (e) => { if (e.key === 'Escape') closeSheet(); });+ if (rg) {+ let depth = 0;+ const files = (e) => e.dataTransfer && [...e.dataTransfer.types].includes('Files');+ addEventListener('dragenter', (e) => { if (files(e)) { depth++; document.body.classList.add('dragging'); e.preventDefault(); } });+ addEventListener('dragover', (e) => { if (files(e)) e.preventDefault(); });+ addEventListener('dragleave', () => { if (--depth <= 0) { depth = 0; document.body.classList.remove('dragging'); } });+ addEventListener('drop', (e) => {+ if (!files(e)) return;+ e.preventDefault();+ depth = 0;+ document.body.classList.remove('dragging');+ addRoms([...e.dataTransfer.files]);+ });+ }+ tips();+ restore();+ render();+ addEventListener('hashchange', () => { st.picked.clear(); st.cap = 'std'; st.variant = 'NumPlay'; restore(); render(); });+ $('#studio').setAttribute('aria-busy', 'false');+ (window.requestIdleCallback || setTimeout)(() => loadTools().catch(() => {}), { timeout: 3000 });+ }+ start();+})();diff --cc customize/index.htmlindex 1f8d323d,00000000..4adbfce3mode 100644,000000..100644--- a/customize/index.html+++ b/customize/index.html@@@ -1,88 -1,0 +1,88 @@@+<!doctype html>+<html lang="en">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width, initial-scale=1">+<title>NumPlay Studio</title>+<meta name="description" content="Pick the NumWorks games you want, add your own Game Boy and NES games for Retro-Go, and get one NumPlay app with all of them.">+<link rel="icon" href="kit/variants/NumPlay.png">+<link rel="stylesheet" href="app.css">+</head>+<body>+<a class="brand" href="../">+ <img id="brand-icon" src="kit/variants/NumPlay.png" alt="">+ <span>NumPlay</span>+</a>++<main id="studio" aria-busy="true">+ <section id="small" class="grid small" aria-label="Games in NumPlay"></section>++ <section class="device" aria-label="Your calculator">+ <div class="meter">+ <span id="used" class="used">0.00</span>+ <div id="bar" class="bar" role="img" aria-label="Space used"></div>+ <div class="cap" role="radiogroup" aria-label="App space">+ <button type="button" role="radio" data-cap="std" aria-checked="true" data-tip="Every NumWorks">1.94 MB</button>+ <button type="button" role="radio" data-cap="xl" aria-checked="false" data-tip="Enlarged Extra Apps, with Nwagra">6 MB</button>+ </div>+ </div>+ <div class="side-by">+ <div id="calc" class="calc">+ <img class="calc-img" src="calculator.webp" alt="A NumWorks calculator" draggable="false">+ <div id="screen" class="screen" role="img" aria-label="Space on the calculator">+ <div class="status"><span id="status-line"></span><span class="battery"><i id="battery"></i></span></div>+ <div id="map" class="map"></div>+ <div class="drop-hint" aria-hidden="true">+ <svg viewBox="0 0 24 24" width="30" height="30" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4v11"/><path d="M7 10l5 5 5-5"/><path d="M5 20h14"/></svg>+ </div>+ </div>+ </div>+ <div class="actions">+ <div id="variants" class="variants" role="radiogroup" aria-label="App icon"></div>+ <button id="install" type="button" class="install"><span>Install</span></button>+ <button id="download" type="button" class="round" aria-label="Download NumPlay.nwa" data-tip="Download NumPlay.nwa">+ <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 4v12"/><path d="M6 11l6 6 6-6"/><path d="M5 20h14"/></svg>+ </button>+ </div>+ </div>+ </section>++ <section class="side" aria-label="Big games and Retro-Go">+ <div id="big" class="grid big"></div>+ <div id="carts" class="carts" aria-label="Retro-Go games">- <label id="add-rom" class="cart add" for="rom-file" data-tip="Add Game Boy or NES games">++ <label id="add-rom" class="cart add" for="rom-file" data-tip="Add Game Boy, NES or Sega games">+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M12 5v14"/><path d="M5 12h14"/></svg>+ </label>- <input id="rom-file" type="file" multiple accept=".gb,.gbc,.nes">++ <input id="rom-file" type="file" multiple accept=".gb,.gbc,.nes,.sms,.gg">+ </div>+ </section>+</main>++<div id="sheet" class="sheet" hidden>+ <div class="sheet-card" role="dialog" aria-modal="true" aria-labelledby="sheet-title">+ <button type="button" class="sheet-close" aria-label="Close">+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg>+ </button>+ <h2 id="sheet-title">NumPlay.nwa is on its way</h2>+ <ol class="steps">+ <li><span class="step-icon">+ <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="6" y="2" width="12" height="20" rx="2.5"/><rect x="8.5" y="4.5" width="7" height="5" rx="0.5"/><path d="M9 13h.01M12 13h.01M15 13h.01M9 16h.01M12 16h.01M15 16h.01M9 19h.01M12 19h.01M15 19h.01"/></svg>+ </span><span>Plug your calculator in</span></li>+ <li class="xl-only"><span class="step-icon">+ <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 3h12v18l-6-4-6 4z"/></svg>+ </span><span>Click the <a href="https://nwagyu.org/guide/help/enlarge-your-memory.html" target="_blank" rel="noopener">Nwagra</a> bookmark on the installer page</span></li>+ <li><span class="step-icon">+ <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 15V3"/><path d="M7 8l5-5 5 5"/><path d="M4 15v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"/></svg>+ </span><span>Drop NumPlay.nwa there</span></li>+ </ol>+ <a class="install wide" href="https://my.numworks.com/apps" target="_blank" rel="noopener">Open the installer</a>+ </div>+</div>++<footer class="foot"><a href="https://github.com/Mason363/NumPlay">Made by Mason Chen as part of NumPlay</a></footer>++<div id="tip" class="tip" role="tooltip"></div>+<div id="toast" class="toast" role="status" aria-live="polite"></div>+<script src="app.js"></script>+</body>+</html>diff --cc docs/play.mdindex cb3acaf3,efff5bf8..f4d68c4a--- a/docs/play.md+++ b/docs/play.md@@@ -737,6 -465,23 +737,23 @@@ Push every crate onto a goal: the keepe| **OK / ⌫** (stopwatch, timer) | Start or stop / reset || **OK, Up, +** / **Down, -** (counter) | Count up / down. **⌫** goes back to 0 |-11 backgrounds and 5 add-ons: a clock, a stopwatch, a timer, a counter and your own text (press **Alpha** for letters). Everything is kept for next time.+NumVisuals comes on its own, as NumVisuals.nwa (its backgrounds are also on NumPlay's home screen: press ⌫). 11 backgrounds and 5 add-ons: a clock, a stopwatch, a timer, a counter and your own text (press **Alpha** for letters). Everything is kept for next time.<br clear="right">++ ## Retro-Go++ <img src="../games/retrogo/docs/game.png" width="320" align="right" alt="Retro-Go: Thwaite, an NES homebrew game">++ | Key | What it does |+ | --- | --- |+ | **Arrows** | Choose a system, then a game. In a game: the D-pad |+ | **OK** | Open it. In a game: **A** (**2** on Sega's pads) |+ | **Back** | Back to the systems. In a game: **B** (**1**) |+ | **shift** / **EXE** | In a game: **Select** / **Start** (the Master System's **Pause**) |+ | **Backspace** | Retro-Go's menu: save, load, reset, options |+ | **Home** | Save and quit |++ Game Boy, Game Boy Color, NES, Master System and Game Gear games you pick on NumPlay's customizer website. Open a game for New game, or Resume game from one of its 4 save slots. In a game, Backspace opens Retro-Go's menu: Save & Continue, Save & Quit, Load game, Reset and Options, where the picture can be 1x, Fit or Full screen. The cartridges' own saves are kept as well.++ <br clear="right">diff --cc games/games.jsonindex da6b4a76,e21e5d36..01acec85--- a/games/games.json+++ b/games/games.json@@@ -375,80 -375,37 +375,110 @@@"shots": ["docs/shot.png"],- "colors": 48,- "repo": "https://github.com/Mason363/NumPlay/tree/main/games/numvisuals"+ "colors": 16,+ "app": "TwoPlayers.nwa",+ "repo": "https://github.com/Mason363/NumPlay/tree/main/games/twoplayer"+ },+ {+ "id": "invaders",+ "title": "Space Invaders",+ "tagline": "Stop the invasion, one cannon",+ "credit": "Based on Space Invaders by Taito",+ "top": "0x2B2F4A",+ "bottom": "0x05060C",+ "accent": "0x3CF03C",+ "colors": 4,+ "records": [+ "invaders.sav"+ ],+ "shots": [+ "docs/card.png"+ ],+ "app": "SpaceInvaders.nwa",+ "repo": "https://github.com/Mason363/NumPlay/tree/main/games/invaders"+ },+ {+ "id": "sudoku",+ "title": "Sudoku",+ "tagline": "Fill the grid, 1 to 9",+ "credit": null,+ "top": "0x3F67B5",+ "bottom": "0x18243A",+ "accent": "0x8EC5FF",+ "colors": 3,+ "records": [+ "sudoku.sav"+ ],+ "shots": [+ "docs/card.png"+ ],+ "app": "Sudoku.nwa",+ "repo": "https://github.com/Mason363/NumPlay/tree/main/games/sudoku"+ },+ {+ "id": "uttt",+ "title": "Ultimate Tic-Tac-Toe",+ "tagline": "Tic-tac-toe in tic-tac-toe",+ "credit": null,+ "top": "0x2B3470",+ "bottom": "0x10132A",+ "accent": "0xFF4D6D",+ "colors": 6,+ "records": [+ "uttt.sav"+ ],+ "shots": [+ "docs/card.png"+ ],+ "app": "UltimateTicTacToe.nwa",+ "repo": "https://github.com/Mason363/NumPlay/tree/main/games/uttt"+ },+ {+ "id": "sokoban",+ "title": "Sokoban",+ "tagline": "Push every box home",+ "credit": "Levels: Microban by David W. Skinner",+ "top": "0xA19555",+ "bottom": "0x444024",+ "accent": "0xFFB650",+ "colors": 11,+ "records": [+ "sokoban.sav"+ ],+ "shots": [+ "docs/shot.png"+ ],+ "app": "Sokoban.nwa",+ "repo": "https://github.com/Mason363/NumPlay/tree/main/games/sokoban"+ },+ {+ "id": "retrogo",+ "title": "Retro-Go",+ "tagline": "Game Boy, NES and Sega games",+ "credit": "Based on Retro-Go by ducalex",+ "top": "0xE84B39",+ "bottom": "0x1E1430",+ "accent": "0x3199DC",+ "records": [+ "retrogo.cfg",+ "rg_*"+ ],+ "reset": [+ "rg_*"+ ],+ "shots": [+ "docs/shot.png"+ ],+ "app": "RetroGo.nwa",+ "repo": "https://github.com/Mason363/NumPlay/tree/main/games/retrogo",+ "default": false,+ "roms": true,+ "systems": [+ 1,+ 2,+ 3,+ 4,+ 5+ ]}]diff --cc launcher/lang/fr.txtindex 5ab1b842,d48e04fb..fc6088c5--- a/launcher/lang/fr.txt+++ b/launcher/lang/fr.txt@@@ -97,29 -97,23 +97,32 @@@ Minesweeper DémineuClear the field, flag the mines Déblaie le terrain, pose les drapeauxBlock Breaker Casse-briquesBreak every brick Casse toutes les briques+2 Players 2 joueurs+Pong and more, side by side Pong et plus, côte à côte+Fill the grid, 1 to 9 Remplis la grille, de 1 à 9+Ultimate Tic-Tac-Toe Morpion ultime+Tic-tac-toe in tic-tac-toe Un morpion dans le morpionBackgrounds, clocks, timers Fonds, horloges, minuteurs+Stop the invasion, one cannon Arrête l'invasion avec un seul canon+ Game Boy, NES and Sega games Jeux Game Boy, NES et Sega# (names that stay as they are)NumDash NumDashNumBlocks NumBlocksNumDrive NumDrive2048 2048NumVisuals NumVisuals+Space Invaders Space Invaders+Sudoku Sudoku+ Retro-Go Retro-Go# the games' creditsInspired by Minecraft, not affiliated with Mojang Inspiré de Minecraft, sans lien avec MojangBy Tatone26, from All the Apps Par Tatone26, tiré d'All the AppsInspired by Tatone26's All the Apps Inspiré d'All the Apps de Tatone26Based on 2048 by Gabriele Cirulli D'après 2048 de Gabriele CirulliBased on Block Blast! by Hungry Studio D'après Block Blast! de Hungry Studio+Based on Space Invaders by Taito D'après Space Invaders de TaitoBased on Chrome's dinosaur game by Google D'après le jeu du dinosaure de Chrome, de Google+ Based on Retro-Go by ducalex D'après Retro-Go de ducalex# a game the RAM of the calculator's software is too small forNeeds Il manqueKB more memory Ko de mémoirediff --cc launcher/lang/zh.txtindex 0540b24e,c1067280..6ee07e7d--- a/launcher/lang/zh.txt+++ b/launcher/lang/zh.txt@@@ -96,15 -96,8 +96,16 @@@ Minesweeper 扫�Clear the field, flag the mines 清理雷区,标出地雷Block Breaker 打砖块Break every brick 打碎每一块砖+2 Players 双人对战+Pong and more, side by side Pong 等游戏,两人并肩玩+Sudoku 数独+Fill the grid, 1 to 9 填满九宫格,1 到 9+Ultimate Tic-Tac-Toe 终极井字棋+Tic-tac-toe in tic-tac-toe 井字棋里的井字棋Backgrounds, clocks, timers 背景、时钟、计时器+Space Invaders 太空侵略者+Stop the invasion, one cannon 一门大炮,挡住入侵+ Game Boy, NES and Sega games Game Boy、NES 和 Sega 游戏# (names that stay as they are)NumDash NumDashNumBlocks NumBlocks@@@ -117,8 -111,8 +119,9 @@@ By Tatone26, from All the Apps 作者 TInspired by Tatone26's All the Apps 灵感来自 Tatone26 的 All the AppsBased on 2048 by Gabriele Cirulli 改编自 Gabriele Cirulli 的 2048Based on Block Blast! by Hungry Studio 改编自 Hungry Studio 的 Block Blast!+Based on Space Invaders by Taito 改编自 Taito 的 Space InvadersBased on Chrome's dinosaur game by Google 改编自 Google Chrome 的小恐龙游戏+ Based on Retro-Go by ducalex 改编自 ducalex 的 Retro-Go# a game the RAM of the calculator's software is too small forNeeds 内存还差KB more memory KBdiff --cc tests/test_games.pyindex a5957003,59d62fa8..1a3da3c3--- a/tests/test_games.py+++ b/tests/test_games.py@@@ -181,26 -139,10 +181,30 @@@ GAMES =# Press OK to Play: the first scenario, its first goal closed, the city runs; then Continue"finalearth2": ("FinalEarth2.nwa", "finalearth2.sav", presses((2000, "ok"), (3000, "ok")), 9000,presses((2000, "ok")), 6000),+ # past the title, a new run as Isaac: the floor's name, then he walks and cries; Home keeps the run. Next time,+ # Continue, and the run goes on (quitting with On/Off)+ "isaac": ("BindingOfIsaac.nwa", "isaacrun.sav",+ presses((1500, "ok"), (2200, "ok"), (2800, "ok"), (3400, "ok"), (3900, "left", 1200), (4200, "6", 900),+ (5400, "up", 600)), 7000,+ presses((1500, "ok"), (2200, "ok"), (2800, "right", 900), (3000, "8", 600)), 4500),+ # past the keys, Adventure: the street, Ready Set Plant, a peashooter on the sod; Home keeps the level. Next+ # time Continue, Back to Game, and the level goes on+ "pvz": ("PlantsVsZombies.nwa", "pvzlevel.sav", presses((1500, "ok"), (2500, "ok"), (3500, "ok"), (12500, "1"),+ (13000, "ok")), 16000,+ presses((1500, "ok"), (2500, "ok"), (3500, "ok")), 9000),+ # past the keys, the SEGA screen and the title: Green Hill Zone, running; Home keeps the act, and next time+ # Continue goes back to it+ "sonic": ("SonicTheHedgehog.nwa", "sonic.sav",+ presses((1500, "ok"), (5500, "ok"), (7000, "ok"), (9000, "right", 6000)), 16000,+ presses((5500, "ok"), (7000, "ok"), (9500, "right", 2000)), 13000),+ # past the keys, the big cookie clicked three times; Home saves the bakery. Next time, from the copy, two more+ "cookieclicker": ("CookieClicker.nwa", "cookieclicker.sav",+ presses((2500, "ok"), (3500, "ok"), (4000, "ok"), (4500, "ok")), 6500,+ presses((3000, "ok"), (3600, "ok")), 5500),+ # no games in its table: the welcome; Backspace, Options, Scaling from Fit to Full, back; next time to 1x+ "retrogo": ("RetroGo.nwa", "retrogo.cfg",+ presses((1500, "backspace"), (2200, "ok"), (2900, "right"), (3500, "back")), 4500,+ presses((1500, "backspace"), (2200, "ok"), (2900, "right"), (3500, "back")), 4500),# a level, its message, then play; then back to the level select"portal": ("PortalReturns.nwa", "portal.sav",presses((1500, "ok"), (2500, "ok"), (3500, "ok")) + every(4000, 7000, 400, "right", 300), 8000,@@@ -309,29 -224,10 +313,31 @@@ CHECKS ="blockblast": (lambda v: len(v) == 92 and v[:3] == b"B\1\3" and struct.unpack_from("<I", v, 12)[0] >= 1and struct.unpack_from("<I", v, 8)[0] >= struct.unpack_from("<I", v, 12)[0],lambda v: v[2] & 1 and struct.unpack_from("<I", v, 12)[0] >= 2),+ # the runner died (the deaths at 8); after the reinstall, from the copy, it died again+ "leveldevil": (lambda v: len(v) == 48 and v[:2] == b"L\1" and struct.unpack_from("<I", v, 8)[0] >= 1,+ lambda v: struct.unpack_from("<I", v, 8)[0] >= 2),+ # the best score ("I", version 1, the best at 4): some invaders shot; then kept, or beaten+ "invaders": (lambda v: len(v) == 8 and v[:2] == b"I\1" and struct.unpack_from("<I", v, 4)[0] >= 20,+ lambda v: len(v) == 8 and v[:2] == b"I\1" and struct.unpack_from("<I", v, 4)[0] >= 20),+ # how to play read, the game's moves (at 32) kept: 40 then 36; then 2 more+ "uttt": (lambda v: len(v) == 114 and v[:2] == b"U\1" and v[4] & 1 and v[5] == 2 and v[32:34] == bytes([40, 36]),+ lambda v: v[5] == 3 and v[34] == 2),+ # how to play seen and the first level played last; then the second+ "sokoban": (lambda v: len(v) == 314 and v[:4] == b"S\1\1\0", lambda v: len(v) == 314 and v[:4] == b"S\1\1\1"),+ # the bakery kept ("CCK1", the cookies at 8, the clicks at 48): 3 clicks; after the reinstall, from the copy, 5+ "cookieclicker": (lambda v: v[:4] == b"CCK1" and struct.unpack_from("<d", v, 48)[0] == 3+ and struct.unpack_from("<d", v, 8)[0] >= 3,+ lambda v: v[:4] == b"CCK1" and struct.unpack_from("<d", v, 48)[0] == 5),"breakout": (lambda v: len(v) == 12 and v[:2] == b"B\2" and v[4] == 1 and struct.unpack_from("<I", v, 8)[0] >= 10,lambda v: v[4] == 0 and struct.unpack_from("<I", v, 8)[0] >= 1), # best kept, shake off+ # Air Hockey and the easy computer chosen; then the normal computer and Tanks, the tallies kept+ "twoplayer": (lambda v: len(v) == 36 and v[:4] == b"P\1\1\1",+ lambda v: len(v) == 36 and v[:4] == b"P\1\2\2"),+ # a game kept (Easy, the guide read) with the two digits the hints wrote (the digits at 109); then three+ "sudoku": (lambda v: len(v) == 352 and v[:4] == b"S\1\3\0" and sum(1 <= b <= 9 for b in v[109:190]) == 2,+ lambda v: v[2] & 1 and sum(1 <= b <= 9 for b in v[109:190]) == 3),+ # the scaling (third byte): Full, then 1x+ "retrogo": (lambda v: len(v) == 19 and v[:2] == b"R\1" and v[2] == 2, lambda v: v[2] == 0),}