Ejemplo n.º 1
0
bool video_manager::finish_screen_updates()
{
	// finish updating the screens
	screen_device_iterator iter(machine().root_device());

	for (screen_device *screen = iter.first(); screen != nullptr; screen = iter.next())
		screen->update_partial(screen->visible_area().max_y);

	// now add the quads for all the screens
	bool anything_changed = m_output_changed;
	m_output_changed = false;
	for (screen_device *screen = iter.first(); screen != nullptr; screen = iter.next())
		if (screen->update_quads())
			anything_changed = true;

	// draw HUD from LUA callback (if any)
	anything_changed |= machine().manager().lua()->frame_hook();

	// update our movie recording and burn-in state
	if (!machine().paused())
	{
		record_frame();

		// iterate over screens and update the burnin for the ones that care
		for (screen_device *screen = iter.first(); screen != nullptr; screen = iter.next())
			screen->update_burnin();
	}

	// draw any crosshairs
	for (screen_device *screen = iter.first(); screen != nullptr; screen = iter.next())
		machine().crosshair().render(*screen);

	return anything_changed;
}
Ejemplo n.º 2
0
bool video_manager::finish_screen_updates()
{
	// finish updating the screens
	for (screen_device *screen = machine().first_screen(); screen != NULL; screen = screen->next_screen())
		screen->update_partial(screen->visible_area().max_y);

	// now add the quads for all the screens
	bool anything_changed = false;
	for (screen_device *screen = machine().first_screen(); screen != NULL; screen = screen->next_screen())
		if (screen->update_quads())
			anything_changed = true;

	// update our movie recording and burn-in state
	if (!machine().paused())
	{
		record_frame();

		// iterate over screens and update the burnin for the ones that care
		for (screen_device *screen = machine().first_screen(); screen != NULL; screen = screen->next_screen())
			screen->update_burnin();
	}

	// draw any crosshairs
	for (screen_device *screen = machine().first_screen(); screen != NULL; screen = screen->next_screen())
		crosshair_render(*screen);

	return anything_changed;
}
Ejemplo n.º 3
0
static gint
handle_fdri_write(bitstream_parsed_t *parsed,
		  bitstream_parser_t *parser,
		  const unsigned length) {
  bytearray_t *ba = &parser->ba;
  const gchar *frame = bytearray_get_ptr(ba);
  guint i, nrframes;
  guint32 last_far = 0;

  /* Frame length writes must be a multiple of the flr length */
  if (length % frame_length) {
    debit_log(L_BITSTREAM,"%i bytes in FDRI write, "
	      "which is inconsistent with the FLR value %i",
	      length, frame_length);
    return -1;
  }

  nrframes = length / frame_length;

  /* We handle here a complete series of writes, so that we have
     the ability to see the start and end frames */
  last_far = register_read(parser, FAR);

  for (i = 0; i < nrframes; i++) {

    /* The first write of a FDRI write in WCFG mode does not flush the
       previous writes. As I don't know what other modes may be on, be
       conservative wrt to mode setting */
    if (i != 0)
      /* flush the previous frame into the frame array with the previous
	 FAR address */
      record_frame(parsed, parser, last_far);

    last_far = register_read(parser, FAR);
    parser->last_frame = frame;

    far_increment(parser);
    frame += frame_length * sizeof(guint32);
  }

  debit_log(L_BITSTREAM,"%i frames written to fdri", i);

  return length;
}
Ejemplo n.º 4
0
static gint
handle_cmd_write(bitstream_parsed_t *parsed,
		 bitstream_parser_t *parser) {
  cmd_code_t cmd = register_read(parser, CMD);

  switch(cmd) {
  case MFW:
    debit_log(L_BITSTREAM,"Executing multi-frame write");
    record_frame(parsed, parser, register_read(parser, FAR));
    break;
  case RCRC:
    debit_log(L_BITSTREAM,"Resetting CRC");
    register_write(parser, CRC, 0);
    break;
  default:
    debit_log(L_BITSTREAM,"execution of %i:%s is a noop",
	      cmd, cmd_names[cmd]);
    break;
  }

  return 0;

}
Ejemplo n.º 5
0
int main(int argc, char** argv) {
  width = 12, depth = 8, height = 60;
  xd = (width - 1) / 2.4;
  yd = (depth - 1) / 1.6;
  zd = (height - 1) / 2.0;
  xl = (width - 1) / xd;
  yl = (depth - 1) / yd;
  zl = (height - 1) / zd;
  total_leds = width * depth * height;
  channel = 0;

  fps = 60;
  period_x = xl / (2 * M_PI);
  speed_x = 1.0 / fps;
  period_y = yl / (2 * M_PI);
  speed_y = 0.9 / fps;
  period_z = zl / (2 * M_PI);
  speed_z = 0.8 / fps;

  sphere_r = .3;
  spheres = sqrt(pow(xl/2, 2) + pow(yl/2, 2) + pow(zl/2, 2)) / sphere_r;
  spheres += 2;
  frames_per_layer = fps / 2;
  pixel l_sphere_colors[spheres];
  sphere_colors = l_sphere_colors;
  int i;
  for (i = 0; i < spheres; i++) {
    sphere_colors[i] = randcolor();
  }

  pixel pixels[total_leds + 1];
  opc_sink s;

  if (argc < 2) {
    fprintf(stderr, "Usage: %s <server>[:<port>]\n", argv[0]);
    return 1;
  }

  s = opc_new_sink(argv[1]);

  int64_t frame_index = 0;
  int64_t start = now();
  struct fps_queue fpsq;
  int64_t frames[total_leds];
  fpsq.samples = fps;
  fpsq.pos = 0;
  fpsq.frames = frames;
  while (1) {
    sleep_until(start + 1000000 * frame_index / fps);
    render_frame(pixels, frame_index);
    if (!opc_put_pixels(s, channel, total_leds, pixels)) {
      break;
    }
    record_frame(&fpsq);
    if (fpsq.pos == 0) {
      double cur_fps = (fpsq.samples - 1) / (get_elapsed(&fpsq) / 1000000.0);
      printf("fps: %.2f  (%.2f Mbps)\n",
	     cur_fps, total_leds * 24 * cur_fps / 1000000.0);
    }
    frame_index++;
  }
  printf("fps: %f\n", frame_index / 5.0);
}