Пример #1
0
void STRG::_read(athena::io::IStreamReader& reader)
{
    atUint32 langCount = reader.readUint32Big();
    atUint32 strCount = reader.readUint32Big();

    std::vector<FourCC> readLangs;
    readLangs.reserve(langCount);
    for (atUint32 l=0 ; l<langCount ; ++l)
    {
        DNAFourCC lang;
        lang.read(reader);
        readLangs.emplace_back(lang);
        reader.seek(4);
    }

    langs.clear();
    langs.reserve(langCount);
    for (FourCC& lang : readLangs)
    {
        std::vector<std::wstring> strs;
        reader.seek(strCount * 4 + 4);
        for (atUint32 s=0 ; s<strCount ; ++s)
            strs.emplace_back(reader.readWStringBig());
        langs.emplace_back(lang, strs);
    }

    langMap.clear();
    langMap.reserve(langCount);
    for (std::pair<FourCC, std::vector<std::wstring>>& item : langs)
        langMap.emplace(item.first, &item.second);
}
Пример #2
0
void STRG::read(athena::io::IStreamReader& reader)
{
    atUint32 magic = reader.readUint32Big();
    if (magic != 0x87654321)
        Log.report(logvisor::Error, "invalid STRG magic");

    atUint32 version = reader.readUint32Big();
    if (version != 0)
        Log.report(logvisor::Error, "invalid STRG version");

    _read(reader);
}
Пример #3
0
MREA::StreamReader::StreamReader(athena::io::IStreamReader& source,
                                 atUint32 blkCount, atUint32 secIdxCount)
: DNAMP2::MREA::StreamReader(source)
{
    m_blkCount = blkCount;
    m_blockInfos.reserve(blkCount);
    for (atUint32 i=0 ; i<blkCount ; ++i)
    {
        m_blockInfos.emplace_back();
        BlockInfo& info = m_blockInfos.back();
        info.read(source);
        m_totalDecompLen += info.decompSize;
    }
    source.seekAlign32();
    m_secIdxs.reserve(secIdxCount);
    for (atUint32 i=0 ; i<secIdxCount ; ++i)
    {
        m_secIdxs.emplace_back();
        std::pair<DNAFourCC, atUint32>& idx = m_secIdxs.back();
        idx.first.read(source);
        idx.second = source.readUint32Big();
    }
    source.seekAlign32();
    m_blkBase = source.position();
    nextBlock();
}
Пример #4
0
void MREA::ReadBabeDeadToBlender_3(hecl::BlenderConnection::PyOutStream& os,
                                   athena::io::IStreamReader& rs)
{
    atUint32 bdMagic = rs.readUint32Big();
    if (bdMagic != 0xBABEDEAD)
        Log.report(logvisor::Fatal, "invalid BABEDEAD magic");
    os << "bpy.context.scene.render.engine = 'CYCLES'\n"
          "bpy.context.scene.world.use_nodes = True\n"
          "bpy.context.scene.render.engine = 'BLENDER_GAME'\n"
          "bg_node = bpy.context.scene.world.node_tree.nodes['Background']\n";
    for (atUint32 s=0 ; s<4 ; ++s)
    {
        atUint32 lightCount = rs.readUint32Big();
        for (atUint32 l=0 ; l<lightCount ; ++l)
        {
            BabeDeadLight light;
            light.read(rs);
            ReadBabeDeadLightToBlender(os, light, s, l);
        }
    }
}
Пример #5
0
void ANIM::ANIM0::read(athena::io::IStreamReader& reader)
{
    Header head;
    head.read(reader);
    mainInterval = head.interval;

    frames.clear();
    frames.reserve(head.keyCount);
    for (size_t k=0 ; k<head.keyCount ; ++k)
        frames.push_back(k);

    std::map<atUint8, atUint32> boneMap;
    for (size_t b=0 ; b<head.boneSlotCount ; ++b)
    {
        atUint8 idx = reader.readUByte();
        if (idx == 0xff)
            continue;
        boneMap[idx] = b;
    }

    atUint32 boneCount = reader.readUint32Big();
    bones.clear();
    bones.reserve(boneCount);
    channels.clear();
    for (size_t b=0 ; b<boneCount ; ++b)
    {
        bones.emplace_back(boneMap[b], false);
        atUint8 idx = reader.readUByte();
        channels.emplace_back();
        DNAANIM::Channel& chan = channels.back();
        chan.type = DNAANIM::Channel::Type::Rotation;
        if (idx != 0xff)
        {
            bones.back().second = true;
            channels.emplace_back();
            DNAANIM::Channel& chan = channels.back();
            chan.type = DNAANIM::Channel::Type::Translation;
        }
    }

    reader.readUint32Big();
    chanKeys.clear();
    chanKeys.reserve(channels.size());
    for (const std::pair<atUint32, bool>& bone : bones)
    {
        chanKeys.emplace_back();
        std::vector<DNAANIM::Value>& keys = chanKeys.back();
        for (size_t k=0 ; k<head.keyCount ; ++k)
            keys.emplace_back(reader.readVec4fBig());

        if (bone.second)
            chanKeys.emplace_back();
    }

    reader.readUint32Big();
    auto kit = chanKeys.begin();
    for (const std::pair<atUint32, bool>& bone : bones)
    {
        ++kit;
        if (bone.second)
        {
            std::vector<DNAANIM::Value>& keys = *kit++;
            for (size_t k=0 ; k<head.keyCount ; ++k)
                keys.emplace_back(reader.readVec3fBig());
        }
    }

    evnt.read(reader);
}