mirror of
https://github.com/jakcron/nstool
synced 2024-11-15 02:06:40 +00:00
Improve automatic detection of .cnmt files.
This commit is contained in:
parent
33a6f391e9
commit
4f41774002
1 changed files with 34 additions and 24 deletions
|
@ -758,6 +758,9 @@ bool UserSettings::determineValidCnmtFromSample(const fnd::Vec<byte_t>& sample)
|
||||||
if (sample.size() < minimum_size)
|
if (sample.size() < minimum_size)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// include exthdr/data check if applicable
|
||||||
|
if (data->exhdr_size.get() > 0)
|
||||||
|
{
|
||||||
if (data->type == (byte_t)nn::hac::cnmt::ContentMetaType::Application)
|
if (data->type == (byte_t)nn::hac::cnmt::ContentMetaType::Application)
|
||||||
{
|
{
|
||||||
const nn::hac::sApplicationMetaExtendedHeader* meta = (const nn::hac::sApplicationMetaExtendedHeader*)(sample.data() + sizeof(nn::hac::sContentMetaHeader));
|
const nn::hac::sApplicationMetaExtendedHeader* meta = (const nn::hac::sApplicationMetaExtendedHeader*)(sample.data() + sizeof(nn::hac::sContentMetaHeader));
|
||||||
|
@ -786,6 +789,13 @@ bool UserSettings::determineValidCnmtFromSample(const fnd::Vec<byte_t>& sample)
|
||||||
|
|
||||||
minimum_size += meta->extended_data_size.get();
|
minimum_size += meta->extended_data_size.get();
|
||||||
}
|
}
|
||||||
|
else if (data->type == (byte_t)nn::hac::cnmt::ContentMetaType::SystemUpdate)
|
||||||
|
{
|
||||||
|
const nn::hac::sSystemUpdateMetaExtendedHeader* meta = (const nn::hac::sSystemUpdateMetaExtendedHeader*)(sample.data() + sizeof(nn::hac::sContentMetaHeader));
|
||||||
|
|
||||||
|
minimum_size += meta->extended_data_size.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (sample.size() != minimum_size)
|
if (sample.size() != minimum_size)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue