makerom: build 0.13

in rsf: "Rom" renamed to "RomFs" and "HostRoot" renamed to "RootPath".
Cci rsf settings "MediaSize"/"CardDevice" are automatically decided if
not specified manually. Also some bug fixes.
This commit is contained in:
applestash
2014-09-20 22:55:48 +10:00
parent ded7f036bb
commit 1723d4fc8f
12 changed files with 229 additions and 200 deletions
+1 -1
View File
@@ -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
View File
@@ -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;
} }
} }
+1 -1
View File
@@ -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
+25
View File
@@ -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;
} }
+1
View File
@@ -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
View File
@@ -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;
+114 -111
View File
@@ -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)){
@@ -247,9 +192,7 @@ int ProcessCiaForCci(cci_settings *set)
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 +228,37 @@ 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");
// Adjusting save size
if(set->romInfo.saveSize <= (u64)128*KB)
set->romInfo.saveSize = (u64)128*KB;
else if(set->romInfo.saveSize <= (u64)512*KB)
set->romInfo.saveSize = (u64)512*KB;
else
set->romInfo.saveSize = align(set->romInfo.saveSize,MB);
}
int ImportCciNcch(cci_settings *set)
{
int ret = 0;
if(set->content.dataType == infile_ncch) if(set->content.dataType == infile_ncch)
return ImportNcchForCci(set); ret = ImportNcchForCci(set);
else if(set->content.dataType == infile_cia) else if(set->content.dataType == infile_cia)
return ProcessCiaForCci(set); ret = ProcessCiaForCci(set);
else else{
fprintf(stderr,"[CCI ERROR] Unrecognised input data type\n"); fprintf(stderr,"[CCI ERROR] Unrecognised input data type\n");
return FAILED_TO_IMPORT_FILE;
}
return FAILED_TO_IMPORT_FILE; GetTitleSaveSize(set);
return ret;
} }
int ProcessCverDataForCci(cci_settings *set) int ProcessCverDataForCci(cci_settings *set)
@@ -399,12 +360,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 +402,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 +454,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 +464,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 +500,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 +512,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 +560,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 +577,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,20 +590,31 @@ int GenCciHdr(cci_settings *set)
return 0; return 0;
} }
int CheckRomConfig(cci_settings *set) 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)
{
u64 cciUsedSize; u64 cciUsedSize;
if(set->romInfo.mediaType == mediatype_CARD2) if(set->romInfo.mediaType == mediatype_CARD2)
cciUsedSize = set->romInfo.card2SaveOffset + set->romInfo.saveSize; cciUsedSize = set->romInfo.card2SaveOffset + set->romInfo.saveSize;
else else
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;
+8 -12
View File
@@ -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);
@@ -18,7 +19,7 @@ int PopulateRomfs(romfs_buildctx *ctx);
void BuildRomfsHeader(romfs_buildctx *ctx); void BuildRomfsHeader(romfs_buildctx *ctx);
void BuildIvfcHeader(romfs_buildctx *ctx); void BuildIvfcHeader(romfs_buildctx *ctx);
void GenIvfcHashTree(romfs_buildctx *ctx); void GenIvfcHashTree(romfs_buildctx *ctx);
u32 CalcPathHash(u32 parent,wchar_t * path,u32 start,u32 length); u32 CalcPathHash(u32 parent, fs_romfs_char* path, u32 start, u32 length);
int PrepareBuildRomFsBinary(ncch_settings *ncchset, romfs_buildctx *ctx) int PrepareBuildRomFsBinary(ncch_settings *ncchset, romfs_buildctx *ctx)
@@ -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;
@@ -399,18 +400,15 @@ int AddDirToRomfs(romfs_buildctx *ctx, fs_dir *fs, u32 parent, u32 sibling)
romfs_direntry *entry = (romfs_direntry*)(ctx->dirTable + ctx->u_dirTableLen); romfs_direntry *entry = (romfs_direntry*)(ctx->dirTable + ctx->u_dirTableLen);
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 uTableIndex = GetDirUTableIndex(ctx,fs);
u32_to_u8(entry->weirdoffset,0xffffffff,LE); 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 +462,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);
} }
} }
@@ -515,15 +513,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 -41
View File
@@ -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;}
@@ -202,7 +213,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 +224,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 +289,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 +385,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 +402,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);
@@ -441,11 +441,6 @@ void free_RsfSettings(rsf_settings *set)
free(set->AccessControlInfo.ServiceAccessControl[i]); free(set->AccessControlInfo.ServiceAccessControl[i]);
} }
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 +465,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 +512,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);
-12
View File
@@ -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);
+4 -3
View File
@@ -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 -17
View File
@@ -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{
@@ -96,7 +90,6 @@ typedef struct
bool SpecialMemoryArrange; bool SpecialMemoryArrange;
// Strings // Strings
//char *ProgramId; // DELETE
char *IdealProcessor; char *IdealProcessor;
char *Priority; char *Priority;
char *MemoryType; char *MemoryType;
@@ -112,7 +105,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 +125,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 +149,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 +164,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 +180,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;