vita-toolchain

git clone https://git.neptards.moe/neptards/vita-toolchain.git
Log | Files | Refs | README | LICENSE

self.h (2160B)


      1 #pragma once
      2 
      3 #include <inttypes.h>
      4 
      5 // some info taken from the wiki, see http://vitadevwiki.com/index.php?title=SELF_File_Format
      6 
      7 #pragma pack(push, 1)
      8 typedef struct {
      9 	uint32_t magic;                 /* 53434500 = SCE\0 */
     10 	uint32_t version;               /* header version 3*/
     11 	uint16_t sdk_type;              /* */
     12 	uint16_t header_type;           /* 1 self, 2 unknown, 3 pkg */
     13 	uint32_t metadata_offset;       /* metadata offset */
     14 	uint64_t header_len;            /* self header length */
     15 	uint64_t elf_filesize;          /* ELF file length */
     16 	uint64_t self_filesize;         /* SELF file length */
     17 	uint64_t unknown;               /* UNKNOWN */
     18 	uint64_t self_offset;           /* SELF offset */
     19 	uint64_t appinfo_offset;        /* app info offset */
     20 	uint64_t elf_offset;            /* ELF #1 offset */
     21 	uint64_t phdr_offset;           /* program header offset */
     22 	uint64_t shdr_offset;           /* section header offset */
     23 	uint64_t section_info_offset;   /* section info offset */
     24 	uint64_t sceversion_offset;     /* version offset */
     25 	uint64_t controlinfo_offset;    /* control info offset */
     26 	uint64_t controlinfo_size;      /* control info size */
     27 	uint64_t padding;
     28 } SCE_header;
     29 
     30 typedef struct {
     31 	uint64_t authid;                /* auth id */
     32 	uint32_t vendor_id;             /* vendor id */
     33 	uint32_t self_type;             /* app type */
     34 	uint64_t version;               /* app version */
     35 	uint64_t padding;               /* UNKNOWN */
     36 } SCE_appinfo;
     37 
     38 typedef struct {
     39 	uint32_t unk1;
     40 	uint32_t unk2;
     41 	uint32_t unk3;
     42 	uint32_t unk4;
     43 } SCE_version;
     44 
     45 typedef struct {
     46 	uint32_t type;
     47 	uint32_t size;
     48 	uint32_t unk;
     49 	uint32_t pad;
     50 } SCE_controlinfo;
     51 
     52 typedef struct {
     53 	SCE_controlinfo common;
     54 	char unk[0x100];
     55 } SCE_controlinfo_5;
     56 
     57 typedef struct {
     58 	SCE_controlinfo common;
     59 	uint32_t unk1;
     60 	char unk2[0xFC];
     61 } SCE_controlinfo_6;
     62 
     63 typedef struct {
     64 	SCE_controlinfo common;
     65 	char unk[0x40];
     66 } SCE_controlinfo_7;
     67 
     68 typedef struct {
     69 	uint64_t offset;
     70 	uint64_t length;
     71 	uint64_t compression; // 1 = uncompressed, 2 = compressed
     72 	uint64_t encryption; // 1 = encrypted, 2 = plain
     73 } segment_info;
     74 #pragma pack(pop)
     75 
     76 enum {
     77 	HEADER_LEN = 0x1000
     78 };