Move things around some more

This commit is contained in:
Lior Halphon 2024-11-24 14:36:12 +02:00
parent fe2c868d6c
commit b4fc2ff7ba
6 changed files with 39 additions and 41 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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) {

View File

@ -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);

View File

@ -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;
}

View File

@ -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);