wudd/source/utils/WUDUtils.cpp
Maschell 05aea5756b Various improvements including:
- Display name/type of the partition
- Block home menu when launching via HBL
- Use libmocha instead of libiosuhax, which should result in a small performance boost
- Improve logging
- Improve memory management
- Add option to abort dumps
- Slightly improve .wux handling
2022-07-27 08:22:12 -07:00

15 lines
806 B
C++

#include "WUDUtils.h"
#include "FSTUtils.h"
std::optional<uint64_t> WUDUtils::getOffsetOfContent(const std::shared_ptr<WiiUGMPartition> &gamePartition, const std::shared_ptr<FST> &fst, const std::shared_ptr<Content> &content) {
if (content->index == 0) { // Index 0 is the FST which is at the beginning of the partition;
auto &vh = gamePartition->getVolumes().begin()->second;
return gamePartition->getSectionOffsetOnDefaultPartition() + vh->FSTAddress.getAddressInBytes();
}
auto info = FSTUtils::getSectionEntryForIndex(fst, content->index);
if (!info.has_value()) {
DEBUG_FUNCTION_LINE_ERR("Failed to get section for Content");
return {};
}
return gamePartition->getSectionOffsetOnDefaultPartition() + info.value()->address.getAddressInBytes();
}