ReplayCLI.cc 959 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "ReplayCLI.hh"
  2. #include "CommandLineParser.hh"
  3. #include "TclObject.hh"
  4. using std::string;
  5. namespace openmsx {
  6. ReplayCLI::ReplayCLI(CommandLineParser& parser_)
  7. : parser(parser_)
  8. {
  9. parser.registerOption("-replay", *this);
  10. parser.registerFileType({"omr"}, *this);
  11. }
  12. void ReplayCLI::parseOption(const string& option, span<string>& cmdLine)
  13. {
  14. parseFileType(getArgument(option, cmdLine), cmdLine);
  15. }
  16. std::string_view ReplayCLI::optionHelp() const
  17. {
  18. return "Load replay and start replaying it in view only mode";
  19. }
  20. void ReplayCLI::parseFileType(const string& filename,
  21. span<string>& /*cmdLine*/)
  22. {
  23. TclObject command = makeTclList("reverse", "loadreplay", "-viewonly", filename);
  24. command.executeCommand(parser.getInterpreter());
  25. }
  26. std::string_view ReplayCLI::fileTypeHelp() const
  27. {
  28. return "openMSX replay";
  29. }
  30. std::string_view ReplayCLI::fileTypeCategoryName() const
  31. {
  32. return "replay";
  33. }
  34. } // namespace openmsx