MCPcopy Create free account
hub / github.com/OpenSteam001/OpenSteamTool / TableToPatternMap

Function TableToPatternMap

src/Utils/SteamMetadata/PatternLoader.cpp:104–128  ·  view source on GitHub ↗

Section keys are hex literals like "0x82428E37"; each section is a table with optional `name`, `rva` (hex string), and `sig` (IDA-style bytes).

Source from the content-addressed store, hash-verified

102// Section keys are hex literals like "0x82428E37"; each section is a table
103// with optional `name`, `rva` (hex string), and `sig` (IDA-style bytes).
104static PatternMap TableToPatternMap(const toml::table& tbl)
105{
106 PatternMap map;
107 map.reserve(tbl.size());
108 for (auto& [rawKey, val] : tbl) {
109 if (!val.is_table()) continue;
110 auto& sub = *val.as_table();
111
112 const auto parsedKey = OSTPlatform::Numbers::ParseHexUInt32(std::string(rawKey));
113 if (!parsedKey) continue;
114 const uint32_t hashKey = *parsedKey;
115
116 PatternEntry entry;
117 if (auto v = sub["name"].value<std::string>()) entry.name = *v;
118 if (auto v = sub["rva"].value<std::string>()) {
119 if (const auto rva = OSTPlatform::Numbers::ParseHexUInt64(*v)) {
120 entry.rva = static_cast<uintptr_t>(*rva);
121 }
122 }
123 if (auto v = sub["sig"].value<std::string>()) entry.sig = *v;
124
125 map[hashKey] = std::move(entry);
126 }
127 return map;
128}
129
130static PatternMap ParsePatternString(std::string_view body,
131 std::string* outError = nullptr)

Callers 1

ParsePatternStringFunction · 0.85

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected