static void nes_vh_start(ppu_t ppu_type, double scanlines_per_frame) { ppu2c0x_interface ppu_interface; nes_zapper_hack = NULL; memset(&ppu_interface, 0, sizeof(ppu_interface)); ppu_interface.type = ppu_type; ppu_interface.num = 1; ppu_interface.vrom_region[0] = nes.chr_chunks ? REGION_GFX1 : REGION_INVALID; ppu_interface.mirroring[0] = PPU_MIRROR_NONE; ppu_interface.nmi_handler[0] = ppu_nmi; ppu2c0x_init(&ppu_interface); ppu2c0x_set_vidaccess_callback(0, nes_ppu_vidaccess); ppu2c0x_set_scanlines_per_frame(0, ceil(scanlines_per_frame)); if (nes.four_screen_vram) { ppu2c0x_set_mirroring(0, PPU_MIRROR_4SCREEN); } else { switch(nes.hard_mirroring) { case 0: ppu2c0x_set_mirroring(0, PPU_MIRROR_HORZ); break; case 1: ppu2c0x_set_mirroring(0, PPU_MIRROR_VERT); break; } } add_reset_callback(Machine, nes_vh_reset); /* Reset the mapper variables. Will also mark the char-gen ram as dirty */ mapper_reset(nes.mapper); }
static void nes_vh_reset( running_machine &machine ) { nes_state *state = machine.driver_data<nes_state>(); ppu2c0x_set_vidaccess_callback(machine.device("ppu"), nes_ppu_vidaccess); if (state->m_four_screen_vram) set_nt_mirroring(machine, PPU_MIRROR_4SCREEN); else { switch (state->m_hard_mirroring) { case PPU_MIRROR_HORZ: case PPU_MIRROR_VERT: case PPU_MIRROR_HIGH: case PPU_MIRROR_LOW: set_nt_mirroring(machine, state->m_hard_mirroring); break; default: set_nt_mirroring(machine, PPU_MIRROR_NONE); break; } } }