From 57f61f8e659196586c0bf33bb00765ece006ef9d Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Tue, 21 Nov 2023 00:27:23 -0600 Subject: Added WIP Geo Layout Exporter and some code cleanups --- src/utils/TorchUtils.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/utils/TorchUtils.cpp (limited to 'src/utils/TorchUtils.cpp') diff --git a/src/utils/TorchUtils.cpp b/src/utils/TorchUtils.cpp new file mode 100644 index 0000000..d63fa0b --- /dev/null +++ b/src/utils/TorchUtils.cpp @@ -0,0 +1,20 @@ +#include "TorchUtils.h" + +#include +#include +#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->GetSegmentedAddr(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; +} -- cgit v1.2.3