summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend
diff options
context:
space:
mode:
authorGravatarGravatar Vas Crabb <vas@vastheman.com>2019-11-01 00:47:41 +1100
committerGravatarGravatar Vas Crabb <vas@vastheman.com>2019-11-01 00:47:41 +1100
commit6f4c1f6e5b2525ac8b700b3a0754f5e99c4223e1 (patch)
tree4b0e0ac5cf1c3a7fd518a7d8f4d12f39291b2629 /src/frontend
parent0be348c7fbc8c0478f724ba098dabeb9eb3aab8c (diff)
Spring cleaning:
* Changed emu_fatalerror to use util::string_format semantics * Fixed some incorrectly marked up stuff in build scripts * Make internal layout compression type a scoped enum (only zlib is supported still, but at least the values aren't magic numbers now) * Fixed memory leaks in Xbox USB * There can only be one "perfect quantum" device - enforce that only the root machine can set it, as allowing subdevices to will cause weird issues with slot cards overiding it * Allow multiple devices to set maximum quantum and use the most restrictive one (it's maximum quantum, it would be minimum interleave) * Got rid of device_slot_card_interface as it wasn't providing value * Added a helper template to reduce certain kinds of boilerplate in slots/buses * Cleaned up some particularly bad slot code (plenty more of that to do), and made some slots more idiomatic
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/mame/cheat.cpp9
-rw-r--r--src/frontend/mame/clifront.cpp34
-rw-r--r--src/frontend/mame/info.cpp2
3 files changed, 24 insertions, 21 deletions
diff --git a/src/frontend/mame/cheat.cpp b/src/frontend/mame/cheat.cpp
index ae2ca8ebd78..0f8095cefbd 100644
--- a/src/frontend/mame/cheat.cpp
+++ b/src/frontend/mame/cheat.cpp
@@ -310,6 +310,9 @@ bool cheat_parameter::set_next_state()
// CHEAT SCRIPT
//**************************************************************************
+constexpr int cheat_script::script_entry::MAX_ARGUMENTS;
+
+
//-------------------------------------------------
// cheat_script - constructor
//-------------------------------------------------
@@ -1227,7 +1230,7 @@ bool cheat_manager::save_all(const char *filename)
catch (emu_fatalerror const &err)
{
// catch errors and cleanup
- osd_printf_error("%s\n", err.string());
+ osd_printf_error("%s\n", err.what());
cheatfile.remove_on_close();
}
return false;
@@ -1447,7 +1450,7 @@ void cheat_manager::load_cheats(const char *filename)
catch (emu_fatalerror const &err)
{
// just move on to the next cheat
- osd_printf_error("%s\n", err.string());
+ osd_printf_error("%s\n", err.what());
}
}
}
@@ -1455,7 +1458,7 @@ void cheat_manager::load_cheats(const char *filename)
catch (emu_fatalerror const &err)
{
// handle errors cleanly
- osd_printf_error("%s\n", err.string());
+ osd_printf_error("%s\n", err.what());
m_cheatlist.clear();
}
}
diff --git a/src/frontend/mame/clifront.cpp b/src/frontend/mame/clifront.cpp
index 46c7f9cbe63..82a291539ba 100644
--- a/src/frontend/mame/clifront.cpp
+++ b/src/frontend/mame/clifront.cpp
@@ -219,7 +219,7 @@ void cli_frontend::start_execution(mame_machine_manager *manager, const std::vec
{
// if we failed, check for no command and a system name first; in that case error on the name
if (m_options.command().empty() && mame_options::system(m_options) == nullptr && !m_options.attempted_system_name().empty())
- throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.attempted_system_name().c_str());
+ throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "Unknown system '%s'", m_options.attempted_system_name().c_str());
// otherwise, error on the options
throw emu_fatalerror(EMU_ERR_INVALID_CONFIG, "%s", ex.message().c_str());
@@ -258,7 +258,7 @@ void cli_frontend::start_execution(mame_machine_manager *manager, const std::vec
// if we can't find it, give an appropriate error
const game_driver *system = mame_options::system(m_options);
if (system == nullptr && *(m_options.system_name()) != 0)
- throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name());
+ throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "Unknown system '%s'", m_options.system_name());
// otherwise just run the game
m_result = manager->execute();
@@ -282,14 +282,14 @@ int cli_frontend::execute(std::vector<std::string> &args)
// handle exceptions of various types
catch (emu_fatalerror &fatal)
{
- std::string str(fatal.string());
+ std::string str(fatal.what());
strtrimspace(str);
osd_printf_error("%s\n", str);
m_result = (fatal.exitcode() != 0) ? fatal.exitcode() : EMU_ERR_FATALERROR;
// if a game was specified, wasn't a wildcard, and our error indicates this was the
// reason for failure, offer some suggestions
- if (m_result == EMU_ERR_NO_SUCH_GAME
+ if (m_result == EMU_ERR_NO_SUCH_SYSTEM
&& !m_options.attempted_system_name().empty()
&& !core_iswildstr(m_options.attempted_system_name().c_str())
&& mame_options::system(m_options) == nullptr)
@@ -431,7 +431,7 @@ void cli_frontend::listclones(const std::vector<std::string> &args)
{
// see if we match but just weren't a clone
if (original_count == 0)
- throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching systems found for '%s'", gamename);
+ throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "No matching systems found for '%s'", gamename);
else
osd_printf_info("Found %lu match(es) for '%s' but none were clones\n", (unsigned long)drivlist.count(), gamename); // FIXME: this never gets hit
return;
@@ -464,7 +464,7 @@ void cli_frontend::listbrothers(const std::vector<std::string> &args)
// start with a filtered list of drivers; return an error if none found
driver_enumerator initial_drivlist(m_options, gamename);
if (initial_drivlist.count() == 0)
- throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching systems found for '%s'", gamename);
+ throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "No matching systems found for '%s'", gamename);
// for the final list, start with an empty driver list
driver_enumerator drivlist(m_options);
@@ -608,7 +608,7 @@ void cli_frontend::listsamples(const std::vector<std::string> &args)
// determine which drivers to output; return an error if none found
driver_enumerator drivlist(m_options, gamename);
if (drivlist.count() == 0)
- throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching systems found for '%s'", gamename);
+ throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "No matching systems found for '%s'", gamename);
// iterate over drivers, looking for SAMPLES devices
bool first = true;
@@ -648,7 +648,7 @@ void cli_frontend::listdevices(const std::vector<std::string> &args)
// determine which drivers to output; return an error if none found
driver_enumerator drivlist(m_options, gamename);
if (drivlist.count() == 0)
- throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching systems found for '%s'", gamename);
+ throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "No matching systems found for '%s'", gamename);
// iterate over drivers, looking for SAMPLES devices
bool first = true;
@@ -733,7 +733,7 @@ void cli_frontend::listslots(const std::vector<std::string> &args)
// determine which drivers to output; return an error if none found
driver_enumerator drivlist(m_options, gamename);
if (drivlist.count() == 0)
- throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching systems found for '%s'", gamename);
+ throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "No matching systems found for '%s'", gamename);
// print header
printf("%-16s %-16s %-16s %s\n", "SYSTEM", "SLOT NAME", "SLOT OPTIONS", "SLOT DEVICE NAME");
@@ -801,7 +801,7 @@ void cli_frontend::listmedia(const std::vector<std::string> &args)
// determine which drivers to output; return an error if none found
driver_enumerator drivlist(m_options, gamename);
if (drivlist.count() == 0)
- throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching systems found for '%s'", gamename);
+ throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "No matching systems found for '%s'", gamename);
// print header
printf("%-16s %-16s %-10s %s\n", "SYSTEM", "MEDIA NAME", "(brief)", "IMAGE FILE EXTENSIONS SUPPORTED");
@@ -938,7 +938,7 @@ void cli_frontend::verifyroms(const std::vector<std::string> &args)
for (std::string const &pat : args)
{
if (!*it)
- throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching systems found for '%s'", pat.c_str());
+ throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "No matching systems found for '%s'", pat.c_str());
++it;
}
@@ -1002,7 +1002,7 @@ void cli_frontend::verifysamples(const std::vector<std::string> &args)
// return an error if none found
if (matched == 0)
- throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching systems found for '%s'", gamename);
+ throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "No matching systems found for '%s'", gamename);
// if we didn't get anything at all, display a generic end message
if (matched > 0 && correct == 0 && incorrect == 0)
@@ -1215,7 +1215,7 @@ void cli_frontend::listsoftware(const std::vector<std::string> &args)
// determine which drivers to output; return an error if none found
driver_enumerator drivlist(m_options, gamename);
if (drivlist.count() == 0)
- throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching systems found for '%s'", gamename);
+ throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "No matching systems found for '%s'", gamename);
while (drivlist.next())
{
@@ -1260,7 +1260,7 @@ void cli_frontend::verifysoftware(const std::vector<std::string> &args)
// determine which drivers to process; return an error if none found
driver_enumerator drivlist(m_options, gamename);
if (drivlist.count() == 0)
- throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching systems found for '%s'", gamename);
+ throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "No matching systems found for '%s'", gamename);
media_auditor auditor(drivlist);
util::ovectorstream summary_string;
@@ -1298,7 +1298,7 @@ void cli_frontend::verifysoftware(const std::vector<std::string> &args)
// return an error if none found
if (matched == 0)
- throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching systems found for '%s'", gamename);
+ throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "No matching systems found for '%s'", gamename);
// if we didn't get anything at all, display a generic end message
if (matched > 0 && correct == 0 && incorrect == 0)
@@ -1401,7 +1401,7 @@ void cli_frontend::verifysoftlist(const std::vector<std::string> &args)
// return an error if none found
if (matched == 0)
- throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching software lists found for '%s'", gamename);
+ throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "No matching software lists found for '%s'", gamename);
// if we didn't get anything at all, display a generic end message
if (matched > 0 && correct == 0 && incorrect == 0)
@@ -1528,7 +1528,7 @@ template <typename T, typename U> void cli_frontend::apply_action(const std::vec
for (std::string const &pat : args)
{
if (!*it)
- throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching systems found for '%s'", pat.c_str());
+ throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "No matching systems found for '%s'", pat.c_str());
++it;
}
diff --git a/src/frontend/mame/info.cpp b/src/frontend/mame/info.cpp
index b06453c0958..8ca799874d6 100644
--- a/src/frontend/mame/info.cpp
+++ b/src/frontend/mame/info.cpp
@@ -315,7 +315,7 @@ void info_xml_creator::output(std::ostream &out, const std::vector<std::string>
if (iter != matched.end())
{
int index = iter - matched.begin();
- throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching machines found for '%s'", patterns[index].c_str());
+ throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "No matching machines found for '%s'", patterns[index].c_str());
}
}
}