Skip to content

pineapple-pager-projects/pineapple_pager_tetris

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tetris for WiFi Pineapple Pager

Classic block-stacking puzzle game for the WiFi Pineapple Pager.

Author: brAinphreAk | brAinphreAk.net

Tetris Demo


Features

  • Two play modes: Left-handed and Right-handed portrait orientations
  • Mode selector: Animated launcher with falling pieces
  • Classic gameplay: All 7 tetrominoes with SRS-style rotation
  • Ghost piece: Shows where your piece will land
  • Scoring system: Points for lines, soft drops, and hard drops
  • Leveling: Speed increases as you clear more lines
  • High score persistence: Saved to /root/loot/tetris_highscore
  • Background music: Korobeiniki (Tetris theme) via RTTTL
  • Sound effects: Line clears, level ups, SMB death sound on game over
  • LED effects: Visual feedback on D-pad and buttons

Screenshots

Payload Starting Loading Mode Select
Payload Loading Mode Select
Game Menu Gameplay Pause Menu Game Over
Menu Gameplay Pause Game Over

Installation

Copy the payloads/user/games/tetris/ directory contents to your Pager:

# Create directory
ssh root@172.16.52.1 "mkdir -p /root/payloads/user/games/tetris"

# Copy all files
scp payloads/user/games/tetris/* root@172.16.52.1:/root/payloads/user/games/tetris/

# Make executable
ssh root@172.16.52.1 "chmod +x /root/payloads/user/games/tetris/*"

Files on Pager

/root/payloads/user/games/tetris/
├── payload.sh          # Entry point for Pager menu
├── tetris_launcher     # Mode selector
├── tetris_portrait_l   # Left-handed game
└── tetris_portrait_r   # Right-handed game

How to Play

Starting

  1. Navigate to Games > Tetris on your Pager
  2. Choose LEFT or RIGHT handed mode
  3. Press GREEN to start

Controls

Hold the Pager sideways (landscape orientation).

Button Left-Handed Right-Handed
UP Move RIGHT Move LEFT
DOWN Move LEFT Move RIGHT
LEFT Rotate Soft drop
RIGHT Soft drop Rotate
GREEN (A) Hard drop Hard drop
RED (B) Pause Pause

Scoring

Action Points
Single line 100 × level
Double 300 × level
Triple 500 × level
Tetris (4 lines) 800 × level

Building from Source

Requirements

OpenWrt SDK for ramips-mt76x8:

wget https://downloads.openwrt.org/releases/24.10.0/targets/ramips/mt76x8/openwrt-sdk-24.10.0-ramips-mt76x8_gcc-13.3.0_musl.Linux-x86_64.tar.zst
tar -xf openwrt-sdk-*.tar.zst
export PATH=/path/to/openwrt-sdk/staging_dir/toolchain-mipsel_24kc_gcc-13.3.0_musl/bin:$PATH

Build & Deploy

# Build (outputs to payloads/user/games/tetris/)
make CROSS_COMPILE=mipsel-openwrt-linux-musl- tetris

# Deploy to Pager
make CROSS_COMPILE=mipsel-openwrt-linux-musl- deploy

Project Structure

pineapple-pager-tetris/
├── src/
│   ├── lib/
│   │   ├── pager_gfx.h       # Graphics library
│   │   └── pager_gfx.c
│   └── tetris/
│       ├── tetris_launcher.c  # Mode selector
│       ├── tetris_portrait_l.c
│       └── tetris_portrait_r.c
├── payloads/user/games/tetris/   # Ready to deploy (mirrors Pager path)
│   ├── payload.sh
│   ├── tetris_launcher           # (built)
│   ├── tetris_portrait_l         # (built)
│   └── tetris_portrait_r         # (built)
├── Makefile
└── README.md

Pager Development Notes

Hardware

Spec Value
CPU MIPS 24KEc @ 580MHz
Display 222×480 RGB565 @ /dev/fb0
Input /dev/input/event0 (evdev)
Max FPS ~20 (SPI limited)

Button Mapping

Important: Physical button A is GREEN (right), button B is RED (left).

Button Color Position Code evdev
A GREEN Right BTN_A KEY_ENTER (28)
B RED Left BTN_B KEY_ESC (1)

Payload Script

Games must stop Pager services to access the framebuffer:

# Stop services before game
/etc/init.d/pineapplepager stop
/etc/init.d/pineapd stop

# Run game
./mygame

# Restart services after
/etc/init.d/pineapplepager start &
/etc/init.d/pineapd start &

The pager_gfx Library

Included in src/lib/, provides:

  • Framebuffer double-buffering
  • Drawing primitives & text
  • Input handling with edge detection
  • Display rotation (0°, 90°, 180°, 270°)
  • RTTTL audio playback

Credits

  • Original Tetris by Alexey Pajitnov
  • Korobeiniki - Traditional Russian folk song

License

Open source. Use and modify freely.

About

Tetris game coded for the hak5 pineapple pager - include LED, Sound, Dual Orientation etc.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors