コード例 #1
0
        void populate_list(bool copydesc)
        {
            m_systems.reserve(driver_list.total());
            std.unordered_set <string> manufacturers;
            std.unordered_set <string> years;
            for (int x = 0; x < (int)driver_list.total(); ++x)
            {
                game_driver    driver = driver_list.driver((size_t)x);
                ui_system_info ins    = new ui_system_info(driver, x, false);
                m_systems.emplace_back(ins);
                if (driver != ___empty.driver____empty)
                {
                    if ((driver.flags & machine_flags.type.IS_BIOS_ROOT) != 0)
                    {
                        ++m_bios_count;
                    }

                    if ((driver.parent.Length >= 1 && driver.parent[0] != '0') || (driver.parent.Length >= 2 && driver.parent[1] != 0))  //if ((driver.parent[0] != '0') || driver.parent[1])
                    {
                        var parentindex = driver_list.find(driver.parent);
                        if (copydesc)
                        {
                            if (0 <= parentindex)
                            {
                                game_driver parentdriver = driver_list.driver((size_t)parentindex);
                                ins.is_clone = (parentdriver.flags & machine_flags.type.IS_BIOS_ROOT) == 0;
                                ins.parent   = parentdriver.type.fullname();
                            }
                            else
                            {
                                ins.is_clone = false;
                                ins.parent   = driver.parent;
                            }
                        }
                        else
                        {
                            ins.is_clone = (0 <= parentindex) && (driver_list.driver((size_t)parentindex).flags & machine_flags.type.IS_BIOS_ROOT) == 0;
                        }
                    }

                    if (copydesc)
                    {
                        ins.description = driver.type.fullname();
                    }

                    m_filter_data.add_manufacturer(driver.manufacturer);
                    m_filter_data.add_year(driver.year);
                }
            }
        }
コード例 #2
0
        public static void get_system_warnings(ref string buf, running_machine machine, machine_flags.type flags, device_t_feature_type unemulated, device_t_feature_type imperfect)
        {
            // start with the unemulated/imperfect features
            get_device_warnings(ref buf, unemulated, imperfect);

            // add one line per machine warning flag
            if ((flags & machine_flags.type.NO_COCKTAIL) != 0)
            {
                buf += __("Screen flipping in cocktail mode is not supported.\n");
            }
            if ((flags & machine_flags.type.REQUIRES_ARTWORK) != 0)
            {
                buf += __("This machine requires external artwork files.\n");
            }
            if ((flags & machine_flags.type.IS_INCOMPLETE) != 0)
            {
                buf += __("This machine was never completed. It may exhibit strange behavior or missing elements that are not bugs in the emulation.\n");
            }
            if ((flags & machine_flags.type.NO_SOUND_HW) != 0)
            {
                buf += __("This machine has no sound hardware, MAME will produce no sounds, this is expected behaviour.\n");
            }

            // these are more severe warnings
            if ((flags & machine_flags.type.NOT_WORKING) != 0)
            {
                buf += __("\nTHIS MACHINE DOESN'T WORK. The emulation for this machine is not yet complete. There is nothing you can do to fix this problem except wait for the developers to improve the emulation.\n");
            }
            if ((flags & machine_flags.type.MECHANICAL) != 0)
            {
                buf += __("\nElements of this machine cannot be emulated as they require physical interaction or consist of mechanical devices. It is not possible to fully experience this machine.\n");
            }

            if ((flags & MACHINE_ERRORS) != 0 || ((machine.system().type.unemulated_features() | machine.system().type.imperfect_features()) & device_t_feature.type.PROTECTION) != 0)
            {
                // find the parent of this driver
                driver_enumerator drivlist = new driver_enumerator(machine.options());
                int maindrv  = driver_list.find(machine.system());
                int clone_of = driver_list.non_bios_clone((size_t)maindrv);
                if (clone_of != -1)
                {
                    maindrv = clone_of;
                }

                // scan the driver list for any working clones and add them
                bool foundworking = false;
                while (drivlist.next())
                {
                    if (drivlist.current() == maindrv || drivlist.clone() == maindrv)
                    {
                        game_driver driver = drivlist.driver();
                        if ((driver.flags & MACHINE_ERRORS) == 0 && ((driver.type.unemulated_features() | driver.type.imperfect_features()) & device_t_feature.type.PROTECTION) == 0)
                        {
                            // this one works, add a header and display the name of the clone
                            if (!foundworking)
                            {
                                util.stream_format(ref buf, __("\n\nThere are working clones of this machine: {0}"), driver.name);
                            }
                            else
                            {
                                util.stream_format(ref buf, __(", {0}"), driver.name);
                            }

                            foundworking = true;
                        }
                    }
                }

                if (foundworking)
                {
                    buf += '\n';
                }
            }
        }
