Reference ยท Port

piney-apples, the player's launcher

Covers16
crates/piney-launcher (piney-applesits AppImage)piney_data::homepiney_build::buildpiney_build::discpiney_build::stamppiney_game::runpiney_game::settings (the settings' tablesettings.tomlthe flags)piney_game's fullscreenthe build's stamp.txtthe data folder's discs.txtlauncher.tomlplaying.lockbuilding.lock and logs/

piney-apples is the program players download: one executable holding the launcher's window (GPUI), the builder (piney-build's library) and the game (piney-game's library). Everything it makes is kept in one folder beside it. This page is what the program does and where it keeps things; the discs' formats are elsewhere in the reference.

One executable, three roles

piney-apples                     the window (Library, Settings, Logs and help)
piney-apples --play ARGS...      game mode: piney_game::run(ARGS)
piney-apples --add-disc ISO      a disc checked and remembered, then the window
piney-apples --page NAME         the window on library, settings or help
piney-apples --status            each volume's state, and whether a rebuild is due
piney-apples --build             the remembered discs built, progress printed
piney-apples --start N [-- ARGS] volume N played as its row's Play does, waited for
piney-apples --build-job DIR DISCS...  build mode, the window's own (not in --help)
  • Play runs the program again as --play --game <data>/game [--volume N] --card <save folder>. A row's Play names its volume. Play .hack//, offered when two or more volumes are ready, names none, so the game opens its own four-part selector (piney-game's launcher mode). The program is std::env::current_exe(), or in an AppImage the .AppImage file ($APPIMAGE), which mounts itself again for the game. Its stdout and stderr go to a new log file, so a panic is kept too. On Windows the program is a GUI-subsystem executable with no console window, in both roles.
  • The game outlives the window. The game-mode process holds an exclusive lock on playing.lock in the data folder for as long as it runs (std::fs::File::try_lock; the lock goes with the process however it ends). Closing the window leaves the game running. A window opened while the lock is held says a game is running and keeps Play, the build and Settings waiting until the lock is free; --build and --start refuse.
  • Closing during a build asks first: keep building, or cancel the build and close once it has stopped (the old build stays as it was).
  • The build is the program again in build mode, --build-job <data>/game DISCS..., the same program Play runs (the .AppImage in an AppImage), for the window and for --build. Its process runs piney_build::build::run and is gone when the build ends, its memory with it (in the window's own process glibc kept some 750 MB of the build's freed memory). A crash in it is a failed build, not a closed window. On Windows it is started with CREATE_NO_WINDOW, its stdin and stdout pipes.
  • The build's lines. Its stdout is one message a line (piney-launcher/src/builder.rs): say TEXT (a line of the account, \, \n and \r escaped), progress V STEP DONE TOTAL (volume 1 to 4, files, port-data or verify, no oftener than every 50 ms but for a step's start and end), and last done, cancelled or failed TEXT. The window writes the account to the build's log, keeps the numbers it draws on its 150 ms timer, and logs a line that is no message as such. Its stderr (the generator's notes, a panic) goes to the log too. A process that ends without an outcome is a failed build, said with the last lines of its stderr. GPUI draws only a window that is visible: a hidden or locked screen holds the picture until it is shown, while the build goes on.
  • Cancel writes cancel on the process's stdin; a thread there sets the flag the builder asks between chunks and files. Its stdin closing (the window closed or crashed) is a cancel too, so no build outlives the window. A process that says nothing for 120 s after Cancel is ended and its .part files removed. Making a disc's port data is its one quiet stretch (0.9 s for Infection, 16 to 57 s for the later volumes, with Infection's executable), and it comes before the old build is replaced, so an ended build leaves the old one too. Once the new build has replaced the old one, the check of every file runs to its end whatever is asked: a cancel then could not leave the old build.
  • piney-game and piney-build remain the developers' programs. Their mains parse the same flags as before and call the same entry points: piney_game::run(args) -> ExitCode and piney_build::build::run.

The folder

piney_data::home is the one resolver the game, the builder and the launcher share. Its order is:

  1. a portable folder the program names (use_portable; piney-apples sets piney-apples-data beside itself before anything else runs). Where "itself" is, is home::portable: the executable, or, when $APPIMAGE and $APPDIR are both set and the executable is inside $APPDIR, the .AppImage file. An AppImage runs from a read-only mount that goes when it ends, so the folder goes beside the file the player has;
  2. $PINEY_HOME;
  3. piney in the platform's data folder: ~/.local/share/piney (or $XDG_DATA_HOME/piney), %APPDATA%\piney, or ~/Library/Application Support/piney.

piney-game and piney-build never set a portable folder, so they keep the second and third. Inside the folder (home::Places):

pathwhatwritten by
game/the build: chunks.pak, one <volume>.disc per disc, build.txt, stamp.txtthe builder
data/<image>-<size hex>/a disc image's port data, when one is played without a buildthe game
memcard/slot1/the memory card a build's game plays withthe game
settings.tomlthe options kept across the four partsthe game, the Settings page
padlogs/the console's pad_log recordingsthe game
console_history.txtthe console's typed linesthe game
logs/game-*.log, build-*.log, launcher-*.logpiney-apples
discs.txtthe disc images given, <volume number> <path> a linepiney-apples
launcher.tomlthe launcher's own choices: save_folder = "<path>" when the player chose onepiney-apples
playing.locklocked by a running game in game modepiney-apples
building.locklocked by a running build in build modepiney-apples

A log is named by its kind and the UTC time it began (game-20261128-112451.log). Each kind keeps its newest 10. At start the launcher writes and removes .write-check in the folder. If that fails, it shows only a message saying it cannot write beside itself and naming the folder.

A disc's verdict

piney_build::disc::identify reads only the image:

  1. Sector 16 must be an ISO 9660 primary volume descriptor (01 "CD001"). Without one the image is not a .hack disc.
  2. The image must be at least the volume space size (u32 LE at +80) times the logical block size (u16 LE at +128). A shorter image is damaged or incomplete.
  3. SYSTEM.CNF's BOOT2 = cdrom0:\NAME;1 names the boot file. Without it the image is not a .hack disc.
  4. A boot file of the four North American discs (SLUS_202.67, SLUS_205.62, SLUS_205.63, SLUS_205.64) has its DATA/GCMN.PRG checked by length and FNV-1a 64 (Volume::detect). It must be that volume's. If it is, the disc is that volume ("This is Mutation (SLUS_205.62)."). If not, it is damaged.
  5. SLPS_255.27 is .hack//fragment's Japanese disc: not supported yet.
  6. Any other boot file that is not SLUS_/SCUS_, on a disc with DATA/DATA.BIN and a DATA/GCMN*.PRG, is a PAL or Japanese .hack disc. Without those files it is another game.

The four discs under work/ and fragment's own SYSTEM.CNF were checked this way (worklog 618). The other regions' boot files are not listed: the region comes from the prefix and the engine's files.

The stamp

game/stamp.txt, written by every build after its discs are in place:

# What this build was made with (piney-build); another version remakes it.
data = 35
pack = 2
disc = 1 SLUS_202.67 2598567936 9349383e707e0cad

data is pack::DATA_VERSION, the port data's format. pack is pack::VERSION, the chunk file's. Each disc line is a volume number, a boot file, the image's length in bytes and GCMN.PRG's FNV-1a 64 in hex. A disc kept from an earlier build keeps its earlier line.

The cards

Each volume's state comes from its remembered image, checked again at start, the build's .disc files and the stamp:

statewhen
no discno image given and none built
disc movedan image given, not built, and the file is gone or is no longer that volume
needs Infection's disc tooa later volume given, with neither Infection's image nor its build present (the later volumes' data is made with Infection's executable)
ready to buildan image given and found, not built
needs rebuildbuilt, but the stamp is missing or of other formats, or the image given is not the one built
readybuilt, with a current stamp naming this disc

A built volume plays from the build whether or not its image is still there. At start, if any volume needs a rebuild because of the formats, the build is made again from every remembered image and from the build itself: the builder keeps a volume whose image is not given ("keeping ... from the build") and makes its port data again from the build's own copy of its files. That needs the build's chunk file to be of this builder's format (pack = pack::VERSION in the stamp) and the stamp to name the volume's disc. Only when a built volume's image is gone and its build cannot be read that way does the launcher wait; its row then asks for the image again. A later volume's row with neither Infection's image nor its build says so ("Needs Infection's disc too, to build Mutation") and offers to add Infection's disc instead of Build. A build always remakes chunks.pak from every disc it holds. The old build is replaced only once the new one is whole. A cancelled or failed build leaves the old one, its log is kept, and the .part files of a build process that crashed or was ended are removed then, those of a closed program at the next start. A build process holds building.lock in the data folder while it runs, so a second window neither removes its .part files at its start nor starts a build of its own beside it.

The window

Flat, like a desktop shell: one solid colour per surface (the page, the column of pages and the title bar, each row), 1px lines between them, no gradients, glows or shadows. Colour means something where it is used: a volume's own colour (Infection cyan, Mutation violet, Outbreak amber, Quarantine crimson) on its row's edge bar and its mark (rings round a point, parallel slants, a burst, nested squares sealed by a bar, drawn as paths in motif.rs), the pad's focus rim, the main button.

  • Library: a row per volume with "Vol. N", the name, the boot file and image name, its state where it needs saying ("Not built yet", "Needs Infection's disc too", "No disc", "Building"; built is said by a lit edge bar and Play), and at most one action: Play, Add disc, Add Infection's disc or Find the disc. A volume with no disc is dimmed but for its action.
  • One build. piney-build makes one shared build (one chunks.pak, a .disc per volume), so the window shows one build, not four. Adding discs (the dialog, a drop, Scan a folder, Find discs, --add-disc) starts the build of the whole library by itself, every disc found but a later volume's without Infection, which its row explains. Discs added while a build or a game runs are built once that ends (one more build; the builder cannot take a disc into a build already running). The panel above the rows holds it: "Building the game from your discs" (or, for the rebuild after an update, "Updating the game data") with one overall bar, the disc and step being worked on, and Cancel; a failure with its reason, Try again and Open log; "Not built yet" with Build when discs were left unbuilt (a build cancelled); else Play .hack//, its strip lit in the colours of the volumes built, for two or more of them.
  • The frame is the launcher's own (frame.rs): a slim title bar (the drag area; a double click maximises), minimise, maximise and close as line icons (close red under the pointer), a 1px border, resizing from a 5px band along the edges. Linux asks for client-side decorations and draws the frame only when the compositor grants them; otherwise the system's bar stays and this one is not drawn. Windows and macOS get a transparent system title bar with this one drawn under it (macOS keeps its traffic lights). Fullscreen has none.
  • Dialogs are the system's: prompt_for_paths, which is the XDG file chooser portal on Linux (Wayland and X11 alike) and the native dialog on Windows and macOS. GPUI 0.2.2 offers no file-type filter. When the dialog fails, the notice says why and points at drag and drop.
  • The Steam Deck's Game Mode (GAMESCOPE_WAYLAND_DISPLAY set, or SteamGamepadUI=1; piney_game::settings::game_mode): the window is fullscreen, and so is the game unless fullscreen is set. The portal's dialogs do not show where a pad reaches them, so Add discs becomes Find discs (found.rs): the .hack discs beside the program (that folder), in ~/Downloads, ~/Games and ~ (one folder down) and on drives under /run/media (two folders down) are listed, each added with A. The save folder can only be reset there.
  • Pad and keys (nav.rs): the gamepads are read through piney_game::input, the game's own gilrs reading, every 20 ms while the window is in front and no game runs. The D-pad or the left stick (past half way, by its larger axis) moves the focus; Cross (A) chooses, Circle (B) goes back, L1 and R1 turn the pages; a held direction repeats after 400 ms, then every 110 ms. The keyboard's arrows, Enter or Space, Escape or Backspace and Page Up / Down do the same. A page's focus places are rows of items, one row per part of the page; up and down keep the item where they can, left from a row's first item goes to the column of pages. The focus is drawn (a solid rim) after a pad or key moves it, and the pad's hints show in the column while a pad is the last input.
  • The column ends with the repository's link and the version. Logs and help has the data folder's path and links to the repository, its Releases and its Issues.
  • A new version (update.rs): at start, unless Settings' "Check GitHub for a new version at start" is off (check_for_updates = false in launcher.toml), one GET of the repository's releases/latest on a thread, through GPUI's own reqwest (rustls, ring, the system's roots), blocking, ten seconds at most. A published tag newer than the crate's version (semver) puts a panel at the top of the Library: Get it opens the release page, Skip this version writes skip_version. A failure or no network is a line in the launcher's log only. Nothing downloads or replaces the program.

