running_machine m_machine; // reference to our machine // construction/destruction //------------------------------------------------- // network_manager - constructor //------------------------------------------------- public network_manager(running_machine machine) { m_machine = machine; machine.configuration().config_register("network", config_load, config_save); }
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); } }
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); }
running_machine m_machine; // reference to our machine // construction/destruction public image_manager(running_machine machine) { m_machine = machine; // make sure that any required devices have been allocated foreach (device_image_interface image in new image_interface_iterator(machine.root_device())) { // ignore things not user loadable if (!image.user_loadable()) { continue; } throw new emu_unimplemented(); } machine.configuration().config_register("image_directories", config_load, config_save); }
// construction/destruction //------------------------------------------------- // bookkeeping_manager - constructor //------------------------------------------------- public bookkeeping_manager(running_machine machine) { m_machine = machine; m_dispensed_tickets = 0; /* reset coin counters */ for (int counternum = 0; counternum < COIN_COUNTERS; counternum++) { m_lastcoin[counternum] = 0; m_coinlockedout[counternum] = 0; m_coin_count[counternum] = 0; } // register coin save state machine.save().save_item(m_coin_count, "m_coin_count"); machine.save().save_item(m_coinlockedout, "m_coinlockedout"); machine.save().save_item(m_lastcoin, "m_lastcoin"); machine.save().save_item(m_dispensed_tickets, "m_dispensed_tickets"); // register for configuration machine.configuration().config_register("counters", config_load, config_save); }