コード例 #3
0
ファイル: auditmenu.cs プロジェクト: kwanboy/mcs
        public static int sorted_game_list(game_driver x, game_driver y)
        {
            bool clonex = !string.IsNullOrEmpty(x.parent);
            bool cloney = !string.IsNullOrEmpty(y.parent);

            if (!clonex && !cloney)
            {
                return(cs_stricmp(x.type.fullname(), y.type.fullname())); // < 0);
            }
            int cx = -1, cy = -1;

            if (clonex)
            {
                cx = driver_list.find(x.parent);
                if (cx == -1 || ((UInt64)driver_list.driver(cx).flags & global_object.MACHINE_IS_BIOS_ROOT) != 0)
                {
                    clonex = false;
                }
            }

            if (cloney)
            {
                cy = driver_list.find(y.parent);
                if (cy == -1 || ((UInt64)driver_list.driver(cy).flags & global_object.MACHINE_IS_BIOS_ROOT) != 0)
                {
                    cloney = false;
                }
            }

            if (!clonex && !cloney)
            {
                return(cs_stricmp(x.type.fullname(), y.type.fullname())); // < 0);
            }
            else if (clonex && cloney)
            {
                if (cs_stricmp(x.parent, y.parent) == 0)
                {
                    return(cs_stricmp(x.type.fullname(), y.type.fullname())); // < 0);
                }
                else
                {
                    return(cs_stricmp(driver_list.driver(cx).type.fullname(), driver_list.driver(cy).type.fullname())); // < 0);
                }
            }
            else if (!clonex && cloney)
            {
                if (cs_stricmp(x.name, y.parent) == 0)
                {
                    return(cs_stricmp(x.name, y.parent));
                }
                else
                {
                    return(cs_stricmp(x.type.fullname(), driver_list.driver(cy).type.fullname())); // < 0);
                }
            }
            else
            {
                if (cs_stricmp(x.parent, y.name) == 0)
                {
                    return(cs_stricmp(x.parent, y.name));
                }
                else
                {
                    return(cs_stricmp(driver_list.driver(cx).type.fullname(), y.type.fullname())); // < 0);
                }
            }
        }