Settings

One table. piney_game::settings::table::TABLE declares every setting once: its key in settings.toml, its kind (a switch, a choice from a list, an integer or float range with a step, a volume), its default (and, for fullscreen, the Steam Deck Game Mode's), its section, its label and one line for players, its flags, whether it is kept in the save's option block too, whether the console changes it in a running game, and whether the page shows it. The launcher's Settings page, the game's reading and writing of settings.toml, the game's flags and its console all read it. Key names the rows; Settings holds the values given (by the file, a flag or a page), the rest taking their defaults; Display is the typed view the game sets its window and picture up from.

keysectionvaluesdefaultflag
fullscreenDisplaytrue or falsefalse; true in Game Mode--fullscreen, --windowed
render_scaleDisplay1 to 81--render-scale N
hud_scaleDisplay0.5 to 1 by 0.051--hud-scale N
vsyncDisplaytrue or falsetrue--no-vsync
fps_capDisplay0 (none), 30, 60, 90, 120, 144, 165, 240 (any N read)0--fps-cap N
deflickerDisplaytrue or falsefalse--deflicker
screen_x, screen_yDisplay-48 to 48 by 3, -16 to 16 by 10
window_width, window_height(not shown)320 to 16384 logical pixels960, 720
main_volume, se_volume, bgm_volumeSound0 to 256 by 8 (the Sound page's 32 steps)256
sound_outputSound1 stereo, 0 mono1
voiceSound1 English, 0 Japanese1--voice en or jp
vibrationControls1 on, 0 off1
controller_typeControls0 to 3: A-1, A-2, B-1, B-20
field_cameraControls3 follow, 1 eye view3
message_windowGameplay1 on, 0 off (the Movie Text option)1
data_drain_movieGameplay1 on, 0 off1
map_modeGameplaythe towns' map: 0 shown, 1 hidden0
disc_speedGameplay0 instant, else DVD 1x multiples (1 to 8 listed, any read)0--dvd [SPEED], --cdrom [SPEED]

The thirteen kept in the save's option block (the volumes, output, screen, vibration, controller_type, voice, message_window, data_drain_movie, field_camera, map_mode) default to what a new save holds, and a test holds them to it.

The file. name = value lines, with # notes. A save's option is written as the number the save holds (as 0.1.0 wrote it, so an older piney still reads it), the port's own as true/false or a number. Reading takes the last line of each name it can read; a line it cannot read, or a name it does not know, gives nothing. A save's value is kept as written even outside its menu's list (a hand edit), but for an on/off option any number but 0 reads as on and is written back as 1; the port's own are put in range. Writing changes only the names asked for: the file is written back grouped under # Display, # Sound, # Controls and # Gameplay, each other line as it was (a note after it too), and names piney does not know kept at the end. A setting reset is taken out of the file, so it takes its default.

Who writes it. The game's Option menus (the thirteen, whenever a menu changes one), F11 and Alt+Enter (fullscreen), the game's window as it closes (window_width and window_height, when the player resized it out of fullscreen and not maximised), and the launcher's Settings page. A flag gives its setting a value for that run only, over the file's, and is never written back; so do the console's commands (fullscreen, render_scale, hud_scale, vsync, fps_cap, deflicker, each refusing a value out of range, and settings, which lists every setting as the run has it). --voice goes through the game's voice override, over the save's own as well. A headless run (--shot, --webp) reads no file: the defaults, under its flags.

The page. A section per group of the table (Display, Sound, Controls, Gameplay), then the launcher's own: Saves and Updates, kept in launcher.toml. Each row is the label, its line in muted text and a control chosen by the kind (Kind::control): a switch for on and off, the choices side by side for two to four, a stepper for a longer list, a slider with its value for a range or a volume (a press or a drag on the track sets the step under it). Left and right change the row with the focus, A flips a switch or takes the next choice round, B goes back to the column; the column shows "Left / Right change" while the pad is in use. Each section's heading has Reset to defaults, which asks first and is greyed while the section is at its defaults. While a game runs the game's rows are dimmed and do not change (it keeps its own copy and writes the file); Saves and Updates still change.

The game's window

The game's window is winit's, 960 x 720 logical pixels unless the file gives another size. Fullscreen is borderless (Fullscreen::Borderless, on the monitor the window is on); F11 or Alt+Enter switches it and writes fullscreen. Neither key reaches the pad (Alt+Enter would be Start). The pointer is hidden while fullscreen, unless the console, with its scroll bar, is open. The picture keeps its 4:3 shape in any window (piney-gs's presenter, black bars on the long sides). Escape still opens the quit prompt and does not leave fullscreen; the close button and the console work as in a window.

The save folder is the memory card the game plays with, passed as --card to every game the launcher starts. By default it is memcard/slot1 in the data folder; Change (a folder dialog) keeps another in launcher.toml. A change is checked first (config::plan): the new folder must be writable and not inside the old one or around it. When the old folder holds saves and the new one is empty, the player chooses to copy them over (the originals stay) or start empty; when both hold saves, nothing is copied or overwritten and the player chooses which folder the game uses. The card's own layout inside the folder is the game's.

The bug report

"Copy bug report" puts these on the clipboard:

  • piney-apples's version (the release tag in CI builds) and piney-game build <commit>;
  • the OS (/etc/os-release's PRETTY_NAME where there is one);
  • the adapter a high-performance request gets, as piney-gs makes it;
  • each volume's boot file and state;
  • the save folder;
  • the newest game or build log's last 40 lines.

The user's home folder is replaced by ~, and the user name by <user> where it stands as a whole word of three letters or more. "Report on GitHub" opens the repository's new-issue page with the same text in its body, cut at 6,000 bytes. The program sends nothing itself.

The AppImage

piney-apples-<version>-x86_64.AppImage is made by crates/piney-launcher/appimage/build.sh with appimagetool 1.9.1 and the type2 runtime 20251108 (both MIT, the AppImage project; release.yml checks their sha256). The AppDir holds the program (stripped), its .desktop file, the icon (drawn for the project, piney-apples.svg and a 256px PNG) and the licences, and nothing else. The release build (Ubuntu 22.04, libwebp static) needs only libasound.so.2, libudev.so.1, libxkbcommon.so.0, libxkbcommon-x11.so.0, libgcc_s, libm and libc, and opens the Vulkan loader, Wayland and the X11 libraries itself: all in SteamOS 3's base system, and none of them ones an AppImage should carry (glibc, the graphics loaders and drivers, the sound libraries). The AppImage is about 17 MB.

Unknown

  • F11 and Alt+Enter were pressed (XTEST) only in an X11 window, in a nested KWin's Xwayland; on Wayland the switch ran from --fullscreen, Game Mode and a replayed console fullscreen off, not from a key.
  • Fullscreen under gamescope on a Deck, on Windows and on macOS has not been seen; only KWin (Wayland and Xwayland) has.
  • Whether GPUI's window shows on every Linux desktop the release reaches: it was run on KDE Plasma under Wayland and XWayland only.
  • The AppImage and the pad navigation have not run on a Steam Deck: Game Mode was imitated with SteamGamepadUI=1 and the pad with a uinput Xbox 360 pad. Whether Steam's default controller layout for a non-Steam game sends the pad (rather than mouse and keys) is the Deck's to show.
  • The client-side frame on GNOME and on Windows has not been seen; macOS's only has to build from source and has not been built here.
  • The Windows executable has not been run yet. CI's release workflow builds it for x86_64-pc-windows-msvc; locally the launcher was checked against x86_64-pc-windows-gnu, since the Linux machine has no MSVC SDK for the C dependencies' build scripts.

How this was found out

docs/port/launcher.md