forked from xenia-project/xenia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api_scanner_loader.h
61 lines (48 loc) · 1.59 KB
/
api_scanner_loader.h
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
53
54
55
56
57
58
59
60
61
/**
******************************************************************************
* api-scanner - Scan for API imports from a packaged 360 game *
******************************************************************************
* Copyright 2015 x1nixmzeng. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <cstddef>
#include <cstdint>
#include <memory>
#include <vector>
#include "xenia/base/math.h"
#include "xenia/cpu/export_resolver.h"
#include "xenia/kernel/fs/filesystem.h"
#include "xenia/kernel/objects/xfile.h"
#include "xenia/kernel/util/xex2.h"
#include "xenia/memory.h"
#include "xenia/xbox.h"
namespace xe {
namespace tools {
class apiscanner_logger {
public:
enum LogType { LT_WARNING, LT_ERROR };
void operator()(const LogType type, const char* szMessage);
};
class apiscanner_loader {
private:
kernel::fs::FileSystem file_system;
apiscanner_logger log;
std::unique_ptr<Memory> memory_;
std::unique_ptr<xe::cpu::ExportResolver> export_resolver;
public:
apiscanner_loader();
~apiscanner_loader();
bool LoadTitleImports(const std::wstring& target);
struct title {
uint32_t title_id;
std::vector<std::string> imports;
};
const std::vector<title>& GetAllTitles() const { return loaded_titles; }
private:
std::vector<title> loaded_titles;
bool ReadTarget();
bool ExtractImports(const void* addr, const size_t length, title& info);
};
} // namespace tools
} // namespace xe