コード例 #4
0
        void do_cache_data(string datpath, string titles)
        {
            // try to open the titles file for optimisation reasons
            emu_file titles_file = new emu_file(datpath, OPEN_FLAG_READ);
            bool     try_titles  = !titles.empty() && !titles_file.open(titles);

            // generate full list - initially ordered by shortname
            populate_list(!try_titles);

            // notify that BIOS count is valie
            notify_available(available.AVAIL_BIOS_COUNT);

            // try to load localised descriptions
            if (try_titles)
            {
                load_titles(titles_file.core_file_get());

                // populate parent descriptions while still ordered by shortname
                // already done on the first pass if built-in titles are used
                populate_parents();
            }

            // system names are finalised now
            notify_available(available.AVAIL_SYSTEM_NAMES);

            // get rid of the "empty" driver - we don't need positions to line up any more
            m_sorted_list.reserve(m_systems.size() - 1);
            var empty = driver_list.find(___empty.driver____empty);

            foreach (ui_system_info info in m_systems)
            {
                if (info.index != empty)
                {
                    m_sorted_list.emplace_back(info);
                }
            }

            // sort drivers and notify
            //std::collate<wchar_t> const &coll = std::use_facet<std::collate<wchar_t> >(std::locale());
            //auto const compare_names =
            //        [&coll] (std::wstring const &wx, std::wstring const &wy) -> bool
            //        {
            //            return 0 > coll.compare(wx.data(), wx.data() + wx.size(), wy.data(), wy.data() + wy.size());
            //        };
            Func <string, string, int> compare_names = (string wx, string wy) => { return(wx.CompareTo(wy)); };

            //std::stable_sort(
            //        m_sorted_list.begin(),
            //        m_sorted_list.end(),
            //        [&compare_names] (ui_system_info const &lhs, ui_system_info const &rhs)
            m_sorted_list.Sort((ui_system_info lhs, ui_system_info rhs) =>
            {
                game_driver x = lhs.driver;
                game_driver y = rhs.driver;

                if (!lhs.is_clone && !rhs.is_clone)
                {
                    return(compare_names(
                               lhs.reading_description.empty() ? wstring_from_utf8(lhs.description) : lhs.reading_description,
                               rhs.reading_description.empty() ? wstring_from_utf8(rhs.description) : rhs.reading_description));
                }
                else if (lhs.is_clone && rhs.is_clone)
                {
                    if (std.strcmp(x.parent, y.parent) == 0)
                    {
                        return(compare_names(
                                   lhs.reading_description.empty() ? wstring_from_utf8(lhs.description) : lhs.reading_description,
                                   rhs.reading_description.empty() ? wstring_from_utf8(rhs.description) : rhs.reading_description));
                    }
                    else
                    {
                        return(compare_names(
                                   lhs.reading_parent.empty() ? wstring_from_utf8(lhs.parent) : lhs.reading_parent,
                                   rhs.reading_parent.empty() ? wstring_from_utf8(rhs.parent) : rhs.reading_parent));
                    }
                }
                else if (!lhs.is_clone && rhs.is_clone)
                {
                    if (std.strcmp(x.name, y.parent) == 0)
                    {
                        return(0);  //return true;
                    }
                    else
                    {
                        return(compare_names(
                                   lhs.reading_description.empty() ? wstring_from_utf8(lhs.description) : lhs.reading_description,
                                   rhs.reading_parent.empty() ? wstring_from_utf8(rhs.parent) : rhs.reading_parent));
                    }
                }
                else
                {
                    if (std.strcmp(x.parent, y.name) == 0)
                    {
                        return(-1);  //return false;
                    }
                    else
                    {
                        return(compare_names(
                                   lhs.reading_parent.empty() ? wstring_from_utf8(lhs.parent) : lhs.reading_parent,
                                   rhs.reading_description.empty() ? wstring_from_utf8(rhs.description) : rhs.reading_description));
                    }
                }
            });

            notify_available(available.AVAIL_SORTED_LIST);

            // sort manufacturers and years
            m_filter_data.finalise();
            notify_available(available.AVAIL_FILTER_DATA);

            // convert shortnames to UCS-4
            foreach (ui_system_info info in m_sorted_list)
            {
                info.ucs_shortname = ustr_from_utf8(normalize_unicode(info.driver.name, unicode_normalization_form.D, true));
            }

            notify_available(available.AVAIL_UCS_SHORTNAME);

            // convert descriptions to UCS-4
            foreach (ui_system_info info in m_sorted_list)
            {
                info.ucs_description = ustr_from_utf8(normalize_unicode(info.description, unicode_normalization_form.D, true));
            }

            notify_available(available.AVAIL_UCS_DESCRIPTION);

            // convert "<manufacturer> <description>" to UCS-4
            string buf;

            foreach (ui_system_info info in m_sorted_list)
            {
                buf = info.driver.manufacturer;
                buf = buf.append_(1, ' ');
                buf = buf.append_(info.description);
                info.ucs_manufacturer_description = ustr_from_utf8(normalize_unicode(buf, unicode_normalization_form.D, true));
            }

            notify_available(available.AVAIL_UCS_MANUF_DESC);

            // convert default descriptions to UCS-4
            if (try_titles)
            {
                foreach (ui_system_info info in m_sorted_list)
                {
                    string fullname = info.driver.type.fullname();
                    if (info.description != fullname)
                    {
                        info.ucs_default_description = ustr_from_utf8(normalize_unicode(fullname, unicode_normalization_form.D, true));
                    }
                }
            }

            notify_available(available.AVAIL_UCS_DFLT_DESC);

            // convert "<manufacturer> <default description>" to UCS-4
            if (try_titles)
            {
                foreach (ui_system_info info in m_sorted_list)
                {
                    string fullname = info.driver.type.fullname();
                    if (info.description != fullname)
                    {
                        buf = info.driver.manufacturer;
                        buf = buf.append_(1, ' ');
                        buf = buf.append_(fullname);
                        info.ucs_manufacturer_default_description = ustr_from_utf8(normalize_unicode(buf, unicode_normalization_form.D, true));
                    }
                }
            }

            notify_available(available.AVAIL_UCS_MANUF_DFLT_DESC);
        }
