blob: 5dc4621d5a2ad1617a89b94a73e54b60a4a7412d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include "TorchUtils.h"
#include <Companion.h>
#include <factories/BaseFactory.h>
#include "spdlog/spdlog.h"
uint32_t Torch::translate(const uint32_t offset) {
if(SEGMENT_NUMBER(offset) > 0x01) {
auto segment = SEGMENT_NUMBER(offset);
const auto addr = Companion::Instance->GetFileOffsetFromSegmentedAddr(segment);
if(!addr.has_value()) {
SPDLOG_ERROR("Segment data missing from game config\nPlease add an entry for segment {}", segment);
throw std::runtime_error("Failed to find offset");
}
return addr.value() + SEGMENT_OFFSET(offset);
}
return offset;
}
|