Exemplo n.º 1
0
void video_manager::frame_update(bool debug)
{
	// only render sound and video if we're in the running phase
	int phase = machine().phase();
	bool skipped_it = m_skipping_this_frame;
	if (phase == MACHINE_PHASE_RUNNING && (!machine().paused() || machine().options().update_in_pause()))
	{
		bool anything_changed = finish_screen_updates();

		// if none of the screens changed and we haven't skipped too many frames in a row,
		// mark this frame as skipped to prevent throttling; this helps for games that
		// don't update their screen at the monitor refresh rate
		if (!anything_changed && !m_auto_frameskip && m_frameskip_level == 0 && m_empty_skip_count++ < 3)
			skipped_it = true;
		else
			m_empty_skip_count = 0;
	}

	// draw the user interface
	machine().ui().update_and_render(&machine().render().ui_container());

	// if we're throttling, synchronize before rendering
	attotime current_time = machine().time();
	if (!debug && !skipped_it && effective_throttle())
		update_throttle(current_time);

	// ask the OSD to update
	g_profiler.start(PROFILER_BLIT);
	machine().osd().update(!debug && skipped_it);
	g_profiler.stop();

	machine().manager().lua()->periodic_check();

	// perform tasks for this frame
	if (!debug)
		machine().call_notifiers(MACHINE_NOTIFY_FRAME);

	// update frameskipping
	if (!debug)
		update_frameskip();

	// update speed computations
	if (!debug && !skipped_it)
		recompute_speed(current_time);

	// call the end-of-frame callback
	if (phase == MACHINE_PHASE_RUNNING)
	{
		// reset partial updates if we're paused or if the debugger is active
		screen_device *screen = machine().first_screen();
		if (screen != nullptr && (machine().paused() || debug || debugger_within_instruction_hook(machine())))
			screen->reset_partial_updates();
	}
}
Exemplo n.º 2
0
void video_manager::frame_update(bool debug)
{
	// only render sound and video if we're in the running phase
	int phase = machine().phase();
	bool skipped_it = m_skipping_this_frame;
	if (phase == MACHINE_PHASE_RUNNING && (!machine().paused() || machine().options().update_in_pause()))
	{
		bool anything_changed = finish_screen_updates();

		// if none of the screens changed and we haven't skipped too many frames in a row,
        // mark this frame as skipped to prevent throttling; this helps for games that
        // don't update their screen at the monitor refresh rate
		if (!anything_changed && !m_auto_frameskip && m_frameskip_level == 0 && m_empty_skip_count++ < 3)
			skipped_it = true;
		else
			m_empty_skip_count = 0;
	}

	if(netClient || netServer)
	{
		//Can't skip frames in network mode
		skipped_it = false;
	}

	// draw the user interface
	ui_update_and_render(machine(), &machine().render().ui_container());

	// update the internal render debugger
	debugint_update_during_game(machine());

	// if we're throttling, synchronize before rendering
	attotime current_time = machine().time();

	//Don't throttle if you are a network client
	if (!netClient && !debug && !skipped_it && effective_throttle())
		update_throttle(current_time);

	// ask the OSD to update
	g_profiler.start(PROFILER_BLIT);
	machine().osd().update(!debug && skipped_it);
	g_profiler.stop();

	// perform tasks for this frame
	if (!debug)
		machine().call_notifiers(MACHINE_NOTIFY_FRAME);

	// update frameskipping
	if (!netClient && !netServer && !debug)
		update_frameskip();

	// update speed computations
	if (!debug && !skipped_it)
		recompute_speed(current_time);

	// call the end-of-frame callback
	if (phase == MACHINE_PHASE_RUNNING)
	{
		// reset partial updates if we're paused or if the debugger is active
		if (machine().primary_screen != NULL && (machine().paused() || debug || debugger_within_instruction_hook(machine())))
			machine().primary_screen->scanline0_callback();

		// otherwise, call the video EOF callback
		else
		{
			g_profiler.start(PROFILER_VIDEO);
			for (screen_device *screen = machine().first_screen(); screen != NULL; screen = screen->next_screen())
				screen->screen_eof();
			g_profiler.stop();
		}
	}
}