# Applications and Services

## Game Entry Points

Top-level symlinks:

| Path | Target |
| --- | --- |
| `/games/game` | `pokemon_pro/game` |
| `/games/conagent` | `pokemon_pro/conagent` |
| `/games/data` | `pokemon_pro/data` |
| `/games/spike3` | `pokemon_pro/spike3` |

Main executables:

| Path | Type | Size |
| --- | --- | ---: |
| `/games/pokemon_pro/game` | Stripped AArch64 PIE, dynamically linked | 52,829,400 |
| `/games/pokemon_pro/conagent` | Stripped AArch64 PIE, dynamically linked | 272,432 |
| `/games/pokemon_pro/spike3/bin/dprint` | Stripped AArch64 PIE, dynamically linked | see artifact index |
| `/games/pokemon_pro/spike3/bin/boot_display` | Stripped AArch64 PIE, dynamically linked | see artifact index |
| `/games/pokemon_pro/spike3/bin/bttest` | Stripped AArch64 PIE, dynamically linked | see artifact index |
| `/games/pokemon_pro/spike3/spike_menu/game` | Stripped AArch64 PIE, dynamically linked | 4,645,784 |
| `/games/pokemon_pro/spike3/netbridge/netbridge.elf` | 32-bit ARM statically linked ELF with debug info, not stripped | see artifact index |

Large payloads:

- `/games/pokemon_pro/image.bin`: 1,154,884,359 bytes.
- `/games/pokemon_pro/assets/godot/main.pck`: 256,326,416 bytes.
- `/games/pokemon_pro/spike3/spike_menu/image.bin`: 14,959,521 bytes.

Asset extraction status:

- `/games/pokemon_pro/assets/godot/main.pck` has been statically extracted into workspace-local `assets/`; see `godot-and-radium-assets.md`.
- `/games/pokemon_pro/image.bin` did not expose standard media signatures in first-pass static scans and remains a Radium/runtime image reverse-engineering target.

## Game Data

Release-note files:

- `/games/pokemon_pro/data/pro_release_notes.txt`
- `/games/pokemon_pro/data/premium_release_notes.txt`

Version hints:

- `/games/spk/index/pokemon_pro.sidx -> pokemon_pro-0_83_0.sidx`
- `/games/pokemon_pro/data/*_release_notes.txt` match the Pokemon Pro/Premium title.

Bundled node firmware images:

- `coil4node-LPC1112_101-1_33_0.hex`
- `pinnode-LPC1112_101-1_33_0.hex`
- `hdmi_ws2812node-LPC1313-1_33_0.hex`
- `tmc5041node-LPC1313-1_33_0.hex`
- `pinnode-LPC1313-1_33_0.hex`
- `lcdnode-LPC1113_302-1_33_0.hex`
- `coil4_lednode-LPC1313-1_33_0.hex`
- `coil4node-LPC1313-1_33_0.hex`
- `magsensornode-LPC812-1_33_0.hex`
- `hdminode-LPC1313-1_33_0.hex`
- `ws2812pinnode-LPC1313-1_33_0.hex`
- `node4-LPC1124_303-1_33_0.hex`
- `node4-LPC812-1_33_0.hex`
- `ws2812node-LPC1313-1_33_0.hex`
- `pinnode-LPC1112_201-1_33_0.hex`
- `coil4node-LPC1112_201-1_33_0.hex`
- `tmc2590node-LPC1313-1_33_0.hex`

These are likely firmware payloads for distributed SPIKE node boards.

## Monitors

`/etc/init.d/S95game` starts these in the background when `/games/game` exists:

- `/etc/init.d/reboot_monitor`
- `/etc/init.d/conagent_monitor`
- `/etc/init.d/game_monitor`
- `/etc/init.d/update`

`game_monitor`:

- Starts `/games/game`.
- Interprets game exit codes:
  - `0`: restart requested.
  - `1`: reboot requested.
  - `2`: exit requested, development-only control-C path.
  - `3`: power loss.
  - `4`: fatal error.
  - `5`: dispatch timeout.
  - `6`: deep sleep.
  - `>=128`: uncaught signal, encoded as `exit_reason - 128`.
- On power loss or deep sleep, syncs filesystems, remounts `/data` and `/connectivity` read-only, and hangs waiting for power removal.
- On reboot request, syncs, remounts persistent filesystems read-only, calls `/sbin/reboot -f`, and hangs.
- On repeated fatal/non-normal exits, tracks restart sentinels under `/tmp/game_restarts`.
- After more than 4 restart sentinels, clears selected `/connectivity` caches. If cache was already cleared and restart pressure continues, it reboots.

`conagent_monitor`:

- Loops forever.
- Starts `/games/conagent`.
- Sleeps one second and restarts it whenever it exits.

`reboot_monitor`:

- Tracks machine reboots under `/connectivity/machine_reboots`.
- If more than 9 reboot markers exist before the system reaches 5 minutes uptime, it clears selected `/connectivity` caches.
- Creates a reboot marker, sleeps 300 seconds, then clears reboot markers.

## Display Utilities

`/etc/init.d/shared` resolves:

- `BOOT_DISPLAY=/games/spike3/bin/boot_display`, fallback `/usr/local/spike/boot_display`.
- `DPRINT=/games/spike3/bin/dprint`, fallback `/usr/local/spike/dprint`.

`boot_display` is launched early by `S12lvds_panel`; `dprint` is used by startup/update scripts to print messages to the boot display.

## Bluetooth Support Scripts

Bundled scripts under `/games/pokemon_pro/spike3/scripts`:

- `find_trusted_devices.sh`: walks `/var/lib/bluetooth` and prints device directories whose `info` contains `Trusted=true`.
- `find_untrusted_devices.sh`: walks `/var/lib/bluetooth` and prints devices missing that trusted marker.
- `copy_newest_corefile_to_usb.sh`: archives the newest core file from `/connectivity/dump/cores` into an encrypted 7z file and copies it to `/media` after mounting `/dev/sda1` or `/dev/sda`.

Sensitive note: `copy_newest_corefile_to_usb.sh` reads a passphrase from `/games/spike3/scripts/corefile_passphrase.txt`; the value is not copied into this wiki.

## Netbridge / Debug Hardware

`/games/pokemon_pro/spike3/netbridge` contains:

- `netbridge.elf`: 32-bit ARM static executable with debug info, not stripped.
- `rp2040.cfg`: OpenOCD RP2040 target config.
- `spike3-swd.cfg`: OpenOCD config using `bcm2835gpio`.

`spike3-swd.cfg` maps:

- SWCLK to GPIO 11.
- SWDIO to GPIO 10.

This is a strong next target for understanding how the Pi interfaces with an RP2040 or other debug bridge in the machine.
