From 02f55d12d305d0a778617c6b7ed225fc09d0c09d Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sun, 7 Nov 2021 14:13:52 +0200 Subject: [PATCH] Maybe one day GCC will stop being shit at handling __attribute__s --- Core/apu.h | 16 ++++++++-------- Core/cheats.h | 2 +- Core/debugger.h | 16 ++++++++-------- Core/defs.h | 2 +- Core/display.h | 8 ++++---- Core/gb.h | 2 +- Core/joypad.h | 2 +- Core/mbc.h | 4 ++-- Core/memory.h | 6 +++--- Core/rewind.h | 4 ++-- Core/rumble.h | 2 +- Core/save_state.h | 4 ++-- Core/sgb.h | 6 +++--- Core/sm83_cpu.h | 2 +- Core/symbol_hash.h | 12 ++++++------ Core/timing.h | 10 +++++----- 16 files changed, 49 insertions(+), 49 deletions(-) diff --git a/Core/apu.h b/Core/apu.h index 7fa91da..f7b125c 100644 --- a/Core/apu.h +++ b/Core/apu.h @@ -171,14 +171,14 @@ void GB_set_interference_volume(GB_gameboy_t *gb, double volume); void GB_apu_set_sample_callback(GB_gameboy_t *gb, GB_sample_callback_t callback); #ifdef GB_INTERNAL -bool internal GB_apu_is_DAC_enabled(GB_gameboy_t *gb, unsigned index); -void internal GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value); -uint8_t internal GB_apu_read(GB_gameboy_t *gb, uint8_t reg); -void internal GB_apu_div_event(GB_gameboy_t *gb); -void internal GB_apu_div_secondary_event(GB_gameboy_t *gb); -void internal GB_apu_init(GB_gameboy_t *gb); -void internal GB_apu_run(GB_gameboy_t *gb); -void internal GB_apu_update_cycles_per_sample(GB_gameboy_t *gb); +internal bool GB_apu_is_DAC_enabled(GB_gameboy_t *gb, unsigned index); +internal void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value); +internal uint8_t GB_apu_read(GB_gameboy_t *gb, uint8_t reg); +internal void GB_apu_div_event(GB_gameboy_t *gb); +internal void GB_apu_div_secondary_event(GB_gameboy_t *gb); +internal void GB_apu_init(GB_gameboy_t *gb); +internal void GB_apu_run(GB_gameboy_t *gb); +internal void GB_apu_update_cycles_per_sample(GB_gameboy_t *gb); #endif #endif /* apu_h */ diff --git a/Core/cheats.h b/Core/cheats.h index 68bbe1b..f9c076c 100644 --- a/Core/cheats.h +++ b/Core/cheats.h @@ -20,7 +20,7 @@ int GB_save_cheats(GB_gameboy_t *gb, const char *path); #ifdef GB_DISABLE_CHEATS #define GB_apply_cheat(...) #else -void internal GB_apply_cheat(GB_gameboy_t *gb, uint16_t address, uint8_t *value); +internal void GB_apply_cheat(GB_gameboy_t *gb, uint16_t address, uint8_t *value); #endif #endif diff --git a/Core/debugger.h b/Core/debugger.h index e2e49f2..3d77b7a 100644 --- a/Core/debugger.h +++ b/Core/debugger.h @@ -17,14 +17,14 @@ #define GB_debugger_add_symbol(gb, bank, address, symbol) ((void)bank, (void)address, (void)symbol) #else -void internal GB_debugger_run(GB_gameboy_t *gb); -void internal GB_debugger_handle_async_commands(GB_gameboy_t *gb); -void internal GB_debugger_call_hook(GB_gameboy_t *gb, uint16_t call_addr); -void internal GB_debugger_ret_hook(GB_gameboy_t *gb); -void internal GB_debugger_test_write_watchpoint(GB_gameboy_t *gb, uint16_t addr, uint8_t value); -void internal GB_debugger_test_read_watchpoint(GB_gameboy_t *gb, uint16_t addr); -const GB_bank_symbol_t *internal GB_debugger_find_symbol(GB_gameboy_t *gb, uint16_t addr); -void internal GB_debugger_add_symbol(GB_gameboy_t *gb, uint16_t bank, uint16_t address, const char *symbol); +internal void GB_debugger_run(GB_gameboy_t *gb); +internal void GB_debugger_handle_async_commands(GB_gameboy_t *gb); +internal void GB_debugger_call_hook(GB_gameboy_t *gb, uint16_t call_addr); +internal void GB_debugger_ret_hook(GB_gameboy_t *gb); +internal void GB_debugger_test_write_watchpoint(GB_gameboy_t *gb, uint16_t addr, uint8_t value); +internal void GB_debugger_test_read_watchpoint(GB_gameboy_t *gb, uint16_t addr); +internal const GB_bank_symbol_t *GB_debugger_find_symbol(GB_gameboy_t *gb, uint16_t addr); +internal void GB_debugger_add_symbol(GB_gameboy_t *gb, uint16_t bank, uint16_t address, const char *symbol); #endif /* GB_DISABLE_DEBUGGER */ #endif diff --git a/Core/defs.h b/Core/defs.h index 63deb40..b4f13f5 100644 --- a/Core/defs.h +++ b/Core/defs.h @@ -7,7 +7,7 @@ #define likely(x) __builtin_expect((x), 1) #define unlikely(x) __builtin_expect((x), 0) -#define internal __attribute__((visibility("hidden"))) +#define internal __attribute__((visibility("internal"))) #if __clang__ #define unrolled _Pragma("unroll") diff --git a/Core/display.h b/Core/display.h index cd6064a..1cac6ae 100644 --- a/Core/display.h +++ b/Core/display.h @@ -6,10 +6,10 @@ #include #ifdef GB_INTERNAL -void internal GB_display_run(GB_gameboy_t *gb, uint8_t cycles); -void internal GB_palette_changed(GB_gameboy_t *gb, bool background_palette, uint8_t index); -void internal GB_STAT_update(GB_gameboy_t *gb); -void internal GB_lcd_off(GB_gameboy_t *gb); +internal void GB_display_run(GB_gameboy_t *gb, uint8_t cycles); +internal void GB_palette_changed(GB_gameboy_t *gb, bool background_palette, uint8_t index); +internal void GB_STAT_update(GB_gameboy_t *gb); +internal void GB_lcd_off(GB_gameboy_t *gb); enum { GB_OBJECT_PRIORITY_X, diff --git a/Core/gb.h b/Core/gb.h index 145eac5..1cec2ac 100644 --- a/Core/gb.h +++ b/Core/gb.h @@ -856,7 +856,7 @@ void GB_get_rom_title(GB_gameboy_t *gb, char *title); uint32_t GB_get_rom_crc32(GB_gameboy_t *gb); #ifdef GB_INTERNAL -void internal GB_borrow_sgb_border(GB_gameboy_t *gb); +internal void GB_borrow_sgb_border(GB_gameboy_t *gb); #endif #endif /* GB_h */ diff --git a/Core/joypad.h b/Core/joypad.h index 645021d..615e34a 100644 --- a/Core/joypad.h +++ b/Core/joypad.h @@ -20,6 +20,6 @@ void GB_set_key_state_for_player(GB_gameboy_t *gb, GB_key_t index, unsigned play void GB_icd_set_joyp(GB_gameboy_t *gb, uint8_t value); #ifdef GB_INTERNAL -void internal GB_update_joyp(GB_gameboy_t *gb); +internal void GB_update_joyp(GB_gameboy_t *gb); #endif #endif /* joypad_h */ diff --git a/Core/mbc.h b/Core/mbc.h index 3253ec5..709bd1f 100644 --- a/Core/mbc.h +++ b/Core/mbc.h @@ -26,8 +26,8 @@ typedef struct { #ifdef GB_INTERNAL extern const GB_cartridge_t GB_cart_defs[256]; -void internal GB_update_mbc_mappings(GB_gameboy_t *gb); -void internal GB_configure_cart(GB_gameboy_t *gb); +internal void GB_update_mbc_mappings(GB_gameboy_t *gb); +internal void GB_configure_cart(GB_gameboy_t *gb); #endif #endif /* MBC_h */ diff --git a/Core/memory.h b/Core/memory.h index a53ab7c..0b7a43c 100644 --- a/Core/memory.h +++ b/Core/memory.h @@ -9,9 +9,9 @@ void GB_set_read_memory_callback(GB_gameboy_t *gb, GB_read_memory_callback_t cal uint8_t GB_read_memory(GB_gameboy_t *gb, uint16_t addr); void GB_write_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value); #ifdef GB_INTERNAL -void internal GB_dma_run(GB_gameboy_t *gb); -void internal GB_hdma_run(GB_gameboy_t *gb); -void internal GB_trigger_oam_bug(GB_gameboy_t *gb, uint16_t address); +internal void GB_dma_run(GB_gameboy_t *gb); +internal void GB_hdma_run(GB_gameboy_t *gb); +internal void GB_trigger_oam_bug(GB_gameboy_t *gb, uint16_t address); #endif #endif /* memory_h */ diff --git a/Core/rewind.h b/Core/rewind.h index a3e2edf..3cc23ed 100644 --- a/Core/rewind.h +++ b/Core/rewind.h @@ -5,8 +5,8 @@ #include "defs.h" #ifdef GB_INTERNAL -void internal GB_rewind_push(GB_gameboy_t *gb); -void internal GB_rewind_free(GB_gameboy_t *gb); +internal void GB_rewind_push(GB_gameboy_t *gb); +internal void GB_rewind_free(GB_gameboy_t *gb); #endif bool GB_rewind_pop(GB_gameboy_t *gb); void GB_set_rewind_length(GB_gameboy_t *gb, double seconds); diff --git a/Core/rumble.h b/Core/rumble.h index 196c191..ca34737 100644 --- a/Core/rumble.h +++ b/Core/rumble.h @@ -10,7 +10,7 @@ typedef enum { } GB_rumble_mode_t; #ifdef GB_INTERNAL -void internal GB_handle_rumble(GB_gameboy_t *gb); +internal void GB_handle_rumble(GB_gameboy_t *gb); #endif void GB_set_rumble_mode(GB_gameboy_t *gb, GB_rumble_mode_t mode); diff --git a/Core/save_state.h b/Core/save_state.h index b57130f..2352cac 100644 --- a/Core/save_state.h +++ b/Core/save_state.h @@ -36,8 +36,8 @@ static inline uint32_t state_magic(void) } /* For internal in-memory save states (rewind, debugger) that do not need BESS */ -size_t internal GB_get_save_state_size_no_bess(GB_gameboy_t *gb); -void internal GB_save_state_to_buffer_no_bess(GB_gameboy_t *gb, uint8_t *buffer); +internal size_t GB_get_save_state_size_no_bess(GB_gameboy_t *gb); +internal void GB_save_state_to_buffer_no_bess(GB_gameboy_t *gb, uint8_t *buffer); #endif #endif /* save_state_h */ diff --git a/Core/sgb.h b/Core/sgb.h index 7d961a1..4ed2bea 100644 --- a/Core/sgb.h +++ b/Core/sgb.h @@ -58,9 +58,9 @@ struct GB_sgb_s { uint8_t received_header[0x54]; }; -void internal GB_sgb_write(GB_gameboy_t *gb, uint8_t value); -void internal GB_sgb_render(GB_gameboy_t *gb); -void internal GB_sgb_load_default_data(GB_gameboy_t *gb); +internal void GB_sgb_write(GB_gameboy_t *gb, uint8_t value); +internal void GB_sgb_render(GB_gameboy_t *gb); +internal void GB_sgb_load_default_data(GB_gameboy_t *gb); #endif diff --git a/Core/sm83_cpu.h b/Core/sm83_cpu.h index 95e6462..1221fd7 100644 --- a/Core/sm83_cpu.h +++ b/Core/sm83_cpu.h @@ -5,7 +5,7 @@ void GB_cpu_disassemble(GB_gameboy_t *gb, uint16_t pc, uint16_t count); #ifdef GB_INTERNAL -void internal GB_cpu_run(GB_gameboy_t *gb); +internal void GB_cpu_run(GB_gameboy_t *gb); #endif #endif /* sm83_cpu_h */ diff --git a/Core/symbol_hash.h b/Core/symbol_hash.h index 7efc475..d063312 100644 --- a/Core/symbol_hash.h +++ b/Core/symbol_hash.h @@ -27,12 +27,12 @@ typedef struct { } GB_reversed_symbol_map_t; #ifdef GB_INTERNAL -void internal GB_reversed_map_add_symbol(GB_reversed_symbol_map_t *map, uint16_t bank, GB_bank_symbol_t *symbol); -const GB_symbol_t *internal GB_reversed_map_find_symbol(GB_reversed_symbol_map_t *map, const char *name); -GB_bank_symbol_t *internal GB_map_add_symbol(GB_symbol_map_t *map, uint16_t addr, const char *name); -const GB_bank_symbol_t *internal GB_map_find_symbol(GB_symbol_map_t *map, uint16_t addr); -GB_symbol_map_t *internal GB_map_alloc(void); -void internal GB_map_free(GB_symbol_map_t *map); +internal void GB_reversed_map_add_symbol(GB_reversed_symbol_map_t *map, uint16_t bank, GB_bank_symbol_t *symbol); +internal const GB_symbol_t *GB_reversed_map_find_symbol(GB_reversed_symbol_map_t *map, const char *name); +internal GB_bank_symbol_t *GB_map_add_symbol(GB_symbol_map_t *map, uint16_t addr, const char *name); +internal const GB_bank_symbol_t *GB_map_find_symbol(GB_symbol_map_t *map, uint16_t addr); +internal GB_symbol_map_t *GB_map_alloc(void); +internal void GB_map_free(GB_symbol_map_t *map); #endif #endif /* symbol_hash_h */ diff --git a/Core/timing.h b/Core/timing.h index 5e29e80..d5d7356 100644 --- a/Core/timing.h +++ b/Core/timing.h @@ -3,11 +3,11 @@ #include "defs.h" #ifdef GB_INTERNAL -void internal GB_advance_cycles(GB_gameboy_t *gb, uint8_t cycles); -void internal GB_emulate_timer_glitch(GB_gameboy_t *gb, uint8_t old_tac, uint8_t new_tac); -bool internal GB_timing_sync_turbo(GB_gameboy_t *gb); /* Returns true if should skip frame */ -void internal GB_timing_sync(GB_gameboy_t *gb); -void internal GB_set_internal_div_counter(GB_gameboy_t *gb, uint16_t value); +internal void GB_advance_cycles(GB_gameboy_t *gb, uint8_t cycles); +internal void GB_emulate_timer_glitch(GB_gameboy_t *gb, uint8_t old_tac, uint8_t new_tac); +internal bool GB_timing_sync_turbo(GB_gameboy_t *gb); /* Returns true if should skip frame */ +internal void GB_timing_sync(GB_gameboy_t *gb); +internal void GB_set_internal_div_counter(GB_gameboy_t *gb, uint16_t value); enum { GB_TIMA_RUNNING = 0,