2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-12-27 12:31:50 +00:00

chore: rename iw4 zone constants for zone version

This commit is contained in:
Jan Laupetin
2025-12-23 00:41:09 +01:00
parent 5a0b255d92
commit 8b1afcafaa
3 changed files with 5 additions and 5 deletions

View File

@@ -16,8 +16,8 @@ namespace IW4
static constexpr const char* MAGIC_SIGNED_OAT = "ABff0100"; static constexpr const char* MAGIC_SIGNED_OAT = "ABff0100";
static constexpr const char* MAGIC_UNSIGNED = "IWffu100"; static constexpr const char* MAGIC_UNSIGNED = "IWffu100";
static constexpr const char* MAGIC_IW4X = "IW4x"; static constexpr const char* MAGIC_IW4X = "IW4x";
static constexpr int ZONE_VERSION = 276; static constexpr int ZONE_VERSION_PC = 276;
static constexpr int IW4X_ZONE_VERSION = 3; static constexpr int ZONE_VERSION_IW4x = 3;
static constexpr int ZONE_VERSION_XENON = 269; static constexpr int ZONE_VERSION_XENON = 269;
static_assert(std::char_traits<char>::length(MAGIC_SIGNED_INFINITY_WARD) == sizeof(ZoneHeader::m_magic)); static_assert(std::char_traits<char>::length(MAGIC_SIGNED_INFINITY_WARD) == sizeof(ZoneHeader::m_magic));

View File

@@ -48,12 +48,12 @@ namespace
std::optional<ZoneLoaderInspectionResultIW4> InspectZoneHeaderIw4(const ZoneHeader& header) std::optional<ZoneLoaderInspectionResultIW4> InspectZoneHeaderIw4(const ZoneHeader& header)
{ {
if (endianness::FromLittleEndian(header.m_version) == ZoneConstants::ZONE_VERSION) if (endianness::FromLittleEndian(header.m_version) == ZoneConstants::ZONE_VERSION_PC)
{ {
if (!memcmp(header.m_magic, ZoneConstants::MAGIC_IW4X, std::char_traits<char>::length(ZoneConstants::MAGIC_IW4X))) if (!memcmp(header.m_magic, ZoneConstants::MAGIC_IW4X, std::char_traits<char>::length(ZoneConstants::MAGIC_IW4X)))
{ {
if (*reinterpret_cast<const uint32_t*>(&header.m_magic[std::char_traits<char>::length(ZoneConstants::MAGIC_IW4X)]) if (*reinterpret_cast<const uint32_t*>(&header.m_magic[std::char_traits<char>::length(ZoneConstants::MAGIC_IW4X)])
== ZoneConstants::IW4X_ZONE_VERSION) == ZoneConstants::ZONE_VERSION_IW4x)
{ {
return ZoneLoaderInspectionResultIW4{ return ZoneLoaderInspectionResultIW4{
.m_generic_result = .m_generic_result =

View File

@@ -39,7 +39,7 @@ namespace
ZoneHeader CreateHeaderForParams(const bool isSecure, const bool isOfficial) ZoneHeader CreateHeaderForParams(const bool isSecure, const bool isOfficial)
{ {
ZoneHeader header{}; ZoneHeader header{};
header.m_version = ZoneConstants::ZONE_VERSION; header.m_version = ZoneConstants::ZONE_VERSION_PC;
if (isSecure) if (isSecure)
{ {