コード例 #5
0
ファイル: info.cs プロジェクト: kwanboy/mcs
        // text generators

        //-------------------------------------------------
        //  warnings_string - print the warning flags
        //  text to the given buffer
        //-------------------------------------------------
        public string warnings_string()
        {
            string buf = "";

            // add a warning if any ROMs were loaded with warnings
            if (m_machine.rom_load().warnings() > 0)
            {
                buf += "One or more ROMs/CHDs for this machine are incorrect. The machine may not run correctly.\n";
            }

            if (!m_machine.rom_load().software_load_warnings_message().empty())
            {
                buf += m_machine.rom_load().software_load_warnings_message();
            }

            // if we have at least one warning flag, print the general header
            if ((m_machine.rom_load().knownbad() > 0) || (machine_flags_get() & (MACHINE_ERRORS | MACHINE_WARNINGS | MACHINE_BTANB)) != 0 || unemulated_features() != 0 || imperfect_features() != 0)
            {
                if (!buf.str().empty())
                {
                    buf += "\n";
                }
                buf += "There are known problems with this machine\n\n";
            }

            // add a warning if any ROMs are flagged BAD_DUMP/NO_DUMP
            if (m_machine.rom_load().knownbad() > 0)
            {
                buf += "One or more ROMs/CHDs for this machine have not been correctly dumped.\n";
            }

            // add line for unemulated features
            if (unemulated_features() != 0)
            {
                buf += "Completely unemulated features: ";
                bool first = true;
                foreach (var feature in FEATURE_NAMES)
                {
                    if ((unemulated_features() & feature.Key) != 0)
                    {
                        buf  += string.Format(first ? "{0}" : ", {0}", feature.Value);
                        first = false;
                    }
                }
                buf += "\n";
            }

            // add line for imperfect features
            if (imperfect_features() != 0)
            {
                buf += "Imperfectly emulated features: ";
                bool first = true;
                foreach (var feature in FEATURE_NAMES)
                {
                    if ((imperfect_features() & feature.Key) != 0)
                    {
                        buf  += string.Format(first ? "{0}" : ", {0}", feature.Value);
                        first = false;
                    }
                }
                buf += "\n";
            }

            // add one line per machine warning flag
            if ((machine_flags_get() & machine_flags.type.NO_COCKTAIL) != 0)
            {
                buf += "Screen flipping in cocktail mode is not supported.\n";
            }
            if ((machine_flags_get() & machine_flags.type.REQUIRES_ARTWORK) != 0) // check if external artwork is present before displaying this warning?
            {
                buf += "This machine requires external artwork files.\n";
            }
            if ((machine_flags_get() & machine_flags.type.IS_INCOMPLETE) != 0)
            {
                buf += "This machine was never completed. It may exhibit strange behavior or missing elements that are not bugs in the emulation.\n";
            }
            if ((machine_flags_get() & machine_flags.type.NO_SOUND_HW) != 0)
            {
                buf += "This machine has no sound hardware, MAME will produce no sounds, this is expected behaviour.\n";
            }

            // these are more severe warnings
            if ((machine_flags_get() & machine_flags.type.NOT_WORKING) != 0)
            {
                buf += "\nTHIS MACHINE DOESN'T WORK. The emulation for this machine is not yet complete. There is nothing you can do to fix this problem except wait for the developers to improve the emulation.\n";
            }
            if ((machine_flags_get() & machine_flags.type.MECHANICAL) != 0)
            {
                buf += "\nElements of this machine cannot be emulated as they requires physical interaction or consist of mechanical devices. It is not possible to fully experience this machine.\n";
            }

            if ((machine_flags_get() & MACHINE_ERRORS) != 0 || ((m_machine.system().type.unemulated_features() | m_machine.system().type.imperfect_features()) & emu.detail.device_feature.type.PROTECTION) != 0)
            {
                // find the parent of this driver
                driver_enumerator drivlist = new driver_enumerator(m_machine.options());
                int maindrv  = driver_list.find(m_machine.system());
                int clone_of = driver_list.non_bios_clone(maindrv);
                if (clone_of != -1)
                {
                    maindrv = clone_of;
                }

                // scan the driver list for any working clones and add them
                bool foundworking = false;
                while (drivlist.next())
                {
                    if (drivlist.current() == maindrv || drivlist.clone() == maindrv)
                    {
                        game_driver driver = drivlist.driver();
                        if ((driver.flags & MACHINE_ERRORS) == 0 && ((driver.type.unemulated_features() | driver.type.imperfect_features()) & emu.detail.device_feature.type.PROTECTION) == 0)
                        {
                            // this one works, add a header and display the name of the clone
                            if (!foundworking)
                            {
                                buf += string.Format("\n\nThere are working clones of this machine: {0}", driver.name);
                            }
                            else
                            {
                                buf += string.Format(", {0}", driver.name);
                            }
                            foundworking = true;
                        }
                    }
                }
                if (foundworking)
                {
                    buf += "\n";
                }
            }

            // add the 'press OK' string
            if (!buf.str().empty())
            {
                buf += "\n\nPress any key to continue";
            }

            return(buf.str());
        }