How victorsanchesdealmeida/gba-emulator-for-android works
GBA Emulator is a Game Boy Advance player: the user selects a ROM, the app supplies its bundled BIOS, and the native Rust core runs the game and returns video/audio while accepting button input. The README documents automatic cartridge-save restoration and persistence. The sampled excerpts establish the emulator’s peripheral and BIOS behavior; some UI-to-native details and peripheral wiring are documented but not shown in full, so the graph omits uncertain call links.
Main entry points: mod.rs Frame runner · index.tsx Game screen · lib.rs Rust FFI · GbaEmulatorModule.kt Android module
Components 23
Expo app
- Game screen
src/app/index.tsx
Native interface
- JS module
modules/gba-emulator/src/GbaEmulatorModule.ts - Emulator view
modules/gba-emulator/src/GbaEmulatorView.tsx - Android module
modules/gba-emulator/android/src/main/java/expo/modules/gbaemulator/GbaEmulatorModule.kt - Android view
modules/gba-emulator/android/src/main/java/expo/modules/gbaemulator/GbaEmulatorView.kt - JNI bridge
modules/gba-emulator/android/src/main/java/expo/modules/gbaemulator/GbaNative.kt - Rust FFI
native/ffi/src/lib.rs
Emulation core
- Frame runner
core/src/emulator/mod.rs - Memory bus
core/src/memory/bus.rs
GBA hardware
- ARM7TDMI CPU
core/src/cpu/mod.rs - BIOS emulation
core/src/bios/mod.rs - Cartridge
core/src/cartridge/cartridge.rs - Save memory
core/src/cartridge/save/mod.rs - Graphics
core/src/ppu/mod.rs - Audio
core/src/apu/mod.rs - DMA channels
core/src/dma/mod.rs - Timers
core/src/timer/mod.rs - Interrupt controller
core/src/interrupts/mod.rs - Joypad
core/src/joypad/mod.rs
Other components
- Player
- ROM file
- Bundled BIOS
- Save files
Connections 32
- Player → Game screen: operates
- Player → ROM file: chooses
- ROM file → Game screen: loads
- Bundled BIOS → Game screen: supplies BIOS
- Game screen → JS module: controls session
- Game screen → Emulator view: renders view
- Emulator view → Android view: hosts view
- JS module → Android module: invokes
- Android module → JNI bridge: calls native
- JNI bridge → Rust FFI: dispatches
- Rust FFI → Frame runner: runs frames
- Frame runner → ARM7TDMI CPU: steps
- ARM7TDMI CPU → Memory bus: reads and writes
- Frame runner → Memory bus: ticks hardware
- Memory bus → Cartridge: accesses ROM
- Cartridge → Save memory: uses save type
- Frame runner → BIOS emulation: handles SWI and IRQ
- Frame runner → Graphics: advances
- Frame runner → Timers: advances
- Frame runner → Audio: ticks and samples
- Frame runner → DMA channels: dispatches transfers
- Frame runner → Interrupt controller: checks pending IRQ
- Frame runner → Joypad: sends button events
- Graphics → Interrupt controller: requests events
- Timers → Interrupt controller: requests overflow
- DMA channels → Interrupt controller: requests completion
- Rust FFI → Graphics: reads frame output
- Rust FFI → Audio: samples audio
- Rust FFI → Save memory: loads and exports data
- Save files → Android module: read and written by
- Android module → Save files: persists saves
- Game screen → Save files: derives save path