|
|
@@ -34,7 +34,6 @@ bool frameRateSync = true; |
|
|
|
float autosavePeriod = 15.0; |
|
|
|
bool skipLoadOnLaunch = false; |
|
|
|
std::string patchPath; |
|
|
|
std::map<std::tuple<std::string, std::string>, float> favoriteScores; |
|
|
|
std::vector<NVGcolor> cableColors = { |
|
|
|
nvgRGB(0xc9, 0xb7, 0x0e), // yellow |
|
|
|
nvgRGB(0x0c, 0x8e, 0x15), // green |
|
|
@@ -88,19 +87,6 @@ json_t *toJson() { |
|
|
|
|
|
|
|
json_object_set_new(rootJ, "patchPath", json_string(patchPath.c_str())); |
|
|
|
|
|
|
|
json_t *favoriteModelsJ = json_array(); |
|
|
|
for (auto &pair : favoriteScores) { |
|
|
|
const std::string &plugin = std::get<0>(pair.first); |
|
|
|
const std::string &model = std::get<1>(pair.first); |
|
|
|
float score = pair.second; |
|
|
|
json_t *favoriteJ = json_object(); |
|
|
|
json_object_set_new(favoriteJ, "plugin", json_string(plugin.c_str())); |
|
|
|
json_object_set_new(favoriteJ, "model", json_string(model.c_str())); |
|
|
|
json_object_set_new(favoriteJ, "score", json_real(score)); |
|
|
|
json_array_append_new(favoriteModelsJ, favoriteJ); |
|
|
|
} |
|
|
|
json_object_set_new(rootJ, "favoriteModels", favoriteModelsJ); |
|
|
|
|
|
|
|
json_t *cableColorsJ = json_array(); |
|
|
|
for (NVGcolor cableColor : cableColors) { |
|
|
|
std::string colorStr = color::toHexString(cableColor); |
|
|
@@ -194,34 +180,6 @@ void fromJson(json_t *rootJ) { |
|
|
|
if (patchPathJ) |
|
|
|
patchPath = json_string_value(patchPathJ); |
|
|
|
|
|
|
|
json_t *favoriteModelsJ = json_object_get(rootJ, "favoriteModels"); |
|
|
|
// Legacy: "favorites" was defined under "moduleBrowser" until 1.0. |
|
|
|
if (!favoriteModelsJ) { |
|
|
|
json_t *moduleBrowserJ = json_object_get(rootJ, "moduleBrowser"); |
|
|
|
if (moduleBrowserJ) |
|
|
|
favoriteModelsJ = json_object_get(rootJ, "favorites"); |
|
|
|
} |
|
|
|
if (favoriteModelsJ) { |
|
|
|
favoriteScores.clear(); |
|
|
|
size_t i; |
|
|
|
json_t *favoriteJ; |
|
|
|
json_array_foreach(favoriteModelsJ, i, favoriteJ) { |
|
|
|
json_t *pluginJ = json_object_get(favoriteJ, "plugin"); |
|
|
|
json_t *modelJ = json_object_get(favoriteJ, "model"); |
|
|
|
if (!pluginJ || !modelJ) |
|
|
|
continue; |
|
|
|
std::string plugin = json_string_value(pluginJ); |
|
|
|
std::string model = json_string_value(modelJ); |
|
|
|
// Set default score when migrating favorites from v0.6 |
|
|
|
float score = 1.f; |
|
|
|
json_t *scoreJ = json_object_get(favoriteJ, "score"); |
|
|
|
if (scoreJ) |
|
|
|
score = json_number_value(scoreJ); |
|
|
|
|
|
|
|
favoriteScores[std::make_tuple(plugin, model)] = score; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
json_t *cableColorsJ = json_object_get(rootJ, "cableColors"); |
|
|
|
if (cableColorsJ) { |
|
|
|
cableColors.clear(); |
|
|
|