void emulator_load(const char *rom) { ines_unloadrom(); ines_loadrom(rom); mapper_make_current(c_rom->mapper); mapper_reset(); cpu_init(); ppu_init(); papu_init(EMULATOR_DEF_SOUND_SAMLE_RATE, EMULATOR_DEF_SOUND_DURATION); emulator_last_tick = 0; }
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 int nes_vh_start(int ppu_scanlines_per_frame) { ppu2c03b_interface ppu_interface; memset(&ppu_interface, 0, sizeof(ppu_interface)); 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; ppu2c03b_init(&ppu_interface); ppu2c03b_set_vidaccess_callback(0, nes_ppu_vidaccess); ppu2c03b_set_scanlines_per_frame(0, ppu_scanlines_per_frame); if (nes.four_screen_vram) { /* TODO: figure out what to do here */ } else { switch(nes.hard_mirroring) { case 0: ppu2c03b_set_mirroring(0, PPU_MIRROR_HORZ); break; case 1: ppu2c03b_set_mirroring(0, PPU_MIRROR_VERT); break; } } add_reset_callback(nes_vh_reset); /* Reset the mapper variables. Will also mark the char-gen ram as dirty */ mapper_reset (nes.mapper); return 0; }