How kxtzownsu/gscemulator-c works
better-gscemu is a standalone C rewrite of GSCEmulator, not a library. Its visible workflow parses command-line options, selects H1B3C, initializes Unicorn with the BootROM and CPU state, starts emulation, then shuts down. The source also shows reusable MMIO component registration and a FOOBAR peripheral. Peripheral initialization is invoked by the emulator, but the sampled excerpts do not establish how individual peripheral implementations are wired or mapped.
Main entry points: emulator.c Unicorn emulator · main.c CLI entry · file.c File reader · libargs.c Argument parser
Components 12
Command line
- CLI entry
src/main.c - Argument parser
src/libargs.c
Emulator core
- Unicorn emulator
src/H1B3C/emulator.c
H1B3C platform
- Peripheral initialization
src/H1B3C/peripherals/_init.c - FOOBAR peripheral
src/H1B3C/peripherals/foobar.c
Shared runtime
- Runtime context
src/common/ctx.c - File reader
src/common/file.c - MMIO components
src/common/peripherals/component.c - Logging
src/common/logger.c
Other components
- Operator
- Unicorn engine
- BootROM file
Connections 13
- Operator → CLI entry: provides options
src/main.c - CLI entry → Argument parser: parses flags
src/main.c - CLI entry → Runtime context: initializes context
src/main.c - CLI entry → Unicorn emulator: selects and starts
src/main.c - Argument parser → CLI entry: returns values
src/main.c - Unicorn emulator → Unicorn engine: configures and runs
src/H1B3C/emulator.c - BootROM file → File reader: supplies bytes
- Unicorn emulator → File reader: reads BootROM
src/H1B3C/emulator.c - Unicorn emulator → Peripheral initialization: initializes peripherals
src/H1B3C/emulator.c - FOOBAR peripheral → MMIO components: registers component
src/H1B3C/peripherals/foobar.c - MMIO components → Unicorn engine: maps MMIO callbacks
src/common/peripherals/component.c - Unicorn emulator → Logging: logs emulator events
src/H1B3C/emulator.c - File reader → Logging: logs file errors
src/common/file.c