diff options
| author | KiritoDv <kiritodev01@gmail.com> | 2023-11-21 00:27:23 -0600 |
|---|---|---|
| committer | Lywx <kiritodev01@gmail.com> | 2024-01-31 12:05:40 -0600 |
| commit | 57f61f8e659196586c0bf33bb00765ece006ef9d (patch) | |
| tree | a01342fa2f050b624d0848e878755bc3b9e6e15f /src/utils/TorchUtils.cpp | |
| parent | 06134be57a88ba1f5297dcedf29094b78aa5d5fc (diff) | |
Added WIP Geo Layout Exporter and some code cleanups
Diffstat (limited to 'src/utils/TorchUtils.cpp')
| -rw-r--r-- | src/utils/TorchUtils.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
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 <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->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; +} |
