[makerom] Relaxed RSF requirements.

This commit is contained in:
jakcron
2015-10-09 21:35:54 +08:00
parent d5f0d2c096
commit aa694f20f9
3 changed files with 17 additions and 19 deletions
+5 -11
View File
@@ -4,6 +4,7 @@
#include "accessdesc.h"
#include "titleid.h"
const char *DEFAULT_EXHEADER_NAME = "CtrApp";
/* Prototypes */
void free_ExHeaderSettings(exheader_settings *exhdrset);
@@ -189,17 +190,10 @@ finish:
int get_ExHeaderCodeSetInfo(exhdr_CodeSetInfo *CodeSetInfo, rsf_settings *rsf)
{
/* Name */
if(rsf->BasicInfo.Title){
//if(strlen(rsf->BasicInfo.Title) > 8){
// fprintf(stderr,"[EXHEADER ERROR] Parameter Too Long \"BasicInfo/Title\"\n");
// return EXHDR_BAD_RSF_OPT;
//}
strncpy((char*)CodeSetInfo->name,rsf->BasicInfo.Title,8);
}
else{
ErrorParamNotFound("BasicInfo/Title");
return EXHDR_BAD_RSF_OPT;
}
if (rsf->BasicInfo.Title)
strncpy((char*)CodeSetInfo->name, rsf->BasicInfo.Title, 8);
else
strncpy((char*)CodeSetInfo->name, DEFAULT_EXHEADER_NAME, 8);
/* Stack Size */
if(rsf->SystemControlInfo.StackSize)
+8 -4
View File
@@ -12,6 +12,8 @@
#include "ncch_logo.h" // Contains Logos
const u32 NCCH_BLOCK_SIZE = 0x200;
const char *DEFAULT_PRODUCT_CODE = "CTR-P-CTAP";
const char *DEFAULT_MAKER_CODE = "00";
// Private Prototypes
int SignCFA(ncch_hdr *hdr, keys_struct *keys);
@@ -591,18 +593,20 @@ int SetCommonHeaderBasicData(ncch_settings *set, ncch_hdr *hdr)
fprintf(stderr,"[NCCH ERROR] Invalid Product Code\n");
return NCCH_BAD_RSF_SET;
}
memcpy(hdr->productCode,set->rsfSet->BasicInfo.ProductCode,strlen((char*)set->rsfSet->BasicInfo.ProductCode));
strncpy((char*)hdr->productCode,set->rsfSet->BasicInfo.ProductCode, 16);
}
else memcpy(hdr->productCode,"CTR-P-CTAP",10);
else
strncpy((char*)hdr->productCode, DEFAULT_PRODUCT_CODE, 16);
if(set->rsfSet->BasicInfo.CompanyCode){
if(strlen((char*)set->rsfSet->BasicInfo.CompanyCode) != 2){
fprintf(stderr,"[NCCH ERROR] CompanyCode length must be 2\n");
return NCCH_BAD_RSF_SET;
}
memcpy(hdr->makerCode,set->rsfSet->BasicInfo.CompanyCode,2);
strncpy((char*)hdr->makerCode, set->rsfSet->BasicInfo.CompanyCode, 2);
}
else memcpy(hdr->makerCode,"00",2);
else
strncpy((char*)hdr->makerCode, DEFAULT_MAKER_CODE, 2);
// Setting Encryption Settings
if(!set->options.Encrypt)
+4 -4
View File
@@ -2,6 +2,8 @@
#include "ncch_read.h"
#include "titleid.h"
const u32 DEFAULT_UNIQUE_ID = 0xff3ff;
void SetPIDType(u16 *type);
int SetPIDCategoryFromName(u16 *cat, char *CategoryStr);
int SetPIDCategoryFromFlags(u16 *cat, char **CategoryFlags, u32 FlagNum);
@@ -52,10 +54,8 @@ int GetProgramID(u64 *dest, rsf_settings *rsf, bool IsForExheader)
// Getting UniqueId
if(rsf->TitleInfo.UniqueId)
GetUniqueID(&uniqueId,rsf);
else{
fprintf(stderr,"[ID ERROR] ParameterNotFound: \"TitleInfo/UniqueId\"\n");
return PID_BAD_RSF_SET;
}
else
uniqueId = DEFAULT_UNIQUE_ID;
// Getting Variation
if(SetTitleVariation(&variation,category,rsf) == PID_INVALID_VARIATION)