Skip to content

CHGame 0.3.0

Latest

Choose a tag to compare

@bateske bateske released this 07 Oct 22:58
· 15 commits to main since this release

The first release from the CHGame repository: one Boards Manager URL now
installs the core, the menu bootloader, the libraries and the games. The
package's maintainer is shown as bateske.

Changed

  • The board is "CHGame Rev0" (Tools > Board > CHGame Boards > CHGame
    Rev0
    ), FQBN CHGame:ch32v:rev0 (it was CHGame:ch32v:CHGame), variant
    CH32X035/CHGame_Rev0, ARDUINO_CHGAME_REV0. A later hardware revision
    gets its own board entry and variant.
  • The CHGame library's instance is chgame (chgame.boot(),
    chgame.pressed(), chgame.exitToMenu() ...); it was arduboy. CHGame
    is the platform and the product, Arduboy the maker. A sketch written for
    0.2.4 with the copied library renames arduboy. to chgame..
  • The games' code is in their sketch folders, so the Arduino IDE shows
    it as tabs; src/ keeps generated art, scores and tables.
  • Smallest + LTO links as one partition (-flto-partition=one). gcc
    split the larger sketches in two and could not inline or merge across the
    split: nine of the examples are 40-376 B smaller, none bigger.
  • CHGfx 1.3.1: a 12 bpp sketch carries no 16 or 18 bpp code.
    gfx_begin(..., GFX_12BPP) with no gfx_setColorMode() leaves those
    converters out: 0.2-0.4 KB of flash and 176 B of SRAM back in every game.

