forked from SilicaAndPina/rePatch
-
Notifications
You must be signed in to change notification settings - Fork 24
/
self.h
99 lines (86 loc) · 2.55 KB
/
self.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#pragma once
#include <inttypes.h>
// some info taken from the wiki, see https://playstationdev.wiki/psvitadevwiki/index.php?title=SELF_File_Format
#pragma pack(push, 1)
typedef struct {
uint32_t magic; /* 53434500 = SCE\0 */
uint32_t version; /* header version 3*/
uint16_t sdk_type; /* */
uint16_t header_type; /* 1 self, 2 unknown, 3 pkg */
uint32_t metadata_offset; /* metadata offset */
uint64_t header_len; /* self header length */
uint64_t elf_filesize; /* ELF file length */
uint64_t self_filesize; /* SELF file length */
uint64_t unknown; /* UNKNOWN */
uint64_t self_offset; /* SELF offset */
uint64_t appinfo_offset; /* app info offset */
uint64_t elf_offset; /* ELF #1 offset */
uint64_t phdr_offset; /* program header offset */
uint64_t shdr_offset; /* section header offset */
uint64_t section_info_offset; /* section info offset */
uint64_t sceversion_offset; /* version offset */
uint64_t controlinfo_offset; /* control info offset */
uint64_t controlinfo_size; /* control info size */
uint64_t padding;
} SCE_header;
typedef struct {
uint64_t authid; /* auth id */
uint32_t vendor_id; /* vendor id */
uint32_t self_type; /* app type */
uint64_t version; /* app version */
uint64_t padding; /* UNKNOWN */
} SCE_appinfo;
typedef struct {
uint32_t unk1;
uint32_t unk2;
uint32_t unk3;
uint32_t unk4;
} SCE_version;
typedef struct {
uint32_t type;
uint32_t size;
uint32_t unk;
uint32_t pad;
} SCE_controlinfo;
typedef struct {
SCE_controlinfo common;
char unk[0x100];
} SCE_controlinfo_5;
typedef struct {
SCE_controlinfo common;
uint32_t unk1;
char unk2[0xFC];
} SCE_controlinfo_6;
typedef struct {
SCE_controlinfo common;
char unk[0x40];
} SCE_controlinfo_7;
typedef struct {
uint64_t offset;
uint64_t length;
uint64_t compression; // 1 = uncompressed, 2 = compressed
uint64_t encryption; // 1 = encrypted, 2 = plain
} segment_info;
#pragma pack(pop)
enum {
HEADER_LEN = 0x1000
};
typedef struct {
uint16_t attr;
uint16_t ver;
uint8_t name[27];
uint8_t type;
uint32_t gp;
uint32_t expTop;
uint32_t expBtm;
uint32_t impTop;
uint32_t impBtm;
uint32_t nid;
uint32_t unk[3];
uint32_t start;
uint32_t stop;
uint32_t exidxTop;
uint32_t exidxBtm;
uint32_t extabTop;
uint32_t extabBtm;
} SceModuleInfo;