git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 29d8cca511c621b02738d4c32539cdd5fff8bd8d
parent 14cf76776a641147ccf2692fb917fbe1d51f447c
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sat, 16 Nov 2024 20:25:36 +0200

Keep moving and renaming things

Diffstat:
MCocoa/Document.m2+-
MCore/debugger.c5+++++
MCore/debugger.h3+++
MCore/display.c6++++++
MCore/display.h1+
MCore/gb.c16----------------
MCore/gb.h5-----
MCore/joypad.c5+++++
MCore/joypad.h3+++
MSDL/main.c2+-
10 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/Cocoa/Document.m b/Cocoa/Document.m @@ -298,7 +298,7 @@ static void debuggerReloadCallback(GB_gameboy_t *gb) GB_apu_set_sample_callback(&_gb, audioCallback); GB_set_rumble_callback(&_gb, rumbleCallback); GB_set_infrared_callback(&_gb, infraredStateChanged); - GB_set_debugger_reload_callback(&_gb, debuggerReloadCallback); + GB_debugger_set_reload_callback(&_gb, debuggerReloadCallback); GB_gameboy_t *gb = &_gb; __unsafe_unretained Document *weakSelf = self; diff --git a/Core/debugger.c b/Core/debugger.c @@ -2783,6 +2783,11 @@ void GB_debugger_set_disabled(GB_gameboy_t *gb, bool disabled) update_debug_active(gb); } +void GB_debugger_set_reload_callback(GB_gameboy_t *gb, GB_debugger_reload_callback_t callback) +{ + gb->debugger_reload_callback = callback; +} + /* Jump-to breakpoints */ static bool is_in_trivial_memory(uint16_t addr) diff --git a/Core/debugger.h b/Core/debugger.h @@ -5,6 +5,8 @@ #include "defs.h" #include "symbol_hash.h" +typedef void (*GB_debugger_reload_callback_t)(GB_gameboy_t *gb); + void GB_debugger_break(GB_gameboy_t *gb); #ifdef GB_INTERNAL bool /* Returns true if debugger waits for more commands. Not relevant for non-GB_INTERNAL */ @@ -21,6 +23,7 @@ bool GB_debugger_evaluate(GB_gameboy_t *gb, const char *string, uint16_t *result bool GB_debugger_is_stopped(GB_gameboy_t *gb); void GB_debugger_set_disabled(GB_gameboy_t *gb, bool disabled); void GB_debugger_clear_symbols(GB_gameboy_t *gb); +void GB_debugger_set_reload_callback(GB_gameboy_t *gb, GB_debugger_reload_callback_t callback); #ifdef GB_INTERNAL internal void GB_debugger_run(GB_gameboy_t *gb); diff --git a/Core/display.c b/Core/display.c @@ -57,6 +57,12 @@ void GB_set_rgb_encode_callback(GB_gameboy_t *gb, GB_rgb_encode_callback_t callb } } +void GB_set_pixels_output(GB_gameboy_t *gb, uint32_t *output) +{ + GB_ASSERT_NOT_RUNNING_OTHER_THREAD(gb) + gb->screen = output; +} + /* FIFO functions */ static inline unsigned fifo_size(GB_fifo_t *fifo) diff --git a/Core/display.h b/Core/display.h @@ -100,6 +100,7 @@ void GB_set_palette(GB_gameboy_t *gb, const GB_palette_t *palette); const GB_palette_t *GB_get_palette(GB_gameboy_t *gb); void GB_set_color_correction_mode(GB_gameboy_t *gb, GB_color_correction_mode_t mode); void GB_set_light_temperature(GB_gameboy_t *gb, double temperature); +void GB_set_pixels_output(GB_gameboy_t *gb, uint32_t *output); bool GB_is_odd_frame(GB_gameboy_t *gb); uint32_t GB_convert_rgb15(GB_gameboy_t *gb, uint16_t color, bool for_border); diff --git a/Core/gb.c b/Core/gb.c @@ -1234,12 +1234,6 @@ uint64_t GB_run_frame(GB_gameboy_t *gb) return gb->cycles_since_last_sync * 1000000000LL / 2 / GB_get_clock_rate(gb); /* / 2 because we use 8MHz units */ } -void GB_set_pixels_output(GB_gameboy_t *gb, uint32_t *output) -{ - GB_ASSERT_NOT_RUNNING_OTHER_THREAD(gb) - gb->screen = output; -} - uint32_t *GB_get_pixels_output(GB_gameboy_t *gb) { return gb->screen; @@ -1267,11 +1261,6 @@ void GB_set_async_input_callback(GB_gameboy_t *gb, GB_input_callback_t callback) #endif } -void GB_set_debugger_reload_callback(GB_gameboy_t *gb, GB_debugger_reload_callback_t callback) -{ - gb->debugger_reload_callback = callback; -} - void GB_set_execution_callback(GB_gameboy_t *gb, GB_execution_callback_t callback) { gb->execution_callback = callback; @@ -1945,11 +1934,6 @@ unsigned GB_get_player_count(GB_gameboy_t *gb) return GB_is_hle_sgb(gb)? gb->sgb->player_count : 1; } -void GB_set_update_input_hint_callback(GB_gameboy_t *gb, GB_update_input_hint_callback_t callback) -{ - gb->update_input_hint_callback = callback; -} - double GB_get_usual_frame_rate(GB_gameboy_t *gb) { return GB_get_clock_rate(gb) / (double)LCDC_PERIOD; diff --git a/Core/gb.h b/Core/gb.h @@ -269,12 +269,10 @@ typedef enum { typedef void (*GB_log_callback_t)(GB_gameboy_t *gb, const char *string, GB_log_attributes_t attributes); typedef char *(*GB_input_callback_t)(GB_gameboy_t *gb); -typedef void (*GB_debugger_reload_callback_t)(GB_gameboy_t *gb); typedef void (*GB_infrared_callback_t)(GB_gameboy_t *gb, bool on); typedef void (*GB_rumble_callback_t)(GB_gameboy_t *gb, double rumble_amplitude); typedef void (*GB_serial_transfer_bit_start_callback_t)(GB_gameboy_t *gb, bool bit_to_send); typedef bool (*GB_serial_transfer_bit_end_callback_t)(GB_gameboy_t *gb); -typedef void (*GB_update_input_hint_callback_t)(GB_gameboy_t *gb); typedef void (*GB_joyp_write_callback_t)(GB_gameboy_t *gb, uint8_t value); typedef void (*GB_icd_pixel_callback_t)(GB_gameboy_t *gb, uint8_t row); typedef void (*GB_icd_hreset_callback_t)(GB_gameboy_t *gb); @@ -939,7 +937,6 @@ void GB_set_rendering_disabled(GB_gameboy_t *gb, bool disabled); void GB_log(GB_gameboy_t *gb, const char *fmt, ...) __printflike(2, 3); void GB_attributed_log(GB_gameboy_t *gb, GB_log_attributes_t attributes, const char *fmt, ...) __printflike(3, 4); -void GB_set_pixels_output(GB_gameboy_t *gb, uint32_t *output); uint32_t *GB_get_pixels_output(GB_gameboy_t *gb); void GB_set_border_mode(GB_gameboy_t *gb, GB_border_mode_t border_mode); @@ -948,10 +945,8 @@ void GB_set_infrared_input(GB_gameboy_t *gb, bool state); void GB_set_log_callback(GB_gameboy_t *gb, GB_log_callback_t callback); void GB_set_input_callback(GB_gameboy_t *gb, GB_input_callback_t callback); void GB_set_async_input_callback(GB_gameboy_t *gb, GB_input_callback_t callback); -void GB_set_debugger_reload_callback(GB_gameboy_t *gb, GB_debugger_reload_callback_t callback); void GB_set_infrared_callback(GB_gameboy_t *gb, GB_infrared_callback_t callback); void GB_set_rumble_callback(GB_gameboy_t *gb, GB_rumble_callback_t callback); -void GB_set_update_input_hint_callback(GB_gameboy_t *gb, GB_update_input_hint_callback_t callback); /* Called when a new boot ROM is needed. The callback should call GB_load_boot_rom or GB_load_boot_rom_from_buffer */ void GB_set_boot_rom_load_callback(GB_gameboy_t *gb, GB_boot_rom_load_callback_t callback); diff --git a/Core/joypad.c b/Core/joypad.c @@ -221,3 +221,8 @@ void GB_set_emulate_joypad_bouncing(GB_gameboy_t *gb, bool emulate) { gb->no_bouncing_emulation = !emulate; } + +void GB_set_update_input_hint_callback(GB_gameboy_t *gb, GB_update_input_hint_callback_t callback) +{ + gb->update_input_hint_callback = callback; +} diff --git a/Core/joypad.h b/Core/joypad.h @@ -28,6 +28,8 @@ typedef enum { // For example, for player 2's (0-based; logical player 3) A button, use GB_MASK_FOR_PLAYER(GB_KEY_A_MASK, 2) #define GB_MASK_FOR_PLAYER(mask, player) ((x) << (player * 8)) +typedef void (*GB_update_input_hint_callback_t)(GB_gameboy_t *gb); + void GB_set_key_state(GB_gameboy_t *gb, GB_key_t index, bool pressed); void GB_set_key_state_for_player(GB_gameboy_t *gb, GB_key_t index, unsigned player, bool pressed); void GB_set_key_mask(GB_gameboy_t *gb, GB_key_mask_t mask); @@ -37,6 +39,7 @@ bool GB_get_joyp_accessed(GB_gameboy_t *gb); void GB_clear_joyp_accessed(GB_gameboy_t *gb); void GB_set_allow_illegal_inputs(GB_gameboy_t *gb, bool allow); void GB_set_emulate_joypad_bouncing(GB_gameboy_t *gb, bool emulate); +void GB_set_update_input_hint_callback(GB_gameboy_t *gb, GB_update_input_hint_callback_t callback); #ifdef GB_INTERNAL internal void GB_update_joyp(GB_gameboy_t *gb); diff --git a/SDL/main.c b/SDL/main.c @@ -875,7 +875,7 @@ restart:; GB_set_async_input_callback(&gb, asyc_input_callback); } - GB_set_debugger_reload_callback(&gb, debugger_reload_callback); + GB_debugger_set_reload_callback(&gb, debugger_reload_callback); } if (stop_on_start) { stop_on_start = false;

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.