whiteoutlib 0.1.1

Read and write Blizzard game assets: models (MDX, M2, M3), textures (BLP, DDS, PNG, ...) and archives (CASC, MPQ).
Documentation
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2026 Fernando Sahmkow
//
// AUTO-GENERATED by scripts/gen_d3_sno_defs.py — do not edit manually.

#pragma once

#include "../sno_defs.h"

#include <cstddef>
#include <span>

namespace whiteout {
namespace sno {
namespace d3 {

/// Compiled type registry for Diablo III SNO formats.
///
/// Contains D3-specific type definitions reverse-engineered from binary
/// analysis.  Shares the SnoTypeRegistry interface with d4::SnoTypeRegistry.
class SnoTypeRegistry final : public sno::SnoTypeRegistry {
public:
    /// Get the singleton instance.
    static const SnoTypeRegistry& instance();

    const SnoTypeDef* findType(u32 typeHash) const override;
    u32 typeHashFromKey(u32 key) const override;
    const char* typeName(const SnoTypeDef& def) const override;
    std::span<const SnoFieldDef> fields(const SnoTypeDef& def) const override;
    const char* fieldName(const SnoFieldDef& def) const override;
    u32 typeHashFromName(const char* name) const override;

private:
    SnoTypeRegistry();

    const SnoTypeDef* m_types = nullptr;
    size_t m_typeCount = 0;
    const SnoFieldDef* m_fields = nullptr;
    [[maybe_unused]] size_t m_fieldCount = 0;
    const char* const* m_typeNames = nullptr;
    const char* const* m_fieldNames = nullptr;
    size_t m_fieldNameCount = 0;
};

} // namespace d3
} // namespace sno
} // namespace whiteout