1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-06 10:45:33 +00:00

Add support for Fallout 4 next-gen update BA2s

This commit is contained in:
Alexei Kotov 2024-04-26 10:30:42 +03:00
parent ec8675ba6f
commit 22fb3d7f83
3 changed files with 32 additions and 14 deletions

View file

@ -116,16 +116,19 @@ namespace Bsa
if (header[0] == 0x00415342) /*"BSA\x00"*/ if (header[0] == 0x00415342) /*"BSA\x00"*/
fail("Unrecognized compressed BSA format"); fail("Unrecognized compressed BSA format");
mVersion = header[1]; mVersion = header[1];
if (mVersion != 0x01 /*FO4*/ && mVersion != 0x02 /*Starfield*/) switch (static_cast<BA2Version>(mVersion))
fail("Unrecognized compressed BSA version"); {
case BA2Version::Fallout4:
case BA2Version::Fallout4NG:
break;
case BA2Version::StarfieldDDS:
fail("Unsupported DDS BA2 version");
default:
fail("Unrecognized DDS BA2 version");
}
type = header[2]; type = header[2];
fileCount = header[3]; fileCount = header[3];
if (mVersion == 0x02)
{
uint64_t dummy;
input.read(reinterpret_cast<char*>(&dummy), 8);
}
} }
if (type == ESM::fourCC("DX10")) if (type == ESM::fourCC("DX10"))

View file

@ -8,6 +8,15 @@ namespace Bsa
{ {
uint32_t generateHash(const std::string& name); uint32_t generateHash(const std::string& name);
uint32_t generateExtensionHash(std::string_view extension); uint32_t generateExtensionHash(std::string_view extension);
enum class BA2Version : std::uint32_t
{
Fallout4 = 1,
StarfieldGeneral = 2,
StarfieldDDS = 3,
Fallout4NG = 7,
Fallout4NG2 = 8,
};
} }
#endif #endif

View file

@ -110,16 +110,22 @@ namespace Bsa
if (header[0] == 0x00415342) /*"BSA\x00"*/ if (header[0] == 0x00415342) /*"BSA\x00"*/
fail("Unrecognized compressed BSA format"); fail("Unrecognized compressed BSA format");
mVersion = header[1]; mVersion = header[1];
if (mVersion != 0x01 /*FO4*/ && mVersion != 0x02 /*Starfield*/) switch (static_cast<BA2Version>(mVersion))
fail("Unrecognized compressed BSA version"); {
case BA2Version::Fallout4:
case BA2Version::Fallout4NG:
case BA2Version::Fallout4NG2:
break;
case BA2Version::StarfieldGeneral:
uint64_t dummy;
input.read(reinterpret_cast<char*>(&dummy), 8);
break;
default:
fail("Unrecognized general BA2 version");
}
type = header[2]; type = header[2];
fileCount = header[3]; fileCount = header[3];
if (mVersion == 0x02)
{
uint64_t dummy;
input.read(reinterpret_cast<char*>(&dummy), 8);
}
} }
if (type == ESM::fourCC("GNRL")) if (type == ESM::fourCC("GNRL"))