mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-01 22:36:39 +00:00
ESM4: add a way to get the current form version
Differentiate between Fallout 4 and TES4 version 1.0 plugins
This commit is contained in:
parent
a722518b4b
commit
8c27dca1df
7 changed files with 11 additions and 17 deletions
|
@ -25,12 +25,13 @@ namespace ESM
|
||||||
VER_120 = 0x3f99999a, // TES3
|
VER_120 = 0x3f99999a, // TES3
|
||||||
VER_130 = 0x3fa66666, // TES3
|
VER_130 = 0x3fa66666, // TES3
|
||||||
VER_080 = 0x3f4ccccd, // TES4
|
VER_080 = 0x3f4ccccd, // TES4
|
||||||
VER_100 = 0x3f800000, // TES4
|
VER_100 = 0x3f800000, // TES4, FO4
|
||||||
VER_132 = 0x3fa8f5c3, // FONV Courier's Stash, DeadMoney
|
VER_132 = 0x3fa8f5c3, // FONV Courier's Stash, DeadMoney
|
||||||
VER_133 = 0x3faa3d71, // FONV HonestHearts
|
VER_133 = 0x3faa3d71, // FONV HonestHearts
|
||||||
VER_134 = 0x3fab851f, // FONV, GunRunnersArsenal, LonesomeRoad, OldWorldBlues
|
VER_134 = 0x3fab851f, // FONV, GunRunnersArsenal, LonesomeRoad, OldWorldBlues
|
||||||
VER_094 = 0x3f70a3d7, // TES5/FO3
|
VER_094 = 0x3f70a3d7, // TES5/FO3
|
||||||
VER_170 = 0x3fd9999a // TES5
|
VER_170 = 0x3fd9999a, // TES5
|
||||||
|
VER_095 = 0x3f733333, // FO4
|
||||||
};
|
};
|
||||||
|
|
||||||
// Defines another files (esm or esp) that this file depends upon.
|
// Defines another files (esm or esp) that this file depends upon.
|
||||||
|
|
|
@ -249,9 +249,8 @@ void ESM4::Navigation::load(ESM4::Reader& reader)
|
||||||
}
|
}
|
||||||
case ESM4::SUB_NVPP:
|
case ESM4::SUB_NVPP:
|
||||||
{
|
{
|
||||||
// FIXME: this is both the version for FO4 and for some TES4 files
|
// FIXME: FO4 updates the format
|
||||||
// How to distinguish?
|
if (reader.hasFormVersion() && (esmVer == ESM::VER_095 || esmVer == ESM::VER_100))
|
||||||
if (esmVer == ESM::VER_100)
|
|
||||||
{
|
{
|
||||||
reader.skipSubRecordData();
|
reader.skipSubRecordData();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -213,7 +213,7 @@ void ESM4::NavMesh::load(ESM4::Reader& reader)
|
||||||
{
|
{
|
||||||
// See FIXME in ESM4::Navigation::load.
|
// See FIXME in ESM4::Navigation::load.
|
||||||
// FO4 updates the format
|
// FO4 updates the format
|
||||||
if (esmVer == ESM::VER_100)
|
if (reader.hasFormVersion() && (esmVer == ESM::VER_095 || esmVer == ESM::VER_100))
|
||||||
{
|
{
|
||||||
reader.skipSubRecordData();
|
reader.skipSubRecordData();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -39,7 +39,7 @@ void ESM4::Npc::load(ESM4::Reader& reader)
|
||||||
mFlags = reader.hdr().record.flags;
|
mFlags = reader.hdr().record.flags;
|
||||||
|
|
||||||
std::uint32_t esmVer = reader.esmVersion();
|
std::uint32_t esmVer = reader.esmVersion();
|
||||||
mIsTES4 = esmVer == ESM::VER_080 || esmVer == ESM::VER_100;
|
mIsTES4 = (esmVer == ESM::VER_080 || esmVer == ESM::VER_100) && !reader.hasFormVersion();
|
||||||
mIsFONV = esmVer == ESM::VER_132 || esmVer == ESM::VER_133 || esmVer == ESM::VER_134;
|
mIsFONV = esmVer == ESM::VER_132 || esmVer == ESM::VER_133 || esmVer == ESM::VER_134;
|
||||||
// mIsTES5 = esmVer == ESM::VER_094 || esmVer == ESM::VER_170; // WARN: FO3 is also VER_094
|
// mIsTES5 = esmVer == ESM::VER_094 || esmVer == ESM::VER_170; // WARN: FO3 is also VER_094
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
|
||||||
mFlags = reader.hdr().record.flags;
|
mFlags = reader.hdr().record.flags;
|
||||||
|
|
||||||
std::uint32_t esmVer = reader.esmVersion();
|
std::uint32_t esmVer = reader.esmVersion();
|
||||||
bool isTES4 = esmVer == ESM::VER_080 || esmVer == ESM::VER_100;
|
bool isTES4 = (esmVer == ESM::VER_080 || esmVer == ESM::VER_100) && !reader.hasFormVersion();
|
||||||
bool isFONV = esmVer == ESM::VER_132 || esmVer == ESM::VER_133 || esmVer == ESM::VER_134;
|
bool isFONV = esmVer == ESM::VER_132 || esmVer == ESM::VER_133 || esmVer == ESM::VER_134;
|
||||||
bool isFO3 = false;
|
bool isFO3 = false;
|
||||||
|
|
||||||
|
|
|
@ -201,15 +201,6 @@ namespace ESM4
|
||||||
|
|
||||||
// restart from the beginning (i.e. "TES4" record header)
|
// restart from the beginning (i.e. "TES4" record header)
|
||||||
mStream->seekg(0, mStream->beg);
|
mStream->seekg(0, mStream->beg);
|
||||||
#if 0
|
|
||||||
unsigned int esmVer = mHeader.mData.version.ui;
|
|
||||||
bool isTes4 = esmVer == ESM::VER_080 || esmVer == ESM::VER_100;
|
|
||||||
//bool isTes5 = esmVer == ESM::VER_094 || esmVer == ESM::VER_170;
|
|
||||||
//bool isFONV = esmVer == ESM::VER_132 || esmVer == ESM::VER_133 || esmVer == ESM::VER_134;
|
|
||||||
|
|
||||||
// TES4 header size is 4 bytes smaller than TES5 header
|
|
||||||
mCtx.recHeaderSize = isTes4 ? sizeof(ESM4::RecordHeader) - 4 : sizeof(ESM4::RecordHeader);
|
|
||||||
#endif
|
|
||||||
getRecordHeader();
|
getRecordHeader();
|
||||||
if (mCtx.recordHeader.record.typeId == REC_TES4)
|
if (mCtx.recordHeader.record.typeId == REC_TES4)
|
||||||
{
|
{
|
||||||
|
|
|
@ -249,6 +249,9 @@ namespace ESM4
|
||||||
inline unsigned int esmVersion() const { return mHeader.mData.version.ui; }
|
inline unsigned int esmVersion() const { return mHeader.mData.version.ui; }
|
||||||
inline unsigned int numRecords() const { return mHeader.mData.records; }
|
inline unsigned int numRecords() const { return mHeader.mData.records; }
|
||||||
|
|
||||||
|
inline bool hasFormVersion() const { return mCtx.recHeaderSize == sizeof(RecordHeader); }
|
||||||
|
inline unsigned int formVersion() const { return mCtx.recordHeader.record.version; }
|
||||||
|
|
||||||
void buildLStringIndex();
|
void buildLStringIndex();
|
||||||
void getLocalizedString(std::string& str);
|
void getLocalizedString(std::string& str);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue