mirror of
https://github.com/DarkStore-3DS/Project_CTR.git
synced 2026-07-06 16:59:03 +00:00
Merge pull request #25 from 3DSGuy/unstable
makerom 0.13 and ctrtool fixes
This commit is contained in:
@@ -42,6 +42,11 @@ void exheader_set_programid(exheader_context* ctx, u8 programid[8])
|
|||||||
memcpy(ctx->programid, programid, 8);
|
memcpy(ctx->programid, programid, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void exheader_set_hash(exheader_context* ctx, u8 hash[32])
|
||||||
|
{
|
||||||
|
memcpy(ctx->hash, hash, 32);
|
||||||
|
}
|
||||||
|
|
||||||
void exheader_set_counter(exheader_context* ctx, u8 counter[16])
|
void exheader_set_counter(exheader_context* ctx, u8 counter[16])
|
||||||
{
|
{
|
||||||
memcpy(ctx->counter, counter, 16);
|
memcpy(ctx->counter, counter, 16);
|
||||||
@@ -94,6 +99,19 @@ void exheader_read(exheader_context* ctx, u32 actions)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int exheader_hash_valid(exheader_context* ctx)
|
||||||
|
{
|
||||||
|
u8 hash[32];
|
||||||
|
ctr_sha_256((u8*)&ctx->header, 0x400, hash);
|
||||||
|
|
||||||
|
if(memcmp(ctx->hash,hash,0x20)){
|
||||||
|
fprintf(stderr, "Error, exheader hash mismatch. Wrong key?\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int exheader_programid_valid(exheader_context* ctx)
|
int exheader_programid_valid(exheader_context* ctx)
|
||||||
{
|
{
|
||||||
if (!settings_get_ignore_programid(ctx->usersettings))
|
if (!settings_get_ignore_programid(ctx->usersettings))
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ typedef struct
|
|||||||
settings* usersettings;
|
settings* usersettings;
|
||||||
u8 partitionid[8];
|
u8 partitionid[8];
|
||||||
u8 programid[8];
|
u8 programid[8];
|
||||||
|
u8 hash[32];
|
||||||
u8 counter[16];
|
u8 counter[16];
|
||||||
u8 key[16];
|
u8 key[16];
|
||||||
u32 offset;
|
u32 offset;
|
||||||
@@ -134,6 +135,7 @@ void exheader_set_size(exheader_context* ctx, u32 size);
|
|||||||
void exheader_set_partitionid(exheader_context* ctx, u8 partitionid[8]);
|
void exheader_set_partitionid(exheader_context* ctx, u8 partitionid[8]);
|
||||||
void exheader_set_counter(exheader_context* ctx, u8 counter[16]);
|
void exheader_set_counter(exheader_context* ctx, u8 counter[16]);
|
||||||
void exheader_set_programid(exheader_context* ctx, u8 programid[8]);
|
void exheader_set_programid(exheader_context* ctx, u8 programid[8]);
|
||||||
|
void exheader_set_hash(exheader_context* ctx, u8 hash[32]);
|
||||||
void exheader_set_encrypted(exheader_context* ctx, u32 encrypted);
|
void exheader_set_encrypted(exheader_context* ctx, u32 encrypted);
|
||||||
void exheader_set_key(exheader_context* ctx, u8 key[16]);
|
void exheader_set_key(exheader_context* ctx, u8 key[16]);
|
||||||
void exheader_set_usersettings(exheader_context* ctx, settings* usersettings);
|
void exheader_set_usersettings(exheader_context* ctx, settings* usersettings);
|
||||||
@@ -143,6 +145,7 @@ int exheader_process(exheader_context* ctx, u32 actions);
|
|||||||
const char* exheader_getvalidstring(int valid);
|
const char* exheader_getvalidstring(int valid);
|
||||||
void exheader_print(exheader_context* ctx);
|
void exheader_print(exheader_context* ctx);
|
||||||
void exheader_verify(exheader_context* ctx);
|
void exheader_verify(exheader_context* ctx);
|
||||||
|
int exheader_hash_valid(exheader_context* ctx);
|
||||||
int exheader_programid_valid(exheader_context* ctx);
|
int exheader_programid_valid(exheader_context* ctx);
|
||||||
void exheader_determine_key(exheader_context* ctx, u32 actions);
|
void exheader_determine_key(exheader_context* ctx, u32 actions);
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -328,6 +328,7 @@ void ncch_process(ncch_context* ctx, u32 actions)
|
|||||||
exheader_set_usersettings(&ctx->exheader, ctx->usersettings);
|
exheader_set_usersettings(&ctx->exheader, ctx->usersettings);
|
||||||
exheader_set_partitionid(&ctx->exheader, ctx->header.partitionid);
|
exheader_set_partitionid(&ctx->exheader, ctx->header.partitionid);
|
||||||
exheader_set_programid(&ctx->exheader, ctx->header.programid);
|
exheader_set_programid(&ctx->exheader, ctx->header.programid);
|
||||||
|
exheader_set_hash(&ctx->exheader, ctx->header.extendedheaderhash);
|
||||||
exheader_set_counter(&ctx->exheader, exheadercounter);
|
exheader_set_counter(&ctx->exheader, exheadercounter);
|
||||||
exheader_set_key(&ctx->exheader, ctx->key);
|
exheader_set_key(&ctx->exheader, ctx->key);
|
||||||
exheader_set_encrypted(&ctx->exheader, ctx->encrypted);
|
exheader_set_encrypted(&ctx->exheader, ctx->encrypted);
|
||||||
@@ -361,7 +362,7 @@ void ncch_process(ncch_context* ctx, u32 actions)
|
|||||||
|
|
||||||
if (result && ncch_get_exheader_size(ctx))
|
if (result && ncch_get_exheader_size(ctx))
|
||||||
{
|
{
|
||||||
if (!exheader_programid_valid(&ctx->exheader))
|
if (!exheader_hash_valid(&ctx->exheader))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
result = exheader_process(&ctx->exheader, actions);
|
result = exheader_process(&ctx->exheader, actions);
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ void tmd_print(tmd_context* ctx)
|
|||||||
ctr_tmd_header_2048* header2048 = 0;
|
ctr_tmd_header_2048* header2048 = 0;
|
||||||
ctr_tmd_body* body = 0;
|
ctr_tmd_body* body = 0;
|
||||||
unsigned int contentcount = 0;
|
unsigned int contentcount = 0;
|
||||||
|
unsigned int savesize = 0;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (type == TMD_RSA_2048_SHA256 || type == TMD_RSA_2048_SHA1)
|
if (type == TMD_RSA_2048_SHA256 || type == TMD_RSA_2048_SHA1)
|
||||||
@@ -104,6 +105,7 @@ void tmd_print(tmd_context* ctx)
|
|||||||
body = tmd_get_body(ctx);
|
body = tmd_get_body(ctx);
|
||||||
|
|
||||||
contentcount = getbe16(body->contentcount);
|
contentcount = getbe16(body->contentcount);
|
||||||
|
savesize = getle32(body->savedatasize);
|
||||||
|
|
||||||
fprintf(stdout, "\nTMD header:\n");
|
fprintf(stdout, "\nTMD header:\n");
|
||||||
fprintf(stdout, "Signature type: %s\n", tmd_get_type_string(type));
|
fprintf(stdout, "Signature type: %s\n", tmd_get_type_string(type));
|
||||||
@@ -115,6 +117,12 @@ void tmd_print(tmd_context* ctx)
|
|||||||
memdump(stdout, "Title id: ", body->titleid, 8);
|
memdump(stdout, "Title id: ", body->titleid, 8);
|
||||||
fprintf(stdout, "Title type: %08x\n", getbe32(body->titletype));
|
fprintf(stdout, "Title type: %08x\n", getbe32(body->titletype));
|
||||||
fprintf(stdout, "Group id: %04x\n", getbe16(body->groupid));
|
fprintf(stdout, "Group id: %04x\n", getbe16(body->groupid));
|
||||||
|
if(savesize < sizeKB)
|
||||||
|
fprintf(stdout, "Save Size: %08x\n", savesize);
|
||||||
|
else if(savesize < sizeMB)
|
||||||
|
fprintf(stdout, "Save Size: %dKB (%08x)\n", savesize/sizeKB, savesize);
|
||||||
|
else
|
||||||
|
fprintf(stdout, "Save Size: %dMB (%08x)\n", savesize/sizeMB, savesize);
|
||||||
fprintf(stdout, "Access rights: %08x\n", getbe32(body->accessrights));
|
fprintf(stdout, "Access rights: %08x\n", getbe32(body->accessrights));
|
||||||
fprintf(stdout, "Title version: %04x\n", getbe16(body->titleversion));
|
fprintf(stdout, "Title version: %04x\n", getbe16(body->titleversion));
|
||||||
fprintf(stdout, "Content count: %04x\n", getbe16(body->contentcount));
|
fprintf(stdout, "Content count: %04x\n", getbe16(body->contentcount));
|
||||||
|
|||||||
+6
-2
@@ -27,12 +27,16 @@ typedef struct
|
|||||||
unsigned char titleid[8];
|
unsigned char titleid[8];
|
||||||
unsigned char titletype[4];
|
unsigned char titletype[4];
|
||||||
unsigned char groupid[2];
|
unsigned char groupid[2];
|
||||||
unsigned char padding3[62];
|
unsigned char savedatasize[4];
|
||||||
|
unsigned char privsavedatasize[4];
|
||||||
|
unsigned char padding3[4];
|
||||||
|
unsigned char twlflag;
|
||||||
|
unsigned char padding4[0x31];
|
||||||
unsigned char accessrights[4];
|
unsigned char accessrights[4];
|
||||||
unsigned char titleversion[2];
|
unsigned char titleversion[2];
|
||||||
unsigned char contentcount[2];
|
unsigned char contentcount[2];
|
||||||
unsigned char bootcontent[2];
|
unsigned char bootcontent[2];
|
||||||
unsigned char padding4[2];
|
unsigned char padding5[2];
|
||||||
unsigned char hash[32];
|
unsigned char hash[32];
|
||||||
unsigned char contentinfo[36*64];
|
unsigned char contentinfo[36*64];
|
||||||
} ctr_tmd_body;
|
} ctr_tmd_body;
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ CC = gcc
|
|||||||
# MAKEROM Build Settings
|
# MAKEROM Build Settings
|
||||||
MAKEROM_BUILD_FLAGS = #-DDEBUG
|
MAKEROM_BUILD_FLAGS = #-DDEBUG
|
||||||
VER_MAJOR = 0
|
VER_MAJOR = 0
|
||||||
VER_MINOR = 12
|
VER_MINOR = 13
|
||||||
OUTPUT = makerom
|
OUTPUT = makerom
|
||||||
|
|
||||||
main: build
|
main: build
|
||||||
|
|||||||
+41
-1
@@ -307,6 +307,11 @@ void accessdesc_GetPresetSigData(u8 **accessDescSig, u8 **cxiPubk, u8 **cxiPvtk,
|
|||||||
*cxiPubk = (u8*)app_fw1D_prod_hdrpub;
|
*cxiPubk = (u8*)app_fw1D_prod_hdrpub;
|
||||||
*cxiPvtk = NULL;
|
*cxiPvtk = NULL;
|
||||||
}
|
}
|
||||||
|
if(keys->keyset == pki_GATEWAY3DS){
|
||||||
|
*accessDescSig = (u8*)app_fw1D_prod_acexsig;
|
||||||
|
*cxiPubk = (u8*)app_fw1D_prod_hdrpub;
|
||||||
|
*cxiPvtk = (u8*)app_fw1D_prod_hdrpub;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 0x1E:
|
case 0x1E:
|
||||||
if(keys->keyset == pki_PRODUCTION){
|
if(keys->keyset == pki_PRODUCTION){
|
||||||
@@ -314,6 +319,11 @@ void accessdesc_GetPresetSigData(u8 **accessDescSig, u8 **cxiPubk, u8 **cxiPvtk,
|
|||||||
*cxiPubk = (u8*)app_fw1E_prod_hdrpub;
|
*cxiPubk = (u8*)app_fw1E_prod_hdrpub;
|
||||||
*cxiPvtk = NULL;
|
*cxiPvtk = NULL;
|
||||||
}
|
}
|
||||||
|
if(keys->keyset == pki_GATEWAY3DS){
|
||||||
|
*accessDescSig = (u8*)app_fw1E_prod_acexsig;
|
||||||
|
*cxiPubk = (u8*)app_fw1E_prod_hdrpub;
|
||||||
|
*cxiPvtk = (u8*)app_fw1E_prod_hdrpub;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 0x20:
|
case 0x20:
|
||||||
if(keys->keyset == pki_DEVELOPMENT){
|
if(keys->keyset == pki_DEVELOPMENT){
|
||||||
@@ -321,11 +331,16 @@ void accessdesc_GetPresetSigData(u8 **accessDescSig, u8 **cxiPubk, u8 **cxiPvtk,
|
|||||||
*cxiPubk = (u8*)app_fw20_dev_hdrpub;
|
*cxiPubk = (u8*)app_fw20_dev_hdrpub;
|
||||||
*cxiPvtk = NULL;
|
*cxiPvtk = NULL;
|
||||||
}
|
}
|
||||||
else if(keys->keyset == pki_PRODUCTION){
|
if(keys->keyset == pki_PRODUCTION){
|
||||||
*accessDescSig = (u8*)app_fw20_prod_acexsig;
|
*accessDescSig = (u8*)app_fw20_prod_acexsig;
|
||||||
*cxiPubk = (u8*)app_fw20_prod_hdrpub;
|
*cxiPubk = (u8*)app_fw20_prod_hdrpub;
|
||||||
*cxiPvtk = NULL;
|
*cxiPvtk = NULL;
|
||||||
}
|
}
|
||||||
|
if(keys->keyset == pki_GATEWAY3DS){
|
||||||
|
*accessDescSig = (u8*)app_fw20_prod_acexsig;
|
||||||
|
*cxiPubk = (u8*)app_fw20_prod_hdrpub;
|
||||||
|
*cxiPvtk = (u8*)app_fw20_prod_hdrpub;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 0x21:
|
case 0x21:
|
||||||
if(keys->keyset == pki_DEVELOPMENT){
|
if(keys->keyset == pki_DEVELOPMENT){
|
||||||
@@ -338,6 +353,11 @@ void accessdesc_GetPresetSigData(u8 **accessDescSig, u8 **cxiPubk, u8 **cxiPvtk,
|
|||||||
*cxiPubk = (u8*)app_fw21_prod_hdrpub;
|
*cxiPubk = (u8*)app_fw21_prod_hdrpub;
|
||||||
*cxiPvtk = NULL;
|
*cxiPvtk = NULL;
|
||||||
}
|
}
|
||||||
|
if(keys->keyset == pki_GATEWAY3DS){
|
||||||
|
*accessDescSig = (u8*)app_fw21_prod_acexsig;
|
||||||
|
*cxiPubk = (u8*)app_fw21_prod_hdrpub;
|
||||||
|
*cxiPvtk = (u8*)app_fw21_prod_hdrpub;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 0x23:
|
case 0x23:
|
||||||
if(keys->keyset == pki_DEVELOPMENT){
|
if(keys->keyset == pki_DEVELOPMENT){
|
||||||
@@ -350,6 +370,11 @@ void accessdesc_GetPresetSigData(u8 **accessDescSig, u8 **cxiPubk, u8 **cxiPvtk,
|
|||||||
*cxiPubk = (u8*)app_fw23_prod_hdrpub;
|
*cxiPubk = (u8*)app_fw23_prod_hdrpub;
|
||||||
*cxiPvtk = NULL;
|
*cxiPvtk = NULL;
|
||||||
}
|
}
|
||||||
|
if(keys->keyset == pki_GATEWAY3DS){
|
||||||
|
*accessDescSig = (u8*)app_fw23_prod_acexsig;
|
||||||
|
*cxiPubk = (u8*)app_fw23_prod_hdrpub;
|
||||||
|
*cxiPvtk = (u8*)app_fw23_prod_hdrpub;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 0x27:
|
case 0x27:
|
||||||
if(keys->keyset == pki_PRODUCTION){
|
if(keys->keyset == pki_PRODUCTION){
|
||||||
@@ -357,6 +382,11 @@ void accessdesc_GetPresetSigData(u8 **accessDescSig, u8 **cxiPubk, u8 **cxiPvtk,
|
|||||||
*cxiPubk = (u8*)app_fw27_prod_hdrpub;
|
*cxiPubk = (u8*)app_fw27_prod_hdrpub;
|
||||||
*cxiPvtk = NULL;
|
*cxiPvtk = NULL;
|
||||||
}
|
}
|
||||||
|
if(keys->keyset == pki_GATEWAY3DS){
|
||||||
|
*accessDescSig = (u8*)app_fw27_prod_acexsig;
|
||||||
|
*cxiPubk = (u8*)app_fw27_prod_hdrpub;
|
||||||
|
*cxiPvtk = (u8*)app_fw27_prod_hdrpub;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -369,6 +399,11 @@ void accessdesc_GetPresetSigData(u8 **accessDescSig, u8 **cxiPubk, u8 **cxiPvtk,
|
|||||||
*cxiPubk = (u8*)ecapp_fw20_prod_hdrpub;
|
*cxiPubk = (u8*)ecapp_fw20_prod_hdrpub;
|
||||||
*cxiPvtk = NULL;
|
*cxiPvtk = NULL;
|
||||||
}
|
}
|
||||||
|
if(keys->keyset == pki_GATEWAY3DS){
|
||||||
|
*accessDescSig = (u8*)ecapp_fw20_prod_acexsig;
|
||||||
|
*cxiPubk = (u8*)ecapp_fw20_prod_hdrpub;
|
||||||
|
*cxiPvtk = (u8*)ecapp_fw20_prod_hdrpub;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 0x23:
|
case 0x23:
|
||||||
if(keys->keyset == pki_PRODUCTION){
|
if(keys->keyset == pki_PRODUCTION){
|
||||||
@@ -376,6 +411,11 @@ void accessdesc_GetPresetSigData(u8 **accessDescSig, u8 **cxiPubk, u8 **cxiPvtk,
|
|||||||
*cxiPubk = (u8*)ecapp_fw23_prod_hdrpub;
|
*cxiPubk = (u8*)ecapp_fw23_prod_hdrpub;
|
||||||
*cxiPvtk = NULL;
|
*cxiPvtk = NULL;
|
||||||
}
|
}
|
||||||
|
if(keys->keyset == pki_GATEWAY3DS){
|
||||||
|
*accessDescSig = (u8*)ecapp_fw23_prod_acexsig;
|
||||||
|
*cxiPubk = (u8*)ecapp_fw23_prod_hdrpub;
|
||||||
|
*cxiPvtk = (u8*)ecapp_fw23_prod_hdrpub;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -139,8 +139,12 @@ int SetCardInfoBitmask(cardinfo_hdr *hdr, cci_settings *set)
|
|||||||
}
|
}
|
||||||
|
|
||||||
str = set->rsf->CardInfo.CryptoType;
|
str = set->rsf->CardInfo.CryptoType;
|
||||||
if(!str)
|
if(!str) {
|
||||||
bitmask |= 0;//(3*0x40);
|
if(set->options.useExternalSdkCardInfo)
|
||||||
|
bitmask |= (3*0x40);
|
||||||
|
else
|
||||||
|
bitmask |= 0;
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
int val = strtol(str,NULL,10);
|
int val = strtol(str,NULL,10);
|
||||||
if(val < 0 || val > 3) {
|
if(val < 0 || val > 3) {
|
||||||
|
|||||||
+4
-8
@@ -153,17 +153,13 @@ u32 GetSigHashLen(u32 sig_type)
|
|||||||
{
|
{
|
||||||
switch(sig_type){
|
switch(sig_type){
|
||||||
case RSA_4096_SHA1:
|
case RSA_4096_SHA1:
|
||||||
return 0x14;
|
|
||||||
case RSA_4096_SHA256:
|
|
||||||
return 0x20;
|
|
||||||
case RSA_2048_SHA1:
|
case RSA_2048_SHA1:
|
||||||
return 0x14;
|
|
||||||
case RSA_2048_SHA256:
|
|
||||||
return 0x20;
|
|
||||||
case ECC_SHA1:
|
case ECC_SHA1:
|
||||||
return 0x14;
|
return SHA_1_LEN;
|
||||||
|
case RSA_4096_SHA256:
|
||||||
|
case RSA_2048_SHA256:
|
||||||
case ECC_SHA256:
|
case ECC_SHA256:
|
||||||
return 0x20;
|
return SHA_256_LEN;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,12 @@ typedef enum
|
|||||||
CTR_SHA_256,
|
CTR_SHA_256,
|
||||||
} ctr_sha_modes;
|
} ctr_sha_modes;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
SHA_1_LEN = 0x14,
|
||||||
|
SHA_256_LEN = 0x20,
|
||||||
|
} sha_hash_len;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
RSA_4096_PUBK = 0,
|
RSA_4096_PUBK = 0,
|
||||||
|
|||||||
+1
-1
@@ -41,7 +41,7 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
u16 *name;
|
fs_romfs_char *name;
|
||||||
u32 name_len;
|
u32 name_len;
|
||||||
|
|
||||||
void *dir; // treated as type 'fs_dir'. This officially type 'void' to prevent self referencing problems
|
void *dir; // treated as type 'fs_dir'. This officially type 'void' to prevent self referencing problems
|
||||||
|
|||||||
+411
-436
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -117,7 +117,7 @@ typedef struct
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
u8 extSavedataId[8];
|
u8 extSavedataId[8];
|
||||||
u8 systemSavedataId[8];
|
u8 systemSavedataId[2][4];
|
||||||
u8 storageAccessableUniqueIds[8];
|
u8 storageAccessableUniqueIds[8];
|
||||||
u8 accessInfo[7];
|
u8 accessInfo[7];
|
||||||
u8 otherAttributes;
|
u8 otherAttributes;
|
||||||
@@ -140,7 +140,7 @@ typedef struct
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
u16 num;
|
u16 num;
|
||||||
u32 *Data;
|
u32 *data;
|
||||||
} ARM11KernelCapabilityDescriptor;
|
} ARM11KernelCapabilityDescriptor;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
COMMON_HEADER_KEY_NOT_FOUND = -10,
|
COMMON_HEADER_KEY_NOT_FOUND = -10,
|
||||||
EXHDR_BAD_YAML_OPT = -11,
|
EXHDR_BAD_RSF_OPT = -11,
|
||||||
CANNOT_SIGN_ACCESSDESC = -12
|
CANNOT_SIGN_ACCESSDESC = -12
|
||||||
} exheader_errors;
|
} exheader_errors;
|
||||||
|
|
||||||
|
|||||||
@@ -170,6 +170,31 @@ int LoadKeysFromResources(keys_struct *keys)
|
|||||||
SetTikCert(keys,(u8*)xsC_ppki_cert);
|
SetTikCert(keys,(u8*)xsC_ppki_cert);
|
||||||
SetTmdCert(keys,(u8*)cpB_ppki_cert);
|
SetTmdCert(keys,(u8*)cpB_ppki_cert);
|
||||||
}
|
}
|
||||||
|
else if(keys->keyset == pki_GATEWAY3DS){
|
||||||
|
keys->keysetLoaded = true;
|
||||||
|
/* AES Keys */
|
||||||
|
// CIA
|
||||||
|
if(keys->aes.currentCommonKey > 0xff)
|
||||||
|
SetCurrentCommonKey(keys,0);
|
||||||
|
|
||||||
|
// NCCH
|
||||||
|
SetNormalKey(keys,(u8*)dev_fixed_ncch_key[0]);
|
||||||
|
SetSystemFixedKey(keys,(u8*)dev_fixed_ncch_key[0]);
|
||||||
|
|
||||||
|
/* RSA Keys */
|
||||||
|
// CIA
|
||||||
|
SetTIK_RsaKey(keys,(u8*)xsC_ppki_rsa_priv,(u8*)xsC_ppki_rsa_pub);
|
||||||
|
SetTMD_RsaKey(keys,(u8*)cpB_ppki_rsa_priv,(u8*)cpB_ppki_rsa_pub);
|
||||||
|
// CCI/CFA
|
||||||
|
Set_CCI_CFA_RsaKey(keys,(u8*)prod_ncsd_cfa_priv,(u8*)prod_ncsd_cfa_pub);
|
||||||
|
// CXI
|
||||||
|
SetAccessDesc_RsaKey(keys,(u8*)prod_acex_priv,(u8*)prod_acex_pub);
|
||||||
|
|
||||||
|
/* Certs */
|
||||||
|
SetCaCert(keys,(u8*)ca3_ppki_cert);
|
||||||
|
SetTikCert(keys,(u8*)xsC_ppki_cert);
|
||||||
|
SetTmdCert(keys,(u8*)cpB_ppki_cert);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ typedef enum
|
|||||||
pki_DEVELOPMENT,
|
pki_DEVELOPMENT,
|
||||||
pki_PRODUCTION,
|
pki_PRODUCTION,
|
||||||
pki_CUSTOM,
|
pki_CUSTOM,
|
||||||
|
pki_GATEWAY3DS
|
||||||
} pki_keyset;
|
} pki_keyset;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|||||||
+1
-1
@@ -175,7 +175,7 @@ int GetBasicOptions(ncch_settings *ncchset, user_settings *usrset)
|
|||||||
ncchset->options.FreeProductCode = ncchset->rsfSet->Option.FreeProductCode;
|
ncchset->options.FreeProductCode = ncchset->rsfSet->Option.FreeProductCode;
|
||||||
ncchset->options.IsCfa = (usrset->ncch.ncchType == CFA);
|
ncchset->options.IsCfa = (usrset->ncch.ncchType == CFA);
|
||||||
ncchset->options.IsBuildingCodeSection = (usrset->ncch.elfPath != NULL);
|
ncchset->options.IsBuildingCodeSection = (usrset->ncch.elfPath != NULL);
|
||||||
ncchset->options.UseRomFS = ((ncchset->rsfSet->Rom.HostRoot && strlen(ncchset->rsfSet->Rom.HostRoot) > 0) || usrset->ncch.romfsPath);
|
ncchset->options.UseRomFS = ((ncchset->rsfSet->RomFs.RootPath && strlen(ncchset->rsfSet->RomFs.RootPath) > 0) || usrset->ncch.romfsPath);
|
||||||
ncchset->options.useSecCrypto = usrset->ncch.useSecCrypto;
|
ncchset->options.useSecCrypto = usrset->ncch.useSecCrypto;
|
||||||
ncchset->options.keyXID = usrset->ncch.keyXID;
|
ncchset->options.keyXID = usrset->ncch.keyXID;
|
||||||
|
|
||||||
|
|||||||
+113
-117
@@ -13,6 +13,8 @@
|
|||||||
const int NCCH0_OFFSET = 0x4000;
|
const int NCCH0_OFFSET = 0x4000;
|
||||||
const int CCI_BLOCK_SIZE = 0x200;
|
const int CCI_BLOCK_SIZE = 0x200;
|
||||||
|
|
||||||
|
const char MEDIA_SIZE_STR[10][6] = {"128MB","256MB","512MB","1GB","2GB","4GB","8GB","16GB","32GB"};
|
||||||
|
|
||||||
void ImportCciSettings(cci_settings *set, user_settings *usrset);
|
void ImportCciSettings(cci_settings *set, user_settings *usrset);
|
||||||
void FreeCciSettings(cci_settings *set);
|
void FreeCciSettings(cci_settings *set);
|
||||||
int ImportCciNcch(cci_settings *set);
|
int ImportCciNcch(cci_settings *set);
|
||||||
@@ -46,13 +48,13 @@ int build_CCI(user_settings *usrset)
|
|||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(CheckRomConfig(set)){
|
if(GenCardInfoHdr(set)){
|
||||||
result = CCI_CONFIG_FAIL;
|
result = GEN_HDR_FAIL;
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GenCardInfoHdr(set)){
|
if(CheckRomConfig(set)){
|
||||||
result = GEN_HDR_FAIL;
|
result = CCI_CONFIG_FAIL;
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,63 +167,6 @@ bool CanCiaBeCci(u64 titleId, u16 count, tmd_content_chunk *content)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenRsfInputFromTmd(tmd_hdr *tmd, tmd_content_chunk *info, cci_settings *set)
|
|
||||||
{
|
|
||||||
if(!set->rsf->CardInfo.MediaSize){
|
|
||||||
set->rsf->CardInfo.MediaSize = calloc(20,sizeof(char));
|
|
||||||
u64 contentSize = NCCH0_OFFSET;
|
|
||||||
u16 contentNum = GetTmdContentCount(tmd);
|
|
||||||
for(int i = 0; i < contentNum; i++)
|
|
||||||
contentSize += GetTmdContentSize(info[i]);
|
|
||||||
|
|
||||||
if(contentSize < (u64)128*MB)
|
|
||||||
strcpy(set->rsf->CardInfo.MediaSize,"128MB");
|
|
||||||
else if(contentSize < (u64)256*MB)
|
|
||||||
strcpy(set->rsf->CardInfo.MediaSize,"256MB");
|
|
||||||
else if(contentSize < (u64)512*MB)
|
|
||||||
strcpy(set->rsf->CardInfo.MediaSize,"512MB");
|
|
||||||
else if(contentSize < (u64)1*GB)
|
|
||||||
strcpy(set->rsf->CardInfo.MediaSize,"1GB");
|
|
||||||
else if(contentSize < (u64)2*GB)
|
|
||||||
strcpy(set->rsf->CardInfo.MediaSize,"2GB");
|
|
||||||
else if(contentSize < (u64)4*GB)
|
|
||||||
strcpy(set->rsf->CardInfo.MediaSize,"4GB");
|
|
||||||
else if(contentSize < (u64)8*GB)
|
|
||||||
strcpy(set->rsf->CardInfo.MediaSize,"8GB");
|
|
||||||
else{
|
|
||||||
free(set->rsf->CardInfo.MediaSize);
|
|
||||||
set->rsf->CardInfo.MediaSize = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(set->options.verbose && set->rsf->CardInfo.MediaSize)
|
|
||||||
printf("[CCI] Auto generating RSF setting \"CardInfo/MediaSize: %s\" \n",set->rsf->CardInfo.MediaSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!set->rsf->CardInfo.MediaType){
|
|
||||||
set->rsf->CardInfo.MediaType = calloc(20,sizeof(char));
|
|
||||||
if(set->romInfo.saveSize < (u64)1*MB)
|
|
||||||
strcpy(set->rsf->CardInfo.MediaType,"Card1");
|
|
||||||
else
|
|
||||||
strcpy(set->rsf->CardInfo.MediaType,"Card2");
|
|
||||||
|
|
||||||
if(set->options.verbose)
|
|
||||||
printf("[CCI] Auto generating RSF setting \"CardInfo/MediaType: %s\" \n",set->rsf->CardInfo.MediaType);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!set->rsf->CardInfo.CardDevice){
|
|
||||||
set->rsf->CardInfo.CardDevice = calloc(20,sizeof(char));
|
|
||||||
if(set->romInfo.saveSize < (u64)1*MB && set->romInfo.saveSize > 0)
|
|
||||||
strcpy(set->rsf->CardInfo.CardDevice,"NorFlash");
|
|
||||||
else
|
|
||||||
strcpy(set->rsf->CardInfo.CardDevice,"None");
|
|
||||||
|
|
||||||
if(set->options.verbose)
|
|
||||||
printf("[CCI] Auto generating RSF setting \"CardInfo/CardDevice: %s\" \n",set->rsf->CardInfo.CardDevice);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ProcessCiaForCci(cci_settings *set)
|
int ProcessCiaForCci(cci_settings *set)
|
||||||
{
|
{
|
||||||
if(!IsCia(set->content.data)){
|
if(!IsCia(set->content.data)){
|
||||||
@@ -236,20 +181,12 @@ int ProcessCiaForCci(cci_settings *set)
|
|||||||
|
|
||||||
u16 contentCount = GetTmdContentCount(tmd);
|
u16 contentCount = GetTmdContentCount(tmd);
|
||||||
set->romInfo.saveSize = GetTmdSaveSize(tmd);
|
set->romInfo.saveSize = GetTmdSaveSize(tmd);
|
||||||
if(set->romInfo.saveSize > 0 && set->romInfo.saveSize < (u64)(128*KB))
|
|
||||||
set->romInfo.saveSize = (u64)(128*KB);
|
|
||||||
else if(set->romInfo.saveSize > (u64)(128*KB) && set->romInfo.saveSize < (u64)(512*KB))
|
|
||||||
set->romInfo.saveSize = (u64)(512*KB);
|
|
||||||
else if(set->romInfo.saveSize > (u64)(512*KB))
|
|
||||||
set->romInfo.saveSize = align(set->romInfo.saveSize,MB);
|
|
||||||
|
|
||||||
if(!CanCiaBeCci(GetTmdTitleId(tmd),contentCount,contentInfo)){
|
if(!CanCiaBeCci(GetTmdTitleId(tmd),contentCount,contentInfo)){
|
||||||
fprintf(stderr,"[CCI ERROR] This CIA cannot be converted to CCI\n");
|
fprintf(stderr,"[CCI ERROR] This CIA cannot be converted to CCI\n");
|
||||||
return INCOMPAT_CIA;
|
return INCOMPAT_CIA;
|
||||||
}
|
}
|
||||||
|
|
||||||
GenRsfInputFromTmd(tmd,contentInfo,set);
|
|
||||||
|
|
||||||
bool canDecrypt;
|
bool canDecrypt;
|
||||||
u8 titleKey[AES_128_KEY_SIZE];
|
u8 titleKey[AES_128_KEY_SIZE];
|
||||||
canDecrypt = GetTikTitleKey(titleKey,tik,set->keys);
|
canDecrypt = GetTikTitleKey(titleKey,tik,set->keys);
|
||||||
@@ -285,19 +222,36 @@ int ProcessCiaForCci(cci_settings *set)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ImportCciNcch(cci_settings *set)
|
void GetTitleSaveSize(cci_settings *set)
|
||||||
{
|
{
|
||||||
if(set->rsf->SystemControlInfo.SaveDataSize)
|
if(set->rsf->SystemControlInfo.SaveDataSize)
|
||||||
GetSaveDataSizeFromString(&set->romInfo.saveSize,set->rsf->SystemControlInfo.SaveDataSize,"CCI");
|
GetSaveDataSizeFromString(&set->romInfo.saveSize,set->rsf->SystemControlInfo.SaveDataSize,"CCI");
|
||||||
|
|
||||||
if(set->content.dataType == infile_ncch)
|
// Adjusting save size
|
||||||
return ImportNcchForCci(set);
|
if(set->romInfo.saveSize > 0 && set->romInfo.saveSize < (u64)(128*KB))
|
||||||
else if(set->content.dataType == infile_cia)
|
set->romInfo.saveSize = (u64)(128*KB);
|
||||||
return ProcessCiaForCci(set);
|
else if(set->romInfo.saveSize > (u64)(128*KB) && set->romInfo.saveSize < (u64)(512*KB))
|
||||||
else
|
set->romInfo.saveSize = (u64)(512*KB);
|
||||||
fprintf(stderr,"[CCI ERROR] Unrecognised input data type\n");
|
else if(set->romInfo.saveSize > (u64)(512*KB))
|
||||||
|
set->romInfo.saveSize = align(set->romInfo.saveSize,MB);
|
||||||
|
}
|
||||||
|
|
||||||
return FAILED_TO_IMPORT_FILE;
|
int ImportCciNcch(cci_settings *set)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if(set->content.dataType == infile_ncch)
|
||||||
|
ret = ImportNcchForCci(set);
|
||||||
|
else if(set->content.dataType == infile_cia)
|
||||||
|
ret = ProcessCiaForCci(set);
|
||||||
|
else{
|
||||||
|
fprintf(stderr,"[CCI ERROR] Unrecognised input data type\n");
|
||||||
|
return FAILED_TO_IMPORT_FILE;
|
||||||
|
}
|
||||||
|
|
||||||
|
GetTitleSaveSize(set);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ProcessCverDataForCci(cci_settings *set)
|
int ProcessCverDataForCci(cci_settings *set)
|
||||||
@@ -399,12 +353,34 @@ int ProcessNcchForCci(cci_settings *set)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetCciNcchInfo(cci_hdr *hdr, cci_settings *set)
|
||||||
|
{
|
||||||
|
u64 ncchSize,ncchOffset;
|
||||||
|
|
||||||
|
ncchOffset = NCCH0_OFFSET;
|
||||||
|
|
||||||
|
for(int i = 0; i < CCI_MAX_CONTENT; i++){
|
||||||
|
if(set->content.active[i]){
|
||||||
|
set->content.cOffset[i] = ncchOffset;
|
||||||
|
ncchSize = align(set->content.dSize[i],set->romInfo.blockSize);
|
||||||
|
|
||||||
|
u32_to_u8(hdr->offset_sizeTable[i].offset,(ncchOffset/set->romInfo.blockSize),LE);
|
||||||
|
u32_to_u8(hdr->offset_sizeTable[i].size,(ncchSize/set->romInfo.blockSize),LE);
|
||||||
|
u64_to_u8(hdr->ncchIdTable[i],set->content.titleId[i],LE);
|
||||||
|
|
||||||
|
ncchOffset += ncchSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set->romInfo.usedSize = ncchOffset;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int SetMediaSize(u8 *mediaSize, cci_settings *set)
|
int SetMediaSize(u8 *mediaSize, cci_settings *set)
|
||||||
{
|
{
|
||||||
char *str = set->rsf->CardInfo.MediaSize;
|
char *str = set->rsf->CardInfo.MediaSize;
|
||||||
if(!str)
|
if(str){
|
||||||
set->romInfo.mediaSize = (u64)GB*2;
|
|
||||||
else{
|
|
||||||
if(strcasecmp(str,"128MB") == 0) set->romInfo.mediaSize = (u64)MB*128;
|
if(strcasecmp(str,"128MB") == 0) set->romInfo.mediaSize = (u64)MB*128;
|
||||||
else if(strcasecmp(str,"256MB") == 0) set->romInfo.mediaSize = (u64)MB*256;
|
else if(strcasecmp(str,"256MB") == 0) set->romInfo.mediaSize = (u64)MB*256;
|
||||||
else if(strcasecmp(str,"512MB") == 0) set->romInfo.mediaSize = (u64)MB*512;
|
else if(strcasecmp(str,"512MB") == 0) set->romInfo.mediaSize = (u64)MB*512;
|
||||||
@@ -419,6 +395,31 @@ int SetMediaSize(u8 *mediaSize, cci_settings *set)
|
|||||||
return INVALID_RSF_OPT;
|
return INVALID_RSF_OPT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
u64 dataSize = set->romInfo.usedSize + (set->romInfo.saveSize >= MB ? set->romInfo.saveSize : 0);
|
||||||
|
if(dataSize < (u64)MB*128)
|
||||||
|
set->romInfo.mediaSize = (u64)MB*128;
|
||||||
|
else if(dataSize < (u64)MB*256)
|
||||||
|
set->romInfo.mediaSize = (u64)MB*256;
|
||||||
|
else if(dataSize < (u64)MB*512)
|
||||||
|
set->romInfo.mediaSize = (u64)MB*512;
|
||||||
|
else if(dataSize < (u64)GB*1)
|
||||||
|
set->romInfo.mediaSize = (u64)GB*1;
|
||||||
|
else if(dataSize < (u64)GB*2)
|
||||||
|
set->romInfo.mediaSize = (u64)GB*2;
|
||||||
|
else if(dataSize < (u64)GB*4)
|
||||||
|
set->romInfo.mediaSize = (u64)GB*4;
|
||||||
|
else if(dataSize < (u64)GB*8)
|
||||||
|
set->romInfo.mediaSize = (u64)GB*8;
|
||||||
|
//else if(dataSize < (u64)GB*16)
|
||||||
|
// set->romInfo.mediaSize = (u64)GB*16;
|
||||||
|
//else if(dataSize < (u64)GB*32)
|
||||||
|
// set->romInfo.mediaSize = (u64)GB*32;
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"[CCI ERROR] NCCH Partitions are too large\n");
|
||||||
|
return INVALID_RSF_OPT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
u32_to_u8(mediaSize,(set->romInfo.mediaSize/set->romInfo.blockSize),LE);
|
u32_to_u8(mediaSize,(set->romInfo.mediaSize/set->romInfo.blockSize),LE);
|
||||||
|
|
||||||
@@ -446,9 +447,7 @@ int SetMediaType(u8 *flag, cci_settings *set)
|
|||||||
{
|
{
|
||||||
char *str = set->rsf->CardInfo.MediaType;
|
char *str = set->rsf->CardInfo.MediaType;
|
||||||
|
|
||||||
if(!str)
|
if(str){
|
||||||
*flag = mediatype_CARD1;
|
|
||||||
else{
|
|
||||||
if(strcasecmp(str,"Card1") == 0)
|
if(strcasecmp(str,"Card1") == 0)
|
||||||
*flag = mediatype_CARD1;
|
*flag = mediatype_CARD1;
|
||||||
else if(strcasecmp(str,"Card2") == 0)
|
else if(strcasecmp(str,"Card2") == 0)
|
||||||
@@ -458,6 +457,12 @@ int SetMediaType(u8 *flag, cci_settings *set)
|
|||||||
return INVALID_RSF_OPT;
|
return INVALID_RSF_OPT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
if(set->romInfo.saveSize >= (u64)1*MB)
|
||||||
|
*flag = mediatype_CARD2;
|
||||||
|
else
|
||||||
|
*flag = mediatype_CARD1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -488,9 +493,7 @@ int SetCardDevice(u8 *flags, u64 saveSize, rsf_settings *rsf)
|
|||||||
|
|
||||||
/* CardDevice */
|
/* CardDevice */
|
||||||
u8 cardDevice = 0;
|
u8 cardDevice = 0;
|
||||||
if(!rsf->CardInfo.CardDevice)
|
if(rsf->CardInfo.CardDevice){
|
||||||
cardDevice = carddevice_NONE;
|
|
||||||
else{
|
|
||||||
if(strcmp(rsf->CardInfo.CardDevice,"NorFlash") == 0)
|
if(strcmp(rsf->CardInfo.CardDevice,"NorFlash") == 0)
|
||||||
cardDevice = carddevice_NOR_FLASH;
|
cardDevice = carddevice_NOR_FLASH;
|
||||||
else if(strcmp(rsf->CardInfo.CardDevice,"None") == 0)
|
else if(strcmp(rsf->CardInfo.CardDevice,"None") == 0)
|
||||||
@@ -502,6 +505,12 @@ int SetCardDevice(u8 *flags, u64 saveSize, rsf_settings *rsf)
|
|||||||
return INVALID_RSF_OPT;
|
return INVALID_RSF_OPT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
if(saveSize == 0 || saveSize >= (u64)1*MB)
|
||||||
|
cardDevice = carddevice_NONE;
|
||||||
|
else
|
||||||
|
cardDevice = carddevice_NOR_FLASH;
|
||||||
|
}
|
||||||
|
|
||||||
if(flags[cciflag_MEDIA_TYPE] == mediatype_CARD1){
|
if(flags[cciflag_MEDIA_TYPE] == mediatype_CARD1){
|
||||||
if(saveSize != (u64)(128*KB) && saveSize != (u64)(512*KB) && cardDevice == carddevice_NOR_FLASH){
|
if(saveSize != (u64)(128*KB) && saveSize != (u64)(512*KB) && cardDevice == carddevice_NOR_FLASH){
|
||||||
@@ -544,31 +553,6 @@ int SetCciFlags(u8 *flags, cci_settings *set)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCciNcchInfo(cci_hdr *hdr, cci_settings *set)
|
|
||||||
{
|
|
||||||
u64 ncchSize,ncchOffset;
|
|
||||||
|
|
||||||
ncchOffset = NCCH0_OFFSET;
|
|
||||||
|
|
||||||
for(int i = 0; i < CCI_MAX_CONTENT; i++){
|
|
||||||
if(set->content.active[i]){
|
|
||||||
set->content.cOffset[i] = ncchOffset;
|
|
||||||
ncchSize = align(set->content.dSize[i],set->romInfo.blockSize);
|
|
||||||
|
|
||||||
u32_to_u8(hdr->offset_sizeTable[i].offset,(ncchOffset/set->romInfo.blockSize),LE);
|
|
||||||
u32_to_u8(hdr->offset_sizeTable[i].size,(ncchSize/set->romInfo.blockSize),LE);
|
|
||||||
u64_to_u8(hdr->ncchIdTable[i],set->content.titleId[i],LE);
|
|
||||||
|
|
||||||
ncchOffset += ncchSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
set->romInfo.usedSize = ncchOffset;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int GenCciHdr(cci_settings *set)
|
int GenCciHdr(cci_settings *set)
|
||||||
{
|
{
|
||||||
set->headers.ccihdr.size = sizeof(cci_hdr);
|
set->headers.ccihdr.size = sizeof(cci_hdr);
|
||||||
@@ -586,11 +570,12 @@ int GenCciHdr(cci_settings *set)
|
|||||||
u64_to_u8(hdr->titleId,set->content.titleId[0],LE);
|
u64_to_u8(hdr->titleId,set->content.titleId[0],LE);
|
||||||
|
|
||||||
|
|
||||||
|
SetCciNcchInfo(hdr,set);
|
||||||
if(SetMediaSize(hdr->mediaSize,set))
|
if(SetMediaSize(hdr->mediaSize,set))
|
||||||
return GEN_HDR_FAIL;
|
return GEN_HDR_FAIL;
|
||||||
if(SetCciFlags(hdr->flags,set))
|
if(SetCciFlags(hdr->flags,set))
|
||||||
return GEN_HDR_FAIL;
|
return GEN_HDR_FAIL;
|
||||||
SetCciNcchInfo(hdr,set);
|
|
||||||
|
|
||||||
// Sign Header
|
// Sign Header
|
||||||
RsaSignVerify(&hdr->magic,sizeof(cci_hdr)-RSA_2048_KEY_SIZE,hdr->signature,set->keys->rsa.cciCfaPub,set->keys->rsa.cciCfaPvt,RSA_2048_SHA256,CTR_RSA_SIGN);
|
RsaSignVerify(&hdr->magic,sizeof(cci_hdr)-RSA_2048_KEY_SIZE,hdr->signature,set->keys->rsa.cciCfaPub,set->keys->rsa.cciCfaPvt,RSA_2048_SHA256,CTR_RSA_SIGN);
|
||||||
@@ -598,6 +583,21 @@ int GenCciHdr(cci_settings *set)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* GetMediaSizeStr(u64 mediaSize)
|
||||||
|
{
|
||||||
|
//MEDIA_SIZE_STR
|
||||||
|
switch(mediaSize){
|
||||||
|
case (u64)MB*128: return (char*)MEDIA_SIZE_STR[0];
|
||||||
|
case (u64)MB*256: return (char*)MEDIA_SIZE_STR[1];
|
||||||
|
case (u64)MB*512: return (char*)MEDIA_SIZE_STR[2];
|
||||||
|
case (u64)GB*1: return (char*)MEDIA_SIZE_STR[3];
|
||||||
|
case (u64)GB*2: return (char*)MEDIA_SIZE_STR[4];
|
||||||
|
case (u64)GB*4: return (char*)MEDIA_SIZE_STR[5];
|
||||||
|
case (u64)GB*8: return (char*)MEDIA_SIZE_STR[6];
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int CheckRomConfig(cci_settings *set)
|
int CheckRomConfig(cci_settings *set)
|
||||||
{
|
{
|
||||||
u64 cciUsedSize;
|
u64 cciUsedSize;
|
||||||
@@ -607,11 +607,7 @@ int CheckRomConfig(cci_settings *set)
|
|||||||
cciUsedSize = set->romInfo.usedSize;
|
cciUsedSize = set->romInfo.usedSize;
|
||||||
|
|
||||||
if(cciUsedSize > set->romInfo.mediaSize){
|
if(cciUsedSize > set->romInfo.mediaSize){
|
||||||
char *str = set->rsf->CardInfo.MediaSize;
|
fprintf(stderr,"[CCI ERROR] MediaSize '%s' is insufficient for the CCI data\n",GetMediaSizeStr(set->romInfo.mediaSize));
|
||||||
if(!str)
|
|
||||||
str = "2GB";
|
|
||||||
|
|
||||||
fprintf(stderr,"[CCI ERROR] MediaSize '%s' is insufficient for the CCI data\n",str);
|
|
||||||
return CCI_CONFIG_FAIL;
|
return CCI_CONFIG_FAIL;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+18
-21
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
const int ROMFS_BLOCK_SIZE = 0x1000;
|
const int ROMFS_BLOCK_SIZE = 0x1000;
|
||||||
const unsigned int ROMFS_UNUSED_ENTRY = 0xffffffff;
|
const unsigned int ROMFS_UNUSED_ENTRY = 0xffffffff;
|
||||||
|
const fs_romfs_char ROMFS_EMPTY_PATH[2] = {0x0000, 0x0000};
|
||||||
|
|
||||||
// Build
|
// Build
|
||||||
bool IsFileWanted(fs_file *file, void *filter_criteria);
|
bool IsFileWanted(fs_file *file, void *filter_criteria);
|
||||||
@@ -30,7 +31,7 @@ int PrepareBuildRomFsBinary(ncch_settings *ncchset, romfs_buildctx *ctx)
|
|||||||
char *cwd = calloc(CWD_MAX_LEN,sizeof(char));
|
char *cwd = calloc(CWD_MAX_LEN,sizeof(char));
|
||||||
getcwd(cwd,CWD_MAX_LEN);
|
getcwd(cwd,CWD_MAX_LEN);
|
||||||
|
|
||||||
char *dir = ncchset->rsfSet->Rom.HostRoot;
|
char *dir = ncchset->rsfSet->RomFs.RootPath;
|
||||||
|
|
||||||
fs_char *fs_path;
|
fs_char *fs_path;
|
||||||
fs_romfs_char *path;
|
fs_romfs_char *path;
|
||||||
@@ -201,9 +202,9 @@ int CalcRomfsSize(romfs_buildctx *ctx)
|
|||||||
|
|
||||||
//printf("predict level sizes\n");
|
//printf("predict level sizes\n");
|
||||||
ctx->level[3].size = romfsHdrSize + ctx->m_dataLen; // data
|
ctx->level[3].size = romfsHdrSize + ctx->m_dataLen; // data
|
||||||
ctx->level[2].size = align(ctx->level[3].size,ROMFS_BLOCK_SIZE) / ROMFS_BLOCK_SIZE * 0x20 ;
|
ctx->level[2].size = align(ctx->level[3].size,ROMFS_BLOCK_SIZE) / ROMFS_BLOCK_SIZE * SHA_256_LEN ;
|
||||||
ctx->level[1].size = align(ctx->level[2].size,ROMFS_BLOCK_SIZE) / ROMFS_BLOCK_SIZE * 0x20 ;
|
ctx->level[1].size = align(ctx->level[2].size,ROMFS_BLOCK_SIZE) / ROMFS_BLOCK_SIZE * SHA_256_LEN ;
|
||||||
ctx->level[0].size = align(ctx->level[1].size,ROMFS_BLOCK_SIZE) / ROMFS_BLOCK_SIZE * 0x20 + align(sizeof(ivfc_hdr),0x10); // hdr
|
ctx->level[0].size = align(ctx->level[1].size,ROMFS_BLOCK_SIZE) / ROMFS_BLOCK_SIZE * SHA_256_LEN + align(sizeof(ivfc_hdr),0x10); // hdr
|
||||||
|
|
||||||
ctx->romfsHeaderSize = ctx->level[0].size;
|
ctx->romfsHeaderSize = ctx->level[0].size;
|
||||||
|
|
||||||
@@ -319,13 +320,13 @@ void AddDirHashKey(romfs_buildctx *ctx, u32 parent, fs_romfs_char* path, u32 dir
|
|||||||
{
|
{
|
||||||
u32 hash = CalcPathHash(parent,path,0,fs_u16StrLen(path));
|
u32 hash = CalcPathHash(parent,path,0,fs_u16StrLen(path));
|
||||||
u32 index = hash % ctx->m_dirUTableEntry;
|
u32 index = hash % ctx->m_dirUTableEntry;
|
||||||
if(ctx->dirUTable[index] == 0xffffffff) ctx->dirUTable[index] = dirOffset;
|
if(ctx->dirUTable[index] == ROMFS_UNUSED_ENTRY) ctx->dirUTable[index] = dirOffset;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
romfs_direntry * curdir = (romfs_direntry*)(ctx->dirTable + ctx->dirUTable[index]);
|
romfs_direntry * curdir = (romfs_direntry*)(ctx->dirTable + ctx->dirUTable[index]);
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
if(*(u32*)curdir->weirdoffset == 0xffffffff)
|
if(*(u32*)curdir->weirdoffset == ROMFS_UNUSED_ENTRY)
|
||||||
{
|
{
|
||||||
*(u32*)curdir->weirdoffset = dirOffset;
|
*(u32*)curdir->weirdoffset = dirOffset;
|
||||||
break;
|
break;
|
||||||
@@ -342,13 +343,13 @@ void AddFileHashKey(romfs_buildctx *ctx,u32 parent, fs_romfs_char *path, u32 fil
|
|||||||
{
|
{
|
||||||
u32 hash = CalcPathHash(parent,path,0,fs_u16StrLen(path));
|
u32 hash = CalcPathHash(parent,path,0,fs_u16StrLen(path));
|
||||||
u32 index = hash % ctx->m_fileUTableEntry;
|
u32 index = hash % ctx->m_fileUTableEntry;
|
||||||
if(ctx->fileUTable[index] == 0xffffffff) ctx->fileUTable[index] = fileOffset;
|
if(ctx->fileUTable[index] == ROMFS_UNUSED_ENTRY) ctx->fileUTable[index] = fileOffset;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
romfs_fileentry * curfile = (romfs_fileentry*)(ctx->fileTable + ctx->fileUTable[index]);
|
romfs_fileentry * curfile = (romfs_fileentry*)(ctx->fileTable + ctx->fileUTable[index]);
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
if(*(u32*)curfile->weirdoffset == 0xffffffff)
|
if(*(u32*)curfile->weirdoffset == ROMFS_UNUSED_ENTRY)
|
||||||
{
|
{
|
||||||
*(u32*)curfile->weirdoffset = fileOffset;
|
*(u32*)curfile->weirdoffset = fileOffset;
|
||||||
break;
|
break;
|
||||||
@@ -367,7 +368,7 @@ int AddFileToRomfs(romfs_buildctx *ctx, fs_file *file, u32 parent, u32 sibling)
|
|||||||
|
|
||||||
u32_to_u8(entry->parentdiroffset,parent,LE);
|
u32_to_u8(entry->parentdiroffset,parent,LE);
|
||||||
u32_to_u8(entry->siblingoffset,sibling,LE);
|
u32_to_u8(entry->siblingoffset,sibling,LE);
|
||||||
u32_to_u8(entry->weirdoffset,0xffffffff,LE);
|
u32_to_u8(entry->weirdoffset,ROMFS_UNUSED_ENTRY,LE);
|
||||||
|
|
||||||
// Import Name
|
// Import Name
|
||||||
u32_to_u8(entry->namesize,file->name_len,LE);
|
u32_to_u8(entry->namesize,file->name_len,LE);
|
||||||
@@ -387,6 +388,7 @@ int AddFileToRomfs(romfs_buildctx *ctx, fs_file *file, u32 parent, u32 sibling)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
u64_to_u8(entry->dataoffset,0x40,LE);
|
u64_to_u8(entry->dataoffset,0x40,LE);
|
||||||
|
|
||||||
AddFileHashKey(ctx,parent,file->name,ctx->u_fileTableLen);
|
AddFileHashKey(ctx,parent,file->name,ctx->u_fileTableLen);
|
||||||
ctx->u_fileTableLen += sizeof(romfs_fileentry) + align(file->name_len,4);
|
ctx->u_fileTableLen += sizeof(romfs_fileentry) + align(file->name_len,4);
|
||||||
|
|
||||||
@@ -400,17 +402,14 @@ int AddDirToRomfs(romfs_buildctx *ctx, fs_dir *fs, u32 parent, u32 sibling)
|
|||||||
|
|
||||||
u32_to_u8(entry->parentoffset,parent,LE);
|
u32_to_u8(entry->parentoffset,parent,LE);
|
||||||
u32_to_u8(entry->siblingoffset,sibling,LE);
|
u32_to_u8(entry->siblingoffset,sibling,LE);
|
||||||
|
u32_to_u8(entry->weirdoffset,ROMFS_UNUSED_ENTRY,LE);
|
||||||
//u32 uTableIndex = GetDirUTableIndex(ctx,fs);
|
|
||||||
u32_to_u8(entry->weirdoffset,0xffffffff,LE);
|
|
||||||
//ctx->dirUTable[uTableIndex] = ctx->u_dirTableLen;
|
|
||||||
|
|
||||||
u32 Currentdir = ctx->u_dirTableLen;
|
u32 Currentdir = ctx->u_dirTableLen;
|
||||||
|
|
||||||
if(Currentdir == 0)
|
if(Currentdir == 0)
|
||||||
{
|
{
|
||||||
u32_to_u8(entry->namesize,0,LE);
|
u32_to_u8(entry->namesize,0,LE);
|
||||||
AddDirHashKey(ctx,parent,L"",ctx->u_dirTableLen);
|
AddDirHashKey(ctx,parent,(fs_romfs_char*)ROMFS_EMPTY_PATH,ctx->u_dirTableLen);
|
||||||
ctx->u_dirTableLen += sizeof(romfs_direntry);
|
ctx->u_dirTableLen += sizeof(romfs_direntry);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -464,7 +463,7 @@ int AddDirToRomfs(romfs_buildctx *ctx, fs_dir *fs, u32 parent, u32 sibling)
|
|||||||
AddDirToRomfs(ctx,&dir[i],Currentdir,dir_sibling);
|
AddDirToRomfs(ctx,&dir[i],Currentdir,dir_sibling);
|
||||||
if(dir_sibling != ROMFS_UNUSED_ENTRY)
|
if(dir_sibling != ROMFS_UNUSED_ENTRY)
|
||||||
{
|
{
|
||||||
dir_sibling = ctx->u_dirTableLen;//修复同目录文件夹偏移
|
dir_sibling = ctx->u_dirTableLen;//修复同目录文件夹偏移 (Repair the same directory folder offset)
|
||||||
u32_to_u8(temp_entry->siblingoffset,dir_sibling,LE);
|
u32_to_u8(temp_entry->siblingoffset,dir_sibling,LE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -487,7 +486,7 @@ void BuildIvfcHeader(romfs_buildctx *ctx)
|
|||||||
memcpy(ctx->ivfcHdr->magic,"IVFC",4);
|
memcpy(ctx->ivfcHdr->magic,"IVFC",4);
|
||||||
u32_to_u8(ctx->ivfcHdr->id,0x10000,LE);
|
u32_to_u8(ctx->ivfcHdr->id,0x10000,LE);
|
||||||
|
|
||||||
u32 masterHashSize = ( align(ctx->level[1].size,ROMFS_BLOCK_SIZE) / ROMFS_BLOCK_SIZE ) * 0x20 ;
|
u32 masterHashSize = ( align(ctx->level[1].size,ROMFS_BLOCK_SIZE) / ROMFS_BLOCK_SIZE ) * SHA_256_LEN ;
|
||||||
u32_to_u8(ctx->ivfcHdr->masterHashSize,masterHashSize,LE);
|
u32_to_u8(ctx->ivfcHdr->masterHashSize,masterHashSize,LE);
|
||||||
|
|
||||||
for(int i = 1; i < 4; i++){
|
for(int i = 1; i < 4; i++){
|
||||||
@@ -507,7 +506,7 @@ void GenIvfcHashTree(romfs_buildctx *ctx)
|
|||||||
u32 numHashes = align(ctx->level[i+1].size,ROMFS_BLOCK_SIZE) / ROMFS_BLOCK_SIZE;
|
u32 numHashes = align(ctx->level[i+1].size,ROMFS_BLOCK_SIZE) / ROMFS_BLOCK_SIZE;
|
||||||
for(u32 j = 0; j < numHashes; j++){
|
for(u32 j = 0; j < numHashes; j++){
|
||||||
u8 *datapos = (u8*)(ctx->level[i+1].pos + ROMFS_BLOCK_SIZE * j);
|
u8 *datapos = (u8*)(ctx->level[i+1].pos + ROMFS_BLOCK_SIZE * j);
|
||||||
u8 *hashpos = (u8*)(ctx->level[i].pos + 0x20 * j);
|
u8 *hashpos = (u8*)(ctx->level[i].pos + SHA_256_LEN * j);
|
||||||
ShaCalc(datapos, ROMFS_BLOCK_SIZE, hashpos, CTR_SHA_256);
|
ShaCalc(datapos, ROMFS_BLOCK_SIZE, hashpos, CTR_SHA_256);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -515,15 +514,13 @@ void GenIvfcHashTree(romfs_buildctx *ctx)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 CalcPathHash(u32 parent, fs_romfs_char * path, u32 start, u32 length)
|
u32 CalcPathHash(u32 parent, fs_romfs_char* path, u32 start, u32 length)
|
||||||
{
|
{
|
||||||
u32 hash = parent ^ 123456789;
|
u32 hash = parent ^ 123456789;
|
||||||
u32 index = 0;
|
for( u32 index = 0; index < length; index++ )
|
||||||
while(index < length)
|
|
||||||
{
|
{
|
||||||
hash = (u32)((hash >> 5) | (hash << 27));//ror
|
hash = (u32)((hash >> 5) | (hash << 27));//ror
|
||||||
hash ^= (u16)path[start + index];
|
hash ^= (u16)path[start + index];
|
||||||
index++;
|
|
||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|||||||
+31
-50
@@ -1,5 +1,16 @@
|
|||||||
#include "lib.h"
|
#include "lib.h"
|
||||||
|
|
||||||
|
void GET_Option(ctr_yaml_context *ctx, rsf_settings *rsf);
|
||||||
|
void GET_AccessControlInfo(ctr_yaml_context *ctx, rsf_settings *rsf);
|
||||||
|
void GET_SystemControlInfo(ctr_yaml_context *ctx, rsf_settings *rsf);
|
||||||
|
void GET_BasicInfo(ctr_yaml_context *ctx, rsf_settings *rsf);
|
||||||
|
void GET_RomFs(ctr_yaml_context *ctx, rsf_settings *rsf);
|
||||||
|
void GET_ExeFs(ctr_yaml_context *ctx, rsf_settings *rsf);
|
||||||
|
void GET_PlainRegion(ctr_yaml_context *ctx, rsf_settings *rsf);
|
||||||
|
void GET_TitleInfo(ctr_yaml_context *ctx, rsf_settings *rsf);
|
||||||
|
void GET_CardInfo(ctr_yaml_context *ctx, rsf_settings *rsf);
|
||||||
|
void GET_CommonHeaderKey(ctr_yaml_context *ctx, rsf_settings *rsf);
|
||||||
|
|
||||||
void EvaluateRSF(rsf_settings *rsf, ctr_yaml_context *ctx)
|
void EvaluateRSF(rsf_settings *rsf, ctr_yaml_context *ctx)
|
||||||
{
|
{
|
||||||
u32 start_level = ctx->Level-1;
|
u32 start_level = ctx->Level-1;
|
||||||
@@ -11,7 +22,7 @@ void EvaluateRSF(rsf_settings *rsf, ctr_yaml_context *ctx)
|
|||||||
else if(cmpYamlValue("AccessControlInfo",ctx)) {FinishEvent(ctx); GET_AccessControlInfo(ctx,rsf); goto GET_NextGroup;}
|
else if(cmpYamlValue("AccessControlInfo",ctx)) {FinishEvent(ctx); GET_AccessControlInfo(ctx,rsf); goto GET_NextGroup;}
|
||||||
else if(cmpYamlValue("SystemControlInfo",ctx)) {FinishEvent(ctx); GET_SystemControlInfo(ctx,rsf); goto GET_NextGroup;}
|
else if(cmpYamlValue("SystemControlInfo",ctx)) {FinishEvent(ctx); GET_SystemControlInfo(ctx,rsf); goto GET_NextGroup;}
|
||||||
else if(cmpYamlValue("BasicInfo",ctx)) {FinishEvent(ctx); GET_BasicInfo(ctx,rsf); goto GET_NextGroup;}
|
else if(cmpYamlValue("BasicInfo",ctx)) {FinishEvent(ctx); GET_BasicInfo(ctx,rsf); goto GET_NextGroup;}
|
||||||
else if(cmpYamlValue("Rom",ctx)) {FinishEvent(ctx); GET_Rom(ctx,rsf); goto GET_NextGroup;}
|
else if(cmpYamlValue("RomFs",ctx)) {FinishEvent(ctx); GET_RomFs(ctx,rsf); goto GET_NextGroup;}
|
||||||
else if(cmpYamlValue("ExeFs",ctx)) {FinishEvent(ctx); GET_ExeFs(ctx,rsf); goto GET_NextGroup;}
|
else if(cmpYamlValue("ExeFs",ctx)) {FinishEvent(ctx); GET_ExeFs(ctx,rsf); goto GET_NextGroup;}
|
||||||
else if(cmpYamlValue("PlainRegion",ctx)) {FinishEvent(ctx); GET_PlainRegion(ctx,rsf); goto GET_NextGroup;}
|
else if(cmpYamlValue("PlainRegion",ctx)) {FinishEvent(ctx); GET_PlainRegion(ctx,rsf); goto GET_NextGroup;}
|
||||||
else if(cmpYamlValue("TitleInfo",ctx)) {FinishEvent(ctx); GET_TitleInfo(ctx,rsf); goto GET_NextGroup;}
|
else if(cmpYamlValue("TitleInfo",ctx)) {FinishEvent(ctx); GET_TitleInfo(ctx,rsf); goto GET_NextGroup;}
|
||||||
@@ -53,13 +64,11 @@ void GET_Option(ctr_yaml_context *ctx, rsf_settings *rsf)
|
|||||||
// Handle childs
|
// Handle childs
|
||||||
if(cmpYamlValue("AllowUnalignedSection",ctx)) SetBoolYAMLValue(&rsf->Option.AllowUnalignedSection,"AllowUnalignedSection",ctx);
|
if(cmpYamlValue("AllowUnalignedSection",ctx)) SetBoolYAMLValue(&rsf->Option.AllowUnalignedSection,"AllowUnalignedSection",ctx);
|
||||||
else if(cmpYamlValue("MediaFootPadding",ctx)) SetBoolYAMLValue(&rsf->Option.MediaFootPadding,"MediaFootPadding",ctx);
|
else if(cmpYamlValue("MediaFootPadding",ctx)) SetBoolYAMLValue(&rsf->Option.MediaFootPadding,"MediaFootPadding",ctx);
|
||||||
//else if(cmpYamlValue("NoPadding",ctx)) SetBoolYAMLValue(&rsf->Option.NoPadding,"NoPadding",ctx);
|
|
||||||
else if(cmpYamlValue("EnableCrypt",ctx)) SetBoolYAMLValue(&rsf->Option.EnableCrypt,"EnableCrypt",ctx);
|
else if(cmpYamlValue("EnableCrypt",ctx)) SetBoolYAMLValue(&rsf->Option.EnableCrypt,"EnableCrypt",ctx);
|
||||||
else if(cmpYamlValue("EnableCompress",ctx)) SetBoolYAMLValue(&rsf->Option.EnableCompress,"EnableCompress",ctx);
|
else if(cmpYamlValue("EnableCompress",ctx)) SetBoolYAMLValue(&rsf->Option.EnableCompress,"EnableCompress",ctx);
|
||||||
else if(cmpYamlValue("FreeProductCode",ctx)) SetBoolYAMLValue(&rsf->Option.FreeProductCode,"FreeProductCode",ctx);
|
else if(cmpYamlValue("FreeProductCode",ctx)) SetBoolYAMLValue(&rsf->Option.FreeProductCode,"FreeProductCode",ctx);
|
||||||
else if(cmpYamlValue("UseOnSD",ctx)) SetBoolYAMLValue(&rsf->Option.UseOnSD,"UseOnSD",ctx);
|
else if(cmpYamlValue("UseOnSD",ctx)) SetBoolYAMLValue(&rsf->Option.UseOnSD,"UseOnSD",ctx);
|
||||||
else if(cmpYamlValue("PageSize",ctx)) SetSimpleYAMLValue(&rsf->Option.PageSize,"PageSize",ctx,0);
|
else if(cmpYamlValue("PageSize",ctx)) SetSimpleYAMLValue(&rsf->Option.PageSize,"PageSize",ctx,0);
|
||||||
//else if(cmpYamlValue("AppendSystemCall",ctx)) rsf->Option.AppendSystemCallNum = SetYAMLSequence(&rsf->Option.AppendSystemCall,"AppendSystemCall",ctx);
|
|
||||||
else{
|
else{
|
||||||
fprintf(stderr,"[RSF ERROR] Unrecognised key '%s'\n",GetYamlString(ctx));
|
fprintf(stderr,"[RSF ERROR] Unrecognised key '%s'\n",GetYamlString(ctx));
|
||||||
ctx->error = YAML_UNKNOWN_KEY;
|
ctx->error = YAML_UNKNOWN_KEY;
|
||||||
@@ -91,13 +100,10 @@ void GET_AccessControlInfo(ctr_yaml_context *ctx, rsf_settings *rsf)
|
|||||||
else if(cmpYamlValue("PermitMainFunctionArgument",ctx)) SetBoolYAMLValue(&rsf->AccessControlInfo.PermitMainFunctionArgument,"PermitMainFunctionArgument",ctx);
|
else if(cmpYamlValue("PermitMainFunctionArgument",ctx)) SetBoolYAMLValue(&rsf->AccessControlInfo.PermitMainFunctionArgument,"PermitMainFunctionArgument",ctx);
|
||||||
else if(cmpYamlValue("CanShareDeviceMemory",ctx)) SetBoolYAMLValue(&rsf->AccessControlInfo.CanShareDeviceMemory,"CanShareDeviceMemory",ctx);
|
else if(cmpYamlValue("CanShareDeviceMemory",ctx)) SetBoolYAMLValue(&rsf->AccessControlInfo.CanShareDeviceMemory,"CanShareDeviceMemory",ctx);
|
||||||
else if(cmpYamlValue("UseOtherVariationSaveData",ctx)) SetBoolYAMLValue(&rsf->AccessControlInfo.UseOtherVariationSaveData,"UseOtherVariationSaveData",ctx);
|
else if(cmpYamlValue("UseOtherVariationSaveData",ctx)) SetBoolYAMLValue(&rsf->AccessControlInfo.UseOtherVariationSaveData,"UseOtherVariationSaveData",ctx);
|
||||||
else if(cmpYamlValue("UseExtSaveData",ctx)) SetBoolYAMLValue(&rsf->AccessControlInfo.UseExtSaveData,"UseExtSaveData",ctx);
|
|
||||||
else if(cmpYamlValue("UseExtendedSaveDataAccessControl",ctx)) SetBoolYAMLValue(&rsf->AccessControlInfo.UseExtendedSaveDataAccessControl,"UseExtendedSaveDataAccessControl",ctx);
|
|
||||||
else if(cmpYamlValue("RunnableOnSleep",ctx)) SetBoolYAMLValue(&rsf->AccessControlInfo.RunnableOnSleep,"RunnableOnSleep",ctx);
|
else if(cmpYamlValue("RunnableOnSleep",ctx)) SetBoolYAMLValue(&rsf->AccessControlInfo.RunnableOnSleep,"RunnableOnSleep",ctx);
|
||||||
else if(cmpYamlValue("SpecialMemoryArrange",ctx)) SetBoolYAMLValue(&rsf->AccessControlInfo.SpecialMemoryArrange,"SpecialMemoryArrange",ctx);
|
else if(cmpYamlValue("SpecialMemoryArrange",ctx)) SetBoolYAMLValue(&rsf->AccessControlInfo.SpecialMemoryArrange,"SpecialMemoryArrange",ctx);
|
||||||
|
|
||||||
|
|
||||||
//else if(cmpYamlValue("ProgramId",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.ProgramId,"ProgramId",ctx,0);
|
|
||||||
else if(cmpYamlValue("IdealProcessor",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.IdealProcessor,"IdealProcessor",ctx,0);
|
else if(cmpYamlValue("IdealProcessor",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.IdealProcessor,"IdealProcessor",ctx,0);
|
||||||
else if(cmpYamlValue("Priority",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.Priority,"Priority",ctx,0);
|
else if(cmpYamlValue("Priority",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.Priority,"Priority",ctx,0);
|
||||||
else if(cmpYamlValue("MemoryType",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.MemoryType,"MemoryType",ctx,0);
|
else if(cmpYamlValue("MemoryType",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.MemoryType,"MemoryType",ctx,0);
|
||||||
@@ -112,7 +118,6 @@ void GET_AccessControlInfo(ctr_yaml_context *ctx, rsf_settings *rsf)
|
|||||||
else if(cmpYamlValue("ExtSaveDataId",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.ExtSaveDataId,"ExtSaveDataId",ctx,0);
|
else if(cmpYamlValue("ExtSaveDataId",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.ExtSaveDataId,"ExtSaveDataId",ctx,0);
|
||||||
else if(cmpYamlValue("AffinityMask",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.AffinityMask,"AffinityMask",ctx,0);
|
else if(cmpYamlValue("AffinityMask",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.AffinityMask,"AffinityMask",ctx,0);
|
||||||
else if(cmpYamlValue("DescVersion",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.DescVersion,"DescVersion",ctx,0);
|
else if(cmpYamlValue("DescVersion",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.DescVersion,"DescVersion",ctx,0);
|
||||||
//else if(cmpYamlValue("CryptoKey",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.CryptoKey,"CryptoKey",ctx,0);
|
|
||||||
else if(cmpYamlValue("ResourceLimitCategory",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.ResourceLimitCategory,"ResourceLimitCategory",ctx,0);
|
else if(cmpYamlValue("ResourceLimitCategory",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.ResourceLimitCategory,"ResourceLimitCategory",ctx,0);
|
||||||
else if(cmpYamlValue("ReleaseKernelMajor",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.ReleaseKernelMajor,"ReleaseKernelMajor",ctx,0);
|
else if(cmpYamlValue("ReleaseKernelMajor",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.ReleaseKernelMajor,"ReleaseKernelMajor",ctx,0);
|
||||||
else if(cmpYamlValue("ReleaseKernelMinor",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.ReleaseKernelMinor,"ReleaseKernelMinor",ctx,0);
|
else if(cmpYamlValue("ReleaseKernelMinor",ctx)) SetSimpleYAMLValue(&rsf->AccessControlInfo.ReleaseKernelMinor,"ReleaseKernelMinor",ctx,0);
|
||||||
@@ -126,7 +131,6 @@ void GET_AccessControlInfo(ctr_yaml_context *ctx, rsf_settings *rsf)
|
|||||||
else if(cmpYamlValue("InterruptNumbers",ctx)) rsf->AccessControlInfo.InterruptNumbersNum = SetYAMLSequence(&rsf->AccessControlInfo.InterruptNumbers,"InterruptNumbers",ctx);
|
else if(cmpYamlValue("InterruptNumbers",ctx)) rsf->AccessControlInfo.InterruptNumbersNum = SetYAMLSequence(&rsf->AccessControlInfo.InterruptNumbers,"InterruptNumbers",ctx);
|
||||||
else if(cmpYamlValue("SystemCallAccess",ctx)) rsf->AccessControlInfo.SystemCallAccessNum = SetYAMLSequenceFromMapping(&rsf->AccessControlInfo.SystemCallAccess,"SystemCallAccess",ctx,false);
|
else if(cmpYamlValue("SystemCallAccess",ctx)) rsf->AccessControlInfo.SystemCallAccessNum = SetYAMLSequenceFromMapping(&rsf->AccessControlInfo.SystemCallAccess,"SystemCallAccess",ctx,false);
|
||||||
else if(cmpYamlValue("ServiceAccessControl",ctx)) rsf->AccessControlInfo.ServiceAccessControlNum = SetYAMLSequence(&rsf->AccessControlInfo.ServiceAccessControl,"ServiceAccessControl",ctx);
|
else if(cmpYamlValue("ServiceAccessControl",ctx)) rsf->AccessControlInfo.ServiceAccessControlNum = SetYAMLSequence(&rsf->AccessControlInfo.ServiceAccessControl,"ServiceAccessControl",ctx);
|
||||||
//else if(cmpYamlValue("StorageId",ctx)) rsf->AccessControlInfo.StorageIdNum = SetYAMLSequence(&rsf->AccessControlInfo.StorageId,"StorageId",ctx);
|
|
||||||
else if(cmpYamlValue("AccessibleSaveDataIds",ctx)) rsf->AccessControlInfo.AccessibleSaveDataIdsNum = SetYAMLSequence(&rsf->AccessControlInfo.AccessibleSaveDataIds,"AccessibleSaveDataIds",ctx);
|
else if(cmpYamlValue("AccessibleSaveDataIds",ctx)) rsf->AccessControlInfo.AccessibleSaveDataIdsNum = SetYAMLSequence(&rsf->AccessControlInfo.AccessibleSaveDataIds,"AccessibleSaveDataIds",ctx);
|
||||||
|
|
||||||
else{
|
else{
|
||||||
@@ -187,8 +191,6 @@ void GET_BasicInfo(ctr_yaml_context *ctx, rsf_settings *rsf)
|
|||||||
else if(cmpYamlValue("ProductCode",ctx)) SetSimpleYAMLValue(&rsf->BasicInfo.ProductCode,"ProductCode",ctx,0);
|
else if(cmpYamlValue("ProductCode",ctx)) SetSimpleYAMLValue(&rsf->BasicInfo.ProductCode,"ProductCode",ctx,0);
|
||||||
else if(cmpYamlValue("ContentType",ctx)) SetSimpleYAMLValue(&rsf->BasicInfo.ContentType,"ContentType",ctx,0);
|
else if(cmpYamlValue("ContentType",ctx)) SetSimpleYAMLValue(&rsf->BasicInfo.ContentType,"ContentType",ctx,0);
|
||||||
else if(cmpYamlValue("Logo",ctx)) SetSimpleYAMLValue(&rsf->BasicInfo.Logo,"Logo",ctx,0);
|
else if(cmpYamlValue("Logo",ctx)) SetSimpleYAMLValue(&rsf->BasicInfo.Logo,"Logo",ctx,0);
|
||||||
//else if(cmpYamlValue("BackupMemoryType",ctx)) SetSimpleYAMLValue(&rsf->BasicInfo.BackupMemoryType,"BackupMemoryType",ctx,0);
|
|
||||||
//else if(cmpYamlValue("InitialCode",ctx)) SetSimpleYAMLValue(&rsf->BasicInfo.InitialCode,"InitialCode",ctx,0);
|
|
||||||
else{
|
else{
|
||||||
fprintf(stderr,"[RSF ERROR] Unrecognised key '%s'\n",GetYamlString(ctx));
|
fprintf(stderr,"[RSF ERROR] Unrecognised key '%s'\n",GetYamlString(ctx));
|
||||||
ctx->error = YAML_UNKNOWN_KEY;
|
ctx->error = YAML_UNKNOWN_KEY;
|
||||||
@@ -202,7 +204,7 @@ void GET_BasicInfo(ctr_yaml_context *ctx, rsf_settings *rsf)
|
|||||||
FinishEvent(ctx);
|
FinishEvent(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GET_Rom(ctr_yaml_context *ctx, rsf_settings *rsf)
|
void GET_RomFs(ctr_yaml_context *ctx, rsf_settings *rsf)
|
||||||
{
|
{
|
||||||
/* Checking That Group is in a map */
|
/* Checking That Group is in a map */
|
||||||
if(!CheckMappingEvent(ctx)) return;
|
if(!CheckMappingEvent(ctx)) return;
|
||||||
@@ -213,13 +215,12 @@ void GET_Rom(ctr_yaml_context *ctx, rsf_settings *rsf)
|
|||||||
if(ctx->error || ctx->done) return;
|
if(ctx->error || ctx->done) return;
|
||||||
// Handle childs
|
// Handle childs
|
||||||
|
|
||||||
if(cmpYamlValue("HostRoot",ctx)) SetSimpleYAMLValue(&rsf->Rom.HostRoot,"HostRoot",ctx,0);
|
if(cmpYamlValue("RootPath",ctx)) SetSimpleYAMLValue(&rsf->RomFs.RootPath,"RootPath",ctx,0);
|
||||||
//else if(cmpYamlValue("Padding",ctx)) SetSimpleYAMLValue(&rsf->Rom.Padding,"Padding",ctx,0);
|
|
||||||
|
|
||||||
else if(cmpYamlValue("DefaultReject",ctx)) rsf->Rom.DefaultRejectNum = SetYAMLSequence(&rsf->Rom.DefaultReject,"DefaultReject",ctx);
|
else if(cmpYamlValue("DefaultReject",ctx)) rsf->RomFs.DefaultRejectNum = SetYAMLSequence(&rsf->RomFs.DefaultReject,"DefaultReject",ctx);
|
||||||
else if(cmpYamlValue("Reject",ctx)) rsf->Rom.RejectNum = SetYAMLSequence(&rsf->Rom.Reject,"Reject",ctx);
|
else if(cmpYamlValue("Reject",ctx)) rsf->RomFs.RejectNum = SetYAMLSequence(&rsf->RomFs.Reject,"Reject",ctx);
|
||||||
else if(cmpYamlValue("Include",ctx)) rsf->Rom.IncludeNum = SetYAMLSequence(&rsf->Rom.Include,"Include",ctx);
|
else if(cmpYamlValue("Include",ctx)) rsf->RomFs.IncludeNum = SetYAMLSequence(&rsf->RomFs.Include,"Include",ctx);
|
||||||
else if(cmpYamlValue("File",ctx)) rsf->Rom.FileNum = SetYAMLSequence(&rsf->Rom.File,"File",ctx);
|
else if(cmpYamlValue("File",ctx)) rsf->RomFs.FileNum = SetYAMLSequence(&rsf->RomFs.File,"File",ctx);
|
||||||
|
|
||||||
else{
|
else{
|
||||||
fprintf(stderr,"[RSF ERROR] Unrecognised key '%s'\n",GetYamlString(ctx));
|
fprintf(stderr,"[RSF ERROR] Unrecognised key '%s'\n",GetYamlString(ctx));
|
||||||
@@ -279,12 +280,10 @@ void GET_TitleInfo(ctr_yaml_context *ctx, rsf_settings *rsf)
|
|||||||
// Handle childs
|
// Handle childs
|
||||||
|
|
||||||
if(cmpYamlValue("Category",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.Category,"Category",ctx,0);
|
if(cmpYamlValue("Category",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.Category,"Category",ctx,0);
|
||||||
//else if(cmpYamlValue("Platform",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.Platform,"Platform",ctx,0);
|
|
||||||
else if(cmpYamlValue("UniqueId",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.UniqueId,"UniqueId",ctx,0);
|
else if(cmpYamlValue("UniqueId",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.UniqueId,"UniqueId",ctx,0);
|
||||||
else if(cmpYamlValue("Version",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.Version,"Version",ctx,0);
|
else if(cmpYamlValue("Version",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.Version,"Version",ctx,0);
|
||||||
else if(cmpYamlValue("ContentsIndex",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.ContentsIndex,"ContentsIndex",ctx,0);
|
else if(cmpYamlValue("ContentsIndex",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.ContentsIndex,"ContentsIndex",ctx,0);
|
||||||
else if(cmpYamlValue("Variation",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.Variation,"Variation",ctx,0);
|
else if(cmpYamlValue("Variation",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.Variation,"Variation",ctx,0);
|
||||||
//else if(cmpYamlValue("Use",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.Use,"Use",ctx,0);
|
|
||||||
else if(cmpYamlValue("ChildIndex",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.ChildIndex,"ChildIndex",ctx,0);
|
else if(cmpYamlValue("ChildIndex",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.ChildIndex,"ChildIndex",ctx,0);
|
||||||
else if(cmpYamlValue("DemoIndex",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.DemoIndex,"DemoIndex",ctx,0);
|
else if(cmpYamlValue("DemoIndex",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.DemoIndex,"DemoIndex",ctx,0);
|
||||||
else if(cmpYamlValue("TargetCategory",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.TargetCategory,"TargetCategory",ctx,0);
|
else if(cmpYamlValue("TargetCategory",ctx)) SetSimpleYAMLValue(&rsf->TitleInfo.TargetCategory,"TargetCategory",ctx,0);
|
||||||
@@ -377,15 +376,8 @@ void free_RsfSettings(rsf_settings *set)
|
|||||||
{
|
{
|
||||||
//Option
|
//Option
|
||||||
free(set->Option.PageSize);
|
free(set->Option.PageSize);
|
||||||
/*
|
|
||||||
for(u32 i = 0; i < set->Option.AppendSystemCallNum; i++){
|
|
||||||
free(set->Option.AppendSystemCall[i]);
|
|
||||||
}
|
|
||||||
free(set->Option.AppendSystemCall);
|
|
||||||
*/
|
|
||||||
|
|
||||||
//AccessControlInfo
|
//AccessControlInfo
|
||||||
//free(set->AccessControlInfo.ProgramId);
|
|
||||||
free(set->AccessControlInfo.IdealProcessor);
|
free(set->AccessControlInfo.IdealProcessor);
|
||||||
free(set->AccessControlInfo.Priority);
|
free(set->AccessControlInfo.Priority);
|
||||||
free(set->AccessControlInfo.MemoryType);
|
free(set->AccessControlInfo.MemoryType);
|
||||||
@@ -401,7 +393,6 @@ void free_RsfSettings(rsf_settings *set)
|
|||||||
free(set->AccessControlInfo.SystemMode);
|
free(set->AccessControlInfo.SystemMode);
|
||||||
free(set->AccessControlInfo.AffinityMask);
|
free(set->AccessControlInfo.AffinityMask);
|
||||||
free(set->AccessControlInfo.DescVersion);
|
free(set->AccessControlInfo.DescVersion);
|
||||||
//free(set->AccessControlInfo.CryptoKey);
|
|
||||||
free(set->AccessControlInfo.ResourceLimitCategory);
|
free(set->AccessControlInfo.ResourceLimitCategory);
|
||||||
free(set->AccessControlInfo.ReleaseKernelMajor);
|
free(set->AccessControlInfo.ReleaseKernelMajor);
|
||||||
free(set->AccessControlInfo.ReleaseKernelMinor);
|
free(set->AccessControlInfo.ReleaseKernelMinor);
|
||||||
@@ -442,11 +433,6 @@ void free_RsfSettings(rsf_settings *set)
|
|||||||
}
|
}
|
||||||
free(set->AccessControlInfo.ServiceAccessControl);
|
free(set->AccessControlInfo.ServiceAccessControl);
|
||||||
|
|
||||||
for(u32 i = 0; i < set->AccessControlInfo.StorageIdNum; i++){
|
|
||||||
free(set->AccessControlInfo.StorageId[i]);
|
|
||||||
}
|
|
||||||
free(set->AccessControlInfo.StorageId);
|
|
||||||
|
|
||||||
for(u32 i = 0; i < set->AccessControlInfo.AccessibleSaveDataIdsNum; i++){
|
for(u32 i = 0; i < set->AccessControlInfo.AccessibleSaveDataIdsNum; i++){
|
||||||
free(set->AccessControlInfo.AccessibleSaveDataIds[i]);
|
free(set->AccessControlInfo.AccessibleSaveDataIds[i]);
|
||||||
}
|
}
|
||||||
@@ -470,32 +456,29 @@ void free_RsfSettings(rsf_settings *set)
|
|||||||
free(set->BasicInfo.ProductCode);
|
free(set->BasicInfo.ProductCode);
|
||||||
free(set->BasicInfo.ContentType);
|
free(set->BasicInfo.ContentType);
|
||||||
free(set->BasicInfo.Logo);
|
free(set->BasicInfo.Logo);
|
||||||
//free(set->BasicInfo.BackupMemoryType);
|
|
||||||
//free(set->BasicInfo.InitialCode);
|
|
||||||
|
|
||||||
//Rom
|
//Rom
|
||||||
free(set->Rom.HostRoot);
|
free(set->RomFs.RootPath);
|
||||||
//free(set->Rom.Padding);
|
|
||||||
|
|
||||||
for(u32 i = 0; i < set->Rom.DefaultRejectNum; i++){
|
for(u32 i = 0; i < set->RomFs.DefaultRejectNum; i++){
|
||||||
free(set->Rom.DefaultReject[i]);
|
free(set->RomFs.DefaultReject[i]);
|
||||||
}
|
}
|
||||||
free(set->Rom.DefaultReject);
|
free(set->RomFs.DefaultReject);
|
||||||
|
|
||||||
for(u32 i = 0; i < set->Rom.RejectNum; i++){
|
for(u32 i = 0; i < set->RomFs.RejectNum; i++){
|
||||||
free(set->Rom.Reject[i]);
|
free(set->RomFs.Reject[i]);
|
||||||
}
|
}
|
||||||
free(set->Rom.Reject);
|
free(set->RomFs.Reject);
|
||||||
|
|
||||||
for(u32 i = 0; i < set->Rom.IncludeNum; i++){
|
for(u32 i = 0; i < set->RomFs.IncludeNum; i++){
|
||||||
free(set->Rom.Include[i]);
|
free(set->RomFs.Include[i]);
|
||||||
}
|
}
|
||||||
free(set->Rom.Include);
|
free(set->RomFs.Include);
|
||||||
|
|
||||||
for(u32 i = 0; i < set->Rom.FileNum; i++){
|
for(u32 i = 0; i < set->RomFs.FileNum; i++){
|
||||||
free(set->Rom.File[i]);
|
free(set->RomFs.File[i]);
|
||||||
}
|
}
|
||||||
free(set->Rom.File);
|
free(set->RomFs.File);
|
||||||
|
|
||||||
//ExeFs
|
//ExeFs
|
||||||
for(u32 i = 0; i < set->ExeFs.TextNum; i++){
|
for(u32 i = 0; i < set->ExeFs.TextNum; i++){
|
||||||
@@ -520,13 +503,11 @@ void free_RsfSettings(rsf_settings *set)
|
|||||||
free(set->PlainRegion);
|
free(set->PlainRegion);
|
||||||
|
|
||||||
//TitleInfo
|
//TitleInfo
|
||||||
//free(set->TitleInfo.Platform);
|
|
||||||
free(set->TitleInfo.Category);
|
free(set->TitleInfo.Category);
|
||||||
free(set->TitleInfo.UniqueId);
|
free(set->TitleInfo.UniqueId);
|
||||||
free(set->TitleInfo.Version);
|
free(set->TitleInfo.Version);
|
||||||
free(set->TitleInfo.ContentsIndex);
|
free(set->TitleInfo.ContentsIndex);
|
||||||
free(set->TitleInfo.Variation);
|
free(set->TitleInfo.Variation);
|
||||||
//free(set->TitleInfo.Use);
|
|
||||||
free(set->TitleInfo.ChildIndex);
|
free(set->TitleInfo.ChildIndex);
|
||||||
free(set->TitleInfo.DemoIndex);
|
free(set->TitleInfo.DemoIndex);
|
||||||
free(set->TitleInfo.TargetCategory);
|
free(set->TitleInfo.TargetCategory);
|
||||||
|
|||||||
@@ -1,16 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
void EvaluateRSF(rsf_settings *rsf, ctr_yaml_context *ctx);
|
void EvaluateRSF(rsf_settings *rsf, ctr_yaml_context *ctx);
|
||||||
|
|
||||||
void GET_Option(ctr_yaml_context *ctx, rsf_settings *rsf);
|
|
||||||
void GET_AccessControlInfo(ctr_yaml_context *ctx, rsf_settings *rsf);
|
|
||||||
void GET_SystemControlInfo(ctr_yaml_context *ctx, rsf_settings *rsf);
|
|
||||||
void GET_BasicInfo(ctr_yaml_context *ctx, rsf_settings *rsf);
|
|
||||||
void GET_Rom(ctr_yaml_context *ctx, rsf_settings *rsf);
|
|
||||||
void GET_ExeFs(ctr_yaml_context *ctx, rsf_settings *rsf);
|
|
||||||
void GET_PlainRegion(ctr_yaml_context *ctx, rsf_settings *rsf);
|
|
||||||
void GET_TitleInfo(ctr_yaml_context *ctx, rsf_settings *rsf);
|
|
||||||
void GET_CardInfo(ctr_yaml_context *ctx, rsf_settings *rsf);
|
|
||||||
void GET_CommonHeaderKey(ctr_yaml_context *ctx, rsf_settings *rsf);
|
|
||||||
|
|
||||||
void free_RsfSettings(rsf_settings *set);
|
void free_RsfSettings(rsf_settings *set);
|
||||||
@@ -181,8 +181,8 @@ int SetArgument(int argc, int i, char *argv[], user_settings *set)
|
|||||||
set->common.keys.keyset = pki_DEVELOPMENT;
|
set->common.keys.keyset = pki_DEVELOPMENT;
|
||||||
else if(strcasecmp(argv[i+1],"retail") == 0 || strcasecmp(argv[i+1],"production") == 0 || strcasecmp(argv[i+1],"p") == 0)
|
else if(strcasecmp(argv[i+1],"retail") == 0 || strcasecmp(argv[i+1],"production") == 0 || strcasecmp(argv[i+1],"p") == 0)
|
||||||
set->common.keys.keyset = pki_PRODUCTION;
|
set->common.keys.keyset = pki_PRODUCTION;
|
||||||
//else if(strcasecmp(argv[i+1],"custom") == 0 || strcasecmp(argv[i+1],"c") == 0) // given all known keys are here, this isn't needed
|
else if(strcasecmp(argv[i+1],"gw") == 0 || strcasecmp(argv[i+1],"gateway3ds") == 0 || strcasecmp(argv[i+1],"g") == 0)
|
||||||
// set->common.keys.keyset = pki_CUSTOM;
|
set->common.keys.keyset = pki_GATEWAY3DS;
|
||||||
else{
|
else{
|
||||||
fprintf(stderr,"[SETTING ERROR] Unrecognised target '%s'\n",argv[i+1]);
|
fprintf(stderr,"[SETTING ERROR] Unrecognised target '%s'\n",argv[i+1]);
|
||||||
return USR_BAD_ARG;
|
return USR_BAD_ARG;
|
||||||
@@ -866,10 +866,11 @@ void DisplayHelp(char *app_name)
|
|||||||
printf(" -v Verbose output\n");
|
printf(" -v Verbose output\n");
|
||||||
printf(" -DNAME=VALUE Substitute values in RSF file\n");
|
printf(" -DNAME=VALUE Substitute values in RSF file\n");
|
||||||
printf("KEY OPTIONS:\n");
|
printf("KEY OPTIONS:\n");
|
||||||
printf(" -target <t|d|p> Target for crypto, defaults to 't'\n");
|
printf(" -target <t|d|p|g> Target for crypto, defaults to 't'\n");
|
||||||
printf(" 't' Test(false) Keys & prod Certs\n");
|
printf(" 't' Test(false) Keys & prod Certs\n");
|
||||||
printf(" 'd' Development Keys & Certs\n");
|
printf(" 'd' Development Keys & Certs\n");
|
||||||
printf(" 'p' Production Keys & Certs\n");
|
printf(" 'p' Production Keys & Certs\n");
|
||||||
|
printf(" 'g' Production Keys & Certs for GW3DS only\n");
|
||||||
printf(" -ckeyid <index> Override the automatic common key selection\n");
|
printf(" -ckeyid <index> Override the automatic common key selection\n");
|
||||||
printf(" -ncchseckey <index> Ncch keyX index ('0'=1.0+, '1'=7.0+)\n");
|
printf(" -ncchseckey <index> Ncch keyX index ('0'=1.0+, '1'=7.0+)\n");
|
||||||
printf(" -showkeys Display the loaded key chain\n");
|
printf(" -showkeys Display the loaded key chain\n");
|
||||||
|
|||||||
+2
-19
@@ -62,10 +62,8 @@ static const char output_extention[5][5] = {".cxi",".cfa",".cci",".cia",".app"};
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
struct{
|
struct{
|
||||||
// Booleans
|
|
||||||
// Booleans
|
// Booleans
|
||||||
bool MediaFootPadding;
|
bool MediaFootPadding;
|
||||||
//bool NoPadding; // DELETE
|
|
||||||
bool AllowUnalignedSection;
|
bool AllowUnalignedSection;
|
||||||
bool EnableCrypt;
|
bool EnableCrypt;
|
||||||
bool EnableCompress;
|
bool EnableCompress;
|
||||||
@@ -74,10 +72,6 @@ typedef struct
|
|||||||
|
|
||||||
// Strings
|
// Strings
|
||||||
char *PageSize;
|
char *PageSize;
|
||||||
|
|
||||||
// String Collections
|
|
||||||
//u32 AppendSystemCallNum; // DELETE
|
|
||||||
//char **AppendSystemCall; // DELETE
|
|
||||||
} Option;
|
} Option;
|
||||||
|
|
||||||
struct{
|
struct{
|
||||||
@@ -90,13 +84,10 @@ typedef struct
|
|||||||
bool PermitMainFunctionArgument;
|
bool PermitMainFunctionArgument;
|
||||||
bool CanShareDeviceMemory;
|
bool CanShareDeviceMemory;
|
||||||
bool UseOtherVariationSaveData;
|
bool UseOtherVariationSaveData;
|
||||||
bool UseExtSaveData;
|
|
||||||
bool UseExtendedSaveDataAccessControl;
|
|
||||||
bool RunnableOnSleep;
|
bool RunnableOnSleep;
|
||||||
bool SpecialMemoryArrange;
|
bool SpecialMemoryArrange;
|
||||||
|
|
||||||
// Strings
|
// Strings
|
||||||
//char *ProgramId; // DELETE
|
|
||||||
char *IdealProcessor;
|
char *IdealProcessor;
|
||||||
char *Priority;
|
char *Priority;
|
||||||
char *MemoryType;
|
char *MemoryType;
|
||||||
@@ -112,7 +103,6 @@ typedef struct
|
|||||||
char *AffinityMask;
|
char *AffinityMask;
|
||||||
// Strings From DESC
|
// Strings From DESC
|
||||||
char *DescVersion;
|
char *DescVersion;
|
||||||
//char *CryptoKey; // DELETE
|
|
||||||
char *ResourceLimitCategory;
|
char *ResourceLimitCategory;
|
||||||
char *ReleaseKernelMajor;
|
char *ReleaseKernelMajor;
|
||||||
char *ReleaseKernelMinor;
|
char *ReleaseKernelMinor;
|
||||||
@@ -133,8 +123,6 @@ typedef struct
|
|||||||
char **SystemCallAccess;
|
char **SystemCallAccess;
|
||||||
u32 ServiceAccessControlNum;
|
u32 ServiceAccessControlNum;
|
||||||
char **ServiceAccessControl;
|
char **ServiceAccessControl;
|
||||||
u32 StorageIdNum; // DELETE
|
|
||||||
char **StorageId; // DELETE
|
|
||||||
u32 AccessibleSaveDataIdsNum;
|
u32 AccessibleSaveDataIdsNum;
|
||||||
char **AccessibleSaveDataIds;
|
char **AccessibleSaveDataIds;
|
||||||
} AccessControlInfo;
|
} AccessControlInfo;
|
||||||
@@ -159,14 +147,11 @@ typedef struct
|
|||||||
char *ProductCode;
|
char *ProductCode;
|
||||||
char *ContentType;
|
char *ContentType;
|
||||||
char *Logo;
|
char *Logo;
|
||||||
//char *BackupMemoryType;// Delete
|
|
||||||
//char *InitialCode;// Delete
|
|
||||||
} BasicInfo;
|
} BasicInfo;
|
||||||
|
|
||||||
struct{
|
struct{
|
||||||
// Strings
|
// Strings
|
||||||
char *HostRoot;
|
char *RootPath;
|
||||||
//char *Padding; // DELETE
|
|
||||||
|
|
||||||
// String Collections
|
// String Collections
|
||||||
u32 DefaultRejectNum;
|
u32 DefaultRejectNum;
|
||||||
@@ -177,7 +162,7 @@ typedef struct
|
|||||||
char **Include;
|
char **Include;
|
||||||
u32 FileNum;
|
u32 FileNum;
|
||||||
char **File;
|
char **File;
|
||||||
} Rom;
|
} RomFs;
|
||||||
|
|
||||||
struct{
|
struct{
|
||||||
u32 TextNum;
|
u32 TextNum;
|
||||||
@@ -193,13 +178,11 @@ typedef struct
|
|||||||
|
|
||||||
struct{
|
struct{
|
||||||
// Strings
|
// Strings
|
||||||
//char *Platform; // DELETE
|
|
||||||
char *Category;
|
char *Category;
|
||||||
char *UniqueId;
|
char *UniqueId;
|
||||||
char *Version;
|
char *Version;
|
||||||
char *ContentsIndex;
|
char *ContentsIndex;
|
||||||
char *Variation;
|
char *Variation;
|
||||||
//char *Use; // DELETE
|
|
||||||
char *ChildIndex;
|
char *ChildIndex;
|
||||||
char *DemoIndex;
|
char *DemoIndex;
|
||||||
char *TargetCategory;
|
char *TargetCategory;
|
||||||
|
|||||||
Reference in New Issue
Block a user