Blair Config Migrator V3 (#4148)

* Config migrator to handle CVar macros/sections, as well as a few other changes since MacReady.

* One more round of cleanup.

* Move config migrators above SetupGuiElements to allow for migrated window variables to register before windows use them to determine visibility.

* One more.

* Adapt DpadEquips, NavOnL, and PauseAnyCursor CVars to accommodate Pablo moving them to enhancements.
This commit is contained in:
Malkierian 2024-10-16 21:58:31 -07:00 committed by GitHub
parent b7bbb1bb8a
commit 3c5d9faba3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 1506 additions and 6 deletions

View File

@ -1150,6 +1150,13 @@ extern "C" void InitOTR() {
ItemTableManager::Instance = new ItemTableManager();
GameInteractor::Instance = new GameInteractor();
SaveManager::Instance = new SaveManager();
std::shared_ptr<Ship::Config> conf = OTRGlobals::Instance->context->GetConfig();
conf->RegisterConfigVersionUpdater(std::make_shared<SOH::ConfigVersion1Updater>());
conf->RegisterConfigVersionUpdater(std::make_shared<SOH::ConfigVersion2Updater>());
conf->RegisterConfigVersionUpdater(std::make_shared<SOH::ConfigVersion3Updater>());
conf->RunVersionUpdates();
SohGui::SetupGuiElements();
AudioCollection::Instance = new AudioCollection();
ActorDB::Instance = new ActorDB();
@ -1207,11 +1214,6 @@ extern "C" void InitOTR() {
}
}
#endif
std::shared_ptr<Ship::Config> conf = OTRGlobals::Instance->context->GetConfig();
conf->RegisterConfigVersionUpdater(std::make_shared<SOH::ConfigVersion1Updater>());
conf->RegisterConfigVersionUpdater(std::make_shared<SOH::ConfigVersion2Updater>());
conf->RunVersionUpdates();
}
extern "C" void SaveManager_ThreadPoolWait() {

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,11 @@
#include "ConfigUpdaters.h"
#include "ConfigMigrators.h"
#include "soh/Enhancements/audio/AudioCollection.h"
namespace SOH {
ConfigVersion1Updater::ConfigVersion1Updater() : ConfigVersionUpdater(1) {}
ConfigVersion2Updater::ConfigVersion2Updater() : ConfigVersionUpdater(2) {}
ConfigVersion3Updater::ConfigVersion3Updater() : ConfigVersionUpdater(3) {}
void ConfigVersion1Updater::Update(Ship::Config* conf) {
if (conf->GetInt("Window.Width", 640) == 640) {
@ -68,4 +70,14 @@ namespace SOH {
CVarClear(std::string("gAudioEditor.ReplacedSequences." + seq.second.sfxKey).c_str());
}
}
void ConfigVersion3Updater::Update(Ship::Config* conf) {
conf->EraseBlock("Controllers");
for (Migration migration : version3Migrations) {
if (migration.action == MigrationAction::Rename) {
CVarCopy(migration.from.c_str(), migration.to.value().c_str());
}
CVarClear(migration.from.c_str());
}
}
}

View File

@ -12,4 +12,10 @@ namespace SOH {
ConfigVersion2Updater();
void Update(Ship::Config* conf);
};
class ConfigVersion3Updater : public Ship::ConfigVersionUpdater {
public:
ConfigVersion3Updater();
void Update(Ship::Config* conf);
};
}