Updated GB_set_boot_rom_load_callback (markdown)

Lior Halphon 2024-11-24 23:56:18 +02:00
parent e9dbe9a66d
commit b63f60d33a
1 changed files with 22 additions and 6 deletions

@ -1,9 +1,5 @@
## Definition
```c
typedef void (*GB_boot_rom_load_callback_t)(GB_gameboy_t *gb, GB_boot_rom_t type);
```
```c
typedef enum {
GB_BOOT_ROM_DMG_0,
@ -19,14 +15,34 @@ typedef enum {
} GB_boot_rom_t;
```
<tt>void GB_set_boot_rom_load_callback([[GB_gameboy_t]] *gb, [[GB_boot_rom_load_callback_t]] callback);</tt>
<tt>typedef void (*GB_boot_rom_load_callback_t)([[GB_gameboy_t]] *gb, GB_boot_rom_t type);</tt>
<tt>void GB_set_boot_rom_load_callback([[GB_gameboy_t]] *gb, GB_boot_rom_load_callback_t callback);</tt>
In `gb.h`
## Description
TBD
Sets an optional, but recommended callback that lets the emulator instance request a specific boot ROM. This callback is required to allow the `GB_BORDER_ALWAYS` [[border mode|GB_set_border_mode]] to use Super Game Boy borders while emulating a non-Super Game Boy model. When the callback is called, the callee must call either [[GB_load_boot_rom]] or [[GB_load_boot_rom_from_buffer]] to load a suitable boot ROM before returning.
The possible values for `GB_boot_rom_t` are:
* `GB_BOOT_ROM_DMG_0`: A boot ROM for the original DMG revision, usually saved as `dmg0_boot.bin`
* `GB_BOOT_ROM_DMG`: A boot ROM for all other DMG revisions, usually saved as `dmg_boot.bin`
* `GB_BOOT_ROM_MGB`: A boot ROM for the MGB, usually saved as `mgb_boot.bin`
* `GB_BOOT_ROM_SGB`: A boot ROM for the SGB, usually saved as `sgb_boot.bin`
* `GB_BOOT_ROM_SGB2`: A boot ROM for the SGB2, usually saved as `sgb2_boot.bin`
* `GB_BOOT_ROM_CGB_0`: A boot ROM for the original CGB revision, usually saved as `cgb0_boot.bin`
* `GB_BOOT_ROM_CGB`: A boot ROM for the CGB revisions A to D, usually saved as `cgb_boot.bin`
* `GB_BOOT_ROM_CGB_E`: A boot ROM for CGB revision E, usually saved as `cgbE_boot.bin`
* If this boot ROM revision is not available, the callback can safely fall-back to treating this value as `GB_BOOT_ROM_CGB`.
* `GB_BOOT_ROM_AGB_0`: A boot ROM for the original AGB revision, usually saved as `agb0_boot.bin`
* If this boot ROM revision is not available, the callback can safely fall-back to treating this value as `GB_BOOT_ROM_AGB`.
* `GB_BOOT_ROM_AGB`: A boot ROM for all other AGB revisions, usually saved as `agb_boot.bin`
## Thread Safety
`GB_set_boot_rom_load_callback` is thread-safe and can be called from any thread and context.
## See Also
* [[GB_load_boot_rom]]
* [[GB_load_boot_rom_from_buffer]]