An gb_init_ex() function will be created that takes in a struct as a parameter. Using a struct will allow for new fields to be added in new versions of Peanut-GB without the frontends requiring any update provided that all fields are initialised to 0. Hence, the value 0 is considered as an 'unset' value and Peanut-GB will either not enable the corresponding feature or will use default behaviour.
struct gb_s gb;
struct pgb_init i = { .ver = PGB_INIT_VERSION, .console_type = PGB_CONSOLE_DMG };
int ret = gb_init_ex(&gb, &i);
Where PGB_INIT_VERSION is initially 1, and will allow for future instances where the behaviour of existing fields might change.
The use of gb_init_ex will allow for new features to be added to Peanut-GB without API change, including Game Boy Color support.
This struct will initially include:
struct {
int ver;
pgb_console_type_e console_type; /* PGB_CONSOLE_DMG, PGB_CONSOLE_MGB. */
pgb_cgb_s cgb; /* Additional RAM required for CGB emulation. */
lcd_draw_line_fn lcd_draw_line;
pgb_bootrom_read_fn bootrom_read_fn; /* NULL or function that reads byte from bootrom that corresponds to console_type. */
/* Probably more to be added. */
} pgb_init;
An gb_init_ex() function will be created that takes in a struct as a parameter. Using a struct will allow for new fields to be added in new versions of Peanut-GB without the frontends requiring any update provided that all fields are initialised to 0. Hence, the value 0 is considered as an 'unset' value and Peanut-GB will either not enable the corresponding feature or will use default behaviour.
Where
PGB_INIT_VERSIONis initially 1, and will allow for future instances where the behaviour of existing fields might change.The use of gb_init_ex will allow for new features to be added to Peanut-GB without API change, including Game Boy Color support.
This struct will initially include: