-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmain.cpp
More file actions
52 lines (40 loc) · 1.21 KB
/
main.cpp
File metadata and controls
52 lines (40 loc) · 1.21 KB
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 <cstdio>
#include <string>
#include <vector>
#include "ObjectFileDB.h"
#include "config.h"
#include "util/FileIO.h"
#include "TypeSystem/TypeInfo.h"
int main(int argc, char** argv) {
printf("Jak Disassembler\n");
init_crc();
init_opcode_info();
if (argc != 4) {
printf("usage: jak_disassembler <config_file> <in_folder> <out_folder>\n");
return 1;
}
set_config(argv[1]);
std::string in_folder = argv[2];
std::string out_folder = argv[3];
std::vector<std::string> dgos;
for (const auto& dgo_name : get_config().dgo_names) {
dgos.push_back(combine_path(in_folder, dgo_name));
}
ObjectFileDB db(dgos);
write_text_file(combine_path(out_folder, "dgo.txt"), db.generate_dgo_listing());
db.process_link_data();
db.find_code();
db.process_labels();
if (get_config().write_scripts) {
db.find_and_write_scripts(out_folder);
}
if (get_config().write_hexdump) {
db.write_object_file_words(out_folder, get_config().write_hexdump_on_v3_only);
}
db.analyze_functions();
if (get_config().write_disassembly) {
db.write_disassembly(out_folder, get_config().disassemble_objects_without_functions);
}
printf("%s\n", get_type_info().get_summary().c_str());
return 0;
}