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

Function LoadThunkDatabase

Source/Tools/FEXConfig/Main.cpp:44–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42#include <FEXCore/Utils/FileLoading.h>
43
44static void LoadThunkDatabase(fextl::unordered_map<fextl::string, bool>& HostLibsDB, bool Global) {
45 auto ThunkDBPath = FEXCore::Config::GetConfigDirectory(Global) + "ThunksDB.json";
46 fextl::vector<char> FileData;
47 if (!FEXCore::FileLoading::LoadFile(FileData, ThunkDBPath)) {
48 return;
49 }
50
51 FEX::JSON::JsonAllocator Pool {};
52 const json_t* json = FEX::JSON::CreateJSON(FileData, Pool);
53 if (!json) {
54 ERROR_AND_DIE_FMT("Failed to parse JSON from ThunkDB file '{}' - invalid JSON format", ThunkDBPath);
55 }
56
57 const json_t* DB = json_getProperty(json, "DB");
58 if (!DB || JSON_OBJ != json_getType(DB)) {
59 return;
60 }
61
62 for (const json_t* Library = json_getChild(DB); Library != nullptr; Library = json_getSibling(Library)) {
63 HostLibsDB[json_getName(Library)] = false;
64 }
65}
66
67ConfigModel::ConfigModel() {
68 setItemRoleNames(QHash<int, QByteArray> {{Qt::DisplayRole, "display"}, {Qt::UserRole + 1, "optionType"}, {Qt::UserRole + 2, "optionValue"}});

Callers 2

FileManagerMethod · 0.85
HostLibsModelMethod · 0.85

Calls 8

GetConfigDirectoryFunction · 0.85
LoadFileFunction · 0.85
CreateJSONFunction · 0.85
json_getPropertyFunction · 0.85
json_getTypeFunction · 0.85
json_getChildFunction · 0.85
json_getSiblingFunction · 0.85
json_getNameFunction · 0.85

Tested by

no test coverage detected