-
Notifications
You must be signed in to change notification settings - Fork 21
/
main.cc
52 lines (41 loc) · 845 Bytes
/
main.cc
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <exception>
#include <format>
#ifdef _WIN32
#include <windows.h>
#endif
import options;
import redumper;
import utils.logger;
import version;
using namespace gpsxre;
int main(int argc, char *argv[])
{
int exit_code = 0;
#ifdef _WIN32
SetConsoleCP(CP_UTF8);
SetConsoleOutputCP(CP_UTF8);
#endif
try
{
Options options(argc, const_cast<const char **>(argv));
if(options.help)
options.printUsage();
else if(options.version)
LOG("{}", redumper_version());
else
{
exit_code = redumper(options);
}
}
catch(const std::exception &e)
{
LOG("error: {}", e.what());
exit_code = -1;
}
catch(...)
{
LOG("error: unhandled exception");
exit_code = -2;
}
return exit_code;
}