38 _size =
static_cast<size_t>(
info.st_size);
55 explicit operator bool()
const {
return _base !=
nullptr; }
58 const T*
At(
size_t offset,
size_t count = 1)
const
60 if (!_base ||
count == 0 || offset > _size || (_size - offset) /
sizeof(
T) <
count)
64 return reinterpret_cast<const T*
>(_base + offset);
125 const std::string
fileName = std::filesystem::path(
module.Path).filename().string();
143 return const_cast<uint8_t*
>(
module.Base + value + 2 * sizeof(void*));
148 std::vector<ScanRange>
ranges;
167 .MultipleBases =
vptrOf(
"_ZTVN10__cxxabiv121__vmi_class_type_infoE")};
190 return std::unexpected(offset.error());
197 std::vector<ScanRange>
ranges;
MappedFile(const std::string &path)
MappedFile(const MappedFile &)=delete
const T * At(size_t offset, size_t count=1) const
MappedFile & operator=(const MappedFile &)=delete
void * FindVirtualTableByTypeInfo(std::span< const ScanRange > ranges, const void *typeInfo, intptr_t offsetToTop)
bool FindModuleAndRanges(std::string_view fileName, Image &module, std::vector< ScanRange > &ranges)
@ NotFound
The named thing does not exist (no such player, convar, row).
static std::string ReadFile(const std::filesystem::path &path)
static uint64_t FindSymbolValue(const MappedFile &elf, const std::string &symbol)
Result< int > FindBaseOffsetByTypeInfo(const void *typeInfo, std::string_view baseName, const TypeInfoKinds &kinds)
Result< BaseSubobject > FindBaseIn(const Image &module, std::string_view className, std::string_view baseName)
static const TypeInfoKinds & ExportedTypeInfoKinds()
void * FindVirtualTableByTypeName(std::span< const ScanRange > ranges, std::string_view className)
std::string LengthPrefixedName(std::string_view className)
static bool RangesOf(const Image &module, std::vector< ScanRange > &ranges)
std::expected< T, Error > Result
void * FindVirtualTableIn(const Image &module, std::string_view className)
static Error NotFound(std::string detail)