Merge pull request #1228 from npwoods/fix_softlist_device_description

Fixed an issue that caused softlist device descriptions to be blank
This commit is contained in:
Vas Crabb 2016-08-11 22:13:20 +10:00 committed by GitHub
commit c0b51e99f1
5 changed files with 10 additions and 9 deletions

View File

@ -166,12 +166,13 @@ bool software_info::has_multiple_parts(const char *interface) const
// softlist_parser - constructor // softlist_parser - constructor
//------------------------------------------------- //-------------------------------------------------
softlist_parser::softlist_parser(util::core_file &file, const std::string &filename, std::list<software_info> &infolist, std::ostringstream &errors) softlist_parser::softlist_parser(util::core_file &file, const std::string &filename, std::string &description, std::list<software_info> &infolist, std::ostringstream &errors)
: m_file(file), : m_file(file),
m_filename(filename), m_filename(filename),
m_infolist(infolist), m_infolist(infolist),
m_errors(errors), m_errors(errors),
m_done(false), m_done(false),
m_description(description),
m_data_accum_expected(false), m_data_accum_expected(false),
m_current_info(nullptr), m_current_info(nullptr),
m_current_part(nullptr), m_current_part(nullptr),

View File

@ -148,7 +148,7 @@ class softlist_parser
{ {
public: public:
// construction (== execution) // construction (== execution)
softlist_parser(util::core_file &file, const std::string &filename, std::list<software_info> &infolist, std::ostringstream &errors); softlist_parser(util::core_file &file, const std::string &filename, std::string &description, std::list<software_info> &infolist, std::ostringstream &errors);
private: private:
enum parse_position enum parse_position
@ -191,12 +191,12 @@ private:
// internal parsing state // internal parsing state
util::core_file & m_file; util::core_file & m_file;
const std::string & m_filename; std::string m_filename;
std::list<software_info> & m_infolist; std::list<software_info> & m_infolist;
std::ostringstream & m_errors; std::ostringstream & m_errors;
struct XML_ParserStruct * m_parser; struct XML_ParserStruct * m_parser;
bool m_done; bool m_done;
std::string m_description; std::string & m_description;
bool m_data_accum_expected; bool m_data_accum_expected;
std::string m_data_accum; std::string m_data_accum;
software_info * m_current_info; software_info * m_current_info;

View File

@ -229,9 +229,9 @@ void software_list_device::display_matches(const machine_config &config, const c
{ {
// different output depending on original system or compatible // different output depending on original system or compatible
if (swlistdev.list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM) if (swlistdev.list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM)
osd_printf_error("* Software list \"%s\" (%s) matches: \n", swlistdev.list_name().c_str(), swlistdev.description()); osd_printf_error("* Software list \"%s\" (%s) matches: \n", swlistdev.list_name().c_str(), swlistdev.description().c_str());
else else
osd_printf_error("* Compatible software list \"%s\" (%s) matches: \n", swlistdev.list_name().c_str(), swlistdev.description()); osd_printf_error("* Compatible software list \"%s\" (%s) matches: \n", swlistdev.list_name().c_str(), swlistdev.description().c_str());
// print them out // print them out
for (auto &match : matches) for (auto &match : matches)
@ -297,7 +297,7 @@ void software_list_device::parse()
{ {
// parse if no error // parse if no error
std::ostringstream errs; std::ostringstream errs;
softlist_parser parser(m_file, m_description, m_infolist, errs); softlist_parser parser(m_file, m_file.filename(), m_description, m_infolist, errs);
m_file.close(); m_file.close();
m_errors = errs.str(); m_errors = errs.str();
} }

View File

@ -145,7 +145,7 @@ public:
const char *filename() { return m_file.filename(); } const char *filename() { return m_file.filename(); }
// getters that may trigger a parse // getters that may trigger a parse
const char *description() { if (!m_parsed) parse(); return m_description.c_str(); } const std::string &description() { if (!m_parsed) parse(); return m_description; }
bool valid() { if (!m_parsed) parse(); return !m_infolist.empty(); } bool valid() { if (!m_parsed) parse(); return !m_infolist.empty(); }
const char *errors_string() { if (!m_parsed) parse(); return m_errors.c_str(); } const char *errors_string() { if (!m_parsed) parse(); return m_errors.c_str(); }
const std::list<software_info> &get_info() { if (!m_parsed) parse(); return m_infolist; } const std::list<software_info> &get_info() { if (!m_parsed) parse(); return m_infolist; }

View File

@ -1387,7 +1387,7 @@ void cli_frontend::verifysamples(const char *gamename)
void cli_frontend::output_single_softlist(FILE *out, software_list_device &swlistdev) void cli_frontend::output_single_softlist(FILE *out, software_list_device &swlistdev)
{ {
fprintf(out, "\t<softwarelist name=\"%s\" description=\"%s\">\n", swlistdev.list_name().c_str(), xml_normalize_string(swlistdev.description())); fprintf(out, "\t<softwarelist name=\"%s\" description=\"%s\">\n", swlistdev.list_name().c_str(), xml_normalize_string(swlistdev.description().c_str()));
for (const software_info &swinfo : swlistdev.get_info()) for (const software_info &swinfo : swlistdev.get_info())
{ {
fprintf(out, "\t\t<software name=\"%s\"", swinfo.shortname().c_str()); fprintf(out, "\t\t<software name=\"%s\"", swinfo.shortname().c_str());