[nstool] Add descriptive names to NCA mount points.

This commit is contained in:
jakcron 2018-05-15 23:00:07 +08:00
parent 4d537956f0
commit 7c123ca97b

View file

@ -62,6 +62,23 @@ std::string kKaekIndexStr[]
"System" "System"
}; };
std::string kContentTypeForMountStr[]
{
"program",
"meta",
"control",
"manual",
"data",
"publicdata"
};
std::string kProgramPartitionNameStr[]
{
"code",
"data",
"logo"
};
void NcaProcess::generateNcaBodyEncryptionKeys() void NcaProcess::generateNcaBodyEncryptionKeys()
{ {
// create zeros key // create zeros key
@ -431,6 +448,15 @@ void NcaProcess::processPartitions()
pfs.setInputFile(partition.reader, partition.offset + partition.data_offset, partition.data_size); pfs.setInputFile(partition.reader, partition.offset + partition.data_offset, partition.data_size);
pfs.setCliOutputMode(mCliOutputType); pfs.setCliOutputMode(mCliOutputType);
pfs.setListFs(mListFs); pfs.setListFs(mListFs);
if (mHdr.getContentType() == nx::nca::TYPE_PROGRAM)
{
pfs.setMountPointName(kContentTypeForMountStr[mHdr.getContentType()] + ":/" + kProgramPartitionNameStr[i]);
}
else
{
pfs.setMountPointName(kContentTypeForMountStr[mHdr.getContentType()] + ":/");
}
if (mPartitionPath[index].doExtract) if (mPartitionPath[index].doExtract)
pfs.setExtractPath(mPartitionPath[index].path); pfs.setExtractPath(mPartitionPath[index].path);
//printf("pfs.process(%lx)\n",partition.data_offset); //printf("pfs.process(%lx)\n",partition.data_offset);
@ -443,6 +469,15 @@ void NcaProcess::processPartitions()
romfs.setInputFile(partition.reader, partition.offset + partition.data_offset, partition.data_size); romfs.setInputFile(partition.reader, partition.offset + partition.data_offset, partition.data_size);
romfs.setCliOutputMode(mCliOutputType); romfs.setCliOutputMode(mCliOutputType);
romfs.setListFs(mListFs); romfs.setListFs(mListFs);
if (mHdr.getContentType() == nx::nca::TYPE_PROGRAM)
{
romfs.setMountPointName(kContentTypeForMountStr[mHdr.getContentType()] + ":/" + kProgramPartitionNameStr[i]);
}
else
{
romfs.setMountPointName(kContentTypeForMountStr[mHdr.getContentType()] + ":/");
}
if (mPartitionPath[index].doExtract) if (mPartitionPath[index].doExtract)
romfs.setExtractPath(mPartitionPath[index].path); romfs.setExtractPath(mPartitionPath[index].path);
//printf("romfs.process(%lx)\n", partition.data_offset); //printf("romfs.process(%lx)\n", partition.data_offset);