mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-14 06:10:17 -05:00
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:
parent
b7bbb1bb8a
commit
3c5d9faba3
@ -1150,6 +1150,13 @@ extern "C" void InitOTR() {
|
|||||||
ItemTableManager::Instance = new ItemTableManager();
|
ItemTableManager::Instance = new ItemTableManager();
|
||||||
GameInteractor::Instance = new GameInteractor();
|
GameInteractor::Instance = new GameInteractor();
|
||||||
SaveManager::Instance = new SaveManager();
|
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();
|
SohGui::SetupGuiElements();
|
||||||
AudioCollection::Instance = new AudioCollection();
|
AudioCollection::Instance = new AudioCollection();
|
||||||
ActorDB::Instance = new ActorDB();
|
ActorDB::Instance = new ActorDB();
|
||||||
@ -1207,11 +1214,6 @@ extern "C" void InitOTR() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#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() {
|
extern "C" void SaveManager_ThreadPoolWait() {
|
||||||
|
1480
soh/soh/config/ConfigMigrators.h
Normal file
1480
soh/soh/config/ConfigMigrators.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,11 @@
|
|||||||
#include "ConfigUpdaters.h"
|
#include "ConfigUpdaters.h"
|
||||||
|
#include "ConfigMigrators.h"
|
||||||
#include "soh/Enhancements/audio/AudioCollection.h"
|
#include "soh/Enhancements/audio/AudioCollection.h"
|
||||||
|
|
||||||
namespace SOH {
|
namespace SOH {
|
||||||
ConfigVersion1Updater::ConfigVersion1Updater() : ConfigVersionUpdater(1) {}
|
ConfigVersion1Updater::ConfigVersion1Updater() : ConfigVersionUpdater(1) {}
|
||||||
ConfigVersion2Updater::ConfigVersion2Updater() : ConfigVersionUpdater(2) {}
|
ConfigVersion2Updater::ConfigVersion2Updater() : ConfigVersionUpdater(2) {}
|
||||||
|
ConfigVersion3Updater::ConfigVersion3Updater() : ConfigVersionUpdater(3) {}
|
||||||
|
|
||||||
void ConfigVersion1Updater::Update(Ship::Config* conf) {
|
void ConfigVersion1Updater::Update(Ship::Config* conf) {
|
||||||
if (conf->GetInt("Window.Width", 640) == 640) {
|
if (conf->GetInt("Window.Width", 640) == 640) {
|
||||||
@ -68,4 +70,14 @@ namespace SOH {
|
|||||||
CVarClear(std::string("gAudioEditor.ReplacedSequences." + seq.second.sfxKey).c_str());
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,4 +12,10 @@ namespace SOH {
|
|||||||
ConfigVersion2Updater();
|
ConfigVersion2Updater();
|
||||||
void Update(Ship::Config* conf);
|
void Update(Ship::Config* conf);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ConfigVersion3Updater : public Ship::ConfigVersionUpdater {
|
||||||
|
public:
|
||||||
|
ConfigVersion3Updater();
|
||||||
|
void Update(Ship::Config* conf);
|
||||||
|
};
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user