Files
dusklight/mods/randomizer/src/ui/rando_config.cpp
T
2026-08-05 04:43:55 -07:00

119 lines
4.4 KiB
C++

#include "rando_config.hpp"
#include <mods/svc/log.hpp>
#include "../session.hpp"
#include "../tools.h"
#include "../paths.hpp"
#include "../../generator/seedgen/seed.hpp"
#include "../../generator/utility/string.hpp"
#include "rando_seed_generation.hpp"
#include "config_store.hpp"
#include <mutex>
#include <thread>
#include <map>
namespace randomizer::ui {
seedgen::settings::Setting* FindSetting(const std::string& key) {
if (key.empty()) {
mods::log::error("Key is empty! Unable to find setting.");
}
// TODO: handle multi-world selection
auto& settings = GetRandomizerConfig().GetSettings();
try {
return &settings.GetMap().at(key);
} catch (std::exception e) {
mods::log::error("Failed to get Settings Key: {}", key);
}
}
const std::vector<std::pair<std::string, std::string>>& GetStartingInventoryLayoutOrder() {
static const std::vector<std::pair<std::string, std::string>> layoutOrder = {
// { display name , logic item name }
{"Shadow Crystal", "Shadow Crystal"},
{"Horse Call", "Horse Call"},
{"Fishing Rod", "Progressive Fishing Rod"},
{"Slingshot", "Slingshot"},
{"Lantern", "Lantern"},
{"Gale Boomerang", "Gale Boomerang"},
{"Iron Boots", "Iron Boots"},
{"Bow", "Progressive Bow"},
{"Hawkeye", "Hawkeye"},
{"Bomb Bags", "Bomb Bag"},
{"Giant Bomb Bags", "Giant Bomb Bag"},
{"Clawshot", "Progressive Clawshot"},
{"Spinner", "Spinner"},
{"Ball and Chain", "Ball and Chain"},
{"Dominion Rod", "Progressive Dominion Rod"},
{"Empty Bottle", "Empty Bottle"},
{"Auru's Memo", "Aurus Memo"},
{"Ashei's Sketch", "Asheis Sketch"},
{"Sky Book", "Progressive Sky Book"},
{"Sword", "Progressive Sword"},
{"Ordon Shield", "Ordon Shield"},
{"Hylian Shield", "Hylian Shield"},
{"Zora Armor", "Zora Armor"},
{"Magic Armor", "Magic Armor"},
{"Wallet", "Progressive Wallet"},
{"Hidden Skills", "Progressive Hidden Skill"},
{"Poe Souls", "Poe Soul"},
{"Fused Shadows", "Progressive Fused Shadow"},
{"Mirror Shards", "Progressive Mirror Shard"},
{"Gate Keys", "Gate Keys"},
{"Gerudo Desert Bulblin Camp Key", "Gerudo Desert Bulblin Camp Key"},
{"Forest Temple Small Keys", "Forest Temple Small Key"},
{"Goron Mines Small Keys", "Goron Mines Small Key"},
{"Lakebed Temple Small Keys", "Lakebed Temple Small Key"},
{"Arbiter's Grounds Small Keys", "Arbiters Grounds Small Key"},
{"Snowpeak Ruins Small Keys", "Snowpeak Ruins Small Key"},
{"Ordon Pumpkin", "Ordon Pumpkin"},
{"Ordon Cheese", "Ordon Cheese"},
{"Temple of Time Small Keys", "Temple of Time Small Key"},
{"City in the Sky Small Keys", "City in the Sky Small Key"},
{"Palace of Twilight Small Keys", "Palace of Twilight Small Key"},
{"Hyrule Castle Small Keys", "Hyrule Castle Small Key"},
{"Forest Temple Big Key", "Forest Temple Big Key"},
{"Goron Mines Key Shards", "Goron Mines Key Shard"},
{"Lakebed Temple Big Key", "Lakebed Temple Big Key"},
{"Arbiter's Grounds Big Key", "Arbiters Grounds Big Key"},
{"Snowpeak Ruins Bedroom Key", "Snowpeak Ruins Bedroom Key"},
{"Temple of Time Big Key", "Temple of Time Big Key"},
{"City in the Sky Big Key", "City in the Sky Big Key"},
{"Palace of Twilight Big Key", "Palace of Twilight Big Key"},
{"Hyrule Castle Big Key", "Hyrule Castle Big Key"},
{"Gerudo Desert Portal", "Gerudo Desert Portal"},
{"Mirror Chamber Portal", "Mirror Chamber Portal"},
{"Snowpeak Portal", "Snowpeak Portal"},
{"Sacred Grove Portal", "Sacred Grove Portal"},
{"Bridge of Eldin Portal", "Bridge of Eldin Portal"},
{"Upper Zora's River Portal", "Upper Zoras River Portal"}
};
return layoutOrder;
}
std::filesystem::path GetRandomizerPath() {
return paths::GetRandomizerPath() / "randomizer";
}
std::filesystem::path GetRandomizerSettingsPath() {
return GetRandomizerPath() / "settings.yaml";
}
std::filesystem::path GetRandomizerPreferencesPath() {
return GetRandomizerPath() / "preferences.yaml";
}
std::filesystem::path GetRandomizerPresetsPath() {
return GetRandomizerPath() / "presets";
}
std::filesystem::path GetRandomizerSeedsPath() {
return GetRandomizerPath() / "seeds";
}
} // namespace dusk::ui