SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit b4fc2ff7ba618392fa85cdbf55cf11bb858bfded parent fe2c868d6c4b922a3cc4989093a3f8e47e06953d Author: Lior Halphon <LIJI32@gmail.com> Date: Sun, 24 Nov 2024 14:36:12 +0200 Move things around some more Diffstat:
| M | Core/display.c | 30 | ++++++++++++++++++++++++++++++ |
| M | Core/display.h | 4 | ++++ |
| M | Core/gb.c | 36 | ------------------------------------ |
| M | Core/gb.h | 5 | ----- |
| M | Core/sgb.c | 4 | ++++ |
| M | Core/sgb.h | 1 | + |
6 files changed, 39 insertions(+), 41 deletions(-)
diff --git a/Core/display.c b/Core/display.c @@ -2432,3 +2432,33 @@ bool GB_is_background_rendering_disabled(GB_gameboy_t *gb) return gb->background_disabled; } +unsigned GB_get_screen_width(GB_gameboy_t *gb) +{ + switch (gb->border_mode) { + default: + case GB_BORDER_SGB: + return GB_is_hle_sgb(gb)? 256 : 160; + case GB_BORDER_NEVER: + return 160; + case GB_BORDER_ALWAYS: + return 256; + } +} + +unsigned GB_get_screen_height(GB_gameboy_t *gb) +{ + switch (gb->border_mode) { + default: + case GB_BORDER_SGB: + return GB_is_hle_sgb(gb)? 224 : 144; + case GB_BORDER_NEVER: + return 144; + case GB_BORDER_ALWAYS: + return 224; + } +} + +double GB_get_usual_frame_rate(GB_gameboy_t *gb) +{ + return GB_get_clock_rate(gb) / (double)LCDC_PERIOD; +} diff --git a/Core/display.h b/Core/display.h @@ -102,6 +102,10 @@ void GB_set_color_correction_mode(GB_gameboy_t *gb, GB_color_correction_mode_t m void GB_set_light_temperature(GB_gameboy_t *gb, double temperature); void GB_set_pixels_output(GB_gameboy_t *gb, uint32_t *output); +unsigned GB_get_screen_width(GB_gameboy_t *gb); +unsigned GB_get_screen_height(GB_gameboy_t *gb); +double GB_get_usual_frame_rate(GB_gameboy_t *gb); + 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 @@ -1936,42 +1936,6 @@ void GB_set_border_mode(GB_gameboy_t *gb, GB_border_mode_t border_mode) gb->border_mode = border_mode; } -unsigned GB_get_screen_width(GB_gameboy_t *gb) -{ - switch (gb->border_mode) { - default: - case GB_BORDER_SGB: - return GB_is_hle_sgb(gb)? 256 : 160; - case GB_BORDER_NEVER: - return 160; - case GB_BORDER_ALWAYS: - return 256; - } -} - -unsigned GB_get_screen_height(GB_gameboy_t *gb) -{ - switch (gb->border_mode) { - default: - case GB_BORDER_SGB: - return GB_is_hle_sgb(gb)? 224 : 144; - case GB_BORDER_NEVER: - return 144; - case GB_BORDER_ALWAYS: - return 224; - } -} - -unsigned GB_get_player_count(GB_gameboy_t *gb) -{ - return GB_is_hle_sgb(gb)? gb->sgb->player_count : 1; -} - -double GB_get_usual_frame_rate(GB_gameboy_t *gb) -{ - return GB_get_clock_rate(gb) / (double)LCDC_PERIOD; -} - void GB_set_joyp_write_callback(GB_gameboy_t *gb, GB_joyp_write_callback_t callback) { if (!callback) { diff --git a/Core/gb.h b/Core/gb.h @@ -990,11 +990,6 @@ uint32_t GB_get_clock_rate(GB_gameboy_t *gb); uint32_t GB_get_unmultiplied_clock_rate(GB_gameboy_t *gb); void GB_set_clock_multiplier(GB_gameboy_t *gb, double multiplier); -unsigned GB_get_screen_width(GB_gameboy_t *gb); -unsigned GB_get_screen_height(GB_gameboy_t *gb); -double GB_get_usual_frame_rate(GB_gameboy_t *gb); -unsigned GB_get_player_count(GB_gameboy_t *gb); - /* Handy ROM info APIs */ // `title` must be at least 17 bytes in size void GB_get_rom_title(GB_gameboy_t *gb, char *title); diff --git a/Core/sgb.c b/Core/sgb.c @@ -909,3 +909,7 @@ static void render_jingle(GB_gameboy_t *gb, size_t count) return; } +unsigned GB_get_player_count(GB_gameboy_t *gb) +{ + return GB_is_hle_sgb(gb)? gb->sgb->player_count : 1; +} diff --git a/Core/sgb.h b/Core/sgb.h @@ -67,3 +67,4 @@ internal void GB_sgb_render(GB_gameboy_t *gb); internal void GB_sgb_load_default_data(GB_gameboy_t *gb); #endif +unsigned GB_get_player_count(GB_gameboy_t *gb);
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.