This is a fork of the Genesis Plus GX emulator, modified to run as a headless console application that exposes shared memory for external programs to access. This version allows for easy integration with other applications, making it suitable for various use cases such as game analysis, AI training, or custom frontend development.
- Headless operation (no GUI)
- Shared memory interfaces for video, audio, and input
- Support for Sega Genesis/Mega Drive, Sega CD, and Master System
- High compatibility and accuracy
To build the emulator, you'll need GCC and standard development libraries. Follow these steps:
- Clone this repository
- Navigate to the project directory
- Run
make -f MakeFile.headless
The build process will create an executable named gx_headless
in the project directory.
Run the emulator from the command line:
./gx_headless <path_to_rom>
The emulator exposes several shared memory segments for external applications to interact with:
-
Video Frame Data:
/genesis_frame
- Size: 320x240x4 bytes (RGBA format)
- Updated every frame
-
Audio Data:
/genesis_sound
- Structure:
sound_shared_mem_t
- Contains latest audio samples
- Structure:
-
Input Data:
/genesis_input
- Size: 2 bytes (16-bit integer)
- Write to this to send input to the emulator
-
Control Commands:
/genesis_control
- Size: 4 bytes (32-bit integer)
- Used for save states, loading states, and reset commands
-
Audio Channel Control:
- PSG Channels:
/genesis_psg_channels
- YM2612 Channels:
/genesis_ym2612_channels
- YM2413 Channels:
/genesis_ym2413_channels
- Each is 64 bytes (16 int32 values)
- PSG Channels:
setup_shared_memory()
: Initializes shared memory for video framessetup_sound_shared_memory()
: Sets up shared memory for audio datasetup_input_shared_memory()
: Creates shared memory for input datasetup_control_shared_memory()
: Establishes shared memory for control commandsoutput_frame_data()
: Writes the current frame to shared memoryoutput_sound_data()
: Outputs audio samples to shared memoryhandle_control_commands()
: Processes control commands (save/load state, reset)
To integrate with this emulator:
- Open the shared memory segments in your application
- Read frame data and audio samples as needed
- Write input data to control the emulator
- Use control commands for save states and resets
This project is licensed under the same terms as the original Genesis Plus GX emulator. Please refer to the original project for more details.
This fork is based on the excellent work of the Genesis Plus GX team. All credit for the core emulation goes to them.
Refine sound channel isolation logic for psg.c, ym2413.c, ym2612.c