// construction/destruction //------------------------------------------------- // output_manager - constructor //------------------------------------------------- public output_manager(running_machine machine) { m_machine = machine; m_uniqueid = 12345; /* add pause callback */ machine.add_notifier(machine_notification.MACHINE_NOTIFY_PAUSE, pause); machine.add_notifier(machine_notification.MACHINE_NOTIFY_RESUME, resume); }
// construction/destruction /*------------------------------------------------- * output_manager - constructor * -------------------------------------------------*/ public output_manager(running_machine machine) { m_machine = machine; m_uniqueid = 12345; // add callbacks machine.add_notifier(machine_notification.MACHINE_NOTIFY_PAUSE, pause); machine.add_notifier(machine_notification.MACHINE_NOTIFY_RESUME, resume); machine.save().register_presave(presave); //machine.save().register_presave(save_prepost_delegate(FUNC(output_manager::presave), this)); machine.save().register_postload(postload); //machine.save().register_postload(save_prepost_delegate(FUNC(output_manager::postload), this)); }
attotime m_last_update; // last update time // construction/destruction //------------------------------------------------- // sound_manager - constructor //------------------------------------------------- public sound_manager(running_machine machine) { m_machine = machine; m_update_timer = null; m_finalmix_leftover = 0; m_finalmix = new std.vector <s16>(machine.sample_rate()); m_leftmix = new std.vector <s32>(machine.sample_rate()); m_rightmix = new std.vector <s32>(machine.sample_rate()); m_nosound_mode = machine.osd().no_sound() ? 1 : 0; m_wavfile = null; m_update_attoseconds = STREAMS_UPDATE_ATTOTIME.attoseconds(); m_last_update = attotime.zero; // get filename for WAV file or AVI file if specified string wavfile = machine.options().wav_write(); string avifile = machine.options().avi_write(); // handle -nosound and lower sample rate if not recording WAV or AVI if (m_nosound_mode != 0 && string.IsNullOrEmpty(wavfile) && string.IsNullOrEmpty(avifile)) { machine.sample_rate_set(11025); } // count the mixers if (sound_global.VERBOSE) { mixer_interface_iterator iter = new mixer_interface_iterator(machine.root_device()); sound_global.VPRINTF("total mixers = {0}\n", iter.count()); } // register callbacks machine.configuration().config_register("mixer", config_load, config_save); machine.add_notifier(machine_notification.MACHINE_NOTIFY_PAUSE, pause); machine.add_notifier(machine_notification.MACHINE_NOTIFY_RESUME, resume); machine.add_notifier(machine_notification.MACHINE_NOTIFY_RESET, reset); machine.add_notifier(machine_notification.MACHINE_NOTIFY_EXIT, stop_recording); // register global states machine.save().save_item(m_last_update, "m_last_update"); // set the starting attenuation set_attenuation(machine.options().volume()); // start the periodic update flushing timer m_update_timer = machine.scheduler().timer_alloc(update, this); m_update_timer.adjust(STREAMS_UPDATE_ATTOTIME, 0, STREAMS_UPDATE_ATTOTIME); }
public override ui_manager create_ui(running_machine machine) { m_ui = new mame_ui_manager(machine); m_ui.init(); machine.add_notifier(machine_notification.MACHINE_NOTIFY_RESET, reset); m_ui.set_startup_text("Initializing...", true); return(m_ui); }
u16 m_auto_time; // time in seconds to turn invisible // construction/destruction //------------------------------------------------- // crosshair_manager - constructor //------------------------------------------------- public crosshair_manager(running_machine machine) { m_machine = machine; m_usage = false; m_animation_counter = 0; m_auto_time = CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT; /* request a callback upon exiting */ machine.add_notifier(machine_notification.MACHINE_NOTIFY_EXIT, exit); for (int player = 0; player < MAX_PLAYERS; player++) { m_crosshair[player] = new render_crosshair(machine, player); } /* determine who needs crosshairs */ foreach (var port in machine.ioport().ports()) { foreach (ioport_field field in port.Value.fields()) { if (field.crosshair_axis() != crosshair_axis_t.CROSSHAIR_AXIS_NONE) { int player = field.player(); assert(player < MAX_PLAYERS); /* mark as used and set the default visibility and mode */ m_usage = true; m_crosshair[player].set_used(true); m_crosshair[player].set_mode(CROSSHAIR_VISIBILITY_DEFAULT); m_crosshair[player].set_visible(CROSSHAIR_VISIBILITY_DEFAULT != CROSSHAIR_VISIBILITY_OFF); m_crosshair[player].set_default_bitmap(); } } } /* register callbacks for when we load/save configurations */ if (m_usage) { machine.configuration().config_register("crosshairs", config_load, config_save); } /* register the animation callback */ screen_device first_screen = new screen_device_enumerator(machine.root_device()).first(); if (first_screen != null) { first_screen.register_vblank_callback(animate); } }
// construction/destruction //------------------------------------------------- // ui_input_manager - constructor //------------------------------------------------- public ui_input_manager(running_machine machine) { m_machine = machine; m_current_mouse_target = null; m_current_mouse_down = false; m_current_mouse_field = null; m_events_start = 0; m_events_end = 0; /* create the private data */ m_current_mouse_x = -1; m_current_mouse_y = -1; /* add a frame callback to poll inputs */ machine.add_notifier(machine_notification.MACHINE_NOTIFY_FRAME, frame_update); }
// construction/destruction //------------------------------------------------- // ui_input_manager - constructor //------------------------------------------------- public ui_input_manager(running_machine machine) { m_machine = machine; m_presses_enabled = true; m_current_mouse_target = null; m_current_mouse_x = -1; m_current_mouse_y = -1; m_current_mouse_down = false; m_current_mouse_field = null; m_events_start = 0; m_events_end = 0; std.fill(m_next_repeat, (osd_ticks_t)0); std.fill(m_seqpressed, (u8)0); // add a frame callback to poll inputs machine.add_notifier(machine_notification.MACHINE_NOTIFY_FRAME, frame_update); }
// construction/destruction //------------------------------------------------- // video_manager - constructor //------------------------------------------------- public video_manager(running_machine machine) { m_machine = machine; m_screenless_frame_timer = null; m_output_changed = false; m_throttle_realtime = attotime.zero; m_throttle_emutime = attotime.zero; m_throttle_history = 0; m_speed_last_realtime = 0; m_speed_last_emutime = attotime.zero; m_speed_percent = 1.0; m_overall_real_seconds = 0; m_overall_real_ticks = 0; m_overall_emutime = attotime.zero; m_overall_valid_counter = 0; m_frame_update_counter = 0; m_throttled = true; m_throttle_rate = 1.0f; m_fastforward = false; m_seconds_to_run = (u32)machine.options().seconds_to_run(); m_auto_frameskip = machine.options().auto_frameskip(); m_speed = (u32)original_speed_setting(); m_low_latency = machine.options().low_latency(); m_empty_skip_count = 0; m_frameskip_max = m_auto_frameskip ? (u8)machine.options().frameskip() : (u8)0; m_frameskip_level = m_auto_frameskip ? (u8)0 : (u8)machine.options().frameskip(); m_frameskip_counter = 0; m_frameskip_adjust = 0; m_skipping_this_frame = false; m_average_oversleep = 0; m_snap_target = null; m_snap_native = true; m_snap_width = 0; m_snap_height = 0; // request a callback upon exiting machine.add_notifier(machine_notification.MACHINE_NOTIFY_EXIT, exit); machine.save().register_postload(postload); // extract initial execution state from global configuration settings update_refresh_speed(); unsigned screen_count = (unsigned)(new screen_device_enumerator(machine.root_device()).count()); bool no_screens = screen_count == 0; // create a render target for snapshots string viewname = machine.options().snap_view(); m_snap_native = !no_screens && std.strcmp(viewname, "native") == 0; // the native target is hard-coded to our internal layout and has all options disabled if (m_snap_native) { throw new emu_unimplemented(); } else { // other targets select the specified view and turn off effects m_snap_target = machine.render().target_alloc(null, RENDER_CREATE_HIDDEN); m_snap_target.set_view(m_snap_target.configured_view(viewname, 0, 1)); m_snap_target.set_screen_overlay_enabled(false); } // extract snap resolution if present //if (sscanf(machine.options().snap_size(), "%dx%d", &m_snap_width, &m_snap_height) != 2) var parts = machine.options().snap_size().Split('x'); if (parts.Length == 2) { m_snap_width = Convert.ToInt32(parts[0]); m_snap_height = Convert.ToInt32(parts[1]); } else { m_snap_width = m_snap_height = 0; } // if no screens, create a periodic timer to drive updates if (no_screens) { m_screenless_frame_timer = machine.scheduler().timer_alloc(screenless_update_callback, this); m_screenless_frame_timer.adjust(screen_device.DEFAULT_FRAME_PERIOD, 0, screen_device.DEFAULT_FRAME_PERIOD); machine.output().set_global_notifier(video_notifier_callback, this); } }