2024-01-09 19:12:22 +00:00
|
|
|
#include <cstdlib>
|
|
|
|
#include "argparse.hpp"
|
|
|
|
#include "utils.hpp"
|
2024-01-09 19:59:59 +00:00
|
|
|
#include "core/emuInstance.hpp"
|
2024-01-09 19:12:22 +00:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
// Parsing command line arguments
|
|
|
|
argparse::ArgumentParser program("player", "1.0");
|
|
|
|
|
|
|
|
program.add_argument("romFile")
|
2024-01-09 19:59:59 +00:00
|
|
|
.help("Path to the rom file to run.")
|
2024-01-09 19:12:22 +00:00
|
|
|
.required();
|
|
|
|
|
2024-01-09 19:59:59 +00:00
|
|
|
program.add_argument("sequenceFile")
|
|
|
|
.help("Path to the input sequence file (.sol) to reproduce.")
|
2024-01-09 19:12:22 +00:00
|
|
|
.required();
|
|
|
|
|
|
|
|
program.add_argument("stateFile")
|
|
|
|
.help("(Optional) Path to the initial state file to load.")
|
|
|
|
.default_value("");
|
|
|
|
|
|
|
|
program.add_argument("--reproduce")
|
|
|
|
.help("Plays the entire sequence without interruptions and exit at the end.")
|
|
|
|
.default_value(false)
|
|
|
|
.implicit_value(true);
|
|
|
|
|
|
|
|
program.add_argument("--disableRender")
|
|
|
|
.help("Do not render game window.")
|
|
|
|
.default_value(false)
|
|
|
|
.implicit_value(true);
|
|
|
|
|
|
|
|
// Try to parse arguments
|
|
|
|
try { program.parse_args(argc, argv); }
|
|
|
|
catch (const std::runtime_error &err) { EXIT_WITH_ERROR("%s\n%s", err.what(), program.help().str().c_str()); }
|
2024-01-09 19:59:59 +00:00
|
|
|
|
|
|
|
// Getting ROM file path
|
|
|
|
std::string romFilePath = program.get<std::string>("romFile");
|
|
|
|
|
|
|
|
// Getting sequence file path
|
|
|
|
std::string sequenceFile = program.get<std::string>("sequenceFile");
|
|
|
|
|
|
|
|
// If initial state file is specified, load it
|
|
|
|
std::string sequenceFile = program.get<std::string>("stateFile");
|
|
|
|
|
|
|
|
// Getting reproduce flag
|
|
|
|
bool isReproduce = program.get<bool>("--reproduce");
|
|
|
|
|
|
|
|
// Getting reproduce flag
|
|
|
|
bool disableRender = program.get<bool>("--disableRender");
|
2024-01-09 19:12:22 +00:00
|
|
|
}
|
|
|
|
|