mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-01 20:19:39 +00:00
Fix NIF printVersion and allow 4.0.0.0 file loading
This commit is contained in:
parent
7158f09b87
commit
b08fed6d83
1 changed files with 8 additions and 12 deletions
|
@ -119,19 +119,13 @@ static const std::map<std::string,RecordFactoryEntry> factories = makeFactory();
|
||||||
|
|
||||||
std::string NIFFile::printVersion(unsigned int version)
|
std::string NIFFile::printVersion(unsigned int version)
|
||||||
{
|
{
|
||||||
union ver_quad
|
int major = (version >> 24) & 0xFF;
|
||||||
{
|
int minor = (version >> 16) & 0xFF;
|
||||||
uint32_t full;
|
int patch = (version >> 8) & 0xFF;
|
||||||
uint8_t quad[4];
|
int rev = version & 0xFF;
|
||||||
} version_out;
|
|
||||||
|
|
||||||
version_out.full = version;
|
|
||||||
|
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
stream << version_out.quad[3] << "."
|
stream << major << "." << minor << "." << patch << "." << rev;
|
||||||
<< version_out.quad[2] << "."
|
|
||||||
<< version_out.quad[1] << "."
|
|
||||||
<< version_out.quad[0];
|
|
||||||
return stream.str();
|
return stream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +140,9 @@ void NIFFile::parse(Files::IStreamPtr stream)
|
||||||
|
|
||||||
// Get BCD version
|
// Get BCD version
|
||||||
ver = nif.getUInt();
|
ver = nif.getUInt();
|
||||||
if(ver != VER_MW)
|
// 4.0.0.0 is an older, practically identical version of the format.
|
||||||
|
// It's not used by Morrowind assets but Morrowind supports it.
|
||||||
|
if(ver != 0x04000000 && ver != VER_MW)
|
||||||
fail("Unsupported NIF version: " + printVersion(ver));
|
fail("Unsupported NIF version: " + printVersion(ver));
|
||||||
// Number of records
|
// Number of records
|
||||||
size_t recNum = nif.getInt();
|
size_t recNum = nif.getInt();
|
||||||
|
|
Loading…
Reference in a new issue