How libretro/picodrive works
PicoDrive is a multi-system SEGA console emulator. The principal workflow is to select/load game media, emulate the selected console and peripherals, then present video, audio, and input through a platform frontend. CD, 32X, SVP, cartridge hardware, and 8-bit systems are distinct emulation stages; SH-2 recompilation is an internal performance layer. The README documents broad system and input capabilities, while the sampled source only exposes selected implementation links, so undocumented wiring is omitted.
Main entry points: pico.c Console core · pico/memory.c Main memory · main.c Common frontend · cd/memory.c Sega CD
Components 18
Frontends and input
- Common frontend
platform/common/main.c - Libretro frontend
platform/libretro/libretro.c - Input and keyboard
platform/common/input_pico.h
Emulation core
- Emulator engine
platform/common/emu.c - Console core
pico/pico.c - Main memory
pico/memory.c - 8-bit systems
pico/sms.c
Media and peripherals
- Cartridge hardware
pico/carthw/carthw.c - Sega CD
pico/cd/memory.c - CD images
pico/cd/cd_image.c - 32X hardware
pico/32x/32x.c
Audio and video
- Video rendering
pico/draw.c - Sound synthesis
pico/sound/ym2612.c - Audio mixing
pico/sound/mix.c
CPU execution
- 68000 execution
cpu/musashi/m68k_in.c - SH-2 recompilation
cpu/sh2/compiler.c - Host code emitters
cpu/drc/emit_arm.c
Other components
- Player
Connections 22
- Player → Common frontend: starts
platform/common/main.c - Player → Libretro frontend: loads games
README.md - Common frontend → Emulator engine: runs engine
platform/common/main.c - Common frontend → Input and keyboard: initializes input
platform/common/main.c - Emulator engine → Console core: runs emulation
- Console core → Video rendering: renders frames
- Console core → Sound synthesis: produces audio
- Sound synthesis → Audio mixing: mixes audio
- Console core → Main memory: uses memory
- Cartridge hardware → Main memory: uses mappings
pico/carthw/carthw.c - Sega CD → Main memory: uses mappings
pico/cd/memory.c - CD images → Sega CD: provides media
- 32X hardware → Main memory: uses mappings
- Console core → 8-bit systems: supports systems
README.md - Console core → Cartridge hardware: supports hardware
README.md - Console core → Sega CD: supports Sega CD
README.md - Console core → 32X hardware: supports 32X
README.md - Console core → 68000 execution: executes CPU
- Console core → SH-2 recompilation: runs SH-2
README.md - SH-2 recompilation → Host code emitters: emits host code
cpu/sh2/compiler.c - Libretro frontend → CD images: loads CD media
platform/libretro/libretro.c - Player → Input and keyboard: controls emulator
README.md