Added

  • Box art for every game. Each example has a painted cover for the SD
    Graphic Menu (docs/cart.png, from its tools/cart.py). The menu's own
    pictures, which every card falls back on (the cover, the text menu's
    picture, the about page, installed, no picture, no cover, the errors),
    are painted to match, and so are the casino card's cover and folders;
    the graphic menu's built-in icons are new.
  • One casino chip. The betting chips (Blackjack, Roulette, Craps, Yacht,
    Poker, Tic Tac Toe), the rail racks and the chip-styled pieces (Checkers'
    men, Backgammon's checkers, Four in a Row's discs, the GOBBLE chips,
    Boardwalk's carpet stacks, Solitaire's chip card back, Poker's seat
    avatars) are redrawn as one family: a lit label, edge inserts as dashes,
    rims in the chip's shade, stacks whose inserts alternate so they can be
    counted. The shared sprites are tools/art/common/chip_*.txt.
  • The libraries come with the package. #include <CHGame.h> (buttons,
    frame pacing, palette, drawing, sound, saving, the debug protocol), CHGfx
    (graphics) and CHSd (SD card / FAT) are in the package's libraries/,
    beside SPI, Wire and EEPROM. Nothing to copy into the sketchbook.
  • Twenty casino games and two apps as examples: File > Examples >
    CHGame > Games
    (CHBlackjack, CHChess, CHPoker ...) and Apps:
    CHStlView, a 3D wireframe viewer for the .STL files on the SD card,
    CHSDtoUSB, the SD card reader, and CHSDtoSerial, the SD card helper
    the CHGame website uploads (a framed serial protocol); with Hello, the
    smallest complete sketch.
  • SD menu packages from the IDE. Every build also writes
    <sketch>.ino.chg, the package the bootloader's game menu installs from
    the card's GAMES folder; Sketch > Export Compiled Binary puts it in the
    sketch's build folder. Its title is the sketch's name in capitals.
    (chgame-upload pack, with -title, -author and -gameversion when
    run by hand.)
  • Every game and app as one .chgame cart beside the release
    (CHGame-Casino-<version>.chgame; the format is the repository's
    spec/chgame.md), and its SD card's contents as a zip
    (CHGame-sdcard-<version>.zip): built from this package's own examples.
    Each example has a chgame.json describing it.
  • Tools > Bootloader chooses what Burn Bootloader writes: the SD
    Text Menu (Rainbow)
    , the default, or (Static), the same menu with
    nothing turning: the selection bar, the boxes and the picture's magenta
    parts in the menu's text colour; or USB Only, the same bootloader
    without the menu, for a board built without an SD card: it drives the
    LED and USB and leaves every other pin alone (high-Z), so the card's and
    the panel's pins are free for other circuits. Every bootloader leaves the
    pins it does not use high-Z. The 0.2.4 bootloader is no longer shipped.
  • A card's launch game never installs by itself. If it is the game in
    flash it starts at once, with the panel dark; otherwise the menu opens on
    it and A installs it, so switching on never writes over the game you
    were playing. The SD Graphic Menu stays on the card's cover at power-on
    (A there shows the installed game), and LEFT/RIGHT do nothing on a card
    without folders.
  • The SD Graphic Menu (Tools > Bootloader, Rainbow or Static): the same
    card shown one picture at a time and no text, in the manner of the
    Arduboy FX. The card's cover at power-on, a cover for each folder
    (LEFT/RIGHT), each game's box art (UP/DOWN), a bar over the picture while
    a game installs, fades and slides between pictures, an about page on B.
    Every example game and app comes with its box art (docs/cart.png), and
    the casino card sorts them into genre folders. Switch between the two
    menus at any time with Burn Bootloader: the card works with both.
  • The SD Text Menu takes its look from the card: the picture behind it
    (GAMES/MENU.BG; every card the tools prepare has the CHGAME logo, its
    colour turning), the order of the games and folders of up to 240 games
    (GAMES/MENU.IDX), and optionally a game started at power-on instead of
    the menu (hold START while switching on for the menu). Errors are shown as
    a number (the repository's docs/sd-menu.md lists them).
  • Programmer "CHGame USB (requires CHGame bootloader, no drivers)":
    Burn Bootloader through the bootloader that
    is already on the board. No driver and no buttons; a port must be
    selected, as for Upload. The installed sketch is erased. Upload Using
    Programmer
    does the same and then uploads the sketch. "WCH factory ISP
    (Hold BOOT on power-up, requires driver)" remains for a board whose bootloader is missing, damaged or locked, and no
    longer needs a port selected.
  • chgame-upload 0.2.0: selfupdate <boot.bin>, burn -method usb|isp
    and pack. It refuses an image that is not a bootloader for this board.
    Its source is in this repository now (platform/bootloader/host/go).
    Ready for board revisions (the repository's docs/hardware-revisions.md):
    it shows the board a bootloader reports (probe, info), refuses a
    bootloader built for another board, and takes -device rev0 on flash
    (refusing another board) and pack. The Upload recipe does not pass it
    yet; that comes with the first board after Rev0.

Fixed

  • The word games could find no card after CHSDtoUSB. CHSDtoUSB turns
    the card's CRC checking on, the card stays powered across a reset, and a
    game uploaded while it ran started without the menu (which turns it
    off). CHSd sends fixed CRCs, so a card that kept checking on through the
    reset refused it. CHSd now turns checking off itself.
  • Linux builds. cores/arduino/ch32/lib/ch32yyxx.h included
    core_riscv_cH32yyxx.h with a capital H; the file is
    core_riscv_ch32yyxx.h, so the core only compiled on case-insensitive file
    systems.
  • A crash no longer leaves the piezo sounding. A hard fault, or an
    interrupt with no handler, used to spin with interrupts off, and the timer
    driving the piezo held the note that was playing. Now the piezo pin is
    driven low and the status LED stays on (chgame_fault(), 58 B). A debug
    build (-DCHGAME_DEBUG=1) also keeps mcause, mepc, mtval, ra and sp at
    the bottom of the stack. A sketch that provides chgame_fault_park() (the
    CHGame library's debug protocol) goes on answering its PC; otherwise a
    press of A restarts it, for the library's debug command ! to report.
  • A sketch header named like a core header broke the build on Windows
    and macOS: the core was compiled with the sketch's folder ahead of its own
    on the include path, so a sketch's Board.h, Variant.h, Timer.h ...
    replaced the core's board.h, variant.h, timer.h (the file systems
    ignore case). The sketch's folder now comes last, and wiring.h includes
    "board.h" rather than <board.h>.
  • Comments that still described the 8 KB bootloader and a sketch at 0x2000
    (link_chgame_app.ld, chgame_map.h), and one in boards.txt naming a
    generator that does not exist.

Add this to Arduino IDE, Preferences -> Additional Boards Manager URLs:

https://github.com/bateske/CHGame/releases/latest/download/package_chgame_index.json

Already installed? Boards Manager offers this version as an update.