diff --git a/Core/display.c b/Core/display.c index 1d377c3..20a3bcf 100644 --- 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 index 39b1849..34110dc 100644 --- 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 index 91ec43d..f148ff0 100644 --- 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 index 7ed9eb1..6e317e0 100644 --- 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 index 036ef2f..dd54222 100644 --- 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 index 16f718f..598b1b1 100644 --- 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);