Esempio n. 1
0
        //-------------------------------------------------
        //  game_info_string - return the game info text
        //-------------------------------------------------
        public string game_info_string()
        {
            string buf = "";  //std::ostringstream buf;

            // print description, manufacturer, and CPU:
            util.stream_format(ref buf, __("{0}\n{1} {2}\nDriver: {3}\n\nCPU:\n"),  //util::stream_format(buf, _("%1$s\n%2$s %3$s\nDriver: %4$s\n\nCPU:\n"),
                               system_list.instance().systems()[driver_list.find(m_machine.system().name)].description,
                               m_machine.system().year,
                               m_machine.system().manufacturer,
                               core_filename_extract_base(m_machine.system().type.source()));

            // loop over all CPUs
            execute_interface_enumerator execiter = new execute_interface_enumerator(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
                u32 clock = 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() && std.strcmp(name, scan.device().name()) == 0 && exec.device().clock() == scan.device().clock())
                    {
                        if (exectags.insert(scan.device().tag()))  //.second)
                        {
                            count++;
                        }
                    }
                }

                string hz = std.to_string(clock);
                int    d  = (clock >= 1000000000) ? 9 : (clock >= 1000000) ? 6 : (clock >= 1000) ? 3 : 0;
                if (d > 0)
                {
                    size_t dpos = hz.length() - (size_t)d;
                    hz = hz.insert_(dpos, ".");
                    size_t last = hz.find_last_not_of('0');
                    hz = hz.substr(0, last + (last != dpos ? 1U : 0U));
                }

                // if more than one, prepend a #x in front of the CPU name and display clock
                util.stream_format(ref buf,
                                   (count > 1)
                            ? ((clock != 0) ? "{0}X{1} {2} {3}\n" : "{1}x{2}\n") //? ((clock != 0) ? "%1$d" UTF8_MULTIPLY "%2$s %3$s" UTF8_NBSP "%4$s\n" : "%1$d" UTF8_MULTIPLY "%2$s\n")
                            : ((clock != 0) ? "{1} {2} {3}\n" : "{1}\n"),        //: ((clock != 0) ? "%2$s %3$s" UTF8_NBSP "%4$s\n" : "%2$s\n"),
                                   count, name, hz,
                                   (d == 9) ? __("GHz") : (d == 6) ? __("MHz") : (d == 3) ? __("kHz") : __("Hz"));
            }

            // loop over all sound chips
            sound_interface_enumerator snditer = new sound_interface_enumerator(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++;
                        }
                    }
                }

                u32    clock = sound.device().clock();
                string hz    = std.to_string(clock);
                int    d     = (clock >= 1000000000) ? 9 : (clock >= 1000000) ? 6 : (clock >= 1000) ? 3 : 0;
                if (d > 0)
                {
                    size_t dpos = hz.length() - (size_t)d;
                    hz = hz.insert_(dpos, ".");
                    size_t last = hz.find_last_not_of('0');
                    hz = hz.substr(0, last + (last != dpos ? 1U : 0U));
                }

                // if more than one, prepend a #x in front of the soundchip name and display clock
                util.stream_format(ref buf,
                                   (count > 1)
                            ? ((clock != 0) ? "{0}X{1} {2} {3}\n" : "{0}X{1}\n") //? ((clock != 0) ? "%1$d" UTF8_MULTIPLY "%2$s %3$s" UTF8_NBSP "%4$s\n" : "%1$d" UTF8_MULTIPLY "%2$s\n")
                            : ((clock != 0) ? "{1} {2} {3}\n" : "{1}\n"),        //: ((clock != 0) ? "%2$s %3$s" UTF8_NBSP "%4$s\n" : "%2$s\n"),
                                   count, sound.device().name(), hz,
                                   (d == 9) ? __("GHz") : (d == 6) ? __("MHz") : (d == 3) ? __("kHz") : __("Hz"));
            }

            // display screen information
            buf += __("\nVideo:\n");
            screen_device_enumerator scriter = new screen_device_enumerator(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
                    {
                        string hz   = std.to_string((float)screen.frame_period().as_hz());
                        size_t last = hz.find_last_not_of('0');
                        size_t dpos = hz.find_last_of('.');
                        hz = hz.substr(0, last + (last != dpos ? 1U : 0U));

                        rectangle visarea = screen.visible_area();
                        detail = util.string_format("{0} X {1} ({2}) {3} Hz",  //detail = string_format("%d " UTF8_MULTIPLY " %d (%s) %s" UTF8_NBSP "Hz",
                                                    visarea.width(), visarea.height(),
                                                    (screen.orientation() & ORIENTATION_SWAP_XY) != 0 ? "V" : "H",
                                                    hz);
                    }

                    util.stream_format(ref buf,
                                       (scrcount > 1) ? __("{0}: {1}\n") : __("{1}\n"), //(scrcount > 1) ? _("%1$s: %2$s\n") : _("%2$s\n"),
                                       get_screen_desc(screen), detail);
                }
            }

            return(buf);
        }
Esempio n. 2
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());
        }