18 static constexpr std::array<std::string_view, 5> extensions = {
19 "ri",
"rom",
"mx1",
"mx2",
"sg"
25 : cmdLineParser(cmdLineParser_)
29 for (
const auto* cart : {
"-cart",
"-carta",
"-cartb",
"-cartc",
"-cartd"}) {
39 if (option.size() == 6) {
44 parse(arg, slotName, cmdLine);
49 return "Insert the ROM file (cartridge) specified in argument";
54 parse(arg,
"any", cmdLine);
59 return "ROM image of a cartridge";
67void MSXRomCLI::parse(
const string& arg,
const string& slotName,
68 std::span<string>& cmdLine)
const
71 std::vector<TclObject> options;
74 if (option ==
one_of(
"-ips",
"-romtype")) {
75 options.emplace_back(option);
76 cmdLine = cmdLine.subspan(1);
84 motherboard->insertExtension(
"ROM",
88void MSXRomCLI::IpsOption::parseOption(
const string& ,
92 "-ips options should immediately follow a ROM or disk image.");
95std::string_view MSXRomCLI::IpsOption::optionHelp()
const
97 return "Apply the given IPS patch to the ROM or disk image specified "
98 "in the preceding option";
101void MSXRomCLI::RomTypeOption::parseOption(
const string& ,
104 throw FatalError(
"-romtype options should immediately follow a ROM.");
107std::string_view MSXRomCLI::RomTypeOption::optionHelp()
const
109 return "Specify the rom type for the ROM image specified in the "
static std::string getArgument(const std::string &option, std::span< std::string > &cmdLine)
static std::string peekArgument(const std::span< std::string > &cmdLine)
void registerOption(const char *str, CLIOption &cliOption, ParsePhase phase=PHASE_LAST, unsigned length=2)
void registerFileType(std::span< const std::string_view > extensions, CLIFileType &cliFileType)
MSXMotherBoard * getMotherBoard() const
static std::unique_ptr< HardwareConfig > createRomConfig(MSXMotherBoard &motherBoard, std::string_view romFile, std::string_view slotName, std::span< const TclObject > options)
void parseFileType(const std::string &arg, std::span< std::string > &cmdLine) override
std::string_view fileTypeCategoryName() const override
std::string_view fileTypeHelp() const override
std::string_view optionHelp() const override
static std::span< const std::string_view > getExtensions()
MSXRomCLI(CommandLineParser &cmdLineParser)
void parseOption(const std::string &option, std::span< std::string > &cmdLine) override
This file implemented 3 utility functions: