Esempio n. 1
0
        // interface-level overrides

        //-------------------------------------------------
        //  interface_validity_check - validation for a
        //  device after the configuration has been
        //  constructed
        //-------------------------------------------------
        protected override void interface_validity_check(validity_checker valid)
        {
            // validate the interrupts
            if (m_vblank_interrupt != null)
            {
                screen_device_iterator iter = new screen_device_iterator(device().mconfig().root_device());
                if (iter.first() == null)
                {
                    osd_printf_error("VBLANK interrupt specified, but the driver is screenless\n");
                }
                else if (m_vblank_interrupt_screen != null && device().siblingdevice(m_vblank_interrupt_screen) == null)
                {
                    osd_printf_error("VBLANK interrupt references a nonexistant screen tag '{0}'\n", m_vblank_interrupt_screen);
                }
            }

            if (m_timed_interrupt != null && m_timed_interrupt_period == attotime.zero)
            {
                osd_printf_error("Timed interrupt handler specified with 0 period\n");
            }
            else if (m_timed_interrupt == null && m_timed_interrupt_period != attotime.zero)
            {
                osd_printf_error("No timer interrupt handler specified, but has a non-0 period given\n");
            }
        }
Esempio n. 2
0
        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_iterator(machine.root_device()).first();

            if (first_screen != null)
            {
                first_screen.register_vblank_callback(animate);
            }
        }
Esempio n. 3
0
File: info.cs Progetto: kwanboy/mcs
        //-------------------------------------------------
        //  game_info_string - return the game info text
        //-------------------------------------------------
        public string game_info_string()
        {
            string buf = "";  //std::ostringstream buf;

            // print description, manufacturer, and CPU:
            buf += string.Format("{0}\n{1} {2}\nDriver: {3}\n\nCPU:\n",  // %1$s\n%2$s %3$s\nDriver: %4$s\n\nCPU:\n
                                 m_machine.system().type.fullname(),
                                 m_machine.system().year,
                                 m_machine.system().manufacturer,
                                 core_filename_extract_base(m_machine.system().type.source()));

            // loop over all CPUs
            execute_interface_iterator execiter = new execute_interface_iterator(m_machine.root_device());

            std.unordered_set <string> exectags = new std.unordered_set <string>();
            foreach (device_execute_interface exec in execiter)
            {
                if (!exectags.insert(exec.device().tag()))  //.second)
                {
                    continue;
                }

                // get cpu specific clock that takes internal multiplier/dividers into account
                int clock = (int)exec.device().clock();

                // count how many identical CPUs we have
                int    count = 1;
                string name  = exec.device().name();
                foreach (device_execute_interface scan in execiter)
                {
                    if (exec.device().type() == scan.device().type() && strcmp(name, scan.device().name()) == 0 && exec.device().clock() == scan.device().clock())
                    {
                        if (exectags.insert(scan.device().tag()))  //.second)
                        {
                            count++;
                        }
                    }
                }

                // if more than one, prepend a #x in front of the CPU name
                // display clock in kHz or MHz
                buf += string.Format(
                    (count > 1) ? "{0}X{1} {2}.{3}{4}{5}\n" : "{1} {2}.{3}{4}{5}\n",      // (count > 1) ? "%1$d" UTF8_MULTIPLY "%2$s %3$d.%4$0*5$d%6$s\n" : "%2$s %3$d.%4$0*5$d%6$s\n",
                    count,
                    name,
                    (clock >= 1000000) ? (clock / 1000000) : (clock / 1000),
                    (clock >= 1000000) ? (clock % 1000000) : (clock % 1000),
                    (clock >= 1000000) ? 6 : 3,
                    (clock >= 1000000) ? "MHz" : "kHz");
            }

            // loop over all sound chips
            sound_interface_iterator snditer = new sound_interface_iterator(m_machine.root_device());

            std.unordered_set <string> soundtags = new std.unordered_set <string>();
            bool found_sound = false;

            foreach (device_sound_interface sound in snditer)
            {
                if (!sound.issound() || !soundtags.insert(sound.device().tag()))  //.second)
                {
                    continue;
                }

                // append the Sound: string
                if (!found_sound)
                {
                    buf += "\nSound:\n";
                }

                found_sound = true;

                // count how many identical sound chips we have
                int count = 1;
                foreach (device_sound_interface scan in snditer)
                {
                    if (sound.device().type() == scan.device().type() && sound.device().clock() == scan.device().clock())
                    {
                        if (soundtags.insert(scan.device().tag()))  //.second)
                        {
                            count++;
                        }
                    }
                }

                // if more than one, prepend a #x in front of the CPU name
                // display clock in kHz or MHz
                int clock = (int)sound.device().clock();
                buf += string.Format(
                    (count > 1)
                            ? ((clock != 0) ? "{0}X{1} {2}.{3}{4}{5}\n" : "{0}X{1}\n")  // "%1$d" UTF8_MULTIPLY "%2$s %3$d.%4$0*5$d%6$s\n" : "%1$d" UTF8_MULTIPLY "%2$s\n")
                            : ((clock != 0) ? "{1} {2}.{3}{4}{5}\n" : "{1}\n"),
                    count,
                    sound.device().name(),
                    (clock >= 1000000) ? (clock / 1000000) : (clock / 1000),
                    (clock >= 1000000) ? (clock % 1000000) : (clock % 1000),
                    (clock >= 1000000) ? 6 : 3,
                    (clock >= 1000000) ? "MHz" : "kHz");
            }

            // display screen information
            buf += "\nVideo:\n";
            screen_device_iterator scriter = new screen_device_iterator(m_machine.root_device());
            int scrcount = scriter.count();

            if (scrcount == 0)
            {
                buf += "None\n";
            }
            else
            {
                foreach (screen_device screen in scriter)
                {
                    string detail;
                    if (screen.screen_type() == screen_type_enum.SCREEN_TYPE_VECTOR)
                    {
                        detail = "Vector";
                    }
                    else
                    {
                        rectangle visarea = screen.visible_area();
                        detail = string.Format("{0} X {1} ({2}) {3} Hz",  //"%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz",
                                               visarea.width(), visarea.height(),
                                               (screen.orientation() & ORIENTATION_SWAP_XY) != 0 ? "V" : "H",
                                               screen.frame_period().as_hz());
                    }

                    buf += string.Format(
                        (scrcount > 1) ? "{0}: {1}\n" : "{1}\n",      // "%1$s: %2$s\n") : _("%2$s\n"),
                        get_screen_desc(screen), detail);
                }
            }

            return(buf.str());
        }