LCD line callback (for #422)
This commit is contained in:
parent
7508ddb0cf
commit
a30247cf16
@ -456,6 +456,10 @@ void GB_lcd_off(GB_gameboy_t *gb)
|
||||
|
||||
gb->accessed_oam_row = -1;
|
||||
gb->wy_triggered = false;
|
||||
|
||||
if (unlikely(gb->lcd_line_callback)) {
|
||||
gb->lcd_line_callback(gb, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void add_object_from_index(GB_gameboy_t *gb, unsigned index)
|
||||
@ -983,6 +987,9 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles)
|
||||
/* Lines 0 - 143 */
|
||||
gb->window_y = -1;
|
||||
for (; gb->current_line < LINES; gb->current_line++) {
|
||||
if (unlikely(gb->lcd_line_callback)) {
|
||||
gb->lcd_line_callback(gb, gb->current_line);
|
||||
}
|
||||
|
||||
gb->oam_write_blocked = GB_is_cgb(gb) && !gb->cgb_double_speed;
|
||||
gb->accessed_oam_row = 0;
|
||||
@ -1343,6 +1350,9 @@ abort_fetching_object:
|
||||
for (; gb->current_line < VIRTUAL_LINES - 1; gb->current_line++) {
|
||||
gb->io_registers[GB_IO_LY] = gb->current_line;
|
||||
gb->ly_for_comparison = -1;
|
||||
if (unlikely(gb->lcd_line_callback)) {
|
||||
gb->lcd_line_callback(gb, gb->current_line);
|
||||
}
|
||||
GB_SLEEP(gb, display, 26, 2);
|
||||
if (gb->current_line == LINES && !gb->stat_interrupt_line && (gb->io_registers[GB_IO_STAT] & 0x20)) {
|
||||
gb->io_registers[GB_IO_IF] |= 2;
|
||||
|
@ -1211,6 +1211,11 @@ void GB_set_execution_callback(GB_gameboy_t *gb, GB_execution_callback_t callbac
|
||||
gb->execution_callback = callback;
|
||||
}
|
||||
|
||||
void GB_set_lcd_line_callback(GB_gameboy_t *gb, GB_lcd_line_callback_t callback)
|
||||
{
|
||||
gb->lcd_line_callback = callback;
|
||||
}
|
||||
|
||||
const GB_palette_t GB_PALETTE_GREY = {{{0x00, 0x00, 0x00}, {0x55, 0x55, 0x55}, {0xaa, 0xaa, 0xaa}, {0xff, 0xff, 0xff}, {0xff, 0xff, 0xff}}};
|
||||
const GB_palette_t GB_PALETTE_DMG = {{{0x08, 0x18, 0x10}, {0x39, 0x61, 0x39}, {0x84, 0xa5, 0x63}, {0xc6, 0xde, 0x8c}, {0xd2, 0xe6, 0xa6}}};
|
||||
const GB_palette_t GB_PALETTE_MGB = {{{0x07, 0x10, 0x0e}, {0x3a, 0x4c, 0x3a}, {0x81, 0x8d, 0x66}, {0xc2, 0xce, 0x93}, {0xcf, 0xda, 0xac}}};
|
||||
|
@ -284,6 +284,7 @@ typedef void (*GB_icd_vreset_callback_t)(GB_gameboy_t *gb);
|
||||
typedef void (*GB_boot_rom_load_callback_t)(GB_gameboy_t *gb, GB_boot_rom_t type);
|
||||
|
||||
typedef void (*GB_execution_callback_t)(GB_gameboy_t *gb, uint16_t address, uint8_t opcode);
|
||||
typedef void (*GB_lcd_line_callback_t)(GB_gameboy_t *gb, uint8_t line);
|
||||
|
||||
struct GB_breakpoint_s;
|
||||
struct GB_watchpoint_s;
|
||||
@ -668,6 +669,7 @@ struct GB_gameboy_internal_s {
|
||||
GB_workboy_set_time_callback workboy_set_time_callback;
|
||||
GB_workboy_get_time_callback workboy_get_time_callback;
|
||||
GB_execution_callback_t execution_callback;
|
||||
GB_lcd_line_callback_t lcd_line_callback;
|
||||
|
||||
/*** Debugger ***/
|
||||
volatile bool debug_stopped, debug_disable;
|
||||
@ -843,7 +845,8 @@ void GB_set_update_input_hint_callback(GB_gameboy_t *gb, GB_update_input_hint_ca
|
||||
void GB_set_boot_rom_load_callback(GB_gameboy_t *gb, GB_boot_rom_load_callback_t callback);
|
||||
|
||||
void GB_set_execution_callback(GB_gameboy_t *gb, GB_execution_callback_t callback);
|
||||
|
||||
void GB_set_lcd_line_callback(GB_gameboy_t *gb, GB_lcd_line_callback_t callback);
|
||||
|
||||
void GB_set_palette(GB_gameboy_t *gb, const GB_palette_t *palette);
|
||||
|
||||
/* These APIs are used when using internal clock */
|
||||
|
Loading…
Reference in New Issue
Block a user