-
Notifications
You must be signed in to change notification settings - Fork 1
/
cli.cpp
32 lines (26 loc) · 873 Bytes
/
cli.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "Randomizer.h"
#include "Random.h"
#include <optional>
#include <stdlib.h>
#define ROM_FILE_NAME "Soul Blazer (U) [!].smc"
#define MOD_ROM_FILE_NAME "Soul Blazer Randomized.smc"
int main (int argc, char** argv ) {
std::string in_file;
std::string out_file;
std::optional<unsigned int> seed;
Randomizer::Options options;
for (int i = 1; i < argc; i++) {
if (in_file.empty()) {
in_file = argv[i];
} else if (out_file.empty()) {
out_file = argv[i];
} else if (!seed.has_value()) {
seed = atoi(argv[i]);
} else {
options = Randomizer::Options(argv[i]);
}
}
if (in_file.empty()) in_file = ROM_FILE_NAME;
if (out_file.empty()) out_file = MOD_ROM_FILE_NAME;
return Randomizer::Randomize(in_file, out_file, seed.value_or(0), options) ? 0 : 1;
}