summaryrefslogtreecommitdiff
path: root/src/factories/oot/OoTSkeletonTypes.cpp
blob: 2c4237eabe6c2eb8c49f09f3a75e95a7b1a09973 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "OoTSkeletonTypes.h"
#include "spdlog/spdlog.h"
#include "Companion.h"

namespace OoT {

OoTLimbType ParseLimbType(const std::string& str) {
    if (str == "Standard") return OoTLimbType::Standard;
    if (str == "LOD") return OoTLimbType::LOD;
    if (str == "Skin") return OoTLimbType::Skin;
    if (str == "Curve") return OoTLimbType::Curve;
    if (str == "Legacy") return OoTLimbType::Legacy;
    SPDLOG_ERROR("Unknown OoT limb type '{}'", str);
    return OoTLimbType::Invalid;
}

OoTSkeletonType ParseSkeletonType(const std::string& str) {
    if (str == "Normal") return OoTSkeletonType::Normal;
    if (str == "Flex") return OoTSkeletonType::Flex;
    if (str == "Curve") return OoTSkeletonType::Curve;
    SPDLOG_ERROR("Unknown OoT skeleton type '{}'", str);
    return OoTSkeletonType::Normal;
}

std::string ResolveGfxPointer(uint32_t ptr, const std::string& limbSymbol,
                              const std::string& suffix) {
    if (ptr == 0) return "";
    ptr = Companion::Instance->PatchVirtualAddr(ptr);
    auto result = Companion::Instance->GetStringByAddr(ptr);
    if (result.has_value()) {
        return result.value();
    }

    SPDLOG_WARN("Could not resolve GFX pointer 0x{:08X} — YAML enrichment incomplete", ptr);
    return "";
}

} // namespace OoT