From baefff323cd2ad4ab654ccb8ea421e3d6a5e0034 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Sat, 12 Aug 2023 21:21:44 +0300 Subject: [PATCH 1/2] Make some NIF loading messages less confusing --- components/nif/niffile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/nif/niffile.cpp b/components/nif/niffile.cpp index 2bdb1f7dab..1757488e3d 100644 --- a/components/nif/niffile.cpp +++ b/components/nif/niffile.cpp @@ -354,14 +354,14 @@ namespace Nif if (rec.empty()) { std::stringstream error; - error << "Record number " << i << " out of " << recNum << " is blank."; + error << "Record type is blank (index " << i << ")"; throw Nif::Exception(error.str(), filename); } // Record separator. Some Havok records in Oblivion do not have it. if (hasRecordSeparators && !rec.starts_with("bhk")) if (nif.getInt()) - Log(Debug::Warning) << "NIFFile Warning: Record number " << i << " out of " << recNum + Log(Debug::Warning) << "NIFFile Warning: Record of type " << rec << ", index " << i << " is preceded by a non-zero separator. File: " << filename; const auto entry = factories.find(rec); From ee7accf3bd2a10ccf39e9282afe967fa7709d61f Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Sat, 12 Aug 2023 21:32:16 +0300 Subject: [PATCH 2/2] Don't read affected nodes for 10.0.1.0 NiDynamicEffect --- components/nif/effect.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/components/nif/effect.cpp b/components/nif/effect.cpp index fdd96deeb7..3b90d50564 100644 --- a/components/nif/effect.cpp +++ b/components/nif/effect.cpp @@ -12,9 +12,13 @@ namespace Nif if (nif->getVersion() >= nif->generateVersion(10, 1, 0, 106) && nif->getBethVersion() < NIFFile::BethVersion::BETHVER_FO4) nif->getBoolean(); // Switch state - unsigned int numAffectedNodes = nif->getUInt(); - for (unsigned int i = 0; i < numAffectedNodes; ++i) - nif->getUInt(); // ref to another Node + if (nif->getVersion() <= NIFFile::VER_MW + || (nif->getVersion() >= nif->generateVersion(10, 1, 0, 0) + && nif->getBethVersion() < NIFFile::BethVersion::BETHVER_FO4)) + { + size_t numAffectedNodes = nif->get(); + nif->skip(numAffectedNodes * 4); + } } void NiLight::read(NIFStream* nif)