| 42 | #include <FEXCore/Utils/FileLoading.h> |
| 43 | |
| 44 | static 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 | |
| 67 | ConfigModel::ConfigModel() { |
| 68 | setItemRoleNames(QHash<int, QByteArray> {{Qt::DisplayRole, "display"}, {Qt::UserRole + 1, "optionType"}, {Qt::UserRole + 2, "optionValue"}}); |
no test coverage detected