From 79e3cbdd03897caeec1b9779b33b4a6b4360f9ac Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sun, 24 Nov 2024 21:57:04 +0200 Subject: [PATCH] Initial API reference commit Initial Home page Initial API reference progress --- Built-In DMG Palettes.md | 23 ++ GB_BIG_ENDIAN.md | 9 + GB_CHEAT_ANY_BANK.md | 9 + GB_ENUM.md | 9 + GB_LITTLE_ENDIAN.md | 9 + GB_accessory_t.md | 15 + GB_add_cheat.md | 13 + GB_apu_set_sample_callback.md | 17 ++ GB_attributed_log.md | 13 + GB_audio_format_t.md | 15 + GB_camera_updated.md | 13 + GB_cheat_search_data_type_t.md | 16 ++ GB_cheat_search_filter.md | 13 + GB_cheat_search_get_results.md | 13 + GB_cheat_search_reset.md | 13 + GB_cheat_search_result_count.md | 13 + GB_cheat_search_result_t.md | 15 + GB_cheat_t.md | 19 ++ GB_cheats_enabled.md | 13 + GB_clear_joyp_accessed.md | 13 + GB_connect_printer.md | 13 + GB_connect_workboy.md | 13 + GB_convert_rgb15.md | 13 + GB_cpu_disassemble.md | 13 + GB_debugger_break.md | 13 + GB_debugger_clear_symbols.md | 13 + GB_debugger_complete_substring.md | 13 + GB_debugger_describe_address.md | 13 + GB_debugger_evaluate.md | 13 + GB_debugger_execute_command.md | 13 + GB_debugger_is_stopped.md | 13 + GB_debugger_load_symbol_file.md | 13 + GB_debugger_name_for_address.md | 13 + GB_debugger_set_disabled.md | 13 + GB_debugger_set_reload_callback.md | 17 ++ GB_disconnect_serial.md | 13 + GB_draw_tilemap.md | 13 + GB_draw_tileset.md | 21 ++ GB_gameboy_t.md | 18 ++ GB_gbs_info_t.md | 17 ++ GB_gbs_switch_track.md | 13 + GB_get_apu_wave_table.md | 13 + GB_get_built_in_accessory.md | 13 + GB_get_channel_amplitude.md | 13 + GB_get_channel_edge_triggered.md | 13 + GB_get_channel_period.md | 13 + GB_get_channel_volume.md | 13 + GB_get_cheats.md | 13 + GB_get_clock_rate.md | 13 + GB_get_direct_access.md | 30 ++ GB_get_joyp_accessed.md | 13 + GB_get_model.md | 13 + GB_get_oam_info.md | 13 + GB_get_pixels_output.md | 9 + GB_get_player_count.md | 13 + GB_get_registers.md | 13 + GB_get_rom_crc32.md | 13 + GB_get_rom_title.md | 13 + GB_get_save_state_size.md | 13 + ...t_screen_width and GB_get_screen_height.md | 15 + GB_get_state_model.md | 13 + GB_get_state_model_from_buffer.md | 13 + GB_get_unmultiplied_clock_rate.md | 13 + GB_get_usual_frame_rate.md | 13 + GB_has_accelerometer.md | 13 + GB_icd_set_joyp.md | 13 + GB_import_cheat.md | 13 + GB_inline_const.md | 9 + GB_is_cgb.md | 13 + GB_is_cgb_in_cgb_mode.md | 13 + GB_is_channel_muted.md | 13 + GB_is_hle_sgb.md | 13 + GB_is_odd_frame.md | 13 + GB_is_save_state.md | 13 + GB_is_sgb.md | 13 + GB_key_mask_t.md | 22 ++ GB_key_t.md | 21 ++ GB_likely.md | 9 + GB_load_battery.md | 13 + GB_load_battery_from_buffer.md | 13 + GB_load_boot_rom.md | 13 + GB_load_boot_rom_from_buffer.md | 13 + GB_load_cheats.md | 13 + GB_load_gbs.md | 13 + GB_load_gbs_from_buffer.md | 13 + GB_load_isx.md | 13 + GB_load_rom.md | 13 + GB_load_rom_from_buffer.md | 13 + GB_load_state.md | 13 + GB_load_state_from_buffer.md | 13 + GB_log.md | 13 + GB_log_attributes_t.md | 16 ++ GB_map_type_t.md | 15 + GB_model_t.md | 47 ++++ GB_oam_info_t.md | 16 ++ GB_palette_t.md | 15 + GB_palette_type_t.md | 16 ++ GB_print_image_callback_t.md | 16 ++ GB_printer_done_callback_t.md | 11 + GB_quick_reset.md | 13 + GB_random_seed.md | 13 + GB_random_set_enabled.md | 13 + GB_read_memory.md | 13 + GB_registers_t.md | 68 +++++ GB_remove_all_cheats.md | 13 + GB_remove_cheat.md | 13 + GB_reset.md | 13 + GB_rewind_pop.md | 13 + GB_rewind_reset.md | 13 + GB_rom_supports_alarms.md | 13 + GB_run.md | 13 + GB_run_frame.md | 13 + GB_safe_read_memory.md | 13 + GB_sample_t.md | 15 + GB_save_battery.md | 13 + GB_save_battery_size.md | 13 + GB_save_battery_to_buffer.md | 13 + GB_save_cheats.md | 13 + GB_save_state.md | 13 + GB_save_state_to_buffer.md | 13 + GB_serial_get_data_bit.md | 17 ++ GB_serial_set_data_bit.md | 17 ++ GB_set_accelerometer_values.md | 13 + GB_set_allow_illegal_inputs.md | 13 + GB_set_background_rendering_disabled.md | 15 + GB_set_boot_rom_load_callback.md | 32 +++ GB_set_border_mode.md | 21 ++ GB_set_camera_get_pixel_callback.md | 18 ++ GB_set_camera_update_request_callback.md | 17 ++ GB_set_channel_muted.md | 9 + GB_set_cheats_enabled.md | 13 + GB_set_clock_multiplier.md | 13 + GB_set_color_correction_mode.md | 25 ++ GB_set_emulate_joypad_bouncing.md | 13 + GB_set_execution_callback.md | 17 ++ GB_set_highpass_filter_mode.md | 22 ++ GB_set_icd_hreset_callback.md | 17 ++ GB_set_icd_pixel_callback.md | 17 ++ GB_set_icd_vreset_callback.md | 17 ++ GB_set_infrared_callback.md | 17 ++ GB_set_infrared_input.md | 13 + GB_set_input_callback.md | 19 ++ GB_set_interference_volume.md | 13 + GB_set_joyp_write_callback.md | 17 ++ GB_set_key_mask.md | 13 + GB_set_key_mask_for_player.md | 13 + GB_set_key_state.md | 13 + GB_set_key_state_for_player.md | 13 + GB_set_lcd_line_callback.md | 17 ++ GB_set_lcd_status_callback.md | 17 ++ GB_set_light_temperature.md | 13 + GB_set_log_callback.md | 17 ++ GB_set_object_rendering_disabled.md | 15 + GB_set_open_bus_decay_time.md | 13 + GB_set_palette and GB_get_palette.md | 15 + GB_set_pixels_output.md | 13 + GB_set_read_memory_callback.md | 17 ++ GB_set_rendering_disabled.md | 13 + GB_set_rewind_length.md | 13 + GB_set_rgb_encode_callback.md | 17 ++ GB_set_rtc_mode.md | 20 ++ GB_set_rtc_multiplier.md | 13 + GB_set_rumble_callback.md | 17 ++ GB_set_rumble_mode.md | 21 ++ GB_set_sample_rate.md | 17 ++ GB_set_serial_transfer_bit_end_callback.md | 21 ++ GB_set_serial_transfer_bit_start_callback.md | 21 ++ GB_set_turbo_mode.md | 13 + GB_set_update_input_hint_callback.md | 17 ++ GB_set_user_data and GB_get_user_data.md | 15 + GB_set_vblank_callback.md | 26 ++ GB_set_write_memory_callback.md | 17 ++ GB_start_audio_recording.md | 13 + GB_stop_audio_recording.md | 13 + GB_switch_model_and_reset.md | 13 + GB_time_to_alarm.md | 13 + GB_unlikely.md | 9 + GB_update_cheat.md | 13 + GB_workboy_is_enabled.md | 13 + GB_workboy_set_key.md | 13 + GB_write_memory.md | 13 + Home.md | 266 ++++++++++++++++++ IO Register Constants.md | 129 +++++++++ Instance Allocation.md | 57 ++++ 184 files changed, 3143 insertions(+) create mode 100644 Built-In DMG Palettes.md create mode 100644 GB_BIG_ENDIAN.md create mode 100644 GB_CHEAT_ANY_BANK.md create mode 100644 GB_ENUM.md create mode 100644 GB_LITTLE_ENDIAN.md create mode 100644 GB_accessory_t.md create mode 100644 GB_add_cheat.md create mode 100644 GB_apu_set_sample_callback.md create mode 100644 GB_attributed_log.md create mode 100644 GB_audio_format_t.md create mode 100644 GB_camera_updated.md create mode 100644 GB_cheat_search_data_type_t.md create mode 100644 GB_cheat_search_filter.md create mode 100644 GB_cheat_search_get_results.md create mode 100644 GB_cheat_search_reset.md create mode 100644 GB_cheat_search_result_count.md create mode 100644 GB_cheat_search_result_t.md create mode 100644 GB_cheat_t.md create mode 100644 GB_cheats_enabled.md create mode 100644 GB_clear_joyp_accessed.md create mode 100644 GB_connect_printer.md create mode 100644 GB_connect_workboy.md create mode 100644 GB_convert_rgb15.md create mode 100644 GB_cpu_disassemble.md create mode 100644 GB_debugger_break.md create mode 100644 GB_debugger_clear_symbols.md create mode 100644 GB_debugger_complete_substring.md create mode 100644 GB_debugger_describe_address.md create mode 100644 GB_debugger_evaluate.md create mode 100644 GB_debugger_execute_command.md create mode 100644 GB_debugger_is_stopped.md create mode 100644 GB_debugger_load_symbol_file.md create mode 100644 GB_debugger_name_for_address.md create mode 100644 GB_debugger_set_disabled.md create mode 100644 GB_debugger_set_reload_callback.md create mode 100644 GB_disconnect_serial.md create mode 100644 GB_draw_tilemap.md create mode 100644 GB_draw_tileset.md create mode 100644 GB_gameboy_t.md create mode 100644 GB_gbs_info_t.md create mode 100644 GB_gbs_switch_track.md create mode 100644 GB_get_apu_wave_table.md create mode 100644 GB_get_built_in_accessory.md create mode 100644 GB_get_channel_amplitude.md create mode 100644 GB_get_channel_edge_triggered.md create mode 100644 GB_get_channel_period.md create mode 100644 GB_get_channel_volume.md create mode 100644 GB_get_cheats.md create mode 100644 GB_get_clock_rate.md create mode 100644 GB_get_direct_access.md create mode 100644 GB_get_joyp_accessed.md create mode 100644 GB_get_model.md create mode 100644 GB_get_oam_info.md create mode 100644 GB_get_pixels_output.md create mode 100644 GB_get_player_count.md create mode 100644 GB_get_registers.md create mode 100644 GB_get_rom_crc32.md create mode 100644 GB_get_rom_title.md create mode 100644 GB_get_save_state_size.md create mode 100644 GB_get_screen_width and GB_get_screen_height.md create mode 100644 GB_get_state_model.md create mode 100644 GB_get_state_model_from_buffer.md create mode 100644 GB_get_unmultiplied_clock_rate.md create mode 100644 GB_get_usual_frame_rate.md create mode 100644 GB_has_accelerometer.md create mode 100644 GB_icd_set_joyp.md create mode 100644 GB_import_cheat.md create mode 100644 GB_inline_const.md create mode 100644 GB_is_cgb.md create mode 100644 GB_is_cgb_in_cgb_mode.md create mode 100644 GB_is_channel_muted.md create mode 100644 GB_is_hle_sgb.md create mode 100644 GB_is_odd_frame.md create mode 100644 GB_is_save_state.md create mode 100644 GB_is_sgb.md create mode 100644 GB_key_mask_t.md create mode 100644 GB_key_t.md create mode 100644 GB_likely.md create mode 100644 GB_load_battery.md create mode 100644 GB_load_battery_from_buffer.md create mode 100644 GB_load_boot_rom.md create mode 100644 GB_load_boot_rom_from_buffer.md create mode 100644 GB_load_cheats.md create mode 100644 GB_load_gbs.md create mode 100644 GB_load_gbs_from_buffer.md create mode 100644 GB_load_isx.md create mode 100644 GB_load_rom.md create mode 100644 GB_load_rom_from_buffer.md create mode 100644 GB_load_state.md create mode 100644 GB_load_state_from_buffer.md create mode 100644 GB_log.md create mode 100644 GB_log_attributes_t.md create mode 100644 GB_map_type_t.md create mode 100644 GB_model_t.md create mode 100644 GB_oam_info_t.md create mode 100644 GB_palette_t.md create mode 100644 GB_palette_type_t.md create mode 100644 GB_print_image_callback_t.md create mode 100644 GB_printer_done_callback_t.md create mode 100644 GB_quick_reset.md create mode 100644 GB_random_seed.md create mode 100644 GB_random_set_enabled.md create mode 100644 GB_read_memory.md create mode 100644 GB_registers_t.md create mode 100644 GB_remove_all_cheats.md create mode 100644 GB_remove_cheat.md create mode 100644 GB_reset.md create mode 100644 GB_rewind_pop.md create mode 100644 GB_rewind_reset.md create mode 100644 GB_rom_supports_alarms.md create mode 100644 GB_run.md create mode 100644 GB_run_frame.md create mode 100644 GB_safe_read_memory.md create mode 100644 GB_sample_t.md create mode 100644 GB_save_battery.md create mode 100644 GB_save_battery_size.md create mode 100644 GB_save_battery_to_buffer.md create mode 100644 GB_save_cheats.md create mode 100644 GB_save_state.md create mode 100644 GB_save_state_to_buffer.md create mode 100644 GB_serial_get_data_bit.md create mode 100644 GB_serial_set_data_bit.md create mode 100644 GB_set_accelerometer_values.md create mode 100644 GB_set_allow_illegal_inputs.md create mode 100644 GB_set_background_rendering_disabled.md create mode 100644 GB_set_boot_rom_load_callback.md create mode 100644 GB_set_border_mode.md create mode 100644 GB_set_camera_get_pixel_callback.md create mode 100644 GB_set_camera_update_request_callback.md create mode 100644 GB_set_channel_muted.md create mode 100644 GB_set_cheats_enabled.md create mode 100644 GB_set_clock_multiplier.md create mode 100644 GB_set_color_correction_mode.md create mode 100644 GB_set_emulate_joypad_bouncing.md create mode 100644 GB_set_execution_callback.md create mode 100644 GB_set_highpass_filter_mode.md create mode 100644 GB_set_icd_hreset_callback.md create mode 100644 GB_set_icd_pixel_callback.md create mode 100644 GB_set_icd_vreset_callback.md create mode 100644 GB_set_infrared_callback.md create mode 100644 GB_set_infrared_input.md create mode 100644 GB_set_input_callback.md create mode 100644 GB_set_interference_volume.md create mode 100644 GB_set_joyp_write_callback.md create mode 100644 GB_set_key_mask.md create mode 100644 GB_set_key_mask_for_player.md create mode 100644 GB_set_key_state.md create mode 100644 GB_set_key_state_for_player.md create mode 100644 GB_set_lcd_line_callback.md create mode 100644 GB_set_lcd_status_callback.md create mode 100644 GB_set_light_temperature.md create mode 100644 GB_set_log_callback.md create mode 100644 GB_set_object_rendering_disabled.md create mode 100644 GB_set_open_bus_decay_time.md create mode 100644 GB_set_palette and GB_get_palette.md create mode 100644 GB_set_pixels_output.md create mode 100644 GB_set_read_memory_callback.md create mode 100644 GB_set_rendering_disabled.md create mode 100644 GB_set_rewind_length.md create mode 100644 GB_set_rgb_encode_callback.md create mode 100644 GB_set_rtc_mode.md create mode 100644 GB_set_rtc_multiplier.md create mode 100644 GB_set_rumble_callback.md create mode 100644 GB_set_rumble_mode.md create mode 100644 GB_set_sample_rate.md create mode 100644 GB_set_serial_transfer_bit_end_callback.md create mode 100644 GB_set_serial_transfer_bit_start_callback.md create mode 100644 GB_set_turbo_mode.md create mode 100644 GB_set_update_input_hint_callback.md create mode 100644 GB_set_user_data and GB_get_user_data.md create mode 100644 GB_set_vblank_callback.md create mode 100644 GB_set_write_memory_callback.md create mode 100644 GB_start_audio_recording.md create mode 100644 GB_stop_audio_recording.md create mode 100644 GB_switch_model_and_reset.md create mode 100644 GB_time_to_alarm.md create mode 100644 GB_unlikely.md create mode 100644 GB_update_cheat.md create mode 100644 GB_workboy_is_enabled.md create mode 100644 GB_workboy_set_key.md create mode 100644 GB_write_memory.md create mode 100644 Home.md create mode 100644 IO Register Constants.md create mode 100644 Instance Allocation.md diff --git a/Built-In DMG Palettes.md b/Built-In DMG Palettes.md new file mode 100644 index 0000000..2fb1950 --- /dev/null +++ b/Built-In DMG Palettes.md @@ -0,0 +1,23 @@ +## Definition + +
+extern const GB_palette_t GB_PALETTE_GREY;
+extern const GB_palette_t GB_PALETTE_DMG;
+extern const GB_palette_t GB_PALETTE_MGB;
+extern const GB_palette_t GB_PALETTE_GBL;
+
+ +In `display.h` + +## Description + +Four built-in presets palettes to be used with [[GB_set_palette|GB_set_palette and GB_get_palette]]: + * `GB_PALETTE_GREY`: A palette with four evenly-spaced shades of grey. + * `GB_PALETTE_DMG`: A green palette mimicking the look of the original Game Boy (DMG) + * `GB_PALETTE_MGB`: An olive palette mimicking the look of the Game Boy Pocket (MGB) + * `GB_PALETTE_GBL`: A teal palette mimicking the look of the Game Boy Light (GBL/MGL) + + +## See Also +* [[GB_set_palette and GB_get_palette]] +* [[GB_palette_t]] diff --git a/GB_BIG_ENDIAN.md b/GB_BIG_ENDIAN.md new file mode 100644 index 0000000..38dabd9 --- /dev/null +++ b/GB_BIG_ENDIAN.md @@ -0,0 +1,9 @@ +## Definition + +#define GB_BIG_ENDIAN + +In `gb.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_CHEAT_ANY_BANK.md b/GB_CHEAT_ANY_BANK.md new file mode 100644 index 0000000..55c4cc1 --- /dev/null +++ b/GB_CHEAT_ANY_BANK.md @@ -0,0 +1,9 @@ +## Definition + +#define GB_CHEAT_ANY_BANK 0xFFFF + +In `cheats.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_ENUM.md b/GB_ENUM.md new file mode 100644 index 0000000..3e9b4eb --- /dev/null +++ b/GB_ENUM.md @@ -0,0 +1,9 @@ +## Definition + +#define GB_ENUM(type, ...) + +In `save_state.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_LITTLE_ENDIAN.md b/GB_LITTLE_ENDIAN.md new file mode 100644 index 0000000..ee06d6e --- /dev/null +++ b/GB_LITTLE_ENDIAN.md @@ -0,0 +1,9 @@ +## Definition + +#define GB_LITTLE_ENDIAN + +In `gb.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_accessory_t.md b/GB_accessory_t.md new file mode 100644 index 0000000..6fdf862 --- /dev/null +++ b/GB_accessory_t.md @@ -0,0 +1,15 @@ +## Definition + +```c +typedef GB_ENUM(uint8_t, { + GB_ACCESSORY_NONE, + GB_ACCESSORY_PRINTER, + GB_ACCESSORY_WORKBOY, +}) GB_accessory_t; +``` + +In `gb.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_add_cheat.md b/GB_add_cheat.md new file mode 100644 index 0000000..898200a --- /dev/null +++ b/GB_add_cheat.md @@ -0,0 +1,13 @@ +## Definition + +const [[GB_cheat_t]] *GB_add_cheat([[GB_gameboy_t]] *gb, const char *description, uint16_t address, uint16_t bank, uint8_t value, uint8_t old_value, bool use_old_value, bool enabled); + +In `cheats.h` + +## Description + +TBD + +## Thread Safety + +`GB_add_cheat` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_apu_set_sample_callback.md b/GB_apu_set_sample_callback.md new file mode 100644 index 0000000..9a50c1f --- /dev/null +++ b/GB_apu_set_sample_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef void (*GB_sample_callback_t)(GB_gameboy_t *gb, GB_sample_t *sample); +``` + +void GB_apu_set_sample_callback([[GB_gameboy_t]] *gb, [[GB_sample_callback_t]] callback); + +In `apu.h` + +## Description + +TBD + +## Thread Safety + +`GB_apu_set_sample_callback` is thread-safe and can be called from any thread and context. diff --git a/GB_attributed_log.md b/GB_attributed_log.md new file mode 100644 index 0000000..c72bb97 --- /dev/null +++ b/GB_attributed_log.md @@ -0,0 +1,13 @@ +## Definition + +void GB_attributed_log([[GB_gameboy_t]] *gb, [[GB_log_attributes_t]] attributes, const char *fmt, ...) __printflike(3, 4); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_attributed_log` is thread-safe and can be called from any thread and context. diff --git a/GB_audio_format_t.md b/GB_audio_format_t.md new file mode 100644 index 0000000..7ab2e10 --- /dev/null +++ b/GB_audio_format_t.md @@ -0,0 +1,15 @@ +## Definition + +```c +typedef enum { + GB_AUDIO_FORMAT_RAW, + GB_AUDIO_FORMAT_AIFF, + GB_AUDIO_FORMAT_WAV, +} GB_audio_format_t; +``` + +In `apu.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_camera_updated.md b/GB_camera_updated.md new file mode 100644 index 0000000..ff499cb --- /dev/null +++ b/GB_camera_updated.md @@ -0,0 +1,13 @@ +## Definition + +void GB_camera_updated([[GB_gameboy_t]] *gb); + +In `camera.h` + +## Description + +TBD + +## Thread Safety + +`GB_camera_updated` is thread-safe and can be called from any thread and context. diff --git a/GB_cheat_search_data_type_t.md b/GB_cheat_search_data_type_t.md new file mode 100644 index 0000000..d0eff34 --- /dev/null +++ b/GB_cheat_search_data_type_t.md @@ -0,0 +1,16 @@ +## Definition + +```c +typedef enum { + GB_CHEAT_SEARCH_DATA_TYPE_8BIT = 0, + GB_CHEAT_SEARCH_DATA_TYPE_16BIT = 1, + GB_CHEAT_SEARCH_DATA_TYPE_BE_BIT = 2, + GB_CHEAT_SEARCH_DATA_TYPE_16BIT_BE = GB_CHEAT_SEARCH_DATA_TYPE_16BIT | GB_CHEAT_SEARCH_DATA_TYPE_BE_BIT, +} GB_cheat_search_data_type_t; +``` + +In `cheat_search.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_cheat_search_filter.md b/GB_cheat_search_filter.md new file mode 100644 index 0000000..b14bba3 --- /dev/null +++ b/GB_cheat_search_filter.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_cheat_search_filter([[GB_gameboy_t]] *gb, const char *expression, [[GB_cheat_search_data_type_t]] data_type); + +In `cheat_search.h` + +## Description + +TBD + +## Thread Safety + +`GB_cheat_search_filter` must not be called if the instance is being run in any thread, including the current one (via a callback). diff --git a/GB_cheat_search_get_results.md b/GB_cheat_search_get_results.md new file mode 100644 index 0000000..9d2b52e --- /dev/null +++ b/GB_cheat_search_get_results.md @@ -0,0 +1,13 @@ +## Definition + +void GB_cheat_search_get_results([[GB_gameboy_t]] *gb, [[GB_cheat_search_result_t]] *results); + +In `cheat_search.h` + +## Description + +TBD + +## Thread Safety + +`GB_cheat_search_get_results` is thread-safe and can be called from any thread and context. diff --git a/GB_cheat_search_reset.md b/GB_cheat_search_reset.md new file mode 100644 index 0000000..57cd1ec --- /dev/null +++ b/GB_cheat_search_reset.md @@ -0,0 +1,13 @@ +## Definition + +void GB_cheat_search_reset([[GB_gameboy_t]] *gb); + +In `cheat_search.h` + +## Description + +TBD + +## Thread Safety + +`GB_cheat_search_reset` is thread-safe and can be called from any thread and context. diff --git a/GB_cheat_search_result_count.md b/GB_cheat_search_result_count.md new file mode 100644 index 0000000..ea37ced --- /dev/null +++ b/GB_cheat_search_result_count.md @@ -0,0 +1,13 @@ +## Definition + +size_t GB_cheat_search_result_count([[GB_gameboy_t]] *gb); + +In `cheat_search.h` + +## Description + +TBD + +## Thread Safety + +`GB_cheat_search_result_count` is thread-safe and can be called from any thread and context. diff --git a/GB_cheat_search_result_t.md b/GB_cheat_search_result_t.md new file mode 100644 index 0000000..3ff5134 --- /dev/null +++ b/GB_cheat_search_result_t.md @@ -0,0 +1,15 @@ +## Definition + +```c +typedef struct { + uint16_t addr; + uint16_t bank; + uint16_t value; +} GB_cheat_search_result_t; +``` + +In `cheat_search.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_cheat_t.md b/GB_cheat_t.md new file mode 100644 index 0000000..ab11566 --- /dev/null +++ b/GB_cheat_t.md @@ -0,0 +1,19 @@ +## Definition + +```c +typedef struct GB_cheat_s { + uint16_t address; + uint16_t bank; + uint8_t value; + uint8_t old_value; + bool use_old_value; + bool enabled; + char description[128]; +} GB_cheat_t; +``` + +In `cheats.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_cheats_enabled.md b/GB_cheats_enabled.md new file mode 100644 index 0000000..8f64b30 --- /dev/null +++ b/GB_cheats_enabled.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_cheats_enabled([[GB_gameboy_t]] *gb); + +In `cheats.h` + +## Description + +TBD + +## Thread Safety + +`GB_cheats_enabled` is thread-safe and can be called from any thread and context. diff --git a/GB_clear_joyp_accessed.md b/GB_clear_joyp_accessed.md new file mode 100644 index 0000000..4e4fb3a --- /dev/null +++ b/GB_clear_joyp_accessed.md @@ -0,0 +1,13 @@ +## Definition + +void GB_clear_joyp_accessed([[GB_gameboy_t]] *gb); + +In `joypad.h` + +## Description + +TBD + +## Thread Safety + +`GB_clear_joyp_accessed` is thread-safe and can be called from any thread and context. diff --git a/GB_connect_printer.md b/GB_connect_printer.md new file mode 100644 index 0000000..97f1fbd --- /dev/null +++ b/GB_connect_printer.md @@ -0,0 +1,13 @@ +## Definition + +void GB_connect_printer([[GB_gameboy_t]] *gb, [[GB_print_image_callback_t]] callback, [[GB_printer_done_callback_t]] done_callback); + +In `printer.h` + +## Description + +TBD + +## Thread Safety + +`GB_connect_printer` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_connect_workboy.md b/GB_connect_workboy.md new file mode 100644 index 0000000..2e2f67d --- /dev/null +++ b/GB_connect_workboy.md @@ -0,0 +1,13 @@ +## Definition + +void GB_connect_workboy([[GB_gameboy_t]] *gb, [GB_workboy_set_time_callback_t](GB_workboy_set_time_callback_t.gb) set_time_callback, [GB_workboy_get_time_callback_t](GB_workboy_get_time_callback_t.gb) get_time_callback); + +In `workboy.h` + +## Description + +TBD + +## Thread Safety + +`GB_connect_workboy` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_convert_rgb15.md b/GB_convert_rgb15.md new file mode 100644 index 0000000..28b168f --- /dev/null +++ b/GB_convert_rgb15.md @@ -0,0 +1,13 @@ +## Definition + +uint32_t GB_convert_rgb15([[GB_gameboy_t]] *gb, uint16_t color, bool for_border); + +In `display.h` + +## Description + +TBD + +## Thread Safety + +`GB_convert_rgb15` is thread-safe and can be called from any thread and context. diff --git a/GB_cpu_disassemble.md b/GB_cpu_disassemble.md new file mode 100644 index 0000000..8118fca --- /dev/null +++ b/GB_cpu_disassemble.md @@ -0,0 +1,13 @@ +## Definition + +void GB_cpu_disassemble([[GB_gameboy_t]] *gb, uint16_t pc, uint16_t count); + +In `sm83_cpu.h` + +## Description + +TBD + +## Thread Safety + +`GB_cpu_disassemble` is thread-safe and can be called from any thread and context. diff --git a/GB_debugger_break.md b/GB_debugger_break.md new file mode 100644 index 0000000..406890e --- /dev/null +++ b/GB_debugger_break.md @@ -0,0 +1,13 @@ +## Definition + +void GB_debugger_break([[GB_gameboy_t]] *gb); + +In `debugger.h` + +## Description + +TBD + +## Thread Safety + +`GB_debugger_break` is thread-safe and can be called from any thread and context. diff --git a/GB_debugger_clear_symbols.md b/GB_debugger_clear_symbols.md new file mode 100644 index 0000000..b2b754c --- /dev/null +++ b/GB_debugger_clear_symbols.md @@ -0,0 +1,13 @@ +## Definition + +void GB_debugger_clear_symbols([[GB_gameboy_t]] *gb); + +In `debugger.h` + +## Description + +TBD + +## Thread Safety + +`GB_debugger_clear_symbols` is thread-safe and can be called from any thread and context. diff --git a/GB_debugger_complete_substring.md b/GB_debugger_complete_substring.md new file mode 100644 index 0000000..b0c34fa --- /dev/null +++ b/GB_debugger_complete_substring.md @@ -0,0 +1,13 @@ +## Definition + +char *GB_debugger_complete_substring([[GB_gameboy_t]] *gb, char *input, uintptr_t *context); + +In `debugger.h` + +## Description + +TBD + +## Thread Safety + +`GB_debugger_complete_substring` is thread-safe and can be called from any thread and context. diff --git a/GB_debugger_describe_address.md b/GB_debugger_describe_address.md new file mode 100644 index 0000000..6810a91 --- /dev/null +++ b/GB_debugger_describe_address.md @@ -0,0 +1,13 @@ +## Definition + +const char *GB_debugger_describe_address([[GB_gameboy_t]] *gb, uint16_t addr, uint16_t bank, bool exact_match, bool prefer_local); + +In `debugger.h` + +## Description + +TBD + +## Thread Safety + +`GB_debugger_describe_address` is thread-safe and can be called from any thread and context. diff --git a/GB_debugger_evaluate.md b/GB_debugger_evaluate.md new file mode 100644 index 0000000..b653e2d --- /dev/null +++ b/GB_debugger_evaluate.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_debugger_evaluate([[GB_gameboy_t]] *gb, const char *string, uint16_t *result, uint16_t *result_bank); + +In `debugger.h` + +## Description + +TBD + +## Thread Safety + +`GB_debugger_evaluate` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_debugger_execute_command.md b/GB_debugger_execute_command.md new file mode 100644 index 0000000..9d2c0f7 --- /dev/null +++ b/GB_debugger_execute_command.md @@ -0,0 +1,13 @@ +## Definition + +GB_debugger_execute_command([[GB_gameboy_t]] *gb, char *input); + +In `debugger.h` + +## Description + +TBD + +## Thread Safety + +`GB_debugger_execute_command` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_debugger_is_stopped.md b/GB_debugger_is_stopped.md new file mode 100644 index 0000000..2b4d0ef --- /dev/null +++ b/GB_debugger_is_stopped.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_debugger_is_stopped([[GB_gameboy_t]] *gb); + +In `debugger.h` + +## Description + +TBD + +## Thread Safety + +`GB_debugger_is_stopped` is thread-safe and can be called from any thread and context. diff --git a/GB_debugger_load_symbol_file.md b/GB_debugger_load_symbol_file.md new file mode 100644 index 0000000..1f73904 --- /dev/null +++ b/GB_debugger_load_symbol_file.md @@ -0,0 +1,13 @@ +## Definition + +void GB_debugger_load_symbol_file([[GB_gameboy_t]] *gb, const char *path); + +In `debugger.h` + +## Description + +TBD + +## Thread Safety + +`GB_debugger_load_symbol_file` is thread-safe and can be called from any thread and context. diff --git a/GB_debugger_name_for_address.md b/GB_debugger_name_for_address.md new file mode 100644 index 0000000..c9d5ec4 --- /dev/null +++ b/GB_debugger_name_for_address.md @@ -0,0 +1,13 @@ +## Definition + +const char *GB_debugger_name_for_address([[GB_gameboy_t]] *gb, uint16_t addr); + +In `debugger.h` + +## Description + +TBD + +## Thread Safety + +`GB_debugger_name_for_address` is thread-safe and can be called from any thread and context. diff --git a/GB_debugger_set_disabled.md b/GB_debugger_set_disabled.md new file mode 100644 index 0000000..24ee0b7 --- /dev/null +++ b/GB_debugger_set_disabled.md @@ -0,0 +1,13 @@ +## Definition + +void GB_debugger_set_disabled([[GB_gameboy_t]] *gb, bool disabled); + +In `debugger.h` + +## Description + +TBD + +## Thread Safety + +`GB_debugger_set_disabled` is thread-safe and can be called from any thread and context. diff --git a/GB_debugger_set_reload_callback.md b/GB_debugger_set_reload_callback.md new file mode 100644 index 0000000..6c731a6 --- /dev/null +++ b/GB_debugger_set_reload_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef void (*GB_debugger_reload_callback_t)(GB_gameboy_t *gb); +``` + +void GB_debugger_set_reload_callback([[GB_gameboy_t]] *gb, [[GB_debugger_reload_callback_t]] callback); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_debugger_set_reload_callback` is thread-safe and can be called from any thread and context. diff --git a/GB_disconnect_serial.md b/GB_disconnect_serial.md new file mode 100644 index 0000000..81caebe --- /dev/null +++ b/GB_disconnect_serial.md @@ -0,0 +1,13 @@ +## Definition + +void GB_disconnect_serial([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_disconnect_serial` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_draw_tilemap.md b/GB_draw_tilemap.md new file mode 100644 index 0000000..7f3d6d1 --- /dev/null +++ b/GB_draw_tilemap.md @@ -0,0 +1,13 @@ +## Definition + +void GB_draw_tilemap([[GB_gameboy_t]] *gb, uint32_t *dest, [[GB_palette_type_t]] palette_type, uint8_t palette_index, [[GB_map_type_t]] map_type, [[GB_tileset_type_t]] tileset_type); + +In `display.h` + +## Description + +TBD + +## Thread Safety + +`GB_draw_tilemap` is thread-safe and can be called from any thread and context. diff --git a/GB_draw_tileset.md b/GB_draw_tileset.md new file mode 100644 index 0000000..bbcbd63 --- /dev/null +++ b/GB_draw_tileset.md @@ -0,0 +1,21 @@ +## Definition + +```c +typedef enum { + GB_TILESET_AUTO, + GB_TILESET_8800, + GB_TILESET_8000, +} GB_tileset_type_t; +``` + +void GB_draw_tileset([[GB_gameboy_t]] *gb, uint32_t *dest, [[GB_palette_type_t]] palette_type, uint8_t palette_index); + +In `display.h` + +## Description + +TBD + +## Thread Safety + +`GB_draw_tileset` is thread-safe and can be called from any thread and context. diff --git a/GB_gameboy_t.md b/GB_gameboy_t.md new file mode 100644 index 0000000..f11716a --- /dev/null +++ b/GB_gameboy_t.md @@ -0,0 +1,18 @@ +## Definition + +```c +typedef struct GB_gameboy_s GB_gameboy_t; +``` + +In `defs.h` + +## Description + +An object representing an emulated Game Boy instance, normally passed as a reference (`GB_gameboy_t *`) to functions. + +## Notes + +The size of this struct changes between versions of SameBoy. If the version of SameBoy you're linking against is not known in compile-time, you must not allocate instance statically. See [[Instance Allocation]]. + +## See Also +* [[Instance Allocation]] \ No newline at end of file diff --git a/GB_gbs_info_t.md b/GB_gbs_info_t.md new file mode 100644 index 0000000..dbbcfee --- /dev/null +++ b/GB_gbs_info_t.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef struct { + uint8_t track_count; + uint8_t first_track; + char title[33]; + char author[33]; + char copyright[33]; +} GB_gbs_info_t; +``` + +In `gb.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_gbs_switch_track.md b/GB_gbs_switch_track.md new file mode 100644 index 0000000..b31ab56 --- /dev/null +++ b/GB_gbs_switch_track.md @@ -0,0 +1,13 @@ +## Definition + +void GB_gbs_switch_track([[GB_gameboy_t]] *gb, uint8_t track); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_gbs_switch_track` must not be called if the instance is being run in any thread, including the current one (via a callback). diff --git a/GB_get_apu_wave_table.md b/GB_get_apu_wave_table.md new file mode 100644 index 0000000..37e2f25 --- /dev/null +++ b/GB_get_apu_wave_table.md @@ -0,0 +1,13 @@ +## Definition + +void GB_get_apu_wave_table([[GB_gameboy_t]] *gb, uint8_t *wave_table); + +In `apu.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_apu_wave_table` is thread-safe and can be called from any thread and context. diff --git a/GB_get_built_in_accessory.md b/GB_get_built_in_accessory.md new file mode 100644 index 0000000..f18fc16 --- /dev/null +++ b/GB_get_built_in_accessory.md @@ -0,0 +1,13 @@ +## Definition + +[[GB_accessory_t]] GB_get_built_in_accessory([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_built_in_accessory` is thread-safe and can be called from any thread and context. diff --git a/GB_get_channel_amplitude.md b/GB_get_channel_amplitude.md new file mode 100644 index 0000000..c1a72ae --- /dev/null +++ b/GB_get_channel_amplitude.md @@ -0,0 +1,13 @@ +## Definition + +uint8_t GB_get_channel_amplitude([[GB_gameboy_t]] *gb, [[GB_channel_t]] channel); + +In `apu.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_channel_amplitude` is thread-safe and can be called from any thread and context. diff --git a/GB_get_channel_edge_triggered.md b/GB_get_channel_edge_triggered.md new file mode 100644 index 0000000..11c821b --- /dev/null +++ b/GB_get_channel_edge_triggered.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_get_channel_edge_triggered([[GB_gameboy_t]] *gb, [[GB_channel_t]] channel); + +In `apu.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_channel_edge_triggered` is thread-safe and can be called from any thread and context. diff --git a/GB_get_channel_period.md b/GB_get_channel_period.md new file mode 100644 index 0000000..30d03d9 --- /dev/null +++ b/GB_get_channel_period.md @@ -0,0 +1,13 @@ +## Definition + +uint16_t GB_get_channel_period([[GB_gameboy_t]] *gb, [[GB_channel_t]] channel); + +In `apu.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_channel_period` is thread-safe and can be called from any thread and context. diff --git a/GB_get_channel_volume.md b/GB_get_channel_volume.md new file mode 100644 index 0000000..7881123 --- /dev/null +++ b/GB_get_channel_volume.md @@ -0,0 +1,13 @@ +## Definition + +uint8_t GB_get_channel_volume([[GB_gameboy_t]] *gb, [[GB_channel_t]] channel); + +In `apu.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_channel_volume` is thread-safe and can be called from any thread and context. diff --git a/GB_get_cheats.md b/GB_get_cheats.md new file mode 100644 index 0000000..277fbd7 --- /dev/null +++ b/GB_get_cheats.md @@ -0,0 +1,13 @@ +## Definition + +const [[GB_cheat_t]] *const *GB_get_cheats([[GB_gameboy_t]] *gb, size_t *size); + +In `cheats.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_cheats` is thread-safe and can be called from any thread and context. diff --git a/GB_get_clock_rate.md b/GB_get_clock_rate.md new file mode 100644 index 0000000..419f5b2 --- /dev/null +++ b/GB_get_clock_rate.md @@ -0,0 +1,13 @@ +## Definition + +uint32_t GB_get_clock_rate([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_clock_rate` is thread-safe and can be called from any thread and context. diff --git a/GB_get_direct_access.md b/GB_get_direct_access.md new file mode 100644 index 0000000..6a07472 --- /dev/null +++ b/GB_get_direct_access.md @@ -0,0 +1,30 @@ +## Definition + +```c +typedef enum { + GB_DIRECT_ACCESS_ROM, + GB_DIRECT_ACCESS_RAM, + GB_DIRECT_ACCESS_CART_RAM, + GB_DIRECT_ACCESS_VRAM, + GB_DIRECT_ACCESS_HRAM, + GB_DIRECT_ACCESS_IO, + GB_DIRECT_ACCESS_BOOTROM, + GB_DIRECT_ACCESS_OAM, + GB_DIRECT_ACCESS_BGP, + GB_DIRECT_ACCESS_OBP, + GB_DIRECT_ACCESS_IE, + GB_DIRECT_ACCESS_ROM0, +} GB_direct_access_t; +``` + +void *GB_get_direct_access([[GB_gameboy_t]] *gb, [[GB_direct_access_t]] access, size_t *size, uint16_t *bank); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_direct_access` is thread-safe and can be called from any thread and context. diff --git a/GB_get_joyp_accessed.md b/GB_get_joyp_accessed.md new file mode 100644 index 0000000..6b57fbf --- /dev/null +++ b/GB_get_joyp_accessed.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_get_joyp_accessed([[GB_gameboy_t]] *gb); + +In `joypad.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_joyp_accessed` is thread-safe and can be called from any thread and context. diff --git a/GB_get_model.md b/GB_get_model.md new file mode 100644 index 0000000..48e5b93 --- /dev/null +++ b/GB_get_model.md @@ -0,0 +1,13 @@ +## Definition + +[[GB_model_t]] GB_get_model([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_model` is thread-safe and can be called from any thread and context. diff --git a/GB_get_oam_info.md b/GB_get_oam_info.md new file mode 100644 index 0000000..4018775 --- /dev/null +++ b/GB_get_oam_info.md @@ -0,0 +1,13 @@ +## Definition + +uint8_t GB_get_oam_info([[GB_gameboy_t]] *gb, [[GB_oam_info_t]] *dest, uint8_t *object_height); + +In `display.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_oam_info` is thread-safe and can be called from any thread and context. diff --git a/GB_get_pixels_output.md b/GB_get_pixels_output.md new file mode 100644 index 0000000..94045cf --- /dev/null +++ b/GB_get_pixels_output.md @@ -0,0 +1,9 @@ +## Definition + +uint32_t *GB_get_pixels_output([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_get_player_count.md b/GB_get_player_count.md new file mode 100644 index 0000000..6f539b6 --- /dev/null +++ b/GB_get_player_count.md @@ -0,0 +1,13 @@ +## Definition + +unsigned GB_get_player_count([[GB_gameboy_t]] *gb); + +In `sgb.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_player_count` is thread-safe and can be called from any thread and context. diff --git a/GB_get_registers.md b/GB_get_registers.md new file mode 100644 index 0000000..9a59005 --- /dev/null +++ b/GB_get_registers.md @@ -0,0 +1,13 @@ +## Definition + +[[GB_registers_t]] *GB_get_registers([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_registers` is thread-safe and can be called from any thread and context. diff --git a/GB_get_rom_crc32.md b/GB_get_rom_crc32.md new file mode 100644 index 0000000..56e1337 --- /dev/null +++ b/GB_get_rom_crc32.md @@ -0,0 +1,13 @@ +## Definition + +uint32_t GB_get_rom_crc32([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_rom_crc32` is thread-safe and can be called from any thread and context. diff --git a/GB_get_rom_title.md b/GB_get_rom_title.md new file mode 100644 index 0000000..9522ca8 --- /dev/null +++ b/GB_get_rom_title.md @@ -0,0 +1,13 @@ +## Definition + +void GB_get_rom_title([[GB_gameboy_t]] *gb, char *title); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_rom_title` is thread-safe and can be called from any thread and context. diff --git a/GB_get_save_state_size.md b/GB_get_save_state_size.md new file mode 100644 index 0000000..38d2cee --- /dev/null +++ b/GB_get_save_state_size.md @@ -0,0 +1,13 @@ +## Definition + +size_t GB_get_save_state_size([[GB_gameboy_t]] *gb); + +In `save_state.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_save_state_size` is thread-safe and can be called from any thread and context. diff --git a/GB_get_screen_width and GB_get_screen_height.md b/GB_get_screen_width and GB_get_screen_height.md new file mode 100644 index 0000000..efb59b3 --- /dev/null +++ b/GB_get_screen_width and GB_get_screen_height.md @@ -0,0 +1,15 @@ +## Definition + +unsigned GB_get_screen_height([[GB_gameboy_t]] *gb); + +unsigned GB_get_screen_width([[GB_gameboy_t]] *gb); + +In `display.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_screen_width` and `GB_get_screen_height` are thread-safe and can be called from any thread and context. diff --git a/GB_get_state_model.md b/GB_get_state_model.md new file mode 100644 index 0000000..507afd7 --- /dev/null +++ b/GB_get_state_model.md @@ -0,0 +1,13 @@ +## Definition + +int GB_get_state_model(const char *path, [[GB_model_t]] *model); + +In `save_state.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_state_model` is thread-safe and can be called from any thread and context. diff --git a/GB_get_state_model_from_buffer.md b/GB_get_state_model_from_buffer.md new file mode 100644 index 0000000..d67146d --- /dev/null +++ b/GB_get_state_model_from_buffer.md @@ -0,0 +1,13 @@ +## Definition + +int GB_get_state_model_from_buffer(const uint8_t *buffer, size_t length, [[GB_model_t]] *model); + +In `save_state.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_state_model_from_buffer` is thread-safe and can be called from any thread and context. diff --git a/GB_get_unmultiplied_clock_rate.md b/GB_get_unmultiplied_clock_rate.md new file mode 100644 index 0000000..5a3ab9a --- /dev/null +++ b/GB_get_unmultiplied_clock_rate.md @@ -0,0 +1,13 @@ +## Definition + +uint32_t GB_get_unmultiplied_clock_rate([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_unmultiplied_clock_rate` is thread-safe and can be called from any thread and context. diff --git a/GB_get_usual_frame_rate.md b/GB_get_usual_frame_rate.md new file mode 100644 index 0000000..2b36fea --- /dev/null +++ b/GB_get_usual_frame_rate.md @@ -0,0 +1,13 @@ +## Definition + +double GB_get_usual_frame_rate([[GB_gameboy_t]] *gb); + +In `display.h` + +## Description + +TBD + +## Thread Safety + +`GB_get_usual_frame_rate` is thread-safe and can be called from any thread and context. diff --git a/GB_has_accelerometer.md b/GB_has_accelerometer.md new file mode 100644 index 0000000..e43761b --- /dev/null +++ b/GB_has_accelerometer.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_has_accelerometer([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_has_accelerometer` is thread-safe and can be called from any thread and context. diff --git a/GB_icd_set_joyp.md b/GB_icd_set_joyp.md new file mode 100644 index 0000000..247efcf --- /dev/null +++ b/GB_icd_set_joyp.md @@ -0,0 +1,13 @@ +## Definition + +void GB_icd_set_joyp([[GB_gameboy_t]] *gb, uint8_t value); + +In `joypad.h` + +## Description + +TBD + +## Thread Safety + +`GB_icd_set_joyp` is thread-safe and can be called from any thread and context. diff --git a/GB_import_cheat.md b/GB_import_cheat.md new file mode 100644 index 0000000..6aafdbd --- /dev/null +++ b/GB_import_cheat.md @@ -0,0 +1,13 @@ +## Definition + +const [[GB_cheat_t]] *GB_import_cheat([[GB_gameboy_t]] *gb, const char *cheat, const char *description, bool enabled); + +In `cheats.h` + +## Description + +TBD + +## Thread Safety + +`GB_import_cheat` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_inline_const.md b/GB_inline_const.md new file mode 100644 index 0000000..f6c055a --- /dev/null +++ b/GB_inline_const.md @@ -0,0 +1,9 @@ +## Definition + +#define GB_inline_const(type, ...) (*({static const typeof(type) _= __VA_ARGS__; &_;})) + +In `defs.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_is_cgb.md b/GB_is_cgb.md new file mode 100644 index 0000000..e76216a --- /dev/null +++ b/GB_is_cgb.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_is_cgb(const [[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_is_cgb` is thread-safe and can be called from any thread and context. diff --git a/GB_is_cgb_in_cgb_mode.md b/GB_is_cgb_in_cgb_mode.md new file mode 100644 index 0000000..3d0cb06 --- /dev/null +++ b/GB_is_cgb_in_cgb_mode.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_is_cgb_in_cgb_mode([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_is_cgb_in_cgb_mode` is thread-safe and can be called from any thread and context. diff --git a/GB_is_channel_muted.md b/GB_is_channel_muted.md new file mode 100644 index 0000000..0c3e326 --- /dev/null +++ b/GB_is_channel_muted.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_is_channel_muted([[GB_gameboy_t]] *gb, [[GB_channel_t]] channel); + +In `apu.h` + +## Description + +TBD + +## Thread Safety + +`GB_is_channel_muted` is thread-safe and can be called from any thread and context. diff --git a/GB_is_hle_sgb.md b/GB_is_hle_sgb.md new file mode 100644 index 0000000..e97d81a --- /dev/null +++ b/GB_is_hle_sgb.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_is_hle_sgb([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_is_hle_sgb` is thread-safe and can be called from any thread and context. diff --git a/GB_is_odd_frame.md b/GB_is_odd_frame.md new file mode 100644 index 0000000..0fa6481 --- /dev/null +++ b/GB_is_odd_frame.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_is_odd_frame([[GB_gameboy_t]] *gb); + +In `display.h` + +## Description + +TBD + +## Thread Safety + +`GB_is_odd_frame` is thread-safe and can be called from any thread and context. diff --git a/GB_is_save_state.md b/GB_is_save_state.md new file mode 100644 index 0000000..1dc63ae --- /dev/null +++ b/GB_is_save_state.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_is_save_state(const char *path); + +In `save_state.h` + +## Description + +TBD + +## Thread Safety + +`GB_is_save_state` is thread-safe and can be called from any thread and context. diff --git a/GB_is_sgb.md b/GB_is_sgb.md new file mode 100644 index 0000000..ea198ed --- /dev/null +++ b/GB_is_sgb.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_is_sgb([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_is_sgb` is thread-safe and can be called from any thread and context. diff --git a/GB_key_mask_t.md b/GB_key_mask_t.md new file mode 100644 index 0000000..d41c3fb --- /dev/null +++ b/GB_key_mask_t.md @@ -0,0 +1,22 @@ +## Definition + +
+typedef enum {
+    GB_KEY_RIGHT_MASK = 1 << GB_KEY_RIGHT,
+    GB_KEY_LEFT_MASK = 1 << GB_KEY_LEFT,
+    GB_KEY_UP_MASK = 1 << GB_KEY_UP,
+    GB_KEY_DOWN_MASK = 1 << GB_KEY_DOWN,
+    GB_KEY_A_MASK = 1 << GB_KEY_A,
+    GB_KEY_B_MASK = 1 << GB_KEY_B,
+    GB_KEY_SELECT_MASK = 1 << GB_KEY_SELECT,
+    GB_KEY_START_MASK = 1 << GB_KEY_START,
+} GB_key_mask_t;
+
+#define GB_MASK_FOR_PLAYER(mask, player) ((x) << (player * 8))
+
+ +In `joypad.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_key_t.md b/GB_key_t.md new file mode 100644 index 0000000..5e9c0bf --- /dev/null +++ b/GB_key_t.md @@ -0,0 +1,21 @@ +## Definition + +```c +typedef enum { + GB_KEY_RIGHT, + GB_KEY_LEFT, + GB_KEY_UP, + GB_KEY_DOWN, + GB_KEY_A, + GB_KEY_B, + GB_KEY_SELECT, + GB_KEY_START, + GB_KEY_MAX +} GB_key_t; +``` + +In `joypad.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_likely.md b/GB_likely.md new file mode 100644 index 0000000..5e80612 --- /dev/null +++ b/GB_likely.md @@ -0,0 +1,9 @@ +## Definition + +#define GB_likely(x) + +In `defs.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_load_battery.md b/GB_load_battery.md new file mode 100644 index 0000000..44f76d1 --- /dev/null +++ b/GB_load_battery.md @@ -0,0 +1,13 @@ +## Definition + +int GB_load_battery([[GB_gameboy_t]] *gb, const char *path); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_load_battery` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_load_battery_from_buffer.md b/GB_load_battery_from_buffer.md new file mode 100644 index 0000000..73d191f --- /dev/null +++ b/GB_load_battery_from_buffer.md @@ -0,0 +1,13 @@ +## Definition + +void GB_load_battery_from_buffer([[GB_gameboy_t]] *gb, const uint8_t *buffer, size_t size); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_load_battery_from_buffer` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_load_boot_rom.md b/GB_load_boot_rom.md new file mode 100644 index 0000000..9a947df --- /dev/null +++ b/GB_load_boot_rom.md @@ -0,0 +1,13 @@ +## Definition + +int GB_load_boot_rom([[GB_gameboy_t]] *gb, const char *path); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_load_boot_rom` is thread-safe and can be called from any thread and context. diff --git a/GB_load_boot_rom_from_buffer.md b/GB_load_boot_rom_from_buffer.md new file mode 100644 index 0000000..cfeaf2c --- /dev/null +++ b/GB_load_boot_rom_from_buffer.md @@ -0,0 +1,13 @@ +## Definition + +void GB_load_boot_rom_from_buffer([[GB_gameboy_t]] *gb, const unsigned char *buffer, size_t size); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_load_boot_rom_from_buffer` is thread-safe and can be called from any thread and context. diff --git a/GB_load_cheats.md b/GB_load_cheats.md new file mode 100644 index 0000000..56139b6 --- /dev/null +++ b/GB_load_cheats.md @@ -0,0 +1,13 @@ +## Definition + +int GB_load_cheats([[GB_gameboy_t]] *gb, const char *path, bool replace_existing); + +In `cheats.h` + +## Description + +TBD + +## Thread Safety + +`GB_load_cheats` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_load_gbs.md b/GB_load_gbs.md new file mode 100644 index 0000000..4d6fc44 --- /dev/null +++ b/GB_load_gbs.md @@ -0,0 +1,13 @@ +## Definition + +int GB_load_gbs([[GB_gameboy_t]] *gb, const char *path, [[GB_gbs_info_t]] *info); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_load_gbs` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_load_gbs_from_buffer.md b/GB_load_gbs_from_buffer.md new file mode 100644 index 0000000..57d218d --- /dev/null +++ b/GB_load_gbs_from_buffer.md @@ -0,0 +1,13 @@ +## Definition + +int GB_load_gbs_from_buffer([[GB_gameboy_t]] *gb, const uint8_t *buffer, size_t size, [[GB_gbs_info_t]] *info); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_load_gbs_from_buffer` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_load_isx.md b/GB_load_isx.md new file mode 100644 index 0000000..08162c2 --- /dev/null +++ b/GB_load_isx.md @@ -0,0 +1,13 @@ +## Definition + +int GB_load_isx([[GB_gameboy_t]] *gb, const char *path); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_load_isx` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_load_rom.md b/GB_load_rom.md new file mode 100644 index 0000000..876e2eb --- /dev/null +++ b/GB_load_rom.md @@ -0,0 +1,13 @@ +## Definition + +int GB_load_rom([[GB_gameboy_t]] *gb, const char *path); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_load_rom` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_load_rom_from_buffer.md b/GB_load_rom_from_buffer.md new file mode 100644 index 0000000..cdc4497 --- /dev/null +++ b/GB_load_rom_from_buffer.md @@ -0,0 +1,13 @@ +## Definition + +void GB_load_rom_from_buffer([[GB_gameboy_t]] *gb, const uint8_t *buffer, size_t size); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_load_rom_from_buffer` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_load_state.md b/GB_load_state.md new file mode 100644 index 0000000..bd74372 --- /dev/null +++ b/GB_load_state.md @@ -0,0 +1,13 @@ +## Definition + +int GB_load_state([[GB_gameboy_t]] *gb, const char *path); + +In `save_state.h` + +## Description + +TBD + +## Thread Safety + +`GB_load_state` must not be called if the instance is being run in any thread, including the current one (via a callback). diff --git a/GB_load_state_from_buffer.md b/GB_load_state_from_buffer.md new file mode 100644 index 0000000..9ea4137 --- /dev/null +++ b/GB_load_state_from_buffer.md @@ -0,0 +1,13 @@ +## Definition + +int GB_load_state_from_buffer([[GB_gameboy_t]] *gb, const uint8_t *buffer, size_t length); + +In `save_state.h` + +## Description + +TBD + +## Thread Safety + +`GB_load_state_from_buffer` must not be called if the instance is being run in any thread, including the current one (via a callback). diff --git a/GB_log.md b/GB_log.md new file mode 100644 index 0000000..b0ba934 --- /dev/null +++ b/GB_log.md @@ -0,0 +1,13 @@ +## Definition + +void GB_log([[GB_gameboy_t]] *gb, const char *fmt, ...) __printflike(2, 3); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_log` is thread-safe and can be called from any thread and context. diff --git a/GB_log_attributes_t.md b/GB_log_attributes_t.md new file mode 100644 index 0000000..cf535a6 --- /dev/null +++ b/GB_log_attributes_t.md @@ -0,0 +1,16 @@ +## Definition + +```c +typedef enum { + GB_LOG_BOLD = 1, + GB_LOG_DASHED_UNDERLINE = 2, + GB_LOG_UNDERLINE = 4, + GB_LOG_UNDERLINE_MASK = GB_LOG_DASHED_UNDERLINE | GB_LOG_UNDERLINE +} GB_log_attributes_t; +``` + +In `gb.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_map_type_t.md b/GB_map_type_t.md new file mode 100644 index 0000000..f1a38cd --- /dev/null +++ b/GB_map_type_t.md @@ -0,0 +1,15 @@ +## Definition + +```c +typedef enum { + GB_MAP_AUTO, + GB_MAP_9800, + GB_MAP_9C00, +} GB_map_type_t; +``` + +In `display.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_model_t.md b/GB_model_t.md new file mode 100644 index 0000000..08d8805 --- /dev/null +++ b/GB_model_t.md @@ -0,0 +1,47 @@ +## Definition + +```c +#define GB_MODEL_FAMILY_MASK 0xF00 +#define GB_MODEL_DMG_FAMILY 0x000 +#define GB_MODEL_MGB_FAMILY 0x100 +#define GB_MODEL_CGB_FAMILY 0x200 +#define GB_MODEL_GBP_BIT 0x20 +#define GB_MODEL_PAL_BIT 0x40 +#define GB_MODEL_NO_SFC_BIT 0x80 + +typedef enum { + // GB_MODEL_DMG_0 = 0x000, + // GB_MODEL_DMG_A = 0x001, + GB_MODEL_DMG_B = 0x002, + // GB_MODEL_DMG_C = 0x003, + GB_MODEL_SGB = 0x004, + GB_MODEL_SGB_NTSC = GB_MODEL_SGB, + GB_MODEL_SGB_PAL = GB_MODEL_SGB | GB_MODEL_PAL_BIT, + GB_MODEL_SGB_NTSC_NO_SFC = GB_MODEL_SGB | GB_MODEL_NO_SFC_BIT, + GB_MODEL_SGB_NO_SFC = GB_MODEL_SGB_NTSC_NO_SFC, + GB_MODEL_SGB_PAL_NO_SFC = GB_MODEL_SGB | GB_MODEL_NO_SFC_BIT | GB_MODEL_PAL_BIT, + GB_MODEL_MGB = 0x100, + GB_MODEL_SGB2 = 0x101, + GB_MODEL_SGB2_NO_SFC = GB_MODEL_SGB2 | GB_MODEL_NO_SFC_BIT, + GB_MODEL_CGB_0 = 0x200, + GB_MODEL_CGB_A = 0x201, + GB_MODEL_CGB_B = 0x202, + GB_MODEL_CGB_C = 0x203, + GB_MODEL_CGB_D = 0x204, + GB_MODEL_CGB_E = 0x205, + // GB_MODEL_AGB_0 = 0x206, + GB_MODEL_AGB_A = 0x207, + GB_MODEL_GBP_A = GB_MODEL_AGB_A | GB_MODEL_GBP_BIT, + GB_MODEL_AGB = GB_MODEL_AGB_A, + GB_MODEL_GBP = GB_MODEL_GBP_A, + // GB_MODEL_AGB_B = 0x208 + // GB_MODEL_AGB_E = 0x209 + // GB_MODEL_GBP_E = GB_MODEL_AGB_E | GB_MODEL_GBP_BIT, +} GB_model_t; +``` + +In `model.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_oam_info_t.md b/GB_oam_info_t.md new file mode 100644 index 0000000..9dab0b6 --- /dev/null +++ b/GB_oam_info_t.md @@ -0,0 +1,16 @@ +## Definition + +```c +typedef struct { + uint32_t image[128]; + uint8_t x, y, tile, flags; + uint16_t oam_addr; + bool obscured_by_line_limit; +} GB_oam_info_t; +``` + +In `display.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_palette_t.md b/GB_palette_t.md new file mode 100644 index 0000000..8becb1c --- /dev/null +++ b/GB_palette_t.md @@ -0,0 +1,15 @@ +## Definition + +```c +typedef struct { + struct GB_color_s { + uint8_t r, g, b; + } colors[5]; +} GB_palette_t; +``` + +In `display.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_palette_type_t.md b/GB_palette_type_t.md new file mode 100644 index 0000000..555c4d3 --- /dev/null +++ b/GB_palette_type_t.md @@ -0,0 +1,16 @@ +## Definition + +```c +typedef enum { + GB_PALETTE_NONE, + GB_PALETTE_BACKGROUND, + GB_PALETTE_OAM, + GB_PALETTE_AUTO, +} GB_palette_type_t; +``` + +In `display.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_print_image_callback_t.md b/GB_print_image_callback_t.md new file mode 100644 index 0000000..71fed2c --- /dev/null +++ b/GB_print_image_callback_t.md @@ -0,0 +1,16 @@ +## Definition + +```c +typedef void (*GB_print_image_callback_t)(GB_gameboy_t *gb, + uint32_t *image, + uint8_t height, + uint8_t top_margin, + uint8_t bottom_margin, + uint8_t exposure); +``` + +In `printer.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_printer_done_callback_t.md b/GB_printer_done_callback_t.md new file mode 100644 index 0000000..c2b4ba6 --- /dev/null +++ b/GB_printer_done_callback_t.md @@ -0,0 +1,11 @@ +## Definition + +```c +typedef void (*GB_printer_done_callback_t)(GB_gameboy_t *gb); +``` + +In `printer.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_quick_reset.md b/GB_quick_reset.md new file mode 100644 index 0000000..5d6af88 --- /dev/null +++ b/GB_quick_reset.md @@ -0,0 +1,13 @@ +## Definition + +void GB_quick_reset([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_quick_reset` must not be called if the instance is being run in any thread, including the current one (via a callback). diff --git a/GB_random_seed.md b/GB_random_seed.md new file mode 100644 index 0000000..90c13d9 --- /dev/null +++ b/GB_random_seed.md @@ -0,0 +1,13 @@ +## Definition + +void GB_random_seed(uint64_t seed); + +In `random.h` + +## Description + +TBD + +## Thread Safety + +`GB_random_seed` is thread-safe and can be called from any thread and context. diff --git a/GB_random_set_enabled.md b/GB_random_set_enabled.md new file mode 100644 index 0000000..db06a8c --- /dev/null +++ b/GB_random_set_enabled.md @@ -0,0 +1,13 @@ +## Definition + +void GB_random_set_enabled(bool enable); + +In `random.h` + +## Description + +TBD + +## Thread Safety + +`GB_random_set_enabled` is thread-safe and can be called from any thread and context. diff --git a/GB_read_memory.md b/GB_read_memory.md new file mode 100644 index 0000000..074d1e3 --- /dev/null +++ b/GB_read_memory.md @@ -0,0 +1,13 @@ +## Definition + +uint8_t GB_read_memory([[GB_gameboy_t]] *gb, uint16_t addr); + +In `memory.h` + +## Description + +TBD + +## Thread Safety + +`GB_read_memory` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_registers_t.md b/GB_registers_t.md new file mode 100644 index 0000000..3b086b0 --- /dev/null +++ b/GB_registers_t.md @@ -0,0 +1,68 @@ +## Definition + +```c +enum { + GB_REGISTER_AF, + GB_REGISTER_BC, + GB_REGISTER_DE, + GB_REGISTER_HL, + GB_REGISTER_SP, + GB_REGISTER_PC, + GB_REGISTERS_16_BIT +}; + +enum { + GB_CARRY_FLAG = 0x10, + GB_HALF_CARRY_FLAG = 0x20, + GB_SUBTRACT_FLAG = 0x40, + GB_ZERO_FLAG = 0x80, +}; +``` + +On Little Endian targets: +```c +typedef union { + uint16_t registers[GB_REGISTERS_16_BIT]; + struct { + uint16_t af, + bc, + de, + hl, + sp, + pc; + }; + struct { + uint8_t f, a + c, b + e, d + l, h; + }; +} GB_registers_t; +``` + +On Big Endian targets: +```c +typedef union { + uint16_t registers[GB_REGISTERS_16_BIT]; + struct { + uint16_t af, + bc, + de, + hl, + sp, + pc; + }; + struct { + uint8_t a, f, + b, c, + d, e, + h, l; + }; +} GB_registers_t; +``` + +In `gb.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_remove_all_cheats.md b/GB_remove_all_cheats.md new file mode 100644 index 0000000..e9a0978 --- /dev/null +++ b/GB_remove_all_cheats.md @@ -0,0 +1,13 @@ +## Definition + +void GB_remove_all_cheats([[GB_gameboy_t]] *gb); + +In `cheats.h` + +## Description + +TBD + +## Thread Safety + +`GB_remove_all_cheats` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_remove_cheat.md b/GB_remove_cheat.md new file mode 100644 index 0000000..0d58b7d --- /dev/null +++ b/GB_remove_cheat.md @@ -0,0 +1,13 @@ +## Definition + +void GB_remove_cheat([[GB_gameboy_t]] *gb, const [[GB_cheat_t]] *cheat); + +In `cheats.h` + +## Description + +TBD + +## Thread Safety + +`GB_remove_cheat` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_reset.md b/GB_reset.md new file mode 100644 index 0000000..62dad3c --- /dev/null +++ b/GB_reset.md @@ -0,0 +1,13 @@ +## Definition + +void GB_reset([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_reset` must not be called if the instance is being run in any thread, including the current one (via a callback). diff --git a/GB_rewind_pop.md b/GB_rewind_pop.md new file mode 100644 index 0000000..8e1ab59 --- /dev/null +++ b/GB_rewind_pop.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_rewind_pop([[GB_gameboy_t]] *gb); + +In `rewind.h` + +## Description + +TBD + +## Thread Safety + +`GB_rewind_pop` must not be called if the instance is being run in any thread, including the current one (via a callback). diff --git a/GB_rewind_reset.md b/GB_rewind_reset.md new file mode 100644 index 0000000..3975ebc --- /dev/null +++ b/GB_rewind_reset.md @@ -0,0 +1,13 @@ +## Definition + +void GB_rewind_reset([[GB_gameboy_t]] *gb); + +In `rewind.h` + +## Description + +TBD + +## Thread Safety + +`GB_rewind_reset` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_rom_supports_alarms.md b/GB_rom_supports_alarms.md new file mode 100644 index 0000000..cf7ffbd --- /dev/null +++ b/GB_rom_supports_alarms.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_rom_supports_alarms([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_rom_supports_alarms` is thread-safe and can be called from any thread and context. diff --git a/GB_run.md b/GB_run.md new file mode 100644 index 0000000..14694e8 --- /dev/null +++ b/GB_run.md @@ -0,0 +1,13 @@ +## Definition + +unsigned GB_run([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_run` must not be called if the instance is being run in any thread, including the current one (via a callback). diff --git a/GB_run_frame.md b/GB_run_frame.md new file mode 100644 index 0000000..5217ade --- /dev/null +++ b/GB_run_frame.md @@ -0,0 +1,13 @@ +## Definition + +uint64_t GB_run_frame([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_run_frame` must not be called if the instance is being run in any thread, including the current one (via a callback). diff --git a/GB_safe_read_memory.md b/GB_safe_read_memory.md new file mode 100644 index 0000000..a14eddd --- /dev/null +++ b/GB_safe_read_memory.md @@ -0,0 +1,13 @@ +## Definition + +uint8_t GB_safe_read_memory([[GB_gameboy_t]] *gb, uint16_t addr); + +In `memory.h` + +## Description + +TBD + +## Thread Safety + +`GB_safe_read_memory` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_sample_t.md b/GB_sample_t.md new file mode 100644 index 0000000..95da227 --- /dev/null +++ b/GB_sample_t.md @@ -0,0 +1,15 @@ +## Definition + +```c +typedef struct +{ + int16_t left; + int16_t right; +} GB_sample_t; +``` + +In `apu.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_save_battery.md b/GB_save_battery.md new file mode 100644 index 0000000..fcdecf9 --- /dev/null +++ b/GB_save_battery.md @@ -0,0 +1,13 @@ +## Definition + +int GB_save_battery([[GB_gameboy_t]] *gb, const char *path); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_save_battery` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_save_battery_size.md b/GB_save_battery_size.md new file mode 100644 index 0000000..a39b78f --- /dev/null +++ b/GB_save_battery_size.md @@ -0,0 +1,13 @@ +## Definition + +int GB_save_battery_size([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_save_battery_size` is thread-safe and can be called from any thread and context. diff --git a/GB_save_battery_to_buffer.md b/GB_save_battery_to_buffer.md new file mode 100644 index 0000000..3cc4e7f --- /dev/null +++ b/GB_save_battery_to_buffer.md @@ -0,0 +1,13 @@ +## Definition + +int GB_save_battery_to_buffer([[GB_gameboy_t]] *gb, uint8_t *buffer, size_t size); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_save_battery_to_buffer` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_save_cheats.md b/GB_save_cheats.md new file mode 100644 index 0000000..7d81066 --- /dev/null +++ b/GB_save_cheats.md @@ -0,0 +1,13 @@ +## Definition + +int GB_save_cheats([[GB_gameboy_t]] *gb, const char *path); + +In `cheats.h` + +## Description + +TBD + +## Thread Safety + +`GB_save_cheats` is thread-safe and can be called from any thread and context. diff --git a/GB_save_state.md b/GB_save_state.md new file mode 100644 index 0000000..1864f31 --- /dev/null +++ b/GB_save_state.md @@ -0,0 +1,13 @@ +## Definition + +int GB_save_state([[GB_gameboy_t]] *gb, const char *path); + +In `save_state.h` + +## Description + +TBD + +## Thread Safety + +`GB_save_state` must not be called if the instance is being run in any thread, including the current one (via a callback). diff --git a/GB_save_state_to_buffer.md b/GB_save_state_to_buffer.md new file mode 100644 index 0000000..a541d0a --- /dev/null +++ b/GB_save_state_to_buffer.md @@ -0,0 +1,13 @@ +## Definition + +void GB_save_state_to_buffer([[GB_gameboy_t]] *gb, uint8_t *buffer); + +In `save_state.h` + +## Description + +TBD + +## Thread Safety + +`GB_save_state_to_buffer` must not be called if the instance is being run in any thread, including the current one (via a callback). diff --git a/GB_serial_get_data_bit.md b/GB_serial_get_data_bit.md new file mode 100644 index 0000000..6e57742 --- /dev/null +++ b/GB_serial_get_data_bit.md @@ -0,0 +1,17 @@ +## Definition + +bool GB_serial_get_data_bit([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_serial_get_data_bit` is thread-safe and can be called from any thread and context. However, this function should generally be used from outside the [[GB_run]] loop to avoid serial timing bugs. + +## See Also + +* [[Serial Communication Between Instances]] \ No newline at end of file diff --git a/GB_serial_set_data_bit.md b/GB_serial_set_data_bit.md new file mode 100644 index 0000000..e83fa75 --- /dev/null +++ b/GB_serial_set_data_bit.md @@ -0,0 +1,17 @@ +## Definition + +void GB_serial_set_data_bit([[GB_gameboy_t]] *gb, bool data); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_serial_set_data_bit` is thread-safe and can be called from any thread and context. However, this function should generally be used from outside the [[GB_run]] loop to avoid serial timing bugs. + +## See Also + +* [[Serial Communication Between Instances]] \ No newline at end of file diff --git a/GB_set_accelerometer_values.md b/GB_set_accelerometer_values.md new file mode 100644 index 0000000..01226ba --- /dev/null +++ b/GB_set_accelerometer_values.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_accelerometer_values([[GB_gameboy_t]] *gb, double x, double y); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_accelerometer_values` is thread-safe and can be called from any thread and context. diff --git a/GB_set_allow_illegal_inputs.md b/GB_set_allow_illegal_inputs.md new file mode 100644 index 0000000..8b3d13c --- /dev/null +++ b/GB_set_allow_illegal_inputs.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_allow_illegal_inputs([[GB_gameboy_t]] *gb, bool allow); + +In `joypad.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_allow_illegal_inputs` is thread-safe and can be called from any thread and context. diff --git a/GB_set_background_rendering_disabled.md b/GB_set_background_rendering_disabled.md new file mode 100644 index 0000000..780f532 --- /dev/null +++ b/GB_set_background_rendering_disabled.md @@ -0,0 +1,15 @@ +## Definition + +void GB_set_background_rendering_disabled([[GB_gameboy_t]] *gb, bool disabled); + +bool GB_is_background_rendering_disabled([[GB_gameboy_t]] *gb); + +In `display.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_background_rendering_disabled` is thread-safe and can be called from any thread and context. diff --git a/GB_set_boot_rom_load_callback.md b/GB_set_boot_rom_load_callback.md new file mode 100644 index 0000000..cb4662f --- /dev/null +++ b/GB_set_boot_rom_load_callback.md @@ -0,0 +1,32 @@ +## 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, + GB_BOOT_ROM_DMG, + GB_BOOT_ROM_MGB, + GB_BOOT_ROM_SGB, + GB_BOOT_ROM_SGB2, + GB_BOOT_ROM_CGB_0, + GB_BOOT_ROM_CGB, + GB_BOOT_ROM_CGB_E, + GB_BOOT_ROM_AGB_0, + GB_BOOT_ROM_AGB, +} GB_boot_rom_t; +``` + +void GB_set_boot_rom_load_callback([[GB_gameboy_t]] *gb, [[GB_boot_rom_load_callback_t]] callback); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_boot_rom_load_callback` is thread-safe and can be called from any thread and context. diff --git a/GB_set_border_mode.md b/GB_set_border_mode.md new file mode 100644 index 0000000..176b861 --- /dev/null +++ b/GB_set_border_mode.md @@ -0,0 +1,21 @@ +## Definition + +```c +typedef enum { + GB_BORDER_SGB, + GB_BORDER_NEVER, + GB_BORDER_ALWAYS, +} GB_border_mode_t; +``` + +void GB_set_border_mode([[GB_gameboy_t]] *gb, [[GB_border_mode_t]] border_mode); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_border_mode` is thread-safe and can be called from any thread and context. diff --git a/GB_set_camera_get_pixel_callback.md b/GB_set_camera_get_pixel_callback.md new file mode 100644 index 0000000..c55d566 --- /dev/null +++ b/GB_set_camera_get_pixel_callback.md @@ -0,0 +1,18 @@ +## Definition + +```c +typedef uint8_t (*GB_camera_get_pixel_callback_t)(GB_gameboy_t *gb, uint8_t x, uint8_t y); +``` + +void GB_set_camera_get_pixel_callback([[GB_gameboy_t]] *gb, [[GB_camera_get_pixel_callback_t]] callback); + +In `camera.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_camera_get_pixel_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). + diff --git a/GB_set_camera_update_request_callback.md b/GB_set_camera_update_request_callback.md new file mode 100644 index 0000000..5b9c006 --- /dev/null +++ b/GB_set_camera_update_request_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef void (*GB_camera_update_request_callback_t)(GB_gameboy_t *gb); +``` + +void GB_set_camera_update_request_callback([[GB_gameboy_t]] *gb, [[GB_camera_update_request_callback_t]] callback); + +In `camera.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_camera_update_request_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_channel_muted.md b/GB_set_channel_muted.md new file mode 100644 index 0000000..63e9769 --- /dev/null +++ b/GB_set_channel_muted.md @@ -0,0 +1,9 @@ +## Definition + +void GB_set_channel_muted([[GB_gameboy_t]] *gb, [[GB_channel_t]] channel, bool muted); + +In `apu.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_set_cheats_enabled.md b/GB_set_cheats_enabled.md new file mode 100644 index 0000000..c614a74 --- /dev/null +++ b/GB_set_cheats_enabled.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_cheats_enabled([[GB_gameboy_t]] *gb, bool enabled); + +In `cheats.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_cheats_enabled` is thread-safe and can be called from any thread and context. diff --git a/GB_set_clock_multiplier.md b/GB_set_clock_multiplier.md new file mode 100644 index 0000000..a4726d5 --- /dev/null +++ b/GB_set_clock_multiplier.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_clock_multiplier([[GB_gameboy_t]] *gb, double multiplier); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_clock_multiplier` is thread-safe and can be called from any thread and context. diff --git a/GB_set_color_correction_mode.md b/GB_set_color_correction_mode.md new file mode 100644 index 0000000..0e85d22 --- /dev/null +++ b/GB_set_color_correction_mode.md @@ -0,0 +1,25 @@ +## Definition + +```c +typedef enum { + GB_COLOR_CORRECTION_DISABLED, + GB_COLOR_CORRECTION_CORRECT_CURVES, + GB_COLOR_CORRECTION_MODERN_BALANCED, + GB_COLOR_CORRECTION_MODERN_BOOST_CONTRAST, + GB_COLOR_CORRECTION_REDUCE_CONTRAST, + GB_COLOR_CORRECTION_LOW_CONTRAST, + GB_COLOR_CORRECTION_MODERN_ACCURATE, +} GB_color_correction_mode_t; +``` + +void GB_set_color_correction_mode([[GB_gameboy_t]] *gb, [[GB_color_correction_mode_t]] mode); + +In `display.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_color_correction_mode` is thread-safe and can be called from any thread and context. diff --git a/GB_set_emulate_joypad_bouncing.md b/GB_set_emulate_joypad_bouncing.md new file mode 100644 index 0000000..dde9c4b --- /dev/null +++ b/GB_set_emulate_joypad_bouncing.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_emulate_joypad_bouncing([[GB_gameboy_t]] *gb, bool emulate); + +In `joypad.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_emulate_joypad_bouncing` is thread-safe and can be called from any thread and context. diff --git a/GB_set_execution_callback.md b/GB_set_execution_callback.md new file mode 100644 index 0000000..0919ae3 --- /dev/null +++ b/GB_set_execution_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef void (*GB_execution_callback_t)(GB_gameboy_t *gb, uint16_t address, uint8_t opcode); +``` + +void GB_set_execution_callback([[GB_gameboy_t]] *gb, [[GB_execution_callback_t]] callback); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_execution_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_highpass_filter_mode.md b/GB_set_highpass_filter_mode.md new file mode 100644 index 0000000..fdf1fb6 --- /dev/null +++ b/GB_set_highpass_filter_mode.md @@ -0,0 +1,22 @@ +## Definition + +```c +typedef enum { + GB_HIGHPASS_OFF, + GB_HIGHPASS_ACCURATE, + GB_HIGHPASS_REMOVE_DC_OFFSET, + GB_HIGHPASS_MAX +} GB_highpass_mode_t; +``` + +void GB_set_highpass_filter_mode([[GB_gameboy_t]] *gb, [[GB_highpass_mode_t]] mode); + +In `apu.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_highpass_filter_mode` is thread-safe and can be called from any thread and context. diff --git a/GB_set_icd_hreset_callback.md b/GB_set_icd_hreset_callback.md new file mode 100644 index 0000000..f0c7ae8 --- /dev/null +++ b/GB_set_icd_hreset_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef void (*GB_icd_hreset_callback_t)(GB_gameboy_t *gb); +``` + +void GB_set_icd_hreset_callback([[GB_gameboy_t]] *gb, [[GB_icd_hreset_callback_t]] callback); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_icd_hreset_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_icd_pixel_callback.md b/GB_set_icd_pixel_callback.md new file mode 100644 index 0000000..4f21266 --- /dev/null +++ b/GB_set_icd_pixel_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef void (*GB_icd_pixel_callback_t)(GB_gameboy_t *gb, uint8_t row); +``` + +void GB_set_icd_pixel_callback([[GB_gameboy_t]] *gb, [[GB_icd_pixel_callback_t]] callback); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_icd_pixel_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_icd_vreset_callback.md b/GB_set_icd_vreset_callback.md new file mode 100644 index 0000000..47ed476 --- /dev/null +++ b/GB_set_icd_vreset_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef void (*GB_icd_vreset_callback_t)(GB_gameboy_t *gb); +``` + +void GB_set_icd_vreset_callback([[GB_gameboy_t]] *gb, [[GB_icd_vreset_callback_t]] callback); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_icd_vreset_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_infrared_callback.md b/GB_set_infrared_callback.md new file mode 100644 index 0000000..65a08e9 --- /dev/null +++ b/GB_set_infrared_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef void (*GB_infrared_callback_t)(GB_gameboy_t *gb, bool on); +``` + +void GB_set_infrared_callback([[GB_gameboy_t]] *gb, [[GB_infrared_callback_t]] callback); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_infrared_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_infrared_input.md b/GB_set_infrared_input.md new file mode 100644 index 0000000..7e74ea2 --- /dev/null +++ b/GB_set_infrared_input.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_infrared_input([[GB_gameboy_t]] *gb, bool state); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_infrared_input` is thread-safe and can be called from any thread and context. diff --git a/GB_set_input_callback.md b/GB_set_input_callback.md new file mode 100644 index 0000000..a46c367 --- /dev/null +++ b/GB_set_input_callback.md @@ -0,0 +1,19 @@ +## Definition + +```c +typedef char *(*GB_input_callback_t)(GB_gameboy_t *gb); +``` + +void GB_set_async_input_callback([[GB_gameboy_t]] *gb, [[GB_input_callback_t]] callback); + +void GB_set_input_callback([[GB_gameboy_t]] *gb, [[GB_input_callback_t]] callback); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_input_callback` and `GB_set_async_input_callback` are thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_interference_volume.md b/GB_set_interference_volume.md new file mode 100644 index 0000000..c9a9fa9 --- /dev/null +++ b/GB_set_interference_volume.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_interference_volume([[GB_gameboy_t]] *gb, double volume); + +In `apu.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_interference_volume` is thread-safe and can be called from any thread and context. diff --git a/GB_set_joyp_write_callback.md b/GB_set_joyp_write_callback.md new file mode 100644 index 0000000..51f8e3a --- /dev/null +++ b/GB_set_joyp_write_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef void (*GB_joyp_write_callback_t)(GB_gameboy_t *gb, uint8_t value); +``` + +void GB_set_joyp_write_callback([[GB_gameboy_t]] *gb, [[GB_joyp_write_callback_t]] callback); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_joyp_write_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_key_mask.md b/GB_set_key_mask.md new file mode 100644 index 0000000..d003ede --- /dev/null +++ b/GB_set_key_mask.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_key_mask([[GB_gameboy_t]] *gb, [[GB_key_mask_t]] mask); + +In `joypad.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_key_mask` is thread-safe and can be called from any thread and context. diff --git a/GB_set_key_mask_for_player.md b/GB_set_key_mask_for_player.md new file mode 100644 index 0000000..0d52888 --- /dev/null +++ b/GB_set_key_mask_for_player.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_key_mask_for_player([[GB_gameboy_t]] *gb, [[GB_key_mask_t]] mask, unsigned player); + +In `joypad.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_key_mask_for_player` is thread-safe and can be called from any thread and context. diff --git a/GB_set_key_state.md b/GB_set_key_state.md new file mode 100644 index 0000000..681c2ab --- /dev/null +++ b/GB_set_key_state.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_key_state([[GB_gameboy_t]] *gb, [[GB_key_t]] index, bool pressed); + +In `joypad.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_key_state` is thread-safe and can be called from any thread and context. diff --git a/GB_set_key_state_for_player.md b/GB_set_key_state_for_player.md new file mode 100644 index 0000000..0eca27f --- /dev/null +++ b/GB_set_key_state_for_player.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_key_state_for_player([[GB_gameboy_t]] *gb, [[GB_key_t]] index, unsigned player, bool pressed); + +In `joypad.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_key_state_for_player` is thread-safe and can be called from any thread and context. diff --git a/GB_set_lcd_line_callback.md b/GB_set_lcd_line_callback.md new file mode 100644 index 0000000..286d091 --- /dev/null +++ b/GB_set_lcd_line_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef void (*GB_lcd_line_callback_t)(GB_gameboy_t *gb, uint8_t line); +``` + +void GB_set_lcd_line_callback([[GB_gameboy_t]] *gb, [[GB_lcd_line_callback_t]] callback); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_lcd_line_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_lcd_status_callback.md b/GB_set_lcd_status_callback.md new file mode 100644 index 0000000..baa1869 --- /dev/null +++ b/GB_set_lcd_status_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef void (*GB_lcd_status_callback_t)(GB_gameboy_t *gb, bool on); +``` + +void GB_set_lcd_status_callback([[GB_gameboy_t]] *gb, [[GB_lcd_status_callback_t]] callback); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_lcd_status_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_light_temperature.md b/GB_set_light_temperature.md new file mode 100644 index 0000000..8e551f3 --- /dev/null +++ b/GB_set_light_temperature.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_light_temperature([[GB_gameboy_t]] *gb, double temperature); + +In `display.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_light_temperature` is thread-safe and can be called from any thread and context. diff --git a/GB_set_log_callback.md b/GB_set_log_callback.md new file mode 100644 index 0000000..d0b1c00 --- /dev/null +++ b/GB_set_log_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef void (*GB_log_callback_t)(GB_gameboy_t *gb, const char *string, GB_log_attributes_t attributes); +``` + +void GB_set_log_callback([[GB_gameboy_t]] *gb, [[GB_log_callback_t]] callback); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_log_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_object_rendering_disabled.md b/GB_set_object_rendering_disabled.md new file mode 100644 index 0000000..de4dec4 --- /dev/null +++ b/GB_set_object_rendering_disabled.md @@ -0,0 +1,15 @@ +## Definition + +void GB_set_object_rendering_disabled([[GB_gameboy_t]] *gb, bool disabled); + +bool GB_is_object_rendering_disabled([[GB_gameboy_t]] *gb); + +In `display.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_object_rendering_disabled` is thread-safe and can be called from any thread and context. diff --git a/GB_set_open_bus_decay_time.md b/GB_set_open_bus_decay_time.md new file mode 100644 index 0000000..a2b5889 --- /dev/null +++ b/GB_set_open_bus_decay_time.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_open_bus_decay_time([[GB_gameboy_t]] *gb, uint32_t decay); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_open_bus_decay_time` is thread-safe and can be called from any thread and context. diff --git a/GB_set_palette and GB_get_palette.md b/GB_set_palette and GB_get_palette.md new file mode 100644 index 0000000..4381926 --- /dev/null +++ b/GB_set_palette and GB_get_palette.md @@ -0,0 +1,15 @@ +## Definition + +const [[GB_palette_t]] *GB_get_palette([[GB_gameboy_t]] *gb); + +void GB_set_palette([[GB_gameboy_t]] *gb, const [[GB_palette_t]] *palette); + +In `display.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_palette` and `GB_get_palette` are thread-safe and can be called from any thread and context. diff --git a/GB_set_pixels_output.md b/GB_set_pixels_output.md new file mode 100644 index 0000000..03b8dea --- /dev/null +++ b/GB_set_pixels_output.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_pixels_output([[GB_gameboy_t]] *gb, uint32_t *output); + +In `display.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_pixels_output` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_read_memory_callback.md b/GB_set_read_memory_callback.md new file mode 100644 index 0000000..d5729af --- /dev/null +++ b/GB_set_read_memory_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef uint8_t (*GB_read_memory_callback_t)(GB_gameboy_t *gb, uint16_t addr, uint8_t data); +``` + +void GB_set_read_memory_callback([[GB_gameboy_t]] *gb, [[GB_read_memory_callback_t]] callback); + +In `memory.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_read_memory_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_rendering_disabled.md b/GB_set_rendering_disabled.md new file mode 100644 index 0000000..db7d672 --- /dev/null +++ b/GB_set_rendering_disabled.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_rendering_disabled([[GB_gameboy_t]] *gb, bool disabled); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_rendering_disabled` is thread-safe and can be called from any thread and context. diff --git a/GB_set_rewind_length.md b/GB_set_rewind_length.md new file mode 100644 index 0000000..5c6ab2e --- /dev/null +++ b/GB_set_rewind_length.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_rewind_length([[GB_gameboy_t]] *gb, double seconds); + +In `rewind.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_rewind_length` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_rgb_encode_callback.md b/GB_set_rgb_encode_callback.md new file mode 100644 index 0000000..c603982 --- /dev/null +++ b/GB_set_rgb_encode_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef uint32_t (*GB_rgb_encode_callback_t)(GB_gameboy_t *gb, uint8_t r, uint8_t g, uint8_t b); +``` + +void GB_set_rgb_encode_callback([[GB_gameboy_t]] *gb, [[GB_rgb_encode_callback_t]] callback); + +In `display.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_rgb_encode_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_rtc_mode.md b/GB_set_rtc_mode.md new file mode 100644 index 0000000..6b3e9f0 --- /dev/null +++ b/GB_set_rtc_mode.md @@ -0,0 +1,20 @@ +## Definition + +```c +typedef enum { + GB_RTC_MODE_SYNC_TO_HOST, + GB_RTC_MODE_ACCURATE, +} GB_rtc_mode_t; +``` + +void GB_set_rtc_mode([[GB_gameboy_t]] *gb, [[GB_rtc_mode_t]] mode); + +In `timing.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_rtc_mode` is thread-safe and can be called from any thread and context. diff --git a/GB_set_rtc_multiplier.md b/GB_set_rtc_multiplier.md new file mode 100644 index 0000000..0c58d23 --- /dev/null +++ b/GB_set_rtc_multiplier.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_rtc_multiplier([[GB_gameboy_t]] *gb, double multiplier); + +In `timing.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_rtc_multiplier` is thread-safe and can be called from any thread and context. diff --git a/GB_set_rumble_callback.md b/GB_set_rumble_callback.md new file mode 100644 index 0000000..07e6535 --- /dev/null +++ b/GB_set_rumble_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef void (*GB_rumble_callback_t)(GB_gameboy_t *gb, double rumble_amplitude); +``` + +void GB_set_rumble_callback([[GB_gameboy_t]] *gb, [[GB_rumble_callback_t]] callback); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_rumble_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_rumble_mode.md b/GB_set_rumble_mode.md new file mode 100644 index 0000000..981b295 --- /dev/null +++ b/GB_set_rumble_mode.md @@ -0,0 +1,21 @@ +## Definition + +```c +typedef enum { + GB_RUMBLE_DISABLED, + GB_RUMBLE_CARTRIDGE_ONLY, + GB_RUMBLE_ALL_GAMES +} GB_rumble_mode_t; +``` + +void GB_set_rumble_mode([[GB_gameboy_t]] *gb, [[GB_rumble_mode_t]] mode); + +In `rumble.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_rumble_mode` is thread-safe and can be called from any thread and context. diff --git a/GB_set_sample_rate.md b/GB_set_sample_rate.md new file mode 100644 index 0000000..f13e147 --- /dev/null +++ b/GB_set_sample_rate.md @@ -0,0 +1,17 @@ +## Definition + +void GB_set_sample_rate([[GB_gameboy_t]] *gb, unsigned sample_rate); + +void GB_set_sample_rate_by_clocks([[GB_gameboy_t]] *gb, double cycles_per_sample); + +unsigned GB_get_sample_rate([[GB_gameboy_t]] *gb); + +In `apu.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_sample_rate` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_serial_transfer_bit_end_callback.md b/GB_set_serial_transfer_bit_end_callback.md new file mode 100644 index 0000000..673986a --- /dev/null +++ b/GB_set_serial_transfer_bit_end_callback.md @@ -0,0 +1,21 @@ +## Definition + +```c +typedef bool (*GB_serial_transfer_bit_end_callback_t)(GB_gameboy_t *gb); +``` + +void GB_set_serial_transfer_bit_end_callback([[GB_gameboy_t]] *gb, [[GB_serial_transfer_bit_end_callback_t]] callback); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_serial_transfer_bit_end_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). + +## See Also + +* [[Serial Communication Between Instances]] \ No newline at end of file diff --git a/GB_set_serial_transfer_bit_start_callback.md b/GB_set_serial_transfer_bit_start_callback.md new file mode 100644 index 0000000..af00b72 --- /dev/null +++ b/GB_set_serial_transfer_bit_start_callback.md @@ -0,0 +1,21 @@ +## Definition + +```c +typedef void (*GB_serial_transfer_bit_start_callback_t)(GB_gameboy_t *gb, bool bit_to_send); +``` + +void GB_set_serial_transfer_bit_start_callback([[GB_gameboy_t]] *gb, [[GB_serial_transfer_bit_start_callback_t]] callback); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_serial_transfer_bit_start_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). + +## See Also + +* [[Serial Communication Between Instances]] \ No newline at end of file diff --git a/GB_set_turbo_mode.md b/GB_set_turbo_mode.md new file mode 100644 index 0000000..b06d77a --- /dev/null +++ b/GB_set_turbo_mode.md @@ -0,0 +1,13 @@ +## Definition + +void GB_set_turbo_mode([[GB_gameboy_t]] *gb, bool on, bool no_frame_skip); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_turbo_mode` is thread-safe and can be called from any thread and context. diff --git a/GB_set_update_input_hint_callback.md b/GB_set_update_input_hint_callback.md new file mode 100644 index 0000000..c118989 --- /dev/null +++ b/GB_set_update_input_hint_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef void (*GB_update_input_hint_callback_t)(GB_gameboy_t *gb); +``` + +void GB_set_update_input_hint_callback([[GB_gameboy_t]] *gb, [[GB_update_input_hint_callback_t]] callback); + +In `joypad.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_update_input_hint_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_user_data and GB_get_user_data.md b/GB_set_user_data and GB_get_user_data.md new file mode 100644 index 0000000..10f51c4 --- /dev/null +++ b/GB_set_user_data and GB_get_user_data.md @@ -0,0 +1,15 @@ +## Definition + +void GB_set_user_data([[GB_gameboy_t]] *gb, void *data); + +void *GB_get_user_data([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_set_user_data` and `GB_get_user_data` thread-safe and can be called from any thread and context. diff --git a/GB_set_vblank_callback.md b/GB_set_vblank_callback.md new file mode 100644 index 0000000..509b4d3 --- /dev/null +++ b/GB_set_vblank_callback.md @@ -0,0 +1,26 @@ +## Definition + +```c +typedef void (*GB_vblank_callback_t)(GB_gameboy_t *gb, GB_vblank_type_t type); +``` + +```c +typedef enum { + GB_VBLANK_TYPE_NORMAL_FRAME, + GB_VBLANK_TYPE_LCD_OFF, + GB_VBLANK_TYPE_ARTIFICIAL, + GB_VBLANK_TYPE_REPEAT, +} GB_vblank_type_t; +``` + +void GB_set_vblank_callback([[GB_gameboy_t]] *gb, [[GB_vblank_callback_t]] callback); + +In `display.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_vblank_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_set_write_memory_callback.md b/GB_set_write_memory_callback.md new file mode 100644 index 0000000..5c8820d --- /dev/null +++ b/GB_set_write_memory_callback.md @@ -0,0 +1,17 @@ +## Definition + +```c +typedef bool (*GB_write_memory_callback_t)(GB_gameboy_t *gb, uint16_t addr, uint8_t data); +``` + +void GB_set_write_memory_callback([[GB_gameboy_t]] *gb, [[GB_write_memory_callback_t]] callback); + +In `memory.h` + +## Description + +TBD + +## Thread Safety + +If `callback` is not NULL, `GB_set_write_memory_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_start_audio_recording.md b/GB_start_audio_recording.md new file mode 100644 index 0000000..fcd0e85 --- /dev/null +++ b/GB_start_audio_recording.md @@ -0,0 +1,13 @@ +## Definition + +int GB_start_audio_recording([[GB_gameboy_t]] *gb, const char *path, [[GB_audio_format_t]] format); + +In `apu.h` + +## Description + +TBD + +## Thread Safety + +`GB_start_audio_recording` is thread-safe and can be called from any thread and context. diff --git a/GB_stop_audio_recording.md b/GB_stop_audio_recording.md new file mode 100644 index 0000000..0ea19fe --- /dev/null +++ b/GB_stop_audio_recording.md @@ -0,0 +1,13 @@ +## Definition + +int GB_stop_audio_recording([[GB_gameboy_t]] *gb); + +In `apu.h` + +## Description + +TBD + +## Thread Safety + +`GB_stop_audio_recording` is thread-safe and can be called from any thread and context. diff --git a/GB_switch_model_and_reset.md b/GB_switch_model_and_reset.md new file mode 100644 index 0000000..d5248d0 --- /dev/null +++ b/GB_switch_model_and_reset.md @@ -0,0 +1,13 @@ +## Definition + +void GB_switch_model_and_reset([[GB_gameboy_t]] *gb, [[GB_model_t]] model); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_switch_model_and_reset` must not be called if the instance is being run in any thread, including the current one (via a callback). diff --git a/GB_time_to_alarm.md b/GB_time_to_alarm.md new file mode 100644 index 0000000..d4f2b4e --- /dev/null +++ b/GB_time_to_alarm.md @@ -0,0 +1,13 @@ +## Definition + +unsigned GB_time_to_alarm([[GB_gameboy_t]] *gb); + +In `gb.h` + +## Description + +TBD + +## Thread Safety + +`GB_time_to_alarm` is thread-safe and can be called from any thread and context. diff --git a/GB_unlikely.md b/GB_unlikely.md new file mode 100644 index 0000000..7cc1ccf --- /dev/null +++ b/GB_unlikely.md @@ -0,0 +1,9 @@ +## Definition + +#define GB_unlikely(x) + +In `defs.h` + +## Description + +TBD \ No newline at end of file diff --git a/GB_update_cheat.md b/GB_update_cheat.md new file mode 100644 index 0000000..c49f7f3 --- /dev/null +++ b/GB_update_cheat.md @@ -0,0 +1,13 @@ +## Definition + +void GB_update_cheat([[GB_gameboy_t]] *gb, const [[GB_cheat_t]] *cheat, const char *description, uint16_t address, uint16_t bank, uint8_t value, uint8_t old_value, bool use_old_value, bool enabled); + +In `cheats.h` + +## Description + +TBD + +## Thread Safety + +`GB_update_cheat` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/GB_workboy_is_enabled.md b/GB_workboy_is_enabled.md new file mode 100644 index 0000000..64b52ae --- /dev/null +++ b/GB_workboy_is_enabled.md @@ -0,0 +1,13 @@ +## Definition + +bool GB_workboy_is_enabled([[GB_gameboy_t]] *gb); + +In `workboy.h` + +## Description + +TBD + +## Thread Safety + +`GB_workboy_is_enabled` is thread-safe and can be called from any thread and context. diff --git a/GB_workboy_set_key.md b/GB_workboy_set_key.md new file mode 100644 index 0000000..bb105aa --- /dev/null +++ b/GB_workboy_set_key.md @@ -0,0 +1,13 @@ +## Definition + +void GB_workboy_set_key([[GB_gameboy_t]] *gb, uint8_t key); + +In `workboy.h` + +## Description + +TBD + +## Thread Safety + +`GB_workboy_set_key` is thread-safe and can be called from any thread and context. diff --git a/GB_write_memory.md b/GB_write_memory.md new file mode 100644 index 0000000..1305968 --- /dev/null +++ b/GB_write_memory.md @@ -0,0 +1,13 @@ +## Definition + +void GB_write_memory([[GB_gameboy_t]] *gb, uint16_t addr, uint8_t value); + +In `memory.h` + +## Description + +TBD + +## Thread Safety + +`GB_write_memory` must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). diff --git a/Home.md b/Home.md new file mode 100644 index 0000000..0f933f0 --- /dev/null +++ b/Home.md @@ -0,0 +1,266 @@ +# SameBoy API Reference + +This wiki serves as the API documentation of SameBoy's core. It is currently a work in progress, and reflects the API for the upcoming SameBoy 1.0 release. Since version 1.0 has not been released yet, the API has not been finalized yet. + +## General Usage + +The recommended way to use SameBoy as a library is to build the `lib` target, and use the built `.o` or `.a` file, together with the generated `include` directory. This guarantees SameBoy is compiled with the optimal compilation flags. You do not need to include specific header files, the main header file will include all other headers for you: + +```c +#include +``` + +See the README file in the [main repositry](https://github.com/LIJI32/SameBoy) for more information about building and build configurations. + +## API Reference + +### Base + +These APIs are used for base operations of an emulator instance; including initialization, running, loading ROM files, etc. + +* [[Instance Allocation]] +* [[GB_gameboy_t]] +* [[GB_model_t]] +* [[GB_get_model]] +* [[GB_run]] +* [[GB_run_frame]] +* [[GB_reset]] +* [[GB_quick_reset]] +* [[GB_switch_model_and_reset]] +* [[GB_set_boot_rom_load_callback]] +* [[GB_load_boot_rom]] +* [[GB_load_boot_rom_from_buffer]] +* [[GB_load_isx]] +* [[GB_load_rom]] +* [[GB_load_rom_from_buffer]] +* [[GB_get_clock_rate]] +* [[GB_set_clock_multiplier]] +* [[GB_get_unmultiplied_clock_rate]] +* [[GB_get_direct_access]] +* [[GB_set_user_data and GB_get_user_data]] +* [[GB_is_cgb]] +* [[GB_is_cgb_in_cgb_mode]] +* [[GB_is_hle_sgb]] +* [[GB_is_sgb]] +* [[GB_random_seed]] +* [[GB_random_set_enabled]] +* [[GB_set_open_bus_decay_time]] +* [[GB_set_rendering_disabled]] +* [[GB_set_turbo_mode]] +* [[IO Register Constants]] + +### Video + +These APIs are used to obtain the video output of an emulator instance and affect it. + +* [[GB_set_pixels_output]] +* [[GB_set_rgb_encode_callback]] +* [[GB_get_screen_width and GB_get_screen_height]] +* [[GB_set_vblank_callback]] +* [[GB_set_color_correction_mode]] +* [[GB_set_light_temperature]] +* [[GB_set_palette and GB_get_palette]] +* [[Built In DMG Palettes]] +* [[GB_convert_rgb15]] +* [[GB_draw_tilemap]] +* [[GB_draw_tileset]] +* [[GB_get_oam_info]] +* [[GB_get_usual_frame_rate]] +* [[GB_is_odd_frame]] +* [[GB_map_type_t]] +* [[GB_oam_info_t]] +* [[GB_palette_t]] +* [[GB_palette_type_t]] +* [[GB_set_background_rendering_disabled]] +* [[GB_set_object_rendering_disabled]] +* [[GB_set_border_mode]] + +### Audio + +These APIs are used to obtain the audio output of an emulator instance and affect it. + +* [[GB_set_sample_rate]] +* [[GB_apu_set_sample_callback]] +* [[GB_sample_t]] +* [[GB_set_highpass_filter_mode]] +* [[GB_audio_format_t]] +* [[GB_get_apu_wave_table]] +* [[GB_get_channel_amplitude]] +* [[GB_get_channel_edge_triggered]] +* [[GB_get_channel_period]] +* [[GB_get_channel_volume]] +* [[GB_is_channel_muted]] +* [[GB_set_channel_muted]] +* [[GB_set_interference_volume]] +* [[GB_start_audio_recording]] +* [[GB_stop_audio_recording]] + +### Player Controls + +These APIs are used to handle the player controls in an emulator instance. + +* [[GB_key_t]] +* [[GB_key_mask_t]] +* [[GB_set_key_mask]] +* [[GB_set_key_mask_for_player]] +* [[GB_set_key_state]] +* [[GB_set_key_state_for_player]] +* [[GB_clear_joyp_accessed]] +* [[GB_get_joyp_accessed]] +* [[GB_get_player_count]] +* [[GB_has_accelerometer]] +* [[GB_set_accelerometer_values]] +* [[GB_set_allow_illegal_inputs]] +* [[GB_set_emulate_joypad_bouncing]] +* [[GB_set_rumble_mode]] +* [[GB_set_rumble_callback]] +* [[GB_set_update_input_hint_callback]] + +### Saves + +These APIs are used to save and load battery and save states. + +* [[GB_get_save_state_size]] +* [[GB_get_state_model]] +* [[GB_get_state_model_from_buffer]] +* [[GB_is_save_state]] +* [[GB_load_battery]] +* [[GB_load_battery_from_buffer]] +* [[GB_load_state]] +* [[GB_load_state_from_buffer]] +* [[GB_save_battery]] +* [[GB_save_battery_size]] +* [[GB_save_battery_to_buffer]] +* [[GB_save_state]] +* [[GB_save_state_to_buffer]] + +### Camera + +These APIs are used to provide image input while emulating a Game Boy Camera. + +* [[GB_camera_updated]] +* [[GB_set_camera_get_pixel_callback]] +* [[GB_set_camera_update_request_callback]] + +### Cheats + +These APIs are used to manage and apply cheats to an emulator instance. + +* [[GB_add_cheat]] +* [[GB_CHEAT_ANY_BANK]] +* [[GB_cheat_t]] +* [[GB_cheats_enabled]] +* [[GB_get_cheats]] +* [[GB_import_cheat]] +* [[GB_load_cheats]] +* [[GB_remove_all_cheats]] +* [[GB_remove_cheat]] +* [[GB_save_cheats]] +* [[GB_set_cheats_enabled]] +* [[GB_update_cheat]] + +### Cheat Search + +These APIs are used to search the memory of an emulator instance for specific values for the purpose of creating cheat codes. + +* [[GB_cheat_search_data_type_t]] +* [[GB_cheat_search_filter]] +* [[GB_cheat_search_get_results]] +* [[GB_cheat_search_reset]] +* [[GB_cheat_search_result_count]] +* [[GB_cheat_search_result_t]] + +### Connectivity + +These APIs are used to communicate with the serial port and infrared transceiver of an emulator instance. They can also connect a built-in supported accessory (such as a Game Boy Printer or WorkBoy) to an emulator instance. + +* [[GB_accessory_t]] +* [[GB_connect_printer]] +* [[GB_connect_workboy]] +* [[GB_disconnect_serial]] +* [[GB_get_built_in_accessory]] +* [[GB_print_image_callback_t]] +* [[GB_printer_done_callback_t]] +* [[GB_serial_get_data_bit]] +* [[GB_serial_set_data_bit]] +* [[GB_set_infrared_callback]] +* [[GB_set_infrared_input]] +* [[GB_set_serial_transfer_bit_end_callback]] +* [[GB_set_serial_transfer_bit_start_callback]] +* [[GB_workboy_is_enabled]] +* [[GB_workboy_set_key]] + +### Console I/O + +These APIs are used to communicate with an emulator instance's console I/O, used for logging and debugger input/output. + +* [[GB_attributed_log]] +* [[GB_log]] +* [[GB_log_attributes_t]] +* [[GB_set_input_callback]] +* [[GB_set_log_callback]] + +### GBS + +These APIs are used to load and play GBS audio files in an emulator instance. + +* [[GB_load_gbs]] +* [[GB_load_gbs_from_buffer]] +* [[GB_gbs_info_t]] +* [[GB_gbs_switch_track]] + +### Inspection + +These APIs are used to obtain internal information about the currently loaded ROM or the current execution state of an emulator instance. + +* [[GB_get_registers]] +* [[GB_get_rom_crc32]] +* [[GB_get_rom_title]] +* [[GB_read_memory]] +* [[GB_registers_t]] +* [[GB_safe_read_memory]] +* [[GB_set_execution_callback]] +* [[GB_set_read_memory_callback]] +* [[GB_set_write_memory_callback]] +* [[GB_write_memory]] + +### Macros + +These macros are defined and exported by SameBoy and provide various capabilities and information. + +* [[GB_BIG_ENDIAN]] +* [[GB_LITTLE_ENDIAN]] +* [[GB_CONTEXT_SAFETY]] +* [[GB_ENUM]] +* [[GB_inline_const]] +* [[GB_likely]] +* [[GB_unlikely]] + +### Real Time Clock + +These APIs are used to control and integrate with Real Time Clock features in supported ROMs. + +* [[GB_set_rtc_mode]] +* [[GB_set_rtc_multiplier]] +* [[GB_rom_supports_alarms]] +* [[GB_time_to_alarm]] + +### Rewinding + +These APIs are used to enable and control rewinding support in an emulator instance. + +* [[GB_set_rewind_length]] +* [[GB_rewind_pop]] +* [[GB_rewind_reset]] + +### SFC/SNES Integration + +These APIs can be used to integrate SameBoy as the Game Boy core of a SFC or SNES emulator emulating a Super Game Boy. + +* [[GB_icd_set_joyp]] +* [[GB_set_icd_hreset_callback]] +* [[GB_set_icd_pixel_callback]] +* [[GB_set_icd_vreset_callback]] +* [[GB_set_joyp_write_callback]] +* [[GB_set_lcd_line_callback]] +* [[GB_set_lcd_status_callback]] \ No newline at end of file diff --git a/IO Register Constants.md b/IO Register Constants.md new file mode 100644 index 0000000..798c2fb --- /dev/null +++ b/IO Register Constants.md @@ -0,0 +1,129 @@ +## Definition + +```c +enum { + /* Joypad and Serial */ + GB_IO_JOYP = 0x00, // Joypad (R/W) + GB_IO_SB = 0x01, // Serial transfer data (R/W) + GB_IO_SC = 0x02, // Serial Transfer Control (R/W) + + /* Missing */ + + /* Timers */ + GB_IO_DIV = 0x04, // Divider Register (R/W) + GB_IO_TIMA = 0x05, // Timer counter (R/W) + GB_IO_TMA = 0x06, // Timer Modulo (R/W) + GB_IO_TAC = 0x07, // Timer Control (R/W) + + /* Missing */ + + GB_IO_IF = 0x0F, // Interrupt Flag (R/W) + + /* Sound */ + GB_IO_NR10 = 0x10, // Channel 1 Sweep register (R/W) + GB_IO_NR11 = 0x11, // Channel 1 Sound length/Wave pattern duty (R/W) + GB_IO_NR12 = 0x12, // Channel 1 Volume Envelope (R/W) + GB_IO_NR13 = 0x13, // Channel 1 Frequency lo (Write Only) + GB_IO_NR14 = 0x14, // Channel 1 Frequency hi (R/W) + /* NR20 does not exist */ + GB_IO_NR21 = 0x16, // Channel 2 Sound Length/Wave Pattern Duty (R/W) + GB_IO_NR22 = 0x17, // Channel 2 Volume Envelope (R/W) + GB_IO_NR23 = 0x18, // Channel 2 Frequency lo data (W) + GB_IO_NR24 = 0x19, // Channel 2 Frequency hi data (R/W) + GB_IO_NR30 = 0x1A, // Channel 3 Sound on/off (R/W) + GB_IO_NR31 = 0x1B, // Channel 3 Sound Length + GB_IO_NR32 = 0x1C, // Channel 3 Select output level (R/W) + GB_IO_NR33 = 0x1D, // Channel 3 Frequency's lower data (W) + GB_IO_NR34 = 0x1E, // Channel 3 Frequency's higher data (R/W) + /* NR40 does not exist */ + GB_IO_NR41 = 0x20, // Channel 4 Sound Length (R/W) + GB_IO_NR42 = 0x21, // Channel 4 Volume Envelope (R/W) + GB_IO_NR43 = 0x22, // Channel 4 Polynomial Counter (R/W) + GB_IO_NR44 = 0x23, // Channel 4 Counter/consecutive, Inital (R/W) + GB_IO_NR50 = 0x24, // Channel control / ON-OFF / Volume (R/W) + GB_IO_NR51 = 0x25, // Selection of Sound output terminal (R/W) + GB_IO_NR52 = 0x26, // Sound on/off + + /* Missing */ + + GB_IO_WAV_START = 0x30, // Wave pattern start + GB_IO_WAV_END = 0x3F, // Wave pattern end + + /* Graphics */ + GB_IO_LCDC = 0x40, // LCD Control (R/W) + GB_IO_STAT = 0x41, // LCDC Status (R/W) + GB_IO_SCY = 0x42, // Scroll Y (R/W) + GB_IO_SCX = 0x43, // Scroll X (R/W) + GB_IO_LY = 0x44, // LCDC Y-Coordinate (R) + GB_IO_LYC = 0x45, // LY Compare (R/W) + GB_IO_DMA = 0x46, // DMA Transfer and Start Address (W) + GB_IO_BGP = 0x47, // BG Palette Data (R/W) - Non CGB Mode Only + GB_IO_OBP0 = 0x48, // Object Palette 0 Data (R/W) - Non CGB Mode Only + GB_IO_OBP1 = 0x49, // Object Palette 1 Data (R/W) - Non CGB Mode Only + GB_IO_WY = 0x4A, // Window Y Position (R/W) + GB_IO_WX = 0x4B, // Window X Position minus 7 (R/W) + + // Controls DMG mode and PGB mode + GB_IO_KEY0 = 0x4C, + + /* General CGB features */ + GB_IO_KEY1 = 0x4D, // CGB Mode Only - Prepare Speed Switch + + /* Missing */ + + GB_IO_VBK = 0x4F, // CGB Mode Only - VRAM Bank + GB_IO_BANK = 0x50, // Write to disable the boot ROM mapping + + /* CGB DMA */ + GB_IO_HDMA1 = 0x51, // CGB Mode Only - New DMA Source, High + GB_IO_HDMA2 = 0x52, // CGB Mode Only - New DMA Source, Low + GB_IO_HDMA3 = 0x53, // CGB Mode Only - New DMA Destination, High + GB_IO_HDMA4 = 0x54, // CGB Mode Only - New DMA Destination, Low + GB_IO_HDMA5 = 0x55, // CGB Mode Only - New DMA Length/Mode/Start + + /* IR */ + GB_IO_RP = 0x56, // CGB Mode Only - Infrared Communications Port + + /* Missing */ + + /* CGB Palettes */ + GB_IO_BGPI = 0x68, // CGB Mode Only - Background Palette Index + GB_IO_BGPD = 0x69, // CGB Mode Only - Background Palette Data + GB_IO_OBPI = 0x6A, // CGB Mode Only - Object Palette Index + GB_IO_OBPD = 0x6B, // CGB Mode Only - Object Palette Data + GB_IO_OPRI = 0x6C, // Affects object priority (X based or index based) + + /* Missing */ + + GB_IO_SVBK = 0x70, // CGB Mode Only - WRAM Bank + GB_IO_PSM = 0x71, // Palette Selection Mode, controls the PSW and key combo + GB_IO_PSWX = 0x72, // X position of the palette switching window + GB_IO_PSWY = 0x73, // Y position of the palette switching window + GB_IO_PSW = 0x74, // Key combo to trigger the palette switching window + GB_IO_UNKNOWN5 = 0x75, // (8Fh) - Bit 4-6 (Read/Write) + GB_IO_PCM12 = 0x76, // Channels 1 and 2 amplitudes + GB_IO_PCM34 = 0x77, // Channels 3 and 4 amplitudes +}; + +enum { + GB_LCDC_BG_EN = 1, + GB_LCDC_OBJ_EN = 2, + GB_LCDC_OBJ_SIZE = 4, + GB_LCDC_BG_MAP = 8, + GB_LCDC_TILE_SEL = 0x10, + GB_LCDC_WIN_ENABLE = 0x20, + GB_LCDC_WIN_MAP = 0x40, + GB_LCDC_ENABLE = 0x80, +}; +``` + +In `gb.h` + +## Description + +Constants for accessing memory-mapped IO registers. `GB_IO_*` constants are offsets from the MMIO base (`0xFF00`). `GB_LCDC_*` constants are bit masks for the LCDC register. + +## See Also + * [[GB_read_memory]] + * [[GB_write_memory]] + * [[GB_get_direct_access]] \ No newline at end of file diff --git a/Instance Allocation.md b/Instance Allocation.md new file mode 100644 index 0000000..125772f --- /dev/null +++ b/Instance Allocation.md @@ -0,0 +1,57 @@ +## Definition + +
+GB_gameboy_t *GB_init(GB_gameboy_t *gb, GB_model_t model);
+void GB_free(GB_gameboy_t *gb);
+
+GB_gameboy_t *GB_alloc(void);
+void GB_dealloc(GB_gameboy_t *gb);
+
+bool GB_is_inited(GB_gameboy_t *gb);
+size_t GB_allocation_size(void);
+
+ +In `gb.h` + +## Description +These functions handle the creation and destruction of [[GB_gameboy_t]] instances that will emulate a specified [[model|GB_model_t]]. There are three ways these functions can be used to create an instance: +1. Statically allocated: +```c +static GB_gameboy_t gb; +GB_init(&gb, model); +/* ... */ +GB_free(&gb); +``` +This method can be used when you wish to avoid dynamic allocations. You must not use this method if you cannot guarantee the SameBoy headers you're compiling with are the *exact* same version as the SameBoy library you're linking against. + +2. Dynamically allocated: +```c +GB_gameboy_t *gb = GB_init(GB_alloc(), model); +/* ... */ +/* GB_free(gb); */ // optional +GB_dealloc(gb); +``` +`GB_alloc` will allocate a buffer with the right size for your instance, which can then be initialized with `GB_init`. `GB_delloc` will call `GB_free` if it wasn't already called, and free the allocated buffer. For convenience, `GB_init` always returns the first argument back. + +3. Manually allocated: +```c +GB_gameboy_t *gb = GB_init(my_custom_malloc(GB_allocation_size()), model); +/* ... */ +GB_free(gb); +my_custom_free(gb); +``` +Using `GB_allocation_size` you can obtain the required buffer size for an instance, which can then be used to allocate a buffer for it using any arbitrary allocation method. + +Additionally, `GB_is_inited` will return `true` if a [[GB_gameboy_t]] instance is initialized in a given buffer. If an instance is allocated in such before, it must be first freed with `GB_free` or `GB_alloc` before being deallocated. + +## Thread Safety +`GB_free` and `GB_dealloc` must not be called if the instance is being run in any thread, including the current one (via a callback). + +## Notes +`GB_init` must not be called on an already initialized instance. You must first call `GB_free` on that instance to avoid memory leaks. If you merely want to switch to another emulated [[model|GB_model_t]], use [[GB_switch_model_and_reset]]. + +# See Also +* [[GB_gameboy_t]] +* [[GB_model_t]] +* [[GB_reset]] +* [[GB_switch_model_and_reset]] \ No newline at end of file