Keeping the games

Downloads, installers, the TV box, PC installs, loans and saves

A licence can be withdrawn; a checked installer on the server can't. This is how owned games get downloaded, verified, scanned and made to run on the TV, installed on a PC, lent out for a while, and how every save version is kept for good.

Live in 0.40.0.1PC installs since 0.35 · every save version kept since 0.38.3 · loans with a length and a limit since 0.39 · Remove from a PC, and a PC's game kept where the library holds a ready copy, since 0.40

Downloads and archiving

  • GOG: downloads the installers for the whole GOG library, checks each against GOG's checksums, and picks up where it left off if a download is interrupted. The installer is the copy that's kept.
  • Unpacked for the TV: each GOG game is unpacked onto the Batocera box's Windows shelf, in the folder layout Batocera launches through Wine. The unpacker doesn't run GOG's install scripts, so Cartmark reads GOG's list of install steps and replays them: config files, registry settings imported into Wine by a small start script, support files. It picks the English options and skips GOG's little "choose an option" DOS menus, so the game just starts.
  • Steam: owned games can be downloaded too, through a separate Steam sign-in used only for downloads, onto the Windows or Linux shelf.
  • Scanned before anything runs them. Every Windows game and installer that arrives is virus-scanned before it is listed for a box, installed on a PC, copied to one or downloaded. A copy judged a threat is set aside out of reach and another copy searched for. How scanning works.

Getting Windows games to run on the box took some digging:

  • Wine needed one exact version of its Mono add-on, in the folder Wine actually looks in. The setup script now asks Wine which version it wants and fetches exactly that.
  • Every 32-bit game crashed at once because this Batocera build is missing a 32-bit library. Those games now get a one-line setting that sends them through X11 instead.
  • Old DOSBox games needed their video output switched to OpenGL.

Windows games unpacked from their installers play on the box, straight from the library; a game whose installer has not been unpacked yet waits until it is, because the box cannot run installers itself. RollerCoaster Tycoon 2 is played through its open-source remake, OpenRCT2, instead.

Installers stay on Batocera's own shelf. A GOG installer sits in its own folder on the box's installers shelf, where Batocera's Install a new Windows game list shows it; the game unpacked from it is one entry on the Windows shelf and never shows as an installer. A game copied to a PC goes without its installer. With the box's switch on, each Windows game gets a controller mapping: the left stick moves the pointer, A and B click, the D-pad is the arrow keys, Start is Escape, and Hotkey+Start closes the game. A Wii U game on the box gives player one a Pro Controller.

Steam itself gets installed too. The Batocera installer offers to set it up, the Windows station setup installs it through winget, and every machine reports whether Steam is installed and signed in.

A Windows game in one archive, unpacked

A Windows game that arrives as one .7z, .zip or .rar is unpacked into its own game folder, ready to copy and play, after its listing is judged: no links, no names outside its folder, names Windows can hold, enough free space, and no more than 20 times its own size. Each file is checked against the listing before the folder is put in place. An installer is never unpacked; it waits to be installed. The archive is removed only once the unpacked folder scans clean. A repack downloaded for a game is read as the installer it is, placed on the installers shelf beside the game's name, and never run by the server.

A download's page shows the import step it is really on, live: reading an archive's programs, unpacking it, copying it to the shelf, checksumming installer files, then the achievement hash. A download stranded at "importing" with nothing working on it is found within minutes and put back.

A Windows game's page with its one file, a folder ending .pc, recorded once
One folder, one record. On a test install with made-up games.

An arcade shelf

Arcade sets have a home instead of being thrown away. Cartmark keeps MAME's own list of sets for the MAME the box runs, and FinalBurn Neo's, and checks every file inside an arcade zip against them. A complete set goes on the mame shelf as the set's own name, under the game it really is, which is not always the game that was searched for. A set from another MAME version, one split from its parent, several merged into one zip, or one that also needs a disk image is held and says which, rather than placed wrongly. A set already on the shelf is never replaced.

Windows games install on a PC from their installer

Copy and install copies the installer to the PC, checks it, and runs its setup there. The page shows each stage, and the person who pressed is told when Windows' administrator prompt is up; the install waits for the answer. An install counts as installed only when Windows lists the game and its folder has stopped changing. A game gets a shortcut in the PC's Cartmark folder and one beside its own folder, and each Windows PC keeps a Cartmark folder with a shortcut to every emulator Cartmark set up and every game copied to it.

An install asks a fair amount of room: the installer and the game it installs to, judged by the installer's kind or by an earlier install of it. A copy to a PC counts as done only once its files have been checked, and a copied game carries only its own settings and save folder, never settings for the whole PC. Nothing sent to a PC is left stuck: an install or copy that ended without the game offers Dismiss and, where it helps, Try again, and each says what happened.

Removing a game leaves no folder behind: saved games move to Cartmark Saves, other files to Kept, and nothing is deleted that Cartmark did not put there.

A game installed on a PC comes home, gently

A game installed on a PC is sent back to the library as soon as it is installed, even while the PC is in use: at up to 2 MiB a second then, and with no limit in the PC's quiet hours. It pauses while the game itself is running, so its files are never read while the game may be writing them, and while the PC is busy online (a game, a call, a stream), resuming a minute after things go quiet. A game that changed its own files still comes home: what still matches the install is brought back, and the changed files stay on the PC and are named. Where the program itself changed, or more than a tenth of the game, nothing is taken.

A game whose virus scan could not read it whole is held as "only partly scanned". A person who may install can accept such a game for one install, on one PC, of exactly those files, and who accepted, when, and the words they were shown are recorded. A real finding stays held whatever is ticked, and the box never takes it, because it runs games with full access.

Loans have a length and a limit

Every game lent, copied or installed to a machine runs 14 days by default, which your household admin can change, is warned of two days before, and goes back by itself with its saves kept. You can extend it twice, and each person has three loans at once unless an admin sets another number. Games a handheld keeps by its own sync rules do not count. Console games can be lent to a Windows PC too, from a library that keeps them under roms.

A loan counts only the time a PC runs without contact, and a clock set back cannot stop it. A machine's page lists each installed game with its size, when and by whom it was installed, its loan and its last attempts with their reasons; games brought home from the PC are listed under Transfers.

Every version of every save is kept for good

Your real save versions are never thrown away, however many there are. My saves lists each save's versions, the current one first as #1, each with when and on which machine it was played, the emulator core, and what Cartmark can read of its progress, such as a game's stars. Restore this one shows the current version and the chosen one side by side and says what changes before you say Yes. The one it replaces is kept as #2, every PC and box fetches your choice at its next check-in, and Recently played always starts from #1.

  • Starting an emulator from the tray waits for your saves first. The tray's Emulators menu brings in your saves for that emulator or core, saying about how many seconds it needs, and starts nothing until they are all there.
  • A game started from an emulator's own shortcut is seen too. Its save becomes your newest only where the play began on your newest save; otherwise it is kept as a separate copy for you to choose, so an old copy never wins because its file is newer.
  • On the Batocera box, each player keeps their own PS2 memory card, and a player change puts the last player's cards away and brings yours back, exactly as you left them. Dreamcast VMUs and Dolphin's GameCube cards and Wii saves are per player too.
  • Game night never waits on the server. The box gives it ten seconds; if it cannot be reached and you are the player on the box, your game starts on your saves, and they go up at the next contact.
  • No size limit per person. While the server's disk is nearly full, new saves wait on the PC or box and the game still starts.

A household admin can restore a member's save, always with their admin password, and never sees that member's PC folders.