/* This hook is called at the end of every frame. */ static void machine_vsync_hook(void) { int i; unsigned int playtime; static unsigned int time = 0; if (vsid_autostart_delay > 0) { if (-- vsid_autostart_delay == 0) { log_message(c64_log, "Triggering VSID autoload"); psid_init_tune(0); for (i = 0; i < vsid_autostart_length; i += 1) { mem_inject((WORD)(vsid_autostart_load_addr + i), vsid_autostart_data[i]); } mem_set_basic_text(vsid_autostart_load_addr, (WORD)(vsid_autostart_load_addr + vsid_autostart_length)); kbdbuf_feed_runcmd("RUN\r"); } } playtime = (psid_increment_frames() * machine_timing.cycles_per_rfsh) / machine_timing.cycles_per_sec; if (playtime != time) { vsid_ui_display_time(playtime); time = playtime; } clk_guard_prevent_overflow(maincpu_clk_guard); }
/* This hook is called at the end of every frame. */ static void machine_vsync_hook(void) { CLOCK sub; if (vsid_mode) { unsigned int playtime; static unsigned int time = 0; playtime = (psid_increment_frames() * machine_timing.cycles_per_rfsh) / machine_timing.cycles_per_sec; if (playtime != time) { vsid_ui_display_time(playtime); time = playtime; } clk_guard_prevent_overflow(maincpu_clk_guard); return; } network_hook(); drive_vsync_hook(); autostart_advance(); screenshot_record(); sub = clk_guard_prevent_overflow(maincpu_clk_guard); /* The drive has to deal both with our overflowing and its own one, so it is called even when there is no overflowing in the main CPU. */ drivecpu_prevent_clk_overflow_all(sub); }