OXYGENHUB
◆ main openmsx / src / ReplayCLI.cc
1019 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#include "ReplayCLI.hh"
2
3
#include "CommandLineParser.hh"
4
#include "TclObject.hh"
5
6
#include <array>
7
8
namespace openmsx {
9
10
ReplayCLI::ReplayCLI(CommandLineParser& parser_)
11
	: parser(parser_)
12
{
13
	parser.registerOption("-replay", *this);
14
	parser.registerFileType(std::array<std::string_view, 1>{"omr"}, *this);
15
}
16
17
void ReplayCLI::parseOption(const std::string& option, std::span<std::string>& cmdLine)
18
{
19
	parseFileType(getArgument(option, cmdLine), cmdLine);
20
}
21
22
std::string_view ReplayCLI::optionHelp() const
23
{
24
	return "Load replay and start replaying it in view only mode";
25
}
26
27
void ReplayCLI::parseFileType(const std::string& filename,
28
                              std::span<std::string>& /*cmdLine*/)
29
{
30
	TclObject command = makeTclList("reverse", "loadreplay", "-viewonly", filename);
31
	command.executeCommand(parser.getInterpreter());
32
}
33
34
std::string_view ReplayCLI::fileTypeHelp() const
35
{
36
	return "openMSX replay";
37
}
38
39
std::string_view ReplayCLI::fileTypeCategoryName() const
40
{
41
	return "replay";
42
}
43
44
} // namespace openmsx