Implement peripherals that may be connected to the Game Boy serial port. Then allow the front-end to select which peripheral is connected.
Example below:
enum serial_peripherals {
SERIAL_NOT_CONNECTED, /* Emulate no serial device connected (Default). */
SERIAL_PRINTER, /* Emulate printer connected. */
SERIAL_EXTERNAL /* Send serial output to front-end (eg. for multiplayer). */
};
/* Must be set before switching to printer peripheral. */
int gb_serial_printer_init((void printer_output)(gb_t *gb, uint8_t *buffer));
/* To set the connected peripheral. Returns error if peripheral not initialised. */
int gb_serial_set_peripheral(enum serial_peripherals);
Implement peripherals that may be connected to the Game Boy serial port. Then allow the front-end to select which peripheral is connected.
Example below: