-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsrc.cpp
71 lines (67 loc) · 1.64 KB
/
src.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
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
62
63
64
65
66
67
68
69
70
71
/*
*
*/
#include "idaldr.h"
#include "types.h"
#include "exefs.h"
#include "ncch.h"
//--------------------------------------------------------------------------
//
// check input file format. if recognized, then return 1
// and fill 'fileformatname'.
// otherwise return 0
//
static int idaapi accept_file(
qstring *fileformatname,
qstring *processor,
linput_t *li,
const char *)
{
NCCH ncch;
if (ncch.check_header(li)) {
*fileformatname = "Nintendo 3DS game dump (NCCH/CXI)";
*processor = "arm";
return 1;
}
return 0;
}
//--------------------------------------------------------------------------
//
// load file into the database.
//
static void idaapi load_file(linput_t *li, ushort neflag, const char * fileformatname)
{
NCCH ncch;
set_processor_type("ARM", SETPROC_LOADER);
if (ncch.check_header(li) && qstrcmp(fileformatname, "Nintendo 3DS firmware dump")) {
ncch.load_file(li);
}
}
//----------------------------------------------------------------------
//
// LOADER DESCRIPTION BLOCK
//
//----------------------------------------------------------------------
loader_t LDSC =
{
IDP_INTERFACE_VERSION,
0, // loader flags
//
// check input file format. if recognized, then return 1
// and fill 'fileformatname'.
// otherwise return 0
//
accept_file,
//
// load file into the database.
//
load_file,
//
// create output file from the database.
// this function may be absent.
//
NULL,
// take care of a moved segment (fix up relocations, for example)
NULL,
NULL,
};