MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / Load

Method Load

Source/Tools/CodeSizeValidation/Main.cpp:386–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384 }
385
386 void Load() override {
387 fextl::unordered_map<std::string_view, std::string> EnvMap;
388 const uint8_t* Data = TestHeaderData->Data;
389 for (size_t i = 0; i < TestHeaderData->EnvironmentVariableCount; ++i) {
390 // Environment variables are a pair of null terminated strings.
391 const std::string_view Key = reinterpret_cast<const char*>(Data);
392 Data += strlen(reinterpret_cast<const char*>(Data)) + 1;
393
394 const std::string_view Value_View = reinterpret_cast<const char*>(Data);
395 Data += strlen(reinterpret_cast<const char*>(Data)) + 1;
396 std::optional<fextl::string> Value;
397
398#define ENVLOADER
399#include <FEXCore/Config/ConfigOptions.inl>
400
401 if (Value) {
402 EnvMap.insert_or_assign(Key, *Value);
403 } else {
404 EnvMap.insert_or_assign(Key, Value_View);
405 }
406 }
407
408 auto GetVar = [&](const std::string_view id) -> std::optional<std::string_view> {
409 const auto it = EnvMap.find(id);
410 if (it == EnvMap.end()) {
411 return std::nullopt;
412 }
413
414 return it->second;
415 };
416
417 for (auto& it : EnvConfigLookup) {
418 if (auto Value = GetVar(it.first); Value) {
419#define OPT_BASE(type, group, enum, json, default) // Nothing
420#define OPT_STRARRAY(group, enum, json, default) \
421 else if (it.second == FEXCore::Config::ConfigOption::CONFIG_##enum) { \
422 AppendStrArrayValue(it.second, *Value); \
423 }
424
425 if (false) {
426 }
427#include <FEXCore/Config/ConfigValues.inl>
428 else {
429 Set(it.second, *Value);
430 }
431 }
432 }
433 }
434
435private:

Callers 3

HandleGuestSignalMethod · 0.45
SetRootFSAsDefaultFunction · 0.45
OpenFileFunction · 0.45

Calls 2

SetFunction · 0.50
endMethod · 0.45

Tested by

no test coverage detected