summaryrefslogtreecommitdiff
path: root/src/port/resource/importers/ResourceUtil.h
blob: 67ed936ac7e60b1d532ae277ea56cd05f6fb9129 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#pragma once

#include "resourcebridge.h"
#include "ResourceManager.h"
#include "Context.h"

namespace SF64 {
template <typename T> T LoadChild(uint64_t crc) {
    if (crc == 0) {
        return nullptr;
    }
    auto path = ResourceGetNameByCrc(crc);
    if (path == nullptr) {
        return nullptr;
    }
    auto asset = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(path);
    return asset != nullptr ? static_cast<T>(asset->GetRawPointer()) : nullptr;
}
}